akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
int n,m;

vector<vector<int> > calc(vector<vector<int> > mat,ll t){
    if(t==1) return mat;
	vector<vector<int> > tmp=calc(mat,t/2),res(n,vector<int>(n,0));
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<n;k++){
				res[i][j]+=tmp[i][k]*tmp[k][j];
				res[i][j]%=m;
			}
		}
	}
	if(t%2==0) return res;
	tmp=res;
	for(int i=0;i<n;i++)for(int j=0;j<n;j++) res[i][j]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<n;k++){
				res[i][j]+=tmp[i][k]*mat[k][j];
				res[i][j]%=m;
			}
		}
	}
	return res;
}

int pow(int x,ll a){
	if(a==0) return 1;
	int tmp=pow(x,a/2);
	if(a%2) return (tmp*tmp*x)%m;
	else return (tmp*tmp)%m;
}

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

	int a,b,c;ll t;
	while(cin>>n>>m>>a>>b>>c>>t,n){
		vector<int> s(n);
		for(int i=0;i<n;i++) cin>>s[i];
		if(n==1) cout<<pow(s[0],t)<<endl;
		else if(t==0){
			cout<<s[0];
			for(int i=1;i<n;i++) cout<<" "<<s[i];
			cout<<endl;
		}
		else{
			vector<vector<int> > mat(n,vector<int>(n,0));
			mat[0][0]=b;mat[0][1]=c;
			for(int i=1;i<n-1;i++){
				mat[i][i-1]=a;
				mat[i][i]=b;
				mat[i][i+1]=c;
			}
			mat[n-1][n-2]=a;mat[n-1][n-1]=b;
			vector<vector<int> > res=calc(mat,t);
            /*
            for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){
					cout<<res[i][j];
				}
				cout<<endl;
			}*/
			vector<int> ans(n,0);
			for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){
					ans[i]+=res[i][j]*s[j];
					ans[i]%=m;
				}
			}
			cout<<ans[0];
			for(int i=1;i<n;i++) cout<<" "<<ans[i];
			cout<<endl;
		}
	}
}



Measured memory_bytes: 3380
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    int N;
    cin >> N;
    int ans = 0;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    for(int i=0; i<N; ++i){
        if((i+1)%2==1 && a[i]%2==1) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

int main (){
    int H,W;
    scanf("%d%d",&H,&W);
    while(1){
        for (int i = 0; i < H; i++){
            for (int j = 0; j < W; j++){
                if((i+j)%2 == 0) printf("#");
                else printf(".");
            }
            printf("\n");
        }
        printf("\n");
        scanf("%d%d",&H,&W);
        if (H == 0 && W == 0) break;
    }
    return 0;
    
}



Measured memory_bytes: 2620
#include <bits/stdc++.h>
using namespace std;
const int Maxn=205;
int a[Maxn],n,l,ans,sum,mini=0x3f3f3f3f;
int main()
{
	scanf("%d%d",&n,&l);
	for(int i=1;i<=n;i++)
	{
		a[i]=i+l-1,sum+=a[i];
		if(mini>abs(a[i]))
			ans=a[i],mini=abs(a[i]);
	}
	printf("%d",sum-ans);
	return 0;
}

Measured memory_bytes: 256
MOD =  10**9+7

def power(n, k)
  return 1 if k.zero?
  if k.even?
   power(n, k/2)**2%MOD
  else
    n*power(n,(k-1)/2)**2%MOD
  end
end

n, k = gets.strip.split.map(&:to_i)

@fac = [1, 1]
2.upto(n) do |num|
  @fac[num] = num * @fac[num-1] %MOD
end

#p @fac

@ifac = [1, 1]
@ifac [n] = power(@fac[n], MOD-2)%MOD
(n-1).downto(2) do |num|
  @ifac[num] = @ifac[num+1] * (num+1) % MOD
end

def comb(n, k)
  return 0 if n<k || n<0 || k<0
  up = @fac[n] % MOD
  down = (@ifac[n-k] * @ifac[k]) % MOD
  (up*down) % MOD
end


# n-k個並んだ赤いボールの両端を含めたn-k+1個のスペースから、i個選ぶ
# k個をそれらのスペースに配置する
# そのパターン数は 両端を含まないk-1個のスペースに(i-1)個の仕切をはさむのと同じ
# (n-k+1)Ci * (k-1)C(i-1) が任意のiに対するボールの配置パターン数

(1..k).each do |i|
  p (comb(n-k+1, i) * comb(k-1, i-1)) % MOD
end





Measured memory_bytes: 2044
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<ll, ll>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;

ll d(P a, P b) {
    return abs(a.first-b.first)+abs(a.second-b.second);
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<P> v(n);
    rep(i, n) cin >> v[i].first >> v[i].second;
    sort(whole(v));
    P up = v[0];
    P down = v[0];
    ll ans = 0;
    rep(i, n) {
        if (i==0) continue;
        chmax(ans, d(up, v[i]));
        chmax(ans, d(down, v[i]));
        if (v[i].second>up.second) {
            ll dx = v[i].first-up.first;
            ll dy = v[i].second-up.second;
            if (dx<dy) up = v[i];
        }
        if (v[i].second<down.second) {
            ll dx = v[i].first-down.first;
            ll dy = down.second-v[i].second;
            if (dx<dy) down = v[i];
        }
    }
    
    pr(ans);
    return 0;
}


Measured memory_bytes: 6364
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
vector<ll> adj[200007] ;
ll vis[200007] ;

void dfs(ll n ) {
    vis[n]=1 ;
    for (auto it : adj[n]) {
        if (!vis[it]) dfs(it) ;
    }

}

int main() {

    ll n , m ;
    cin >> n>> m ;
    while(m--) {
        ll a , b ,c ;
        cin >> a >> b >> c ;
        adj[a].push_back(b) ;
        adj[b].push_back(a) ;
    }
    ll ans = 0 ;
    for (ll i =1 ; i<=n ;i++) {
        if (!vis[i]) {
            dfs(i) ;
            ans++ ;
        }
    }

    cout << ans << endl ;

    return 0 ;
}


Measured memory_bytes: 12032
while 1:
    n = int(input())
    if n == 0:
        break

    large = 0
    for _ in range(n):
        p, d1, d2 = map(int, input().split())
        if large < d1 + d2:
            large = d1 + d2
            number = p

    print(number, large)



Measured memory_bytes: 5612
"use strict";
function main(input) {
    let line = input.split(/\r?\n/g);
    let arr = line[0].split(" ");
    const N = parseInt(arr[0]), K = parseInt(arr[1]);
    console.log(N.toString(K).length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int a = sc.NextInt();
        int b = sc.NextInt();
        int c = sc.NextInt();
        int d = sc.NextInt();

        int answer = Math.Max(a * b, c * d);

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  if(n<10){
    cout<<n<<endl;
    return 0;
  }
  ll ans=0;
  ll kake=10;
  ll cnt=0;
  map<pair<ll,ll>,ll>MP;
  for(int i=1;i<=9;i++){
    MP[mp(i,i)]++;
  }
  while(kake*10 < n){
    for(ll i=1;i<=9;i++)
      for(ll j=1;j<=9;j++){
	MP[mp(i,j)] += pow(10,cnt);
      }
    cnt++;
    kake*=10;
  }

  ll hoge=n/kake;
  for(ll i=1;i<hoge;i++){
    for(ll j=1;j<=9;j++){
      MP[mp(i,j)] += pow(10,cnt);
    }
  }
  for(ll i=1;i<=9;i++){
    for(ll j=0;j<kake/10;j++){
      ll num=hoge*kake+j*10+i;
      if(num<=n)MP[mp(hoge,i)]++;
    }
    //  MP[mp(hoge,i)] += (n-(n/kake*kake))/10+1;
  }
  for(ll i=1;i<=9;i++){
    for(ll j=1;j<=9;j++){
      //   cout<<i<<" "<<j<<" "<<MP[mp(i,j)]<<" "<<MP[mp(j,i)]<<endl;
      //ans+=MP[mp(i,j)]*MP[mp(j,i)];
    }
  }
  for(ll i=1;i<=9;i++){
    for(ll j=1;j<=9;j++){
      //cout<<i<<" "<<j<<" "<<MP[mp(i,j)]<<" "<<MP[mp(j,i)]<<endl;
      ans+=MP[mp(i,j)]*MP[mp(j,i)];
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i, n;
  int dp[32];

  //dpツ配ツ療アツ渉可甘コツ可サ
  for(i = 0; i <= 30; i++){
    dp[i] = 0;
  }

  //ツ階ツ段ツづーツ湘」ツづゥツパツタツδ督青板づーDPツづ可づヲツづィツ仰?づ淞づゥ
  dp[0] = 1;
  for(i = 0; i < 30; i++){
    dp[i + 1] += dp[i];
    dp[i + 2] += dp[i];
    dp[i + 3] += dp[i];
  }

  while(1){
    scanf("%d", &n);
    if(n == 0) break;

    //1ツ禿コ10ツ嘉アツづー1ツ年ツづ?65ツ嘉アツつキツづゥツづ個づ? 3650ツづ?環?づ?づ?ツづーツ堕ォツつケツづ篠年ツ青板つェツ出ツづゥ
    printf("%d\n", (dp[n] - 1) / 3650 + 1);
  }

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
using namespace std;
using ll = long long;
#define MOD (ll)1000000007
#define PI 3.14159265359
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define P pair<int, int>
#define Pl pair<ll, ll>
#define dvec vector<vector<ll>>
//printf("%.10f\n")
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b){if (a < b) { a = b; return true; } return false;}
template<class T> inline bool chmin(T& a, T b){if (a > b) { a = b; return true; } return false;}
ll INF = 1e+18;
int iINF = 1e9;

struct edge
{
  ll from;
  ll to;
  ll cost;
  edge(ll f, ll t, ll c): from(f), to(t), cost(c){}
};

bool
bellman_ford(const vector<edge> &G, ll V, int S, vector<ll> &cost)
{
  cost[S] = 0;
  rep(i, 0, 2){
    ll cnt = 0;
    while(cnt < V){
      bool end = true;
      for(auto e: G){
        if(cost[e.from] == INF) continue;
        if(chmin(cost[e.to], cost[e.from] + e.cost)){
          end = false;
          if(cnt >= V - 1 && e.to == V - 1 && i == 1) return true;
        }
      }
      if(end) break;
      ++cnt;
    }
  }
  return false;
}


int main()
{
  int V, E; cin >> V >> E;
  vector<edge> G;
  rep(i, 0, E){
    ll s, t, d; cin >> s >> t >> d;
    --s, --t; d = -d;
    G.push_back(edge(s, t, d));
  }
  vector<ll> cost(V, INF);

  if(bellman_ford(G, V, 0, cost)) cout << "inf" << endl;
  else cout << -cost[V - 1] << endl;
}


Measured memory_bytes: 3668
#include<iostream>
using namespace std;
int main() {
    string s; //max is 10^9 char
    cin >> s;
    long long k; //max is 9*10^9
    cin >> k;
    int one = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '1') {
            one++;
        } else {
            break;
        }
    }
    if (one < k) {
        cout << s[one] << endl;
    } else {
        cout << 1 << endl;
    }
    return 0;
}


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

using ll = long long;
constexpr ll INF = 1e18;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    ll sum = 0;
    for(int i = 0; i < N; ++i) {
        cin >> a[i];
        sum += a[i];
    }
    ll res = INF;
    ll now = 0;
    for(int i = 0; i < N - 1; ++i) {
        now += a[i];
        res = min(res, abs(sum - now - now));
    }
    cout << res << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 100000
#define MAX_M 100000
const int INF = 1e9;

int main (){
  int n,ans=0;
  cin>>n;
  int A[n];
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  int mina,maxa;
  maxa=INF*-1;
  mina=A[0];
  for(int i=1;i<n;i++){
    maxa=max(maxa,A[i]-mina);
    mina=min(mina,A[i]);
  }
  cout<<maxa<<endl;
}


Measured memory_bytes: 3840
process.stdin.resume();
process.stdin.setEncoding('utf8');

// your code goes here
function Main(input) {
	var tmp = input.split(" ");
	var a = parseInt(tmp[0], 10);
	var b = parseInt(tmp[1], 10);
	
	if (a % 3 === 0 || b % 3 === 0 || (a + b) % 3 === 0) {
		console.log("Possible");
	} else {
		console.log("Impossible")	
	}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));process.stdin.resume();

Measured memory_bytes: 21192
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int R, G, B, N;
    cin >> R  >> G >> B >> N;
    
    int ans = 0;

    for(int i = 0; i <= N; i++) {
        for(int j = 0; j <= N; j++) {
            int tmp = N - i*R - j*G;
            if (tmp >= 0 && tmp % B == 0) {
                ans++;
                // cout << i << j << tmp / B << endl;
                
            }
        }
    }


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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <climits>

#define F first
#define S second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())


//INT_MAX
//INT_MIN
//LLONG_MAX
//LLONG_MIN
//DBL_MIN
//DBL_MAX
//LDBL_MIN
//LDBL_MAX

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int n, k;
    cin >> n >> k;
    if(n % k >= 2){
        cout << 1 << endl;
    }else{
        cout << n % k << endl;
    }
}


Measured memory_bytes: 256
MOD = 10**9+7
l = list(map(int,input().split()))
h,w,a,b = l[0],l[1],l[2],l[3]
def pow(x,n):
    res = 1
    while n > 0:
        if n % 2 == 1:
            res = res*x % MOD
        x = x*x % MOD
        n = n >> 1
    return res

def comb(n,k):
    return (fact[n]*inv[k] % MOD)*inv[n-k] % MOD

fact = [1]*1000000
inv = [1]*1000000

for i in range(h+w):
    fact[i+1]=fact[i]*(i+1) % MOD
inv[h+w] = pow(fact[h+w],MOD-2) % MOD
for i in range(h+w-1,0,-1):
    inv[i] = (i+1)*inv[i+1] % MOD
ans = 0
for i in range(w-b):
    ans = (ans + (comb(h-a+b+i-1,b+i)*comb(w-b-i+a-2,a-1) % MOD)) % MOD
print(ans)


Measured memory_bytes: 31348
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
const int N=1e6+10;
int a[N],b[N],n,ans;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		int x,y;
		cin >> x >> y;
		a[i] = x+y;b[i]=x-y;
	}
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	ans = max(a[n]-a[1],b[n]-b[1]);
	cout<<ans<<'\n';
}

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

#define fast()           ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(dat)         dat.begin(), dat.end()
#define loop(i, to)      for (int i = 0; i < to; i++)
#define count(i, to)     for (int i = 1; i <= to; i++)
#define foreach(dat, i)  for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); i++)

typedef long long        num;

using namespace std;

int n, pr[100005], ans;

pair<int, int> x[100005], y[100005];

struct triple {
    
    int d, a, b;
    
    triple(int i, int j, int k) {
        
        d = k;
        
        a = i;
        
        b = j;
        
    }
    
};

vector<triple> edge;

int root(int a) {
    
    if (pr[a] == a)  return a;
        
    return pr[a] = root(pr[a]);
    
}

void combine(int a, int b) {
    
    int pa = root(a), pb = root(b);
    
    pr[pb] = pa;
    
}

bool cmp(triple a, triple b) {
    
    return a.d < b.d;
    
}

int main() {
    
    cin >> n;
    
    loop (i, n) {
        
        int a, b;
        
        cin >> a >> b;
        
        x[i] = {a, i};
        
        y[i] = {b, i};
        
        pr[i] = i;
        
    }
    
    sort(x, x + n);
    
    sort(y, y + n);
    
    loop (i, n - 1) {
        
        edge.push_back(triple(x[i].second, x[i + 1].second, abs(x[i].first - x[i + 1].first)));
        
        edge.push_back(triple(y[i].second, y[i + 1].second, abs(y[i].first - y[i + 1].first)));
        
    }
    
    sort(all(edge), cmp);
    
    loop (i, edge.size()) {
        
        triple tmp = edge[i];
        
        int pa = root(tmp.a), pb = root(tmp.b);
        
        if (pa != pb) {
            
            ans += tmp.d;
            
            combine(tmp.a, tmp.b);
            
        }
        
    }
    
    cout << ans << endl;
    
}


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

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define MOD 1000000007

#define trace1(x)                    cout <<#x<<": "<<x<< endl;
#define trace2(x, y)                 cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)              cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)           cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;

typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    ll i,j,n,m;
    cin>>n;
    ll a[n],b[n];
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=0;i<n;i++)
    cin>>b[i];
    ll cnt=0;
    for(i=0;i<n;i++)
    cnt+=max(a[i]-b[i],ll(0));
    cout<<cnt;
    return 0;
}


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

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

  int x[5];
  for (int i = 0; i < 5; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < 5; i++) {
    if (x[i] == 0) {
      cout << i + 1 << "\n";
    }
  }
  return 0;
}


Measured memory_bytes: 3648
''' Hey stalker :) '''
INF = 10**10
def main():
    #print = out.append
    ''' Cook your dish here! '''

    s, t = input().split()
    a, b = get_list()
    dic = {}
    dic[s] = a
    dic[t] = b
    dic[input()] -= 1
    print(dic[s], dic[t])



''' Pythonista fLite 1.1 '''
import sys
from collections import defaultdict, Counter
from bisect import bisect_left, bisect_right
#from functools import reduce
import math
#input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
print(*out, sep='\n')


Measured memory_bytes: 38256
import java.util.*;
public class Main {
    public static int max(int a, int b){return (a > b ? a : b);}
    public static int min(int a, int b){return (a < b ? a : b);}
    public static int gcd(int a, int b){return (b > 0 ? gcd(b, a % b) : a);}
    public static int lcm(int a, int b){return a / gcd(a, b) * b;}
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt(), M = sc.nextInt(), K = sc.nextInt();
        ArrayList<ArrayList<Integer>> A = new ArrayList<ArrayList<Integer>>();
        ArrayList<ArrayList<Integer>> B = new ArrayList<ArrayList<Integer>>();
        for(int i = 0; i <= N; i++)A.add(new ArrayList<Integer>());
        for(int i = 0; i <= N; i++)B.add(new ArrayList<Integer>());
        int nxt = 1;
        int[] cnt = new int[101010];
        int[] flg = new int[101010];
        for(int i = 0; i < M; i++){
            int a = sc.nextInt(), b = sc.nextInt();
            A.get(a).add(b);
            A.get(b).add(a);
        }
        for(int i = 0; i < K; i++){
            int a = sc.nextInt(), b = sc.nextInt();
            B.get(a).add(b);
            B.get(b).add(a);
        }
        for(int i = 1; i <= N; i++)if(flg[i] == 0){
            Queue<Integer> Q = new ArrayDeque<Integer>();
            flg[i] = nxt;
            Q.add(i);
            cnt[nxt]++;
            while(true){
                Integer idx = Q.poll();
                if(idx == null)break;
                for(int j = 0; j < A.get(idx).size(); j++){
                    int to = A.get(idx).get(j);
                    if(flg[to] != 0)continue;
                    flg[to] = nxt;
                    Q.add(to);
                    cnt[nxt]++;
                }
            }
            nxt++;
        }
        for(int i = 1; i <= N; i++){
            int ans = cnt[flg[i]] - 1 - A.get(i).size();
            for(int j = 0; j < B.get(i).size(); j++){
                int to = B.get(i).get(j);
                if(flg[i] == flg[to])ans--;
            }
            System.out.print(ans + (i == N ? "\n" : " "));
        }
    }
}


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

// mod p でのaの逆元を求める
int calc_inv(int p, int a) {
  int q = p - 2;
  long long res = 1;
  long long temp = a;
  
  for (; q > 0; q /= 2) {
    if (q % 2 == 1) res = (res * temp) % p;
//    printf("temp = %d, res = %d\n", temp, res);
    temp = (temp * temp) % p;    
  }
  
  return res;
}

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A;
  int p = 1000 * 1000 * 1000 + 7;
  int inv2 = calc_inv(p, 2);
//  printf("2^(-1) mod p = %d\n", inv2);
  
  long long ans;
  
  // A[i]とA[j]が同じ群に属する場合
  long long ans_same = 0;
  int temp;
  for (int i = 0; i < N; i++) {
    cin >> temp;
    A.push_back(temp);
    sort(A.begin(), A.end());
    ans_same += A.end() - upper_bound(A.begin(), A.end(), temp);
  }
  
//  printf("ans_same(1群) = %d\n", ans_same);
  
  ans_same = (ans_same * K)% p;
  
//  printf("ans_same(K群) = %d\n", ans_same);
  
  // A[i]とA[j]が異なる群に属する場合
  long long ans_diff = N * N;
  
  map<int, int> mA;
  for (int Ai : A) {
    if (!mA.count(Ai)) {
      mA[Ai] = 1;
    } else {
      mA.at(Ai)++;
    }
  }
  for (pair<int, int> kv : mA) {
    ans_diff -= kv.second * kv.second;
  }
  
//  printf("N^2 - Σei^2 = %d\n", ans_diff);
  
  ans_diff = (ans_diff / 2) % p;
  ans_diff = (ans_diff * K) % p;
  ans_diff = (ans_diff * (K - 1)) % p;
  ans_diff = (ans_diff * inv2) % p;
  
//  ans_diff = (ans_diff * K * (K - 1) / 4) % p;
  
//  printf("(N^2 - Σei^2) * K(K-1)/4 = %d\n", ans_diff);
  
  ans = (ans_same + ans_diff) % p;
  
  cout << ans;
}

Measured memory_bytes: 256
/*
时间:2020-7-25
书籍：算法和数据结构
内容：选择排序
页数：P44
*/
#include<iostream>
using namespace std;
void printArray(int a[],int length)
{
	for (int i = 0; i < length - 1; ++i)
		cout << a[i] << " ";
	cout << a[length-1];                       //防止行元素后的空格多余导致PE
	cout << endl;                             //每一行结束输出要换行

}
void selectionSort(int a[], int length)
{
	int count = 0;
	for (int i = 0; i < length; ++i)
	{
		int min = i;
		for (int j = i + 1; j < length; ++j)
			if (a[j] < a[min])
				min = j;
		if (i != min)
		{
			++count;
			swap(a[i], a[min]);
		}
	}
	printArray(a, length);
	cout << count << endl;
}
int main()
{
	int n;
	cin >> n;
	int* a = new int[n];
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	selectionSort(a, n);
	delete[]a;
	return 0;
}


Measured memory_bytes: 3128
#include <iostream>
        #include<cmath>
        #include<string>
        using namespace std;
        int main()
        {
             string s;
             cin>>s;
             int a=0,b=0;
          int k=s.length();
          	for(int i=0;i<k;i++)
            {
              if(s[i]=='A')
                a++;
              else
                b++;
            }
          if(a==b+1 || b==a+1)
            cout<<"Yes";
          else
            cout<<"No";
            
        }

Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <string>
#include <bits/stdc++.h>
#include <set>
#include <list> //list<???> a; a.push_back ,insert(追加したい要素),a.sort(),参照できない
#include <vector> //vector<???> a; a.push_back,sort(a.begin(),a.end());a[i]
//配列 int a[N];a[i]=追加したい要素;sort(a,a+N);a[i]
const int MOD = 1e9+7;
using namespace std;
typedef long  ll;
#define rep(i,n) for(int i=0;i<(n);i++)


//using namespace std;
//


int main(){
  int K,S;cin>>K>>S;
  int z=0,cnt=0;
  for(int x=0;x<=K;x++){
    for(int y=0;y<=K;y++){
      if(0<=(S-x-y) && (S-x-y)<=K){
        cnt+=1;
      }

    }
  }
  cout<<cnt<<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if (k % 2 == 0)
        cout << a - b << endl;
    else
        cout << b - a << endl;
    return 0;
}



Measured memory_bytes: 256
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a,b,k = i2()
ans = []*100
for i in range( 1,min(a,b)+1 ):
	if a%i==0 and b%i==0:
		ans.append(i)
print(ans[-k])

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

int main()
{
  int k, s;
  cin >> k >> s;
  int cnt = 0;
  for (int x = 0; x <= k; x++) {
    for (int y = 0; y <= k; y++) {
      if (s-x-y < 0 || s-x-y > k)
        continue;
      else
        cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


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

#define N 3

int main() {
    
    int W, H, x, y, r;
    cin>>W>>H>>x>>y>>r;
    
    if(0 <= x-r && x+r <= W) {
        if(0 <= y-r && y+r <= H) {
            cout<<"Yes"<<endl;
            return 0;
        }
    }

    cout<<"No"<<endl;
    
    return 0;
}



Measured memory_bytes: 3100
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

typedef pair<int, int> P;

int dp[3005][3005]; // i: 何番目 j: 前の桁より少ない数が何個あるか
string s;
int N;

int mod = 1e9 + 7;

void add(int& a, int b) {
    a += b;
    if (a >= mod) a -= mod;
}

struct BIT {
    int n;
    vector<int> bit; // 1-indexd

    BIT(int sz) {
        bit.resize(sz + 1);
        n = sz;
    }

    int sum(int i) {
        int s = 0;
        while (i > 0) {
            s += bit[i];
            s %= mod;
            i -= i & -i;
        }
        return s;
    }

    void add(int i, int x) {
        while (i <= n) {
            bit[i] += x;
            bit[i] %= mod;
            i += i & -i;
        }
    }
};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    cin >> N;
    cin >> s;

    REP(j, N) dp[0][j] = 1;

    FOR(i, 1, N - 1) {
        vector<int> sum(N + 1);
        REP(j, N) sum[j + 1] = (sum[j] + dp[i - 1][j]) % mod;

        REP(j, N - i) {
            if (s[i - 1] == '<') {
                dp[i][j] = sum[j + 1];
            } else {
                dp[i][j] = (sum[N] - sum[j + 1] + mod) % mod;
            }
        }
    }

    cout << dp[N - 1][0] << endl;

    return 0;
}


Measured memory_bytes: 70016
#include<stdio.h>
int main(void)
{
	int h,n,a[100000],i,m;
	m=0;
	scanf("%d %d",&h,&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++){
		m+=a[i];
	}
	if(m>=h){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

int main()
{
  string s,t;
  cin >> s>> t;
  vector <int> start(26,-1);
  vector <int> goal(26,-1);
  for (int i=0;i<s.size();++i){
    int a=s[i]-'a';
    int b=t[i]- 'a';
    if(start[a]!=-1||goal[b]!=-1){
        if(start[a]!=b||goal[b]!=a){
            cout << "No"<< endl;
            return 0;
        }
    }
    else{
        start[a]=b;
        goal[b]=a;

    }

  }
  cout << "Yes"<< endl;
  return 0;
}


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

int main() {
  int n;
  cin >>n;
  vector<int> a(n);
  for (int i=0; i<n; ++i) cin >> a.at(i);
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int alice=0, bob=0;

  for (int i=0; i<n; i=i+2) {
    alice += a.at(i);
  }
  for (int i=1; i<n; i=i+2){
    bob += a.at(i);
  }
  
  cout << alice-bob;
}

Measured memory_bytes: 256
while True:
  dice = [1,2,3,5,4,6]
  n = int(input())
  if n == 0:
    break
  a = 1
  while n>0:
    s = input()
    if s == 'North':
      dice[0],dice[1],dice[3],dice[5] = dice[1],dice[5],dice[0],dice[3]
    elif s == 'South':
      dice[1],dice[5],dice[0],dice[3] = dice[0],dice[1],dice[3],dice[5]
    elif s == 'East':
      dice[0],dice[2],dice[4],dice[5] = dice[4],dice[0],dice[5],dice[2]
    elif s == 'West':
      dice[4],dice[0],dice[5],dice[2] = dice[0],dice[2],dice[4],dice[5]
    elif s == 'Right':
      dice[1],dice[2],dice[3],dice[4] = dice[2],dice[3],dice[4],dice[1]
    else:
      dice[2],dice[3],dice[4],dice[1] = dice[1],dice[2],dice[3],dice[4]
    a += dice[0]
    n -= 1
  print(a)

Measured memory_bytes: 7744
#include <bits/stdc++.h>
#define int long long
using namespace std;

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<PII> VP;


//REPEAT
//------------------------------------------
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i > n;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,m)  RFOR(i,m,0)

//container util
//------------------------------------------
#define pb(a) push_back(a)
#define fst first
#define snd second
#define SORT(V) sort((V).begin(),(V).end())
#define REV(V) reverse((V).begin(),(V).end())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//grobal variable
//------------------------------------------

//def function, class
//------------------------------------------

//main
//------------------------------------------
signed main(){
  int n;
  cin >> n;

  VI p(n);
  REP(i, n) cin >> p[i];

  int ans=0;
  REP(i, n-2){
    if(p[i]<p[i+1]&&p[i+1]<p[i+2]) ans++;
    if(p[i]>p[i+1]&&p[i+1]>p[i+2]) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int main(void){
    int n, m; cin >> n >> m;
    
    vi B(n), P(m);
    for(auto & e : B) cin >> e;
    for(auto & e : P) cin >> e;
    string b_org;
    for(auto & e : B){
        b_org.push_back('0' + e);
    }

    int res = 1e9;
    rep(bi, 2){
        string p;
        rep(i, m){
            rep(j, P[i]){
                p.push_back('0' + ((bi + i) % 2));
            }
        }

        int cur = 0;
        string b = b_org;
        if(count(_all(b), '0') != count(_all(p), '0')) continue;

        for(auto & c : p){
            int pos = b.find(c);
            cur += pos;
            b.erase(pos, 1);
        }

        chmin(res, cur);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3196
h, w, n = map(int, input().split())
square = dict()
for i in range(n):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    for x in range(b-2,b+1,1):
        for y in range(a-2,a+1,1):
            if 0 <= y <= (h - 3) and 0 <= x <= (w - 3) :
                if (x,y) in square:
                    square[(x,y)] += 1
                else:
                    square[(x,y)] = 1
ans = [0 for i in range(10)]
for i in square.values():
    ans[i] += 1
ans[0] = (h - 2) * (w - 2) - sum(ans)
for i in range(10):
    print(ans[i])


Measured memory_bytes: 151760
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n,x;
ll solve(ll u,ll v){
	if(u==0) return -v;
	return v/u*2*u+solve(v%u,u);
}
int main(){
	ios::sync_with_stdio(false);
	cin >> n >> x;
	cout << n+solve(x,n-x) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;

int main(){
  ll k,x; cin>>k>>x;
  for(int i=x-k+1;i<=x+k-1;i++)cout<<i<<endl;
  return 0;
}


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

using namespace std;
const int maxn = 2e5+15;
const int inf = 0x3f3f3f3f;
int head[maxn],n,m,u,v,s,t,cnt;
struct edge{
    int to,nxt,w;
}e[maxn<<2];
inline void add(int u,int v,int _w){
    e[++cnt].to = v;
    e[cnt].nxt = head[u];
    e[cnt].w = _w;
    head[u] = cnt;
}
int dp[maxn][3],vis[maxn][3];
struct node{
    int x,dis,f;
    bool friend operator<(node a,node b){
        return a.dis > b.dis;
    }
};
void dijkstra(){
     memset(dp,0x3f,sizeof(dp));
     dp[s][0] = 0;
     priority_queue<node> q;
     q.push(node{s,0,0});
     while(!q.empty()){
        node now = q.top();
        q.pop();
        if(vis[now.x][now.f]) continue;
        vis[now.x][now.f] = 1;
        for(int i = head[now.x]; i;i = e[i].nxt){
            int v = e[i].to;
            if(dp[v][(now.f+1)%3] > now.dis+1){
                dp[v][(now.f+1)%3] = now.dis+1;
                q.push(node{v,now.dis+1,(now.f+1)%3});
            }
        }
     } 
}
int main(){
    scanf("%d %d",&n,&m);
    while(m--){
        scanf("%d %d",&u,&v);
        add(u,v,1);
    }
    scanf("%d %d",&s,&t);
    dijkstra();
    if(dp[t][0] == inf) puts("-1");
    else printf("%d\n",dp[t][0]/3);
    return 0;
}

Measured memory_bytes: 7744
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] v = new int[n];
		int[] c = new int[n];
		for (int i = 0; i < n; i++) {
			v[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			c[i] = sc.nextInt();
		}
		sc.close();

		int ans = 0;
		for (int i = 0; i < n; i++) {
			if (v[i] > c[i]) {
				ans += v[i] - c[i];
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23252
package main

import (
	"strconv"
	"bufio"
	"os"
	"strings"
	"fmt"
)

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_D>
 */

func init() {

}

func main() {
	array, _ := SplitIntStdin(" ")
	cnt := 0
	for i := array[0]; i <= array[1]; i++ {
		if array[2]%i == 0{
			cnt++
		}
	}
	fmt.Println(cnt)
}

// ????????????1?????????
func StrStdin() (stringReturned string) {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	stringInput := scanner.Text()

	stringReturned = strings.TrimSpace(stringInput)
	return
}

// ??´??°???1?????????
func IntStdin() (int, error) {
	stringInput := StrStdin()
	return strconv.Atoi(strings.TrimSpace(stringInput))
}

// ?????????????????????????????????????????????Split()
func SplitWithoutEmpty(stringTargeted string, delim string) (stringReturned []string) {
	stringSplited := strings.Split(stringTargeted, delim)

	for _, str := range stringSplited {
		if str != "" {
			stringReturned = append(stringReturned, str)
		}
	}

	return
}

// ??????????????§??????????????????????????????????????????
func SplitStrStdin(delim string) (stringReturned []string) {
	// ???????????§1?????????
	stringInput := StrStdin()

	// ????????§??????
	// stringSplited := strings.Split(stringInput, delim)
	stringReturned = SplitWithoutEmpty(stringInput, delim)

	return
}

// ??????????????§??????????????´??°????????????????????????
func SplitIntStdin(delim string) (intSlices []int, err error) {
	// ??????????????????????????????
	stringSplited := SplitStrStdin(" ")

	// ??´??°?????????????????????
	for i := range stringSplited {
		var iparam int
		iparam, err = strconv.Atoi(stringSplited[i])
		if err != nil {
			return
		}
		intSlices = append(intSlices, iparam)
	}
	return
}

Measured memory_bytes: 1100
#include <bits/stdc++.h>
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;
template <typename... Args> void dbg(Args &&... args) {
  using expander = int[];
  (void)expander{
      0,
      (static_cast<void>(void(cout << std::forward<Args>(args) << " ")), 0)...};
  cout << endl;
}
void gen() {
  exit(0);
}

char x;

void input() {
  scanf(" %c", &x);
}

void solve() {
  if (x == 'A') {
    printf("T");
  } else if (x == 'T') {
    printf("A");
  } else if (x == 'C') {
    printf("G");
  } else if (x == 'G') {
    printf("C");
  }
  printf("\n");
}

void clean() {
}

int main() {
#ifdef DEBUG
  freopen("input", "r", stdin);
  // freopen("output", "w", stdout);
  // gen();
  while (!feof(stdin)) {
#endif
    input();
    solve();
#ifdef DEBUG
    clean();
  }
#endif
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

int cnt;
int n;
int l;
int A[1000000];
vector<int> G;

void insertionSort(int A[],int n, int g){
    for (int i = g; i < n ; ++i) {
        int v = A[i];
        int j = i-g;
        while (j >= 0 && A[j] > v ){
            A[j+g] = A[j];
            j = j-g;
            cnt ++;
        }
        A[j+g] = v;
    }
}

void shellSort(int A[],int n){
    for (int h = 1 ; ; ){
    if(h > n)break;
    G.push_back(h);
        h = 3 * h + 1;
    }
    for (int i = G.size() -1 ; i >= 0 ; i--) {
        insertionSort(A, n, G[i]);
    }
}

int main(){
    cin >> n;
	for (long i = 0; i < n; i++) cin >> A[i];
    cnt = 0;

    shellSort(A,n);

    cout << G.size() << endl;
    for (int i = G.size() -1 ; i >= 0 ; i--) {
        cout << G[i];
        if (i) cout << (" ");
    }
    cout << endl;
    cout << cnt << endl;
    for (int i = 0; i < n ; ++i) {
        cout << A[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 5124
'use strict'
function main(input) {
  input = input
    .trim()
    .split(/\s|\n/)
    .map(v => ~~v)
  const n = input.slice(0, 1)[0]
  const nums = input.slice(1)
  if (n === 1) {
    console.log('Yes')
    return
  }
  for (let i = n - 1; i >= 1; i--) {
    const sub = nums[i] - nums[i - 1]
    if (sub >= 0) {
    } else if (sub === -1) {
      nums[i - 1] -= 1
    } else {
      console.log('No')
      return
    }
  }
  console.log('Yes')
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 26700
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

int N;
string s;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> N >> s;
	for (auto& c : s)
	{
		c -= 'A';
		c = (c + N) % 26;
		c += 'A';
	}
	cout << s;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cctype>
#include <string>
#include <cstring>
using namespace std;

int main(int argc, char const *argv[])
{
    int m, f, r;
    while(true){
        cin >> m >> f >> r;
        if (m == -1 && f == -1 && r == -1) break;
        if (m == -1 or f == -1){
            cout << 'F' << endl;
            continue;
        }
        int sum = m + f;
        if(80 <= sum){
            cout << 'A' << endl;
        }else if (65 <= sum){
            cout << 'B' << endl;
        }else if(50 <= sum){
            cout << 'C' << endl;
        }else if (30 <= sum){
            if (r >= 50) cout << 'C' << endl;
            else cout << 'D' << endl;
        }else cout << 'F' << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
str=[i for i in input()]
n=int(input())
l= [input().split() for i in range(n)]
for i in range(n):
    if l[i][0]=="print":
        str = ''.join(str) 
        print(str[int(l[i][1]):int(l[i][2])+1])
        str = [i for i in str]         
    elif l[i][0]=="reverse":
        part_str=list(reversed(str[int(l[i][1]):int(l[i][2])+1]))
        str[int(l[i][1]):int(l[i][2])+1]=part_str
    else:
        replace_str=[j for j in l[i][3]]
        str[int(l[i][1]):int(l[i][2])+1]=replace_str  


Measured memory_bytes: 5672
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main()	{
  int n;
  cin>>n;
  vector<int>a(n),d(n);
  rep(i,n) {
    cin>>a[i];
    a[i]--;
  }
  rep(i,n)
    d[a[i]]++;
  for(auto x:d)
    cout<<x<<endl;
}


Measured memory_bytes: 4784
#include"stdio.h"

int main()
{
    int a,b;
    int num;
    scanf("%d%d",&a,&b);
    if(a<b)
    {
        num=a;
        a=b;
        b=num;
    }
    while(1)
    {
        num=a%b;
        if(num==0)
        {
            printf("%d\n",b);
            break;
        }
        else
        {
            a=b;
            b=num;
        }
    }
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  bool yes = false;
  for (int i = 0; i <= n/4; ++i){
    for (int j = 0; j <= n/7; ++j){
      if(n==i*4+j*7) yes = true;
    }
  }
  if(yes) puts("Yes");
  else puts("No");
  return 0;
}


Measured memory_bytes: 256
import math

N = int(input())
LI = []
for a in range(N):
    LI.append(int(input()))

MOD = 998244353
SUM = sum(LI)

# dp[t][r]: t までの整数を塗り分けたときに赤にしたやつの和が r となる場合の数
dp = [[0 for _ in range(SUM + 1)] for _ in range(len(LI))]
dp[0][0] = 2  # 緑か青
dp[0][LI[0]] = 1
for t in range(1, len(LI)):
    for r in range(len(dp[t])):
        dp[t][r] += dp[t - 1][r] * 2 % MOD
        dp[t][r] += dp[t - 1][r - LI[t]] % MOD if 0 <= r - LI[t] <= len(dp[t - 1]) else 0

# 選び方の組み合わせ数
ans = (3 ** len(LI)) % MOD
# 赤の合計が SUM / 2 以上だと三角形作れないので、選び方の合計から引く
# 緑と青が一番大きいケースも同じなので * 3
ans -= sum([dp[-1][r] for r in range(math.ceil(SUM / 2), SUM + 1)]) * 3
ans %= MOD

if SUM % 2 == 0:
    # r == g, b == 0 のケースを重複して引いてるので足したい
    # dp[t][r]: t までの整数を赤と青だけで塗り分けたときに赤にしたやつの和が r となる場合の数
    dp = [[0 for _ in range(SUM // 2 + 1)] for _ in range(len(LI))]
    dp[0][0] = 1  # 青
    dp[0][LI[0]] = 1
    for t in range(1, len(LI)):
        for r in range(len(dp[t])):
            dp[t][r] += dp[t - 1][r] % MOD
            dp[t][r] += dp[t - 1][r - LI[t]] % MOD if 0 <= r - LI[t] <= len(dp[t - 1]) else 0
    # 赤緑、赤青、緑青
    ans += dp[-1][SUM // 2] * 3
    ans %= MOD

print(ans)


Measured memory_bytes: 384312
// 単一始点最短経路 ( ダイクストラ法 )
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

static const int MAX = 100;
static const int INFTY = (1 <<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int Dijkstra()
{
    int u, minv;
    int d[MAX], p[MAX], color[MAX];

    for(int i = 0; i < n; i++)
    {
        d[i] = INFTY;
        p[i] = -1;
        color[i] = WHITE;
    }

    // 初期値の設定
    d[0] = 0;
    color[0] = GRAY;

    while(1)
    {
        minv = INFTY;
        // 次に移動するべき頂点
        u = -1;

        for(int i = 0; i < n; i++)
        {
            if( minv > d[i] && color[i] != BLACK )
            {
                // 未訪問の頂点の中で, 最小のコストを持つ辺を探索する
                u = i;
                minv = d[i];
            }
        }

        if( u == -1 )
        {
            // 最初全域木が完成した
            break;
        }

        color[u] = BLACK;

        for(int v = 0; v < n; v++)
        {
            if( color[v] != BLACK && M[u][v] != INFTY )
            {
                // u → v の辺の中で, 最小コストの辺のコストを記録する
                if( d[v] > d[u] + M[u][v] )
                {
                    // コストの記録
                    d[v] = d[u] + M[u][v];
                    // 頂点 v の親を記録する
                    p[v] = u;
                    // 訪問状態の記録
                    color[v] = GRAY;
                }
            }
        }
    }

    /*
    int sum = 0;

    for(int i = 0; i < n; i++)
    {
        if( p[i] != -1 )
        {
            // 最小コストの辺の和を求める
            sum += M[i][p[i]];
        }
    }
    */

    for(int i = 0; i < n; i++)
    {
        cout << i << " " << ( d[i] == INFTY ? -1 : d[i] ) << endl;
    }

    return 0;
}

int main(void)
{

    cin >> n;

    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            // 配列の初期化
            M[i][j] = INFTY;
        }
    }

    int k, c, u, v;

    for(int i = 0; i < n; i++)
    {
        cin >> u >> k;

        for(int j = 0; j < k; j++)
        {
            cin >> v >> c;

            M[u][v] = c;
        }
    }

    Dijkstra();

    return 0;

}



Measured memory_bytes: 3156