akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cassert>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define int long long
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const int INF = 1e18;
const int M = 1e9 + 7;





signed main()
{
#ifndef ONLINE_JUDGE
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	int n, l, sum = 0;
	cin >> n >> l;
	int a[400], b[400];
	for(int i = 1; i <= n; ++i){
		a[i] = l + i - 1;
		b[i] = abs(a[i]);
		sum += a[i];
	}
	int x = *min_element(b + 1, b + n + 1);	
	for(int i = 1; i <= n; ++i){
		if(abs(a[i]) == x){
			sum -= a[i];
		}
	}
	cout << sum << endl;

    
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	ll N, K;
	cin >> N >> K;
	vector<ll> A(N);
	for(auto &a : A) cin >> a;
	vector<ll> sum(N+1, 0);
	for(int i=1;i<=N;i++) {
		sum[i] = sum[i-1] + A[i-1];
	}
	map<ll,ll> mp;
	ll ans = 0;
	for(int i=0;i<=N;i++) {
		ll plus = (sum[i] - i) % K;
		if(plus < 0) plus += K;
		mp[plus]++;
		if(i >= K) {
			ll minus = (sum[i-K] - (i-K)) % K;
			mp[minus]--;
		}
		// 自分自身との組
		ans += (mp[plus] - 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 15872
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

// Liバーガー長さ そのうちパティの数
ll a[51], b[51];

ll foo(int n, ll x) {
    if (n == 0) return x;
    ll t = a[n], s = (t - 3) / 2;
    if (x <= 1) return 0;
    if (x >= t - 1) return b[n];
    if (x == s + 1) return b[n - 1];
    if (x == s + 2) return b[n - 1] + 1;
    if (x <= s + 1) return foo(n - 1, x - 1);
    if (x > s + 2) return b[n - 1] + 1 + foo(n - 1, x - (s + 2));
    throw;
}

int main() {
    int n;
    cin >> n;

    ll x;
    cin >> x;

    a[0] = 1;
    b[0] = 1;
    for (int i = 0; i < n; i++) {
        a[i + 1] = a[i] * 2 + 3;
        b[i + 1] = b[i] * 2 + 1;
    }

    cout << foo(n, x) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>

using namespace std;

queue<int> card;
int k;
int n, m;

void cut(int k);
void riffle();

int main()
{
	scanf("%d", &n);
	scanf("%d", &m);
	
	for (int i = 1; i <= n * 2; i++){
		card.push(i);
	}
	
	while (m-- > 0){
		scanf("%d", &k);
		k == 0 ? riffle() : cut(k);
	}
	while (!card.empty()){
		printf("%d\n", card.front());
		card.pop();
	}
	
	return 0;
}

void cut(int k)
{
	queue<int> tmp;
	while (k-- > 0){
		tmp.push(card.front());
		card.pop();
	}
	while (!tmp.empty()){
		card.push(tmp.front());
		tmp.pop();
	}
}

void riffle()
{
	queue<int> t1, t2;
	
	for (int i = 0; i < n; i++){
		t1.push(card.front());
		card.pop();
	}
	for (int i = 0; i < n; i++){
		t2.push(card.front());
		card.pop();
	}
	while (!t1.empty()){
		card.push(t1.front());
		card.push(t2.front());
		t1.pop();
		t2.pop();
	}
}

Measured memory_bytes: 1056
#include <iostream>
#include <algorithm>
using namespace std;

void sort(int* begin, int* end) {
    std::sort(begin, end);
}

int high[10];

int main() {
    for(int i = 0; i < 10; i++) {
        cin >> high[i];
    }
    sort(high, high + 10);
    cout << high[9] << endl;
    cout << high[8] << endl;
    cout << high[7] << endl;
    return 0;
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

class FenwickTree {
private:
    ll n;
    vector<ll> dat;
public:
    FenwickTree(ll _n): n(_n), dat(_n+1, 0) {}
    FenwickTree(ll _n, ll init): n(_n), dat(_n+1, 0) {
        for (ll i = 0; i <= _n; i++) {
            add(i, init);
        }
    }
    
    void add(ll idx, ll value) {
        idx++;
        while(idx <= n) {
            dat[idx] += value;
            idx += idx & -idx;
        }
    }

    ll query(ll l, ll r) {
        ll ans = 0;
        r++;
        while(r > 0) {
            ans += dat[r];
            r -= r & -r;
        }
        while(l > 0) {
            ans -= dat[l];
            l -= l & -l;
        }
        return ans;
    }
};

bool comp(pair<ll,ll> a, pair<ll,ll> b)
{
    return a.second - a.first < b.second - b.first;
}

int main(void)
{
    ll n, m;
    cin >> n >> m;

    vector< pair<ll,ll> > A(n);
    for (ll i = 0; i < n; i++) {
        cin >> A[i].first >> A[i].second;
    }
    sort(A.begin(), A.end(), comp);

    FenwickTree ft(m+2);

    ll idx = 0;
    for (ll d = 1; d < m+1; d++) {
        ll count = 0;
        for(; idx < n && A[idx].second - A[idx].first < d; idx++) {
            ft.add(A[idx].first, 1);
            ft.add(A[idx].second+1, -1);
        }
        for (ll i = 0; i < m+1; i += d) {
            count += ft.query(0, i);
        }
        count += n - idx;
        cout << count << endl;
    }
}


Measured memory_bytes: 6400
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;



int main(){
  lll ii,jj,kk;
  long n;
  cin >> n;

  vector<long> a;
  a.resize(n);

  for(ii=0;ii<n;ii++){
    cin >> a[ii];
  }
  double sum;
  sum =0;
  
  for(ii=0;ii<n;ii++){
    sum += 1.0/a[ii]; 
  }
  cout << 1.0/sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    int n,ans=0;
    cin>>n;
    int m=n;
    while(m){
        ans+=m%10;
        m/=10;
    }
    if(n%ans==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(ll i=0; i<N; i++)
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll N_MAX = 100000;

int main(){
    ll n; cin >> n;
    ll l[n+1]; rep(i,n) cin >> l[i];
  	l[n] = 2*1000+1;
 
    sort(l, l+n);
    ll ans = 0;
    rep(i,n){
        for(ll j = i+1; j<n; j++){
          	auto itr = lower_bound(l, l+n+1, l[j]+l[i]);             
            //cout << itr - l << endl;
            ll num = (itr - l) - (j+1);
            ans += num;
        
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
///====================== TEMPLATE STARTS HERE =====================///
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define pb push_back
#define MP make_pair
#define ff first
#define ss second
#define ABS(x) ((x)<0?-(x):(x))
#define FABS(x) ((x)+eps<0?-(x):(x))
#define LCM(x,y) (((x)/gcd((x),(y)))*(y))
#define POPCOUNT __builtin_popcountll
#define Set(N,p) ((N)|((1LL)<<(p)))
#define Reset(N,p) ((N)&(~((1LL)<<(p))))
#define Check(N,p) (!(((N)&((1LL)<<(p)))==(0)))
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL)

#define LL long long
#define LLU long long unsigned int
typedef pair < int, int > pii;
typedef pair < LL, LL > pll;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef vector<pll> vll;

#ifdef s_da_sailor
    #define line                    cout << "\n===================\n"
    #define trace(...)              __f( #__VA_ARGS__ , __VA_ARGS__ )
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " = " << arg1 << "\n";
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " = " << arg1 << " , ";
    __f(comma + 1, args...);
    }
#else
    #define line
    #define trace(...)
#endif // s_da_sailor

inline LL gcd ( LL a, LL b ) {
    a = ABS ( a ); b = ABS ( b );
    while ( b ) { a = a % b; swap ( a, b ); } return a;
}

LL ext_gcd ( LL A, LL B, LL *X, LL *Y ){
    LL x2, y2, x1, y1, x, y, r2, r1, q, r;
    x2 = 1; y2 = 0;
    x1 = 0; y1 = 1;
    for (r2 = A, r1 = B; r1 != 0; r2 = r1, r1 = r, x2 = x1, y2 = y1, x1 = x, y1 = y ) {
        q = r2 / r1;
        r = r2 % r1;
        x = x2 - (q * x1);
        y = y2 - (q * y1);
    }
    *X = x2; *Y = y2;
    return r2;
}

inline LL modInv ( LL a, LL m ) {
    LL x, y;
    ext_gcd( a, m, &x, &y );
    x %= m;
    if ( x < 0 ) x += m;
    return x;
}

inline LL bigmod ( LL a, LL p, LL m ) {
    LL res = 1 % m, x = a % m;
    while ( p ) {
        if ( p & 1 ) res = ( res * x ) % m;
        x = ( x * x ) % m; p >>= 1; /// For bigmod2 multiply here using mulmod
    }
    return res;
}


//int knightDir[8][2] = { {-2,1},{-1,2},{1,2},{2,1},{2,-1},{-1,-2},{1,-2},{-2,-1} };
//int dir4[4][2] = {{-1,0},{0,1},{1,0},{0,-1}};
//int dir8[8][2] = {{-1,0},{0,1},{1,0},{0,-1},{-1,-1},{1,1},{1,-1},{-1,1}};
const LL inf = 2147383647;
const LL mod = 1000000007;
const double pi = 2 * acos ( 0.0 );
const double eps = 1e-11;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); /// For generating random numbers

///======================  TEMPLATE ENDS HERE  =====================///

void solve() {
    LL D, T, S;
    cin >> D >> T >> S;
    if(T*S>=D) cout << "Yes\n";
    else cout << "No\n";
}

int main () {
    #ifdef s_da_sailor
    freopen ( "input.txt", "r", stdin );
    //freopen ( "output.txt", "w", stdout );
    #endif // s_da_sailor

    fast_cin;

    solve();

    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int N,K;
    string S;
    cin>>N>>S>>K;
    char b=S[K-1];
    REP(i,S.size()){
        if(S[i]!=b){
            printf("*");
        } else {
            printf("%c",S[i]);
        }
    }
    printf("\n");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
#define pb push_back


int main()
{
    int tst=1;
    /*scanf("%d",&tst);*/
    while(tst--) 
	{
		ll n,k,i,r=0;
		cin >> n >> k;
		ll a[n];
		for(i=0;i<n;i++)
		{
			cin >> a[i];
		}
		if(k==1)
		{
			cout << a[0] << endl;
			return 0;
		}
		map<ll,ll>mp;
		vector<ll>v;
		i=0;
		v.push_back(a[0]);
		mp[v[0]]=0;
		while(1)
		{
			if(mp.count(a[v[i]-1]))
			{
				r=mp[a[v[i]-1]];
				break;
			}
			v.push_back(a[v[i]-1]);
			//cout << v[i] << endl;
			i++;
			mp[v[i]]=i;
		}
		//for(i=0;i<v.size();i++)cout << v[i] << endl;
		//cout << r << endl;
		k--;
		ll sz=v.size();
		if(k<sz)
		{
			cout << v[k] << endl;
		}
		else
		{
			if(r==0)
			{
				cout << v[k%sz] << endl;
				return 0;
			}
			else
			{
				v.erase(v.begin(),v.begin()+r);
				sz=v.size();
				cout << v[(k-r)%sz] << endl;
			}
		}
    }
    return 0;
}


Measured memory_bytes: 18484
using System;
class Program
    {
        static void Main(string[] args)
        {
            double[] input1 = new double[2];
            input1[0] = double.Parse(Console.ReadLine());
            input1[1] = double.Parse(Console.ReadLine());
            Console.WriteLine(new Calu().calu(input1));
        }
        public class Calu {
            public string calu(double[] input1){
                if(input1[0]<input1[1]){
                    return "LESS";
                }else if(input1[0]>input1[1]){
                    return "GREATER";
                }else{ return "EQUAL"; }
                
            } 
        }

    }

Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
int N;
string s, t;
int main() {
	cin >>N>> s >> t;
	string ml = s + t;
	string str;
	
	bool comp = false;
	for (int i = 0; i < 2 * N; ++i) {
		bool flag = true;
		if (ml[i] == t[0]) {
			for (int j = 0; i+j < N; ++j) {
				if (ml[i + j] != t[j]) {
					flag = false;
				}
			}
			if (flag) {
				for (int j = 0; j < N; ++j) {
					str += t[j];
				}
				comp = true;
			}
		}
		if (comp) break;
		str += ml[i];
	}
	cout << str.size() << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1e9+5
#define int long long
#define LINF 1000000000000000005

int n,x,y,k[100005],r,v[100005],t[100005],ans,f;

vector <int> g[100005];

void DFS(int nod){
    v[nod]=1;
    int cnt1=0,cnt0=0;
    for(int i : g[nod]){
        if(!v[i]){
            DFS(i);
            if(!t[i]) cnt0++;
            else cnt1++;
        }
    }
    if(cnt1 && !cnt0) t[nod]=0;
    else if(cnt0==1) t[nod]=1;
    else if(cnt0>1) f=1;
}

int32_t main(){
    ios_base :: sync_with_stdio(0);
    cin >> n;
    for(int i=1;i<n;i++){
        cin >> x >> y;
        g[x].pb(y); g[y].pb(x);
        k[x]++; k[y]++;
    }
    if(n==2){
        cout << "Second";
        return 0;
    }
    r=1;
    while(k[r]==1) r++;
    DFS(r);
    if(f || !t[r]) cout << "First";
    else cout << "Second";
}


Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N, M;
    cin >> N >> M;
    string S;
    cin >> S;

    reverse(all(S));

    vector<int> maze;
    rep(i, S.size()) {
        if (S[i] == '0') {
            maze.push_back(i);
        }
    }

    int res = 0;
    vector<int> ans;
    while (1) {
        int index = upper_bound(all(maze), res + M) - maze.begin();
        index--;
        if (res >= maze[index]) {
            cout << -1 << endl;
            return 0;
        }
        ans.push_back(maze[index] - res);
        res = maze[index];
        if (res == N) break;
    }

    reverse(all(ans));
    rep(i, ans.size()) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 4300
#include <iostream>
#include <cmath>
#include <string>
#include <map>
#include <queue>

using namespace std;
#define MAX 3
#define MAX2 9

struct Puzzle{
  int f[MAX2];
  int space;
  string path;
  
  bool operator < (const Puzzle &p) const{
    for(int i=0;i<MAX2;i++){
      if(f[i]==p.f[i])continue;
      return f[i]>p.f[i];
    }
    return false;
  }
};

static const int dx[4]={-1,0,1,0};
static const int dy[4]={0,-1,0,1};
static const char dir[4]={'u','l','d','r'};

bool isTarget(Puzzle p){
  for(int i=0;i<MAX2;i++)if(p.f[i]!=(i+1))return false;
  return true;
}
string BFS(Puzzle s){
  queue<Puzzle>Q;
  map<Puzzle,bool>V;
  Puzzle u,v;
  s.path="";
  Q.push(s);
  V[s]=true;

  while(!Q.empty()){
    u=Q.front();
    Q.pop();
    if(isTarget(u))return u.path;
    int sx=u.space/MAX;
    int sy=u.space%MAX;
    for(int r=0;r<4;r++){
      int tx=sx+dx[r];
      int ty=sy+dy[r];
      if(tx<0 || ty<0 || tx>=MAX || ty>=MAX)continue;
      v=u;
      swap(v.f[u.space],v.f[tx*MAX+ty]);
      v.space=tx*MAX+ty;
      if(!V[v]){
	V[v]=true;
	v.path += dir[r];
	Q.push(v);
      }
    }
  }
  return "umsolvable";
}

int main() {
  Puzzle in;
  for(int i=0;i<MAX2;i++){
    cin >> in.f[i];
    if(in.f[i]==0){
      in.f[i]=MAX2;
      in.space=i;
    }
  }
  string ans=BFS(in);
  cout << ans.size() << endl;
  return 0;
}



Measured memory_bytes: 30632
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long l,r;
  scanf("%lld%lld", &l,&r);

  int ans = 2019;

  int ref = 0;


  for(long long i=l+ref; i<=l+2018;++i){
    for(long long j=l+ref+1; j<=l+2019;++j){
      if(j>r) break;
      long long hold = (i*j)%2019;
      if(hold<ans) ans = hold;
      if(ans==0) break;
    }
    ++ref;
    if(l+ref>r-1) break;
    if(ans == 0) break;
  }





  cout << ans << endl;



}



Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created 2017/06/01.
 */
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    ArrayList<Double> ary = new ArrayList<>();

    while (true) {
      double input = Integer.parseInt(sc.next());
      ary.add(input);
      if (ary.size() == 2) break;
    }
    
    double a = ary.get(0);
    double b = ary.get(1);
    
    int ans1 = (int)(a / b);
    int ans2 = (int)(a % b);
    double ans3 = a / b;

    System.out.printf("%d",ans1);
    System.out.print(" ");
    System.out.printf("%d",ans2);
    System.out.print(" ");
    System.out.printf("%f",ans3);
  }
}

Measured memory_bytes: 26312
#include <iostream>
#include <cstdio>
using namespace std;

int count(int a, int b, int c) {
    int sum = 0;
    if (c & 1) {
        while (a <= b) {
            if (a & 1 && c % a == 0) {
                sum++;
            }
            a++;
        }
    }
    else {
        while (a <= b) {
            if (c % a == 0) {
                sum++;
            }
            a++;
        }
    }
    return sum;
}

int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    cout << count(a, b, c) << endl;
    return 0;
}


Measured memory_bytes: 3244
import math

def plot(x,y):
  print(f'{x:.8f} {y:.8f}')

def Koch(n,x1,y1,x2,y2):
  if n ==0:
    plot(x1,y1)
    return
  sx = (2*x1+x2)/3
  sy = (2*y1+y2)/3
  tx = (x1+2*x2)/3
  ty = (y1+2*y2)/3
  ux = (tx-sx)*(1/2)-(ty-sy)*(math.sqrt(3)/2)+sx
  uy = (tx-sx)*(math.sqrt(3)/2)+(ty-sy)*(1/2)+sy
  Koch(n-1, x1,y1, sx,sy)
  Koch(n-1, sx,sy, ux,uy)
  Koch(n-1, ux,uy, tx,ty)
  Koch(n-1, tx,ty, x2,y2)

n=int(input())
Koch(n, 0,0, 100,0)
plot(100, 0)


Measured memory_bytes: 5752
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<61);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n,i,j;
ll ans;
string s,x,y;
map<pair<string,string>,ll>mp;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n>>s;
    for(i=0;i<(1<<n);i++)
    {
        x="",y="";
        for(j=0;j<n;j++)
        {
            if(i&(1<<j))x+=s[n+j];
            else y+=s[n+j];
        }
        reverse(x.begin(),x.end());
        reverse(y.begin(),y.end());
        mp[{x,y}]++;
    }
    for(i=0;i<(1<<n);i++)
    {
        x="",y="";
        for(j=0;j<n;j++)
        {
            if(i&(1<<j))x+=s[j];
            else y+=s[j];
        }
        //cout<<x<<" "<<y<<" "<<mp[{x,y}]<<endl;
        ans+=mp[{x,y}];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 87040
using System;
using System.Collections.Generic;
using System.Linq;


class Program
{
    static void Main(string[] args)
    {
        var nk = Console.ReadLine().Split(' ');
        var n = long.Parse(nk[0]);
        var k = long.Parse(nk[1]);
        var arr = Console.ReadLine().Split(' ').Select(v => long.Parse(v)).ToList<long>();

        long b = 0;
        long c = 0;
        for (var i = 0; i < n; i++)
        {
            for (var j = 0; j < n; j++)
            {
                if (arr[i] > arr[j])
                {
                    c++;
                    if (i < j) b++;
                }
            }
        }

        long ret = 0;
        long tmp = (k * (k - 1) / 2) % 1000000007;
        ret += b * k % 1000000007;
        ret += c * tmp % 1000000007;
        ret %= 1000000007;

        Console.Write(ret);
    }
}


Measured memory_bytes: 13384
#include<bits/stdc++.h>
using namespace std;
int main(){
   long long n, i, cnt[100100]={0}, micnt=0, ans=-1;
   cin >> n;
   for(i=0;i<n;i++){
      long long a;
      cin >> a;
      cnt[a]++;
      cnt[a+1]++;
      if(a!=0) cnt[a-1]++;
      else micnt++;
   }
   for(auto x : cnt){
      ans=max(ans, x);
   }
   ans=max(ans, micnt);
   cout << ans <<endl;
   return 0;
}



Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int N = sc.nextInt();
        if (N == 0) {
            System.out.println(X);
            return;
        }
        List<Integer> ps = new ArrayList<Integer>();
        for (int i = 0; i < N; i++) {
            ps.add(sc.nextInt());
        }
        Collections.sort(ps);

        int min = Integer.MAX_VALUE;
        int ans = -1;

        int st = ps.get(0) - 1;
        st = X < st ? X : st;
        int en = ps.get(ps.size() - 1) + 1;
        en = en < X ? X : en;
        for (int i = st; i <= en; i++) {
            if (!ps.contains(i)) {
                int res = Math.abs(X - i);
                if (res < min) {
                    min = res;
                    ans = i;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 36012
read = lambda:list(map(int, input().split()))
n, m, k = read()
a = read()
b = read()
at, bt = [0], [0]
for i in range(n):
    at.append(at[i] + a[i])
for i in range(m):
    bt.append(bt[i] + b[i])
ans, j = 0, m
for i in range(n + 1):
    if at[i] > k:
        break
    while bt[j] > k - at[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Measured memory_bytes: 47544
#include <iostream>

using namespace std;
int d1[110],d2[110];
int main(){
    int i,j,n; cin >> n;
    for(i=0;i<n;i++) cin >> d1[i] >> d2[i];
    for(i=2;i<n;i++){
        bool f = true;
        for(j=i;j>=i - 2;j--){
            if(d1[j]!=d2[j]) f = false;
        }
        if(f){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3628
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char) 
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
    
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let (a, b): (i32, i32) = (read(), read());
  println!("{}", if a > 9 || b > 9 { -1 } else { a * b });
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

void call(int n){
    int i = 1;

    while (i <= n) {
        int x = i;
        if ( x % 3 == 0 ){
            cout << " " << i;
        }
        else {
            do {
                if ( x % 10 == 3 ){
                    cout << " " << i;
                    break;
                }
                x /= 10;
            } while (x);
        }
        i++;
    }
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    call(n);
}


Measured memory_bytes: 3100
//love yjl forever
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int INF=0x3f3f3f3f;
ll n;
int main()
{
/*	freopen("","r",stdin);
	freopen("","w",stdout);*/
	int i;
	cin>>n;
	int ans=0;
	int x=sqrt(n);
	for(i=2;i<=x;i++)
	{
		if(n==1) break;
		int tmp=0;
		while(n%i==0)
		{
			tmp++;
			n=n/i;
		}
//		cout<<i<<" "<<tmp<<endl;
		for(int j=1;j<=1000;j++)
		{
//			cout<<tmp<<" "<<j<<endl;
			if(tmp-j>=0)
			{
				ans++;
				tmp-=j;
			}
			else 
				break;
		}
	}
	if(n!=1) ans++;
	cout<<ans<<endl;
}

Measured memory_bytes: 3704
import java.util.*;

public class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        int plus = a+b;
        int minus = a-b;
        int multi = a*b;

        int an = Math.max(plus, minus);
        int ans = Math.max(an, multi);
        System.out.print(ans);

    }
}

Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back 
const int mod=1e9+7;
long long  dp[3005][3005];
/*
ll solve(vector<ll>v,int i,int j){
	// for(int i=0; i<v.size(); i++)
      //   { cout<<v[i]<<" ";  }
		// cout<<endl;
	       if(i==j)
	        return dp[i][j]=v[i];
	       if(j-i == 1)
	         return dp[i][j]=max(v[i]-v[j],v[j]-v[i]);
	      
	       if(dp[i][j]!=-1)
	          return dp[i][j];
	          
		
	        ll sum1= v[i]-solve(v,i+1,j);
	        ll sum2=v[j]-solve(v,i,j-1);
	      //  cout<<sum1<<" "<<sum2<<" "<<i<<" "<<j<<endl;
	  return dp[i][j]= max(sum1 ,  sum2);
}  */
int main(){
      ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);
      ll n;
         cin>>n;
         vector<ll>v(n);
         ll sum=0;
         for(int i=0; i<n; i++)
         { cin>>v[i];
			  sum+=v[i];}
			  memset(dp,-1,sizeof(dp));
       //  cout<<solve(v,0,n-1)<<endl;
         
         for(int i=0; i<n; i++)
            dp[i][i]=v[i];
           
         for(int i=1; i<n; i++) {
            for(int j=0; j<n-i ;j++){
			    int k=i+j;
			    dp[k][j]=max(v[k]-dp[k-1][j], v[j]-dp[k][j+1]);
		      
		   }
		}
		cout<<dp[n-1][0]<<endl;
     }


Measured memory_bytes: 70784
def main():
    reversi = input()
    answer = 0
    count_black = [0] * len(reversi)
    if reversi[0] == "B":
        count_black[0] = 1
    for i in range(1, len(reversi)):
        if reversi[i] == "B":
            count_black[i] = count_black[i - 1] + 1
        else:
            count_black[i] = count_black[i - 1]
    for i in range(len(reversi)):
        if reversi[i] == "W":
            answer += count_black[i]
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 11240
#include <iostream>
using namespace std;

int main()
{
	int nn, max = 0, ans = 0;
	bool flag;
	cin >> nn;
	int hh[nn];
	for(int ii = 0;ii < nn;ii++)
	{
		cin >> hh[ii];
		if(max < hh[ii])
		{
			max = hh[ii];
		}
	}
	for(int ii = 0;ii < max;ii++)
	{
		flag = false;
		for(int jj = 0;jj < nn;jj++)
		{
			if(hh[jj] > 0 && !flag)
			{
				flag = true;
				ans++;
			}
			else if(hh[jj] <= 0 && flag)
			{
				flag = false;
			}
			hh[jj]--;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define MAXN 100005
#define X first
#define Y second
#define mod 1000000007
#define inf 1e18
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);
ll n,i,j,k;

int main()
{
    fastio;
    cin>>n;
    string s,t;
    cin>>s>>t;
    for(i=0;i<n;i++) cout<<s[i]<<t[i];
    cout<<endl;
}


Measured memory_bytes: 256
al=0
tyo=0
ei=0
don=0

while True:
    s=list(map(int,input().split())) 
    s.sort(reverse=True)
    if s[0]+s[1]>s[2] and s[1]+s[2]>s[0] and s[2]+s[0]>s[1]:
        al+=1
        tmp=s[0]*s[0]-(s[1]*s[1]+s[2]*s[2])
        if tmp==0:
           tyo+=1
        elif tmp<0:
            ei+=1
        else:
            don+=1
    else:
        print(al,tyo,ei,don)
        break



Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
int q;
long long a,b;
long long solve(long long a,long long b){
	long long lo=0,hi=6e9;
	long long ans=0;
	while(lo<=hi){
		long long mi=(lo+hi)>>1;
		long long tmp=0;
		for(long long i=max(mi/2-50,1LL);i<=min(mi/2+50,mi);i++){
			long long L=i;
			if(i>=a)
				L++;
			long long R=mi+1-i;
			if(i<=mi-b+1)
				R++;
			tmp=max(tmp,L*R);
		}
		if(tmp<a*b){
			ans=mi;
			lo=mi+1;
		}
		else{
			hi=mi-1;
		}
	}
	return ans;
}
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>q;
	while(q--){
		cin>>a>>b;
		cout<<solve(a,b)<<endl;
	}
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;

template <typename T>
class weighted_quick_find {
	using pid = pair<int, T>;
	vector<pair<int, T>> data;
	vector<vector<int>> all;
public:
	weighted_quick_find(int n) : data(n), all(n, vector<int>(1)) {
		for (int i = 0; i < n; i++) {
			data[i].first = i;
			all[i][0] = i;
		}
	}
	void unite(int a, int b, T d) {
		if (same(a, b)) return;
		d += data[a].second - data[b].second;
		a = data[a].first;
		b = data[b].first;
		if (all[a].size() < all[b].size()) swap(a, b), d = -d;
		for (auto& id : all[b]) {
			data[id] = { a, data[id].second + d };
		}
		copy(all[b].begin(), all[b].end(), back_inserter(all[a]));
	}
	bool same(int a, int b) const {
		return data[a].first == data[b].first;
	}
	T dist(int a, int b) const {
		return data[b].second - data[a].second;
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, q;
	cin >> n >> q;
	weighted_quick_find<int> wqf(n);
	while (q--) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com == 0) {
			int z;
			cin >> z;
			wqf.unite(x, y, z);
		}
		else if (wqf.same(x, y)) {
			printf("%d\n", wqf.dist(x, y));
		}
		else {
			puts("?");
		}
	}
	return 0;
}



Measured memory_bytes: 10292
#include<bits/stdc++.h>
using namespace std;


int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[101];
  int f=0;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    if(a[i]%2==1 && i%2==1){
      f++;
    }
  }
  cout<<f<<endl;
}
       
  


Measured memory_bytes: 3604
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int n,m;
  cin>>n>>m;
  vector2d<char> submit(n+1,vector<char>(0));
  for(int i=0;i<m;i++){
    int p;
    string res;
    cin>>p>>res;
    submit[p].push_back(res.front());
  }
  int ac_count=0,penalty=0;
  for(int prob=1;prob<=n;prob++){
    int tmp=0;
    for(auto c:submit[prob]){
      if(c=='A'){
        ac_count++;
        penalty+=tmp;
        break;
      }else{
        tmp++;
      }
    }
  }
  cout<<ac_count<<" "<<penalty<<endl;


  return 0;
}




Measured memory_bytes: 5760
#include<stdio.h>
#include<iostream>
using namespace std;

int main(){
	int H,W,M;
	
	while(1){
		cin >> H >> W ;
		if(W==0&&H==0)return 0;
		if(W%2==0&&H%2==0){
			for(int i=0;i<H/2;i++){
				for(int i=0;i<W/2;i++){
					cout << "#." ;
				}
				cout << endl;
				for(int i=0;i<W/2;i++){
					cout << ".#" ;
				}
				cout << endl;
			}
			cout << endl;
			
		}else if(W%2==0&&H%2==1){
			for(int i=0;i<H/2;i++){
				for(int i=0;i<W/2;i++){
					cout << "#." ;
				}
				cout << endl;
				for(int i=0;i<W/2;i++){
					cout << ".#" ;
				}
				cout << endl;
			}
			for(int i=0;i<W/2;i++){
					cout << "#." ;
				}
			cout << endl << endl;
		
		}else if(W%2==1&&H%2==0){
			for(int i=0;i<H/2;i++){
				for(int i=0;i<W/2;i++){
					cout << "#." ;
				}
				cout << "#" << endl;
				for(int i=0;i<W/2;i++){
					cout << ".#" ;
				}
				cout << "." << endl;
			}
			cout << endl;
			
		}else if(W%2==1&&H%2==1){
			for(int i=0;i<H/2;i++){
				for(int i=0;i<W/2;i++){
					cout << "#." ;
				}
				cout << "#" << endl;
				for(int i=0;i<W/2;i++){
					cout << ".#" ;
				}
				cout << "." << endl;
			}
			for(int i=0;i<W/2;i++){
					cout << "#." ;
			}
			cout << "#" << endl << endl;
			
		}
	
	}
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>

int sum(int s,int e,int dif,int *a){
  int s1=0,s2=0;
  for(int i=0;i<s;i++)
    s1+=a[i];
  
  for(int i=s;i<e;i++)
    s2+=a[i];
  if(s==0)
    dif=s1-s2;
  
  if(dif*dif>=(s1-s2)*(s1-s2))
    dif=s1-s2;
  
  if(s==(e-1))
    return dif;
  
  return sum(s+1,e,dif,a);
}
int main(){
  int N;
  
  scanf("%d",&N);
  
  int a[100];
  
  for(int i=0;i<N;i++)
    scanf("%d",&a[i]);
  
  int ans;
  ans=sum(0,N,0,a);
  if(ans<0)
    ans=ans*(-1);
  printf("%d\n",ans);
}
  
  

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;

int main() {
    long long n;
    cin >> n;
    vector<int> a(20);
    int k=-1;
    while(n>0){
        long long  r = n%26;
        if(r==0) r=26;
        //cout << r <<  " ";
        k++;
        a[k] = r;
        n = (n-r)/26;
    }
    for(int i=k; i>=0; i--){
        cout << (char)('a' + a[i] - 1);
    }
    


}

Measured memory_bytes: 3636
x,k,d = map(int,input().split())
x_max = x+k*d
x_min = x-k*d
if x_max<=0:print(-x_max)
elif x_min>=0:print(x_min)
else:
    t = x_max%(2*d)
    t2 = -t+2*d
    print(min(t,t2))

Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define am 998244353
#define INFi 2147483647
#define INFl 9223372036854775807LL
#define fi first
#define se second
#define be begin()
#define en end()  
int d[1000000];
int dp[1000][1000];
signed main(){
// __builtin_ctz(N);      Nを２で何回割り切れるかを返す
//(n+1)*n/2;              １からNまでの総和を求める式
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    int c;
    int e,f,q=0,w=0;
    cin>>a>>b;
    for(int i=0;i<a;i++){
      cin>>d[i];
      q+=d[i];
    }
  if(q<=b){
    if(q==b) cout<<a;
    else cout<<a-1;
  }
  else{
    sort(d,d+a);
    for(int i=0;i<a;i++){
      if(b-d[i]>=0){
        b-=d[i];
        w++;
      }
      else break;
    }
    cout<<w;
  }
  cout<<"\n";
  }


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;

int main() {

    // input from txt （提出時にこの箇所は削除すること）
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    
    int N;
    cin >> N;
    vector<int> ans(N);
    for(int i=0; i<N-1; i++){
        int x;
        cin >> x;
        ans[x-1]++;
    }
    
    for(int i=0; i<N; i++){
        cout << ans[i] << endl;
    }
    
}

Measured memory_bytes: 3984
(let ((x (concatenate 'list (read-line))))

  (defun comma-to-space (lst)
    (labels ((f (l acc)
                (if (null l)
                  acc
                  (if (char= (car l) #\,)
                    (f (cdr l) (cons #\Space acc))
                    (f (cdr l) (cons (car l) acc))))))
      (reverse (f lst nil))))

  (format t "~A~%"
          (concatenate 'string (comma-to-space x))))


Measured memory_bytes: 23736
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int64_t i = 0; i < (n); i++)
using namespace std;
 
int main(void) {
  ios::sync_with_stdio(false);
  int64_t N, M;
  cin >> N >> M;
  vector<int64_t> A(N);
  vector<int64_t> ASUM(2e5 + 1, 0);
  rep(i, N) {
    cin >> A[i];
    ASUM[A[i]]++;
  }
  for (int i = 2e5; i > 0; --i) {
    ASUM[i - 1] += ASUM[i];
  }
 
  sort(A.rbegin(), A.rend());
  vector<int64_t> B(N + 1, 0);
  rep(i, N) { B[i + 1] = B[i] + A[i]; }
 
  int64_t left = 0;
  int64_t right = 2e5 + 1;
  while (left + 1 < right) {
    int64_t mid = left + (right - left) / 2L;
    int64_t L = 0;
    rep(i, N) { L += ASUM[max(0L, mid - A[i])]; }
    if (M <= L)
      left = mid;
    else
      right = mid;
  }
 
  int64_t answer = 0;
  int64_t L = 0;
  rep(i, N) {
    int64_t v = max(0L, right - A[i]);
    int64_t t = max(0L, min(ASUM[v], M - L));
    answer += B[t] + t * A[i];
    L += t;
  }
  answer += left * (M - L);
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 6400
using System;
using System.Collections.Generic;

class Class3
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int X = int.Parse(input[0]);
        int N = int.Parse(input[1]);

        if (N == 0)
        {
            Console.WriteLine(X);
            return;
        }

        // N >= 1

        string[] input2 = Console.ReadLine().Split(' ');
        List<int> xList = new List<int>();
        for (int i = 0; i < input2.Length; i++)
        {
            xList.Add(int.Parse(input2[i]));
        }

        if (!xList.Contains(X))
        {
            Console.WriteLine(X);
            return;
        }

        bool flg = true;
        int diff = 1;

        while(flg)
        {
            if (!xList.Contains(X - diff))
            {
                Console.WriteLine(X - diff);
                break;
            }

            if (!xList.Contains(X + diff))
            {
                Console.WriteLine(X + diff);
                break;
            }

            diff++;
        }




    }
}


Measured memory_bytes: 27788
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<functional>
#include<vector>
#include<map>
#include<string>
#include<set>
#include<unordered_set>
#include<unordered_map>
#define int long long
#define P pair<int,int>
using namespace std;

P a[4];//1Lあたりの値段　量
signed main() {
	int b, c, d, e; cin >> b >> c >> d >> e;
	int S; cin >> S;
	S *= 4;
	a[0] = { b * 8,1};
	a[1] = { c * 4,2 };
	a[2] = { d * 2,4 };
	a[3] = { e * 1,8 };
	sort(a, a + 4);
	long long ans = 0;
	for (int i = 0; i < 4; i++) {
		long long f = S / a[i].second;
		ans += f*a[i].first*a[i].second/8;
		S -= f*a[i].second;
	}
	cout << ans << endl;
	getchar();
}

Measured memory_bytes: 256
#pragma GCC optimize ("-O3")
    #include <bits/stdc++.h>  
     
    using namespace std;
     
    typedef long long ll;
    typedef long double ld;
    typedef pair<int,int> p32;
    typedef pair<ll,ll> p64;
    typedef pair<double,double> pdd;
    typedef vector<ll> v64;
    typedef vector<int> v32;
    typedef vector<vector<int> > vv32;
    typedef vector<vector<ll> > vv64;
    typedef vector<vector<p64> > vvp64;
    typedef vector<p64> vp64;
    typedef vector<p32> vp32;
    ll MOD = 998244353;
    #define forn(i,e) for(ll i = 0; i < e; i++)
    #define forsn(i,s,e) for(int i = s; i < e; i++)
    #define rforn(i,s) for(ll i = s; i >= 0; i--)
    #define rforsn(i,s,e) for(ll i = s; i >= e; i--)
    #define ln "\n"
    #define dbg(x) cout<<#x<<" = "<<x<<ln
    #define mp make_pair
    #define pb push_back
    #define fi first
    #define se second
    #define INF 1e18
    #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
    #define all(x) (x).begin(), (x).end()
    #define sz(x) ((ll)(x).size())
     
    ll mpow(ll a, ll b){
        if(b >= (MOD-1)) b %= (MOD-1);
        if(b==0) return 1;
        ll t1 = mpow(a,b/2);
        t1 *= t1;
        t1 %= MOD;
        if(b%2) t1 *= a;
        t1 %= MOD;
        return t1;
    }
     
    ll mpow(ll a, ll b, ll p){
        if(b==0) return 1;
        ll t1 = mpow(a,b/2,p);   t1 *= t1;
        t1 %= p;
        if(b%2) t1 *= a;
        t1 %= p;
        return t1;
    }
    ll modinverse(ll a, ll m){
        ll m0 = m; 
        ll y = 0, x = 1; 
        if (m == 1) return 0; 
        while (a > 1){
            ll q = a / m; 
            ll t = m; 
            m = a % m, a = t; 
            t = y; 
            y = x - q * y; 
            x = t; 
        }
        if (x < 0) x += m0; 
        return x; 
    }
    ll range(ll l, ll r){
        return l + rand()%(r-l+1);
    }
    
    int main()
    {
        ll t=1;
        //cin>>t;
        while(t--)
        {
            ll n;cin>>n;
            if(n>=30)cout<<"Yes"<<endl;
            else cout<<"No"<<endl;  
        }
    }

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b, c;
  int N, A;
  
  cin >> N >> A;
  a = N % 500;
  
  if(a <= A)
 	cout << "Yes" << endl;
  else
    cout << "No" << endl;

}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint();
	int A = 0, B = 0;

	rep(i, N) {
		int a = getint();
		if (!(a & 3)) A++;
		else if (!(a & 1)) B++;
	}
	int ikeru = A * 2 + B;
	if (B == 0) ikeru++;

	if (ikeru >= N) printf("Yes");
	else printf("No");

	Would you please return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int R, G, B, N;
  scanf("%d %d %d %d", &R, &G, &B, &N);

  int r;

  int sum;

  int rmax = N/R;

  int ans = 0;

  for(r = 0; r <= rmax; r++){
    sum = R * r;
    while(sum <= N){
      if((N - sum) % B == 0) ans++;
      sum += G;
    }
  }

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;

ll g1(ll n, int p){
	if(n == 0) return 0;
  	return n/p + g1(n/p, p);
}

ll g2(ll n, int p){
	ll res = 0;
  	if(n%2 == 1){
    	return g1(n, p) - g2(n-1, p);
    }
  	res = g1(n/2, p);
  	if(p == 2) res += n/2;
  	return res;
}
 
int main(){
	ll n;
  	cin >> n;
  
  	ll ans = min(g2(n, 2), g2(n, 5));
  	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

// Mod int
const int mod = 1000000007;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
typedef vector<mint> vm;
typedef vector<vm> vvm;
//

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  VLL a(n);
  rep(i,n) cin >> a[i];
  mint ans = 0;
  ll b[61];
  memset(b,0,sizeof(b));
  rep(i,n){
    rep(bit,61){
      if(((a[i]>>bit) & 1) == 1) b[bit]++;
    }
  }
  rep(i,61){
    mint tmp1 = (1LL << i);
    mint tmp2 = (b[i] * (n - b[i]));
    ans += tmp1 * tmp2;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
while 1:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        exit()
    if m == -1 or f == -1:
        print('F')
    elif m + f >= 80:
        print('A')
    elif m + f >= 65:
        print('B')
    elif m + f >= 50:
        print('C')
    elif m + f >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')



Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> p;
const int inf = 1e9;
const ll mod = 1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  rep(i,n) p[i]++;
  int mx = 0;
  int s = 0;
  queue<int> q;
  rep(i,n) {
    s += p[i];
    q.push(p[i]);
    if (q.size() > k) {
      s -= q.front(); q.pop();
    }
    if (q.size() == k) {
      mx = max(mx, s);
    }
  }
  double ans = mx;
  ans /= 2;
  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
	priority_queue<int> q;
	int N; cin>>N;
	int a, Papu = 0, Popa = 0, turno = 0;
	while(N--){
		cin>>a; q.push(a);
	}
	while(q.size()){
		if (turno % 2 == 0)Popa+=q.top();
		else Papu+=q.top();
		turno++;
		q.pop();
	}
	if(Papu>=Popa)cout<<Papu-Popa;
	else cout<<Popa-Papu;
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{

    class Atcoderrrrrrr
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int X = int.Parse(s[0]);
            int Y = int.Parse(s[1]);
            int Z = int.Parse(s[2]);

            int ans = 0;
            for (int i = 0; X>=0; i++)
            {
                if (i == 0)
                {
                    X -= Z;
                }
                X -= (Y + Z);
                if(X>=0){
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;

int dy[] = {-1, 0, 1, 0};
int dx[] = {0, -1, 0, 1};

int main(){
	int n, m, op, r, c, sz, a;
	scanf("%d%d", &n, &m);
	vector<vector<int> > v(n + 2, vector<int>(n + 2, 2)), w;
	for(int i = 1; i <= n; ++i){
		for(int j = 1; j <= n; ++j){
			scanf("%d", &v[i][j]);
		}
	}
	
	while(m--){
		scanf("%d%d", &op, &r);
		if(op == 0){
			scanf("%d%d%d", &c, &sz, &a);
			for(; a > 0; a -= 90){
				w = v;
				for(int i = 0; i < sz; ++i)
				for(int j = 0; j < sz; ++j){
					w[r + i][c + j] = v[r + sz - j - 1][c + i];
				}
				w.swap(v);
			}
		}
		else if(op == 1){
			scanf("%d%d", &c, &sz);
			for(int i = r; i < r + sz; ++i)
			for(int j = c; j < c + sz; ++j){
				v[i][j] = 1 - v[i][j];
			}
		}
		else if(op == 2){
			int t = v[r][1];
			for(int i = 1; i < n; ++i){
				v[r][i] = v[r][i + 1];
			}
			v[r][n] = t;
		}
		else if(op == 3){
			int t = v[r][n];
			for(int i = n; i > 1; --i){
				v[r][i] = v[r][i - 1];
			}
			v[r][1] = t;
		}
		else{
			scanf("%d", &c);
			int t = v[r][c];
			v[r][c] = 1 - t;
			queue<int> q;
			q.push(r << 16 | c);
			while(!q.empty()){
				r = q.front() >> 16;
				c = q.front() & 0xffff;
				q.pop();
				for(int i = 0; i < 4; ++i){
					int nr = r + dy[i], nc = c + dx[i];
					if(v[nr][nc] == t){
						v[nr][nc] = 1 - t;
						q.push(nr << 16 | nc);
					}
				}
			}
		}
	}
	
	for(int i = 1; i <= n; ++i)
	for(int j = 1; j <= n; ++j){
		printf("%d%c", v[i][j], j == n ? '\n' : ' ');
	}
}

Measured memory_bytes: 1060
n,m=map(int,input().split())
stu=[]
for i in range(n):
    stu.append(int(input()))
for i in range(2,m+1):
    for j in range(n-1):
        if stu[j]%i>stu[j+1]%i:stu[j],stu[j+1]=stu[j+1],stu[j]
for i in stu:print(i)


Measured memory_bytes: 5612