akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<set>
#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 chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const ll mod = 100000000000000003;
int ne[200001], he[100001];
char C[1200100];

ll num[524300];
int kazu[524300];
const int ma = (1 << 19) - 1;
int query(ll n) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) return kazu[n2];
		n2 = n2 * 61 % 524287;
	}
	return 0;
}
void add(ll n, int b) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) {
			kazu[n2] |= b;
			return;
		}
		n2 = n2 * 61 % 524287;
	}
	num[n2] = n + 1;
	kazu[n2] = b;
}

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


	fread(C, 1, 1200100, stdin);
	char* ci = C, c;
	int N = 0;
	while ((c = *ci++) >= '0') N = N * 10 + c - '0';
	set<pair<int, char*>> ST;
	char* s[200001];
	rep1(i, N) {
		s[i] = ci;
		while (*ci++ >= '0');
		int n = ci - s[i] - 1;	
		if (n <= 100000) {
			ne[i] = he[n];
			he[n] = i;
		}
		else {
			ST.insert(mp(n, s[i]));
		}
	}

	ll kotae = 0;

	for (int M = 1; M <= 100000; M++) {
		for (int p = he[M]; p; p = ne[p]) {
			auto S = s[p];
			int k[26] = {};
			ll are = 0;
			for (int i = M - 1; i >= 1; i--) {
				int tmp = query(are);
				if (tmp) {
					rep(j, 26) if ((tmp >> j & 1)) {
						k[j]++;
					}
				}
				kotae += k[S[i] - 'a'];
				k[S[i] - 'a'] = 0;
				are = (are * 30 + S[i] - 'a' + 1) % mod;
			}

			kotae += k[S[0] - 'a'];
			k[S[0] - 'a'] = 0;

			add(are, 1 << (S[0] - 'a'));
		}
	}
	for (auto p : ST) {
		auto S = p.second;
		int k[26] = {};
		ll are = 0;
		for (int i = p.first - 1; i >= 1; i--) {
			int tmp = query(are);
			if (tmp) {
				rep(j, 26) if ((tmp >> j & 1)) {
					k[j]++;
				}
			}
			kotae += k[S[i] - 'a'];
			k[S[i] - 'a'] = 0;
			are = (are * 30 + S[i] - 'a' + 1) % mod;
		}

		kotae += k[S[0] - 'a'];
		k[S[0] - 'a'] = 0;

		add(are, 1 << (S[0] - 'a'));
	}
	printf("%lld\n", kotae);


	Would you please return 0;
}

Measured memory_bytes: 12732
#include <bits/stdc++.h>
using namespace std;
#define lld long long int
#define M 1000000007
#define fors(i,n) for(int i=0;i<n;++i)
#define fore(i,a,b) for(int i=a;i<=b;++i)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define vv vector<int>
#define endl "\n"
#define test(i) cout<<i<<endl
#define itrt int t; cin>>t; fors(i,t)
#define itr1 int t; cin>>t;
#define ff first
#define ss second
#define pb push_back
#define vmp make_pair
#define ppb pop_back
#define sorta(a,n) sort(arr,arr+n)
#define sortv(x) sort(x.begin(),x.end())

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int sum=a+b+c;
  if(sum>=22){
    cout<<"bust";
  }
  else{
  	cout<<"win";
  }
}

Measured memory_bytes: 256
import sys

s = int(input())
l = set()
l.add(s)
c = 2
while 1:
    if s%2 == 0:
        s = s//2
    else:
        s = 3*s + 1
    if (s in l) == True:
        print(c)
        sys.exit()
    else:
        c += 1
        l.add(s)

print(l)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pb push_back
#define in insert
#define ff first
#define ss second
#define mp make_pair
#define int long long
#define uint unsigned long long
#define rep(i,x,m) for(int i=x;i<m;i++)
#define repr(i,x,m) for(int i=x;i>=m;i--)
#define MOD 1000000007
#define endl "\n"
using namespace std;
#define noob ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void ram5564()
{
    string s;
    cin>>s;
    set<char>set;
    for(auto x:s)
    {
    	set.in(x);
    }
    if(set.size()==2)
    	cout<<"Yes";
    else
    	cout<<"No";

}

signed main()
{
		noob
		
        int t=1;
        //cin>>t;
        while(t--)
        ram5564();
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
  // ans=LLONG_MAXs;
  ll ans=0;
  ll N,C,K;
  cin>>N>>C>>K;
  ll T[N];
  ll taiki=0;
  ll limit;

  FOR(i,0,N-1){
    cin>>T[i];
  }
  sort(T,T+N);
  limit=T[0]+K;
  FOR(i,0,N-1){
    if(limit<T[i] || taiki>=C){
      taiki=1;
      limit=T[i]+K;
      ans++;
    }else{
      taiki++;
    }
  }
  if(taiki>0)ans++;


cout<<ans<<endl;
return 0;

}
 


Measured memory_bytes: 1024
#include <stdio.h>
#include<math.h>

double abso(double n){
	if(n<0)n*=(-1);
	return n;
}

double dis(double xa,double ya,double xb,double yb){
	if(xa==xb){
		return abso(ya-yb);
	}else{
		return sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
	}
}

int main(void) {
	int i;
	double r;
	
	while(scanf("%lf",&r)!=EOF){
		for(i=1;r>7*sqrt(2*(i-1));i++);
		printf("%d\n",i);
	}
	return 0;
}

Measured memory_bytes: 628
#include<iostream>

using namespace::std;
int main(){
    int month,day,k,i,j;
    cin>>month>>day;
    if(day<22){
        cout<<0<<endl;
        return 0;
    }
    int number;
//2digit=day/10;
//1digit=day%10;
for(i=1;i<=month;i++)
    for(j=1;j<=day;j++)
        if(i==(j%10)*(j/10)&&(j%10>1)&&(j/10>1))
        number++;
cout<<number;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define   ll          long long int
#define   sz          200010
#define   sc(a)       scanf("%lld",&a)
#define   sc2(a,b)    scanf("%lld %lld",&a,&b)
#define   py          printf("Yes\n")
#define   pn          printf("No\n")
using namespace std;


ll num[sz];


int main()
{

     ll n,s=0,d,i,j,k;

     cin>>n;
     for(i=1;i<=n;i++)
     {
         cin>>num[i];
     }

     sort(num+1,num+n+1);
     for(i=1;i<n;i++)
     {
         s+=num[i];
     }
     s+=num[n]/2;

     cout<<s<<endl;

    return 0;
}



Measured memory_bytes: 256
#1-index
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

from collections import deque

N, u, v = map(int, input().split())
G = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    A, B = map(int, input().split())
    G[A].append(B)
    G[B].append(A)

queT = deque()
queA = deque()

checkT = [-1] * (N + 1)
checkA = [-1] * (N + 1)

checkT[u] = 0
checkA[v] = 0

queT.append(u)
queA.append(v)
flag = True
while queT or queA: #どちらかが生きているとき
    tmp_lst = []
    while queT:
        tmp = queT.popleft()
        d = checkT[tmp]
        for next_ in G[tmp]:
            if checkT[next_] == -1:
                if checkA[next_] != -1:
                    flag = False
                    turn = True #高橋くんが動くとぶつかる
                    break
                checkT[next_] = d + 1
                tmp_lst.append(next_)
        if not flag:
            break
    if not flag:
        break
    for i in tmp_lst:
        queT.append(i)
    
    tmp_lst = []
    while queA:
        tmp = queA.popleft()
        d = checkA[tmp]
        for next_ in G[tmp]:
            if checkA[next_] == -1:
                if checkT[next_] != -1:
                    flag = False
                    turn = False #青木くんが動くとぶつかる
                    break
                checkA[next_] = d + 1
                tmp_lst.append(next_)
        if not flag:
            break
    if not flag:
        break
    for i in tmp_lst:
        queA.append(i)

# print (checkT)
# print (checkA)
# print (d)
# print (turn)
# print (tmp) #現在の場所
#ここまでで二人がギリギリまで近づく位置と、どちらが動いたらぶつかるかが分かる

if turn:
    ans = 0
    check = [-1] * (N + 1)
    check[tmp] = 0
    stack = [tmp]
    while stack:
        tmp1 = stack.pop()
        tmp_d = check[tmp1]
        # flag = True
        for next_ in G[tmp1]:
            if check[next_] == -1 and checkA[next_] == -1:
                check[next_] = tmp_d + 1
                stack.append(next_)
                # flag = False
        # if flag:
        ans = max(ans, tmp_d)

else:
    ans = 0
    check = [-1] * (N + 1)
    check[tmp] = 0
    stack = [tmp]

    tmp1 = stack.pop()
    tmp_d = check[tmp1]
    # flag = True
    for next_ in G[tmp1]:
        if check[next_] == -1 and checkT[next_] != -1:
            check[next_] = tmp_d + 1
            stack.append(next_)
            # flag = False
    # if flag:
    ans = max(ans, tmp_d)

    while stack:
        tmp1 = stack.pop()
        tmp_d = check[tmp1]
        # flag = True
        for next_ in G[tmp1]:
            if check[next_] == -1 and checkA[next_] == -1:
                check[next_] = tmp_d + 1
                stack.append(next_)
                # flag = False
        # if flag:
        ans = max(ans, tmp_d)    


# print (check)
if turn:
    print (max(d + ans, 0))
else:
    print (max(d + ans - 1, 0))

Measured memory_bytes: 27736
#include <iostream>
using namespace std;
static const int MAX=50;

int main(void){
    int n, counter=0;
    int p[MAX];
    int seikai[MAX];
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> p[i];
        seikai[i] = i+1;
    }
    for(int i=0; i<n; i++){
        if(seikai[i] != p[i]) counter += 1;
    }
    if(counter == 0 || counter == 2) cout << "YES";
    else cout << "NO";
    
    return 0;
}

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

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {

	ll x;
	cin >> x;
	ll t = 100;
	int ans = 0;
	while(t < x) {
		t *= 1.01; 
		ans++;
	}
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
int main()
{
	long long int m,n,i,x,y,max=0,num=0;
	scanf("%lld%lld", &m, &n);
	n = n * n;
	/*for (i = 0; i < m; i++)
	{
		scanf("%lld%lld", &x[i], &y[i]);
		for (j = 0; j < i; j++)
		{
			if (x[i] == x[j] && y[i] == y[j])
			{
				x[i] = 0;
				y[i] = 0;
				break;
			}
		}
	}*/
	for (i = 0; i < m; i++)
	{
		scanf("%lld%lld", &x, &y);
		max = x * x + y * y;
		if (max > n)
		{
			num++;
		}
	}
	printf("%lld", m-num);
	return 0;
}

Measured memory_bytes: 1732
//2018-01-07
//LZYeah
//
#include<bits/stdc++.h>
#define ll long long
#define For(i,a,b) for(register int i=a;i<=b;i++)
#define Forr(i,a,b) for(register int i=a;i>=b;i--)
using namespace std;
inline void File()
{
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
inline void read(int &x)
{
	int p=1;
	x=0;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')p=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+(c^'0');c=getchar();}
	x*=p;
}
int n,ans;
int cnt[110];
int main()
{
//	File();
	read(n);
	For(i,1,n)
	{
		int a;
		read(a);
		if(!cnt[a])ans++;
		cnt[a]=1;
	}
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF=1<<29;
ll inf=1LL<<50;

struct edge{int from,to,cost;};

edge es[2010]; //MAX_E
ll d[1010]; //S→Gのcost //MAX_V
ll N,M;

void bellman_ford(ll s){
	for(int i=0;i<N;i++) d[i]=inf;
	d[s]=0;
	while(1){
		bool update=false;
		for(int i=0;i<M;i++){
			edge e=es[i];
			if(d[e.from]!=inf && d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				update=true;
			}
		}
		if(!update) break;
	}
}

bool find_negative_roop(ll s){
	for(int i=0;i<N;i++) d[i]=inf;
	d[s]=0;
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			edge e=es[j];
			if(d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				if(i==N-1) return true;
			}
		}
	}
	return false;
}
vector<bool> nega(1010);
void find_negative_roop2(ll s){
	for(int i=0;i<N;i++) nega[i]=false;
	//d[s]=0;
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			edge e=es[j];
			if(d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				nega[e.to]=true;
				//if(i==N-1) return true;
			}
		}
	}
	//return false;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>N>>M;
	for(int i=0;i<M;i++){
		ll x,y,z;
		cin>>x>>y>>z;
		x--; y--; z=-z;
		es[i].from=x;
		es[i].to=y;
		es[i].cost=z;
	}
	find_negative_roop(0);
	find_negative_roop2(0);
	if(nega[N-1]){
		cout<<"inf"<<endl;
	}else{
		cout<<-d[N-1]<<endl;
	}
	/*if(find_negative_roop(0)){
		cout<<"inf"<<endl;
	}else{
		cout<<-d[N-1]<<endl;
	}*/
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

#define INF 1e9
using namespace std;

#define REPR(i, n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

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

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

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

typedef long long ll;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


int main() {
    string S;
    cin >> S;

    // 答えのぜんれっきょ
    set<string> s;
    // 0468
    REP(i, 1 << 4) {
        // bit
        vector<bool> v(4,false);
        REP(j, 4) {
            if (1 << j & i) {
                v[j] = true;
            }
        }

        string akiba = "AKIHABARA";
        string created;
        REP(j, akiba.size()) {
            if (j == 0 && v[0]) continue;
            else if ( j == 4 && v[1]) continue;
            else if ( j == 6 && v[2]) continue;
            else if ( j == 8 && v[3]) continue;

            string ch{akiba[j]};
            created += ch;
        }
        s.insert(created);
    }

    auto ans = s.find(S) != s.end() ? "YES" : "NO";

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
S = input()

for bit in range(2 ** 3):
    ans = int(S[0])
    for i in range(3):
        if bit & (1 << i):
            ans += int(S[i+1])
        else:
            ans -= int(S[i+1])

    if ans == 7:
        print(S[0], end='')
        for i in range(3):
            if bit & (1 << i):
                print('+' + S[i+1], end='')
            else:
                print('-' + S[i+1], end='')
        print('=7', end='')
        exit()


Measured memory_bytes: 38416
while True:
    a, op, b = input().split()
    if op == '+':
        print(int(a) + int(b))
    elif op == '-':
        print(int(a) - int(b))
    elif op == '*':
        print(int(a) * int(b))
    elif op == '/':
        print(int(a) // int(b))
    else:
        break


Measured memory_bytes: 5596
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
	int n;
	bool S[13],H[13],C[13],D[13];
	cin >> n;
	for(int i=0;i<13;i++) S[i] = H[i] = C[i] = D[i] = false;
	for(int i=0;i<n;i++){
		string mark;
		int num;
		cin >> mark >> num;
		if(mark == "S"){
			S[num-1] = true;
		} else if(mark == "H"){
			H[num-1] = true;
		} else if(mark == "C"){
			C[num-1] = true;
		} else if(mark == "D"){
			D[num-1] = true;
		}
	}

	for(int i=0;i<13;i++) {
		if(!S[i]) cout << "S " << i+1 << endl;
	}
	for(int i=0;i<13;i++) {
		if(!H[i]) cout << "H " << i+1 << endl;
	}
	for(int i=0;i<13;i++) {
		if(!C[i]) cout << "C " << i+1 << endl;
	}
	for(int i=0;i<13;i++) {
		if(!D[i]) cout << "D " << i+1 << endl;
	}
	return 0;
}


Measured memory_bytes: 3148
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int w = sc.nextInt(), h = sc.nextInt();
		int n = sc.nextInt();
		int xs = 0, xb = w, ys = 0, yb = h;
		for(int i = 0; i < n; i++) {
			int x = sc.nextInt(), y = sc.nextInt();
			int a = sc.nextInt();
			if(a == 1) {
				if(xs < x) {
					xs = x;
				}
			}else if(a == 2) {
				if(xb > x) {
					xb = x;
				}
			}else if(a == 3) {
				if(ys < y) {
					ys = y;
				}
			}else {
				if(yb > y) {
					yb = y;
				}
			}
		}
		if(xs >= xb || ys >= yb) {
			System.out.println(0);
		}else {
			System.out.println((xb-xs)*(yb-ys));
		}
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 32808
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a,b, k;
  cin >> k;
  cin >> a >>  b;
  bool t = false;
  for(int i = a; i < b+1; i++){
    if(i%k==0) t = true;
  }
  if(t) cout << "OK" << endl;
  else cout << "NG" << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i,a,b) for(int(i)=(a);(i)<(b);++(i))
#define RREP(i,a,b) for(int(i)=(a)-1;(i)>=(b);--(i))
#define ALL(x) (x).begin(),(x).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
using namespace std;
typedef long long ll;
const int MAX_N = (int)1e5+10;

int prime[MAX_N]; // i番目の素数
bool is_prime[MAX_N+1];  // iが素数か？

// n以下の素数の数を返す
int sieve(int n)
{
  int p = 0;
  REP(i,0,n+1) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  REP(i,2,n+1) {
    if (is_prime[i]) {
      prime[p] = i;
      ++p;
      // iの倍数は素数ではない
      for(int j=2*i; j<=n; j+=i) is_prime[j] = false;
    }
  }
  return p;
}

int a[MAX_N];  // a[i]: iが2017-likeか？

int main()
{
  // (多めに)MAX_N個の事前計算:
  sieve(MAX_N);  // is_prime配列を計算
  a[0] = 0;
  REP(i,1,MAX_N) {
    a[i] = (is_prime[i] && is_prime[(i+1)/2]) ? 1 : 0;
  }

  // S[i+1]: iまでの2017-like数の合計
  vector<int> S(MAX_N+1);
  S[0] = 0;
  REP(i,0,MAX_N) S[i+1] = S[i] + a[i];

  int Q;
  cin >> Q;
  REP(i,0,Q) {
    int l,r;
    cin >> l >> r;
    cout << (S[r+1] - S[l]) << endl;
  }

  return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
 
using namespace std;
using S = set<long long>;
using D = deque<long long>; //pop_back pop_front push_back push_front front back clear empty
using L = vector<long long>;
using M = map<int,long long>;  //erase  (でキーごと削除) 追加削除検索O(log(N))
using A = vector<vector<long long>>;
using PQ = priority_queue<long long>; //erase  (でキーごと削除) push pop top 
using PQG = priority_queue<long long,L,greater<long long>>; //erase  (でキーごと削除) push pop top 
using U = unordered_map<int,long long>; //map  (との違いはkeyの順番を保持していない)

#define sorted(vector) sort(vector.begin(),vector.end()) //O(nlongn)
#define sortedreverce(vector) sort(vector.rbegin(),vector.rend()) //O(nlongn)
#define vmin(vector) *min_element(vector.begin(),vector.end()) //O(N)
#define vmax(vector) *max_element(vector.begin(),vector.end()) //O(N)
#define vsum(vector) accumulate(vector.begin(),vector.end(),0) //O(N)
#define vdel(vector,a) vector.erase(vector.begin()+a)
#define vcount(vector,a) count(vector.begin(), vector.end(),a) //O(N)
#define bisect_left(vector,a) (lower_bound(vector.begin(),vector.end(),a)-vector.begin())
#define bisect_right(vector,a) (upper_bound(vector.begin(),vector.end(),a)-vector.begin())
#define vfind(vector,a) find(vector.begin(), vector.end(), a) != vector.end() //遅いからあんまり使うな
#define inf 1000000000000000000+10
#define setans long long ans=0;

template <typename T>
void print(T a){for (auto b:a){cout<<b<<" ";};cout<<endl;}
template <>
void print(unsigned long a){cout<<a<<endl;}
template <>
void print(char a){cout<<a<<endl;}
template <>
void print(bool a){cout<<a<<endl;}
template <>
void print(long long a){cout<<a<<endl;}
template <>
void print(A a){for (auto b:a){for (auto c:b){cout<<c<<" ";}cout<<endl;};cout<<endl;}
template <>
void print(string a){cout<<a<<endl;}


//存在確認はmap!!!!!!!!!!!!!か配列に埋め込んでcontinueで回避
//__gcd(a,b)はコンパイラがGCC時のみ
//printf("%.16f", ans); 誤差落ち対応君

int main(){
    long long n,a,b;
    cin>>n;
    A array;
    for(long long i=0  ;i<n  ;i++){
        cin>>a>>b;
        array.push_back(L{b,a});
    }
    sorted(array);
//    print(array);
    long long t=0;
    for(long long i=0  ;i<n  ;i++){
        t+=array[i][1];
        if (t<=array[i][0]){
            continue;
        }else{
            cout<<"No"<<endl;
            exit(0);
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 12464
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 1000+5;
const int dx[] = {-1,1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;

int G[N*2][N*2];
int getNum(int x1,int y1,int x2,int y2){//以(x1,y1)为左上角(x2,y2)为右下角的点的数量
    return G[x2][y2]-G[x1][y2]-G[x2][y1]+G[x1][y1];
}
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
        int x,y;
        char c;
        scanf("%d %d %c",&x,&y,&c);
        if(c=='W')//反色
            x+=k;
        //取模压缩
        x=x%(k*2);
        y=y%(k*2);
        G[x+1][y+1]++;//从点(1,1)开始
    }

    for(int i=1;i<=2*k;i++)
        for(int j=1;j<=2*k;j++)
            G[i][j]+=G[i-1][j]+G[i][j-1]-G[i-1][j-1];//容斥

    int res=-INF;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            int temp1=getNum(0,0,i,j);
            int temp2=getNum(0,j+k,i,2*k);
            int temp3=getNum(i+k,0,2*k,j);
            int temp4=getNum(i+k,j+k,2*k,2*k);
            int temp5=getNum(i,j,i+k,j+k);
            int sum=temp1+temp2+temp3+temp4+temp5;
            res=max(res,max(sum,n-sum));
        }
    }
    printf("%d\n",res);

    return 0;
}


Measured memory_bytes: 16000
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b) {
    return b>0 ? gcd(b,a%b):a;
}
int main(){
	int n;
	scanf("%d",&n);
	int sum = 0;
	for(int i = 1; i<= n; i++){
		for(int j = 1; j<= n; j++){
			for(int k = 1; k<= n; k++){
				sum += gcd(gcd(i,j),k);
			} 
		}
	}
	printf("%d",sum);
}

Measured memory_bytes: 3800
using System;
using System.Linq;

namespace Aizu {
    class OnlineJudge {
        static void Main() {
            int count = 0;
            var table = new[] { 'A', 'Z' };
            var input = Console.ReadLine();
            for (var i = 0; i < input.Length; ++i) {
                if (input[i] == table[(count & 1)]) {
                    ++count;
                }
            }
            Console.WriteLine(count >= 2 ? string.Concat(Enumerable.Repeat("AZ", count >> 1).ToArray()) : "-1");
        }
    }
}

Measured memory_bytes: 9340
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}

void solve() {
  ll w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << w * h / 2.0 << " " << (w % 2 == 0 && h % 2 == 0 && x * 2 == w && y * 2 == h ? 1 : 0) << endl;
}


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

typedef long long ll;
typedef pair<int,int> P;

int dp[114][114514];

int main(){
        int N,W;
        cin>>N>>W;
        vector<int>v(N),w(N);
        for(int i=0;i<N;i++){
                cin>>v[i]>>w[i];
        }
        for(int i=0;i<N;i++){
                for(int j=0;j<=W;j++){
                        if(j>=w[i])dp[i+1][j]=max(dp[i+1][j],dp[i][j-w[i]]+v[i]);
                        dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
                }
        }
        cout<<dp[N][W]<<endl;
}



Measured memory_bytes: 7420
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x=sc.nextInt();
        int time=0;
        int place=0;
        while(true){
            time++;
            place+=time;
            if(place>=x){
                System.out.println(time);
                return;
            }
        }
    }
}

Measured memory_bytes: 23764
use std::io::prelude::*;
macro_rules! read_line {
    () => {{
        let mut input = String::new();
        std::io::stdin().read_line(&mut input).unwrap();
        input
    }};
}
pub fn read_to_vec<T: std::str::FromStr>() -> Vec<T> {
    read_line!().split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
macro_rules! bind_from_vec {
    ( $($variable:ident),+ = $vector:expr ) => {
        let mut v = $vector.clone().into_iter();
        $(let $variable = v.next().unwrap();)+
    };
}
fn read_two<T: std::str::FromStr>(stdin: &mut std::io::StdinLock, buf: &mut String) -> (T, T) {
    buf.clear();
    stdin.read_line(buf).ok();
    let mut iter = buf.split_whitespace().map(|e| e.parse().ok().unwrap());

    (iter.next().unwrap(), iter.next().unwrap())
}
fn main() {
    bind_from_vec!(n, m = read_to_vec());
    let mut m = m;

    let mut input = Vec::with_capacity(n as usize);
    {
        let stdin = std::io::stdin();
        let mut locked_stdin = stdin.lock();
        let mut buf = String::new();

        for _ in 0..n {
            let (a, b) = read_two::<u64>(&mut locked_stdin, &mut buf);
            input.push((a, b));
        }
    }
    input.sort_by_key(|e| e.0);

    let mut ans = 0;
    for &(a, b) in input.iter() {
        if m > b {
            ans += a * b;
            m -= b;
        } else {
            ans += a * m;
            break;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 6396
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
typedef long long int ll;
typedef unsigned long long ull;
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 pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;

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

    int h = s / 3600;
    int m = (s - h*3600) / 60;
    int ss = s - (h * 3600 +m * 60);

    cout << h << ":" << m << ":" << ss << endl;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int N;
  ll p[100000];
  cin>>N; 
  for (int i(0);i<N;i++) cin>>p[i];
      bool finishi(true);
      for (int k(1);k<N;k++){
   //     cerr << p[k-1]<<" "<<p[k]<<endl;
        if (p[k-1]>p[k]) finishi=false;
      }
      if (finishi==true){
        cout << "YES" << endl;
        return 0;
      }
  for (int i(0);i<N;i++){
    for (int j(i+1);j<N;j++){
      int s[100];
      for (int k(0);k<N;k++){
        s[k]=p[k];
        cerr << s[i] << " "<< p[i]<<endl;
      }
      int tmp; 
      tmp=s[i];
      s[i]=s[j];
      s[j]=tmp;
      bool finish(true);
      for (int k(1);k<N;k++){
//         cerr << s[k-1]<<" "<<s[k]<<endl;
        if (s[k-1]>s[k]) finish=false;
      }
      cerr << endl;
      if (finish==true){
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int c = saori.saori_hayami();

		int count = 0;

		if(a==b){
			count++;
		}
		if(a==c){
			count++;
		}
		if(c==b){
			count++;
		}

		if(count == 1){
			System.out.println("Yes");
		} else{
			System.out.println("No");
		}
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main(void)
{
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        k: usize,
        d: [usize;k],
    }

    let mut ok: bool = true;
    let mut not_d: Vec<usize> = Vec::new();

    for i in 0..10 {
        for j in 0..k {
            if i!=d[j] {
                continue;
            } else {
                ok = false;
            }
        }
        if ok {
            not_d.push(i);
        } else {
            ok = true;
        }
    }
    ok = false;
    let nl = not_d.len();
    // debug!(not_d);
    let mut ok1: bool = true;
    for i in n..10*n+1 {
        let mut x = i;
        while x!=0 {
            let r = x%10;
            ok = false;
            for j in 0..nl {
                if r==not_d[j] {
                    ok = true;
                    break;
                } 
                // debug!(not_d[j]);
            }
            x /= 10;
            // debug!(r);
            // debug!(ok);
            if ok==false {
                ok1 = false;
                break;
            }
        }
        if ok1==true {
            println!("{}", i);
            return;
        } else {
            ok1 = true;
        }
    }

}


Measured memory_bytes: 2124
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


const int max_comb=3000;
vector<ll> fac(max_comb+1); //n! (mod M)
vector<ll> ifac(max_comb+1); //k!^(-1) (mod M)

ll mpow(ll x, ll n){ //x^n(mod M)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}

ll minv(ll x){
    return mpow( x, MOD-2 );
}

ll comb(int a, int b){     // C(a,b) = a! * b!^(-1) * (a-b)^(-1)
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % MOD;
    return tmp * fac[a] % MOD;
}

ll perm(int a, int b){     // P(a,b) = a! * (a-b)!^(-1)
    if(b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b] % MOD;
    return tmp * fac[a] % MOD;
}

void pre_comb()
{
    fac[0] = 1;
    ifac[0] = 1;
    for(int i = 0; i<max_comb; i++){
        fac[i+1] = fac[i]*(i+1) % MOD; // n!(mod M)
        ifac[i+1] = ifac[i]*minv(i+1) % MOD; // k!^(-1) (mod M)
    }
    return;
}

ll dp[1001][1001];

int main(int argc, char* argv[])
{
    int n,a, b, c, d;
    scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);

    pre_comb();

    dp[a-1][0]=1;
    int i,j,k;
    for(i=a; i<=b; i++) {
        for(k=0; k<=n; k++) {
            int curr=n-k;
            int add=0;
            ll  tmp=1;
            for(j=0; j<=d; j++) {
                if(j>1) {
                    curr-=i;
                }
                if(j>0) {
                    if(curr<i) {
                        break;
                    }
                    tmp=tmp*comb(curr,i)%MOD;
                    add+=i;
                }
                if(j>0 && j<c) {
                    continue;
                }
                if(dp[i-1][k]) {
                    ll tmp2 = tmp * minv(perm(j,j))%MOD;
                    dp[i][k+add]=(dp[i][k+add]+dp[i-1][k]*tmp2)%MOD;
                }
            }
        }
    }
    printf("%lld\n", dp[b][n]);

    return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;



int main(){
    string s; cin >> s;
    ll len = s.size();
    ll ans = 0;
    rep(i,len-1){
        if(s[i] != s[i+1]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>

using namespace std;
#define int long long
const int p=1e9+7;
int ct=35;
int po(int a,int b)
{
    if(b==0) return 1;
    if(b==1) return a;
    if(b%2==0)
    {
        int u=po(a,b/2);
        return (u*u)%p;
    }
    int u=po(a,b-1);
    return (a*u)%p;
}
int inv(int x)
{
    return po(x,p-2);
}
void go(vector <pair<int,int> > v,int n)
{
    int ans=0;
    int sz=v.size();
    for(int i=0;i<sz;++i)
    {
        int curr=v[i].second;
        for(int j=0;j<v.size();++j)
        {
            if(j!=i)
            {
                curr*=(n-v[j].first);curr%=p;
                curr*=inv(v[i].first-v[j].first);curr%=p;
            }
        }
        ans+=curr;
        ans%=p;
    }
    ans+=p;
    ans%=p;
    cout<<ans<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int ans[ct];
    for(int i=0;i<ct;++i) ans[i]=0;
    for(int s1=0;s1<ct;++s1)
    {
    for(int s2=(s1+1);(s1+s2)<ct;++s2)
    {
    for(int u1=0;(u1+s1+s2)<ct;++u1)
    {
    for(int u2=(u1+1);(u1+u2+s1+s2)<ct;++u2)
    {
    for(int n1=0;(n1+u1+u2+s1+s2)<ct;++n1)
    {
    for(int n2=(n1+1);(n1+n2+u1+u2+s1+s2)<ct;++n2)
    {
    for(int l1=0;(u1+u2+s1+s2+l1+n1+n2)<ct;++l1)
    {
    for(int l2=(l1+1);(u1+u2+s1+s2+l1+l2+n1+n2)<ct;++l2)
    {
    for(int k1=0;(u1+u2+s1+s2+l1+l2+n1+n2+k1)<ct;++k1)
    {
    for(int k2=(k1+1);(u1+u2+s1+s2+l1+l2+n1+n2+k1+k2)<ct;++k2)
    {
        int h=(l1+l2+k1+k2+n1+n2+u1+u2+s1+s2);
        int res=(l2-l1)*(u2-u1)*(k2-k1)*(n2-n1)*(s2-s1);
        for(int i=h;i<ct;++i)
        {
            ans[i]+=res;
            ans[i]%=p;
        }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    vector <pair<int,int> > v1;
    for(int i=0;i<ct;i+=2)
    {
        v1.push_back({i,ans[i]});
    }
    vector <pair<int,int> > v2;
    for(int i=1;i<ct;i+=2)
    {
        v2.push_back({i,ans[i]});
    }
    int t;
    cin>>t;
    while(t--)
    {
    int n;
    cin>>n;
    /*if(n<ct)
    {
        cout<<ans[n]<<endl;
        continue;
    }*/
    if(n%2==0)
    {
        go(v1,n);
    }
    else
    {
        go(v2,n);
    }
    }
    return 0;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

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

int main() {
	string str;
	cin >> str;
	int n = str.size();
	string ans;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			ans += "g";
		} else {
			ans += "p";
		}
	}
	int count = 0;
	for (int i = 0; i < n; i++) {
		if (str[i] == 'g') {
			if (ans[i] == 'p')
				count++;
		} else {
			if (ans[i] == 'g')
				count--;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 640
{-# LANGUAGE BangPatterns #-}
import Data.List
import Data.Maybe
import Control.Monad
import Data.Function (fix)
import Data.Array (Array, array, (!))
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
 
getInts :: IO [Int]
getInts = (map parseInt . BS8.words) <$> BS.getLine 
    where parseInt = fst . fromJust . BS8.readInt

solve :: Int -> [Int] -> Int
solve t = fst . foldl (\(a,b) x -> (a + min t (x+t-b), x+t)) (0,0)

main :: IO ()
main = do
    [_, t] <- getInts
    arr <- getInts
    print $ solve t arr

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

int main() {
  int H,W;
  cin>> H >> W;
  vector<string> a(H);
  
  for(int i=0;i<H;i++)
    cin>>a.at(i);
  
  for(int i=0;i<W+2;i++)
    cout<<'#';
  cout<<endl;
  
  for(int i=0;i<H;i++)
    cout<<'#'<<a.at(i)<<'#'<<endl;
  
  
  for(int i=0;i<W+2;i++)
    cout<<'#';
  cout<<endl;
  
  
  
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.text.*;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s = sc.next();
		String t = sc.next();
		int a = sc.nextInt();
		int b = sc.nextInt();
		String u = sc.next();
		if(s.equals(u))
			a--;
		if(t.equals(u))
			b--;
		pw.println(a+" "+b);
		pw.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader r) {
			br = new BufferedReader(r);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < arr.length; i++)
				arr[i] = nextInt();
			return arr;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}


Measured memory_bytes: 22356
n = int(input())

xyh = [list(map(int, input().split())) for _ in range(n)]

isOk = False
i = 0
j = 0
constant = -1

for i in range(101):
    for j in range(101):

        constant = -1
        for xyhTemp in xyh:
            if xyhTemp[2] != 0:
                temp = xyhTemp[2] + abs(i - xyhTemp[0]) + abs(j - xyhTemp[1])

                if constant == -1:
                    constant = temp

                if constant != temp:
                    break
        else:

            for p in xyh:
                if p[2] == 0 and constant - abs(i - p[0]) - abs(j - p[1]) > 0:
                    break
            else:
                isOk = True
                break
        
    if isOk:
        break

print(i, j, constant)
        


Measured memory_bytes: 3064
#include <bits/stdc++.h>

using namespace std;
#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

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

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
const ld eps = 1e-9;

template<typename T>
struct edge {
    int src, to;
    T cost;
};

template<typename T>
using Graph = vector<vector<edge<T>>>;


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

    // ifstream in("in.txt");
    // cin.rdbuf(in.rdbuf());

    int n, m; cin >> n >> m;
    Graph<int> g(n);
    REP(i, m) {
        int u, v, s; cin >> u >> v >> s; --u, --v;
        g[u].push_back({u, v, s});
        g[v].push_back({v, u, s});
    }

    vll val(n, LINF);
    vi color(n);
    map<ll,bool> req;
    function<bool(int,int,ll,int)> dfs = [&](int v, int p, ll x, int c) {
        if (val[v] != LINF) {
            if (color[v] == c) {
                return val[v] == x;
            } else {
                ll diff = x - val[v];
                if (diff & 1) return false;
                if (color[v] == 1) {
                    req[diff / 2] = true;
                } else {
                    req[-diff / 2] = true;
                }
                return true;
            }
        }
        val[v] = x;
        color[v] = c;
        bool ret = true;
        for (auto& e : g[v]) {
            if (e.to == p) continue;
            if (!dfs(e.to, v, e.cost - x, -c)) ret = false;
        }
        return ret;
    };

    if (!dfs(0, -1, 0, 1) or req.size() > 1) {
        cout << 0 << endl;
        return 0;
    }


    ll evenmin = LINF, oddmin = LINF;
    REP(i, n) {
        if (color[i] == 1) {
            chmin(evenmin, val[i]);
        }
        else {
            chmin(oddmin, val[i]);
        }
    }

    if (req.size() == 1) {
        cout << (evenmin + req.begin()->first > 0 and oddmin - req.begin()->first > 0 ? 1 : 0) << endl;
        return 0;
    }

    ll cap = oddmin + evenmin - 1;

    cout << max(cap, 0ll) << endl;

    return 0;
}


Measured memory_bytes: 17792