akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
using namespace std;
typedef long long ll;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX
#define Endl '\n'
#define mian() main()
#define greater greater<int>()
VI findAll(string S,string pattern){VI P;ll pos=(ll)S.find(pattern);
while(pos!=string::npos){P.push_back(pos);pos=(ll)S.find(pattern,pos+1);}return P;}
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
bool is_prime(ll n){if(n<2)return 0;for(int i=2;i*i<n;i++)if(n%i==0)return 0;return 1;}
inline void eratosthenes(VB& p){rep(i,SZ(p))p[i]=1;p[0]=p[1]=0;
rep(i,SZ(p)/2+1){if(p[i])for(ll j=i+i;j<SZ(p);j+=i)p[j]=0;}}
inline ll mod_add(ll a,ll b){return (a+b)%MOD;}
inline ll mod_sub(ll a,ll b){return (a+MOD-b)%MOD;}
inline ll mod_mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
inline ll mod_pow(ll x,ll n,ll mod=(ll)MOD){ll res=1;while(n>0){
if(n&1)res=res*x%mod;x=x*x%mod;n>>=1;}return res;}
inline ll mod_inv(ll x){return mod_pow(x,MOD-2);}
inline ll mod_div(ll a, ll b){return mod_mul(a,mod_inv(b));}
using Graph=vector<vector<P> >;
ll median(ll n,ll a[]){
    return (!(n%2)?(a[n/2]+a[n/2-1])/2:a[n/2]);
}
int main(){
    ll n;ll a[MAX2];cin>>n;rep(i,n){cin>>a[i];a[i]-=i+1;}
    sort(a,a+n);
    ll b=median(n,a);
    ll ans=0;
    rep(i,n){
        ans+=abs(a[i]-b);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1920
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

def printd(str)
  print str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

as = inputs[1]
bs = inputs[2]
cs = inputs[3]

# body
if $debugFlag
  p as
  p bs
  p cs
end

ans = 0
as.length.times do |i|
  ans += bs[as[i]-1]
  if i >= 1
    if as[i]-1 == as[i-1]-1 + 1
      ans += cs[as[i-1]-1]
    end
  end
end

puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <functional>

using namespace std;

#define TPL template
#define TNM typename

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;

TPL<TNM V, TNM H> void resize(vector<V> &v, const H h)
{
    v.resize(h);
}
TPL<TNM V, TNM H, TNM... T> void resize(vector<V> &v, const H &h, const T... t)
{
    v.resize(h);
    for (auto &_v : v)
        resize(_v, t...);
}
TPL<TNM V, TNM T> void fill(V &x, const T &val)
{
    x = val;
}
TPL<TNM V, TNM T> void fill(vector<V> &vec, const T &val)
{
    for (auto &v : vec)
        fill(v, val);
}

vec2<int> dp;
vec<int> w;
vec<int> v;
int N, W;

int rec(int i, int sum)
{
    if (i == N)
        return 0;
    if(dp[i][sum] != -1)
    {
        return dp[i][sum];
    }
    int res = 0;
    if (sum >= w[i])
    {
        res = max(rec(i + 1, sum), rec(i + 1, sum - w[i]) + v[i]);
    }
    else
    {
        res = rec(i + 1, sum);
    }
    return dp[i][sum] = res;
}

int main(void)
{
    cin >> N >> W;
    resize(dp, 110, 10100);
    fill(dp, -1);
    resize(v, N);
    resize(w, N);
    for (int i = 0; i < N; ++i)
    {
        cin >> v[i] >> w[i];
    }

    cout << rec(0, W) << endl;
    return 0;
}



Measured memory_bytes: 7068
#include<stdio.h>
#define MAX 10000
 
typedef struct{
  int p,l,r;
}Node;
 
Node tree[MAX];
 
int n;
 
void pre(int u){
  if(u==-1) return;
 
  printf(" %d",u);
 
  pre(tree[u].l);
  pre(tree[u].r);
}
 
void in(int u){
  if(u==-1) return;
 
  in(tree[u].l);
 
  printf(" %d",u);
 
  in(tree[u].r);
}
 
void post(int u){
  if(u==-1) return;
 
  post(tree[u].l);
  post(tree[u].r);
 
  printf(" %d",u);
}
 
int main(){
 
  int i,v,l,r,root;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    tree[i].p=-1;
  }
 
  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
 
    tree[v].l=l;
    tree[v].r=r;
 
    if(l!=-1){
      tree[l].p=v;
    }
    if(r!=-1){
      tree[r].p=v;
    }
  }
  for(i=0;i<n;i++){
    if(tree[i].p==-1){
      root=i;
    }
  }
  printf("Preorder\n");
  pre(root);
  printf("\n");
  printf("Inorder\n");
  in(root);
  printf("\n");
  printf("Postorder\n");
  post(root);
  printf("\n");
 
  return 0;
}

Measured memory_bytes: 616
#include <iostream>
#include <numeric>
#include <algorithm>
#include <string>

typedef long long ll;
using namespace std;

int gcd(int x, int y) {
	while (y != 0) {
		int r = x % y;
		x = y; y = r;
	}
	return x;
}


int main() {
	int N, M;
	string S, T;
	cin >> N >> M >> S >> T;

	int g = gcd(N, M);
	ll l = (ll)N * M / g;
	for (int k = 0; k < g; k++) {
		if (S[N/g*k] != T[M/g*k]) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << l << endl;
}


Measured memory_bytes: 512
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#include<vector>
#define N 110000
#define inf 9999999
#define pb push_back
using namespace std;
struct node{int y,nex;}a[2*N];
struct node1{int l,r,lc,rc,p,mi,lz,head;vector<int> v;}lt[2*N];
struct node2{int dep,fa,tp;}t[N];
int n,fir[N],len,dfn[N],id,siz[N],son[N],A[N][2],tl;
bool b[N];
void ins(int x,int y)
{
	a[++len].y=y;a[len].nex=fir[x];fir[x]=len;
}
void dfs(int x,int fa)
{
	t[x].fa=fa;
	t[x].dep=t[fa].dep+1;
	siz[x]=1;
	for(int k=fir[x];k;k=a[k].nex)
	{
		int y=a[k].y;
		if(y==fa) continue;
		dfs(y,x);
		siz[x]+=siz[y];
		if(siz[y]>siz[son[x]]) son[x]=y;
	}
}
void dfs1(int x,int tp)
{
	dfn[x]=++id;
	t[x].tp=tp;
	if(son[x]) dfs1(son[x],tp);
	for(int k=fir[x];k;k=a[k].nex)
	{
		int y=a[k].y;
		if(y==t[x].fa || y==son[x]) continue;
		dfs1(y,y);
	}
}
void down(int now)
{
	int lc=lt[now].lc,rc=lt[now].rc;
	if(lc) lt[lc].lz+=lt[now].lz;
	if(rc) lt[rc].lz+=lt[now].lz;
	lt[now].mi+=lt[now].lz;
	lt[now].lz=0;
}
void upd(int now)
{
	int lc=lt[now].lc,rc=lt[now].rc;
	if(lt[lc].lz) down(lc);
	if(lt[rc].lz) down(rc);
	if(lt[lc].mi<lt[rc].mi) lt[now].mi=lt[lc].mi,lt[now].p=lt[lc].p;
	else lt[now].mi=lt[rc].mi,lt[now].p=lt[rc].p;
}
void bt(int l,int r)
{
	int now=++tl;
	lt[now].l=l;lt[now].r=r;
	if(l<r)
	{
		int mid=(l+r)/2;
		lt[now].lc=tl+1;bt(l,mid);
		lt[now].rc=tl+1;bt(mid+1,r);
		upd(now);
	}
	else {lt[now].p=l;if(l==1) lt[now].mi=inf;}
}
void change(int now,int l,int r,int k,int d)
{
	int lc=lt[now].lc,rc=lt[now].rc,mid=(lt[now].l+lt[now].r)/2;
	if(lt[now].lz) down(now);
	if(lt[now].l==l && lt[now].r==r)
	{
		lt[now].lz+=d;
		if(k) lt[now].v.pb(k);
		return;
	}
	if(mid>=r) change(lc,l,r,k,d);
	else if(l>mid) change(rc,l,r,k,d);
	else change(lc,l,mid,k,d),change(rc,mid+1,r,k,d);
	upd(now);
}
void modify(int x,int y,int k,int d)
{
	int fx=t[x].tp,fy=t[y].tp;
	while(fx!=fy)
	{
		if(t[fx].dep<t[fy].dep) swap(fx,fy),swap(x,y);
		change(1,dfn[fx],dfn[x],k,d);
		x=t[fx].fa;fx=t[x].tp;
	}
	if(x==y) return;
	if(dfn[x]>dfn[y]) swap(x,y);
	change(1,dfn[x]+1,dfn[y],k,d);
}
int find(int now,int k)
{
	int lc=lt[now].lc,rc=lt[now].rc,mid=(lt[now].l+lt[now].r)/2;
	if(lt[now].lz) down(now);
	int siz=lt[now].v.size();
	while(lt[now].head<siz && b[lt[now].v[lt[now].head]]) lt[now].head++;
	if(lt[now].head<siz) return lt[now].v[lt[now].head];
	if(mid>=k) return find(lc,k);
	else return find(rc,k);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		ins(x,y);ins(y,x);
	}
	dfs(1,0);
	dfs1(1,1);
	bt(1,n);
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&A[i][0],&A[i][1]);
		modify(A[i][0],A[i][1],i,1);
	}
	for(int i=1;i<n;i++)
	{
		if(lt[1].mi!=1) {printf("NO\n");return 0;}
		int p=lt[1].p,x;
		x=find(1,p);
		b[x]=1;
		modify(A[x][0],A[x][1],0,-1);
		change(1,p,p,0,inf);
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 34500
#include<stdio.h>
int main(void)
{
	int S,h,m,s;
	scanf("%d",&S);
	h=S/3600;
	S-=h*3600;
	m=S/60;
	S-=m*60;
	s=S;
	printf("%d:%d:%d\n",h,m,s);
 return 0;
}

Measured memory_bytes: 2752
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int A[3005];
int main(void){
    int a,ans=0;
    cin>>a;
    for(int i=0;i<a;i++){
        cin>>A[i];
        ans=A[i]+ans;
    }
    cout<<ans-a<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// const long double PI = acos(-1);
constexpr int inf = 1e9;
constexpr ll INF = 2e18;
// constexpr ll MOD = 1e9+7;
constexpr ll MOD = 998244353;

ll n,a,b,k;
ll kai[300010];

void input() {
    cin >> n >> a >> b >> k;
}

ll mypow(ll _a, ll _b) {
    if (_b == 0) return 1;
    if (_b == 1) return _a;
    ll ans = mypow(_a, _b / 2);
    ans = ans * ans % MOD;
    if (_b & 1) ans = ans * _a % MOD;
    return ans;
}

ll inv(ll _k) {
    return mypow(_k, MOD - 2);
}

ll C(ll _k, ll _n) {
    return kai[_n] * inv(kai[_n - _k]) % MOD * inv(kai[_k]) % MOD;
}

void solve() {

    kai[0] = 1;
    kai[1] = 1;
    for (ll i = 2; i <= n; i++) {
        kai[i] = kai[i-1] * i % MOD;
    }

    ll ans = 0;
    for (ll na = 0; na <= n; na++) {
        ll nb = (k - na * a) / b;
        if (nb * b + na * a == k && 0 <= nb && nb <= n) {
            ans += C(na, n) * C(nb, n) % MOD;
            ans %= MOD;
            // cout << na << " " << nb << " " << C(na, n) << " " << C(nb, n) << endl;
        }
    }
    cout << ans << endl;
}

int main(int argc, char *argv[]) {
    input();
    solve();
    return 0;
}


Measured memory_bytes: 2560
n=int(input())

s = [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]
print(s[n-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
 
int n;
long long dp[105][300001];
int m;
int a[123456];
int b[123456];
bool used[105][300001];
 
int main() {
	cin >> n >> m;
	for(int i = 1; i <= n; i++) 
	cin >> a[i] >> b[i], swap(a[i], b[i]);

	used[0][0] = 1;

	for(int i = 1; i <= n; i++) {
		for(int j = 100000; j >= 0; j--) {
			if(!used[i -1][j]) continue;


			if(!used[i][j]) dp[i][j] = (long long)3e11;
			used[i][j] = 1;
			dp[i][j] = min(dp[i][j], dp[i - 1][j]);

			if(dp[i][j] + b[i] <= m) {
				if(!used[i][j + a[i]]) dp[i][j + a[i]] = (long long)3e11;
				used[i][j + a[i]] = 1;
				
				dp[i][j + a[i]] = min(dp[i][j + a[i]], dp[i - 1][j] + b[i]);
			}
		}
		if(i == n) {
			long long ans = 0;
			for(int j = 100000; j >= 0; j--) 
				if(used[i][j]) return cout << j, 0;
		   	cout << ans;
		}
	}
}


Measured memory_bytes: 262400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fo(i,n) for(ll i=0;i<n;i++)
#define fok(i,k,n) for(ll i=k;i<n;i++)
#define ci(x) cin>>x
#define ci2(x,y) cin>>x>>y
#define co(x) cout<<x<<"\n"
#define co2(x,y) cout<<x<<" "<<y<<"\n"
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define PI 3.1415926535897932384626
#define deb1(x) cout<<#x<<" "<<x<<endl
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n"
#define deb3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n"
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;	
int gcd(int a, int b){ if(a==0) return b; return gcd(b%a, a);}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//ci(t);
	while(t--){
		int n;
		ci(n);
		map<string,int> m;
		m["AC"]=0;
		m["WA"]=0;
		m["TLE"]=0;
		m["RE"]=0;
		fo(i,n){
			string tmp;
			ci(tmp);
			m[tmp]++;
		}
		cout<<"AC x "<<m["AC"]<<endl;
		cout<<"WA x "<<m["WA"]<<endl;
		cout<<"TLE x "<<m["TLE"]<<endl;
		cout<<"RE x "<<m["RE"]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<=(end);i++)
#define REP(i, n) FOR(i,1,n)
#define IFOR(i, begin, end) for(int i=(end);i>=(begin);i--)
#define IREP(i, n) IFOR(i,1,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())

#define ll long long
using namespace std;

int main()
{
	ll N,M,K;
    cin>>N>>M>>K;
    FOR(i,0,N){
        FOR(j,0,M){
            if(i*j+(N-i)*(M-j)==K){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

using ll = long long;
using ld = long double;

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

int main(){
  int n, m;
  cin >> n >> m;
  int l=0; int r=INF;
  int tl; int tr;
  REP(i, m){
    cin >> tl >> tr;
    chmax(l, tl);
    chmin(r, tr);
  }
  cout << (r-l+1>0 ? r-l+1 : 0) << endl;
  return 0;
}

Measured memory_bytes: 256
N, M, X, Y = map(int, input().split())

x = list(map(int, input().split()))
y = list(map(int, input().split()))

if max(x) >= min(y):
  print("War")
  quit()
else:
  if max(x) <= X or min(y) > Y:
    print("War")
  else:
    print("No War")

Measured memory_bytes: 3060
import sys
from fractions import gcd

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def lcm(x, y):
    return x * y // gcd(x, y)


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split(" ")))
    A = [a // 2 for a in A]

    semi_lcm = 1
    for a in A:
        semi_lcm = lcm(semi_lcm, a)
        if semi_lcm > M or semi_lcm // a % 2 == 0:
            print(0)
            return

    print((M // semi_lcm + 1) // 2)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 16232
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
using namespace std;
using ll = long long;
ll MOD = 1e9+7;


int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    REP(i, n){
        cnt += (s[i] == 'R' ? 1: -1);
    }
    if(cnt > 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CsTest
{
    public class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            for (int i = 1; i <= 9; ++i)
            {
                int j = N / i;
                if (j * i != N) continue;
                if (1 <= j && j <= 9)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using namespace atcoder;
// cout << fixed << setprecision(10）<<  << endl;
using ll = long long;
const ll MOD = 998244353;

using S = pair<ll,ll>;


S op(S a, S b) { return make_pair((a.first + b.first) % MOD, (a.second + b.second) % MOD); }
S e() { return make_pair(0, 0); }
S mapping(ll f, S a) { if (f == -1ll) return a; return make_pair(f * a.second % MOD, a.second); }
ll composition(ll f, ll g) { return f == -1ll ? g : f; }
ll id() { return -1ll; }

int main(){
    int n, q; cin >> n >> q;

    vector<ll> save(n,1ll);
    rep(i,n-1) save[i+1] = save[i] * 10 % MOD;
    vector<S> ff(n); rep(i,n) ff[i] = make_pair(1ll * save[n - 1 - i], save[n - 1 - i]);

    lazy_segtree<S, op, e, ll, mapping, composition, id> data(ff);

    rep(i,q) {
        int l, r; ll d; cin >> l >> r >> d;
        data.apply(l - 1, r, d);
        cout << data.all_prod().first << endl;
    }
    return 0;

}

Measured memory_bytes: 18288
using System;
using System.Collections.Generic;

//namespace _4_A

class Program
{
    static void Main(string[] args)
    {

        //???????????????3????????????????????????????????????
        string readData = Console.ReadLine();

        //???????????¨??????????????????????????????a,b,???????????????????????????
        string[] readDataValues = readData.Split(' ');
        int a = int.Parse(readDataValues[0]);
        int b = int.Parse(readDataValues[1]);
        //?????£?????´??°?????????
        int d = a / b;

        //?????£?????????????????????
        int r = a % b;

        //???????°???°???
        double f = a / (double)b;

        string g = (f).ToString("F5");

        //??????????????????
        Console.WriteLine(d + " " + r + " " + g);
    }
}

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

int main (void) {
  int N; std::cin >> N;
  std::string S, T; std::cin >> S >> T;
  
  std::string ans;
  
  for(int i=0;i<N;i++) {
  ans+=S[i];
  ans+=T[i];
}
  
  std::cout<<ans<<std::endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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 main(){
  ll n;cin >> n;
  vvl g(n,vl(n));rep(i,n)rep(j,n)cin >> g[i][j];
  vl sum(1<<n);
  rep(bit,1<<n){
    ll ret=0;
    rep(i,n)repl(j,i+1,n)if((bit&(1<<i))&&(bit&(1<<j)))ret+=g[i][j];
    sum[bit]=ret;
  }
  //rep(i,1<<n)cout << sum[i] <<" ";cout << endl;
  rep(bit,1<<n){
    vl z;rep(i,n)if(bit&(1<<i))z.pb(i);
    rep(cit,1<<z.size()){
      ll d=0,e=0;
      rep(j,z.size()){
        if(cit&(1<<j))d+=1<<z[j];
        else e+=1<<z[j];
      }
      if(d>e)break;
      //cout << bit <<" " << d << " " << e <<endl;
      chmax(sum[bit],sum[d]+sum[e]);
    }
  }
  //rep(i,1<<n)cout << sum[i] <<" ";cout << endl;
  cout << sum[(1<<n)-1] <<endl;
}

Measured memory_bytes: 3796
#pragma GCC optimize(2)
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, int> pdd;

const ll mod = 23333333333333333;
const int N = 1e5 + 10, M = 1e5 + 10;
const ll INF = 5e17;
const int inf = 0x3f3f3f3f;
const double eps = 1e-4;

#define pi acos(-1)
#define mk make_pair

int main()
{
    ll x;
    cin >> x;
    double ans = 100;
    for (int i = 1; i; i++)
    {
        ans = (ans + ans * 0.01);
        ans = floor(ans);
        if (ans >= x)
        {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

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

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(int, N);
    vector<pair<int, int>> b(N);
    vector<int> ans(N);

    for (int i = 0; i < N; i++) {
        int temp;
        cin >> temp;
        b[i] = make_pair(temp, 1);
    }

    for (int i = 0; i < N; i++) {
        int last = -1;
        int index = 1;
        int lastIndex = -1;
        for (int j = 0; j < N; j++) {
            if (b[j].second == 0) continue;
            if (b[j].first == index) {
                last = j;
                lastIndex = index;
            }
            index++;
        }

        if ( last == -1 ) {
            cout << "-1\n";
            return 0;
        } else {
            ans[N-1-i] = lastIndex;
            b[last].second = 0;
        }
    }

    for (int i = 0; i < N; i++) {
        cout << ans[i] << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <map>
#include <string.h>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>

using namespace std;
#define set_precision cout << fixed << setprecision(10)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repb(i, a, b) for (int i = a; i >= b; i--)
#define replb(i, a, b) for (ll i = a; i >= b; i--)
#define repl(i, a, b) for (ll i = a; i < b; i++)
#define repit(arr) for (auto it = arr.begin(); it != arr.end(); it++)
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define vpi vector<pair<int,int>>
#define seti set<int>
#define setl set<ll>
#define dseti set<int, greater<int>>
#define dsetl set<ll, greater<ll>>
#define mseti multiset<int>
#define msetl multiset<ll>
#define dmseti multiset<int, greater<int>>
#define dmsetl multiset<ll, greater<ll>>
#define sortA(arr) sort(arr.begin(), arr.end())
#define dsortA(arr) sort(arr.begin(), arr.end(), greater<int>())
#define ssort(arr) stable_sort(arr.begin(), arr.end())
#define search(arr, c) binary_search(arr.begin(), arr.end(), c)
#define pb push_back
#define ll long long
#define cl_bf cin.ignore(numeric_limits<streamsize>::max(), '\n');
#define castl static_cast<ll>
int fact(int n) 
{ 
    int res = 1; 
    for (int i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
}
int nCr(int n, int r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
}
int cel(int a,int b){return((a-1)/b+1);} 
int gcd(int a, int b)
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int lcm(int a,int b){
    return (a*b)/gcd(a,b);
} 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t,l,r, n,ans=0;
    cin >> l>>r>>n;
    rep(i,l,r+1){if(i%n==0)ans++;}
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <math.h>
#include <string>
using namespace std;

int main(){
  float a,b;
  int digit = 0;
  float ans = 0;
  int tmp = 0;
  float parse = 0.0;
  /*処理系*/
  cin >> a >> b;
  digit = (int)log10(b) + 1.0;
  a = a * pow(10.0,digit);
  ans = a + b;
  parse = sqrt(ans) / 1.0;
  parse -= (int)parse;
  if (parse == 0.0)
    cout << "Yes";
  else
  {
    cout << "No";
  }

  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	string s;  cin >> s;
	for(int i = 0 ; i < s.length() ; i++)  cout << 'x';

	cout << endl;

	return 0;
}


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

int n;

int Parent(int a){
  return a/2;
}

int Left (int a){
  return a*2;
}
int Right (int a){
  return a*2 + 1;
}

void swap (int *A,int a,int b){
  int cmp;
 
  cmp = A[a];
  A[a] = A[b];
  A[b] = cmp;
  
}

void maxheapify(int *A,int i){
  int l,r,largest;

  l = Left(i);
  r = Right(i);

  if(l <= n && A[l] > A[i]) largest = l;
  else largest = i;

  if(r <= n && A[r] > A[largest]) largest = r;

  if(largest != i) {
    swap(A,i,largest);
    maxheapify(A,largest);
  }

}

void  buildMaxHeap(int *A){
  int i;

  for(i=n/2;i>0;--i) maxheapify(A,i);
}

int main (){
  int i;
  int *A;

  scanf("%d",&n);

  A = malloc(sizeof(int) * (n+2));

  for(i=1;i<=n;++i){
    scanf("%d",&A[i]);
  }

  buildMaxHeap(A);

  for(i=1;i<=n;++i) printf(" %d",A[i]);
  printf("\n");

  return 0;
}



Measured memory_bytes: 3656
#pragma region macro
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

namespace std {
template <typename A, typename B>
string to_string(pair<A, B> p);

string to_string(const string &s) {
    return '"' + s + '"';
}

string to_string(const char *s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for(int i = 0; i < static_cast<int>(v.size()); i++) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for(size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
};  // namespace std
#pragma endregion

struct info {
    i64 x, y, h;
};

void solve() {
    int n;
    std::cin >> n;
    std::vector<info> infos(n);
    rep(i, n) {
        std::cin >> infos[i].x >> infos[i].y >> infos[i].h;
    }
    std::sort(infos.begin(), infos.end(), [&](info &x, info &y) { return x.h > y.h; });
    // std::cout << infos[0].h << std::endl;

    rep(cx, 101) {
        rep(cy, 101) {
            i64 h = infos[0].h + std::abs(infos[0].x - cx) + std::abs(infos[0].y - cy);
            bool flag = true;
            rep(i, n) {
                if(std::max<i64>(h - std::abs(infos[i].x - cx) - std::abs(infos[i].y - cy), 0) != infos[i].h) {
                    flag = false;
                    break;
                }
            }
            if(flag) {
                std::cout << cx << " " << cy << " " << h << std::endl;
                return;
            }
        }
    }
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
ll five(ll n){
	return (n*n*n*n*n);
}
//include  ll func(ll)
ll func(ll b){
	return five(b);
}

//binarlyscearch
//return ->[0]-, [1]+
vector<pair<ll,ll>> BScearch(ll start,ll stop,ll terget){
	vector<pair<ll,ll>> tmp={mp(start,0LL),mp(stop,INFLL)};
	pair<ll,ll>mid;
	while(abs(tmp[0].F-tmp[1].F)>1){
		mid.F=tmp[0].F+(tmp[1].F-tmp[0].F)/2;
		mid.S=func(mid.F);
		if (mid.S > terget){
			tmp[1] = mid;
		}else{
			tmp[0] = mid;
		}
	}
return tmp;
}
int main(){
	ll x;
	ll a=0LL,b=0LL;
	cin >>x;
	ll ter;
	vector<pair<ll,ll>>cage(2);
	for(a=1000;a>=-1000;a--){
		ter=five(a)-x;
		cage=BScearch(-1000,1000,ter);
	//	clog<<a<<endl;
	//	clog<<cage[0].F<<" "<<cage[0].S<<endl;
	//	clog << cage[1].F << " " << cage[1].S << endl<<endl;
		if(cage[0].S==ter){
			b=cage[0].F;
			break;
		}
	}
	printf("%lld %lld\n",a,b);
}

/*
a^5 + b^5 = x
10^5 + 0^5 = 10^5


*/

Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
const int N=2e3+5,mo=1e9+7;
int f[N];
int main(){
	int s;scanf("%d",&s);
	f[0]=1;
	for(int i=3;i<=s;i++)
		for(int j=i-3;~j;j--)(f[i]+=f[j])%=mo;
	printf("%d",f[s]);
	return 0;
}

Measured memory_bytes: 3820
w, h, n = map(int, input().split())
p = [0, 0]
q = [w, h]

for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        if p[0] < x:
            p[0] = x
    if a == 2:
        if x < q[0]:
            q[0] = x
    if a == 3:
        if p[1] < y:
            p[1] = y
    if a == 4:
        if y < q[1]:
            q[1] = y

    if p[0] > q[0]:
        q[0] = p[0]
    if p[1] > q[1]:
        q[1] = p[1]

        
s = (q[0] - p[0])*(q[1] - p[1])

print(s)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main() {
  int n; cin >> n;
  int y;
  for(int y=0;n-7*y>=0;y++){
    if((n-7*y)%4==0 && (n-7*y)/4>=0){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {

	int n, m;
	
	cin >> n >> m;
	int a[105][105];
	int b[105];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}

	}
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}
	int ans[105] = {0};
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			ans[i] += a[i][j] * b[j];
		}
		cout << ans[i] << endl;
	}

	return 0;
}



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

string S, T;

int main() {
    long long N, M; scanf("%lld%lld",&N,&M);
    cin >> S >> T;
    if(N > M) swap(N, M), swap(S, T);
    long long G = __gcd(N, M); long long ans = N / G * M;
    long long sg = ans / N, tg = ans / M, si = 0, ti = 0;
    while(si < ans && ti < ans) {
        if(si == ti && S[si / sg] != T[ti / tg]) return !printf("-1");
        si += sg;
        while(ti < si) ti += tg;
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 512
import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int k = fs.nextInt();
        int[] p = new int[n];
        for(int i=0;i<n;i++){
            p[i] = fs.nextInt();
        }
        Arrays.sort(p);
        int sum = 0;
        for(int i=0;i<k;i++){
            sum+=p[i];
        }
        System.out.println(sum);
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

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

const long long MOD=1000000007;

int main(){
  long long N,M; cin >> N >> M;
  vector<long long> a(M);
  for(int i=0; i<M; i++) cin >> a[i];
  
  long long step[100010]={};
  //i段目までの数
  step[0]=1;
  for(int i=1; i<=N; i++){
    if(i==1){
      if(M>0){
        if(a[0]!=1){
          step[i]=step[0];
        }
      }else{
        step[i]=step[0];
      }
    }else if(binary_search(a.begin(),a.end(),i)==false){
      step[i]=(step[i-1]+step[i-2])%MOD;
    }
  }
  cout << step[N] << endl;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;

char s[205][205];
int cnt[205],book[205];
int a[200005],tl[200005],nx[200005];
int q[205],st[205];
int main()
{
	int n,ln=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) tl[i]=++ln;
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s[i]+1);
		for(int j=1;j<=n;j++) if(s[i][j]=='1')
		{
			cnt[i]++;
			a[tl[i]=nx[tl[i]]=++ln]=j;
		}
	}
	int ans=0;
	for(int pos=1;pos<=n;pos++)
	{
		memset(book,-1,sizeof(book));
		book[pos]=1;
		int head=1,tail=0;
		q[++tail]=pos;
		while(head)
		{
			int ln=0;
			while(head<=tail)
			{
				int x=q[head++];
				for(int i=nx[x];i;i=nx[i])
				{
					if(book[a[i]]==book[x]-1||book[a[i]]==book[x]+1) continue;
					else if(book[a[i]]==-1)
					{
						st[++ln]=a[i];
						book[a[i]]=book[x]+1;
					}
					else return !printf("-1");
				}
			}
			if(ln==0) break;
			head=1,tail=0;
			for(int i=1;i<=ln;i++) q[++tail]=st[i];
		}
		for(int i=1;i<=n;i++) ans=max(ans,book[i]);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 512
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 2000;

long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}

ll GetDigit(ll num){
    ll digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

ll power(ll a, ll b){
  ll ans = 1;
  if(b%2==0){
    REP(i, b/2){
      ans *= a;
      if(ans>1000000000){
        return -1;
      }
    }
    return ans * ans;
  }else{
    b = b/2;
    REP(i, b){
      ans *= a;
      if(ans>1000000000){
        return -1;
      }
    }
    return ans * ans* a;
  }
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}



int main(void){

  ll n;
  cin>>n;
  ll c0=0, c1=0, c2=0, c3=0;

  REP(i, n){
    string s;
    cin>>s;
    if(s=="AC") c0++;
    else if(s=="WA") c1++;
    else if(s=="TLE") c2++;
    else c3++;

  }

  cout<<"AC x "<<c0<<endl; 
  cout<<"WA x "<<c1<<endl; 
  cout<<"TLE x "<<c2<<endl; 
  cout<<"RE x "<<c3<<endl; 
  
}

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

int main()
{
double r;
cin >> r ;
cout << fixed << setprecision(6) << r*r*M_PI ;
cout << " " ;
cout << fixed << setprecision(6) << r*2*M_PI << endl ;
}


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

int main()
{
  stack<int> stciCalc;
  string sCalc;
  
  while (cin >> sCalc)
  {
    if (sCalc == "+" || sCalc == "-" || sCalc == "*")
    {
      int iNum1 = stciCalc.top(); stciCalc.pop();
      int iNum2 = stciCalc.top(); stciCalc.pop();
      int iReslt;
      if      (sCalc == "+")
        iReslt = iNum2 + iNum1;
      else if (sCalc == "-")
        iReslt = iNum2 - iNum1;
      else if (sCalc == "*")
        iReslt = iNum2 * iNum1;
      else;
      
      stciCalc.push(iReslt);
    }
    else
    {
      int iNum = stoi(sCalc);
      stciCalc.push(iNum);
    }
  }

  cout << stciCalc.top() << endl;
  stciCalc.pop();

  return 0;
}

Measured memory_bytes: 1204
#include<cstdio>
#include<iostream>
#include<string>
using namespace std;
string s;
int main(){
    cin>>s;
    bool flag=false;
    for(int i=0;i<s.size();i++){
        if(s[i]=='C'){
            flag=true;
            continue;
        }
        if(s[i]=='F'){
            if(flag){
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//using ll = long long;
using P = pair<int,int>;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

struct UnionFind{
	vector<int> rnk,par;

	UnionFind(int sz) : rnk(sz,0),par(sz){
		for(int i = 0;i < sz;i++) par[i] = i;
	}

	int find(int x){
		if(par[x] == x) return x;
		return par[x] = find(par[x]);
	}

	void unite(int x,int y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		if(rnk[x] < rnk[y]) swap(x,y);
		par[y] = x;
		if(rnk[x] == rnk[y]) rnk[x]++;
	}
	
	bool same(int x,int y){
		return (find(x) == find(y));
	}
};

signed main(){
	int n,x[100010],y[100010];
	cin >> n;
	vector<int> xs,ys;
	for(int i = 0;i < n;i++){
		cin >> x[i] >> y[i];
		xs.push_back(x[i]);
		ys.push_back(y[i]);
	}
	sort(all(xs));
	xs.erase(unique(all(xs)),xs.end());
	sort(all(ys));
	ys.erase(unique(all(ys)),ys.end());
	UnionFind uf(xs.size() + ys.size());
	for(int i = 0;i < n;i++){
		x[i] = lower_bound(all(xs),x[i]) - xs.begin();
		y[i] = lower_bound(all(ys),y[i]) - ys.begin();
		uf.unite(x[i],xs.size() + y[i]);
	}
	set<int> points[100010];
	for(int i = 0;i < n;i++){
		points[uf.find(x[i])].insert(y[i]);
	}
	int ans = 0;
	for(int i = 0;i < xs.size();i++){
		ans += points[uf.find(i)].size();
	}
	cout << ans - n << endl;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	ll n, m;
	cin >> n >> m;

	vector<ll> a(n);
	rep(i, n) cin >> a[i];

	map<ll, ll> mp;
	ll sum = 0;
	mp[sum]++;

	for (int i = 0; i < n; i++) {
		sum += a[i];
		mp[sum % m]++;
	}

	ll ans = 0;
	for (auto m : mp) {
		ans += m.second * (m.second - 1) / 2;
	}

	out(ans);

	return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>

int main(void){
    int a,b,c;
    int k;
    int count=0;

    scanf("%d %d %d %d",&a,&b,&c,&k);

    for(int i = 0; i < k; i++){
        if(i < a){
            count++;
        }else if(i < a+b){
        }else if(i < a+b+c){
            count--;
        }
    }
    printf("%d\n",count);
    return(0);
}

Measured memory_bytes: 1732
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
#define ld long double
using namespace std; 
 
const int N = 2e5 + 1000, OO = 1e9 + 100, M = 1e9 + 7, P = 6151, SQ = 120, lg = 100;
typedef pair <int, int> pii;
int a[N], dp[N];
 
int pw(int x, int y) {
	if(y == 0)
		return 1;
	int cnt = pw(x, y / 2);
	cnt = (cnt * cnt) % M;
	cnt = (cnt * (y % 2 == 1 ? x : 1)) % M;
	return cnt;
}

int32_t main() {
    use_fast;
	int n;
    cin >> n;
    for(int i = 0; i < n; i++) 
    	cin >> a[i];
    sort(a, a + n);
    dp[n - 1] = (2 * a[n - 1]) % M;
	for(int i = n - 2; i >= 0; i--) {
		int h = n - i;
		int g = ((h - 1) * pw(2, h - 2)) % M;
		int cnt = (pw(2, h - 1) + g) % M;
		cnt = (cnt * pw(2, h - 1)) % M;
		cnt = (cnt + M) % M;
		cnt = (cnt * 2 * a[i]) % M; 
		dp[i] = (cnt + (4 * dp[i + 1] % M)) % M;
		dp[i] %= M;
	}
	cout << dp[0] << endl;
	return 0; 
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ... 
*/	

Measured memory_bytes: 3456
#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>;

void Main()
{
  int N; cin >> N;
  vector<int> A(N);
  int sum = 0;
  rep(i,N) {
    cin >> A[i];
    sum += A[i];
  }
  int mean = round((double)sum / N);
  int cost = 0;
  rep(i,N) cost += (A[i]-mean)*(A[i]-mean);
  cout << cost << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 256
# from copy import copy
import math
n = int(input())
ans = ''
alp = 'abcdefghijklmnopqrstuvwxyz'
cnt = 0
res = [0] * 11
for i in range(1, 11):
    res[i] = res[i-1] + 26**i
keta = 1
#print(res)
for i in range(11):
    if n > res[i]:
        keta = i
#桁数がわかる
n -= res[keta]
#print(n)
#残ったnを26進数表記すれば良い
import numpy as np
aaa = np.base_repr(n-1,26)
#print(aaa)
aaa = str(aaa)
di = {'0':'a', '1':'b','2':'c','3':'d','4':'e','5':'f','6':'g','7':'h','8':'i','9':'j','A':'k','B':'l','C':'m','D':'n','E':'o','F':'p','G':'q','H':'r','I':'s','J':'t','K':'u','L':'v','M':'w','N':'x','O':'y','P':'z'}
for i in range(len(str(aaa))):
    ans = ans + di[aaa[i]]
if keta+1 - len(ans) > 0:
    ans = 'a' * (keta+1 - len(ans) ) + ans
print(ans)
"""
cnt = 10
while True:
    k = n//(26**cnt)
    if k > 0:
        k = n//(26**cnt)
        n -= k
        ans = ans + alp[k-1]
        print(cnt)
    cnt -= 1
    if n <= 26:
        print(n)
        ans = ans + alp[n-1]
        break
    if cnt == 0:
        break
print(ans)
"""

Measured memory_bytes: 28032
#include <stdio.h>

int main()
{
	int price, cake, donut;
  	scanf("%d", &price);
  	for (cake = 0; cake * 4 <= price; cake++){
    	for (donut = 0; donut * 7 <= price; donut++){
        	if (price == cake * 4 + donut * 7) {
            	printf("Yes");
              	return 0;
            }
        }
    }
  	printf("No");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        double x1,x2,x3,y1,y2,y3,a,b,c,r,d,p1,p2;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        c = sqrt(pow(x2-x1,2)+pow(y2-y1,2));
        b = sqrt(pow(x3-x1,2)+pow(y3-y1,2));
        a = sqrt(pow(x3-x2,2)+pow(y3-y2,2));
        r = (a*b*c) / (sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c)));
        d = 2*(x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2));
        p1 =((pow(x1,2)+pow(y1,2))*(y2-y3)+(pow(x2,2)+pow(y2,2))*(y3-y1)+(pow(x3,2)+pow(y3,2))*(y1-y2))/d;
        p2 =((pow(x1,2)+pow(y1,2))*(x3-x2)+(pow(x2,2)+pow(y2,2))*(x1-x3)+(pow(x3,2)+pow(y3,2))*(x2-x1))/d;
        cout << fixed << setprecision(3) << p1 <<" "<< p2 <<" "<< r << endl;
    }
}



Measured memory_bytes: 3196
from collections import defaultdict
n, m = map(int, input().split())
l_1 = [False] * n
l_n = [False] * n
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        l_1[b] = True
    elif b == n:
        l_n[a] = True
for i in range(n):
    if l_1[i] == True and l_n[i] == True:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')


Measured memory_bytes: 6388