akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <unordered_map>
#include <math.h>
using namespace std;
#define _USE_MATH_DEFINES

int a[4][3][10];
int main() {
	int b, r, f, v;
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> b >> f >> r >> v;
		a[b - 1][f - 1][r - 1] += v;
	}
	for (int b = 0; b < 4; b++) {
		for (int f = 0; f < 3; f++) {
			for (int r = 0; r < 10; r++) {
				cout << " "; 
				cout << a[b][f][r];
			}
			cout << endl;
		}
		if(b<3)
		cout << "####################" << endl;
	}
}

Measured memory_bytes: 1164
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

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

using namespace std;

typedef pair<int, int> P;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * (b / gcd(a,b)); }

class CAntiDivision {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;

        int all = b - (a - 1);
        int cnum = b / c - (a - 1) / c;
        int dnum = b / d - (a - 1) / d;
        int cdnum = b / lcm(c, d) - (a - 1) / lcm(c, d);
        cout << all - (cnum + dnum - cdnum) << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    CAntiDivision solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(int, n);
	vector<int> v = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	OUT(v[n - 1]);
}


Measured memory_bytes: 256
# For taking integer inputs.
import math


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


def coutDiffL(a1, a2):
    a1 = set(a1)
    a2 = set(a2)
    a3 = a1.intersection(a2)
    return len(a3)


n = inp()

s = input()
res = 0
for i in range(1, n-1):
    m1 = coutDiffL(s[:i], s[i:])
    if m1 > res:
        res = m1


print(res)


Measured memory_bytes: 3064
#include <stdio.h>

char ans[100000005];
int main()
{
	int n;
	int m, i;
	char c[10005];
	char a, data;

	while(1){
		for(i=0; i<10005; i++){
			c[i] = 0;
		}
		scanf("%d", &n);
		if(n==0)
			break;

		for(i=0; i<n; i++){
			scanf(" %c", &a);
			scanf("	%c", &c[a]);
		}
		scanf("%ld", &m);
		for(i=0; i<m; i++){
			scanf(" %c", &data);
			if(c[data] != 0)
				ans[i] = c[data];
			else
				ans[i] = data;
		}
		ans[i] = '\0';
		printf("%s\n", ans);
	}
	return 0;
}

Measured memory_bytes: 696
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		string s = Console.ReadLine();
    int answer = 0;

    for(int i = 0; i < n; i++)
    {
      if(s[i] == 'R') answer++;
      else answer--;
    }

    if(answer > 0) Console.WriteLine("Yes");
    else Console.WriteLine("No");
	}
}

Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int i = 1;
        while(s.hasNextInt()) {
            int n = s.nextInt();
            if(n == 0) break;
            System.out.printf("Case %d: %d\n", i, n);
            i++;
        }
    }
}

Measured memory_bytes: 55772
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    string s;
    ll k;
    cin >> s >> k;

    int cnt = 0;
    for(int i = 0; i < s.size(); i++) {
        if (s[i] == '1') cnt ++;
        else break;
    }

    if (cnt >= k) {
        cout << "1" << endl;
    } else {
        cout << s[cnt] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

int main() {
  kyun;
  int a,b,t;
  cin >> a >> b >> t;
  cout << (t/a)*b;
  hinata;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n, m; cin>>n>>m;
	if(n>=m){
		cout<<0<<endl;
		return 0;
	}
	int x[100001];
	for(int i=0; i<m; i++) cin>>x[i];
	sort(x, x+m);
	int d[100001];
	for(int i=0; i<m-1; i++) d[i]=x[i+1]-x[i];
	sort(d, d+m-1, greater<int>());
	int ans=x[m-1]-x[0];
	for(int i=0; i<n-1; i++) ans-=d[i];
	cout<<ans<<endl;
	return 0;
}

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

int main() {
	int n;cin >>n;
	string s;cin >> s;
	int cnt = 0;
	for(int i=0;i<n;++i){
		auto sub = s.substr(i,1);
		if(sub=="R"){
			++cnt;
		} else {
			--cnt;
		}
	}
	if(cnt>0){
		cout << "Yes";
	} else {
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int n,MOD;
int s[3100][3100],sum[3100],mi[3100],inv[3100],w[9000010],g[3100],ws[3100];
int ans;
int mo(int x)
{
	if (x>=MOD) return x-MOD;
	return x;
}
int power(int x,int y)
{
	int ans=1,t=x;
	while (y)
	{
		if (y%2) ans=1ll*ans*t%MOD;
		t=1ll*t*t%MOD;
		y/=2;
	}
	return ans;
}
void init()
{
	mi[0]=mi[1]=1;
	for (int i=2;i<=n;i++) mi[i]=1ll*mi[i-1]*i%MOD;
	inv[0]=inv[1]=1;
	for (int i=2;i<=n;i++) inv[i]=1ll*inv[MOD%i]*(MOD-MOD/i)%MOD;
	for (int i=2;i<=n;i++) inv[i]=1ll*inv[i-1]*inv[i]%MOD;
	w[0]=1; g[0]=2;
	ws[0]=1; 
	for (int i=1;i<=n*n;i++) w[i]=mo(w[i-1]+w[i-1]);
	for (int i=1;i<=n;i++) ws[i]=ws[i-1]*2%(MOD-1),g[i]=power(2,ws[i]);
	s[0][0]=1;
	for (int i=1;i<=n+1;i++)
		for (int j=1;j<=i;j++)
			s[i][j]=mo(s[i-1][j-1]+1ll*s[i-1][j]*j%MOD);
}
int C(int x,int y)
{
	if (x<y) return 0;
	return 1ll*mi[x]*inv[y]%MOD*inv[x-y]%MOD;
}
int main()
{
	scanf("%d%d",&n,&MOD);
	init();
	for (int k=0;k<=n;k++) 
		{
			int i=n-k;
			int cas=k%2?MOD-1:1;
		//	printf("%d %d %d %d %d %d\n",mi[n],inv[k],inv[i],inv[j],sum[i],g[j]);
			for (int j=0;j<=k;j++)
				ans=mo(ans+1ll*cas*C(n,k)%MOD*s[k+1][j+1]%MOD*w[j*i]%MOD*g[i]%MOD);
		//	printf("%d %d %d\n",k,i,ans);
		}
	printf("%d\n",ans);
}

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

long long find_val(string s,long long mod)
{
	long long p=1;
	
	long long ans=0;
	
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='1')
		{
			ans=(ans+p)%mod;	
		}
		p=(p*2)%mod;
	}
	
	return ans;
}

int find_step(long long n)
{
	if(n==0)
		return 0;
		
	long long bits=__builtin_popcount(n);
	
	return 1+find_step(n%bits);
}

int main()
{
	int n;
	cin>>n;
	
	string s;
	cin>>s;
	
	long long cnt=0;
	
	for(int i=0;i<n;i++)
	{
		cnt+=(s[i]=='1');
	}
	
	reverse(s.begin(),s.end());
	
	long long val1=-1,val2;
	
	if(cnt>1)
	{
		val1=find_val(s,cnt-1);
	}
	
	val2=find_val(s,cnt+1);
	
	long long p1=1;
	long long p2=1;
	
	int ans[n];
	
	for(int i=0;i<n;i++)
	{
		if(s[i]=='1')
		{
			if(cnt>1)
			{
				long long temp=(val1-p1+ (cnt-1) )%(cnt-1);								
				ans[n-i-1]=1+find_step(temp);
			}
			else
			{
				ans[n-i-1]=0;
			}
		}
		else
		{
			long long temp=(val2+p2)%(cnt+1);			
			ans[n-i-1]=1+find_step(temp);
		}
		
		if(cnt>1)
		{
			p1=(2*p1)%(cnt-1);
		}
		
		p2=(2*p2)%(cnt+1);
	}
	
	for(int i=0;i<n;i++)
	{
		cout<<ans[i]<<endl;
	}
}

Measured memory_bytes: 4572
#include<bits/stdc++.h>
using namespace std;
int main(){
int X;
cin >>X;
vector <bool > expo(X+1);
expo[1]=1;
for(int b=2;b<=X;b++){
int v = b*b;
while(v<=X){
expo[v] = 1;
v *= b;
}
}
for(int i=X;i>=1;i--) if(expo[i]){
cout <<i<<endl;
return 0;
}
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;//typo用
using itn = int;//typo用
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a) - 1; i >= (intl)(b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl//1次元配列の出力
#define rrdebug(i, j, x) rep(i, alength(x))rep(j, alength(x[i]))cout << #x << "[" << i << "][" << j << "]:" << x[i][j] << endl//二次元配列の出力
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = acos(-1);
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
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; }
intl gcd(intl a, intl b){ if(!b)return a; return gcd(b, a % b); }
intl lcm(intl a,intl b){ return a / gcd(a, b) * b; }
intl kai(intl k){//k!を求める関数,
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl digit10(intl a){//aを10進数で表したときの桁数を求める関数
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}


signed main(){
    cout << fixed << setprecision(10);
    intl n;
    cin >> n;
    intl c[n - 1], s[n - 1], f[n - 1];
    rep(i,n-1){
        cin >> c[i] >> s[i] >> f[i];
    }
    rep(i,n - 1){
        intl time = 0;
        repi(j,i, n - 1){
            if(time == s[j])time += c[j];
            else if(time < s[j])time += (s[j] - time) + c[j];
            else {
                intl a = (time + f[j] - 1) / f[j];
                time += (a * f[j] - time) + c[j];
            }
        }
        cout << time << endl;
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<queue>
#include<string.h>
#include<iostream>
#include<algorithm>
#define INF 1000000000
#define MAXN 100005
using namespace std;
int mmin=11;
int step[4][2]={0,1,0,-1,-1,0,1,0};
int a[1005][1005];int m,n,k,sx,sy;
struct node{
    int x,y,cost;
};
int bfs(int x,int y,int s)
{
    queue<node>q;
    bool vis[1005][1005]={0};
    node now={x,y,0};
    q.push(now);
    while(!q.empty())
    {
        now=q.front();q.pop();
        if(a[now.x][now.y]==s)break;
        for(int i=0;i<4;i++)
        {
            int xx=now.x+step[i][0],yy=now.y+step[i][1];
            if(!vis[xx][yy]&&a[xx][yy]!=-1){
                vis[xx][yy]=1;
                node temp={xx,yy,now.cost+1};
                q.push(temp);

            }
        }
    }
    //cout<<now.cost<<endl;
    sx=now.x;sy=now.y;
    return now.cost;
}
int main()
{
    scanf("%d%d%d",&n,&m,&k);
    memset(a,-1,sizeof(a));
    for(int i=1;i<=n;i++){
        string x;cin>>x;
        for(int j=1;j<=m;j++)
        {
            char c=x[j-1];
            if(c=='S'){a[i][j]=0;sx=i;sy=j;}
            else if(c=='X')a[i][j]=-1;
            else if(c=='.')a[i][j]=0;
            else a[i][j]=c-'0';
        }
    }
    int sum=0;
    for(int i=1;i<=k;i++)
    {
        sum+=bfs(sx,sy,i);
    }
    printf("%d\n",sum);
}



Measured memory_bytes: 8284
n = int(raw_input())
s = raw_input()

def fill():
    for i in range(n-2):
        c = s[i]
        if a[i] == 0: # hituji
            if c == 'o':
                a[i+1] = a[i-1]
            else:
                a[i+1] = a[i-1] ^ 1
        else: # ookami
            if c == 'o':
                a[i+1] = a[i-1] ^ 1
            else:
                a[i+1] = a[i-1]

def isTrue(i):
    flag = False
    if a[i] == 0:
        if s[i] == 'o' and a[i-1] == a[(i+1)%n]:
            flag = True
        elif s[i] == 'x' and a[i-1] != a[(i+1)%n]:
            flag = True
    else:
        if s[i] == 'o' and a[i-1] != a[(i+1)%n]:
            flag = True
        elif s[i] == 'x' and a[i-1] == a[(i+1)%n]:
            flag = True
    return flag

def convert():
    ret = ""
    for v in a:
        if v == 0:
            ret += 'S'
        else:
            ret += 'W'
    return ret

a = [0] * n

a[-1] = 0 # hituji
a[0]  = 0 # hituji
fill()
if isTrue(n-2) and isTrue(n-1):
    print convert()
    exit()

a[-1] = 0 # hituji
a[0]  = 1 # ookami
fill()
if isTrue(n-2) and isTrue(n-1):
    print convert()
    exit()

a[-1] = 1 # ookami
a[0]  = 1 # ookami
fill()
if isTrue(n-2) and isTrue(n-1):
    print convert()
    exit()

a[-1] = 1 # ookami
a[0]  = 0 # hituji
fill()
if isTrue(n-2) and isTrue(n-1):
    print convert()
    exit()

print -1

Measured memory_bytes: 6900
// The moment you think of giving up you have already lost the battle
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
typedef long double dl;
#define PI  3.14159265358979323846
#define Mod 1000000007
ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll r=fast(n/2,a,m);
        if(n%2==0)
        {
            return (((r%m)*(r%m))%m);
        }
        else
        {
            return (((((r%m)*a)%m)*r)%m);
        }

    }
}
int main()
{
   ll N,D;
   cin>>N>>D;
   ll ans=0;
   ll i,X,Y;
   for(i=0;i<N;i++)
   {
       cin>>X>>Y;
       ll d=X*X+Y*Y;
       if(d<=D*D)
        ans++;
   }
   cout<<ans;
}


Measured memory_bytes: 3592
#include<stdio.h>
#include<string.h>

void judge(int fild[14][14], int i, int j) {
	fild[i][j] = 0;  
	if (fild[i][j + 1] == 1)judge(fild, i, j + 1);
	if (fild[i][j - 1] == 1)judge(fild, i, j - 1);
	if (fild[i+1][j ] == 1)judge(fild, i+1, j);     
	if (fild[i-1][j] == 1)judge(fild, i-1, j);     
}

int main(void) {
	int fild[14][14] = {0};
	int ans;
	int i,j;
	
	while (1) {
		for (i = 1; i <=12; i++) {
			for (j = 1; j<=12; j++) {
				if (scanf("%1d", &fild[i][j]) == EOF) return 0;
			}
		}
		ans = 0;
		for (i = 1; i <= 12; i++) {
			for (j = 1; j <= 12; j++) {
				if (fild[i][j] == 1) {
					ans++;                  
					judge(fild,i,j);
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
int main(){
  float A,B,C;
  str S1,S2,S3;
  str N;
  cin>>A>>B;
  cout<<B*2-A<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<algorithm>
#include<cstdlib>

using namespace std;

#define rep2(x,from,to) for(int (x)=(from);x<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int n;
int s[1000];
int dp[100005];
int main()
{
  dp[0]=1;
  cin>>n;
  rep(i,n)cin>>s[i];
  rep(i,n)
    {
      for(int j=10000;j>=0;j--)
	{
	  if(j>=s[i]&&dp[j-s[i]])
	    {
	      dp[j]=1;
	    }
	}
    }
  for(int i=10000;i>=0;i--)
    {
      if(dp[i]&&i%10!=0)
	{
	  cout<<i<<endl;
	  return 0;
	}
    }
  cout<<0<<endl;
  return 0;
}


Measured memory_bytes: 256
function main(input) {
    var a = input.trim().split(/\s+/).map((e) => {return Number(e)}).sort();
    console.log(a[0] == 5 && a[1] == 5 && a[2] == 7 ? 'YES' : 'NO');
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 11468
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  int x,y;
  cin>>x>>y;
  int sum=0;
  if(x<=3)sum+=(4-x);
  if(y<=3)sum+=(4-y);
  if(x+y==2)sum+=4;
  cout<<sum*100000<<endl;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<queue>
using namespace std;

#define INF 1e9

int zalgo(string s){
  int n;
  n = s.length();

  int a[n];
  for(int i=0;i<n;i++) a[i] = 0;

  int c = 0;
  for(int i=1;i<n;i++){
    if(i + a[i-c] < c + a[c]){
      a[i] = a[i-c];
    }
    else{
      int j = max(0,c+a[c]-i);
      while(i+j < n && s[j] == s[i+j]) j++;
      a[i] = j;
      c = i;
    }
  }

  int m = 0;
  for(int i=0;i<n;i++) m = max(m,min(i,a[i]));

  return m;
}

int main(){
  int n;
  string s;
  cin >> n;
  cin >> s;
  n = s.length();
  string subs;
  int m = 0;
  for(int i=0;i<n;i++){
    subs = s.substr(i,n-i);
    m = max(m,zalgo(subs));
  }

  cout << m << endl;

  return 0;
}


Measured memory_bytes: 256
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as MP
import qualified Data.Set as ST
import qualified Data.Sequence as SQ
import Data.Array
import Data.Array.Unboxed
import Data.Array.ST
import Data.Array.IO
import Data.Maybe
import Data.Ratio
import Data.Char
import Data.Bits
import Data.List
import Data.Tuple
import Data.Functor
import Data.IORef
import Data.STRef
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- 約数列挙
divisor :: Int -> [Int]
divisor n = loop n 1
    where
        loop :: Int -> Int -> [Int]
        loop n i
            | n < i * i = []
            | n `mod` i == 0 && (i * i == n) = i : loop n (i+1)
            | n `mod` i == 0 && (i * i /= n) = i : (n `div` i) : loop n (i+1)
            | otherwise = loop n (i + 1)

main = do
  n <- readLn :: IO Int
  print $ length [() | i<-[1,3..n], let ds = divisor i, (length ds) == 8]

Measured memory_bytes: 508
#include "bits/stdc++.h"
using namespace std;

struct tree{
  vector<shared_ptr<tree> >chs;
  int num;
  tree():chs(2,nullptr),num(0){
  }
};

int getnum(string st,int &a){
  int num=0;
  assert(isdigit(st[a]));
  while(a<st.size()&&isdigit(st[a])){
    num*=10;
    num+=st[a]-'0';
    a++;
  }
  assert(st[a]==']');
  a++;
  return num;
}
shared_ptr < tree > input(string st,int &a){
  //cout<<a<<endl;
  assert(a<=st.size());
  if(a==st.size()){
    a++;
    return nullptr;
  }else if(st[a]!='('){
    assert(st[a]==')');
    return nullptr;
  }else{
    shared_ptr<tree> t(make_shared<tree>());
    assert(t->chs.size()==2);
    assert(st[a]=='(');
    a++;
    //cout<<"moguru"<<endl;
    t->chs[0]=input(st,a);
    assert(st[a]==')');
    a++;
    //cout<<"detekita"<<endl;
    assert(st[a]=='[');
    a++;
    //cout<<"Num is"<<endl;
    t->num=getnum(st,a);
    //cout<<t->num<<endl;
    assert(st[a]=='(');
    a++;
    //cout<<"moguru2"<<endl;
    t->chs[1]=input(st,a);
    assert(st[a]==')');
    a++;
    //cout<<"detekita2"<<endl;
    return t;
  }
}

string ans;
void solve(shared_ptr<tree>&l,shared_ptr<tree>&r){
  
    ans.push_back('(');
    if(l->chs[0]==nullptr||r->chs[0]==nullptr){
  }else{
    solve(l->chs[0],r->chs[0]);
    
  }
  
  ans.push_back(')');
  ans.push_back('[');
  ans+=(to_string(l->num+r->num));
  ans.push_back(']');
    ans.push_back('(');
  if(l->chs[1]==nullptr||r->chs[1]==nullptr){

  }else{
    solve(l->chs[1],r->chs[1]);
  }
  
    ans.push_back(')');
}

int main(){
  string A,B;cin>>A>>B;
  vector<shared_ptr<tree>>ts(2,(make_shared<tree>()));
  int a=0;
  ts[0]=input(A,a);
  a=0;
  ts[1]=input(B,a);
  solve(ts[0],ts[1]);
  cout<<ans<<endl;    
  return 0;
}

Measured memory_bytes: 3404
#![allow(dead_code)]

fn main() {
    let n:Vec<u32> = read_vec();

    for (x, i) in n.iter().enumerate() {
        if *i == 0u32 {
            println!("{}", x+1);

        }
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}


fn read_n<T: std::str::FromStr>(n: u32) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}


Measured memory_bytes: 2152
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

int g[15][15];
int main (){
    int ans=0;
    rep(i,15)rep(j,15) g[i][j]=-1;
    int n;
    cin >> n;
    rep(i,n){
        int a;
        cin >> a;
        rep(j,a){
            int x,y;
            cin >> x >> y;
            x--;
            g[i][x]=y;
        }
    }
    rep(i,1<<n){
        vector<int>bin(n,0);
        rep(j,n) if(i>>j&1) bin[j]=1;
        bool flag=true;
        rep(j,n){
            if(bin[j]==1){
                rep(s,n){
                    if(g[j][s]==-1) continue;
                    else if(g[j][s]!=bin[s] ) flag=false;
                }
            }
        }
        if(flag) ans=max(ans,__builtin_popcount(i));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// 2020-08-25 21:19:59
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, ll>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

const int V = 1010;
const ll inf = 1e18;
vector<P> G[V];
ll dist[V];
void answer() {
  int n, m;
  cin >> n >> m;
  rep(i, m) {
    ll a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    G[a].emplace_back(P(b, -c));
  }
  rep(i, n) dist[i] = inf;
  dist[0] = 0;
  ll x = inf;
  rep(k, 2*n) {
    rep(i, n) for(auto [j, c] : G[i]) chmin(dist[j], dist[i] + c);
    if(k+1 == n) x = dist[n-1];
  }
  if(dist[n-1] < x) {
    cout << "inf" << '\n';
  } else {
    cout << -dist[n-1] << '\n';
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;

    int MAX = X;
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        MAX = max(MAX, x);
    }
    int MIN = Y;
    for (int i = 0; i < M; i++) {
        int y;
        cin >> y;
        MIN = min(MIN, y);
    }

    string ans = "War";

    if (MAX < MIN) {
        ans = "No War";
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
	int N,L;
  	cin>>N>>L;
  	vector<string> vec(N);
  
  for(int i=0;i<N;i++)
    cin>>vec.at(i);
  
  sort(vec.begin(),vec.end());
  
  for(int i=0;i<N;i++)
    cout<<vec.at(i);
  
  cout<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    string s, t;
    cin >> s;
    REP(i,s.length()){
        if (s[i] == 'B'){
            if (t.length() > 0){
                t.erase(t.length()-1,1);
            }
        }else{
            t += s[i];
        }
    }
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=1000000007;

int main() {
  ll a,b,x;
  cin >> a >> b >> x;
  ll c=a/x;
  ll d=b/x;
  if(a%x!=0)
  c=c+1;
  cout << d-c+1 << endl;
}



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


int main() {
  int x1 , y1 , x2 , y2 ;
  cin >> x1 >> y1 >> x2 >> y2 ;
  
  int a=abs(x1-x2);
  int b=abs(y1-y2);
  
  int x3 , y3 , x4 , y4 ;
  if(x1<=x2&&y1<=y2){
    x3=x2-b;
    y3=y2+a;
    x4=x3-a;
    y4=y3-b;
  }
  
  if(x1<=x2&&y1>=y2){
    x3=x2+b;
    y3=y2+a;
    x4=x3-a;
    y4=y3+b;
  }
  
  if(x1>=x2&&y1<=y2){
    x3=x2-b;
    y3=y2-a;
    x4=x3+a;
    y4=y3-b;
  }
  
  if(x1>=x2&&y1>=y2){
    x3=x2+b;
    y3=y2-a;
    x4=x3+a;
    y4=y3+b;
  }
  
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl ;
}
    

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> s(N);
	int sum=0;
	for (int i = 0; i < N; i++) {
		cin >> s[i];
		sum += s[i];
	}
	if (sum % 10 != 0)cout << sum;
	else {
		int min_num = 101;
		for (int i = 0; i < N; i++) {
			if (min_num > s[i] && s[i] % 10 != 0)min_num = s[i];
		}
		if (min_num == 101)cout << 0;
		else cout << sum - min_num;
	}
}

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

using namespace std;

class NODE {
public:
	int k, p=0, r=0, l=0;
	NODE(int key) {
		this->k = key;
	}
};

vector<NODE> A;

void insert(int i, int H) {
	A[i].p = i / 2;
	if (2*i <= H) A[i].l = 2 * i;
	if (2*i+1 <= H) A[i].r = 2 * i + 1;
}


int main() {
	int H, key;
	cin >> H;
	NODE z(0); A.push_back(z);
	for (int i = 1; i <= H; i++) {
		cin >> key;
		NODE z(key); A.push_back(z);
		insert(i, H);
	}

	for (int i = 1; i <= H; i++) {
		cout << "node " << i << ": key = " << A[i].k << ", ";
		if (A[i].p != 0) cout << "parent key = " << A[A[i].p].k << ", ";
		if (A[i].l != 0) cout << "left key = " << A[A[i].l].k << ", ";
		if (A[i].r != 0) cout << "right key = " << A[A[i].r].k << ", ";
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3124
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

int main(){
	int cnt=0;
	string str;
	while(getline(cin,str)){
		if(str == "END OF INPUT"){
			break;
		}
		for(int i=0;i<str.size();i++){
			if(str[i] != ' '){
				cnt++;
			}else{
				cout << cnt;
				cnt = 0;
			}
		}
		for(int i=str.size()-1;i>=0;i--){
			if(str[i] != ' '){
				cnt++;
			}else{
				cout << cnt/2 << endl;
				cnt = 0;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1184
n, y = STDIN.readline.chomp.split(' ').map(&:to_i)

def f1(n, b10, b5, total)
  b = total / 1000
  if (n == b10 + b5 + b)
    puts "#{b10} #{b5} #{b}"
    return true
  end
  false
end

def f5(n, b10, b5, total)
  max_b5 = total / 5000
  max_b5.downto(0) do |b|
    if f1(n, b10, b, total - b * 5000)
      return true
    end
  end

  false
end

def f10(n, b10, b5, b1, total)
  max_b10 = total / 10000
  max_b10.downto(0) do |b|
    if f5(n, b, b5, total - b * 10000)
      return true
    end
  end

  puts "-1 -1 -1"
end

f10(n, 0, 0, 0, y)


Measured memory_bytes: 1916
//Author: kaiyu
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <unordered_map>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <numeric>
#include <iomanip>
#define SZ(x) ((int)(x).size())
#define all(x)  x.begin(),x.end()
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define tt int t;cin >> t;while(t--)
#define int3(x,y,z) int x,y,z;cin >> x >> y >> z;
#define int2(x,y) int x,y;cin >> x >>y;
#define int1(x) int x;cin>>x;
#define vi vector<int>
#define vii vector<vector<int>>
typedef long long ll;
#define  fio ios::sync_with_stdio(0);cin.tie(NULL);
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//bool cmp(pair<string,int>p1,pair<string,int>p2) {
//    return p1.ss > p2.ss;
//}
//if (s1.find(s2) != std::string::npos) {
//   std::cout << "found!" << '\n';
//}


using namespace std;

int main() {
    fio
    string s;
    cin >> s;
    if(s.at(2) ==s.at(3) && s.at(4) == s.at(5)) {
        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;



    return 0;
}






Measured memory_bytes: 256
import sys
input = sys.stdin.readline
A, B = map(int, input().split())

xmin = 1
while xmin :
    if int(0.08*xmin) == A and int(0.1*xmin) == B :
        print(int(xmin))
        exit()
    elif int(0.08*xmin) < A or int(0.1*xmin) < B :
        xmin += 1
    else :
        print(-1)
        exit()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ull unsigned long long
# define lli long long int
# define ulli unsigned long long int
#define ll long long
#define db double
#define ldb long double
#define vi vector<int>
#define vull vector<ull>
#define vll vector<ll>
#define pb push_back
#define si set<int>
#define sll set<ll>
#define ins insert
#define rep(i,n) for(int i=0;i<n;i++)
#define vpp vector<pair<int,int>>
#define mp make_pair
#define ft first
#define sc second
#define MOD 1000000007
using namespace std;
// ll prime[10000000];
// //Modular Exponentiation
//     ll fastExpo(ll x,ll n){
//         if(n==0) return 1;
//         if((n&1)==0) return fastExpo((x*x)%MOD,n/2)%MOD;
//         return ((x%MOD)*fastExpo((x*x)%MOD,(n-1)/2))%MOD;
//     }
//   //Euclidean Algorithm
//      ll gcd(ll a,ll b){
//       return (b==0)?a:gcd(b,a%b);
//     } 
//  // Extended Euclidean Algorithm
//   ll exgcd(ll a,ll b,ll &x, ll &y){
//   if(b==0){
//     x=1,y=0;
//     return a;
//   }
//    ll x1,y1;
//     ll d=exgcd(b,a%b,x1,y1);
//    x=y1;
//    y=x1-y1*(a/b);
//    return d;    
//  }    
  //sieve
//   void sieve(){
//   prime[0]=0;
//   prime[1]=0;
//   for(int i=2;i<10000000;i++){
//     prime[i]=1;
//   }
//   for(int i=2;i*i<10000000;i++){
//     if(prime[i]==1){
//       for(int j=i*i;j<10000000;j+=i){
//         prime[j]=0;
//       }
//     }
//   }
// }  
    bool compare(const pair<int,double>&p1,const pair<int,double>&p2)
    {
       if(p1.second>p2.second)
        return true;
       else if(p1.second==p2.second)
        return p1.first<p2.first;
       return false;

    }
     int main(){
      ios_base::sync_with_stdio(false);
      cin.tie(0);
      cout.tie(0);
     // cout << fixed;
      //cout.precision(2);
          
             int n;
             cin>>n;
             int ans=0;
             if(n%1000==0)
              ans=0;
             else
             {
               int r=n/1000;
               r++;
               ans=1000*r-n;
             }
             cout<<ans<<"\n";

             return 0;
            }

Measured memory_bytes: 3648
#include<iostream>
#include<cmath>

using namespace std;
int main()
{
    int a[30];
    for(int i=0;i<30;i++){
        a[i]=0;
    }
    int x;
    for(int i=0;i<28;i++){
        cin >> x;
        a[x-1]=1;
    }
    for(int i=0;i<30;i++){
        
        if(a[i]==0){
            cout << i+1 << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3080
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI()
    ans = inf
    for targ in range(-100, 101):
        s = sum([(x - targ) ** 2 for x in A])
        ans = min(s, ans)
    print(ans)
main()



Measured memory_bytes: 5460
#include <atcoder/all>
using namespace std;
using namespace atcoder;
int main()
{
    int n, m;
    cin >> n >> m;
    dsu uf(n);
    for(int i = 0; i < m; i++)
    {
        int u, v;
        cin >> u >> v;
        u--;v--;
        uf.merge(u, v);
    }
    int ans = 0;
    for(int i = 1; i < n; i++)
    {
        if(!uf.same(0, i))
        {
            ans++;
            uf.merge(0, i);
        }
    }
    cout << ans << endl;
}



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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find algo with array
// Find()
int findpar(int curr, int arr[])
{
  while(arr[curr] != curr) curr = arr[curr];
  return curr;
}
// Union()
void Union(int b, int spa, int arr[])
{
  while(arr[b] != b)
  {
    int c = arr[b];
    arr[b] = spa;
    b = c;
  }
  arr[b] = spa;
}

// Main Code

int main()
{
  int a;
  cin>>a;
  llt ans = 1;
  repn(i, 1, a)
    ans = (ans * i)%M;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 12160
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	string s;

	cin >> s;

	if (s[0] == s[1] && s[1] == s[2] && s[2] == s[3]) {
		cout << "No" << endl;
	}
	else if (s[0] == s[1] && s[2] == s[3]) {
		cout << "Yes" << endl;
	}
	else if (s[0] == s[2] && s[1] == s[3]) {
		cout << "Yes" << endl;
	}
	else if (s[0] == s[3] && s[1] == s[2]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

#define MEM(a, b) memset(a, b, sizeof a);
#define REP(i, k) for(int i = (0); i < (k); i++ )

#define ALL(cont) cont.begin(), cont.end()
#define RALL(cont) cont.begin(), cont.end()
#define FOREACH(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define debug puts("FANGO")
#define INF (int)MAX_INT
#define EPS (int)1e-9
#define PI acos(-1)
#define MOD 1000000007

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef long long int32;
typedef unsigned long long uint32;
typedef long long int int64;
typedef unsigned long long int uint64;

template <class T>
T sqr(T val) {
  return val * val;
}

void solve(__attribute__((unused)) int tc = 0) {
  char c;
  cin >> c;
  switch(c) {
    case 'A':
      cout << "T" << "\n";
      break;
    case 'T':
      cout << "A" << "\n";
      break;
    case 'G':
      cout << "C" << "\n";
      break;
    case 'C':
      cout << "G" << "\n";
      break;
  }
  //cout << "Test case " << tc << " : " << "\n";
  return;
}

int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  /*int TC;
  cin >> TC;
  REP(tc, TC) {
    solve(tc);
  }*/
  solve();
}


Measured memory_bytes: 764
def number_of_inversions(array)
	merge_sort(array, 0, array.size)
end

def merge_sort(array, left, right)
	return 0 unless left + 1 < right
	mid = (left + right) / 2
	count  = merge_sort(array, left, mid)
	count += merge_sort(array, mid, right)
	count += merge(array, left, mid, right)
	count
end

def merge(array, left, mid, right)
	left_array_size  = mid - left
	right_array_size = right - mid

	left_array  = []
	left_array_size.times { |i| left_array << array[left + i] }

	right_array = []
	right_array_size.times { |i| right_array << array[mid + i] }

	left_array  << Float::INFINITY
	right_array << Float::INFINITY

	count = 0
	i = j = 0
	(left...right).each do |k|
		if left_array[i] <= right_array[j]
			array[k] = left_array[i]
			i += 1
		else
			array[k] = right_array[j]
			j += 1
			count += left_array_size - i
		end
	end
	count
end

n = STDIN.gets.to_i
array = STDIN.gets.split[0...n].map(&:to_i)
puts number_of_inversions(array)

Measured memory_bytes: 44164
#define z 1000000
main(){int a[z]={},b[z]={},n,i,x=0,c;for(i=2;i<z;i++)a[i]=i;for(i=0;i<z;i++)if(a[i]!=0){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}while(scanf("%d",&n)!=-1){c=0;while(b[c]<=n && b[c]!=0){c++;}printf("%d\n",c);}return 0;}

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

int main() {
    int x,y;
    cin >> x >> y;
    cout << x + y/2 << endl;
}

Measured memory_bytes: 256
p = int(input())
n = 2*p
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)
primes.sort()

for i in primes:
    if i >= p:
        print(i)
        break


Measured memory_bytes: 21604
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    int n, m;
    cin >> n;
    map<string, int> mp;
    rep(i,n) {
        string s;
        cin >> s;
        mp[s]++;
    }
    cin >> m;
    rep(i,m){
        string t;
        cin >> t;
        if(mp[t]>=1) mp[t]--;
    }
    int ans = 0;
    for(auto x : mp){
        ans = max(ans, x.second);
    }
    cout << ans <<  endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std ;
using namespace __gnu_pbds;

template <typename T> // *s.find_by_order(0), s.order_of_key(2) ;
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define reMin(a, b) a = min(a, b)
#define reMax(a, b) a = max(a, b)

#define lint long long
#define pb push_back
#define F first 
#define S second 
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define SET(x, val) memset(x, val, sizeof(x))
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

typedef vector < int > vi ;
typedef pair < int, int > pii ;

// template <typename T>
inline int modpow(lint base, int exp, int modulo) {
  base %= modulo;
  lint result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulo;
    base = (base * base) % modulo;
    exp >>= 1;
  }
  return result;
}

const int N = 51 ;
const int M = 20 ; 
const int MOD = 1e9 + 7 ;
const lint INF = 1e18 ;

vi adj[N];
vector < pii > restrictions ;
pii edges[N] ; 
int par[N] ;
set < int > subtree ;
int enables[N] ; 
lint dp1[1 << M], dp2[1 << M] ;
int n, m ; 

void dfs(int v, int p) {
	par[v] = p;
	for(int u : adj[v])
		if(u != p)
			dfs(u, v);
}

void sub(int v, int p) {
	subtree.insert(v);
	for(int u : adj[v])
		if(u != p)
			sub(u, v);
}

int main()
{
    fastio; cin >> n ; int u, v, p, q ;
    for(int i = 1; i < n; i++) {
    	cin >> u >> v ;
    	edges[i] = {u, v};
    	adj[u].pb(v); adj[v].pb(u);
    }
    cin >> m ; 
    for(int i = 0; i < m; i++) {
    	cin >> u >> v ;
    	restrictions.pb({u, v});
    }

    dfs(1, -1);
    for(int i = 1; i < n; i++) {
    	int u = edges[i].F, v = edges[i].S ;
    	int parent = u, child = v ; if(par[u] == v) parent = v, child = u ;

    	subtree.clear(); int mask = 0 ;
    	sub(child, parent);

    	for(int j = 0; j < m; j++) {
    		p = restrictions[j].F, q = restrictions[j].S ;
    		if( (subtree.find(p) != subtree.end() and subtree.find(q) == subtree.end() ) or (subtree.find(q) != subtree.end() and subtree.find(p) == subtree.end() ) )
    			mask |= (1 << j);
    	}
    	enables[i] = mask ; 
    }

    SET(dp1, 0); dp1[(1 << m) - 1] = 1 ; 
    for(int i = n-1; i > 0; i--) {
    	SET(dp2, 0);
    	for(int j = 0; j < (1 << m); j++) 
    		dp2[j] = dp1[j] + dp1[j | enables[i]] ; 
    	for(int j = 0; j < (1 << m); j++)
    		dp1[j] = dp2[j] ;
    }
    cout << dp1[0] ; 
}


Measured memory_bytes: 16640
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=100000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n;
string s;
map<string,int> mp;

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	cin >> s;
	n=s.size();
	string t="";
	mp["dream"]=mp["dreamer"]=mp["erase"]=mp["eraser"]=1;
	per(i,n-1,0)
	{
		t=s[i]+t;
		if (mp.count(t)) t="";
	}
	if (t=="") puts("YES");else puts("NO");
	return 0;
}


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

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

	set<char> data;
	for (int i = 0; i < N; i++) {
		char c;
		cin >> c;
		if (c == 'Y') {
			cout << "Four" << endl;
			return 0;
		}
	}

	cout << "Three" << endl;
}


Measured memory_bytes: 256