akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std ;

#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll> 
#define ld long double

const int M=1000000007;
const int MM=998244353;
const long double PI = acos(-1);

ll power(ll b,ll e,ll m)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b%m,e/2,m)%m;
    return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
    if(e==0) return 1;
    if(e&1) return b*power(b*b,e/2);
    return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T, U> &p)
{ 
    return os<<'('<<p.F<< ","<<p.S<<')'; 
}

#define runSieve
const int N=1000005;
bool prime[N];
ll pf[N];
void sieve()
{
    int k=sqrt(N-2);
    for(int i=1;i<=N-2;++i)
        prime[i]=true;
    for(int i=2;i<=k;++i)
    {
        if(prime[i])
        {
            for(int k=i*i;k<=N-2;k+=i)
            {
                prime[k]=false;
                pf[k]=i;
            }
        }
    }
}

ll cnt[N];

int _runtimeTerror_()
{
    ll n;
    cin>>n;
    vector<ll> v(n);
    for(int i=0;i<n;++i)
    {
        cin>>v[i];
        ll k = v[i];
        while(k!=1 && !prime[k])
        {
            ll z=pf[k];
            while(k%z==0)k/=z;
            ++cnt[z];
        }
        if(k!=1)
            ++cnt[k];
    }
    bool f = false;
    for(int i=1;i<=1e6;++i)
    {
        if(cnt[i]>1)
            f=true;
        if(cnt[i]==n)
        {
            cout<<"not coprime";return 0;
        }
    }
    cout<<(f?"setwise coprime":"pairwise coprime");
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifdef runSieve
        sieve();
    #endif
    #ifdef NCR
        initialize();
    #endif
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--)
        _runtimeTerror_();
    return 0;
}

Measured memory_bytes: 27696
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(void) {
    string s;
    cin >> s;
    rep(i, s.size()){
        s[i] = 'x';
    }
    cout << s;
}



Measured memory_bytes: 256
import collections
N = int(input())
A = list(map(int, input().split()))
summ = [0]
for i in range(N):
  summ.append(summ[-1]+A[i])
s = collections.Counter(summ)
s = s.most_common()
ans = 0
for i in range(len(s)):
    if s[i][1] >= 2:
        ans += s[i][1]*(s[i][1]-1)//2
print(ans)


Measured memory_bytes: 48752
#include<bits/stdc++.h>
using namespace std;
#define Sheryang main
const int maxn=1e4+7;
typedef long long ll;
const int mod=1e8+7;
int read(){int c = getchar(),Nig = 1,x = 0;while(!isdigit(c))c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
#define read read()

int Sheryang()
{
    ll a,b,c;
    cin>>a>>b>>c;

    ll ans=0;

    ans=b+min(b,c);

    c-=min(b,c);
    ans+=min(c,a);
    c-=min(c,a);

    if(c>=1) ans++;

    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int buf;
  int height[10] = {0};

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

  for(int i=0; i<10; i++){
    for(int j=i+1; j<10; j++){
      if(height[i] < height[j]){
        buf = height[i];
        height[i] = height[j];
        height[j] = buf;
      }
    }
  }

  for(int i=0; i<3; i++){
    printf("%d\n", height[i]);
  }

  return 0;
}

Measured memory_bytes: 1848
#define _USE_MATH_DEFINES
#pragma region include

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////

void solve() {
	int X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;
	vector<int> AA(A), BB(B), CC(C);
	for (int i = 0; i < A; ++i) {
		cin >> AA[i];
	}
	for (int i = 0; i < B; ++i) {
		cin >> BB[i];
	}
	for (int i = 0; i < C; ++i) {
		cin >> CC[i];
	}
	vector<LL> ans(0);
	sort(AA.begin(), AA.end());
	sort(BB.begin(), BB.end());
	sort(CC.begin(), CC.end());
	reverse(AA.begin(), AA.end());
	reverse(BB.begin(), BB.end());
	reverse(CC.begin(), CC.end());
	for (int i = 0; i < X; ++i) {
		ans.push_back(AA[i]);
	}
	for (int i = 0; i < Y; ++i) {
		ans.push_back(BB[i]);
	}
	sort(ans.begin(), ans.end());
	for (int i = 0; i < X + Y && i < C; ++i) {
		if (ans[i] < CC[i]) {
			ans[i] = CC[i];
		}
		else {
			break;
		}
	}
	LL sum = 0;
	for (int i = 0; i < X + Y; ++i) {
		sum += ans[i];
	}
	cout << sum << endl;
}

#pragma region main
signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;cin>>S;
  if(S.at(0)!='A')cout<<"WA"<<endl;
  else{
    int i;
    for(i=2;i<S.size()-1;i++)if(S.at(i)=='C')break;
    if(i==S.size()-1)cout<<"WA"<<endl;
    else{
      int j;
      for(j=1;j<S.size();j++){
        if(i!=j&&S.at(j)<'a')break;
      }
      if(j==S.size())cout<<"AC"<<endl;
      else cout<<"WA"<<endl;
    }
  }
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  cout << "{";
  for (int i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  cout << "}";
  return os;
}

// ====================================================================

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n + 1);
  vector<ll> b(n);
  for (int i = 0; i < n + 1; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];

  ll count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] >= b[i]) {  // 左の敵が多い → 倒せるだけ倒す
      count += b[i];
      a[i] -= b[i];
    } else {  // 左の敵を優先して全滅させる
      count += a[i];
      b[i] -= a[i];
      a[i] = 0;

      if (a[i + 1] >= b[i]) {  // 右の敵のほうが多い
        count += b[i];
        a[i + 1] -= b[i];
      } else {
        count += a[i + 1];
        b[i] -= a[i + 1];
        a[i + 1] = 0;
      }
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 1792
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const int MAX_V = 10;
LL d[MAX_V][MAX_V];//d[i][j]???e={u,v}????????????(?????¨???????????¨??????INF,i==j?????¨??????0)
int v;



int main() {
	while (cin >> v&&v) {
		REP(i, MAX_V)REP(j, MAX_V) {
			if (i == j)d[i][j] = 0;
			else d[i][j] = INF;
		}
		int a, b, c;
		REP(i,v) {
			cin >> a >> b >> c;
			d[a][b] = c;
			d[b][a] = c;
		}
		/*REP(i, MAX_V) {
			REP(j, MAX_V) {
				cout << d[i][j] << " ";
			}
			cout << endl;
		}*/
		for (int k = 0; k<10; ++k) {
			for (int i = 0; i<10; ++i) {
				for (int j = 0; j<10; ++j) {
					d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
				}
			}
		}
		LL ans = INF;
		int ans2;
		REP(i, MAX_V) {
			LL num = 0;
			REP(j, MAX_V) {
				if (d[i][j] == INF)continue;
				num += d[i][j];
			}
			if (num != 0 && ans > num) {
				ans = num;
				ans2 = i;
			}
		}
		cout << ans2 << " " << ans << endl;
	}
}

Measured memory_bytes: 3100
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 100005
#define ll long long
priority_queue<pair<int ,int > >q,p;
void clear(){while(!p.empty()&&q.top()==p.top())q.pop(),p.pop();}
struct node{int to,next;}e[N<<1];
int head[N],n,cnt,d[N],a[N],out[N],vis[N];ll ans;
void add(int x,int y){e[cnt]=(node){y,head[x]};head[x]=cnt++;d[x]++;}
int main()
{
	scanf("%d",&n);memset(head,-1,sizeof(head));
	for(int i=1,x,y;i<n;i++)scanf("%d%d",&x,&y),add(x,y),add(y,x);
	for(int i=1;i<=n;i++)q.push(make_pair(-d[i],i));
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
		clear();
		pair<int ,int >tmp=q.top();q.pop();
		int x=tmp.second;
		out[x]=a[i];vis[x]=1;ans+=(ll)a[i]*d[x];
		for(int j=head[x];j!=-1;j=e[j].next)
		{
			int to1=e[j].to;
			if(!vis[to1])p.push(make_pair(-d[to1],to1)),d[to1]--,q.push(make_pair(-d[to1],to1));
		}
	}
	printf("%lld\n",ans);
	for(int i=1;i<=n;i++)printf("%d ",out[i]);puts("");
}


Measured memory_bytes: 1280
#include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <math.h>
#include <quadmath.h>
using namespace std;

int main(){
    long double a,b,c;
    cin >> a >> b >>c;
    if (a+b<c-2.0*sqrtl(a*b)+1E-15){
        cout <<"Yes";
    }else{
        cout <<"No";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int ans;
int n,m;
int x[100005];
int num[100005],match[100005];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1,v;i<=n;i++) scanf("%d",&v),x[v%m]++,num[v]++;
	for(int i=1;i<=100000;i++) match[i%m]+=num[i]/2;
	int ans=x[0]/2*2;
	if(m%2==0) ans+=x[m/2]/2*2;
	for(int i=1;i<(m+1)/2;i++){
		int x1=x[i],x2=match[i]*2,y1=x[m-i],y2=match[m-i]*2;
		if(x1<y1) swap(x1,y1),swap(x2,y2);
		ans+=y1*2+min((x1-y1)/2*2,x2);
	}
	cout<<ans/2<<endl;
	return 0;
}

Measured memory_bytes: 1408
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n;

void fun(int cur, int len, string& s)
{
	if (len == n) {
		cout << s << E;
	}
	else {
		for (int i = 0; i < cur; i++) {
			string t = s;
			t += i + 'a';
			fun(cur, len + 1, t);
		}
		string t = s;
		t += cur + 'a';
		fun(cur + 1, len + 1, t);
	}
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	string s = "";
	fun(0, 0, s);
	//system("pause");
	return 0;
}

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

int main()
{
    int k;
    cin >> k;
    int cnt = 0;
    queue<long long int> que;
    que.push(0);
    long long int ans = 0;
    while(cnt < k)
    {
        long long int t = que.front();
        que.pop();

        vector<int> child;
        int a = t%10;
        if(t == 0)
        {
            child = {1,2,3,4,5,6,7,8,9};
        }
        else
        {
            if(a >= 1)
            {
                child.push_back(a-1);
            }
            child.push_back(a);
            if(a <= 8)
            {
                child.push_back(a+1);
            }
        }

        long long int next = t * 10;
        for(int n : child)
        {
            que.push(next+n);
            ++cnt;
            if(cnt == k)
            {
                ans = next+n;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
	static char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray();

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

		int N = sc.nextInt();
		int M = sc.nextInt();

		int[] ans = new int[N + 1];
		for (int i = 0; i < (M * 2); i++) {
			ans[sc.nextInt()]++;
		}
		for (int i = 1; i < ans.length; i++) {
			System.out.println(ans[i]);
		}
	}
}


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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	cout << (x - 1) / 2;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define VIZ {printf("digraph G{\n"); for(int i=1;i<=n;i++) for es(i,e) printf("%d->%d;\n",i,vb[e]); puts("}");}
#ifdef LOCAL
#define TIMER cerr<<clock()<<"ms\n"
#else
#define TIMER
#endif
#define SZ 666666
int n; ld l,r,x;
int main()
{
	scanf("%d%lf%lf",&n,&l,&x);
	r=(n*2-1)*x+l;
	ld ans=0;
	while(n)
	{
		ans+=(l+r)/2.0;
		ld d=(r-l)/(n*2-1);
		l=(l*3+d*3)/(2.0*n)+l*(ld)(2*n-1)/(2*n);
		r=(r*3-d*3)/(2.0*n)+r*(ld)(2*n-1)/(2*n);
		n--;
	}
	printf("%.15lf\n",ans);
}


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

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
  #define cerrendl 42
#endif
//}}}

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

int lcm(int a, int b){
  return (a/gcd(a,b))*b;  // overflowしにくいように最初に割り算をする。
}

signed main() {
  int n,m;cin>>n>>m;
  vector<int> a(n);
  map<int, int> d;
  rep(i, n) {
    cin>>a[i];
    int v = a[i];
    int c = 0;
    while(v%2==0){
      v /= 2;
      c++;
    }
    d[c]++;
  }
  if (sz(d)==1){
    int L = 1;
    rep(i, n){
      L = lcm(L, a[i]/2);
      if (L>m) break;
    }
    dump(L);
    if (m<L) {
      cout << 0 << endl;
      return 0;
    }
    cout << (m-L)/(2*L)+1 << endl;
  }
  else{
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
n = int(input())
S = []
T = []

for i in range(n):
    S += [input()]

m = int(input())

for i in range(m):
    T += [input()]

ans = 0

for tango in set(S):
    tmp = S.count(tango) - T.count(tango)
    ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 3064
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    n = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    if n%1000 == 0:
        print(0)
    else:
        print(1000 - (n%1000))

if __name__ == '__main__':
    solve()


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


#define M_MAX 20
#define N_MAX 50000
#define INFTY 1 << 29

int main(){
long long int n;
cin >> n;
long long int count=0; 
for(int i=1;i<=n;i++){
long long int res=log10(i)+1;
if(res%2==1)count=count+1;
}
cout << count;



}


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

int main() {
    int N,i;
    string s,p;
    set <string> W;

    cin >> N >> p;
    W.insert(p);

    for(i=1; i<N; i++) {
        cin >> s;
        if(!W.count(s) && p.at(p.size()-1)==s.at(0))
            W.insert(s);
        else
            break;
        p = s;
    }

    cout << ((i==N) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

from collections import defaultdict

N = int(input())
A = [int(input()) for _ in range(N)]

cnt = defaultdict(int)
for a in A:
    if cnt[a]:
        cnt[a] = 0
    else:
        cnt[a] = 1

print(sum(cnt.values()))

Measured memory_bytes: 16620
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int Max = 100005;
const int NIL = -1;
int n, id, k;
int c, l, r;
struct Node//×ó×ÓÓÒÐÖµÜ
{
    int parent, left, right;
};
Node T[Max];
int D[Max];

void print(int u)
{

    string status;
    if(T[u].parent==NIL) status = "root";
    else
    {
        if(T[u].left!=NIL) status = "internal node";
        else  status = "leaf";
    }
    printf("node %d: parent = %d, depth = %d, %s, [", u, T[u].parent, D[u], status.c_str());
    if(T[u].left==NIL)
    {
        printf("]\n");
        return;
    }
    int l = T[u].left, c;
    printf("%d", l);
    while(T[l].right!=NIL)
    {
        c = T[l].right;
        printf(", %d", c);
        l = c;
    }
    printf("]\n");
}

void rec(int r, int depth)
{
    D[r] = depth;
    if(T[r].right!=NIL)
        rec(T[r].right, depth);
    if(T[r].left!=NIL)
        rec(T[r].left, depth+1);
}

int main()
{
    scanf("%d", &n);
    for(int i=0; i<n; i++)
    {
        T[i].parent = NIL;
        T[i].left = NIL;
        T[i].right = NIL;
    }
    for(int i=0; i<n; i++)
    {
        scanf("%d %d", &id, &k);
        for(int j=0; j<k; j++)
        {
            scanf("%d", &c);
            T[c].parent = id;
            if(j==0)
                T[id].left = c;
            else
                T[l].right = c;
            l = c;
        }

    }
    for(int i=0; i<n; i++)
    {
        if(T[i].parent==NIL)
        {
            r = i;
            break;
        }
    }
    rec(r, 0);
    for(int i=0; i<n; i++)
    {
        print(i);
    }
    return 0;
}



Measured memory_bytes: 7948
ans = "WA"
s = list(input())
if s[0] == "A":
  if s[2:-1].count("C") == 1:
    c = s[2:-1].index("C")+2

    if all([ s[i].islower() for i in range(1,len(s)) if i != c]):
      ans = "AC"

print(ans)


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
 	string s1,s2;
 	cin>>s1>>s2;
 	int n=s1.length();
 	int m=s2.length();
 	int dp[n+1][m+1];
 	for(int i=0;i<=n;i++)
 	{
 		for(int j=0;j<=m;j++)
		{
			if(i==0 || j==0)
			dp[i][j]=0;
			else if(s1[i-1]==s2[j-1])
			dp[i][j]=dp[i-1][j-1]+1;
			else
			dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
		}	
	}

	int l=dp[n][m];
	string s="";
	int i=n;
	int j=m;
	while(1)
	{
		if(s.length()==l)
		break;
		if(s1[i-1]==s2[j-1])
		{
			s=s1[i-1]+s;
			i--;
			j--;
		}
		else if(dp[i][j-1]>dp[i-1][j])
		j--;
		else
		i--;
	}
	cout<<s;
}



Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
int main(){
    char c;
    cin >>c;
    if(c == 'a'|| c == 'i' || c == 'u' || c == 'e' || c == 'o')cout << "vowel" <<endl;
    else cout << "consonant" << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	static int n;
	static ArrayList<Edge>[] g;
	static int[] depth;

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			n = sc.nextInt();
			if (n == 0)
				break;
			g = new ArrayList[n];
			depth = new int[n];
			for (int i = 0; i < n; ++i)
				g[i] = new ArrayList<>();
			int[] p = new int[n - 1];
			int[] d = new int[n - 1];
			for (int i = 0; i < n - 1; ++i) {
				p[i] = sc.nextInt();
			}
			for (int i = 0; i < n - 1; ++i) {
				d[i] = sc.nextInt();
			}
			for (int i = 0; i < n - 1; ++i) {
				int a = i + 1;
				int b = p[i] - 1;
				int w = d[i];
				g[a].add(new Edge(a, b, w));
				g[b].add(new Edge(b, a, w));
			}

			long ans = 0;
			for (int i = 0; i < n; ++i) {
				for (Edge e : g[i]) {
					if (e.src > e.dst)
						ans += e.weight * 3;
				}
			}

			for (int i = 0; i < n; ++i) {
				if (g[i].size() == 1)
					ans -= g[i].get(0).weight * 2;
			}
			
			dfs(0, -1);

			int max = -1;
			int v = -1;

			for (int i = 0; i < n; ++i) {
				if (max < depth[i]) {
					max = depth[i];
					v = i;
				}
			}
			Arrays.fill(depth, 0);
			dfs(v, -1);

			max = -1;

			for (int i = 0; i < n; ++i) {
				max = Math.max(max, depth[i]);
			}
			ans -= max;
			System.out.println(ans);
		}
	}

	static void dfs(int cur, int pre) {
		for (Edge e : g[cur]) {
			if (g[e.dst].size() == 1)
				continue;
			if (e.dst == pre)
				continue;
			depth[e.dst] = depth[cur] + e.weight;
			dfs(e.dst, cur);

		}
	}

	static class Edge {
		int src;
		int dst;
		int weight;

		public Edge(int src, int dst, int weight) {
			this.src = src;
			this.dst = dst;
			this.weight = weight;
		}
	}
}

Measured memory_bytes: 71644
#include <bits/stdc++.h>
using namespace std;
int snukes[105];
int main(){
    memset(snukes, 0, sizeof(snukes));
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < k; ++i){
        int snake;
        cin >> snake;
        for(int j = 0; j < snake; ++j){
            int x; cin >> x;
            snukes[x - 1]++;
        }
    }
    int ans = 0;
    for(int i = 0; i < n; ++i){
        if(snukes[i] == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
import sys
sys.setrecursionlimit(10 ** 6)
def input():
    return sys.stdin.readline()[:-1]

def dfs(v,prev = -1):
    for u in graph[v]:
        if u == prev:
            continue
        point[u] += point[v]
        dfs(u,v)

N, Q = list(map(int,input().split()))
graph = [[] for _ in range(N)]
point = [0]*N

for i in range(N-1):
    a,b = list(map(int,input().split()))
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

for i in range(Q):
    p,x = list(map(int,input().split()))
    p -= 1
    point[p] += x

dfs(0)
print(*point)


Measured memory_bytes: 282928
/**
 * @author yuichirw
 *
 */
import java.util.*;
public class Main {

	static int n;
	static String line;
	static Scanner sc = new Scanner(System.in);
	
	static void read() {
		line = sc.nextLine();
	}
	
	static int solve() {
		return new MyParser().parse(line.substring(0, line.length() - 1));
	}
	
	public static void main(String[] args) {
		n = sc.nextInt(); sc.nextLine();
		while(n-- > 0) {
			read();
			System.out.println(solve());
		}
	}
	
}

class MyParsed {
	int val;
	String str;
	
	MyParsed(int val, String str) {
		this.val = val; this.str = str;
	}
}

class MyParser {
	
	public int parse(String str) {
		MyParsed mp = expr(str);
		return mp.val;
	}
	
	private MyParsed expr(String str) {
		MyParsed mp = term(str);
		while(mp.str.length() > 0 && (mp.str.charAt(0) == '+' || mp.str.charAt(0) == '-')) {
			char op = mp.str.charAt(0);
			int tmp = mp.val;
			mp = term(mp.str.substring(1));				
			if(op == '+') {
				mp.val = tmp + mp.val;
			} else {
				mp.val = tmp - mp.val;
			}
				
		}
		return mp;
	}
	
	private MyParsed term(String str) {
		MyParsed mp = fact(str);
		while(mp.str.length() > 0 && (mp.str.charAt(0) == '*' || mp.str.charAt(0) == '/')) {
			char op = mp.str.charAt(0);
			int tmp = mp.val;
			mp = fact(mp.str.substring(1));
			if(op == '*') {
				mp.val = tmp * mp.val;
			} else {
				mp.val = tmp / mp.val;
			}
		}
		return mp;
	}
	
	private MyParsed fact(String str) {
		if(Character.isDigit(str.charAt(0))) {
			int pos = 0; String num = "";
			while(pos < str.length() && Character.isDigit(str.charAt(pos))) {
				num += str.charAt(pos++);			
			}
			return new MyParsed(Integer.parseInt(num), str.substring(pos));
		} else {
			MyParsed mp = expr(str.substring(1));
			mp.str = mp.str.substring(1);
			return mp;
		}
	}
}

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

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

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで降順
#define pb push_back
#define eb emplace_back
#define fst first
#define snd second
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
constexpr ll inf = 1ll<<61;
constexpr ll mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>T add(const T &a, const T &b){return (a+b)%mod;}

signed main(){
  int n, m ;cin >> n >> m;
  vi s(n); rep(i,n) cin >> s[i];
  vi t(m); rep(i,m) cin >> t[i];
  vvi dp(n+1,vi(m+1));
  rep(i,n+1) dp[i][0] = 1;
  rep(j,m+1) dp[0][j] = 1;
  rep(i,n) rep(j,m){
    dp[i+1][j+1] = dp[i+1][j] + dp[i][j+1];
    if(s[i] != t[j]) dp[i+1][j+1] -= dp[i][j];
    dp[i+1][j+1] %= mod;
  }
  if(dp[n][m] < 0) dp[n][m] += mod;
  cout << dp[n][m] << endl;
}


Measured memory_bytes: 31616
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,ans;
	cin>>n;
	int l[101000],r[101000];
	for(int i=0;i<n;i++) cin>>l[i]>>r[i];
	ans=0;
	for(int i=0;i<n;i++){
		ans+=r[i]-l[i]+1;
	}
	cout<<ans<<endl;
	return 0;
	}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)                                                         

using namespace std;
#define ll long long

int main(){
  int N;
  ll X;
  cin >> N >> X;
  vector<int> M;
  for(int i=0; i<N; i++){
    int in;
    cin >> in;
    X -= in;
    M.push_back(in);
  }
  sort(M.begin(), M.end());
  cout << N + X / M[0] << endl;
  return 0;
}


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

int main()
{
  int64_t N, M, a, b, ans = 0;
  cin >> N >> M;
  priority_queue<pair<int64_t, int64_t>, vector<pair<int64_t, int64_t>>, greater<pair<int64_t, int64_t>>> ab;
  for (int i = 0; i < N; i++)
  {
    cin >> a >> b;
    if (a <= M)
      ab.push(make_pair(a, b));
  }
  priority_queue<int64_t> pq;
  for (int d = 1; d <= M; d++) // d日前
  {
    while (!ab.empty() && ab.top().first <= d)
    {
      pq.push(ab.top().second);
      ab.pop();
    }
    if (!pq.empty())
    {
      ans += pq.top();
      pq.pop();
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  int N;
  vector<vector<int>> data(3, vector<int>(3));
  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      cin >> data.at(i).at(j);
    }
  }
  cin >> N;
  vector<int> bingo(N);
  for (int i = 0; i < N; i++)
  {
    cin >> bingo.at(i);
  }
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      for (int k = 0; k < 3; k++)
      {
        if (bingo.at(i) == data.at(j).at(k))
        {
          data.at(j).at(k) = 0;
        }
      }
    }
  }
  if (data.at(0).at(0) == 0 && data.at(0).at(1) == 0 && data.at(0).at(2) == 0)
  {
    cout << "Yes" << endl;
    return 0;
  }
  else if (data.at(1).at(0) == 0 && data.at(1).at(1) == 0 && data.at(1).at(2) == 0)
  {
    cout << "Yes" << endl;
    return 0;
  }
  else if (data.at(2).at(0) == 0 && data.at(2).at(1) == 0 && data.at(2).at(2) == 0)
  {
    cout << "Yes" << endl;
    return 0;
  }
  else if (data.at(0).at(0) == 0 && data.at(1).at(0) == 0 && data.at(2).at(0) == 0)
  {
    cout << "Yes" << endl;
    return 0;
  }
  else if (data.at(0).at(1) == 0 && data.at(1).at(1) == 0 && data.at(2).at(1) == 0)
  {
    cout << "Yes" << endl;
    return 0;
  }
  else if (data.at(0).at(2) == 0 && data.at(1).at(2) == 0 && data.at(2).at(2) == 0)
  {
    cout << "Yes" << endl;
    return 0;
  }
  else if (data.at(0).at(0) == 0 && data.at(1).at(1) == 0 && data.at(2).at(2) == 0)
  {
    cout << "Yes" << endl;
    return 0;
  }
  else if (data.at(0).at(2) == 0 && data.at(1).at(1) == 0 && data.at(2).at(0) == 0)
  {
    cout << "Yes" << endl;
    return 0;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
using namespace std;
typedef pair<int,int> p;
typedef long long ll;

int main(){
	int n;
	string s;
	cin>>n>>s;
	int x=0,ans=0;
	rep(i,s.size()){
		if(s[i]=='I')x++;
		else x--;
		ans=max(ans,x);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())
Yen = Y/1000

for i in range(N+1):
    for j in range(N+1-i):
        if i*10 + j*5 + (N-i-j) == Yen:
            print(i, j, N-i-j)
            exit()
print('-1 -1 -1')

Measured memory_bytes: 9096
#include<stdio.h>
#include<string.h>
    int main(){
        char s[101];
        while(~scanf("%s",s)){
            int len;
            len = strlen(s);
            int i;
            int count = 0;
                for(i = 0;i < len / 2;i++){
                    if(s[i] == s[len - i - 1]){
                        continue;
                    }else{
                        count++;
                    }
                }

            printf("%d\n",count);
        }
    }


Measured memory_bytes: 128
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

int N;
vector<int> *G;
vector<int> bfn(int spoint);

int main(){
  cin >> N;
  G = new vector<int>[N+1];
  int a, b;
  for(int i=1; i<N; i++){
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  vector<int> dist1 = bfn(1);
  vector<int> dist2 = bfn(N);

  int l=0; int r=0;
  for(int i=1; i<=N; i++){
    if(dist1[i] <= dist2[i]) l++;
    else r++;
  }

  if(l>r) cout << "Fennec" << endl;
  else  cout << "Snuke" << endl;
}

vector<int> bfn(int spoint){
  vector<int> dist(N+1,-1); 
  queue<int>  q; 
  q.push(spoint);
  dist[spoint] = 0;

  while(!q.empty()){
    int u = q.front();
    q.pop();
    for(int i : G[u]){
      if(dist[i]==-1){
	dist[i] = dist[u] + 1;
	q.push(i);
      }
    }
  }
  return dist;
};


Measured memory_bytes: 6528
#include <iostream>
#include "string.h"

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A,B,C;
	cin >> A >> B >> C;
	int initR = A % B;
	int tmpR = A % B;
	bool flag = true;
	for(int i = 0;i <= B;i++){
		if(initR == C){
			cout << "YES" << endl;
			flag = false;
			break;
		}
		initR = (initR + tmpR) % B;
	}
	
	if(flag) cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 384
# -*- coding: utf-8 -*-
import numpy as np

m, d = map(int, input().split())
day = [i for i in range(22, d+1)]

res_mult = []
for d in day:
    d10 = int(list(str(d))[0])
    d1 = int(list(str(d))[1])
    if d1 < 2:
#        print("pass")
        continue
    else:
        res_mult.append(d10*d1)

#print(res_mult)
res_mult = np.array(res_mult)

#print(res_mult)
print(np.sum(res_mult <= m))


Measured memory_bytes: 21896
#include <iostream>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, s, n) for(int i = s; i < n; i++)
using namespace std;

int main(void) {
    int n;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];

    int b = 0;
    int sgn = 1;
    rep(i, n) {
        b += (sgn) * a[i];
        sgn *= -1;
    }
    cout << b;

    repp(i, 1, n) {
        b = (a[i-1] - b/2) * 2;
        cout << " " << b;
    }
}


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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
int mod = 2;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
int main() {
  int n;
  cin >> n;
  mod = n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<mint> b(n);
  combination c(n-1);
  rep(i,n) if (a[i]) {
    // add (1 - (x-i)^(n-1))
    b[0] += 1;
    mint pw = 1;
    for (int j = n-1; j >= 0; --j) {
      b[j] -= pw * c(n-1,j);
      pw *= -i;
    }
  }
  rep(i,n) {
    printf("%lld\n",b[i].x);
  }
  return 0;
}

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

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

using namespace std;
using ll = long long;

int main(void) {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> vec1(h+2, vector<char>(w+2, '.'));
  vector<vector<char>> vec2(h+2, vector<char>(w+2, '0'));
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      cin >> vec1[i][j];
    }
  }
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (vec1[i][j] == '#') {
        vec2[i][j] = '9';
        vec2[i][j-1]++;
        vec2[i+1][j-1]++;
        vec2[i+1][j]++;
        vec2[i+1][j+1]++;
        vec2[i][j+1]++;
        vec2[i-1][j+1]++;
        vec2[i-1][j]++;
        vec2[i-1][j-1]++;
      }
    }
  }
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (vec2[i][j] > '8') {
        cout << '#';
      } else {
        cout << vec2[i][j];
      }
    } 
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s,t,si;
  int ss,ts;
  cin>>si>>t;
  ss=si.size();
  ts=t.size();
  vector<string>ans;
  bool ok;
  if(ts>ss){
      cout<<"UNRESTORABLE";
      return 0;
  }
  for(int i=ts;i<=ss;i++){
      ok=true;
      s=si;
      for(int j=0;j<ts;j++){
          if(s.at(ss-i+j)=='?'||s.at(ss-i+j)==t.at(j))continue;
          ok=false;
      }
      if(!ok)continue;
      for(int j=0;j<ts;j++){
          s.at(ss-i+j)=t.at(j);
      }
      for(int i=0;i<ss;i++){
        if(s.at(i)=='?')s.at(i)='a';
      }  
      ans.push_back(s);
  }
  if(ans.size()==0)cout<<"UNRESTORABLE";
  else{
    sort(ans.begin(),ans.end());
    cout<<ans.at(0);
  } 
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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 int INF = 1001001001;

int main(){
  int a[13] = {INF, 0,2,0,1,0,1,0,0,1,0,1,0};
  int x, y;
  cin >> x >> y;

  cout << (a[x] == a[y] ? "Yes" : "No") << endl;

  return 0;
}


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

int main()
{
  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    vector<set<int> > res(n);
    vector<vector<int> > dat(30);
    for (int i = 0; i < n; ++i) {
      int f;
      cin >> f;
      for (int j = 0; j < f; ++j) {
	int t;
	cin >> t;
	dat[t-1].push_back(i);
      }
      res[i].insert(i);
    }

    int ans = -2;
    for (unsigned int i = 0; i < dat.size(); ++i) {
      set<int> tmp;
      for (unsigned int j = 0; j < dat[i].size(); ++j) {
	for (set<int>::iterator it = res[dat[i][j]].begin(); it != res[dat[i][j]].end(); ++it)
	  tmp.insert(*it);
      }
      for (unsigned int j = 0; j < dat[i].size(); ++j)
	res[dat[i][j]] = tmp;
      if (tmp.size() == n) {
	ans = i;
	break;
      }
    }
    cout << ans+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 980
use proconio::*;

fn run() {
    input! {
        n: u64,
    }
    let mut ans = 0;
    for i in 1..=n {
        if i % 3 != 0 && i % 5 != 0 {
            ans += i;
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 2120
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;
    cin>>x;
    cout<<8-(x-400)/200;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,r;
signed main(){
    cin>>n>>r;
    if(n<10)r+=100*(10-n);
    cout<<r<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(signed i=0;i<n;++i)
#define repi(n) rep(i,n)
#define int long long
#define str string
#define vint vector<int>
#define pint pair<int,int>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define yn(b) cout<<((b)?"Yes":"No")<<endl
#define YN(b) cout<<((b)?"YES":"NO")<<endl
#define call(a) for(auto t:a)cout<<t<<" ";cout<<endl
#define ENDL printf("\n");
#define debg(a) cout<<#a<<":"<<a<<endl;
#define SORT(a) sort(all(a));
#define INF 1LL<<60
#define inf INF
#define out(i) cout<<i<<endl
int min(int a,int b){if(a>b)return b;return a;}
int max(int a,int b){if(a>b)return a;return b;}

signed main(){
  int n,m;
  cin>>n>>m;
  if(n>=m)out(m/2);
  else out((2*n+m)/4);  

  return 0;
}



Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n,q = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n-1)]
px = [list(map(int,input().split())) for i in range(q)]
t = [[] for i in range(n)] #つながり
for i in ab:
  t[i[0]-1].append(i[1]-1)
  t[i[1]-1].append(i[0]-1)
c = [0] * n # count
for i in px:
  c[i[0]-1] += i[1]
a = [0] * n
visited = [0] * n
stack = [0]
a[0] = c[0]
while stack:
  cur = stack.pop()
  visited[cur] = 1
  for i in t[cur]:
    if visited[i] == 1:
      continue
    else:
      stack.append(i)
      a[i] = a[cur] + c[i]
print(' '.join(map(str,a)))

Measured memory_bytes: 161756
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main 
{	
	public static void main(String[] Arguments) throws IOException 
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer ST = new StringTokenizer(BR.readLine());
		int N = Integer.parseInt(ST.nextToken()), Q = Integer.parseInt(ST.nextToken());
		String S = BR.readLine();
		int PSA[] = new int[S.length() + 1];
		for (int i = 1; i < S.length(); i++)
		{
			if (S.charAt(i - 1) == 'A' && S.charAt(i) == 'C') PSA[i]++;
		}
		for (int i = 1; i <= S.length(); i++) PSA[i] += PSA[i - 1];
		for (int i = 0; i < Q; i++)
		{
			ST = new StringTokenizer(BR.readLine());
			int l = Integer.parseInt(ST.nextToken()), r = Integer.parseInt(ST.nextToken());
			int count = PSA[r - 1] - PSA[l - 1];
			System.out.println(count);
		}
	}
}


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

int main() {

  int a=0, b=0, d=0, r=0;
  double f=0;

  cin >> a >> b;

  d = a/b;
  r = a%b;
  f = ((double) a/b);

  cout << d << " " << r << " " << fixed << setprecision(8) << f << endl;

  return 0;
  
}


Measured memory_bytes: 3232
#include<iostream>
int c[]={500,100,50,10,5,1};
int main(){int n,r,i;while(1){std::cin>>n;if(!n)break;n=1000-n,r=0;for(i=0;i<6;i++)r+=n/c[i],n%=c[i];std::cout<<r<<"\n";}}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
#define maxn 200001
#define rep(i,n) for(int i=0; i<int(n); ++i)
#define pb push_back
#define mp make_pair

void solve(){
    int n,m,k;
    int x,y,z,A,B,C,D;
    cin >> n >> A >> B >> C >> D;
    n--;
    m = B - A;
    bool yes = 0;
    for(int i=0; i<=n; ++i){
        // i pos's, n-i neg's
        long long low = 1ll * i * C - 1ll * (n-i) * D;
        long long high = 1ll * i * D - 1ll * (n-i) * C;
        if(m>=low && m<=high){
            yes = 1;
            break;
        }
    }
    cout << (yes? "YES":"NO") << endl;
}

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0);
    solve();
}

Measured memory_bytes: 256
#include <algorithm>
#include <stdio.h>
using namespace std;

int main()
{
	int n;
	scanf("%d", &n);

	int a;
	long long int sum = 0;
	int minV = 1000001;
	int maxV = -1000001;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		sum += a;
		maxV = max(maxV, a);
		minV = min(minV, a);
	}

	printf("%d %d %lld\n", minV, maxV, sum);

	return 0;
}


Measured memory_bytes: 2736
#include <stdio.h>
#define MAX_N 200000
 
int main(){
    int i,j;
    int n,maxv,min;
    int r[MAX_N];
    scanf("%d",&n);
    for(i=0; i<n; i++) scanf("%d",&r[i]);
 
    min  = r[0];
    maxv = r[1] - min;
    for(j=1; j<n; j++){
        if(maxv < r[j] - min) maxv = r[j] - min;
        if(min > r[j]) min = r[j];
    }
 
    printf("%d\n",maxv);
 
    return 0;
}

Measured memory_bytes: 1376
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] nums = br.readLine().split(" ");
		int[] numsInt = new int[2];
		numsInt[0] = Integer.parseInt(nums[0]);
		numsInt[1] = Integer.parseInt(nums[1]);
		int max = numsInt[0] + numsInt[1];
		if(max < numsInt[0] - numsInt[1]){
			max = numsInt[0] - numsInt[1];
		}
		if(max < numsInt[0] * numsInt[1]){
			max = numsInt[0] * numsInt[1];
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 21332
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    int A, B;
    cin >> A >> B;

    string S;
    cin >> S;

    FOR(i, 0, A){
        char c = S[i];
        if('0' <= c && c <= '9'){

        }else{
            p("No");
            return 0;
        }
    }

    if(S[A]!='-'){
        p("No");
        return 0;
    }

    FOR(i, A+1, A+B+1){
        char c = S[i];
        if('0' <= c && c <= '9'){

        }else{
            p("No");
            return 0;
        }
    }

    p("Yes");
    
    return 0;
}

Measured memory_bytes: 256