akhauriyash/Code-Regression huggingface dataset:
'''dp[N] : N円の答え

dp[N] = min(dp[N-1] + 1,
dp[N-6] + 1, dp[N-6^2] + 1,
dp[N-9] + 1, dp[N-9^2] + 1)
'''

N = int(input())

dp = []
for j in range(100000 + 10):
    dp.append(j)

for i in range(100000 + 9):
    s = 6
    n = 9
    while i-s>=0:
        try:

        
            dp[i] = min(dp[i], dp[i-s] + 1)
            s *= 6
        except:
            print('s', i, i-s, s)
    while i-n>=0:
        dp[i] = min(dp[i], dp[i-n] + 1) 
        n *= 9

print(dp[N])

Measured memory_bytes: 7064
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000

int main(){
  ll N; cin >> N;

  ll apb = N+1;
  for (ll a=1;a<=(ll)sqrt(1.01*N);a++){
    if (N%a==0) {
      ll b = N/a;
      if (apb > a+b) apb = a+b;
    }
  }

  cout << apb-2 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

function<int (int, int)> comparer[] = {
  [](int a, int b) { return max(a, b); },
  [](int a, int b) { return min(a, b); }
};
constexpr int zero[] = { -1, INT_MAX / 2 };

int dp[2001][2];

int score(vector<int> const& as, int i, int cmp) {
  auto& best = dp[i][cmp];
  if (best >= 0) return best;
  auto const& better = comparer[cmp];
  int const len = as.size();
  best = zero[cmp];
  for (int j = i; j < len - 1; j++)
    best = better(best, score(as, j + 1, 1 - cmp));
  best = better(best, as[i - 1]);
  return best;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, z;
  cin >> n >> z;
  for (int i = 0; i <= 2000; i++)
    dp[i][0] = dp[i][1] = -1;
  vector<int> a(n + 1);
  for (auto& v : a)
    cin >> v;
  auto const last = a.back();
  for (auto& v : a)
    v = abs(v - last);
  cout << score(a, 1, 0) << endl;
}


Measured memory_bytes: 384
N, A, B = list(map(int, input().split()))

# 商 n1 余り n2
n1 = N // (A + B)
n2 = N % (A + B)

# 青いボール
blue = n1 * A
if n2 <= A:
    blue += n2
else:
    blue += A
    
print(blue)

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

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
int main(){
  vector<long> a;
  long min = LONG_MAX;
  long tmp;
  long ii,jj,pos=0;
  long rest[3];
  a.resize(3);

  cin >> a[0] >> a[1] >> a[2];
  
  for(ii=0;ii<3;ii++){
	rest[0] = a[ii];
	pos=1;

	for(jj=0;jj<3;jj++){

	  if(ii!=jj){
		rest[pos] = a[jj];
		pos++;
	  }
	}

//	for (jj = 0; jj < 3 ; jj++){
//	  cout << rest[jj];
//	}
//
//	cout << endl;
	
	tmp = abs(rest[0] - rest[1]);
	tmp += abs(rest[1] - rest[2]);
	//cout << "tmp:" << tmp << endl;
	if(min > tmp){
	  min = tmp;
	}
	
	tmp = abs(rest[0] - rest[2]);
	tmp += abs(rest[2] -rest[1]);
	//cout << "tmp:" << tmp << endl;
	if(min > tmp){
	  min = tmp;
	}
	
  }
  //1,2,3

  cout << min << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
S = []
C = []
H = []
D = []
for i in range(1, 14):
    S.append(i)
    C.append(i)
    H.append(i)
    D.append(i)
for i in range(n):
    s = input().split(" ")
    if s[0] == "S":
        S.remove(int(s[1]))
    elif s[0] == "C":
        C.remove(int(s[1]))
    elif s[0] == "H":
        H.remove(int(s[1]))
    else:
        D.remove(int(s[1]))
for i in range(len(S)):
    print("S {0}".format(S[i]))
for i in range(len(H)):
    print("H {0}".format(H[i]))
for i in range(len(C)):
    print("C {0}".format(C[i]))
for i in range(len(D)):
    print("D {0}".format(D[i])) 

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

const int N = 1e5+5;
const int M = 998244353;
int n;
string s;

int mult(int a, int b) {
    return (1LL*a*b) % M;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> n;
    cin >> s;
    int r = 0, g = 0, b = 0, rg = 0, rb = 0, gb = 0;
    ll ans = 1;
    for (int i = 0; i < 3*n; i++) {
        if (s[i] == 'R') {
            if (gb > 0) {
                ans = mult(ans,gb);
                gb--;
            }
            else if (g > 0) {
                ans = mult(ans,g);
                g--;
                rg++;
            }
            else if (b > 0) {
                ans = mult(ans,b);
                b--;
                rb++;
            }
            else {
                r++;
            }
        }
        else if (s[i] == 'G') {
            if (rb > 0) {
                ans = mult(ans,rb);
                rb--;
            }
            else if (r > 0) {
                ans = mult(ans,r);
                r--;
                rg++;
            }
            else if (b > 0) {
                ans = mult(ans,b);
                b--;
                gb++;
            }
            else {
                g++;
            }            
        }
        else if (s[i] == 'B') {
            if (rg > 0) {
                ans = mult(ans,rg);
                rg--;
            }
            else if (r > 0) {
                ans = mult(ans,r);
                r--;
                rb++;
            }
            else if (g > 0) {
                ans = mult(ans,g);
                g--;
                gb++;
            }
            else {
                b++;
            }
        }
    }
    for (int i = 2; i <= n; i++) ans = mult(ans,i);
    cout << ans << '\n';
}



Measured memory_bytes: 720
n = gets.to_i

csf = []
(n - 1).times {csf << gets.split.map(&:to_i)}

(n - 1).times do |i|
    t = csf[i][1] + csf[i][0]

    (i + 1).upto(n - 2) do |j|
        t = csf[j][1] if t < csf[j][1]
        t = t.fdiv(csf[j][2]).ceil * csf[j][2] + csf[j][0]
    end

    puts t
end

puts 0

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

int N, M;
int D[200010], T[200010];
map<int, int> mp;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> D[i];
    mp[D[i]]++;
  }
  cin >> M;
  for (int i = 0; i < M; i++) {
    cin >> T[i];
    if (mp[T[i]]--) continue;
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;

  return 0;
}

Measured memory_bytes: 11264
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 10 * 100 * 1000 + 47;
const double EPS = 1e-8;
const int MOD = 1000 * 1000 * 1000 + 7;




int C[MAX], W[MAX];
int A[MAX];
PII B[MAX];
int P[MAX];
map<int, int> CNT[MAX];
LL F[MAX], IF[MAX];

int find(int v)
{
    if (v == P[v])return v;
    return P[v] = find(P[v]);
}


void unite(int a, int b)
{
    a = find(a);
    b = find(b);
    if (a == b)return ;
    if (rand() & 1)swap(a, b);
    P[a] = b;
}

LL BP(LL a, int n)
{
    LL res= 1;
    while(n)
    {
        if (n & 1)res = (res * a) % MOD;
        a = (a * a) % MOD;
        n >>= 1 ;
    }
    return res;
}



int main()
{


    F[0] = 1;
    IF[0] = 1;
    FOR(i, 1, MAX)
    {
        F[i] = F[i-1] * i % MOD;
        IF[i] = BP(F[i], MOD-2);
    }

    int n, X, Y;
    scanf("%d%d%d", &n, &X, &Y);
    W[0] = INF;
    FOR(i, 1, n+1)
    {
        scanf("%d%d", C + i, W + i);
        if (W[i] < W[A[C[i]]])A[C[i]] = i;
    }
    FOR(i, 1, n+1)
        B[i] = MP(W[A[i]], A[i]);

    FOR(i, 1, n + 1)P[i] = i;

    sort(B + 1, B + n + 1);

    int x = B[1].second;
    int y = B[2].second;

    //cout << x << " " << y << endl;

    FOR(i, 1, n + 1)
    {
        if (C[i] != C[x] && W[i] + W[x] <= Y)unite(x, i);
        if (W[i] + W[A[C[i]]] <= X)unite(A[C[i]], i);
        if (C[i] == C[x] && W[i] + W[y] <= Y)unite(y, i);
    }

    //FOR(i, 1, n + 1)
    //{
     //   cout << i << " : " << find(i) << endl;
    //}

    FOR(i, 1, n+1)
        CNT[find(i)][C[i]]++;

    LL ans = 1;
    FOR(i, 1, n+1)
    {
        LL cnt = 0;
        ITER(it, CNT[i])
        {
            ans = (ans * IF[it->second]) % MOD;
            cnt += it->second;
        }
        ans *= F[cnt];
        ans %= MOD;
    }
    printf("%lld\n", ans);
}








































Measured memory_bytes: 83328
#                         author:  kagemeka 
#                         created: 2019-11-06 14:53:37(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics

def main():
    x, a, b = (int(i) for i in sys.stdin.read().split())
    ans = (x - a) % b
    print(ans)



if __name__ == "__main__":
    # execute only if run as a script
    main()


Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main(){
    int *x=new int[10000],i;
    for(i=0;i<10000;i++){
        cin>>x[i];
        if(x[i]==0)break;
            }
    for(int v=0;v<i;v++){
        cout<<"Case "<<v+1<<": "<<x[v]<<endl;
    }
    delete []x;
    return 0;
}



Measured memory_bytes: 3028
#include <stdio.h>

// min
int main(void){
  int n = 0;
  int a = 0, b = 0;
  
  scanf("%d", &n);

  for(int i = 1; i <= 9; i++){
    for(int j = 1; j <= 9; j++){
      if((i * j) == n){
	printf("Yes\n");
	return 0;
      }
    }
  }

  printf("No\n");
  
  return 0;

}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
string s,t;
int sn,tn;
int main(void){
    cin>>s>>t;
    sn=s.size();
    tn=t.size();
    for(int i=(sn-tn);i>=0;i--){
        for(int j=0;j<tn;j++){
            if(s[i+j]!='?'&&s[i+j]!=t[j]){
                break;
                
            }
            if(j!=tn-1)continue;
            for(int j=0;j<tn;j++){
                s[i+j]=t[j];
            }
            for(int j=0;j<sn;j++){
                if(s[j]=='?')s[j]='a';
            }
            cout<<s<<endl;
            return 0;
        }
    }
    cout<<"UNRESTORABLE"<<endl;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        r: i64,
        g: i64,
        b: i64,
        n: i64,
    };
    let mut c = 0;
    for x in 0..=3000 {
        let n_r = x * r;
        if n_r > n {
            break;
        }
        for y in 0..=3000 {
            let n_g = y * g;
            if n_r + n_g > n {
                break;
            }
            let z = (n - (n_r + n_g)) / b;
            if !(0..=3000).contains(&z) {
                continue;
            }
            let n_b = z * b;
            if n_r + n_g + n_b == n {
                c += 1;
            }
        }
    }
    let ans = c;
    println!("{}", ans);
}


Measured memory_bytes: 2084
#include <iostream>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
int n,m;
int A[110000];
map<int,int>M;
int main(){
	scanf("%d%d",&n,&m);
	M[0]++; int k1=0; long long ans=0;
	for (int i=1;i<=n;i++){
		int k2; scanf("%d",&k2);
		k1=(k1+k2)%m;
		ans+=M[k1]; M[k1]++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>    
using namespace std;
#define ll long long 
#define pi pair<int,int>
#define pb push_back
#define inf 1e16
#define mod 1000000007
#define en '\n'
int pw(int a, int b){
	int ans = 1;
	while(b){
		if(b&1)ans = (ans*a)%mod;
		a = (a*a)%mod;
		b>>=1;
	}
	return ans;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll a,b;cin>>a>>b;
	ll mn = min(a,b);
	ll mx = max(a,b);
	a = mn;
	b = mx;
	if(a==1 && b==2)cout<<3<<en;
	if(a==1 && b==3)cout<<2<<en;
	if(a==2 && b==3)cout<<1<<en;
	return 0 ; 
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
int main(){
    int q;
    std::cin >> q;
    for(int p = 0; p < q; p++){
        std::string X, Y;
        std::cin >> X >> Y;
        int dp[X.size() + 1][Y.size() + 1];
        dp[0][0] = 0;
        for(int i = 0; i < X.size() + 1; i++){
            for(int j = 0; j < Y.size() + 1; j++) dp[i][j] = 0;
        }
        for(int i = 1; i < X.size() + 1; i++){
            for(int j = 1; j < Y.size() + 1; j++){
                if(X[i - 1] == Y[j - 1]) dp[i][j] = std::max(dp[i - 1][j - 1] + 1, std::max(dp[i - 1][j], dp[i][j - 1]));
                else dp[i][j] = std::max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
        std::cout<< dp[X.size()][Y.size()] << std::endl;
    }
}


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

int main() {
	int N;
	cin >> N;
	vector<int> a(3 * N);
	for (int i = 0; i < 3 * N; i++) {
		cin >> a.at(i);
	}
	sort(a.begin(), a.end(), greater<int>());

	long long ans = 0;
	for (int i = 0; i < N; i++) {
		ans += a.at(2 * i + 1);
	}
	cout << ans << endl;
}


Measured memory_bytes: 1408
#include<stdio.h>
#include<memory.h>
int main()
{
    int t,i,f,a[15],temp,j;
	scanf("%d",&t);
	while(t--)
    {
		memset(a,-1,sizeof(a));
        f=0;
        for(i=1;i<=10;i++)
            scanf("%d",&a[i]);
        temp=a[1];
        a[1]=0;
        for(i=2;i<=10;i++)
        if (a[i]>temp) {temp=a[i];a[i]=0;}
        i=2;
        while(a[i++]==0);
        i--;
        temp=a[i];
		a[i]=0;
        for(j=i+1;j<=10;j++)
            if (a[j]>temp) {temp=a[j];a[j]=0;}
        while(a[i++]==0);
        if (i==12) f=1;
        printf(f?"YES\n":"NO\n");
    }
    return 0;
}

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout << i << endl
using namespace std;
const int mod = 1e9+7;

ll triN(ll a){
    return ((a * (a+1) / 2 )% mod);
}

int main(){
    ll n,k;
    ll ans1 = 0,ans2 = 0;
    vector<ll> a;
    cin >> n >> k;

    REP(i,n){
        int t;
        cin >> t;
        a.pb(t);
    }
    REP(i,n){
        FOR(j,i,n){
            if(a[i] > a[j]){
                ans1 = (ans1 + 1) % mod;
            }
        }
    }
    ans1 = ans1 * triN(k) % mod;

    REPB(i,(n-1)){
        REP(j,i){
           if(a[i] > a[j]){
                ans2 = (ans2 + 1) % mod;
            } 
        }
    }
   ans2 = ans2 * triN(k-1) % mod;
    cout << ((ans1 + ans2) %mod) << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx") 
#include<bits/stdc++.h>
using namespace std;

inline int read()
{
	int ret=0; char c=getchar();
	while(c<48||c>57)c=getchar();
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	return ret;
}
int k,x;
int main()
{
	k=read(); x=read();
	for(int i=x-k+1;i<=x+k-1;++i)cout<<i<<' '; 
}

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

int main() {
	ll n, a, b;
	cin >> n >> a >> b;

	ll op_num, undo_op;
	op_num = n / (a + b);
	undo_op = n % (a + b);
	cout << a*op_num + min(a, undo_op) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int S = 1001 * 105;
int f[S];
int n, W, w, v, ans;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cin >> n >> W;
	memset(f, 0x3f, sizeof(f));
	f[0] = 0;
	for (int i = 1; i <= n; ++i)
	{
		cin >> w >> v;
		for (int i = ans; i >= 0; --i)
		if (f[i] + w <= W && f[i + v] > f[i] + w)
		{
			f[i + v] = f[i] + w;
			ans = max(ans, i + v);
		}
	}
	cout << ans;
	return 0;
}


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

int main(){
    int health, n;
    cin >> health >> n;
    vector<int> damage(n);
    for(int i = 0; i < n; i++){
        cin >> damage[i];
    }
    
    sort(damage.begin(), damage.end());
    for(int i = n-1; i > -1; i--){
        health -= damage[i];
    }
    
    if(health <= 0){
        cout << "Yes";
    }else{
        cout << "No";
    }
    
}

Measured memory_bytes: 640
N=int(input())
A=[]
money=0
for i in range(N):
    A+=[input().split()]
    A[i][0]=float(A[i][0])
    if A[i][1]=="JPY":
        money+=A[i][0]
    else:
        money+=A[i][0]*380000
print(money)

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

int main(){
  ll n;
  string s;
  cin>>n>>s;
  string r="";
  for(ll i=0;i<n and i<s.size();i++){
    r+=s[i];
  }
  if(s.size()>n){
    r+="...";
    cout<<r<<endl;
  }
  else{
    cout<<r<<endl;
  }
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define INF 1e9+7
using namespace std;
typedef long long int ll;


int main() {

	int a[3];
	cin >> a[0] >> a[1] >> a[2];

	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			if (a[i] < a[j]) {
				swap(a[i], a[j]);
			}
		}
	}
	
	cout << a[2] * 10 + a[1] + a[0] << endl;

	
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int a[8][8];

void Qputter(int);
int row[8];
int col[8];
int dpos[15];
int dneg[15];

void printboard(){
  int i, j;
  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      if(a[i][j]){
        if(row[i] != j) return;
      }
    }
  }
  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      if(row[i] == j) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}


int main(){
  int n, i, j, r, c;

  for(i=0;i<8;i++) {
    row[i] = col[i] = 0;
  }
  for(i=0;i<15;i++){
    dpos[i] = dneg[i] = 0;
  }


  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      a[i][j] = 0;
    }
  }

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d%d",&r,&c);
    a[r][c] = 1;
  }
 Qputter(0);

   return 0;
}

void Qputter(int i){
  int j;

  if(i == 8){
    printboard();
    return;
  }

  for(j=0;j<8;j++){
    if(col[j] == -1 || dpos[i + j] == -1 || dneg[i - j + 7] == -1) continue;

    row[i] = j;
    col[j] = dpos[i + j] = dneg[i - j + 7] = -1;
    Qputter(i+1);
    row[i] = col[j] = dpos[i+j] = dneg[i - j + 7] = 0;
  }
}




Measured memory_bytes: 2112
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n = inp()
    a = inpl()
    x = 0
    for i in range(n):
        x = x^a[i]
    ans = [x^a[i] for i in range(n)]
    print(*ans)
if __name__ == "__main__":
    main()

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int x;
  cin >> x;
  for (int i = 1; i <= x; ++i) {
    if (100 * i <= x && x <= 105 * i) {
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 256
li = list("abcdefghijklmnopqrstuvwxyz")
s = list(input())
cnt = [0 for i in range(26)]


for i in range(len(s)):
    for j in range(26):
        if li[j]==s[i]:
            cnt[j]+=1

for i in range(26):
    if cnt[i]==0:
        print(li[i])
        break
    elif i ==25:
        print("None")

Measured memory_bytes: 3956
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<cmath>
#include <bits/stdc++.h>



#define  ll long long int
#define REP(i,n) for(int i=0;i<n;i++)
#define v(T,n) vector<T>n
using namespace std;
const ll MOD = 1000000007;
const ll MAX = 65565;
ll fac[MAX], finv[MAX], inv[MAX];
using Graph = vector<vector<int>>;


/*
  // BFS のためのデータ構造
    vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
 while (!que.empty()) {  
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }
	*/










ll modpow(ll a, ll  n) { //二分累乗法 a^n
    ll ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return ret;
}
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(int n, int k){ //nCk
//use COMinit() before use this.
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



void Main()
{
	int N,M;
	cin>>N>>M;
	   Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
		a-=1;b-=1;
        G[a].push_back(b);
        G[b].push_back(a);
    }
	
	vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;
	vector<int> ans(N);
    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
 while (!que.empty()) {  
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない
			ans[nv] = v;
            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }
	int f = 0;
	for(int i = 1; i < N; i++){
		if(dist[i]==-1){
			f++;
		}else{
			
		}
	}
	if(f == 0){
		cout<<"Yes"<<endl;
	 for (int v = 1; v < N; ++v) cout << ans[v]+1 << endl;
	}else{
		cout<<"No"<<endl;
	}
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	COMinit();
	Main();
}

Measured memory_bytes: 12240
program ABC152C
    implicit none
    integer(8)::N,p_min,i
    integer(8)::result=1
    integer(8),allocatable,dimension(:)::P
    read(5,*)N
    allocate(P(N))
    read(5,*)(P(i),i=1,N)

    p_min=P(1)

    do i=2,N
        if(P(i)<=p_min)then
            p_min=P(i)
            result=result+1
        end if
    end do

    print'(i0)',result
end program ABC152C

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,k;cin >> n >> k;
  vector<ll> a(n),sum(n+1);
  for(int i=0;i<n;i++){
    cin >> a[i];
    sum[i+1]=sum[i]+a[i];
  }
  for(ll i=0;i<n+1;i++){
    sum[i]=(sum[i]+n*k-i)%k;
  }
  map<int,int> mp;
  ll ans=0;
  for(int i=0;i<=n;i++){
    ans+=mp[sum[i]];
    mp[sum[i]]++;
    if(i>=k-1){
      mp[sum[i-(k-1)]]--;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 12800
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define maxn 100005
using namespace std;
typedef long long ll;
int n;
ll x,y;
ll a[maxn];
ll myabs(ll now)
{
	return now>0 ? now : -now;
}
int main()
{
	scanf("%d%lld%lld",&n,&x,&y);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);

	ll maxx=myabs(a[n]-y);
	if(n>1)
		maxx=max(maxx,myabs(a[n]-a[n-1]));
	printf("%lld\n",maxx);
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if a[i] < a[j] + a[k] and a[j] < a[i] + a[k] and a[k] < a[j] + a[i] and (a[i]!=a[j]) and (a[j]!=a[k] and a[i]!=a[k]):
                ans+=1
                #print(i+1,j+1,k+1)
print(ans)

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define CEIL(n, m) ceil(n/pow(10.0, m))*pow(10.0, m)
#define FLOOR(n, m) floor(n/pow(10.0, m))*pow(10.0, m)
#define ROUND(n, m) round(n/pow(10.0, m))*pow(10.0, m)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

typedef long long ll;
const int mod = 1e9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;

void solve()
{
  string ans = "Yes";

  vector<vector<int>> c(3, vector<int>(3, 0));
  for (int i=0; i<3; i++) {
    for (int j=0; j<3; j++) {
      cin>>c[i][j];
    }
  }

  for (int i=0; i<2; i++) {
    int d1 = c[i][0]-c[i+1][0];
    int d2 = c[i][1]-c[i+1][1];
    int d3 = c[i][2]-c[i+1][2];
    if (d1 != d2 || d2 != d3) ans="No";
  }
  for (int i=0; i<2; i++) {
    int d1 = c[0][i]-c[0][i+1];
    int d2 = c[1][i]-c[1][i+1];
    int d3 = c[2][i]-c[2][i+1];
    if (d1 != d2 || d2 != d3) ans="No";
  }

  cout << ans << endl;
}

int main()
{
  solve();
  return 0;
}


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

int main(void){
    int N, M;
    int A, B;
    int max = 0, sum = 0;
    
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        cin >> A >> B;
        if(N > A){
            sum += N - A;
            if(N - A > max) max = N - A;
        }
    }
    
    cout << (sum - max) << endl;
}



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

int main(){
  int N;
  
  cin >> N;
  
  vector<long> L(N+1);
  
  L.at(0)=2;
  L.at(1)=1;
  
  for (int i=2; i<N+1; i++){
    L.at(i) = L.at(i-1) + L.at(i-2);
  }
  
  cout << L.at(N);
  
}

Measured memory_bytes: 256
#include<iostream>
  #include<fstream>
  #include<vector>
  #include<initializer_list>
  #include<string>
  using namespace std;
    int main(){
  int H;
  cin >> H;
  int A;
  cin >> A;

if (H%A != 0)
{cout << H/A+1 << endl;}
else if (H%A == 0)
{cout << H/A << endl;}





  }

Measured memory_bytes: 256
#高速化heapqダイクストラ
from collections import *
from heapq import*
import sys
input=lambda:sys.stdin.readline()


def BFS(point,d):
    cost=[1e7]*(n+1)
    cost[point]=0
    Q=[]
    heappush(Q,(0,point))
    
    while Q:
        c,p=heappop(Q)
        for np in d[p]:
            if cost[np]==1e7:
                cost[np]=c+1
                heappush(Q,(c+1,np))
    return cost

n=int(input())
d=[deque()for i in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    d[a].append(b)
    d[b].append(a)
        
x=BFS(1,d)[1:]
y=BFS(n,d)[1:]

#print(x,y)

F=0
S=0

for s,t in zip(x,y):
    if s<=t:
        F+=1
    else:
        S+=1

if F<=S:
    print("Snuke")
else:
    print("Fennec")


Measured memory_bytes: 126172
def fac(l,li):
    for i in range(len(li)+1):
        if l-i not in li:
            return(l-i)
        if l+i not in li:
            return(l+i)

l,n = map(int,input().split())
if n>0:
    li = list(map(int,input().split()))
    print(fac(l,li))
else:
    print(l)



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

#define reep(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) reep((i),0,(n))
long long MOD = 1000000007LL;

long long dp[210][210];


int main() {
	int n;
	cin >> n;
	dp[0][0] = 1;
	vector<char> v(n);
	rep(i, n) {
		cin >> v[i];
		if(v[i] == '-') {
			n--;
			i--;
		}
	}
	// v.erase(v.begin()+n, v.end());

	rep(i, n) {
		char t = v[i];
		rep(j, n) {
			if(t == 'U') {
				if(j>0) (dp[i + 1][j] += j*dp[i][j]%MOD) %= MOD;
				(dp[i + 1][j + 1] += dp[i][j]) %= MOD;
			}
			else {
				if(j - 1 >= 0) (dp[i + 1][j - 1] += j*j*dp[i][j]) %= MOD;
				if(j>0) (dp[i + 1][j] += j*dp[i][j]) %= MOD;
			}
		}
	}
	cout << dp[n][0] << endl;
}

Measured memory_bytes: 3416
#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

// const int N = ;
int n, k;
string s;

int main() {
	ios_base::sync_with_stdio(false);

	cin >> n >> k;
	cin >> s;

	int ok = 0;
	for(int i = 1; i < n; i++)
		if(s[i] == s[i - 1])
			ok++;

	cout << min(ok + 2 * k, n - 1);

}	

	

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, k, h[100101], dp[100101], INF = 1e9;

int main() {
	cin >> n >> k;
	inc(i, n) { cin >> h[i]; }
	
	inc(i, n) { dp[i] = INF; }
	dp[0] = 0;
	inc(i, n - 1) {
		inc1(j, k) { setmin(dp[i + j], dp[i] + abs(h[i] - h[i + j])); }
	}
	
	cout << dp[n - 1] << endl;
	
	return 0;
}


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

int main() {
    string s;
    cin >> s;
    int first = stoi(s.substr(0, 2));
    int second = stoi(s.substr(2, 2));
    int p = 0;
    int q = 0;
    if (0 < first && first < 13) p = 1;
    if (0 < second && second < 13) q = 1;
    if (p == 1 && q == 1) cout << "AMBIGUOUS" << endl;
    else if (p == 1 && q == 0) cout << "MMYY" << endl;
    else if (p == 0 && q == 1) cout << "YYMM" << endl;
    else cout << "NA" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;

using Move = size_t;
constexpr Move Gu = 0;
constexpr Move Choki = 1;
constexpr Move Pa = 2;
constexpr Move Invalid = ~0ull;

inline auto win (Move m) -> Move
{
  return (m + 2) % 3;
}

inline auto update_max (ll & x, const ll & wa) noexcept
{
  return x < wa ? static_cast <void> (x = wa), true : false;
}

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  size_t n, k;
  ll r, s, p;
  string t_str;
  cin >> n >> k >> r >> s >> p >> t_str;

  vector <Move> t;
  for (auto && elem : t_str)
  {
    if (elem == 'r')      t.push_back (Gu);
    else if (elem == 's') t.push_back (Choki);
    else if (elem == 'p') t.push_back (Pa);
    else assert (false);
  }

  auto calc_score = [&](size_t i, size_t m) -> ll
  {
    if (t [i] == Gu && m == Pa) return p;
    if (t [i] == Choki && m == Gu) return r;
    if (t [i] == Pa && m == Choki) return s;
    return 0;
  };

  vector <vector <vector <ll>>> v (k, vector <vector <ll>> (n / k + 1, vector <ll> (3)));
  rep (i, n)
  {
    auto j = i % k;
    auto i_k = i / k;

    if (i_k == 0)
    {
      rep (m, 3)
      {
        v [j][i_k][m] = calc_score (i, m);
      }
    }
    else if (i_k > 0)
    {
      auto && now = v [j][i_k];
      auto && prev = v [j][i_k - 1];
      cerr << "i=" << i << ": ";
      rep (m, 3)
      {
        ll prevmax = - inf;
        size_t prevmaxmove = Invalid;
        rep (prevmove, 3)
        {
          if (m == prevmove) continue;
          if (update_max (prevmax, prev [prevmove]))
          {
            prevmaxmove = prevmove;
          }
        }
        cerr << " (prevmove=" << prevmaxmove << ",prevscore=" << prevmax << ")";
        now [m] = prevmax + calc_score (i, m);
      }
      cerr << endl;
    }
  }

  ll ans = 0;
  cerr << "ans: ";
  rep (j, k)
  {
    auto i = n - 1 - j;
    auto i_k = i / k;
    auto && now = v [i % k][i_k];

    auto m = * max_element (ALL (now));
    cerr << " (i=" << i << ",score=" << m << ")";
    ans += m;
  }
  cerr << endl;

  cout << ans << endl;
}


Measured memory_bytes: 14708
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
#include <list>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#ifndef M_PI
#define M_PI 3.1415926535
#endif
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define F first
#define S second

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

int ans[1001];

int fact(int n){
  if(n<2)return 1;
  return fact(n-1)*n;
}

main(){
  int m;
  while(cin>>m,m){
    memset(ans,0,sizeof(ans));

    rep(i,m){
      int a,b;
      cin>>a>>b;
      for(int j=1000;j>0;j--){
	if(ans[j]==0)continue;
	int u=0;
	for(int k=j+a;k<=1000 && u<b;k+=a){
	  u++;
	  ans[k]+=ans[j];
	}
      }
      rep(j,b)ans[a*j+a]+=1;
    }
    //rep(i,10)cout<<ans[i+1]<<endl;

    int n;
    cin>>n;
    while(n--){
      int a;
      cin>>a;
      cout<<ans[a]<<endl;
    }
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>

using namespace std;

const int MAX_N = 16;
const int MAX_M = 16;
const double EPS = 1e-10;

double dp[1<<MAX_M][MAX_N];

double prob[MAX_M][MAX_N];
int M, N;

double dfs(int b, int x){
  if(x == N) return 1.0;
  if(b == (1<<M)-1){
    return 0.0;
  }
  if(dp[b][x] - -1 > EPS) return dp[b][x];
  //cout << b << " " << x << " " << M << " " << N << endl;  
  double ret = 0; 
  for(int i=0;i<M;i++){
    if(b&(1<<i)) continue;
    double p = 0.0;
    double tmpp = 1.0;
    for(int j=x;j<N;j++){
      p += tmpp * (1 - prob[i][j]) * dfs(b | (1<<i), j);
      //cout << p << endl;
      //cout << "tmpp: " << tmpp << " prob[i][j]: " << prob[i][j] << endl;      
      tmpp *= prob[i][j];
    }
    p += tmpp * dfs(b | (1<<i), N);
    ret = max(ret, p);
  }
  dp[b][x] = ret;
  return ret;
}

int main(){
  scanf("%d%d", &M, &N);
  memset(dp, -1, sizeof(dp));
  for(int i=0;i<M;i++){
    for(int j=0;j<N;j++){
      scanf("%lf", &prob[i][j]);
    }
  }

  printf("%0.30lf\n", dfs(0, 0));
  return 0;
}



Measured memory_bytes: 11420
#include <bits/stdc++.h>
#define FOR(i,x,y) for(int i=x;i<y;i++)
using namespace std;
int main(){
  int W,H,N,x,y,a;
  cin >> W >> H >> N;
  int xl=0,xr=W,yl=0,yr=H;
  FOR(i,0,N){
    cin >> x >> y >> a;
    if(a==1)xl=max(xl,x);
    if(a==2)xr=min(xr,x);
    if(a==3)yl=max(yl,y);
    if(a==4)yr=min(yr,y);
  }
  cout << (max(xr-xl,0))*(max(yr-yl,0)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
	int n;
	cin >> n;
	vector<ll> a(n), b(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	for (int i = 0; i < n; ++i)
	{
		cin >> b[i];
	}
	auto stand_bit = [&](int k) {
		for (auto &x : a)
		{
			x %= (1LL << (k + 1));
		}
		for (auto &x : b)
		{
			x %= (1LL << (k + 1));
		}
		sort(b.begin(), b.end());
		ll T = 1LL << k;
		ll up = 0;
		for (auto &x : a)
		{
			up += lower_bound(b.begin(), b.end(), 2 * T - x) - lower_bound(b.begin(), b.end(), T - x) + lower_bound(b.begin(), b.end(), 4 * T - x) - lower_bound(b.begin(), b.end(), 3 * T - x);
		}
		return up & 1;
	};
	ll ans = 0;
	for (int i = 28; i >= 0; --i)
	{
		ans += (1LL << i) * stand_bit(i);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328
#include<stdio.h>

int main(void){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    //printf("%d%d%d%d",a,b,c,d);
    if(a>b){
        a=b;
    }
    if(c>d){
        c=d;
    }
    printf("%d",a+c);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstring>
using namespace std;
char ch;
 
int main() {
	cin >> ch;
	if (ch == 'A') cout << "T";
	if (ch == 'T') cout << "A";
	if (ch == 'C') cout << "G";
	if (ch == 'G') cout << "C";
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())

g = []
same = ['.'] * w
for _ in range(h):
    a = list(input())
    if a == same:
        continue
    else:
        g.append(a)

l = []
for j in range(w):
    for row in g:
        if row[j] == '#':
            break
    else:
        l.append(j)

for i in range(len(g)):
    g[i] = [g[i][j] for j in range(w) if j not in l]

for i in g:
    print(''.join(i))

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

int main() {
    int n;
    cin >> n;
    int max = -1000000, min = 1000000;
    long long int sum = 0;
    int a;

    for(int i = 0; i < n; i++) {
      	cin >> a;
        sum += a;
        if(a>max) max = a;
        if(a<min) min = a;
    }

    printf("%d %d %ld\n", min, max, sum);
}


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

// #define int long long

signed main()
{
    int i=0, j=0, k=0, ans=0;
    int A,B,C,D;
    cin>>A>>B>>C>>D;

    int ans1, ans2;
    ans1=A/D;
    if(A%D)
        ans1++;
    ans2=C/B;
    if(C%B)
        ans2++;

    if(ans2<=ans1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3564
def main():
    from collections import deque
    import sys
    # from time import time

    # start = time()

    H, W = map(int, sys.stdin.readline().split())
    field = [list(sys.stdin.readline().rstrip()) for i in range(H)]

    # print(time() - start)

    queue = deque([])

    for h in range(H):
        for w in range(W):
            if field[h][w] == "#":
                queue.append([h, w])

    dist_from_nearest_black = [[0] * W for i in range(H)]
    direction = [[1, 0], [-1, 0], [0, 1], [0, -1]]

    def bfs():
        while len(queue) != 0:

            h, w = queue.popleft()

            for dh, dw in direction:
                next_h = h + dh
                next_w = w + dw

                if next_h < 0 or next_h >= H or next_w < 0 or next_w >= W:
                    continue
                elif field[next_h][next_w] == "#":
                    continue
                else:
                    dist_from_nearest_black[next_h][next_w] = dist_from_nearest_black[h][w] + 1
                    field[next_h][next_w] = "#"
                    queue.append([next_h, next_w])

    bfs()

    ans = 0

    for d in dist_from_nearest_black:
        ans = max(ans, max(d))

    print(ans)
    # print(time() - start)


if __name__ == "__main__":
    main()


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

int main(){
  int N , M , C ; 
  cin >> N >> M >> C ; 
  vector<int> B(M) ; 
  vector<vector<int>>  A(N , vector<int>(M)) ;
  int cnt = 0  ; 
  
  
  for(int i = 0 ; i < M ; i++){
    cin >> B.at(i) ; 
  }
  
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < M ; j++){
      cin >> A.at(i).at(j) ; 
    }
  }
  
  for(int i = 0 ; i < N ; i++){
        int T = 0 ;

    for(int j = 0 ; j< M ; j++){
      T += A.at(i).at(j)*B.at(j) ; 
    }
    
    if(T + C > 0 ){
      cnt++ ; 
    }
  }
  
  cout << cnt << endl; 
  
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <ctype.h>

int main(){
    char ch;
    while(1){
        scanf("%c", &ch);
        if(ch=='\n'){
            printf("\n");
            break;
        }else if(islower(ch)){
            printf("%c", toupper(ch));
        }else if(isupper(ch)){
            printf("%c", tolower(ch));
        }else{
            printf("%c", ch);
        }
    }

    return 0;
}



Measured memory_bytes: 2688
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &x: a) cin >> x;

  int ans = 1;
  for (int i = 0; i < n-1; i++) {
    if (a[i] >= a[i+1]) ans++;
  }

  cout << ans << endl;
  cout << n << endl;

  return 0;
}



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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; ++i) cin >> d[i];
    sort(d.begin(), d.end());
    ll left = d[n/2-1];
    ll right = d[n/2];
    cout << right - left << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <complex>
#include <algorithm>

using namespace std;

typedef complex<double> Point;

const double EPS = 1e-10;

Point a, b, c, o;
double r;

bool equals(double a, double b){
  return abs(a-b) < EPS;
}

double dot(Point a, Point b){
  return a.real()*b.real() + a.imag()*b.imag();
}

double cross(Point a, Point b){
  return a.real()*b.imag() - a.imag()*b.real();
}

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

int ccw(Point p0, Point p1, Point p2){
  Point a = p1 - p0;
  Point b = p2 - p0;
  if(cross(a, b) > EPS) return COUNTER_CLOCKWISE;
  if(cross(a, b) < -EPS) return CLOCKWISE;
  if(dot(a, b) < -EPS) return ONLINE_BACK;
  if(norm(a) < norm(b)) return ONLINE_FRONT;
  return ON_SEGMENT;
}

double getDistance(Point a, Point b){
  return abs(a - b);
}

double getDistanceLP(Point a, Point b, Point p){
  return abs(cross(b - a, p - a) / abs(b - a));
}

double getDistanceSP(Point a, Point b, Point p){
  if(dot(b - a, p - a) < 0.0) return abs(p - a);
  if(dot(a - b, p - b) < 0.0) return abs(p - b);  
  return getDistanceLP(a, b, p);
}

bool TinC(){
  if(ccw(a, b, o) != 1) return false;
  if(ccw(b, c, o) != 1) return false;
  if(ccw(c, a, o) != 1) return false;
  if(getDistanceSP(a, b, o) < r) return false;
  if(getDistanceSP(b, c, o) < r) return false;
  if(getDistanceSP(c, a, o) < r) return false;
  return true;
}

bool CinT(){
  if(getDistance(a, o) > r) return false;
  if(getDistance(b, o) > r) return false;
  if(getDistance(c, o) > r) return false;
  return true;
}

bool CrossT(){
  if(getDistanceSP(a, b, o) < r + EPS) return true;
  if(getDistanceSP(b, c, o) < r + EPS) return true;
  if(getDistanceSP(c, a, o) < r + EPS) return true;
  return false;
}

char solve(){
  if(ccw(a, b, c) == -1){
    swap(a, b);
  }
  if(TinC()) return 'a';
  if(CinT()) return 'b';
  if(CrossT()) return 'c';
  else return 'd';
}

main(){
  while(cin >> a.real() >> a.imag() && (a.real() || a.imag())){
    cin >> b.real() >> b.imag();
    cin >> c.real() >> c.imag();
    cin >> o.real() >> o.imag();
    cin >> r;
    cout << solve() << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}

vi h(4),w(4);
vector<vs> s(4);
vs in(4);
bool ans;
void f(int now,int used){
    //cout << "!" << now << " " << used << endl;
    //rep(i,4)cout << in[i] << endl;
    if(used == 0){
        f(now+1,1);
    }
    if(now == 4 && used){
        ans = true;
        return;
    }
    rep(i,4-h[now]+1)rep(j,10-w[now]+1){
        bool c = true;
        rep(x,h[now])rep(y,w[now]){
            if(in[i+x][j+y] == '#' && s[now][x][y] == '#')c = false;
        }
        if(c){
            rep(x,h[now])rep(y,w[now]){
                if(s[now][x][y] == '#')in[i+x][j+y] = '#';
            }
            f(now+1,used);
            rep(x,h[now])rep(y,w[now]){
                if(s[now][x][y] == '#')in[i+x][j+y] = '.';
            }
        }
    }
}

signed main(void) {
    rep(i,4){
        cin >> h[i] >> w[i];
        s[i] = vs(h[i]);
        rep(j,h[i]){
            cin >> s[i][j];
        }
    }
    int n;
    cin >> n;
    while(n--){
        //cout << endl;
        //cout << endl;
        rep(i,4)cin >> in[i];
        ans = false;
        f(0,0);
        if(ans)cout << "Yes" << endl;
        else cout << "No" << endl;
    }

}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353,INF=1e18;



int main() {
    int N;
    cin>>N;
    vector<ll> a(N);
    rep(i,N)cin>>a.at(i);
    ll S=a.at(N-1);
    rep(i,N-1){
        S=S^a.at(i);
    }
    rep(i,N){
        ll p=a.at(i);
        p=p^S;
        cout<<p<<endl;
    }
}

Measured memory_bytes: 4772