akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int Hok[105000], Wok[105000];
int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, W, H;
    cin >> N >> W >> H;
    while(N--) {
        int x, y, w;
        cin >> x >> y >> w;
        Hok[max(0, y - w)]++;
        Hok[min(H + 1, y + w)]--;
        Wok[max(0, x - w)]++;
        Wok[min(W + 1, x + w)]--;
    }
    for(int i = 1; i <= H; i++) Hok[i] += Hok[i-1];
    for(int i = 1; i <= W; i++) Wok[i] += Wok[i-1];
    bool hok = true;
    bool wok = true;
    for(int i = 0; i < H; i++) {
        if(Hok[i] <= 0) {
            hok = false;
        }
    }
    for(int i = 0; i < W; i++) {
        if(Wok[i] <= 0) {
            wok = false;
        }
    }
    if(hok || wok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3992
N, K = map(int, input().split())
d = []
l = [True] * N

for i in range(K):
    di = int(input())
    # d.append(di)
    Ai = [j-1 for j in map(int, input().split())]
    for j in Ai:
        l[j] = False

# print(N, K)
# for i in range(K):
#     print(d[i])
#     print(A[i])
print(l.count(True))


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

int main() {
    int t, n;

    while (true) {
        cin >> t;
        if (t == 0) break;
        cin >> n;
        int sum = 0;
        rep(i, n) {
            int s, e; cin >> s >> e;
            sum += (e-s);
        }
        if (sum < t)
            cout << t-sum << endl;
        else
            cout << "OK" << endl;
    }
}


Measured memory_bytes: 3080
HN = list(map(int, input().split()))
H = HN[0]; N = HN[1]
AB = [list(map(int, input().split())) for _ in range(N)]
 
DP = [[0]*H for i in range(N)]
 
for i in range(H):
    DP[0][i] = int((1+i//AB[0][0])*AB[0][1])
 
for i in range(1,N):
    for j in range(H):
        if j<AB[i][0]:
            DP[i][j] = int(min([DP[i-1][j], AB[i][1]]))
        else:
            DP[i][j] = min([DP[i-1][j], DP[i][j-AB[i][0]] + AB[i][1]])
 
print(int(DP[N-1][H-1]))

Measured memory_bytes: 119404
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll x; cin >> x; x = abs(x);
    ll ans = 0;
    ll i = 1;
    for(i; i<100000; i++){
        ans += i;
        if(ans >= x) break;
    }

    cout << i << endl;
    // if(ans == x || (ans-x) <= i) cout << i << endl;
    // else{

    // }
}

Measured memory_bytes: 256
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
a,b = map(int,input().split())

if a>=13:
    ans = b
elif 6<=a<=12:
    ans = b//2
else:
    ans = 0

print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



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

#define rep(i, a, b) for (long long int i = (a); i < (b); i++)

using namespace std;
using ll = long long int;
using ld = long double;

auto p = [](auto s) {
    cout << s << endl;
};

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;
    vector<vector<int>> d(N, vector<int>(N));
    rep(i, 0, N) {
        rep(j, 0, N) {
            d[i][j] = abs(i - j);
        }
    }
    X--;
    Y--;

    d[X][Y] = 1;
    d[Y][X] = 1;
    rep(i, 0, N) {
        rep(j, 0, N) {
            d[i][j] = min(d[i][j], d[i][X] + d[X][j]);
        }
    }
    rep(i, 0, N) {
        rep(j, 0, N) {
            d[i][j] = min(d[i][j], d[i][Y] + d[Y][j]);
        }
    }
    vector<int> ans(N);
    rep(i, 0, N) {
        rep(j, 0, N) {
            ans[d[i][j]] += 1;
        }
    }
    
    rep(k, 1, N) {
        p(ans[k] / 2);
    }
    return 0;
}

Measured memory_bytes: 16000
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int n;
int a[100][100];
int used[100];
int mincost[100];
const int INF=1000000000;
int prim(){
  for(int i=0;i<n;i++){
    used[i]=0;
    mincost[i]=INF;
  }
  mincost[0]=0;
  int res=0;
  while(1){
    int v=-1;
    for(int u=0;u<n;u++){
      if((v==-1 || mincost[v]>mincost[u]) && !used[u])v=u;
    }
    if(v==-1)break;
    used[v]=1;
    res+=mincost[v];
    for(int u=0;u<n;u++){
      mincost[u]=min(mincost[u],a[v][u]);
    }
  }
  return res;
}
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      scanf("%d",&a[i][j]);
      if(a[i][j]==-1)a[i][j]=INF;
    }
  }
  printf("%d\n",prim());
  return 0;
}

Measured memory_bytes: 3232
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <cassert>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
typedef pair<int, int> P;
vector<int> G[10010];
int cnt[10010];
int c[10010];
int ans[10010];
int N;
void bfs() {
    queue<int> que;
    rep(i, N) {
        if(cnt[i] == 1) que.push(i);
    }
    rep(i, N) ans[i] = -1;
    int k = 0;
    while(que.size()) {
        int u = que.front(); que.pop();
        if(ans[u] != -1) continue;
        cnt[u]--;
        ans[u] = c[k++];
        for(auto to: G[u]) {
            cnt[to]--;
            if(ans[to] == -1 && cnt[to] == 1)
                que.push(to);
        }
    }
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    if(N == 1) {
        cout << 0 << endl;
        int c; cin >> c;
        cout << c << endl;
        return 0;
    }
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
        cnt[a]++;
        cnt[b]++;
    }
    
    int sum = 0;
    rep(i, N) {
        cin >> c[i];
        sum += c[i];
    }
    sort(c, c + N);
    sum -= c[N - 1];
    cout << sum << endl;
    bfs();
    rep(i, N) {
        if(i != 0) cout << " ";
        cout << ans[i];
        assert(ans[i] >= 0);
    }
    cout << endl;






    return 0;
}


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

int main(){
  int n,a;ll ans=0;
  ll dp[51][51][2501];
  cin>>n>>a;
  vector<int> x(n,0);
  REP(i,n) cin>>x.at(i);
  REP(k,n*a+1){
    REP(i,n+1){
      REP(j,n+1){
        if(k==0){
          if(j==0||i==0) dp[i][j][k]=1;
          else dp[i][j][k]=0;
        }else{
          if(j==0||i==0) dp[i][j][k]=0;
          else{
            if(i<j) dp[i][j][k]=0;
            else if(k<x.at(i-1)) dp[i][j][k]=dp[i-1][j][k];
            else dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-x.at(i-1)];
          }
        }
      }
    }
  }

  for(int i=1;i<=n;i++) ans+=(ll)(dp[n][i][i*a]);
  cout<<ans<<endl;
}

Measured memory_bytes: 51072
#include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define re register
#define int long long
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 1e5 + 5 ; 
int n, m, S ; 
signed main()
{
	n = gi(), m = gi(), S = gi() ;
	int maxn = 1000000000 ;
	if( S != maxn ) {
		rep( i, 1, m ) printf("%lld ", S ) ;
		for( re int i = m + 1; i <= n; ++ i ) printf("%lld ", maxn ) ;
	}
	else {
		if( m == n ) rep( i, 1, m ) printf("%lld ", S ) ;
		else {
			printf("1 ") ; int cnt = 0 ; int maxm = 999999999 ;
			rep( i, 1, m ) {
				cnt ^= 1 ; 
				if( cnt == 0 ) printf("1 ") ;
				else printf("%lld ", maxm ) ;
			}
			for( re int i = m + 2; i <= n; ++ i ) {
				if( cnt == 0 ) printf("%lld ", 1ll ) ;
				else printf("%lld ", maxm ) ;
			}
		}
	}
	return 0 ;
}

Measured memory_bytes: 1280
sx,sy,gx,gy=map(int,input().split())
s=''
t=''
for i in range(gx-sx):
  s+='R'
  t+='L'
for i in range(gy-sy):
  s+='U'
  t+='D'
s+=t
s+='D'
t='U'
for i in range(gx-sx+1):
  s+='R'
  t+='L'
for i in range(gy-sy+1):
  s+='U'
  t+='D'
s+='L'+t+'R'
print(s)

Measured memory_bytes: 9012
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

#define int long long

template<typename A, size_t N, typename T>

void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここにグローバル変数宣言

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数宣言




//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ll a;
	double b;
	cin >> a >> b;
	ll c = b*100 + 0.1;
	ll d = a*c;
	ll e = d/100;
	cout << e << endl;



return 0;

}

Measured memory_bytes: 3696
#include <cstdio>

const int N = 5000;
const int MOD = 998244353;

int two[N], binom[N][N];

int main()
{
    two[0] = binom[0][0] = 1;
    for (int i = 1; i < N; ++ i) {
        two[i] = 2 * two[i - 1] % MOD;
        binom[i][0] = 1;
        for (int j = 1; j <= i; ++ j) {
            binom[i][j] = (binom[i - 1][j - 1] + binom[i - 1][j]) % MOD;
        }
    }
    int m, n;
    scanf("%d%d", &m, &n);
    for (int sum = 2; sum <= m + m; ++ sum) {
        int par = 0, ind = m;
        bool sam = false;
        for (int i = 1; i + i <= sum && i <= m; ++ i) {
            if (sum - i > m) {
                continue;
            }
            if (i < sum - i) {
                par ++, ind -= 2;
            } else if (i == sum - i) {
                ind --, sam = true;
            }
        }
        int result = 0;
        for (int must = 0; must <= par; ++ must) {
            int a = n - 1 + ind;
            int b = must + ind - 1;
            if (a >= b) {
                result += 1LL * binom[par][must] * two[must] % MOD * binom[a][b] % MOD;
                if (result >= MOD) {
                    result -= MOD;
                }
            }
        }
        if (sam) {
            for (int must = 0; must <= par; ++ must) {
                int a = n - 2 + ind;
                int b = must + ind - 1;
                if (a >= b) {
                    result += 1LL * binom[par][must] * two[must] % MOD * binom[a][b] % MOD;
                    if (result >= MOD) {
                        result -= MOD;
                    }
                }
            }
        }
        printf("%d\n", result);
    }
}

Measured memory_bytes: 96256
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <cstdlib>

using namespace std;
typedef long long int ll;

bool debug;
#define show(x) if (debug) {cout << "" # x << " = " << x << endl;}
#define rep(x, a, b) for (int x = a; x < b; x++)

int main(int argc, char **argv)
{
  (void)argv; debug = argc > 1;

  string s;

  cin >> s;

  int len = s.size();
  vector<bool> ok(len + 1, false);
  ok[len] = true;

  for(int i = len - 1; i >= 0; i--) {
    bool pohe = false;

    if (i + 5 <= len) {
      if (s.substr(i, 5) == "dream")
        pohe = pohe || ok[i + 5];
    }

    if (i + 7 <= len) {
      if (s.substr(i, 7) == "dreamer")
        pohe = pohe || ok[i + 7];
    }

    if (i + 5 <= len) {
      if (s.substr(i, 5) == "erase")
        pohe = pohe || ok[i + 5];
    }

    if (i + 6 <= len) {
      if (s.substr(i, 6) == "eraser")
        pohe = pohe || ok[i + 6];
    }

    ok[i] = pohe;
  }

  if (debug) {
    cout << s << endl;
    rep (i, 0, len + 1)
      cout << (ok[i]?1:0);
    cout << endl;
  }

  cout << (ok[0]?"YES":"NO") << endl;

  return 0;
}


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

#define endl '\n'
#define ll long long
#define For(i,l,r) for(int i = l; i <= r; i++)
#define ForR(i,l,r) for(int i = l; i >= r; i--)

int main(){
//	freopen("","r",stdin);
//	freopen("","w",stdout);
	ios_base::sync_with_stdio(0);
    cin.tie(0);
	ll n;
	cin>>n;
	if(n>=30)cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>
long long a[300];
long long x;
int main() {
	scanf("%lld", &x);
	for (long long i = -100; i < 200; i++) {
		a[i + 100] = i * i * i * i * i;
	}
	for (int i = 0; i < 300; i++) {
		for (int j = 0; j < 300; j++) {
			if (a[i] - a[j] == x) {
				printf("%d %d\n", i - 100, j - 100);
				return 0;
			}
		}
	}
}

Measured memory_bytes: 1732
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;

int main(){
  string S;
  cin >> S;
  int ans=0;
  for(int i=0; i<(int)S.size(); i++){
    if(S[i] == 'A'){
      for(int j=i+1; j<(int)S.size(); j++){
        if(S[j] == 'Z'){
          ans = j-i+1;
        }
      }
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) ((lli)(x).size())
#define endl '\n'

#ifdef SANJU
    #define localsys 1
#else
    #define localsys 0
#endif

using   lli     =   long long;
using   lld     =   long double;
using   ulli    =   unsigned long long int;
using   pll     =   pair<lli, lli>;
using   ttt     =   pair<lli, pll>;
using   vttt    =   vector<ttt>;
using   vll     =   vector<pll>;
using   vl      =   vector<lli>;
using   vi      =   vector<int>;
using   vvi     =   vector<vector<int>>;
using   cd      =   complex<lld>;

int answer(vector<int> A[],int i,vector<int>&visit)
{
    if(A[i].size()==0)
    {
        visit[i]=0;
        return 0;
    }
    if(visit[i]!=-1)
    {
        return visit[i];
    }
    
    int res=0;
    for(int j=0;j<A[i].size();j++)
    {
        res=max(res,answer(A,A[i][j],visit)+1);
    }
    return visit[i]=res;

}


void sanjeev(int kkkk)
{
    int n,m;
    cin>>n>>m;
    vector<int> A[n+1];

    vector<int>visit(n+1,-1);

    for(int i=0;i<m;i++)
    { 
        int s,e;
        cin>>s>>e;
        A[s].push_back(e);
    }
    int res=0;
    for(int i=0;i<n+1;i++)
    {
        res=max(res,answer(A,i,visit));
    }

    cout<<res<<endl;

    // for(int i=0;i<n+1;i++)cout<<visit[i]<<" ";

}

int main()
{
    if(!localsys) ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) { sanjeev(i+1); }
    if(localsys) system("pause");
}


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

const int MAXN = 110;
const int MAXE = MAXN * MAXN;
int A[MAXN][MAXN], at[MAXE];
std::queue<int> G[MAXN][MAXN];
int col[2][MAXN][MAXN], ans[MAXE];
void dfs(int l, int r, int x, int y, int cx, int cy) {
	col[l][x][cx] = y;
	if (int v = col[r][y][cx]) {
		col[l][v][cx] = 0;
		col[r][y][cx] = x;
		dfs(r, l, y, v, cy, cx);
	} else col[r][y][cx] = x;
}
void adde(int x, int y) {
	int ca, cb;
	static int bak = 0;
	G[x][y].push(++bak);
	for (ca = 1; col[0][x][ca]; ++ca) ;
	for (cb = 1; col[1][y][cb]; ++cb) ;
	dfs(0, 1, x, y, ca, cb);
}
int B[MAXN][MAXN];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	int n, m; std::cin >> n >> m;
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			std::cin >> A[i][j], at[A[i][j]] = i;
	for (int i = 1; i <= n * m; ++i)
		adde(at[i], (i - 1) / m + 1);
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			if (int v = col[0][i][j])
				ans[G[i][v].front()] = j, G[i][v].pop();
	for (int i = 1; i <= n * m; ++i)
		B[at[i]][ans[i]] = i;
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			std::cout << B[i][j] << (" \n" [j == m]);
	for (int i = 1; i <= n * m; ++i)
		B[(i - 1) / m + 1][ans[i]] = i;
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			std::cout << B[i][j] << (" \n" [j == m]);
	return 0;
}


Measured memory_bytes: 8704
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = 0
for i in range(n):
  ans += b[a[i]-1]
  if i != n-1 and a[i+1]-a[i] == 1:
    ans += c[a[i]-1]
print(ans)

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

namespace _20191201
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(a[0] != b[0] ? 1 : 0);
        }
    }
}


Measured memory_bytes: 13268
# N = gets.chomp.to_i
X, Y = gets.chomp.split.map(&:to_i)
# S = gets.chomp.chars

ans = 0
case X
when 1
  ans += 300000
when 2
  ans += 200000
when 3
  ans +=   100000
end

case Y
when 1
  ans += 300000
when 2
  ans += 200000
when 3
  ans +=   100000
end

if X == 1 && Y == 1
  ans += 400000
end

p ans

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const string T = "ACGT";

int main(){
    string s;
    cin >> s;
    int ans = 0, now = 0;
    for (char c : s) {
        bool isT = false;
        for (char c2 : T) {
            if (c == c2) isT = true;
        }
        if (isT) {
            ++now;
            ans = max(now, ans);
        }
        else now = 0;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define Mp make_pair
#define pb push_back

using ll = long long;
using db = double;
using pii = pair<int, int>;
using vi = vector<int>;
mt19937 mrand(time(0));
ll get(ll r) { return ((ll)mrand() * mrand() % r + r) % r; }
ll get(ll l, ll r) { return get(r - l + 1) + l; }

const int N = 2e5 + 100;
int n, m, seg[N << 2], val[N << 2], tag[N << 2];
#define lc(k) (k << 1)
#define rc(k) (k << 1 | 1)
void build(int k, int l, int r) {
    if(l == r) return val[k] = -l, seg[k] = 0, void();
    int mid = l + r >> 1;
    build(lc(k), l, mid), build(rc(k), mid + 1, r);
    seg[k] = min(seg[lc(k)], seg[rc(k)]);
}
void modify(int k, int l, int r, int L, int R, int v) {
    if(L <= l && r <= R) return seg[k] = v + l, tag[k] = val[k] = v, void();
    int mid = l + r >> 1;
    if(tag[k]) { // pushdown
        tag[lc(k)] = tag[rc(k)] = tag[k];
        val[lc(k)] = val[rc(k)] = tag[k];
        seg[lc(k)] = tag[k] + l;
        seg[rc(k)] = tag[k] + mid + 1;
        tag[k] = 0;
    }
    if(L <= mid) modify(lc(k), l, mid, L, R, v);
    if(R > mid) modify(rc(k), mid + 1, r, L, R, v);
    seg[k] = min(seg[lc(k)], seg[rc(k)]);
}
int query(int k, int l, int r, int x) {
    if(l == r) return val[k];
    int mid = l + r >> 1;
    if(tag[k]) { // pushdown
        tag[lc(k)] = tag[rc(k)] = tag[k];
        val[lc(k)] = val[rc(k)] = tag[k];
        seg[lc(k)] = tag[k] + l;
        seg[rc(k)] = tag[k] + mid + 1;
        tag[k] = 0;
    }
    if(x <= mid) return query(lc(k), l, mid, x);
    else return query(rc(k), mid + 1, r, x);
}
signed main() {
    scanf("%d %d", &n, &m);
    build(1, 1, m);
    // for(int j = 1; j <= m; j++) printf("%d ", query(1, 1, m, j)); puts("");
    for(int i = 1; i <= n; i++) {
        int l, r; scanf("%d %d", &l, &r);
        modify(1, 1, m, l, r, l - 1 == 0 ? 1e9 : query(1, 1, m, l - 1));
        // for(int j = 1; j <= m; j++) printf("%d ", query(1, 1, m, j)); puts("");
        printf("%d\n", seg[1] < 1e9 ? seg[1] + i : -1);
    }
    fprintf(stderr, "time=%.4f\n", (db)clock()/CLOCKS_PER_SEC);
    return 0;
    /* 取模直接除，爆零两行泪
     * 不开ll见祖宗
     */
}

Measured memory_bytes: 9988
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = ll(1e9) + 7LL;

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

ll extgcd(ll a, ll b, ll &x, ll &y) {  // extended Euclidean algorithm, used for
                                       // modular multiplicative inverse
    ll d = a;
    if (b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else {
        x = 1;
        y = 0;
    }
    return d;  // return gcd(a,b)
}

ll mod_inv(ll a, ll m = MOD) {  // return inv(a) mod m, ax+my=gcd(a,m)=1, m is
                                // prime int, ax-1=mq equiv. ax-mq=1
    ll x, y;
    extgcd(a, m, x, y);
    return (m + x % m) % m;  // From (possibly) negative x to positive x
}

vector<ll> fact, invfact;
void calc_fact(int n, ll m = MOD) {  // Calculate factorial up to n
    fact.resize(n + 1);
    invfact.resize(n + 1);
    fact[0] = invfact[0] = 1;
    REP(i, n) {
        fact[i + 1] = fact[i] * (i + 1) % m;
        invfact[i + 1] = invfact[i] * mod_inv(i + 1) % m;
    }
}
ll perm(int n, int k, ll m = MOD) {
    if (n < 0 || k < 0 || k > n) return 0;
    return fact[n] * invfact[n - k] % m;
}
ll comb(int n, int k, ll m = MOD) {
    if (n < 0 || k < 0 || k > n) return 0;
    return (fact[n] * invfact[n - k] % m) * invfact[k] % m;
}

int main() {
    int h,n;
    cin >> h >> n;
    vll a(n),b(n);
    REP(i, n) { cin >> a[i] >> b[i]; }
    vector<vll> dp(n + 1, vll(h+1, LLONG_MAX/2LL));
    REP(i, n + 1) { dp[i][0] = 0; }
    REP(i,n){
        REP(j,h+1){
            dp[i+1][j] = min(dp[i+1][j],dp[i][j]);
            if (j - a[i] >= 0){
                dp[i + 1][j] = min(dp[i + 1][j], dp[i + 1][j - a[i]] + b[i]);
            } else {
                dp[i + 1][j] = min(dp[i + 1][j], b[i]);
            }
        }
    }
    cout << dp[n][h] << endl;
}

Measured memory_bytes: 81528
day = strip(readline())

if day == "SUN"
  println(7)
elseif day == "MON"
  println(6)
elseif day == "TUE"
  println(5)
elseif day == "WED"
  println(4)
elseif day == "THU"
  println(3)
elseif day == "FRI"
  println(2)
elseif day == "SAT"
  println(1)
end


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

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ll n, k;
  cin >> n >> k;

  vector<ll> h(n, 0);
  for (ll i = 0; i < n; ++i) {
    cin >> h[i];
  }

  vector<ll> dp(n, INT64_MAX);
  dp[0] = 0;
  for (ll i = 1; i < n; ++i) {
    for (ll j = 1; j <= k; ++j) {
      if (i >= j) {
        dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
      }
    }
  }

  cout << dp[n-1] << endl;
  
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int n,count1=0,count2=0,count4=0;
  cin >>n;
  long long int a[n];
  for(int i=0;i<n;i++){
  	cin >> a[i];
    if(a[i]%4==0)count4++;
    else if(a[i]%2==0)count2++;
    else count1++;
  }
  if(count4>=n/2)cout <<"Yes"<<endl;
  else if(count4*2+count2>=n)cout <<"Yes"<<endl;
  else cout <<"No" <<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (int i = l; i < r; ++i)
#define int long long
#ifdef DEBUG
#define dout cout
#else
std::stringstream dout;
#endif
using namespace std;
typedef pair<int, int> P;
struct edge {
	int to, cost;
};
// other libs
int gcd(int a, int b) {
	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}
int lcm(int a, int b) {
	return a * b / gcd(a, b);
}

class dijkstra {
  private:
	int V;
	int d[100002];
	priority_queue<P, vector<P>, greater<>> que;

  public:
	dijkstra(int v, int s, vector<edge> G[]) {
		V = v;
		update(s, G);
	}

	void update(int s, vector<edge> G[]) {
		fill(d, d + V + 1, 100000000000ll);
		d[s] = 0;
		que.push(make_pair(0, s));
		while (!que.empty()) {
			P p = que.top();
			que.pop();
			int v = p.second;
			if (d[v] < p.first)
				continue;
			rep(i, G[v].size()) {
				edge e = G[v][i];
				if (d[e.to] > d[v] + e.cost) {
					d[e.to] = d[v] + e.cost;
					que.push(make_pair(d[e.to], e.to));
				}
			}
		}
	}

	int find(int e) {
		return d[e];
	}
};
template<typename T>
class Union_Find {
  private:
	vector<T> t, s;

  public:
	Union_Find(T max_length) {
		rep(i, max_length + 1) {
			t.push_back(i);
			s.push_back(1);
		}
	}

	void Union(T x, T y) {
		if (same(x, y))
			return;
		T tx = Find(x), ty = Find(y);
		if (s[tx] < s[ty]) {
			s[ty] += s[tx];
			t[tx] = ty;
		}
		else if (s[tx] > s[ty]) {
			s[tx] += s[ty];
			t[ty] = tx;
		}
		else if (tx > ty) {
			t[tx] = ty;
			s[ty] += s[tx];
		}
		else {
			t[ty] = tx;
			s[tx] += s[ty];
		}
	}
	T Find(T n) {
		if (t[n] == n)
			return n;
		else
			return t[n] = Find(t[n]);
	}

	bool same(T x, T y) {
		return Find(x) == Find(y);
	}

	T get_Size(size_t a) {
		return s[a];
	}
};
bool ifPrime(int n) {
	if (n == 1)
		return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)
			return false;
	}
	return true;
}

set<int> prime_num_factor(int n){
    if(n<2)return set<int>();
    set<int> prime;
    prime.insert(2);
    for(int i=3;i<=n;i++){
        for(int it:prime){
            if(it*it>i){
                prime.insert(i);
                break;
            }
            if(i%it==0)break;
        }
    }
    return prime;
}
vector<int> makeDivisors(int n){
    vector<int> re;
    REP(i,1,sqrt(n)+1){
        if(n%i==0){
            re.push_back(i);
            if(i!=n/i)re.push_back(n/i);
        }
    }
    return re;
}
signed main(signed argc, char* argv[]) {
    int n,m;
    cin>>n>>m;
    vector<vector<int>> dp(m+1,vector<int>((1<<(n)),1000000007));
    dp[0][0]=0;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        vector<int> c(b);
        rep(j,b)cin>>c[j];
        rep(j,(1<<n)){
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
            int it=j;
            rep(k,b){
                it|=(1<<(c[k]-1));
            }
            if(it<(1<<n))
            dp[i+1][it]=min(dp[i+1][it],dp[i][j]+a);
        }
    }
    cout<<(dp[m][(1<<n)-1]==1000000007?-1:dp[m][(1<<n)-1]);
}

Measured memory_bytes: 32384
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

// 入力
int N;
vector<int> a;

int main(void) {
    cin >> N;
    for (int i = 0; i < N; ++i) {
        int a_in;
        cin >> a_in;
        a.push_back(a_in);
    }

    sort(a.begin(), a.end());

    int longest1 = 0, longest2 = 0;
    long long ans = 0;
    for (int i = N - 1; i >= 0; --i) {
        if (a[i] == a[i - 1] && longest1 != 0) {
            longest2 = a[i];
            ans = (long long) longest1 * longest2;
            break;
        }
        if (a[i] == a[i - 1] && longest1 == 0) {
            longest1 = a[i];
            --i;
        }
    }

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


Measured memory_bytes: 892
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
typedef long long ll;

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

    // input
    int N;
    cin >> N;
    vector<int> vec(N);
    for (int i = 0; i < N; ++i) cin >> vec[i];
    
    // calc
    for (int j = 0; j < N; ++j) {
        if (vec[j]%2 != 0) {
            cout << "first" << "\n";
            return 0;
        }
    }
    cout << "second" << "\n";
    
    return 0;
}


Measured memory_bytes: 640
use std::io;


fn main() {
    let a = read_one::<usize>();
    let b = read_one::<usize>();
    println!("{}", 6 / a / b);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
def solve():
    N,W = map(int,input().split())
    weight = []
    value = []
    for i in range(N):
        w,v = map(int,input().split())
        weight.append(w)
        value.append(v)
    
    dp = [[0] * (W+1) for _ in range(N+1)]

    for i in range(1,N+1):
        for w in range(W+1):
            if w - weight[i-1] < 0:
                dp[i][w] = max(dp[i][w],dp[i-1][w])
            else:
                dp[i][w] = max(dp[i][w], dp[i-1][w-weight[i-1]]+value[i-1])
                dp[i][w] = max(dp[i][w],dp[i-1][w])
    
    print(max(*dp[-1]))


if __name__ == '__main__':
    solve()

Measured memory_bytes: 119408
def main():
    N = int(input())

    ac = 0
    wa = 0
    tle = 0
    re = 0

    for n in range(N):
        s = input()
        if s == "AC":
            ac += 1
        elif s == "WA":
            wa += 1
        elif s == "TLE":
            tle += 1
        else:
            re += 1
    
    print(f"AC x {ac}")
    print(f"WA x {wa}")
    print(f"TLE x {tle}")
    print(f"RE x {re}")


if __name__ == '__main__':
    main()

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

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9) + 7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n)
{
	vector<pair<ll, ll>> p;
	for (ll i = 2; i * i <= n; i++)
	{
		if ((n % i) != 0)
			continue;
		pair<ll, ll> a = make_pair(i, 0);
		while ((n % i) == 0)
		{
			n /= i;
			a.second += 1;
		}
		p.push_back(a);
	}

	if (n != 1)
		p.push_back(make_pair(n, 1));
	return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a)
{
	ll b = MOD, u = 1, v = 0;
	while (b)
	{
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0)
	{
		u += MOD;
	}
	return u;
}
// 順列
ll permutation(const ll n, const ll m)
{
	ll result = 1;
	for (ll i = n; i > n - m; i--)
	{
		result = (result * i) % MOD;
	}
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x)
{
	if (x == 0)
		return 1;
	ll res = repeat_square(n, x / 2);
	res = res * res % MOD;
	if ((x % 2) == 1)
		res = res * n % MOD;
	return res;
}
// 組み合わせ nCm
ll combination(ll n, ll m)
{
	ll p = permutation(n, m);
	ll div = 1;
	for (ll i = 2; i <= m; i++)
	{
		div = (div * i) % MOD;
	}
	return (p * modinv(div)) % MOD;
}

void fill(int x, vector<int> &dp) {
	if(dp[x]) return;
	for(int i = 1; i*x <= 1e6; i++) {
		dp[i*x] = true;
	}
	return;
}

int main() {
	string A, B, C;
  cin >> A >> B >> C;

  string next = "a";
  while(true) {
    if (next == "a") {
      if (A.length() == 0) {
        cout << "A" << endl;
        return 0;
      }
      next = A.substr(0, 1);
      A = A.substr(1, A.length());
    } else if (next == "b") {
      if (B.length() == 0) {
        cout << "B" << endl;
        return 0;
      }
      next = B.substr(0, 1);
      B = B.substr(1, B.length());
    } else {
      if (C.length() == 0) {
        cout << "C" << endl;
        return 0;
      }
      next = C.substr(0, 1);
      C = C.substr(1, C.length());
    }
  }
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll labs(ll x){
	if(x<0LL)return -x;
	return x;
}

ll x,y;


int main(void){
	scanf("%lld%lld",&x,&y);
	printf("%s\n",labs(x-y)<=1?"Brown":"Alice");
	return 0;
}


Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#include <functional>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi   vector<int> 
#define   co(x)  cout << x << '\n' 
#define   dbg(x)  cerr << #x << " = " << x << '\n' 
#define   bitcount(x)  (int)__builtin_popcount(x) 
#define   sz(x)  (int)x.size()
#define   all(a) a.begin(),a.end() 
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int  A, B, Q, x ; 
    cin >> A >> B >> Q ; 
    vi s(A),t(B);
    for (int &i: s) cin >> i ; 
    for (int &i: t) cin >> i ; 
    while (Q--){
        cin >> x ; 
        int  s2, t2 ; 
        auto  s1 = lower_bound(s.begin(),s.end(),x) ; 
        if (s1 == s.end()) s1-- ; 
        if (s1 == s.begin()) {
            if (A>1) s2 = *(s1+1) ; 
            else s2 = *s1;
        }
        else {
            if (A>1) s2 = *(s1-1) ; 
            else s2 = *s1;
        }
        auto  t1 = lower_bound(t.begin(),t.end(),x); 
        if (t1 == t.end()) t1-- ; 
        if (t1 == t.begin()) {
            if (B>1) t2 = *(t1+1) ; 
            else t2 = *t1;
        }
        else {
            if (B>1) t2 = *(t1-1) ; 
            else t2 = *t1;
        }
        int  ss[2]={*s1, s2} ,tt[2]={*t1, t2}; 
        int  ans = 2e12 ; 
        for (int i=0;i<2;i++){
            for (int j=0;j<2;j++){
                ans = min(ans, min(abs(x-ss[i]) + abs(ss[i]-tt[j]),abs(x-tt[i]) + abs(tt[i]-ss[j]))) ; 
            }
        }
        co( ans ) ; 
    }
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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

int N;
vector<int> A;
int flag[1000010];

int gcd(int a, int b) {
   while (b) {
       int t = a;
       a = b;
       b = t%b;
   }
   return a;
}

vector<P> factorize(int n) {
    vector<P> res;
    for (int i=2; i*i<=n; i++) {
        int cnt = 0;
        while (n%i==0) {
            cnt++;
            n /= i;
        }
        if (cnt>0) res.pb(P(i, cnt));
    }
    if (n!=1) res.pb(P(n, 1));
    return res;
}

signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N;
    bool one = false;
    rep(i, N) {
        int Ai; cin >> Ai;
        if (Ai==1) one = true;
        if (Ai!=1) A.pb(Ai);
    }
    N = A.size();
    if (N>78500) {
        int G = 0;
        rep(i, N) G = gcd(G, A[i]);
        if (G==1) cout << "setwise coprime" << endl;
        else cout << "not coprime" << endl;
    }
    else {
        bool F = true;
        rep(i, N) {
            vector<P> fct = factorize(A[i]);
            rep(j, fct.size()) {
                int p = fct[j].first;
                if (flag[p]==1) F = false;
                flag[p] = 1;
            }
        }
        if (F) cout << "pairwise coprime" << endl;
        else {
            int G = 0;
            rep(i, N) G = gcd(G, A[i]);
            if (G==1) cout << "setwise coprime" << endl;
            else {
                if (one) cout << "setwise coprime" << endl;
                else cout << "not coprime" << endl;
            }
        }
    }
}

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

int main(){
    int n;
    cin >> n;
    vector<long int> h(n);
    for(int i = 0; i < h.size(); i++){
        cin >> h.at(i);
    }
    int cnt = 0;
    for(int i = 0; i < n-1; i++){
        if(h.at(i) < h.at(i+1)){
            cnt = 0;
            continue;
        }else if(h.at(i) == h.at(i+1)){
            continue;
        }else{
            if(h.at(i) - 1 <= h.at(i+1)){
                h.at(i)--;
                cnt++;
                if(cnt >= 2){
                    cout << "No" << endl;
                    return 0;
                }
            }else{
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;


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

  int ans = 0;
  while( n != 1 ) {
    if( n % 3 ) n = n / 3 + 1;
    else n = n / 3;
    //cout << n << endl;
    ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3104
#include <iostream>
#include <unordered_set>
using namespace std;
#include <vector>
int main(){
    int n;
    int k;
    cin>>n>>k;
    vector<int> v;
    while(k--){
        int d;
        cin>>d;
        while(d--){
            int a;
            cin>>a;
            v.push_back(a);
        }
    }
    unordered_set<int> set;
    for (const int &i: v) {
        set.insert(i);
    }
    int count=0;
    for(int i=1;i<n+1;i++){
        if(set.find(i)==set.end()){
            count=count+1;
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3652
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200010


int main() {
	char a[N + 1];
	int b[N + 1];
	int c[N + 1];
	f(i, N + 1) {
		a[i] = 0;
		b[i] = 0;
		c[i] = 0;
	}
	int n, k;
	int x, y, z;
	int s, ans;
	bool v = true;
	ans = 0;
	scanf("%d", &n);
	scanf("%s", a);
	b[0] = 0;
	f(i, n) {
		if (a[i] == '.')b[i + 1] = b[i] + 1;
		else b[i + 1] = b[i];
	}
	c[n] = 0;
	for (int i = n - 1; i >= 0; i--) {
		if (a[i] == '#')c[i] = c[i + 1] + 1;
		else c[i] = c[i + 1];
	}
	ans = MOD;
	f(i, n + 1) {
		ans = min(n - b[i] - c[i], ans);
	}

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


	return 0;
}

Measured memory_bytes: 1920
while 1:
    n = input()
    if n==0:
        break
    w, h = map(int, raw_input().split())
    m = [[0]*w for i in range(h)]
    l = [[0]*(w+1) for i in range(h+1)]
    for i in xrange(n):
        x, y = map(int, raw_input().split())
        m[y-1][x-1] = 1
    for i in xrange(h):
        temp = 0
        for j in xrange(w):
            temp += m[i][j]
            l[i+1][j+1] = l[i][j+1] + temp

    s, t = map(int, raw_input().split())
    ans = 0
    for i in xrange(h-t+1):
        for j in xrange(w-s+1):
            ans = max(ans, l[i+t][j+s] - l[i][j+s] - l[i+t][j] + l[i][j])
    print ans

Measured memory_bytes: 6612
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    #endif
    // int T;cin>>T;while(T--) 
    {
        int a, b, c, d;
        cin>>a;
        cout<<(1000 - a%1000)%1000<<endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 100000000000000
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);

using namespace std;
typedef long long int  ll;
typedef pair<int, int> P;


//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}


////////////////////////////////////////////////////////////////////

int main() {
string s;
cin>>s;
ll n;
n=s.size();

ll dp[n];
ll pow2[n+5];
ll pow3[n+5];
pow2[0]=1;
pow3[0]=1;
rep(i, n+4){
pow2[i]=pow2[i-1]*2;
pow3[i]=pow3[i-1]*3;
pow2[i]%=MOD;
pow3[i]%=MOD;
if(i<=n-1) dp[i]=-1;
}

ll ans=0;
ll cnt=1;
rrep(i, n){
	if(s[i]=='1'){
		dp[i]=cnt;
		cnt++;
	}
}

ll dpt=0;
rrep(i, n){
if(dp[i]>=1&& i!=n-1){
ll k=pow3[n-i-1];
k*=pow2[dp[i]-1];
k%=MOD;
ans+=k;
ans%=MOD;
dpt=dp[i];
}
if(i==n-1){
	if(s[i]=='1'){
		ans+=3*pow2[dpt];
		ans%=MOD;
	}
	else{ans+=1*pow2[dpt];
	ans%=MOD;}
}

}

cout<<ans<<endl;


}



Measured memory_bytes: 2816