akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

int main()
{
    ll n, cnt = 1;
    while (cin >> n)
    {
        if (n == 0)
        {
            break;
        }
        else
        {
            cout << "Case " << cnt << ": " << n << endl;
        }
        cnt++;
    }
    return 0;
}


Measured memory_bytes: 2988
#include<bits/stdc++.h>
#define ll long long
#define re register
#define ull unsigned int
using namespace std;
inline int read(){
	int s=0,t=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*t;
}
const int N=105;
int n,m,K,P,o;
int coe[N],C[N][N],p[N][N],f[2][N][N],tp[N][N];
int Mod(int x){return x>=P?x-P:x;}
void Pre(int n){
	coe[0]=1;for(int i=1;i<=n;i++)coe[i]=P-coe[i-1];
	for(int i=0;i<=n;i++){
		C[i][0]=p[i][0]=1;
		for(int j=1;j<=n;j++)p[i][j]=1ll*p[i][j-1]*i%P;
		for(int j=1;j<=i;j++)C[i][j]=Mod(C[i-1][j-1]+C[i-1][j]);
	}
}
void Clear(int t){
	for(int i=0;i<=n;i++)
	for(int j=0;j<=m;j++)f[t][i][j]=0;
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read(),m=read(),K=read(),P=read(),Pre(100);
	f[0][0][0]=1;
	for(int t=1;t<=K;t++){
		o^=1,Clear(o);
		for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)if(f[o^1][i][j]){
			int x=1ll*p[K-t+1][j]*p[t][m-j]%P,y=f[o^1][i][j];
			for(int a=0;a<=n-i;a++,y=1ll*y*x%P)f[o][i+a][j]=Mod(f[o][i+a][j]+1ll*C[n-i][a]%P*y%P);
		}o^=1,Clear(o);
		for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)if(f[o^1][i][j]){
			int x=1ll*p[K-t+1][i]*p[t][n-i]%P,y=f[o^1][i][j];
			for(int b=0;b<=m-j;b++,y=1ll*y*x%P)f[o][i][j+b]=Mod(f[o][i][j+b]+1ll*C[m-j][b]%P*y%P);
		}o^=1,Clear(o);
		for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)if(f[o^1][i][j]){
			int x=1ll*(P-p[K-t][j])*p[t][m-j]%P,y=f[o^1][i][j];
			for(int a=0;a<=n-i;a++,y=1ll*y*x%P)f[o][i+a][j]=Mod(f[o][i+a][j]+1ll*C[n-i][a]%P*y%P);
		}o^=1,Clear(o);	
		for(int i=0;i<=n;i++)for(int j=0;j<=m;j++)if(f[o^1][i][j]){
			int x=1ll*(P-p[K-t][i])*p[t][n-i]%P,y=f[o^1][i][j];
			for(int b=0;b<=m-j;b++,y=1ll*y*x%P)f[o][i][j+b]=Mod(f[o][i][j+b]+1ll*C[m-j][b]%P*y%P);
		}
	}printf("%d",f[o][n][m]);
	return 0;
}
/*2 2 2 998244353*/


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pair<int, int> > vp;
typedef pair<int, int> pr;
typedef tuple<int, int, int> ti;

#define FOR(i, a, b) for (int i = (a), _b = (b); i < _b; i++)
#define FORD(i, b, a) for (int i = (b), _a = (a); i > _a; i--)
#define pb push_back
#define print(v) cout << v << '\n'
#define pr_vec(v)   for (int i = 0; i != v.size(); i++) cout << v[i] << ' '
#define vin(v)  for (auto &i: v)    cin >> i

ld pi = 3.141592653589793238;
ll M = 1e9 + 7;

int gcd(int a, int b) {
    if (a == 0) return b;

    return gcd(b % a, a);
}

bool is_prime(ll n) {
    if (n == 2) return true;
    if (n < 2) return false;
    if (n % 2 == 0) return false;

    for (int i = 3; i <= sqrt(n); i += 2) {
        if (n % i == 0) return false;
    }

    return true;
}

bool is_palindrome(string s) {
    return equal(s.rbegin(), s.rend(), s.begin());
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t, n, m, k, q, x, y;
    string s;
    bool flag;

    // cin >> n;
    // vll v(n);
    // vin(v);

    // long long prod = 1;
    // unsigned long long up = 1e18;

    // sort(v.begin(), v.end(), greater<ll>());

    // FORD (i, n - 1, -1) {
    //     if (v[i] == 0) {
    //         print(0);
    //         return 0;
    //     }
    // }

    // for (auto i: v) {
    //     prod *= i;
    //     if (prod > up) {
    //         prod = -1;
    //         break;
    //     }
    // }

    // print(prod);

    ll a, res;
    ld b;
    cin >> a >> b;
    res = floor(a * b);
    cout << res << '\n';

    return 0;

}


Measured memory_bytes: 3776
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cassert>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<bitset>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

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

const ll MOD = 1000000007;
const long double EPS = 10e-10;
const int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int not_prime[31625];

map<Pll, ll> memo;

ll comb(ll n, ll r){
    if(n == 0 || r < 0) return 0LL;
    if(n == r || r == 0){
        return 1;
    }else if(r == 1){
        return n;
    }else if(memo[Pll(n, r)] != 0){
        return memo[Pll(n, r)];
    }else{
        ll tmp = comb(n-1, r-1) + comb(n-1, r);
        memo[Pll(n, r)] = tmp;
        return tmp;
    }
}

vector<ll> factorize(ll n){
    vector<ll> ret;
    ll i = 2, rt = sqrt(n);
    while(n != 1 && i <= rt){
        if(not_prime[i]){
            i++;
            continue;
        }
        ll j = i;
        while(j <= rt){
            not_prime[j] = 1;
            j += i;
        }

        while(n % i == 0){
            n /= i;
            ret.push_back(i);
        }

        i++;
    }
    if(n != 1){
        ret.push_back(n);
    }
    return ret;
}

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

    map<ll, ll> count;
    for(ll i=1;i<=n;i++) {
        vector<ll> facts = factorize(i);
        for(ll fact: facts) {
            count[fact]++;
        }
        fill(not_prime, not_prime+100, 0);
    }

    map<ll, ll> mp;
    for(auto p: count) {
        for(ll i=74;i>=2;i--) {
            if(p.second >= i) {
                mp[i]++;
                break;
            }
        }
    }
    for(ll i=73;i>=2;i--) {
        mp[i] += mp[i+1];
    }

    ll ans = mp[74];
    ans +=  mp[24] * comb(mp[2]-1, 1) + mp[14] * comb(mp[4]-1, 1);
    ans += comb(mp[4], 2) * comb(mp[2]-2, 1);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int d[200000];
long long c[200000];

int main() {
    int m, i;
    long long sum = 0, ans = 0;
    
    scanf("%d", &m);
    
    for (i = 0; i < m; i++) scanf("%d %lld", &d[i], &c[i]);
    
    for (i = 0; i < m; i++) {
        sum += d[i] * c[i];
        ans += c[i] - 1;
        if (i > 0) ans++;
    }
    
    while (sum >= 10) {
        long long sum2 = 0;
        
        for (i = 0; sum > 0; sum /= 10) {
            sum2 += sum % 10;
            ans += sum / 10;
            if (i > 0) ans++;
        }
        
        sum = sum2;
    }
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 2560
# 標準入力
N = int(input()) #1行目のNを取得する
#s = [input() for i in range(N+1)] #複数行の数値の入力を取得
s = [list(map(str, input().split())) for i in range(N+1)]
# print(N)
# print(s)
list_music = []
list_time = []
sleep_music = s[N]
# print(sleep_music[0])

for i in range(N):
    for j in range(2):
        # print(s[i][j])
        if j == 0:
            list_music.append(s[i][j])
        elif j == 1:
            list_time.append(int(s[i][j]))

# print("タイトル：" + str(list_music))
# print("時間：" + str(list_time))

sleep_point = list_music.index(sleep_music[0])
# print((sleep_point))
sleep_time = 0
for i in range(sleep_point+1, N):
    # print(i)
    sleep_time += list_time[i]

# sleep_time = sum(int(list_time) for i in range(sleep_point+1, N))
# sleep_time = sum(int(i) for i in list_time(range(sleep_point+1, N)))
print(sleep_time)

Measured memory_bytes: 3316
/*ILTH      ILTH            ILTHILTHILTH    ILTH        ILTH
  ILTH      ILTH                ILTH        ILTH        ILTH
  ILTH      ILTH                ILTH        ILTHILTHILTHILTH
  ILTH      ILTH                ILTH        ILTH        ILTH
  ILTH      ILTHILTHILTH        ILTH        ILTH        ILTH

  */
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const int maxN = 100005;

string s,t;
int ss[maxN],tt[maxN];
int n,ch[300];
int main()
{
   // ifstream cin("a.inp");
    cin >> s >> t;
    ch['A']=1;ch['B']=2;
    s='#'+s;t='#'+t;
    for (int i=1; i<s.size(); ++i)
        ss[i]=ss[i-1]+ch[s[i]];
    for (int i=1; i<t.size(); ++i)
        tt[i]=tt[i-1]+ch[t[i]];
    cin >> n;
    for (int i=1; i<=n; ++i){
            int a,b,c,d;
        cin >> a >> b >> c >> d;
        int t=abs((ss[b]-ss[a-1])-(tt[d]-tt[c-1]));
        if (t%3==0) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}


Measured memory_bytes: 1636
#include <iostream>

#define REP(i, n) for(int i = 0; i < (n); i++)

using namespace std;

int main() {
	int n, m, l;
	int **a, **b;
	long long **c;
	cin >> n >> m >> l;
	a = new int*[n];
	REP(i, n) {
		a[i] = new int[m];
		REP(j, m) {
			cin >> a[i][j];
		}
	}

	b = new int*[m];
	REP(i, m) {
		b[i] = new int[l];
		REP(j, l) {
			cin >> b[i][j];
		}
	}

	c = new long long*[n];
	REP(i, n) {
		c[i] = new long long[l];
		REP(j, l) {
			long long sum = 0;
			REP(k, m)
				sum += a[i][k] * b[k][j];
			c[i][j] = sum;
		}
	}

	REP(i, n) {
		REP(j, l) {
			if (j != 0)
				cout << " ";
			cout << c[i][j];
		}
		cout << endl;
	}

	REP(i, n)
		delete[] a[i];
	delete a;
	REP(i, m)
		delete[] b[i];
	delete b;
	REP(i, n)
		delete[] c[i];
	delete c;

	return 0;
}

Measured memory_bytes: 1344
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int card[5] = {0};
    while(~scanf("%d,%d,%d,%d,%d",&card[0],&card[1],&card[2],&card[3],&card[4])){
        string role = "null";
        sort(card,card+5);
        if((card[0] == card[1] && card[1] == card[2] && card[2] == card[3]) || (card[1] == card[2] && card[2] == card[3] && card[3] == card[4]))role = "four card";
        else if(((card[0] == card[1] && card[1] == card[2]) && card[3] == card[4])||((card[0] == card[1]) && card[2] == card[3] && card[3] == card[4]))role = "full house";
        else if(((card[0]+4) == (card[1]+3)) && ((card[1] + 3) == (card[2] + 2)) && ((card[2] + 2) == (card[3] + 1)) && ((card[3] + 1) == (card[4]))) role = "straight";
        else if(((card[0]+12) == (card[1]+3)) && ((card[1] + 3) == (card[2] + 2)) && ((card[2] + 2) == (card[3] + 1)) && ((card[3] + 1) == (card[4]))) role = "straight";
        else if((card[0] == card[1] && card[1] == card[2]) || (card[1] == card[2] && card[2] == card[3]) || (card[2] == card[3] && card[3] == card[4]))role = "three card";
        else if((card[0] == card[1] && card[2] == card[3]) || (card[1] == card[2] && card[3] == card[4]) || (card[0] == card[1] && card[3] == card[4])) role = "two pair";
        else if(card[0] == card[1] || card[1] == card[2] || card[2] == card[3] || card[3] == card[4]) role = "one pair";
        cout << role << endl;
    }
    return 0;
}

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

fn main() {
    let mut num: String = (0..3).map(|_| input::<String>()).collect();
    let num :u32 = num.parse().unwrap();
    let ans = if num % 4 == 0 {"YES"} else {"NO"};
    println!("{}",ans);
}

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


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

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  string s;
  cin >> s;
  bool ok = (s[a] == '-');
  for (int i = 0; i < a; i++)
    if (s[i]< '0' or s[i] >'9') ok = false;
  for (int i = a+1; i<=  a+b;i++)
    if (s[i]< '0' or s[i] >'9') ok = false;
  if (ok) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}



Measured memory_bytes: 256
N,K = map(int,input().split())

if N>=K:
    amari = N % K
    X = K - amari
    if X > amari:
        x = amari
    else :
        x = X
else:
    if N >= (K-N):
        x = K-N
    else:
        x = N        


print(x)


Measured memory_bytes: 2940
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a%b)

def main():
    n, q = list(map(int, input().strip().split()))
    v = list(map(int, input().strip().split()))
    v.sort()
    k = v[0]
    for i in range(1, n):
        k = gcd(v[i], k)
    if q <= v[-1] and q % k == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

if __name__ == '__main__':
    main()


Measured memory_bytes: 62576
'''
クラスカル法
辺をコストの小さい順に見ていき、閉路ができなければ追加する。
追加前にuとvが同じ連結成分に属していなければ、eを追加しても閉路はできない。
したがってuとvが同じ連結成分に属しているか否かを判定するためにUnionFindを利用する。
辺をソートするためO(ElogV)
'''

class Kruskal_UnionFind():
    def __init__(self, N):
        """
        Parameters
        ----------
        n:int
            the number of nodes
        """
        self.edges = []
        self.rank = [0] * N
        self.par = [i for i in range(N)]
        self.counter = [1] * N

    def add(self, u, v, d):
        """
        Parameters
        ----------
        u:int
            from node (0-index)
        v:int
            to node (0-index)
        d:int
            cost
        """
        self.edges.append([u, v, d])

    def _find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self._find(self.par[x])
            return self.par[x]

    def _unite(self, x, y):
        x = self._find(x)
        y = self._find(y)
        if x != y:
            z = self.counter[x] + self.counter[y]
            self.counter[x], self.counter[y] = z, z
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def _size(self, x):
        x = self._find(x)
        return self.counter[x]

    def _same(self, x, y):
        return self._find(x) == self._find(y)

    def Kruskal(self):
        """
        Return
        ----------
        res:int
            sum of cost
        """
        edges = sorted(self.edges, key=lambda x: x[2])  # costでself.edgesをソートする
        res = 0
        for e in edges:
            if not self._same(e[0], e[1]):
                self._unite(e[0], e[1])
                res += e[2]
        return res

'''
ABC065-D
平面上にN個の街がある。
i番目の街は座標(x_i,y_i)にあり、重複することもある。
座標(a,b)と座標(c,d)の間に橋をかけるにはmin(|a-c|,|b-d|)円かかる。
任意の2つの街を道を何本か通ることで行き来できるようにするためには、
最低何円必要でしょうか。

term:
2<=N<=10**5
0<=x_i,y_i<=10**9

input:
3
1 5
3 9
7 8

output:
    3
'''

N = int(input())
XY = [[i] + list(map(int, input().split())) for i in range(N)] # [[idx, x_i, y_i],...]
graph = Kruskal_UnionFind(N)
XY = sorted(XY, key=lambda x: x[1]) # x_iについてsort
X_costs = [[XY[i - 1][0], XY[i][0], abs(XY[i - 1][1] - XY[i][1])] for i in range(1, N)]
# X_costs = [[from_idx, to_idx, x_cost],...] x_costについてsortされている
XY = sorted(XY, key=lambda x: x[2]) # y_iについてsort
Y_costs = [[XY[i - 1][0], XY[i][0], abs(XY[i - 1][2] - XY[i][2])] for i in range(1, N)]
# Y_costs = [[from_idx, to_idx, x_cost],...] y_costについてsortされている

for i in range(N-1):
    x0, x1, d = X_costs[i]
    graph.add(x0, x1, d)
    y0, y1, d = Y_costs[i]
    graph.add(y0, y1, d)

print(graph.Kruskal())


'''
この問題ではnodeに番号がないため、idxをつけることでnodeに番号を振っている。
また、x,yのうち最小をとるという条件から、二重辺と見てもどうせコストの大きい方は捨てられるので題意に沿う。

今回は頂点のみが与えられており、メッシュ状に張るとそれだけで|E|=V(V-1)になって間に合わない。
そこで、辺のとり方を工夫する必要があるが、コストを最小にするためにはxの距離が最小またはyの距離が最小である必要がある。
したがってxでsortしたときの隣同士とyでsortしたときの隣同士のみをとればよい。

もし与えられている辺があった場合でO(ElogV)に間に合うのであればすべてgraph.addすればいい。
'''

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int h,w;
char s[52][52];

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

int main(){
  scanf("%d%d",&h,&w);
  REP(i,h)scanf("%s",s[i]);
  REP(i,h)REP(j,w){
    if(s[i][j]=='#')continue;
    int a = 0;
    REP(d,8){
      int ni = i+dx[d];
      int nj = j+dy[d];
      if(ni<0 || nj<0 || ni>=h || nj>=w)continue;
      if(s[ni][nj]=='#')a++;
    }
    s[i][j] = a+'0';
  }
  REP(i,h)puts(s[i]);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main() {
    int a[5];
    for (int i = 0; i < 5; i++) {
        cin >> a[i];
    }
    int b = 10;
    for (int i = 0; i < 5; i++) {
        if (a[i] % 10 > 0){
            b = min(a[i] % 10, b);
        }
    }
    //cout << b << endl;
    int ans = 0;
    for (int i = 0; i < 5; i++) {
        if (a[i] % 10 == 0) {
            ans += a[i];
        } else if (a[i]%10 == b) {
            ans += a[i];
            b=-1;
        } else {
            ans += a[i];
            ans += (10 - a[i] % 10);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)

int main(){
  int n;
  cin >> n;
  cout << (n+1)/2 << endl;
  return 0;
}

Measured memory_bytes: 256
//-----------------------------------------------------------
// すぐ使える
//-----------------------------------------------------------
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
		// 1行、2つ(複数)数字
		String[] ss0 = br.readLine().trim().split(" ", 0);
		int N = Integer.parseInt(ss0[0]);  // 人数　－＞行数
		int C = Integer.parseInt(ss0[1]);  // バス定員
		int K = Integer.parseInt(ss0[2]);  // 待ち猶予時間

		long[] t1 = new long[N];  //0で初期化される
		for(int i=0; i<N; i++) {
			t1[i] = Integer.parseInt(br.readLine());  // 到着時刻
		}
		Arrays.sort(t1);

		long ans = 0;

		long c = 0; //待ち客数
		long t = t1[0];
		for(int i=0; i<N; i++) {
			if (i+1 == N) { ans += 1; break;}
			c += 1;
			if ( ((t+K)>=t1[i+1]) && (C>c) ) {
				//次の時間でも大丈夫
				//System.out.println(i+" "+t1[i]+" NEXT!");
			} else {
				//次の時間じゃダメ
				ans += 1;
				t = t1[i+1];
				c = 0;
				//System.out.println(i+" "+t1[i]+" GO NOW  ans=" + ans + "  c=" + c);
			}

		}


        System.out.println(ans);
        return;
    }
    //-----------------------------------------------------------------
    // Debug.Print
    static void dp(String s) {
		System.out.println(s);
	}
    static void dp(StringBuilder s) { dp(s.toString()); }
    static void dp(int i) { dp(String.valueOf(i)); }
    static void dp(long i) { dp(String.valueOf(i)); }



}


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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

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

int main(){
  ll x;
  cin>>x;
  ll sum=100;
  ll i=0;
  while(sum<x){
    sum*=1.01;
    i++;
  }
  cout<<i<<endl;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include<limits.h>

#define MAX_N 100001

struct pair{int first,second;};

int n;
struct pair dat[2*MAX_N-1];

int add(int k,int a){
  k+=n-1;
  dat[k].first+=a;
  while(k>0){
    k=(k-1)/2;
    if(dat[k*2+1].first>dat[k*2+2].first)dat[k]=dat[k*2+1];
    else if(dat[k*2+1].first==dat[k*2+2].first){
      if(dat[k*2+1].second<dat[k*2+2].second)dat[k]=dat[k*2+1];
      else dat[k]=dat[k*2+2];
    }
    else dat[k]=dat[k*2+2];
  }
}

void init(){
  int i;
  for(i=0;i<n;i++){
    struct pair p;
    p.first=0;
    p.second=i;
    dat[i+n-1]=p;
  }
  for(i=0;i<n;i++)add(i,0);
}

int cnt[100001];

int main(void){

  int r,l,now=0,pre=0,i;

  scanf("%d %d %d",&n,&r,&l);
  init();

  while(r--){

    int d,t,x;
    scanf("%d %d %d",&d,&t,&x);
    cnt[now]+=t-pre;
    pre=t;
    add(d-1,x);
    now=dat[0].second;
  }
  cnt[now]+=l-pre;

  int ans=0,p=0;
  for(i=0;i<n;i++)if(p<cnt[i])p=cnt[i],ans=i;
  printf("%d\n",ans+1);

  return 0;
}

Measured memory_bytes: 2548
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define TEST int t = 1; while(t--) solve()

void solve(){
    
    int a,b;
    cin>>a>>b;
    cout<<a*b<<"\n";
}

signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); TEST; return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
long int n;
int a[100005][3];
int dp[100005][5];
int Func(int i,int flag){
    if(flag==-1){
        int l = max(Func(0,0),Func(0,2));
        l = max(l,Func(0,1));
        return l;
    }
    if(i>=n)    return 0;
    if(dp[i][flag]!=-1) return dp[i][flag];
    if(flag==1){
        return dp[i][flag] = max(a[i][0]+ Func(i+1,0),a[i][2]+Func(i+1,2));
    }
    if(flag==2){
        return dp[i][flag] = max(a[i][0]+ Func(i+1,0),a[i][1]+Func(i+1,1));
    }
    if(flag==0){
        return dp[i][flag] = max(a[i][1]+ Func(i+1,1),a[i][2]+Func(i+1,2));
    }
}
int main(){
    
	cin>>n;
	for(int i =0;i<n;i++){
	    cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	memset(dp,-1,sizeof(dp));
	

	cout<<Func(0,-1)<<endl;
// 	for(int i=0;i<n;i++){
// 	    for(int j=0;j<3;j++){
// 	        cout<<dp[i][j]<<" ";
// 	    }
// 	    cout<<endl;
// 	}
}

Measured memory_bytes: 11420
N,M,K = map(int, input().split())
mod = 998244353

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
    
ans = 0
for k in range(K+1):
    ans += M*pow(M-1, N-1-k, mod)*cmb(N-1, k, mod)
    ans %= mod

print(ans)

Measured memory_bytes: 32788
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b;
  cin >> a >> b;
  if((a+b) % 2 != 0) {
    cout << ((a+b) / 2) + 1<< endl;
  } else {
    cout << (a+b) / 2 << endl;
  }
}

Measured memory_bytes: 3596
from bisect import *
while 1:
	r,c,q = map(int,raw_input().split())
	if r == 0: break
	R = [[0,0] for i in range(r)]
	C = [[0,0] for i in range(c)]
	for i in range(1,q+1):
		A,B,order = map(int,raw_input().split())
		if A == 0:
			R[B] = [i,order]
		else:
			C[B] = [i,order]
	CC =  [sorted(C[ci][0] for ci in range(c) if C[ci][1] == 1)]
	CC += [sorted(C[ci][0] for ci in range(c) if C[ci][1] == 0)]
	ans = r*sum(C[ci][1] for ci in range(c))
	ans -= sum((-1)**R[ri][1]*bisect(CC[R[ri][1]],R[ri][0]) for ri in range(r))
	print ans

Measured memory_bytes: 25120
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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 dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  pll ma,mi;
  ma.F=-INF;
  mi.F=INF;
  rep(i,n){
    if(ma.F<a[i]){
      ma.F=a[i];
      ma.S=i;
    }
    if(mi.F>a[i]){
      mi.F=a[i];
      mi.S=i;
    }
  }
  if(abs(ma.F)<abs(mi.F)){
    COUT(2*n-1);
    rep(i,n){
      cout<<mi.S+1<<" "<<i+1<<endl;
    }
    for(int i=n;i>1;i--){
      cout<<i<<" "<<i-1<<endl;
    }
  }
  else{
    COUT(2*n-1);
    rep(i,n){
      cout<<ma.S+1<<" "<<i+1<<endl;
    }
    rep(i,n-1){
      cout<<i+1<<" "<<i+1+1<<endl;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

// 全部が異なる時　-  (j-i = k-j) を引く余事象
// するとfor分の二重ループで解くことが可能

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> a(n);
  rep(i,n) {
    if (s[i] == 'R') a[i] = 0;
    if (s[i] == 'G') a[i] = 1;
    if (s[i] == 'B') a[i] = 2;
  }
  vector<ll> cnt(3);
  rep(i,n) cnt[a[i]]++;
  ll ans = 1;
  rep(i,3) ans *= cnt[i];
  rep(j,n)rep(i,j) {
    int k = j + (j-i);
    if (k < n) {
      if (a[i] == a[j]) continue;
      if (a[i] == a[k]) continue;
      if (a[k] == a[j]) continue;
      ans--;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> d(K);
  vector<vector<int>> A(K);
  for (int i = 0; i < K; ++i){
    cin >> d[i];
    for (int j = 0; j < d[i]; j++){
      int a; cin >> a;
      A[i].push_back(a);
    }
  }
  vector<bool> sunuke(N,true);
  int count = 0;
  
  for (int i = 0; i < K; ++i) {
    for (auto a : A[i]){
      a--;sunuke[a] = false;
    }
  }
  for (int i = 0 ; i < N; i++) {
    if (sunuke[i]) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 3680
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	X := nextInt()

	A, B, C, D := X/1000, (X/100)%10, (X/10)%10, X%10

	for i := 0; i < 2; i++ {
		for j := 0; j < 2; j++ {
			for k := 0; k < 2; k++ {
				s := A
				res := strconv.Itoa(A)
				switch {
				case i % 2 == 0: s += B; res += "+" + strconv.Itoa(B)
				case i % 2 == 1: s -= B; res += "-" + strconv.Itoa(B)
				}
				switch {
				case j % 2 == 0: s += C; res += "+" + strconv.Itoa(C)
				case j % 2 == 1: s -= C; res += "-" + strconv.Itoa(C)
				}
				switch {
				case k % 2 == 0: s += D; res += "+" + strconv.Itoa(D)
				case k % 2 == 1: s -= D; res += "-" + strconv.Itoa(D)
				}

				if s == 7 {
					fmt.Println(res + "=7")
					return
				}
			}
		}
	}
}

Measured memory_bytes: 640
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int ans = 1;
    for (int i = 0;i < M;i ++) {
      ans *= 2;
    }
    ans *= ((N - M) * 100 +  M * 1900);
    System.out.println(ans);
  }
}

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

int main() {
  int month;
  while(cin >> month) {
    if(month == -1) break;
    if(month <= 10) {
      cout << 4280 - 1150 << endl;
      continue;
    }
    if(month <= 20) {
      cout << 4280 - 1150 - 125*(month-10) << endl;
      continue;
    }
    if(month <= 30) {
      cout << 4280 - 1150 - 1250 - 140*(month-20) << endl;
      continue;
    }
    cout << 4280 - 1150 - 1250 - 1400 - 160*(month-30) << endl;
    continue;
  }
}

Measured memory_bytes: 0
#include <vector>
#include <iostream>
using namespace std;
int n, a, b, ord[209]; unsigned comb[209][209][209], dp[209][209], ndp[209], mod = 1000000007; vector<int> g[209];
int calc(int pos, int pre) {
	int sub = 1; dp[pos][1] = 1;
	for (int i : g[pos]) {
		if (i == pre) continue;
		int w = calc(i, pos);
		fill(ndp + 1, ndp + sub + w + 1, 0);
		for (int j = 1; j <= sub; j++) {
			for (int k = 1; k <= w; k++) {
				for (int l = 0; l <= j - 1 && l <= k; l++) {
					ndp[j + k - l] = (ndp[j + k - l] + 1LL * dp[pos][j] * dp[i][k] % mod * comb[j - 1][k][l]) % mod;
				}
			}
		}
		sub += w;
		for (int j = 1; j <= sub; j++) dp[pos][j] = ndp[j];
	}
	return sub;
}
int main() {
	cin >> n;
	for (int i = 1; i < n; i++) {
		cin >> a >> b;
		g[a].push_back(b);
		ord[b]++;
	}
	comb[0][0][0] = 1;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; i + j <= n; j++) {
			for (int k = 0; k <= i && k <= j; k++) {
				if (i >= 1) comb[i][j][k] = comb[i - 1][j][k];
				if (j >= 1) comb[i][j][k] += comb[i][j - 1][k];
				if (i >= 1 && j >= 1 && k >= 1) comb[i][j][k] += comb[i - 1][j - 1][k - 1];
				while (comb[i][j][k] >= mod) comb[i][j][k] -= mod;
			}
		}
	}
	int ret = 0;
	for (int i = 0; i < n; i++) {
		if (ord[i] == 0) {
			calc(i, -1);
			for (int j = 1; j <= n; j++) ret = (ret + dp[i][j]) % mod;
		}
	}
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 20604
#include <iostream>
#include <bitset>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

int len = 0;

ll three[100010];
string s;

ll f(int loc) {
    if(loc == len - 1) {
        if(s[loc] == '1') {
            return 3;
        }else {
            return 1;
        }
    }
    if(s[loc] == '1') {
        return (2 * f(loc + 1) % MOD + three[len - loc - 1]) % MOD;
    } else {
        return f(loc + 1);
    }
}

int main(){
    cin >> s;

    len = s.length();

    ll tmp = 1;
    for(int i = 0; i <= len; ++i){
        three[i] = tmp;
        tmp = tmp * 3 % MOD;
    }

    ll ans = 0;

    cout << f(0) << endl;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

int gcd(int a, int b) {
    if(b == 0) return a;
    else return gcd(b, a%b);
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    cout << 360 / gcd(360, n) << endl;
}

Measured memory_bytes: 3644
#pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

const int L = 29;

int main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	for (auto& x : a) {
		cin >> x;
	}
	for (auto& x : b) {
		cin >> x;
	}
	ll ans = 0;
	for (int i = 0; i < L; i++) {
		int msk = (1 << i) - 1;
		vector<vector<int>> aa(2), bb(2);
		for (auto x : a) {
			aa[x >> i & 1].push_back(x & msk);
		}
		for (auto x : b) {
			bb[x >> i & 1].push_back(x & msk);
		}
		for (int j = 0; j < 2; j++) {
			sort(aa[j].begin(), aa[j].end());
			sort(bb[j].begin(), bb[j].end());
		}
		ll cur = 0;
		for (int j = 0; j < 2; j++) {
			for (int x : aa[j]) {
				// y >= 2^i - x
				cur += bb[j].size() - (lower_bound(bb[j].begin(), bb[j].end(), (1 << i) - x) - bb[j].begin());
			}
		}
		for (int j = 0; j < 2; j++) {
			for (int x : aa[j]) {
				// y < 2^i - x
				cur += lower_bound(bb[!j].begin(), bb[!j].end(), (1 << i) - x) - bb[!j].begin();
			}
		}
		if (cur & 1) {
			ans ^= (1 << i);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 7512
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int main() {
    string s;
    cin >> s;
    for(int i = 0; i < 3; i++) {
        if(s[i] == '1') {
            cout << '9';
        } else {
            cout << '1';
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <iterator>

using namespace std;

int main() {
	int N;
	long long s = 0;
	cin >> N;
	vector<int> A(N);
	vector<int> ap(10*10*10*10*10 + 1);
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
		s += A.at(i);
		ap.at(A.at(i))++;
	}

	int Q;
	cin >> Q;
	vector<int> b(Q), c(Q);
	for (int i = 0; i < Q; i++) {
		cin >> b.at(i) >> c.at(i);
	}

	for (int i = 0; i < Q; i++) {
		s += (long long)ap.at(b.at(i)) * ((long long)c.at(i) - (long long)b.at(i));
		ap.at(c.at(i)) += ap.at(b.at(i));
		ap.at(b.at(i)) = 0;
		cout << s << endl;
	}

}


Measured memory_bytes: 4776
//
//  main.cpp
//  AOJ1147
//
//  Created by aki33524 on 2014/07/15.
//  Copyright (c) 2014年 aki33524. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[])
{
    int n;
    while(cin>>n, n){
        vector<int> v(n);
        for(int i=0; i<n; i++)
            cin >> v[i];
        sort(v.begin(), v.end());
        int ans = 0;
        for(int i=1; i<n-1; i++)
            ans += v[i];
        cout << ans/(n-2) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF=1001001001;
 

 
int main() {
    int a,b;
    cin>>a>>b;
    int ans=a-2*b;
    if(ans<0) ans=0;
    cout<<ans<<endl;
    
}

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

using ll = long long;

int main() {
    int n;
    vector<int> l;
    cin >> n;
    int sum = 0;
    rep(i, n) {
        int tmp;
        cin >> tmp;
        sum += tmp;
        l.push_back(tmp);
    }
    int maxNum = *max_element(l.begin(), l.end());
    if(sum - maxNum > maxNum)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

		while(true){
			int n=sc.nextInt(), t=sc.nextInt(), l=sc.nextInt(), b=sc.nextInt();
			if(n == 0) break;

			int[] map = new int[n+1];
			double[][] dp = new double[n+1][t+1];

			for(double[] i : dp) Arrays.fill(i,-1);
			while(l-- > 0) map[sc.nextInt()] = 'l';
			while(b-- > 0) map[sc.nextInt()] = 'b';

			System.out.printf("%5f\n",solve(map,0,t,dp));
		}
	}

	public static double solve(int[] map,int n,int t,double[][] dp){
		if(n == map.length - 1 && t >= 0) return 1;
		if(t <= 0) return 0;
		if(dp[n][t] != -1) return dp[n][t];

		double sum = 0;
		for(int i=1;i<=6;i++){
			int next = n+i;
			if(next >= map.length){
				next = map.length - next % map.length - 2;
			}
			switch(map[next]){
			case 'l':
				sum += solve(map,next,t-2,dp);
				break;
			case 'b':
				sum += solve(map,0,t-1,dp);
				break;
			default:
				sum += solve(map,next,t-1,dp);
				break;
			}
		}
		return (dp[n][t]=sum/6);
	}
}

Measured memory_bytes: 12000
N, K = map(int, input().split())
A = list(map(int, input().split()))

A = sorted(A)
if A[N-1] < K:
    print("IMPOSSIBLE")
    exit()

min_A = A[0]
for i in range(1,N):
    if A[i]-A[i-1] != 0:
        min_A = min(min_A,A[i]-A[i-1])

for j in range(N):
    if A[j]%min_A != 0:
        print("POSSIBLE")
        exit()
if K % min_A == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")



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

int main(void) {
	
	char x[2][3];
	cin >> x[0][0] >> x[0][1] >> x[0][2] >> x[1][0] >> x[1][1] >> x[1][2];
	if (x[0][0] == x[1][2] && x[0][1] == x[1][1] && x[0][2] == x[1][0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
    int cnt[256];
int main()
{
    string s;
    cin>>s;
    for(char i: s)
        if(i>='a'&&i<='z')
            cnt[i]++;
    for(int i: cnt)
        if(i%2==1)
        {
            cout<<"No"<<endl;
            return 0;
        }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

typedef unsigned long long UL;
typedef long long LL;
typedef long double LD;
#define LP(i, a, b) for (int i = int(a); i < int(b); i++)
#define LPE(i, a, b) for (int i = int(a); i <= int(b); i++)
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<vector<PII> > WAL;
typedef vector<vector<int> > SAL;
#define Ep 1e-8
#define INF 1e9
#define LINF 1e18

int const MaxSize = 3e5 + 10;
int H, W;
int cnt[26], rem[4];

//row even col even , all letters % 4 == 0
//row even col odd, all letters even, plus total # of remainder 2s <= row/2
//row odd, col even, all letters even, plus total # of remainder 2s <= col/ 2
//row odd, col odd, has 1 r 2, no r3,  remain 2 <= r/2+ c/2
//row odd, col odd, has 1 r3, no r1,
bool good() {
	if (H % 2 && W % 2) {
		if (rem[1] + rem[3] > 1)
			return false;

		if (rem[3] == 1) {
			rem[2]++;
			rem[3]--;
			rem[1]++;
		}

		return rem[2] <= W / 2 + H / 2;

	} else if (H % 2) {
		return rem[1] + rem[3] == 0 && rem[2] <= W / 2;
	} else if (W % 2) {
		return rem[1] + rem[3] == 0 && rem[2] <= H / 2;
	} else {
		return rem[0] == 26;
	}
}

int main() {
	ios_base::sync_with_stdio(false);
//	freopen("/Users/george/A_1.in", "r", stdin);
	cin >> H >> W;

	LP(r, 0, H)
	{
		string s;
		cin >> s;

		LP(c, 0, W)
		{
			cnt[s[c] - 'a']++;
		}
	}

	LP(c, 0, 26)
		rem[cnt[c] % 4]++;

	if (good())
		cout << "Yes";
	else
		cout << "No";

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  forloop for(int i=0;i<n;i++)
#define pb push_back 
#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define MOD 998244353;
#define unmap unordered_map
#define pi 3.1415926536
#define testcases ll t;cin>>t;while(t--)
#define  mp make_pair
#define  vcp vector<pair<ll,ll>>
#define preci(x,y)  fixed<<setprecision(y)<<x
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define fast ios::sync_with_stdio(false);   cin.tie(0); cout.tie(0);
#define preinc priority_queue <ll, vector<ll>, greater<ll>>
#define predec priority_queue<ll> 
#define vll vector<ll>
#define f(a,b) for(ll i=a;i<=b;i++)
int fl=0;
ll lcs(string a,string s,int i,int j,vector<vector<ll>>&v)
{
    if(i==a.length()||j==s.length())
    {
       
        return 0;
    }
    if(v[i][j]!=0)
        return v[i][j];
    char ch=a[i];
    char ch1=s[j];
    int ar=0;
    if(ch==ch1)
    {
       ar= lcs(a,s,i+1,j+1,v)+1;
    }
    else
    {
      
      ar=max(lcs(a,s,i,j+1,v),lcs(a,s,i+1,j,v));
    }
    v[i][j]=ar;
    return ar;
}
int main() {
    #ifndef ONLINE_JUDGE
   freopen("inp.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
   #endif
   fast
   string s,a;
   cin>>s>>a;
   int n=s.length();
   int w=a.length();
   vector<vector<ll>>v(n+1,vector<ll>(w+1,0));
  
  // lcs(s,a,0,0,v);
   // for(int i=0;i<v.size();i++)
   // {
   //  for(int j=0;j<v[i].size();j++)
   //      cout<<v[i][j]<<" ";
   //  cout<<"\n";
   // }
   for(int i=1;i<=n;i++)
   {
    for(int j=1;j<=w;j++)
    {
        if(s[i-1]==a[j-1])
        {
            v[i][j]=v[i-1][j-1]+1;
        }
        else
        {
            v[i][j]=max(v[i][j-1],v[i-1][j]);
        }
    }
   }
   int i=n,j=w;
   string ans="";
   while(i!=0&&j!=0)
   {
    if(v[i-1][j]==v[i][j])
    {
        i--;
    }
    else if(v[i][j-1]==v[i][j])
        j--;
    else
    {
        ans=s[i-1]+ans;
        i--;
        j--;
    }
}
cout<<ans<<"\n";
    // your code goes here
    return 0;
}

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

using namespace std;

int main()
{
    int a,b;
    while(scanf ("%d %d",&a,&b)==2){

        if (a==0 && b==0)break;
        if (a<b)cout<<a<<' '<<b<<endl;
        else cout<<b<<' '<<a<<endl;
    }
    return 0;

}



Measured memory_bytes: 3148
#include<iostream>
using namespace std;
int main(){
int n,a,b,i,ta,tb;
while(cin>>n,n){
ta=tb=0;
for(i=0;i<n;i++){
cin>>a>>b;
if(a>b)ta+=(a+b);
else if(a<b)tb+=(a+b);
else{ta+=a;tb+=b;}
}
cout<<ta<<" "<<tb<<endl;
}
return 0;
}

Measured memory_bytes: 1156
#include<iostream>
#include<algorithm>
#define LL long long
LL mod = 1000000007;
LL fac[100010];
LL divi[100010];
int ap[100010];
LL l, r;
LL fermat(LL x, LL y) {
	if (y == 0)return 1;
	if (y == 1)return x;
		LL F = fermat(x, y / 2) % mod;
		F *= F;
		F %= mod;
	if(y%2==1)return (F*x)% mod;
	
	if (y % 2 == 0)return F%mod;
}
int main() {
	LL N;
	std::cin >> N;
	N++;
	fac[0] = fac[1] = 1;
	for (LL i = 2; i <= N; i++) {
		fac[i] = (fac[i - 1] * i) % mod;
	}
	divi[N] = fermat(fac[N], mod - 2);
	for (LL i = N - 1; i >= 0; i--) {
		divi[i] = (divi[i + 1] * (i + 1)) % mod;
	}
	for (int i = 1; i <= N; i++) {
		int tmp;
		std::cin >> tmp;
		if (ap[tmp]) {
			l = ap[tmp];
			r = i;
		}
		ap[tmp] = i;
	}
	for (LL i = 1; i <= N; i++) {
		LL ans = fac[N];
		ans *= (divi[i] * divi[N - i]) % mod;
		ans %= mod;
		LL minus = fac[l - 1 + N - r];
		if (l - 1 + N - r - i + 1 < 0)minus = 0;
		else {
			minus *= (divi[i - 1] * divi[l - 1 + N - r - i + 1]) % mod;
			minus %= mod;
		}
		if (ans < minus)ans += mod;
		std::cout << ans - minus << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
typedef long long int ll;
using namespace std;
int main() {
	
	string res ="" ;
	ll n ;
	cin >> n ;
	
	while (n != 0){
		n--;
	char c = (n % 26 ) + 'a' ; 
	
	string add(1 , c);
	
	res = add + res ;
	n /= 26 ;
	
	
	}
	
	cout << res << endl ;
	return 0;
}

Measured memory_bytes: 3604
/* Nurgazy Zhandos */

#include <bits/stdc++.h>
#include <functional>
#include <algorithm>
#include <stdexcept>
#include <streambuf>	
#include <exception>
#include <typeinfo>
#include <valarray>
#include <iostream>
#include <iterator>
#include <cstdlib>
#include <istream>
#include <iomanip>
#include <fstream>
#include <complex>
#include <utility>
#include <ostream>
#include <numeric>	
#include <sstream>
#include <utility>
#include <bitset>
#include <iosfwd>
#include <string>
#include <limits>
#include <vector>
#include <cstdio>
#include <locale>
#include <memory>	
#include <string>	
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <stack>
#include <list>	
#include <map>
#include <set>
#include <ios>
#include <new>
//#include <unordered_set>
//#include <unordered_map> 

#define F first
#define S second

#define pf push_front
#define pb push_back
#define mp make_pair
#define pp pop_back
#define in insert

#define resize(v) v.resize(unique(all(v)) - v.begin()); 
#define all(a) a.begin(), a.end()
#define sz(a) a.size()
#define STOP return 0

#define nl '\n'

//#define int long long

using namespace std;

typedef pair <int, pair <int, int > > pIii;
typedef pair < pair <int, int >, int> piiI;
typedef pair <long long, long long> pll;
typedef pair <int, long double> pid;
typedef pair <long double, int> pdi;
typedef pair <int, long long> pil;
typedef pair <long long, int> pli;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long double ld;
typedef long long ll;

const int MAX_N = 1e5 + 123;
const int inf = 1e9 + 123;
const ll INF = 1e18 + 123;
const int NN = 2e6 + 123;
const double eps = 1e-9;
const int mod = 1e9 + 7;

inline void fre() {
	#ifdef TEZZY
//	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
	#endif
}

inline void boost() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
}

set < char > a;

main () {
	fre();
	boost();

	int n;
	cin >> n;

	char s;

	for(int i = 1; i <= n; i++) {
	 	cin >> s;
	 	a.insert(s);
	}

	if(sz(a) == 4) cout << "Four";
	else cout << "Three";
}


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

int main(){
  int k, a, b;
  cin >> k >> a >> b;
	
  if (a % k == 0 || b % k == 0){
    cout << "OK" << endl;
    return 0;
  }
  
  int x;
  x = a - (a % k) + k;

  if (b >= x){
    cout << "OK" << endl;
  } else{
    cout << "NG" << endl;
  }
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main() {
  int N;
  cin >> N;
  string n = to_string(N);
  int fN = 0;
  for (int i = 0; i < n.size(); ++i) {
    fN += n[i] - '0';
  }
  if (N % fN == 0) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}


Measured memory_bytes: 3096
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
using namespace std;

int main(int argc, char** argv){
	int n;
	cin >> n;
	int v[n];
	for(int i = 0; i < n;i++){
		cin >>v[i];
	}
	sort(v,v+n);
	double r = v[0];
	for(int i = 1; i < n; i++){
		r = (r + v[i]) / 2.0;
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1e6+5;
vector<ll> V;
ll pre[maxn];
int main() {
	ll n,x,y,z=0;cin>>n;
    for(int i=1;i<=n;i++) cin>>pre[i];
    for(int i=3;i<=n;i++) z^=pre[i];x=pre[1];y=pre[2];
    z=x+y-z;if(z%2||z<0||z/2>x) return 0*puts("-1");z/=2;
    ll a=z,now=x+y-2*z;
    for(int i=60;i>=0;i--) {
    	if((now&(1ll<<i))&&(a&(1ll<<i))) {
    		return 0*puts("-1");
    	}
    	if(now&(1ll<<i)&&(a+(1ll<<i)<=x))  a+=(1ll<<i);
    }
    if(a==0) puts("-1");
    else cout<<x-a<<endl;
    return 0;
}

Measured memory_bytes: 3636