akhauriyash/Code-Regression huggingface dataset:
// C - HonestOrUnkind2
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	int A[N], X[N][N], Y[N][N];
	//証言が"確実"か、"不確定"か。
	rp(i, 0, N){
		cin>>A[i];
		rp(j, 0, A[i]){ cin>>X[i][j]>>Y[i][j]; X[i][j]--; }
	}

	int ans = 0;
	rp(bits, 1, 1<<N){//bits: 仮定のbit列: 0|1=不確実|確実
		bool ok = true;//true|false=仮定に矛盾なし|あり
		rp(i, 0, N){
			int assume_i = (bits>>i)&1;//i番目の仮定: 0|1
			if(!assume_i) continue;//不確実: 確認のしようがない
			rp(j, 0, A[i]){//以降、i番目の証言は全て確実と仮定して処理
				int x = X[i][j], y = Y[i][j];//y: i番目のx番目に対する証言: 0|1=不確実|確実
				int assume_x = (bits>>x)&1;//x番目の仮定: 0|1
				if(assume_x ^ y) ok = false;//矛盾
			}
		}
		if(ok) ans = max(ans, (int)bitset<16>(bits).count());//矛盾なし: 仮定から最大数を得る
	}
	cout<< ans <<endl;
}

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

int main() {

    int N;
    string S;
    cin >> N;
    cin >> S;

    int cnt = 0;
    int max = 0;

    for(int i = 0; i < N; i ++){
        if (S[i] == 'I') cnt ++;
        if (S[i] == 'D') cnt --;
        if (max < cnt) max = cnt;
    }

    cout << max << endl;

}

Measured memory_bytes: 256
def compute(a, b, c):
    val = c
    for i in range(len(a)):
        val += a[i]*b[i]
    return val

n,m,c=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
count=0
for i in range(n):
    a=[int(x) for x in input().split()]
    if compute(a,b,c)>0:
        count = count + 1
print(count)


Measured memory_bytes: 3060
#include <stdio.h>
#define num_element 150
int main(void)
{
	int i,n,m;
	char array[num_element];
	char a[2];
	char b[2];
	char input[2];
	while(1)
	{
		for(i=0;i<num_element;i++)
		{
			array[i] = i;
		}
		scanf("%d",&n);
		if(n == 0)return 0;
		for(i=0;i<n;i++)
		{
			scanf("%s %s",a,b);
			array[a[0]] = b[0];
		}
		scanf("%d",&m);
		for(i=0;i<m;i++)
		{
			scanf("%s",input);
			printf("%c",array[input[0]]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1004
# 2019-11-12 13:20:54(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n, m, *x = (int(i) for i in sys.stdin.read().split())
    x.sort()
    if n >= m:
        print(0)
        sys.exit()

    dist = []
    # 座標順に並び替えて、m-1個の区間の距離を列挙していく
    for i in range(m-1):
        dist.append(x[i+1] - x[i])

    # n個は初期で設置するので、それらを起点として((m-1)-(n-1))回ポイント間を移動した場合、ポイントが重複しないように移動した時の距離の合計の最小値
    # ポイントの間の距離の組み合わせを列挙して、それらのうち長い方からn-1個の組み合わせの区間は移動するべきではないと考える。
    # イメージ的には隣り合う距離が長い２点の組み合わせから順にコマを置いていけばいい
    dist.sort()
    ans = sum(dist[:(m-1)-(n-1)])

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 13964
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *

def arc079():
    K = int(input())
    k = K//50
    a = [i+k*50 for i in range(50)]
    for i in range(K%50):
        a[i] += 51
    for i in range(50):
        a[i] -= K-k
    print(50)
    print(*a)

arc079()

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define MP make_pair
#define llu unsigned long long
#define U unsigned int
#define ff first
#define ss second
#define SIZE 100005
#define pie 3.14159265358979323
#define minuss 1e-6
#define pair pair<ll,ll>
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL)
#define BIG 1000000000
#define INF 1000000000000005
#define N 10000
map<string,ll> mps;
map<ll,string> mpss;
set<ll>s1;
set<string>s2;
map<string,ll>::iterator str;
set<ll>::iterator itr;
/*
std::cout << std::fixed;
std::cout << std::setprecision(1);
std::cout << VALUE NAME<<endl;
*/
ll tra[100006],tra1[100006];


int main()
{
    fast_cin;
    ll t;

    map<ll,ll>mp;
    map<ll,ll>::iterator it;
    string s,ss,add;
    ll co=0;
    cin>>s>>ss;

    for(int i=0;i<3;i++)
    {
        if(s[i]==ss[i])
            co++;
    }
    cout<<co<<endl;

}


Measured memory_bytes: 3628
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N, M = list(map(int,_in[0].split(' ')))  # type:list(int)
    k_arr = []
    s_arr = []
    for i in range(M):
        _ = list(map(int,_in[i+1].split(' ')))  # type:list(int)
        k_arr.append(_[0])
        s_arr.append(_[1:])
    p_arr = list(map(int,_in[M+1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = 0
    for bit in range(1<<N):
        # bit = 0: off, 1: on
        for i in range(M):
            sum_ = 0
            for s in s_arr[i]:
                if bit&(1<<(s-1)): # on
                    sum_ += 1
            if sum_%2 != p_arr[i]:
                break
        else:
            cnt += 1
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


Measured memory_bytes: 39792
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7, N = 2e5 + 7;

int dp[N], nxt[N][26], tran[N];

signed main()
{
	IO_OP;
	
	string s;
	cin >> s;
	for(int j = 0; j < 26; j++) nxt[s.size()][j] = s.size();
	for(int i = s.size() - 1; i >= 0; i--) {
		for(int j = 0; j < 26; j++) nxt[i][j] = nxt[i + 1][j];
		nxt[i][s[i]-'a'] = i;
	}
	for(int i = s.size() - 1; i >= 0; i--) {
		dp[i] = INF;
		for(int j = 0; j < 26; j++) {
			int cur = dp[nxt[i + 1][j]] + 1;
			if(dp[i] > cur) {
				dp[i] = cur;
				tran[i] = j;
			}
		}
	}
	int mn = INF, st;
	for(int j = 0; j < 26; j++) {
		int cur = dp[nxt[0][j]] + 1;
		if(cur < mn) {
			mn = cur;
			st = j;
		}
	}
	string t;
	int pos = -1;
	for(int i = 0; i < mn; i++) {
		t.PB('a' + st);
		pos = nxt[pos + 1][st];
		st = tran[pos];
	}
	cout << t << endl;
}





Measured memory_bytes: 22420
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define Reza ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define         ll          long long
#define         yes         cout<<"YES"<<endl
#define         no          cout<<"NO"<<endl
#define         ff          first
#define         sc          secound
#define         MAX         10000



int main()
{
    Reza;
    string s,s2,s3,s4,s5;
    int  q,n,a,b,c,d,x,y,o,cnt=0,cnt2=1,sum=0,mm=0,mx=0;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='7') mx=1;
        else continue;
    }
    if(mx==1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;

}






Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n, minH = inf; cin >> n;
	vector<vi> in(n);
	rep(i, n){
		in[i] = vi(3);
		rep(j, 3) cin >> in[i][j];
		minH = min(minH, in[i][2]);
	}
	
	for(int h = minH; h <= minH + 200; h++){
		rep(x, 101) rep(y, 101){
			bool ok = 1;
			rep(i, n){
				int tmpH = h - abs(in[i][0] - x) - abs(in[i][1] - y);
				tmpH = max(tmpH, 0);
				if(tmpH != in[i][2]){
					ok = 0;
					break;
				}
			}
			if(ok){
				cout << x << " " << y << " " << h << endl;
				return 0;
			}
		}
	}
	assert(0);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<map>
#define F first
#define S second
using namespace std;

char c[33][33];
int w,h;

int solve(int x, int y){
  typedef pair < int, int > P;
  queue < P > que;
  int count = 1;

  que.push( P(x, y) );
  c[y][x] = '#';

  while(!que.empty()){
    P q = que.front(); que.pop();
    
    int dx[] = {0, 0, 1, -1};
    int dy[] = {1, -1, 0, 0};
    
    for(int i=0;i<4;i++){
      int xx = dx[i] + q.F;
      int yy = dy[i] + q.S;

      if(xx < 0 || yy < 0 || xx == w || yy == h) continue;
      if(c[yy][xx] == '#') continue;

      c[yy][xx] = '#';
      que.push( P(xx, yy) );
      count++;
    }

  }

  return count;
}

int main(){

  int sx, sy;
  while(true){
    cin >> w >> h;
    if(!w && !h) break;

    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin >> c[i][j];
	if(c[i][j] == '@') sx = j, sy = i;
      }
    }

    cout << solve(sx, sy) << endl;
  }

}

Measured memory_bytes: 1216
#include <iostream>
#include <string>

using namespace std;

bool isans(string s) {
	int sz = s.size();
	sz /= 2;
	string a = s.substr(0, sz);
	string b = s.substr(sz);
	if (a == b) {
		return true;
	}
	else {
		return false;
	}
}

int main() {
	string s;
	cin >> s;
	int sz = s.size();
	sz -= 2;
	while (true) {
		if (isans(s.substr(0, sz))) {
			break;
		}
		else {
			sz -= 2;
		}
	}
	cout << sz << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
string s;
int k;
ll dp[200][4][2];
ll f(int i,int cnt,bool b)
{
    if (i==(int)s.length())
        return(cnt==k);
    if (dp[i][cnt][b]!=-1)
        return dp[i][cnt][b];
    int lmt;
    if (!b)
    {
        lmt=s[i]-'0';
    }
    else
    {
        lmt=9;
    }
    ll res=0;
    for (int j=0;j<=lmt;j++){
        bool t=b;
        int c=cnt;
        if (!b&&j<lmt)
            t=1;
        if (j!=0)
            c++;
        if (c<=k)
            res+=f(i+1,c,t);
    }
    return dp[i][cnt][b]=res;
}
int main()
{
    FASTINOUT;
    cin>>s;
    cin>>k;
    memset(dp,-1,sizeof dp);
    cout<<f(0,0,0);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*
	__________   _____     _________   __            __    __________    ________     _________
	----------  | ----\    ---------   \ \   		/ /    |  _______|	| _____  \    ---------
		||      ||    ||  	  ||		\ \		   / /	   | |			| |		\ \	     ||
		||      ||____//      ||		 \ \      / /	   | |_____ 	| |		 | |	 ||
		||      |__ __/       ||		  \ \    / /	   | _____|		| |		 | |	 ||
		||      || \\         ||		   \ \  / /	   	   | |			| |		 | |	 ||
		||      ||  \\     ___||____        \ \/ /         | |_______ 	| |_____/ /   ___||____
		||		|| 	 \\    _________         \__/		   |_________|	|________/	  _________
*/
/********************************************************************/
/*
Codeforces : @a.trivedi
Codechef   : @adityat25
HackerRank : @adityatrivedi

/********************************************************************/
#define M1 1000000007
#define M3 1000000009
#define M2 998244353
#define ll long long
#define pll pair<ll,ll>
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define REPR(i,a,b) for(ll i=b-1;i>=a;i--)
#define forr(i,n) for(ll i=0;i<n;i++)
#define F first
#define S second
#define pb push_back
#define DB pop_back
#define mp make_pair
#define MT make_tuple
#define V(a) vector<a>
#define vi vector<ll>
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) ll t; cin>>t; while(t--)
/********************************************************************/
const double pi = 3.1415926535;
/********************************************************************/
//FAST IO//
void FAST() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
/********************************************************************/

int main() {
	FAST();
	const int mxn = 1e5 + 5;
	ll frogs[mxn];
	ll n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> frogs[i];
	}

	ll dp[n + 5] = {};
	dp[n - 1] = 0;
	dp[n - 2] = dp[n - 1] + abs(frogs[n - 2] - frogs[n - 1]);
	for (int i = n - 3; i >= 0; i--) {
		ll val1 = abs(frogs[i] - frogs[i + 1]) + dp[i + 1];
		ll val2 = abs(frogs[i] - frogs[i + 2]) + dp[i + 2];
		dp[i] = min(val2, val1);
	}
	cout << dp[0];


	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;



int main() {
	ll N, M,ans=0;

	cin >> N >> M;
	if (2 * N > M) {
		cout << M / 2;
	}
	else{
		cout << N + (M - 2 * N) / 4;
	}
	cout <<  endl;
	
	return 0;
}

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

using namespace std;
using nagai = long long;
#define sz(x) int((x).size())

#define chmax(x,y) if(x<y)x=y;

const int H=190;
const int LG=19;
int n,m;
short dp1[LG][H][H][H],dp2[LG][H][H][H];
int matr[H][H];
int pref[H][H];
bool good(int x1,int y1,int x2,int y2){
	int s=pref[x2][y2]-pref[x1][y2]-pref[x2][y1]+pref[x1][y1];
	return (s==0||s==(x2-x1)*(y2-y1));
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>m;
	for(int i=0;i<n;++i){
		string s;
		cin>>s;
		for(int j=0;j<m;++j){
			matr[i][j]=s[j]=='#';
			pref[i+1][j+1]=pref[i+1][j]+pref[i][j+1]-pref[i][j]+matr[i][j];
		}
	}
	for(int ans=0;ans<LG;++ans){
		for(int num=0;num<2;++num){
			for(int x=0;x<n;++x)
				for(int y=0;y<m;++y)
					for(int len=max(n,m);len>=1;--len){
						chmax(dp1[ans][x][y][len],dp1[ans][x][y][len+1]);
						chmax(dp2[ans][x][y][len],dp2[ans][x][y][len+1]);
						if(ans==0){
							int L=y,R=m+1;
							while(R-L>1){
								int M=(L+R)/2;
								if(good(x,y,x+len,M))
									L=M;
								else
									R=M;
							}
							dp1[0][x][y][len]=L;
							L=x,R=n+1;
							while(R-L>1){
								 int M=(L+R)/2;
								 if(good(x,y,M,y+len))
									 L=M;
								 else
									 R=M;
							}
							dp2[0][x][y][len]=L;
							continue;
						}
						if(x+len<=n){
							int memos=dp1[ans-1][x][y][len];
							int ansich;
							if(memos>=m)ansich=memos;
							else ansich=dp1[ans-1][x][memos][len];
							chmax(ansich,dp1[ans][x][y][len]);
							chmax(dp1[ans][x][y][len],ansich);
							chmax(dp2[ans][x][y][ansich-y],x+len);
						}
						if(y+len<=m){
							int memos=dp2[ans-1][x][y][len];
							int ansich;
							if(memos>=n)ansich=memos;
							else ansich=dp2[ans-1][memos][y][len];
							chmax(ansich,dp2[ans][x][y][len]);
							chmax(dp2[ans][x][y][len],ansich);
							chmax(dp1[ans][x][y][ansich-x],y+len);
						}
					}
		}
	}
//	cerr<<dp2[1][0][0][4]<<'\n';
//	cerr<<dp2[1][2][0][4]<<'\n';
//	cerr<<dp1[1][0][0][2]<<'\n';
//	cerr<<dp1[1][2][0][2]<<'\n';
//	cerr<<dp2[1][0][1][2]<<'\n';
//	cerr<<dp1[1][0][1][3]<<'\n';
	for(int i=0;i<LG;++i){
		if(dp1[i][0][0][n]==m){
			 cout<<i<<'\n';
			 return 0;
		}
	}
	return 0;
}



Measured memory_bytes: 509312
#include <bits/stdc++.h>
const int N=100005,mu=1e9+7;
int n,m,a[N],b[N],s[N],cnt;
struct point{
	int x,y;
}c[N];
void reduce(int &x){ x+=x>>31&mu; }
bool cmp(point x,point y){
	return x.y<y.y;
}
bool cmp2(point x,point y){
	return x.x==y.x?x.y>y.y:x.x<y.x;
}
int lowbit(int x){
	return x&(-x);
}
int getsum(int x){
	if (x<=0) return 0;
	int ret=0;
	while (x){
		reduce(ret+=s[x]-mu);
		x-=lowbit(x);
	}
	return ret;
}
void upd(int x,int y){
	while (x<=cnt+1){
		reduce(s[x]+=y-mu);
		x+=lowbit(x);
	}
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for (int i=1;i<=m;i++) scanf("%d",&b[i]);
	int p=1;
	for (int i=1;i<=n;i++){
		for (;p<=m && b[p]<a[i];p++);
		if (b[p]==a[i] || p==1) continue;
		if (p>m) break;
		c[++cnt]={a[i]-b[p-1],b[p]-a[i]};
	}
	int last=0;
	c[0].y=1;
	std::sort(c+1,c+cnt+1,cmp);
	for (int i=1;i<=cnt;i++){
		if (c[i].y==last) c[i].y=c[i-1].y;
		else last=c[i].y,c[i].y=c[i-1].y+1;
	}
	upd(1,1);
	std::sort(c+1,c+cnt+1,cmp2);
	for (int i=1;i<=cnt;i++){
		if (c[i].x==c[i-1].x && c[i].y==c[i-1].y) continue;
		int ss=getsum(c[i].y-1);
		upd(c[i].y,ss);
	}
	printf("%d\n",getsum(cnt+1));
}

Measured memory_bytes: 5476
/*
Character Drawing Adapted from FAKEUPDATE.NET
		   _    _____         _
		   \`,""   ,'7"r-..__/ \
		  ,'\ `, ,',','    _/   \
		 /   \, 7 / /     (   \ |
		J     \/ j  L______\  / |
		L   __JF"""/""\"\_,    /
		L,-"| O|  f O |  L_  _/
		F   \_ /  \__/   `-  j|
			.-'    `"""    ,' |          _..====.._
			\__/         r"_  A        ,' _..---.._`,
			 `-.______,,-L// / \  ___,' ,'_..:::.. `,`,
					  j   / / / 7"    `-<""=:'  '':. \ \
					 /   <,' /  F  . i , \   `,    :T W I
					 |    \,'  /    >X<  |     \   :| | L
					 |     `._/    ' ! ` |      I  :| |  G
					  \           \     /       |  :H T  |
					 __>-.__   __,-\   |        |  S P   |
					/     /|   | \  \  \_       | 'A R   |
				   /   __/ |   |  L  L   \      K./ /    L
				  /   |    |   4  I  I    |    E./ /   ,'
				 J    \    I    L F  I    |    // / _,'
		_________|     |   F    |J   F    |   //_/-'
		\   __   |    /   J     |/  J     |  /="
		\\  \_\  \__,' \  F     |   F     |
		\\\_____________\/      F__/      F
		 \\| 计算机编程 |_____/  (______/
		  \/从入门到入土/
*/
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
#include <functional>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	string sResult(""), sOpr;
	int i;
	getline(cin, sOpr);
	for (i = 0; i < sOpr.length(); ++i){
		if (sOpr[i] == '0' || sOpr[i] == '1')
			sResult += sOpr[i];
		else if (sOpr[i] == 'B')
			if (sResult.length() != 0)
				sResult = sResult.substr(0, sResult.length() - 1);
	}
	cout << sResult << endl;
endapp:
	//system("pause > nul");
	return 0;
}

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

using namespace std;

int main(){
  int N,M,X,Y,mx,mn;
  cin>>N>>M>>X>>Y;
  vector<int> x(N+1);
  vector<int> y(M+1);
  x.at(0)=X;
  y.at(0)=Y;
  for(int i=1;i<=N;i++) cin>>x.at(i);
  for(int i=1;i<=M;i++) cin>>y.at(i);
  mx=*max_element(x.begin(),x.end());
  mn=*min_element(y.begin(),y.end());
  if(mx<mn) cout<<"No War"<<endl;
  else cout<<"War"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	public static void main(String[]$){
		int v=gInt();
		int m=(""+v).chars().map(i->i-'0').sum();
		System.out.println(v%m==0?"Yes":"No");
	}
	static Scanner s=new Scanner(System.in);
	static int gInt(){return Integer.parseInt(s.next());}
}

Measured memory_bytes: 29012
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int A, B, K;
	cin >> A >> B >> K;
	int cnt = 0;
	for (int i = 100; i > 0; i--) {
		if (A % i == 0 && B % i == 0) {
			cnt++;
		}
		if (cnt == K) {
			cout << i << endl;
			return 0;
		}
	}
}

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

int main ()
{

	int a, b;
	cin >> a >> b;
	if( a < b ){
		cout << "a < b" << endl;
}
else if ( a > b ){
    	cout << "a > b" << endl;
}
else if ( a == b ){
	    cout << "a == b" << endl;
}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define itn int
#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<pair<string,int> > res;
  vector<int> memo (101);
  rep(i,n){
    string tmp;
    int tmp1;
    cin >> tmp >> tmp1;
    res.push_back(make_pair(tmp,tmp1));
    memo[tmp1]=i+1;
  }
  int kaisuu=1;
  while(kaisuu!=0){
    kaisuu=0;
    rep(i,n-1){
      if(strcmp(res[i].first.c_str(),res[i+1].first.c_str())==0){
        if(res[i].second>res[i+1].second){
          continue;
        }
        else{
          auto tmp=res[i];
          res[i]=res[i+1];
          res[i+1]=tmp;
          kaisuu=1;
        }
      }
      else if(strcmp(res[i].first.c_str(),res[i+1].first.c_str())<0){
        continue;
      }
      else{
        auto tmp=res[i];
        res[i]=res[i+1];
        res[i+1]=tmp;
        kaisuu=1;
      }
    }
  }
  rep(i,n){
    cout << memo[res[i].second] << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <math.h>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define RREP(i,n) for(int i=(n)-1; i>=0; --i)
#define SREP(i,s,n) for(int i=(s), i##_len=(n); i<i##_len; ++i)


using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

bool comp(pair<ll, ll> a, pair<ll, ll> b) {
    return (a.first*a.first + a.second*a.second) > (b.first*b.first + b.second*b.second);
}

struct UnionFind {
    vector<int> par;
    vector<int> rank;
    
    UnionFind(int n = 1) {
        init(n);
    }
    
    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
        }
    }
    
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

#define MOD (1000000007)

ll d2(pair<ll, ll> p) {
    return p.first*p.first+p.second*p.second;
}

int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N;
    cin >> N;
    vector<int> A(N+1), B(N+1), C(N);
    REP(i, N) cin >> A[i+1];
    REP(i, N) cin >> B[i+1];
    REP(i, N-1) cin >> C[i+1];
    ll ans = B[A[1]];
    SREP(i, 2, N+1) {
        ans += B[A[i]];
        if (A[i-1] + 1 == A[i] && A[i-1] <= N-1) ans += C[A[i-1]];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 888
# ＢＦＳ, グラフ, 全探索, 親の情報を自身に加算
 # ※ 要削除

from collections import deque

n, q = map(int,input().split())

pic = [[] for _ in range(n+1)] # ダミーのノード '0' を含む
for _ in range(n-1): # 絵の取り込み
    x, y = map(int, input().split())
    pic[x].append(y)
    pic[y].append(x)
    
cnts = [0] * (n+1) # カウンター初期化
for _ in range(q): # 初期情報取り込み
    x, y = map(int, input().split())
    cnts[x] += y

visited = [0] * (n+1) # 訪問の記録、初期化
visited[0], visited[1] = 1, 1 # 開始時情報記録

queue = deque([])
queue.append(1)

#print(n, q) # ※
#print(pic) # ※
#print(cnts)
#print(visited) # ※

while queue:
    tmp = queue.popleft() # 探索候補を popleft して...
    for i in pic[tmp]: # 次の探索候補を探索
        if visited[i] != 0: # 未訪問かどうかを確認...
            continue
        else: # 未訪問の場合...
            visited[i] = 1 # 現在地の訪問を記録
            cnts[i] += cnts[tmp] # 親の 'cnt' を自身の 'cnt' に加える
            queue.append(i) # 現在地を探索候補に積む

print(*cnts[1:])


Measured memory_bytes: 56164
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	int n = s.size();
	int ans = 0;

	for (int i = 0; i < n / 2; i++) {
		if (s[i] != s[n - 1 - i]) {
			// printf("%c %c\n", s[i], s[n-i]);
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int maxn=1e5+100;
typedef long long LL;
LL dp1[maxn],dp2[maxn];
int n;
LL a[maxn];
LL gcd(LL a,LL b){
    return b>0?gcd(b,a%b):a;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
    a[0]=a[1],a[n+1]=a[n];
    for(int i=1;i<=n;i++){
        dp1[i]=gcd(a[i],dp1[i-1]);
    }
    for(int i=n;i>=1;i--){
        dp2[i]=gcd(dp2[i+1],a[i]);
    }
    LL ans=0;
    for(int i=1;i<=n;i++){
        if(i==1){
            ans=max(ans,dp2[i+1]);
        }else if(i==n){
            ans=max(ans,dp1[i-1]);
        }else{
            LL tmp=gcd(dp1[i-1],dp2[i+1]);
            ans=max(ans,tmp);
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int r;
    cin >> r;
    double PI = 3.14159265358979323846264338327950288419716939937510;

    double ans = (double)r * 2 * PI;

    printf("%.10f", ans);
    return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

const string YES = "YES";
const string NO = "NO";

void solve(long long N, long long A, long long B, long long C, long long D){
    REP(i, N) {
        int add = i;
        int sub = N-1-i;

        LL add_min = add * C;
        LL add_max = add * D;
        LL sub_min = sub * C;
        LL sub_max = sub * D;

        if(A + add_min - sub_max <= B && B <= A + add_max - sub_min) {
            cout << YES << endl;
            return;
        }
    }

    cout << NO << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    solve(N, A, B, C, D);
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] tmpArray = br.readLine().split(" ");

		int h = Integer.parseInt(tmpArray[0]);
		int w = Integer.parseInt(tmpArray[1]);
		int n = Integer.parseInt(tmpArray[2]);

		char[][] matrix = new char[h][w];
		Point[] cheese = new Point[n + 1];
		int cheeseID = 0;
		
		for(int i = 0; i < h; i++){
			String tmp = br.readLine();
			for(int j = 0 ; j < w; j++){
				matrix[i][j] = tmp.charAt(j);
				if(Character.isDigit(matrix[i][j])){
					cheese[matrix[i][j] - '0'] = new Point(j, i);
				}
				
				else if(matrix[i][j] == 'S'){
					cheese[0] = new Point(j, i);
				}
			}
						
		}
		
		int dist = 0;
		for(int i = 1; i <= n; i++){
			int tmpdist = bfs(matrix, cheese[i - 1].x, cheese[i - 1].y, cheese[i].x, cheese[i].y);
			dist += tmpdist;
//			System.out.println((i-1)+"to"+i+ " "+tmpdist);
		}
		
		System.out.println(dist);

	}

	static int bfs(char[][] matrix, int startX, int startY, int goalX, int goalY){
		ArrayDeque<Point> queue = new ArrayDeque<Point>();

		int[][] dist = new int[matrix.length][matrix[0].length];
		for(int i = 0; i < dist.length ; i++){
			Arrays.fill(dist[i], Integer.MAX_VALUE);
		}

		queue.add(new Point(startX, startY));
		dist[startY][startX] = 0;

//		int currentDist = 1;
		int x;
		int y;
		while(!queue.isEmpty()){
			Point p = queue.poll();
			
			x = p.x;
			y = p.y;
			
//			if(x == goalX && y == goalY){
//				break;
//			}
			
			//???
			if(y > 0 && matrix[y - 1][x] != 'X' && dist[y - 1][x] > dist[y][x] + 1){
				dist[y - 1][x] = dist[y][x] + 1;
				queue.push(new Point(x, y - 1));
			}
			//???
			if(y < matrix.length - 1 && matrix[y + 1][x] != 'X' && dist[y + 1][x] > dist[y][x] + 1){
				dist[y + 1][x] = dist[y][x] + 1;
				queue.push(new Point(x, y + 1));
			}
			//???
			if(x > 0 && matrix[y][x - 1] != 'X' && dist[y][x - 1] > dist[y][x] + 1){
				dist[y][x - 1] = dist[y][x] + 1;
				queue.push(new Point(x - 1, y));
			}
			//???
			if(x < matrix[0].length - 1 && matrix[y][x + 1] != 'X' && dist[y][x + 1] > dist[y][x] + 1){
				dist[y][x + 1] = dist[y][x] + 1;
				queue.push(new Point(x + 1, y));
			}
			
			//System.out.println("queue size"+queue.size());
//			currentDist++;
		}

		//debug
//		for(int i =0 ; i < dist.length ; i++){
//			for(int j = 0; j < dist[0].length ; j++){
//				System.out.printf("%11d", dist[i][j]);
//			}
//			System.out.println();
//		}
		return dist[goalY][goalX];
	}

}

class Point {
	short x;
	short y;

	public Point(int x, int y){
		this.x = (short)x;
		this.y = (short)y;
	}
}

Measured memory_bytes: 206500
N = int(input())
A = input().split(" ")
A = [int(i) for i in A]
list = [min(A)]
A = sorted(A)
iii = 0
while True:
    iii += 1
    if A[N-1] % A[N-2] != 0:
        A[N-1] = A[N-1] % A[N-2]
    elif N >= 3 and A[N-1] % A[N-3] != 0:
        A[N-1] = A[N-1] % A[N-3]
    elif N >= 4 and A[N-1] % A[N-4] != 0:
        A[N-1] = A[N-1] % A[N-4]
    elif N >= 5 and A[N-1] % A[N-5] != 0:
        A[N-1] = A[N-1] % A[N-5]

    A = sorted(A)
    list.append(min(A))
    if iii > 64:
        break       
#print(list)
for i in range(N-1):
    if A[i+1]-A[i] > 0:
        list.append(A[i+1]-A[i])
#print(list)
print(min(list))

Measured memory_bytes: 14252
N, M = map(int, input().split())

A = []
b = []

for _ in range(N):
   A.append([int(i) for i in input().split()])

for _ in range(M):
   b.append(int(input()))

for i in range(N):
   print(sum([A[i][j] * b[j] for j in range(M)]))


Measured memory_bytes: 6012
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
class Main{
	static long[] kosu;
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		long A=sc.nextLong();
		long B=sc.nextLong();
		long[] bits=new long[48];
		bits[0]=1L;
		for(int i=1; i<48; i++) {
			bits[i]=bits[i-1]*2;
		}
		kosu=new long[48];
		for(int i=0; i<48; i++) {
			kosu[i]=0;
		}

		for(int i=0; i<48; i++) {
			kosu_p(i,B);
			if(A>0) {
				kosu_d(i,A-1);
			}
		}
		for(int i=0; i<48; i++) {
			kosu[i]%=2;
		}
		long ans=0;
		for(int i=0; i<48; i++) {
			ans+=kosu[i]*bits[i];
		}
		System.out.println(ans);
	}
	public static void kosu_p(int bits,long range) {
		long nijyo=1L;
		for(int i=0; i<=bits; i++) {
			nijyo*=2;
		}
		long tmp=0;
		if(bits==0) {
			tmp=(range+1)/2L;
			kosu[bits]+=tmp;
		}
		else {
			tmp=((range+1)/nijyo)*(nijyo/2);
			long amr=(range+1)%nijyo;
			if(amr>nijyo/2) {
				tmp+=amr-nijyo/2;
			}
			kosu[bits]+=tmp;
		}
	}
	public static void kosu_d(int bits,long range) {
		long nijyo=1L;
		for(int i=0; i<=bits; i++) {
			nijyo*=2;
		}
		long tmp=0;
		if(bits==0) {
			tmp=(range+1)/2L;
			kosu[bits]-=tmp;
		}
		else {
			tmp=((range+1)/nijyo)*(nijyo/2);
			long amr=(range+1)%nijyo;
			if(amr>nijyo/2) {
				tmp+=amr-nijyo/2;
			}
			kosu[bits]-=tmp;
		}
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}

Measured memory_bytes: 23124
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int x = readint;
    writeln(x < 1200 ? "ABC" : "ARC");
}


Measured memory_bytes: 256
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
#define two(X) (1<<(X))
#define twoL(X) (((int64)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)
const double pi=acos(-1.0);
const double eps=1e-11;
template<class T> inline void ckmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void ckmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
#define SIZE(A) ((int)A.size())
#define LENGTH(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
#define ALL(A) A.begin(),A.end()

int main()
{
#ifdef _MSC_VER
	freopen("input.txt","r",stdin);
#endif
	std::ios::sync_with_stdio(false);
	int n;
	int64 s,t,c,d;
	while (cin>>n>>s>>t>>c>>d)
	{
		bool ok=false;
		REP(z,n)
		{
			int64 es=c*z-d*(n-1-z);
			int64 et=d*z-c*(n-1-z);
			if (s+es<=t && s+et>=t) { ok=true; break; }
		}
		if (ok)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}



Measured memory_bytes: 256
# c
k = gets.to_i

sum = 0


(1..k).to_a.repeated_combination(3).to_a.each do |(a,b,c)|
  s = a.gcd(b).gcd(c)
  if a == b && b == c # 全部同じ (5,5,5) # 1通り
    sum += s
  elsif a == b || b == c || c == a # (4,4,6) # 3通り
    sum += s * 3
  else # (2 3 4) # 6通り
    sum += s * 6
  end
end
p sum








# 9 10813692



Measured memory_bytes: 83580
#include <iostream>
#include <string.h>
#include <vector>
#include <map>
using namespace std;
#define ll long long

int main () {
  ll n, k;
  cin >> n >> k;
  ll a[n], A[n];
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    A[i] = 0;   
  }
  for (ll i = 0; i < n; i++) {
    A[i] = a[i];  
  }
  ll num[41], two[41];
  for (ll i = 0; i <= 40; i++) {
    num[i] = 0;  
    two[i] = 1;
  }
  for (ll i = 0; i < n; i++) {
    ll j = 0;
    while (a[i] != 0) {
      if (a[i] % 2 == 1) {
        num[j]++;  
      }  
      a[i] >>= 1;
      j++;
    }  
  }
  for (ll i = 1; i <= 40; i++) {
    two[i] = 2 * two[i - 1];
  }
  ll K = 0;
  for (ll i = 40; i >= 0; i--) {
    if (n / 2 >= num[i] && (K + two[i]) <= k) {
      K = K + two[i];    
    }    
    else {
      K = K;  
    }
  }
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    ans += (K ^ A[i]);   
  }
  cout << ans << endl;

    
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define IOS                 ios::sync_with_stdio(false); cin.tie(nullptr)
#define deb(x)              cout << #x << " = " << x << endl
#define deb2(x, y)          cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define f0(i, a, n)         for(i = a; i < n; i++)
#define f1(i, a, n)         for(i = a; i <= n; i++)
#define tc(t)               int t; cin >> t; while(t--)
#define ini(x, y)           memset(x, y, sizeof(x))
#define all(x)              x.begin(),x.end()
#define sz(x)               x.size()
#define ll                  long long int
#define vi                  vector<int>
#define si                  set<int>
#define pb                  emplace_back
#define ppb                 pop_back
#define mp                  make_pair
#define M                   1000000007
#define endl                '\n'
#define bits(x)             __builtin_popcountll(x)
#define zrbits(x)           __builtin_ctzll(x)

using namespace std;

vi g[200001];
int vis[200001];
ll cnt[200001];
ll c;

void dfs(int x) {
        vis[x] = 1;
        // ll c = 1;
        for(ll p : g[x]) {
                if(vis[p] == 0) {
                        c++;
                        dfs(p);
                }
        }
}

void solve() {
        ll n, m, x, y, i;
        cin >> n >> m;
        while(m--) {
                cin >> x >> y;
                g[x].pb(y);
                g[y].pb(x);
        }

        ll ans = 0;
        f1(i, 1, n) {
                if(vis[i] == 0) {
                        c = 1;
                        dfs(i);
                        // cnt[i] = c;
                }
                ans = max(ans, c);
        }
        cout << ans << endl;
}

int main () {
        IOS;
        // tc(t)
        solve();
        return 0;
}

Measured memory_bytes: 21548
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(int argc, char *argv[])
{
    int n, m;
    int k[30];
    int a[30][30];
    int i, j;
    int count[30];
    int ans;

    for (i = 0; i < 30; i++) {
        count[i] = 0;
    }

    scanf("%d %d", &n, &m);

    for (i = 0; i < n; i++) {
        scanf("%d", &k[i]);
        for (j = 0; j < k[i]; j++) {
            scanf("%d", &a[i][j]);
            count[a[i][j] - 1]++;
        }
    }

    ans = 0;
    for (i = 0; i < 30; i++) {
        if (count[i] == n) {ans++;}
    }

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

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <utility>
#include <vector>

using namespace std;

int main() {
    int n, m, s, t;
    cin >> n >> m >> s >> t;

    vector<vector<pair<int, long long>>> ga(n, vector<pair<int, long long>>(0));
    vector<vector<pair<int, long long>>> gb(n, vector<pair<int, long long>>(0));
    for (int i = 0; i < m; i++) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        ga[u - 1].push_back(make_pair(v - 1, a));
        ga[v - 1].push_back(make_pair(u - 1, a));
        gb[u - 1].push_back(make_pair(v - 1, b));
        gb[v - 1].push_back(make_pair(u - 1, b));
    }

    long long inf = 1LL << 61;

    vector<long long> ds(n, inf);
    ds[s - 1] = 0;
    priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> ques;
    ques.push(make_pair(0, s - 1));
    while (!ques.empty()) {
        int q = ques.top().second;
        ques.pop();

        for (int i = 0; i < static_cast<int>(ga[q].size()); i++) {
            if (ds[ga[q][i].first] > ds[q] + ga[q][i].second) {
                ds[ga[q][i].first] = ds[q] + ga[q][i].second;
                ques.push(make_pair(ds[ga[q][i].first], ga[q][i].first));
            }
        }
    }

    vector<long long> dt(n, inf);
    dt[t - 1] = 0;
    priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> quet;
    quet.push(make_pair(0, t - 1));
    while (!quet.empty()) {
        int q = quet.top().second;
        quet.pop();

        for (int i = 0; i < static_cast<int>(gb[q].size()); i++) {
            if (dt[gb[q][i].first] > dt[q] + gb[q][i].second) {
                dt[gb[q][i].first] = dt[q] + gb[q][i].second;
                quet.push(make_pair(dt[gb[q][i].first], gb[q][i].first));
            }
        }
    }

    vector<long long> res(n, ds[n - 1] + dt[n - 1]);
    for (int i = n - 2; i >= 0; i--) {
        res[i] = min(res[i + 1], ds[i] + dt[i]);
    }

    for (int i = 0; i < n; i++) {
        cout << 1000000000000000LL - res[i] << endl;
    }
}


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

int main() {
    char c;
    cin >> c;
    
    if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
        cout <<"vowel" <<endl;
    }
    else {
        cout <<"consonant" <<endl;
    }
}
        

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int arr[5000],n;
int dp[3000][2][2];
int recur(int pos,int x,int y,int t,int last)
{
    if(pos==n)
    {
        return abs(x-y);
    }
    int &ret=dp[pos][t][last];
    if(~ret)
        return dp[pos][t][last];
    ret=0;
    if(pos+1<n)
        ret=recur(pos+1,x,y,t,last);
    if(t)
    {
        t^=1;
      //  ret=max(ret,recur(pos+1,x,y,t,0));
        ret=max(ret,recur(pos+1,x,arr[pos],t,1));
    }
    else
    {
        t^=1;
       // ret=max(ret,recur(pos+1,x,y,t,0));
        ret=max(ret,recur(pos+1,arr[pos],y,t,1));
    }
    return ret;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    memset(dp,-1,sizeof(dp));
    int x,y,pos=0,t=0;
    cin>>n>>x>>y;
    for(int i=0; i<n; i++)
        cin>>arr[i];

    cout<<recur(0,x,y,0,0)<<endl;

    return 0;
}


Measured memory_bytes: 3792
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: usize, b: usize,
    }
    let ans = (a..(b + 1)).filter(|n| {
        n.to_string() == n.to_string().chars().rev().collect::<String>()
    }).count();
    println!("{}", ans);
}


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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int a, b;
	cin >> a >> b;
	if(a < 10 and b < 10) cout << a * b;
	else cout << -1;

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(){
  int i,j,key,loop,N;
  int *A;

  scanf("%d",&N);
  A=malloc(sizeof(int)*N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

  for(i=1;i<N;i++){
    for(loop=0;loop<N;loop++){
      if(loop!=N-1)printf("%d ",A[loop]);
      else printf("%d\n",A[loop]);
    }
    key=A[i];
    j=i-1;
    while(j>=0&&A[j]>key){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=key;
  }
  for(loop=0;loop<N;loop++){
      if(loop!=N-1)printf("%d ",A[loop]);
      else printf("%d\n",A[loop]);
  }
  return 0;
}

Measured memory_bytes: 600