akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n;
	cin >> n;
	for (int i = 1; i <= 9; i++) {
		if (n % i) continue;
		int x = n / i;
		if (1 <= x && x <= 9) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int n;
double x[100],y[100];
 
double distance(double p){
  double sum=0;
  for(int i=0;i<n;i++){
    double w=abs(x[i]-y[i]);
    sum += pow(w,p);
  }
  return pow(sum,1.0/p);
}
 
int main(){
  cout<<fixed<<setprecision(12);
 
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>x[i];
  }
  for(int i=0;i<n;i++){
    cin>>y[i];
  }
   
  cout<< distance(1) <<endl;
  cout<< distance(2) <<endl;
  cout<< distance(3) <<endl;
 
  double mx=0;
  for(int i=0;i<n;i++){
    mx=max(mx, abs(x[i]-y[i]) );
  }
  cout<< mx <<endl;
   
  return 0;
}


Measured memory_bytes: 3460
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

int main(){
    int n; cin >> n;
    cout << (n-2) * 180 << endl;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int power(int x, int n) {
  int ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= MOD;
    (x *= x) %= MOD;
    n >>= 1;
  }
  return ret;
}
signed main(void){
    int x; cin>>x;
    int ma = -1;
    for(int i=1;i<1000;i++){
        rep(j,1000){
            if(j == 1) continue;
            if( power(i,j) <= x){
                chmax(ma, power(i,j));
                
            }
        }
    }
    cout<<ma<<endl;
}
//落ち着いて、サンプル以外のケースも試しましょう
//考察でつまずいたならスマホをみましょう。休憩もしましょう

Measured memory_bytes: 256
//is there any case of -1 or any special corner cases ?
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
const int maxx  = 3*1e6 , limit = 9*1e18 , MOD=1e9+7;
string binary(int n){bitset<60>b(n) ;string p =b.to_string();return p;}
int decimal(string n) { int dec_value = 0;  int base = 1;  for (int i = n.size() - 1; i >= 0; i--) { if (n[i] == '1') 
dec_value += base; base = base * 2; } return dec_value; } 

bool isPrime(int n){if (n <= 1) return false; if (n <= 3) return true;if (n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; }
int pow (int x, int n,int mod) {if (n == 0) return 1; int res = pow (x, n / 2,mod);res = (res * res) % mod;if (n % 2) res = (res * x ) % mod;return res;}

#define boost  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n';

int32_t main(){
    boost;
    vi prime;
    for(int i =1 ; i < maxx ; i++ ){
        if(isPrime(i)){
            prime.pb(i);
        }   
    }
    
    int n;
    cin>>n;
    
    int res =0 ;
    for(int i =0 ; i < prime.size() ; i++ ){
        int lg =1 ;    
        bool flag=false;
        int pr = prime[i];
        if(pr > n){
            break;
        }
        int co = 0;
        int itr = 1;
        int prev = 0;
        while(n%pr == 0){
            n/=pr;
           
            co++;
            
            if(co == itr){
                res++;
                int curr = itr;
                itr = itr + (itr - prev + 1);
                prev = curr;
                
               // cout<<itr<<endl;
            }
            
           
        }
              
        
    }
    if(n>1){
        res++;
    }
    
    cout<<res<<endl;
    
}

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

#define se second
#define fi first
#define mk(a,b) make_pair(a,b)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

    if(A == B && B == C)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) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int d = sc.nextInt();
        int ans = 0;
        for (int i = l; i <= r; i++) {
            if (i % d == 0) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35276
import math
words = lambda t : list(map(t, input().split()))
a,b,x = words(int)

k = x / (a*a)
if k == b:
    print(0)
elif k*2 == b:
    print(45)
elif k*2 < b:
    print(90 - math.degrees(math.atan(2*x/(a*b*b))))
else:
    p = ((a*b)- (x/a)) / (a/2)
    print(90 - math.degrees(math.atan(a/p)))


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

const ull b=1000000007;
const ull binv=13499267949257065399U;

string s;
set<ull> res;

ull bn[300010];

int main(void){
	int n,m;
	cin >> n >> m;
	
	bn[0]=1;
	rep(i,n) bn[i+1]=bn[i]*b;
	
	cin >> s;
	int L=0,R=0;
	ull cur=s[0];
	rep(loop,m){
		string q;
		cin >> q;
		if(q=="R++") R++,cur+=bn[R-L]*s[R];
		if(q=="R--") cur-=bn[R-L]*s[R],R--;
		if(q=="L++") cur-=s[L],cur*=binv,L++;
		if(q=="L--") L--,cur*=b,cur+=s[L];
		res.insert(cur);
	}
	cout << res.size() << endl;
	return 0;
}

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

int memo[210][210];

int gcd(int x, int y) {
    if (y == 0) return x;
    return gcd(y, x % y);
}

int main(void) {
    int K;
    cin >> K;

    for (int i = 1; i < 210; i++) {
        for (int j = 1; j < 210; j++) {
            memo[i][j] = gcd(i, j);
        }
    }
    long long sum = 0;
    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            for (int k = 1; k <= K; k++) {
                sum += memo[memo[i][j]][k];
            }
        }
    }
    printf("%lld\n", sum);
    return 0;
}


Measured memory_bytes: 3936
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define poly vector<ll>
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
inline ll read(){
	ll x=0;char ch=getchar();bool d=1;
	for(;!isdigit(ch);ch=getchar()) if(ch=='-') d=0;
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return d?x:-x;
}
inline void write(ll x){
	if(x<0) x=-x,putchar('-');
	if(x>=10) write(x/10);
	putchar('0'+x%10);
}
inline void writeln(ll x){write(x);puts("");}
inline void writep(ll x){write(x);putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=2e5+5;
int a[N],fa[N];
bool used[N];
poly v[N];
void dfs(int u){
	poly rv;
	for(auto k:v[u]){
		if(used[k]) continue;
		dfs(k);rv.pb(a[k]);
	}
	sort(rv.begin(),rv.end());
	for(auto x:rv){
		if(x==a[u]) a[u]++;
	}
}
int main(){
	int n=read();
	For(i,1,n){
		fa[i]=read();
		v[fa[i]].pb(i);
	}
	int rt=1;
	while(!used[rt]) used[rt]=1,rt=fa[rt];
	memset(used,0,sizeof(used));
	while(!used[rt]) used[rt]=1,rt=fa[rt];
	int L=n+1,R=0,cnt=0;
	For(i,1,n) if(used[i]){
		dfs(i);cnt++;
		R=max(R,a[i]);L=min(L,a[i]);
	}
	if(L==R&&cnt%2) puts("IMPOSSIBLE");
	else puts("POSSIBLE");
}

Measured memory_bytes: 15100
// Crt. 2019-12-08  16:20:58
// Stt. 2019-12-08  20:14:00
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
#include <set>
#include <map>
#define N 100005
using namespace std;
const long long pw = 1e9;

inline int Abs(int x) { return x < 0 ? -x : x; }

int n, x[N], y[N], cx, cy, vis[N];
long long ans;
map<int, int> idx, idy;
map<long long, int> id;
set<int> px[N], py[N];
queue<int> q;
vector<int> vx[N], vy[N];
bool okx[N], oky[N];

inline void calc(int a, int b, int l, int r, set<int>* p, int op, vector<int>* v) {
    if (!a) return ;
    set<int>::iterator it, en, tmp;
    it = p[a].lower_bound(l);
    en = p[a].upper_bound(r);
    ans += upper_bound(v[a].begin(), v[a].end(), r) - lower_bound(v[a].begin(), v[a].end(), l);
    while (it != en) {
        int now = id[!op ? (pw * b) + (*it) : (pw * (*it) + b)];
        //cout << now << " " << b << " " << (*it) << endl;
        vis[now] = 1;
        q.push(now);
        if (!op) py[idy[*it]].erase(b);
        else px[idx[*it]].erase(b);
        tmp = it++;
        p[a].erase(tmp);
    }
}

int main() {
#ifdef LOCAL_JUDGE
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    int a, b;
    cin >> n >> a >> b;

    for (int i = 1, u, v; i <= n; ++i) {
        scanf("%d%d", &u, &v);
        x[i] = u + v, y[i] = u - v;
        id[pw * x[i] + y[i]] = i;
        if (!idx[x[i]]) idx[x[i]] = ++cx;
        if (!idy[y[i]]) idy[y[i]] = ++cy;
        px[idx[x[i]]].insert(y[i]);
        py[idy[y[i]]].insert(x[i]);
        vx[idx[x[i]]].push_back(y[i]);
        vy[idy[y[i]]].push_back(x[i]);
    }
    
    for (int i = 1, now; i <= n; ++i) {
        now = idx[x[i]];
        if (!okx[now]) okx[now] = 1, sort(vx[now].begin(), vx[now].end());
        now = idy[y[i]];
        if (!oky[now]) oky[now] = 1, sort(vy[now].begin(), vy[now].end());
    }

    q.push(a), vis[a] = 1;
    int d = max(Abs(x[b] - x[a]), Abs(y[b] - y[a]));
    px[idx[x[a]]].erase(y[a]);
    py[idy[y[a]]].erase(x[a]);

    while (!q.empty()) {
        int u = q.front(); q.pop();
        //cout << " # " << u << " : \n";
        calc(idx[x[u] - d], x[u] - d, y[u] - d + 1, y[u] + d, px, 0, vx);
        calc(idx[x[u] + d], x[u] + d, y[u] - d, y[u] + d - 1, px, 0, vx);
        calc(idy[y[u] - d], y[u] - d, x[u] - d, x[u] + d - 1, py, 1, vy);
        calc(idy[y[u] + d], y[u] + d, x[u] - d + 1, x[u] + d, py, 1, vy);
        //cout << " ------ \n";
    }

    cout << (ans >> 1) << endl;

    return 0;
}


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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define INFTY 999999


int main(void){
    int N;
    scanf("%d",&N);
    int* L;
    NEW(L,N);

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

    int index;
    int max=0;
    for(int i=0;i<N;i++){
        if(L[i]>max){
            max=L[i];
            index=i;
        }
    }
    
    int sum=0;
    for(int i=0;i<N;i++){
        if(i!=index){
            sum+=L[i];
        }
    }

    if(sum>L[index]){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    
    return 0;
    
}


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

using namespace std;

int N, M;
int WA[105000];
bool AC[105000];

void solve() {
    cin >> N >> M;
    int NumOfWA = 0;
    int NumOfAC = 0;
    
    for(int i = 1; i <= N; i++) {
        WA[i] = 0;
        AC[i] = false;
    }
    while(M--) {
        int p;
        string S;
        cin >> p >> S;
        
        if(AC[p]) continue;
        if(S == "AC") {
            AC[p] = true;
            NumOfAC++;
            NumOfWA += WA[p];
        } else if(S == "WA") {
            WA[p]++;
        }
    }
    cout << NumOfAC << " " << NumOfWA << endl;
    return;
}

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


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
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; }

lli n, k;

int main(void){
    cin >> n >> k;
    vector<lli> x(n);
    rep(i, n) cin >> x[i];
    lli ans = 1e18;
    rep(i, n-k+1){
        lli u = min(abs(x[i]), abs(x[i+k-1]));
        lli v = abs(x[i]-x[i+k-1]);
        ans = min(ans, u+v);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4032
#pragma region noncode
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SORT(v) sort(all(v))
#define TROS(v) sort(all(v), std::greater<Type>());
#pragma endregion

int main() {
    // template
    string s;cin>>s;
    if(s[0]+s[1]+s[2]=='a'+'b'+'c') cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 3544
#include <iostream>
#include <math.h>
#include<iomanip>
using namespace std;

int main(){
  int A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;
  cin >> N;
  double xi[N];
  double yi[N];
  double sum=0;
  for(int i=0;i<N;i++){
    cin >> xi[i];
    cin >> yi[i];
  }
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      sum += sqrt((xi[i]-xi[j])*(xi[i]-xi[j])+(yi[i]-yi[j])*(yi[i]-yi[j]));
    }
  }
  cout <<setprecision(15)<<sum*2/double(N) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n) cin >> a.at(i);
    vector<int> b=a;
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    rep(i,n){
        if(a.at(i)<b.at(0)) cout << b.at(0) << endl;
        else{
            if(b.at(0)==b.at(1)) cout << b.at(0) << endl;
            else cout << b.at(1) << endl;
        }
    }

}

Measured memory_bytes: 3200
# coding: utf-8
# Here your code !
import math
prof = 0
d = int(input())
li =[int(input()) for i in range(d)]
max=float("-inf")
min=li[0]
for j in range(1,d):
    if li[j]-min>max:
        max=li[j]-min
    if li[j]<min:
        min=li[j]

print(max)

Measured memory_bytes: 15748
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#define For(i,a,b) for(int i=a;i<b;i++)
#define rFor(i,a,b) for(int i=a;i>b;i--)
#define sort(a,b) sort(a.begin(),b.end())
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
//(string-'0') 文字列を数字に変換
//vector<vector<int>> data(a,vector<b>(b)) a×b行列
//for(int i=0;i<a;i++)
//for(int j=0;j<b;j++)
//cin>>data.at(i).at(j)  a×b行列の入力
//floor(log10(a)+1) aの10進法での桁数
//ceil(log10(a)) aの10進法での桁数

int main() {
  ll a;
  ci(a);
  co(pow(a,3));
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
    int d;
		
	while(cin>>d){
		int S=0;
		
		for(int x=0;x+d<=600;x+=d){
			S+=d*(x*x);
		}
		cout<<S<<endl;
	}
	
	return 0;
}

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

int main() {
    int K, S;

    cin >> K >> S;

    int counter = 0;
    for (int x = 0; x <= K; x++) {
        for (int y = 0; y <= K; y++) {
            int z = S - x - y;
            if (0 <= z && z <= K) {
                counter++;
            }
        }
    }

    cout << counter << endl;
}


Measured memory_bytes: 256
// 解答不能.
// scott_wu氏.
// https://atcoder.jp/contests/abc155/submissions/10170714
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define all(x) x.begin(), x.end()

int N;
LL K, n0;
vector<LL> neg, pos;

LL csolve(vector<LL> v, LL M){
    LL res = 0;
    int cpos = (int) v.size() - 1;
    rep(i, v.size()){
        while(cpos > i && v[i] * v[cpos] > M) cpos--;
        res += max(0, cpos - i);
    }
    return res;
}

LL ncnt(LL M){
    // # of values <= M
    LL res = 0;
    if(M >= 0){
        res += n0 * (N - n0);
        res += (n0 * (n0 - 1)) / 2;
        res += neg.size() * pos.size();
        res += csolve(neg, M) + csolve(pos, M);
    }else{
        M = -M;
        int cpos = (int)pos.size() - 1;
        rep(i, neg.size()){
            while(cpos >= 0 && neg[i] * pos[cpos] >= M) cpos--;
            res += (int)pos.size() - 1 - cpos;
        }
    }
    return res;
}

int main(){
    scanf("%d %lld", &N, &K);
    rep(i, N){
        LL x;
        scanf("%lld", &x);
        if(x < 0)      neg.pb(-x);
        else if(x > 0) pos.pb(x);
        else           n0++;
    }
    sort(all(neg));
    sort(all(pos));
    LL lo = 0, hi = 4e18;
    LL Y = 2e18;
    while(lo < hi - 1){
        LL mid = (lo + hi) / 2;
        if(ncnt(mid - Y) >= K) hi = mid;
        else                   lo = mid;
    }
    printf("%lld\n", hi - Y);
    return 0;
}

Measured memory_bytes: 3308
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<62;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    string s;cin>>s;
    if(s[1]=='B')s[1]='R';
    else s[1]='B';
    cout<<s<<endl;
}


Measured memory_bytes: 3652
// {{{ by shik
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REP1(i, a, b) for (int i = (a); i <= int(b); i++)
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int, int> PII;
typedef vector<int> VI;

namespace { namespace shik {

template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%" SCNd64, &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }

template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%" PRId64, x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }

#ifdef SHIK
#include "dump.hpp"
#else
#define dump(...)
#endif

template<class T, class F = less<T>> void sort_uniq(vector<T> &v, F f = F()) { sort(begin(v), end(v), f); v.resize(unique(begin(v), end(v)) - begin(v)); }
template<class T> inline T bit(T x, int i) { return (x >> i) & 1; }
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

// }}}

const int N=2e5+10;
int n;
LL a[N],s[N];
void main() {
    map<LL,int> mp;
    R(n);
    REP1(i,1,n) R(a[i]);
    REP1(i,1,n) s[i]=s[i-1]+a[i];
    LL ans=0;
    REP1(i,0,n) {
        ans+=mp[s[i]]++;
    }
    W(ans);
}

// {{{ main
}}
int main() { shik::main(); return 0; }
// }}}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int n,a,b; cin >> n >> a >> b;
  COUT(min(a*n,b));
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
long long pow(int x,int y){
  long long z = 1;
  while(y){
    z *= x;y--;
  }
  return z;
}//昔の話　もっと高速なやつある
int main(){
  string s;cin >> s;
  if(s.size()==1){
    cout << int(s[0]-'0') << endl;
    return 0;
  }
  int n = s.size(),num[n],i,j,c,b[n] = {};b[0] = -1,b[n-1] = 1;long long ans = 0;
  //b[n]が手書き
  for(i=0;i<n;i++) num[i] = s[i]-'0';
  for(i=0;i<pow(2,n-1);i++){
    b[0]++;//最初のやつに1足して
    for(j=0;j<n-1;j++){
      if(b[j]==2){
  		b[j+1]++;b[j]=0;//2になったら次の数値に繰り上げる
      }
    }
    for(j=0;j<n;j++){
      c = j;
      while(b[c]==0) c++;
      ans += num[j]*pow(10,c-j);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

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

	int l = s.length();
	rep(i, l) {
		cout << "x";
	}
	cout << endl;
	return 0;
} 

Measured memory_bytes: 3568
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
     
    int a, b;
    cin >> a >> b;
    if( a == 2 || b == 2 ) {
        if( a == b ) cout << "Yes";
        else cout << "No";
    } else if( a == 4 || a == 6 || a == 9 || a == 11 ) {
        if( b == 4 || b == 6 || b == 9 || b == 11 ) cout << "Yes";
        else cout << "No";
    } else if( b == 4 || b == 6 || b == 9 || b == 11 ) {
        cout << "No";
    } else {
        cout << "Yes";
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//int findmin(int r,int c);
void findcha(void);
  int minmrx[101][101];
  int element[101];
  int n;
int main(){
  int i,j;
  int waste;
  scanf("%d",&n);

  /*for(i=1;i<=n;i++){
    minmrx[i][i]=0;
  }
*/
  //scanf("%d %d",&element[0],&element[1]);

  for(i=1;i<=n;i++){
    scanf("%d%d",&element[i-1],&element[i]);
  }
/*
  for(i=1;i<n;i++){
    minmrx[i][i+1]=element[i-1]*element[i]*element[i+1];
  }


  for(j=0;j<=n-3;j++){
    for(i=j+3;i<=n;i++){
      minmrx[i-2-j][i]=findmin(i-2-j,i);
    }
  }
*/
  findcha();
  /*for(i=1;i<=n;i++){
    printf("%d ",minmrx[1][i]);

  }
printf("\n" );
*/
  printf("%d\n",minmrx[1][n]);


  return 0;

}


/*int findmin(r,c){
  int min=1000000001,i,cnt=c-r;
  for(i=0;i<cnt;i++){
    //if(min>minmrx[r][r+1]+minmrx[r+i+1][c]+element[r-1]*element[r+1]*element[c]){
  min=fmin(min,minmrx[r][r+1]+minmrx[r+i][c]+(element[r-1]*element[r+1]*element[c]));
    //}
    //else {continue;
    //}
  }
  return min;
}
*/
void findcha(){
  int i,j,l,q,k;
  for (i=1;i<=n;i++){
    minmrx[i][i]=0;
  }
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      minmrx[i][j]=100000000;
      for (k=i;k<j;k++){
        q=minmrx[i][k]+minmrx[k+1][j]+element[i-1]*element[k]*element[j];
        minmrx[i][j]=fmin(q,minmrx[i][j]);

      }
    }
  }
}

Measured memory_bytes: 640
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#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, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {
	
	int n;
	scanf("%d", &n);
	string s, t;
	cin >> s >> t;
	rep(i, 2 * n){
	  if(i % 2 == 0)printf("%c", s[i / 2]);
	  else printf("%c", t[i / 2]);
	}
	printf("\n");
	Please AC;
}


Measured memory_bytes: 888
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> pii;

int main()
{
  int price,n[4]={};
  n[0]=-1;
  int i,j;

  while(1){
    cin>>price;
    if(price==0)break;
    if(n[0]>=0)cout<<endl;
    cin>>n[0]>>n[1]>>n[2]>>n[3];
    int n0=0,n1=0,n2=0,n3=0;
    int sum=n[0]*10+n[1]*50+n[2]*100+n[3]*500;
    sum-=price;
    while(sum>=500){
      n3++;
      sum-=500;
    }
    while(sum>=100){
      n2++;
      sum-=100;
    }
    while(sum>=50){
      n1++;
      sum-=50;
    }
    while(sum){
      n0++;
      sum-=10;
    }

    if(n[0]-n0>0)printf("10 %d\n",n[0]-n0);
    if(n[1]-n1>0)printf("50 %d\n",n[1]-n1);
    if(n[2]-n2>0)printf("100 %d\n",n[2]-n2);
    if(n[3]-n3>0)printf("500 %d\n",n[3]-n3);
  }
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif
bool B(int x,int i){return (x>>i)&1;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int N;
	cin >> N;
	V<int> v(N);
	rep(i,N-1){
		int x,y,a;
		cin >> x >> y >> a;
		v[x] ^= a;
		v[y] ^= a;
	}
	int s = 0;
	int ans = 0;
	rep(i,N){
		if(v[i] == 0) ans++;
		else{
			if(B(s,v[i])){
				s ^= 1<<v[i];
				ans++;
			}else{
				s ^= 1<<v[i];
			}
		}
	}
	V<int> dp(1<<16);
	rep(b,1<<16) if((s&b) == b){
		{
			int x = 0;
			rep(i,16) if(B(b,i)) x ^= i;
			if(x == 0) dp[b]++;
		}
		rep(i,16) if(!B(b,i) && B(s,i)){
			chmax(dp[b|(1<<i)],dp[b]);
		}
	}
	int mx = 0;
	rep(b,1<<16) chmax(mx,dp[b]);
	ans += mx-1;
	cout << N - ans << endl;
}


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

namespace AtCoder.Contest.C
{
	static class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			var cin = new Scanner();

			decimal a = cin.NextLong();
			string s = cin.Next();
			decimal b = (s[0] - '0') * 100 + (s[2] - '0') * 10 + s[3] - '0';
			Console.WriteLine((long)Math.Floor((a * b) / 100));

			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextInt() + add;
			}
			return Array;
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextLong() + add;
			}
			return Array;
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}

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

int main() {
  int N,M,C;
  cin >> N >> M >> C;
  vector<int> b(M);
  for (int i=0; i<M; i++) {
    cin >> b[i];
  }
  int a;
  int ans=0;
  int tot=0;
  for (int i=0; i<N; i++) {
    tot = 0;
    for (int j=0; j<M; j++) {
      cin >> a;
      tot += a * b[j];
    }
    if(tot + C > 0) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
  int N , K ;
  cin>>N>>K;
  vector<int> v;
  v={0,1,2,3,4,5,6,7,8,9};
  for(int i = 0 ; i < K ; i++){
    int value_to_remove ;
    cin>>value_to_remove ;
    v.erase(remove(v.begin(), v.end(), value_to_remove), v.end());
  }  //v内は使える数字に変化
  
  for(int i = N ; i<10*N ; i++){
    bool a = false ;
    string i_string ;
    i_string = to_string(i); //iをstringに変化
    for(int j = 0 ; j<i_string.size() ; j++){
      bool b = true ;
      for(int l = 0 ; l<v.size() ; l++){
        if(i_string.at(j)==v.at(l)+48){
          b = false ;
          break;
        } //使える数字でない場合bはtrueのまま
      }
      if(b){
        a = true;
          break;
      } //使えない数字を使っていた場合aはfalse
    }
    if(!a){
      cout<<i_string<<endl;
      break;
    }
    //使える数字のみの場合答え
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

vector<vector<pair<int,int> > > adj;
int mm[100005];
int vis[100005];
map<pair<int,int>,int>edge;

void dfs(int ver,int pr)
{
	vis[ver]=1;
	for(auto i:adj[ver])
	{
		if(!vis[i.first])
		{
			mm[i.first]+=i.second;
			mm[ver]-=i.second;
			dfs(i.first,ver);
			mm[ver]+=mm[i.first];
		}
		else if(vis[i.first]==1&&i.first!=pr)
		{
			mm[ver]+=i.second;
			mm[i.first]-=i.second;
		}
	}
	vis[ver]=2;
}

signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
	if(fopen("INPUT.txt","r"))
	{
	freopen ("INPUT.txt" , "r" , stdin);
	freopen ("OUTPUT.txt" , "w" , stdout);
	}
#endif  

	int n,m;
	cin>>n>>m;
	int x,y;
	adj.resize(n+1);
	for(int i=0;i<m;i++)
	{
		cin>>x>>y;
		edge[{min(x,y),max(x,y)}]++;
	}
	for(auto i:edge)
	{
		adj[i.first.first].push_back({i.first.second,i.second});
		adj[i.first.second].push_back({i.first.first,i.second});		
	}
	for(int i=1;i<=n;i++)
	{
		if(!vis[i])
			dfs(i,0);
	}

	for(int i=1;i<=n;i++)
	{
		if(mm[i]&1)
		{
			cout<<"NO";
			return 0;
		}
	}

	cout<<"YES\n";

}


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

int main(){
    int K, A, B;
    cin >> K >> A >> B;

    bool flag=false;
    for(int i=0;(i-1)*K<B;i++){
        if(i*K <= B){
            if(i*K >= A){
                flag = true;
            }
            else{
            }
        }
        else{
        }
    }

    if(flag){
        cout << "OK" << endl;
    }
    else{
        cout << "NG" << endl;
    }
}

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

class Dice {
public:
	Dice() {
		face[0] = &T;
		face[1] = &S;
		face[2] = &E;
		face[3] = &W;
		face[4] = &N;
		face[5] = &B;
	}
	void setFace() {
		for (int i = 0; i < 6; i++)
			cin >> *face[i];
	}
	int getFace(char c) {
		switch (c) {
		case 'T': return T;
		case 'S': return S;
		case 'E': return E;
		case 'W': return W;
		case 'N': return N;
		case 'B': return B;
		}
	}
	void setCommand() {
		cin >> command;
	}
	void move(char c) {
		switch (c) {
		case 'E': move(E, T, W, B); break;
		case 'N': move(N, T, S, B); break;
		case 'S': move(S, T, N, B); break;
		case 'W': move(W, T, E, B); break;
		case 'R': move(S, W, N, E); break;
		}
	}
	void move() {
		for (int i = 0; i < command.size(); i++)
			move(command[i]);
	}
	void move(int& a, int& b, int& c, int& d) {
		int temp = a;
		a = b;
		b = c;
		c = d;
		d = temp;
	}
	bool equal(Dice dice2) {
		if (W == dice2.getFace('T'))
			move('E');
		else if (E == dice2.getFace('T'))
			move('W');
		for (int i = 3; i > 0 && T != dice2.getFace('T'); i--)
			move('N');
		if (T != dice2.getFace('T')) 
			return false;
		for (int i = 3; i > 0 && S != dice2.getFace('S'); i--)
			move('R');
		if (S != dice2.getFace('S'))
			return false;
		for (int i = 2; i < 6; i++)
			if (*face[i] != *dice2.face[i])
				return false;
		return true;
	}
private:
	int* face[6];
	int T, S, E, W, N, B;
	string command;
};

int main() {
    Dice dice1, dice2;
    dice1.setFace();
    dice2.setFace();
    if(dice1.equal(dice2))
        cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 3168
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define INPUT(x) scanf("%d",&x)
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define RREP1(x,n) for(int x = n-1; x >= 0; x--)
#define RREP2(x,s,e) for(int x = s; x >= e; x--)
#define BR printf("\n")
#define INF 2000000000

typedef long long ll;

bool L[9][9] = {};
int pathcount = 0;
int M,N;

void dfs(int i, vector<bool> flag, int counter){
    if(counter == N){
        pathcount++;
        return;
    }
    flag[i] = 1;
    REP2(t,1,N){
        //パス通っていて，かつ行ったことがない．
        if (L[i][t] && !flag[t]) {
            dfs(t,flag,counter+1);
        }
    }
    
}

int main(){
    INPUT(N);INPUT(M);
    vector<bool> flag;
    REP1(i,N+1){
        flag.push_back(false);
    }
    REP1(i,M){
        INT(a);INT(b);
        L[a][b] = 1;
        L[b][a] = 1;
    }
    dfs(1,flag,1);
    cout << pathcount << endl;
    return 0;
}

Measured memory_bytes: 256
X, Y = [int(i) for i in input().split(' ')]
mod = 10**9+7

x =0
y =0
x += X
y += Y
counter =[0,0]
while x > 0 or y > 0:
    if x >= y:
        x -= 2
        y -= 1
        counter[0] +=1 
    else:
        x -= 1
        y -= 2
        counter[1] +=1 
        

def nCr(n,r,mod):
    if (r<0 or r>n):
        return 0

    return (n_legular[n]*r_inverse[r]*r_inverse[n-r]) % mod

N =counter[0]+counter[1]
n_legular = [1,1]
r_inverse = [1,1] 
inverse_calc = [0,1]

for i in range(2,N+1):
    n_legular.append(n_legular[-1]*i%mod)
    inverse_calc.append(-inverse_calc[mod % i] * (mod//i)  % mod)
    r_inverse.append(r_inverse[-1]*inverse_calc[-1] % mod)
    
if (X+Y) % 3 != 0:
    print(0)
elif (X > 2*Y) or (Y > 2*X):
    print(0)
    
else:
    print(nCr(counter[0]+counter[1],counter[0],mod))

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

int main() {
    int N, K;
    int R, S, P;
    string T;
  
    cin >> N >> K;
    cin >> R >> S >> P;
    cin >> T;

    string win_hand;

    int r, p, s;
    r = p = s = 0;

    for (int i = 0; i < T.size(); i++) {
    
    // 判定：左辺条件：K回目まで好きな手を出せる、右辺条件：K回前の手で勝った手か確認
    if (i < K || T[i] != win_hand[i - K]) {
    
    // 判定：じゃんけんで勝った手数と手を保存する（K回前の手を確認するため）    
        switch (T[i]) {
            case 'r':
            r++;
            win_hand.push_back('r');
            break;
            case 'p':
            p++;
            win_hand.push_back('p');
            break;
            case 's':
            s++;
            win_hand.push_back('s');
            break;
        }
          
    }
    
    // 判定：勝ち以外は0になる
    else {
      win_hand.push_back(0);
    }
    
  }
  
  int ans = (P * r) + (S * p) + (R * s);
  cout << ans << endl;

  return 0;
}


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

int main(){
	int n;
	cin >> n;
	vector<long long> l(n + 1);
	l[0] = 2;
	l[1] = 1;
	for(int i = 2; i <= n; i++) l[i] = l[i - 1] + l[i - 2];
	cout << l[n] << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define abs(p) ((p)>=(0)?(p):(-(p)))
int cmp(const void *a, const void *b);
int main(void){
    ll N, X[200005], Xcp[200005];
    scanf("%lld", &N);
    rep(i, 0, N){
        scanf("%lld", X+i);
        Xcp[i] = X[i];
    }
    qsort(X, N, sizeof(ll), cmp);
    rep(i, 0, N){
        if(Xcp[i]<X[N/2])printf("%lld\n", X[N/2]);
        else printf("%lld\n", X[N/2 -1]);
    }
    return 0;
}
int cmp(const void *a, const void *b){
    ll A=*(ll *)a, B=*(ll *)b;
    if(A==B) return 0;
    else if(A>B) return 1;
    else return -1;
}


Measured memory_bytes: 5240
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
  int i,j,k;
  int n,m,l;
  int **mat1,**mat2;
  long long **mat3;
  scanf("%d%d%d",&n,&m,&l);
  mat1=(int**)malloc(sizeof(int*)*n);
  for(i=0;i<n;i++)
    {
      mat1[i]=(int*)malloc(sizeof(int)*m);
      for(j=0;j<m;j++) scanf("%d",&mat1[i][j]);
    }
  mat2=(int**)malloc(sizeof(int*)*m);
  for(j=0;j<m;j++)
    {
      mat2[j]=(int*)malloc(sizeof(int)*l);
      for(k=0;k<l;k++) scanf("%d",&mat2[j][k]);
    }
  mat3=(long long**)malloc(sizeof(long long*)*n);
  for(i=0;i<n;i++)
    {
      mat3[i]=malloc(sizeof(long long)*l);
      for(k=0;k<l;k++)
        {
          mat3[i][k]=0;
          for(j=0;j<m;j++) mat3[i][k]+=mat1[i][j]*mat2[j][k];
        }
    }
  for(i=0;i<n;i++)
    {
      for(k=0;k<l;k++)
        {
          if(k>0) printf(" ");
          printf("%ld",mat3[i][k]);
        }
      printf("\n");
    }
  return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> pii;

int main() {
	int w, d;
	while(cin >> w >> d, w&&d) {
		vector<int> hw(w), hd(d);
		rep(i,w) cin >> hw[i];
		rep(i,d) cin >> hd[i];
		if(hw.size() < hd.size()) swap(hw, hd);
		int cnt[21]={};
		rep(i,hw.size()) cnt[hw[i]]++;
		rep(i,hd.size()) cnt[hd[i]]--;
		int sum = 0;
		rep(i, 21) {
			if(cnt[i] < 0) {
				sum += i * (-cnt[i]);
			}
		}
		rep(i, hw.size()) sum += hw[i];
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
import java.util.*;
 
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int n_7 = n/7;
        boolean flag = false;
        for(int i=0; i<=n/7; i++){
            int ans = n - (i*7);
            if(ans%4 == 0){
                flag = true;
            }
        }
        if(flag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


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

int n, t, mx, d[200005];
int main()
{
	int i;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf ("%d", &t);
		d[t] = d[t - 1] + 1;
		mx =max(mx, d[t]);
	}
	cout << n - mx;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // 値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする
#define zero_pad(num) setfill('0') << std::right << setw(num)  // 直後の要素をパディング
#define space_pad(num) setfill(' ') << std::right << setw(num)  // 直後の要素をパディング

/*
 * vec.begin(), vec.end() は、endの1つ手前のイテレータまでを指定している。
 * つまり、[begin, end) の範囲
*/

// func declaration
template <class T> void calcVec(vector<T>&, int, char);

int main() {
    // input
    int N;
    cin >> N;
    vector<int> vec(N), diff_vec(N-1);
    REP(i, N) cin >> vec.at(i);

    // calc
    int maxv = INT_MIN;
    int minv = vec.at(0);
    REPN(i, N - 1) {  // 1 ~ N-1
        maxv = max(maxv, vec.at(i) - minv);
        minv = min(minv, vec.at(i));
    }
    cout << maxv << endl;
    return 0;
}


// function
template <class T> void calcVec(vector<T> &vec, int num, char ch) {
    // vec全体への演算
    switch (ch) {
        case '+':
            REP(i, vec.size()) vec.at(i) += num; break;
        case '-':
            REP(i, vec.size()) vec.at(i) -= num; break;
        case '*':
            REP(i, vec.size()) vec.at(i) *= num; break;
        case '/':
            REP(i, vec.size()) vec.at(i) /= num; break;
        case '%':
            REP(i, vec.size()) vec.at(i) %= num; break;
        default:
            cout << "Incorrect Operator" << endl;
    }
}



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

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



int main(){
	int N,M;
	cin>>N>>M;
	long long x = lcm((long long)N,(long long)M);
	string S,T;
	cin>>S>>T;

	for(long long i=0;i<x;i+=x/N){
		if(i%(x/M)!=0)continue;
		char a = S[i/(x/N)];
		char b = T[i/(x/M)];
		if(a!=b){
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<x<<endl;
			
	
	
	return 0;
}

Measured memory_bytes: 512
D,N = map(int, input().split())
if D == 0:
  if N<=99:
    print(N)
  else:
    print(101)
if D == 1:
  if N<=99:
    print(100*N)
  else:
    print(10100)
if D==2:
  if N<= 99:
    print(10000*N)
  else:
    print(1010000)


Measured memory_bytes: 2940