akhauriyash/Code-Regression huggingface dataset:
def x(s):
	n = len(s)
	x1 = (n - 1) // 2
	x2 = (n + 3) // 2
	t = s[:x1]
	u = s[x2 - 1:]
	return (s == s[::-1]) and (t == t[::-1]) and (u == u[::-1])
s = input()
print('Yes' if x(s) else 'No')

Measured memory_bytes: 3060
#include<cstdio>
int main(){
	char a[50]={0};
	while(~scanf("%s",a))
	{
		for(int i=0;i<=4;i++)
		{
			printf("%c",a[i]);
		}
		printf("\ ");
		for(int i=6;i<=12;i++)
		{
			printf("%c",a[i]);
		}
		printf("\ ");
		for(int i=14;i<=18;i++)
		{
			printf("%c",a[i]);
		}
	}
	
	return 0;
}

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

int main(void) {
	char S[128];
	int i;
	int len;
	if (scanf("%127s", S) != 1) return 1;
	len = (int)strlen(S);
	if (len == 2) {
		puts(S);
	} else {
		for (i = len - 1; i >= 0; i--) putchar((unsigned char)S[i]);
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 1568
def sol(N):
  ans = 0
  for i in range(1,int(N**.5)+1):
    if N%i == 0:
      if i != N//i and N%(N//i-1) != 0:
        ans += N//i-1
  return ans

N = int(input())
if N == 1:
  print(0)
else:
  print(sol(N))


Measured memory_bytes: 38768
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  int ans = 2 * n;
  REP(i, n)
  {
    bool flag = true;
    FOR(j, i, n)
    {
      if (s[j] != t[j - i])
      {
        flag = false;
        break;
      }
    }
    if (flag)
    {
      ans = min(ans, n + i);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n,w,f;
int a[110],b[110];

vector<long long> v[4];

int main(){
	cin>>n>>w;f=1145141919;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
		f=min(f,a[i]);
	}
	for(int i=0;i<4;i++)v[i].push_back(0);
	for(int i=0;i<n;i++){
		v[a[i]-f].push_back(b[i]);
	}
	for(int i=0;i<4;i++)sort(v[i].begin()+1,v[i].end(),greater<long long>());
	for(int i=0;i<4;i++){
		for(int j=1;j<v[i].size();j++){
			v[i][j]+=v[i][j-1];
		}
	}
	long long ans=0;
	for(int i=0;i<v[0].size();i++){
		if(i*f>w)break;
		for(int j=0;j<v[1].size();j++){
			if((i+j)*f>w)break;
			for(int k=0;k<v[2].size();k++){
				if((i+j+k)*f>w)break;
				for(int r=0;r<v[3].size();r++){
					if((i+j+k+r)*f+j+k*2+r*3<=w){
						ans=max(ans,v[0][i]+v[1][j]+v[2][k]+v[3][r]);
					}
					else break;
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
  int N;
  cin>>N;
  string S;
  cin >> S;
  if(N%2==0){
    if(S.substr(0,N/2)==S.substr(N/2)){
      cout <<"Yes"<<endl;
      return 0;
    }
  } 

  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
const int maxn=1e5+10;
vector<int> g[maxn];
int n,deg[maxn],pa[maxn];
vector<int> dfn;
void dfs(int x,int fa)
{
	dfn.push_back(x);
	pa[x]=fa;
	for(int i=0;i<g[x].size();i++)
	{
		int to=g[x][i];
		if(to==fa)continue;
		dfs(to,x);
	}
}
int up[maxn];
vector<int> son;
bool check2(int pos,int len)
{
	if(pos>=son.size())return 0;
//	if(len==2)
//	{
//		cout<<"check2 "<<pos<<" "<<len<<" "<<son[pos]<<endl;
//	}
	if(son[pos]+1>len)return 0;
	int l=0,r=son.size()-1;
	for(int i=0;i<son.size()/2;i++)
	{
		if(l==pos)l++;
		if(r==pos)r--;
		if(son[l]+son[r]>len)return 0;
		l++,r--;
	}
	return 1;
}
bool check(int len)
{
	for(int i=0;i<dfn.size();i++)
	{
		int x=dfn[i];
		son.clear();
		for(int j=0;j<g[x].size();j++)
			if(g[x][j]!=pa[x])
			{
		//		if(len==2)
		//		{
		//			cout<<"wtf "<<x<<" "<<g[x][j]<<" "<<up[g[x][j]]+1<<endl;
		//		}
				son.push_back(up[g[x][j]]+1);
			}
		if(!(son.size()&1))son.push_back(0);
		sort(son.begin(),son.end());
		if(len==2)
		{
	//		for(int j=0;j<son.size();j++)cout<<son[j]<<" ";
	//		cout<<"!! "<<x<<endl;
		}
	//	if(!check2(son.size()-1,len))return 0;
		int l=-1,r=son.size();//(l,r]
	//	cout<<"safe here?\n";
		while(l+1<r)
		{
			int mid=(l+r)>>1;
			if(check2(mid,len))r=mid;
			else l=mid;
		}
		if(r==son.size()||son[r]>=len)return 0;
		if(len==2)
		{
	//		cout<<x<<" "<<r<<" "<<son[r]<<endl;
		}
		up[x]=son[r];
	}
	son.clear();
	for(int i=0;i<g[1].size();i++)son.push_back(up[g[1][i]]+1);
	sort(son.begin(),son.end());
	if(son.back()>len)return 0;
	if(son.size()&1)son.pop_back();
	for(int i=0;i<son.size()/2;i++)
		if(son[i]+son[son.size()-1-i]>len)return 0;
	return 1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		g[a].push_back(b);
		g[b].push_back(a);
		deg[a]++;
		deg[b]++;
	}
	int A=n-1;
	for(int i=1;i<=n;i++)
	{
		A-=deg[i]/2;
	}
	dfs(1,0);
	reverse(dfn.begin(),dfn.end());
	dfn.pop_back();
	int l=0,r=n;//(l,r]
	while(l+1<r)
	{
		int mid=(l+r)>>1;
		if(check(mid))r=mid;
		else l=mid;
	}
	printf("%d %d\n",A,r);
	return 0;
}

Measured memory_bytes: 11384
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
	int i = 0, L = 0;
	char S[100000];
	scanf("%s", S);
	while (S[i] != '\0') {
		L++;
		i++;
	}
	i = 0;
	while (i < L) {
		printf("%c", S[i]);
		i += 2;
	}
	return 0;
}

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

def main():
    n=int(input())
    sdic={}
    for i in range(n):
        s=input()
        if s in sdic.keys():
            sdic[s]+=1
        else:
            sdic.setdefault(s,0)
    sdic_sorted = sorted(sdic.values(), reverse=True)
    mn=sdic_sorted[0]
    ans=[]
    for k,v in sdic.items():
        if v==mn:
            ans.append(k)
    ans.sort()
    for i in ans:
        print(i.rstrip('\n'))


if __name__ == '__main__':
    main()

Measured memory_bytes: 33628
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}



///////////////////////////




int main() {

	ll N;
	cin >> N;
	bool r[200];
	ll y[200];

	repn(i, N) {
		ll a, b;
		cin >> a>> b;
		y[a] = b;
		r[a] = 1;
	}

	repn(i, N) {
		ll c, d;
		cin >> c >> d;
		y[c] = d;
		r[c] = 0;
	}

	ll ans = 0;
	rep(i, 2 * N) {
		if (r[i] == 0) {
			ll v = -1;
			ll ind = -1;

			rep(j, i) {
				if (r[j] == 1 && y[j] > v&&y[j] < y[i]) {
					v = y[j];
					ind = j;
				}
			}

			if (ind != -1) {
				ans++;
				y[ind] = INF;

				//cout << i << ind << endl;
			}

		}
	}

	cout << ans;
	system("PAUSE");

}


Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char C;
  cin >> C;

    if ((C == 'a') || (C == 'i') || (C == 'u') || (C == 'e') || (C == 'o'))  {
      cout << "vowel" << endl;
    }
    else {
      cout << "consonant" << endl;
    }
}

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

int calc(int n) {

}

int main()
{
    int N;
    std::unordered_map<std::string,int> ss;
    std::cin >> N;
    for (int i=0; i<N; ++i) {
        std::string s;
        std::cin >> s;
        std::sort(s.begin(), s.end());
        ss[s] += 1;
    }
    long count = 0L;
    for (auto i=ss.begin(); i!=ss.end(); ++i) {
        long occur = (*i).second;
        count += occur * (occur -1) / 2;
    }
    std::cout << count << std::endl;
    return 0;
}

Measured memory_bytes: 10660
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){
    string S,T;
    cin>>S;
    cin>>T;

    int ans=LLONG_MAX;
    for(int i=0;i<S.size();i++){
        int c=0;
        for(int j=0;j<T.size();j++){
            if(i+j>=S.size()){
                c=LLONG_MAX;
                break;
            }
            if(S[i+j]!=T[j]) c++;
        }
        ans=min(ans,c);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3184
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main()

{
  //int A, B, C, X, Y;
  char s[101]={};
  long long min=0;
  int A, B, C, K;
//  int sosu[20000]={};
  int i,j,k;
  int flag=0;
  int tmp=0;
  int cnt =0;
  int next_cnt = 0;
  int tmp_cnt =0;
  int tmp_next_cnt = 0;

//    int k=0;

  scanf("%s", s);
//  printf("%s\n", s);

  for(i=0;i<4;i++){
  if(s[i] == '+') cnt++;
  else cnt--;
  }
  
/*  while (1){
    for(i=5;i>0;i--){
      printf("cnt%d\n",cnt);
      tmp=pow(9,i);
      if(A>tmp){
        while(1){
        A = A -pow(9,i);
        cnt++;
        if(A<=tmp) break;
       }
      }
    if(A==0) break;
//      printf("%d\n",A);
    }
    for(i=6;i>0;i--){
      printf("%d\n",A);
      tmp=pow(6,i);
      printf("cnt %d\n",cnt);
      if(A>tmp){
        while(1){
        A = A -pow(6,i);
        cnt++;
      printf("cnt %d\n",cnt);
        if(A<=tmp) break;
       }
      }
    if(A==0) break;
//      printf("%d\n",A);
    }
    for(i=0;i<A;i++){
      printf("%d\n",A);
        A--;
        cnt++;
      if(A==0) break;
//      printf("%d\n",A);
    }
  break;
  }
*/
printf("%d\n",cnt);   

return 0;
}


Measured memory_bytes: 128
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 str = br.readLine();
		String[] abc = str.split(" ", 0);
		int w = Integer.parseInt(abc[0]);
		int h = Integer.parseInt(abc[1]);
		int x = Integer.parseInt(abc[2]);
		int y = Integer.parseInt(abc[3]);
		int r = Integer.parseInt(abc[4]);

		if (0 <= x && 0 <= y) {
			if (x < w && y < h) {
				if (r <= (w - x) && r <= (h - y)) {
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			} else {
				System.out.println("No");
			}
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 24196
a=[]
for i in range(3):
    a.append(list(map(int,input().split())))
n=int(input())
b=[]
for i in range(n):
    b.append(int(input()))

b=set(b)
ch=[]
for i in range(3):
    ch.append([0,0,0])

for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            ch[i][j]+=1

for i in range(3):
    s=0
    for j in range(3):
        s+=ch[i][j]
    if s==3:
        print("Yes")
        exit()

for i in range(3):
    s = 0
    for j in range(3):
        s += ch[j][i]
    if s == 3:
        print("Yes")
        exit()

s=0
for i in range(3):
   s+=ch[i][i]
if s==3:
    print("Yes")
    exit()

s=0
for i in range(3):
   s+=ch[i][2-i]
if s==3:
    print("Yes")
    exit()

print("No")

Measured memory_bytes: 3064
N = int(input())
s = [input() for _ in range(N)]
M = int(input())
t = [input() for _ in range(M)]

n = []
for i in range(N):
  S = s.count(s[i])
  T = t.count(s[i])
  n.append(S - T)

if max(n) < 0:
  print(0)
else:
  print(max(n))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

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

inline LL gl()
{
	LL f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

int n, m;

int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	cin >> n >> m;
	if (n >= 10) cout << m << endl;
	else cout << m + 100 * (10 - n) << endl;
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N = int(input())
P = list(map(int, input().split()))

C = [True if i+1 == p else False for i, p in enumerate(P)]

result = 0
for n in range(N-1):
    if C[n]*C[n+1]:
        result += 1
        C[n] = False
        C[n+1] = False

print(sum(C) + result)

Measured memory_bytes: 14008
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#define MOD 1000000007
#define ll long long
#define MOD1 2
#define MOD2 1681
#define MOD3 148721
#define ten6 1000000
#define ten5 100000
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
       cin.tie(NULL);
    int n,h[100000]={0},cost[ten5]={0};
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    cost[0]=0;
    cost[1]=std::abs(h[1]-h[0]);
    for(int k=2;k<n;k++)
    {
        cost[k]=std::min(cost[k-1] + std::abs(h[k]-h[k-1]),cost[k-2] + std::abs(h[k]-h[k-2]));
    }
                                              
    
    cout<<cost[n-1]<<endl;
    return 0;
}





Measured memory_bytes: 1024
(defun parse-int-ex (n)
  (cond ((stringp n) (parse-integer n))
        ((char= n #\1) 1)
        ((char= n #\2) 2)
        ((char= n #\3) 3)
        ((char= n #\4) 4)
        ((char= n #\5) 5)
        ((char= n #\6) 6)
        ((char= n #\7) 7)
        ((char= n #\8) 8)
        ((char= n #\9) 9)
        ((char= n #\0) 0)))
(defun int-to-list (k)
  (mapcar #'parse-int-ex (concatenate 'list (format nil "~A" k))))
(let* ((n (read))
       (m (read))
       (lst (loop :repeat m :collect (read))))
  (defun f (k) (if (loop :for x :in (int-to-list k) :never (find x lst))
                   (princ k)
                   (f (1+ k))))
  (f n))

Measured memory_bytes: 57704
#include<stdio.h>
#define N 10

int main(){
  int i, j, n, ice, data[N];

  while(1){
    scanf("%d", &n);
    if(n == 0) break;

    for(i=0; i<N; i++)
      data[i] = 0;

    for(i=0; i<n; i++){
      scanf("%d", &ice);
      data[ice]++;
    }

    for(i=0; i<N; i++){
      if(data[i] == 0){
	printf("-\n");
      }else{
	for(j=0; j<data[i]; j++)
	  printf("*");
	printf("\n");
      }
    }
  }

  return 0;
}

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


void solve(long long a, long long b){
  cout << ((a * b % 2 == 1) ? "Odd" : "Even") << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long a;
  scanf("%lld",&a);
  long long b;
  scanf("%lld",&b);
    solve(a, b);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n, k, i, j, x, f, d[10]={};
	scanf("%d %d", &n, &k);
	while(k--){
		scanf("%d", &x);
		d[x]=1;
	}
	for(i=n;;i++){
		x=i;
		f=0;
		while(x){
			if(d[x%10/*1の位が嫌いな数字*/]){
				f=1;
				break;
			}
			x/=10;
		}
		if(f==0)
		break;
	}
	printf("%d\n", i);
	return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
int N, Q;
string s;
string t[200000], d[200000];
bool checkL(int idx) {
	for (int i = 0; i < Q; i++) {
		if (s[idx] == t[i][0]) {
			if (d[i] == "L") idx--;
			else idx++;
		}
		if (idx < 0) return 1;
		else if (idx >= N) return 0;
	}
	return 0;
}
bool checkR(int idx) {
	for (int i = 0; i < Q; i++) {
		if (s[idx] == t[i][0]) {
			if (d[i] == "L") idx--;
			else idx++;
		}
		if (idx < 0) return 0;
		else if (idx >= N) return 1;
	}
	return 0;
}
int main() {
	cin >> N >> Q;
	cin >> s;
	for (int i = 0; i < Q; i++) {
		cin >> t[i] >> d[i];
	}
	int L = -1, R = -1;
	if (checkL(0)) {
		int l = 0, r = N;
		while (r - l > 1) {
			int m = (l + r) / 2;
			if (checkL(m)) {
				l = m;
			}
			else {
				r = m;
			}
		}
		L = l;
	}
	if (checkR(N - 1)) {
		int l = -1, r = N - 1;
		while (r - l > 1) {
			int m = (l + r) / 2;
			if (checkR(m)) {
				r = m;
			}
			else {
				l = m;
			}
		}
		R = r;
	}
	int ans = N;
	if (L != -1) ans -= (L + 1);
	if (R != -1) ans -= N - R;
	cout << ans << endl;
}


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

int main() {
  int H, W;
  cin >> H >> W;
  
  // 0行目
  for (int i=0;i<=W+1;i++) {
    cout << '#';
  }
  cout << endl;
  
  // 1~H行目
  string S;
  for (int row=0;row<H;row++) {
    cin >> S;
    cout << '#' << S << '#' << endl;
  }
  
  // H+1行目
  for (int i=0;i<=W+1;i++) {
    cout << '#';
  }
  cout << endl;
  
}


Measured memory_bytes: 256
n = int(input())
w = [int(i) for i in input().split()]
weight = sum(w)
left = 0
div = weight
for j in range(n):
    left += w[j]
    if div < abs(weight - 2 * left):
        break
    div = abs(weight - 2 * left)
print(div)
    

Measured memory_bytes: 3060
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



vector<vector<ll>> dp;
vector<vector<ll>> edge;
vector<ll> A;

void merge(ll p,ll c){
    vector<ll> &ret=dp[p],&child=dp[c];
    vector<ll> P=dp[p];
    ret.resize(P.size()+child.size()-1);
    for(auto &i:ret){i=0;}
    for(int i=1;i<P.size();i++){
        for(int t=1;t<child.size();t++){
            ret[i+t]+=P[i]*child[t]%MOD;
            ret[i+t]%=MOD;
        }
    }
    for(int i=1;i<P.size();i++){
        ret[i]-=P[i]*child[0]%MOD;
        ret[i]%=MOD;
    }
    for(int i=1;i<ret.size();i++){ret[0]+=ret[i]*A[i]%MOD;}
    ret[0]%=MOD;
    if(ret[0]<0){ret[0]+=MOD;}
}

void dfs(ll w,ll p){
    dp[w]={0,1};
    for(auto &i:edge[w]){
        if(i==p){continue;}
        dfs(i,w);
        merge(w,i);
    }
}



int main(){
    ll n;
    cin>>n;
    A.resize(n+10,0);
    A[0]=1;
    for(int i=2;i<n+10;i++){
        A[i]=A[i-2]*(i-1);
        A[i]%=MOD;
    }
    edge.resize(n);
    dp.resize(n);
    for(int i=1;i<n;i++){
        ll x,y;
        cin>>x>>y;
        x--; y--;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }
    dfs(0,-1);
    dp[0][0]%=MOD;
    if(dp[0][0]<0){dp[0][0]+=MOD;}
    cout<<dp[0][0]<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 69376
N = int(input())
S = input()

l = 0 # max proven possible
r = N # min proven impossible
while l + 1 < r:
  x = (l + r) // 2
  first_loc = {}
  possible = False
  for i in range(N-x+1):
    #print(i, N-x, first_loc)
    sub = S[i:i+x]
    #print(sub)
    if sub in first_loc:
      if first_loc[sub] <= i - x:
        #print(sub, first_loc[sub], i, x, i-x)
        possible = True
        break
    else:
      first_loc[sub] = i
  if possible:
    l = x
  else:
    r = x
print(l)
      

Measured memory_bytes: 15164
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
#include <float.h>
#include <math.h>
#include <sstream>
#include <iterator>
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
const  long long INF = 1LL << 60;
typedef unsigned long long ll;
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 ctoi(char c) {
 	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}

bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された

    if(n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である

    // 6の倍数前後の数を使って試し割りをする
    for(unsigned i = 5; i * i <= n; i += 6) {
        if(n % i     == 0) return false; // (6の倍数)-1
        if(n % (i+2) == 0) return false; // (6の倍数)+1
    }

    return true;
}

map<ll,ll> mp;

auto findFactors(ll num){
	
    ll i;
    while (num % 2 == 0){ // 偶数の素数は2のみ
        if(mp.count(2)){
			mp[2] = mp[2] + 1;
		}
		else{
			mp[2] = 1;
		}
        num /= 2;
    }
    for (i = 3; i <= num; i++){ // 他の素数で割っていく
        while (num % i == 0){
			if(mp.count(i)){
			mp[i] = mp[i] + 1;
		}
		else{
			mp[i] = 1;
		}
            num /= i;
        }
    }
    return 0;
}

int main(){ 
int N; cin >> N;
vector<int> A(N);
rep(i,N) {
    int a;
    cin >> a;
    a--;
    A[i] = a;
}
set<int> s;
int x = 0;
int cnt = 0;
rep(i,N){
    x = A[x];
    if(x == 1){
       s.insert(1);
       cnt = i + 1;
       break; 
    }
}
if(! s.count(1)){
    cout << -1 << endl;
}
else{
    cout << cnt << endl;
}
}

Measured memory_bytes: 768
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        int res = n/(d*2+1);
        if (n%(d*2+1)!=0) {
            res++;
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 22996
def referee(text):
    if text[0] != "A":
        return "WA"

    if text[1] == "C":
        return "WA"

    if text[1].isupper():
        return "WA"

    Cnum = 0

    for i in range(2, len(text)):
        if (text[i] == "C"):
            Cnum += 1
            if Cnum > 1:
                return "WA"
            continue

        if (text[i].isupper()):
            return "WA"

    if (text[-1] == "C"):
        return "WA"

    if (Cnum == 0):
        return "WA"

    return "AC"


if __name__ == "__main__":
    a = input()
    print(referee(a))


Measured memory_bytes: 3064
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin >>s;
    map<char, int> mp;
    for(int i = 0; i < 4; i++)
        mp[s[i]]++;
    bool flag = true;
    for(auto ele : mp)
        if(ele.second != 2)
            flag = false;
    if(flag && mp.size() == 2)
        cout <<"Yes";
    else 
        cout <<"No";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 301
#define NAX 1000

int abc[MAX];
int fl[MAX];
int a,b,c;

void init(){
	int i;
	for(i=1;i<=a+b+c;i++){
		fl[i]=2;
	}
}

void check(int i,int j,int k){
	if(fl[i]==1 && fl[j]==1) fl[k]=0;
	else if(fl[j]==1 && fl[k]==1) fl[i]=0;
	else if(fl[i]==1 && fl[k]==1) fl[j]=0;
}

int main(void)
{
	int N;
	int l,q;
	int i,j,k,r;
	int ta[NAX],tb[NAX],tc[NAX];
	
	while(1){
	
	scanf("%d %d %d",&a,&b,&c);
	
	if(a==0 && b==0 && c==0) break;
	
	init();
	
	scanf("%d",&N);
	
	q=0;
	
	for(l=0;l<N;l++){
		scanf("%d %d %d %d",&i,&j,&k,&r);
		if(r==0){
			
			ta[q]=i;
			tb[q]=j;
			tc[q]=k;
			q++;
		}
		else{
			fl[i]=1;
			fl[j]=1;
			fl[k]=1;
		}
	}
	
	for(i=0;i<q;i++){
		check(ta[i],tb[i],tc[i]);
	}
	
	for(i=1;i<=a+b+c;i++){
		printf("%d\n",fl[i]);
	}
	
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <iostream>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

using namespace std;

template< typename Monoid >
struct SegmentTree {
  using F = function< Monoid(Monoid, Monoid) >;

  int sz;
  vector< Monoid > seg;

  const F f;
  const Monoid M1;

  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }

  template< typename C >
  int find_subtree(int a, const C &check, Monoid &M, bool type) {
    while(a < sz) {
      Monoid nxt = type ? f(seg[2 * a + type], M) : f(M, seg[2 * a + type]);
      if(check(nxt)) a = 2 * a + type;
      else M = nxt, a = 2 * a + 1 - type;
    }
    return a - sz;
  }


  template< typename C >
  int find_first(int a, const C &check) {
    Monoid L = M1;
    if(a <= 0) {
      if(check(f(L, seg[1]))) return find_subtree(1, check, L, false);
      return -1;
    }
    int b = sz;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) {
        Monoid nxt = f(L, seg[a]);
        if(check(nxt)) return find_subtree(a, check, L, false);
        L = nxt;
        ++a;
      }
    }
    return -1;
  }

  template< typename C >
  int find_last(int b, const C &check) {
    Monoid R = M1;
    if(b >= sz) {
      if(check(f(seg[1], R))) return find_subtree(1, check, R, true);
      return -1;
    }
    int a = sz;
    for(b += sz; a < b; a >>= 1, b >>= 1) {
      if(b & 1) {
        Monoid nxt = f(seg[--b], R);
        if(check(nxt)) return find_subtree(b, check, R, true);
        R = nxt;
      }
    }
    return -1;
  }
};

int N, Q;
std::string S;

int main()
{
  std::cin >> N >> S;

  SegmentTree<int> seg( N, []( int v1, int v2 ) {
    return v1 | v2; 
  }, 0 );

  rep( i, N )
  {
    seg.update( i, 1<<(S[i]-'a') );
  }

  scanf( "%d", &Q );

  rep( i, Q )
  {
    int t;
    scanf( "%d", &t );

    if( t == 1 )
    {
      int k;
      char c[2];

      std::cin >> k >> c;

      int v = 1<<(c[0]-'a');

      seg.update( k-1, v );
    }
    else
    {
      int l, r;
      std::cin >> l >> r;

      int state = seg.query( l-1, r );
      int ans = 0;

      rep( ch, 26 ) if( state >> ch & 1 )
        ++ans;

      std::cout << ans << std::endl;
    }
  }

  return 0;
}

Measured memory_bytes: 4996
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("in.txt");ofstream coutt("out.txt");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Use __builtin_popcountll for ll;
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 

signed main(){
    FASTER;
    int a;cin>>a;
    cout<<a+a*a+a*a*a;
}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




int main(){
  ll n;
  cin>>n;

  vector<ll> p(n);
  rep(i,n){
    cin>>p[i];
  }

  ll ans=1;
  vector<ll> q={0,0,0};
  rep(i,n){
    int cnt=0;
    int memo;
    rep(j,3){
      if(p[i]==q[j]) {
        cnt++;
        memo=j;
      }
    }
    if(cnt==0){
      cout << 0 << endl;
      return 0;
    }
    ans*=cnt;
    ans%=mod;
    q[memo]++;
  }

  cout << ans << endl;
}

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

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


signed main(){
    int a, b, q;
    cin >> a >> b >> q;
    vector<i64> s(a+2), t(b+2), x(q);
    for(int i = 0; i < a; ++i)
        cin >> s[i+1];
    for(int i = 0; i < b; ++i)
        cin >> t[i+1];
    for(int i = 0; i < q; ++i)
        cin >> x[i];
    s[0] = t[0] = -1e15;
    s[a+1] = t[b+1] = 1e15;

    for(int i = 0; i < q; ++i){
        i64 ans = INF;
        auto ls = lower_bound(s.begin(), s.end(), x[i]);
        auto lt = lower_bound(t.begin(), t.end(), x[i]);
        i64 xb = *prev(ls);
        i64 yb = *prev(lt);
        i64 xf = *ls;
        i64 yf = *lt;
        i64 dxb = x[i] - xb;
        i64 dyb = x[i] - yb;
        i64 dxf = xf - x[i];
        i64 dyf = yf - x[i];

        chmin(ans, max(dxb, dyb));
        chmin(ans, max(dxf, dyf));
        chmin(ans, dxb + dyf + min(dxb, dyf));
        chmin(ans, dxf + dyb + min(dxf, dyb));
        cout << ans << endl;
    }
}


Measured memory_bytes: 5568
#include <cmath>
#include <fstream>
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

#define REP(i, x, n) for(int i = x, i##_len=(n); i < i##_len; i++)
#define rep(i,n) REP(i,0,n)
#define PRI(p) cout<<(p)<<endl;
//#define DEBUG 3

void run() {
	int a, b, c;
	cin >> a >> b >> c;
	int sum = a + b + c;
	bool is_half = false;
	if (sum == a * 2) is_half = true;
	if (sum == b * 2) is_half = true;
	if (sum == c * 2) is_half = true;

	PRI(is_half ? "Yes" : "No");
}

int main() {
#ifdef DEBUG
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
	rep(i, DEBUG) {
		cout << "--------------: i=" << i << endl;
		run();
	}
#else
	run();
#endif
	return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define int long long
using namespace std;


int dp[405][405];
int pre[405];
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
// #ifndef ONLINE_JUDGE
//    freopen ("INPUT.txt" , "r" , stdin);
//    freopen ("OUTPUT.txt" , "w" , stdout);
// #endif

    clock_t clk;
	clk = clock();

// --------------Code starts here---------------------------------------------------------------------

    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        pre[i]=a[i]+pre[i-1];
    }

    fill_n(&dp[0][0],405*405,1e17);

    for (int i = 1; i <=n; i++)
    {
        dp[i][i]=0;
    }
    
    for(int j=1;j<=n;j++)
        for(int i=j-1;i>=1;i--)
            for(int k=i;k<j;k++)
                dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+pre[j]-pre[i-1]);

        cout<<dp[1][n];

// -------------------------------------Code ends here------------------------------------------------------

    clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  int N;
  string S;
  cin >> N >> S;
  
  int ans = 0;
  
  repi(i,1,N-2) {
    string X = S.substr(0,i);
    string Y = S.substr(i);
    
    set<char> st;
    for (char c : X) {
      if (count(all(Y),c)) {
        st.insert(c);
      }
    }
    ans = max(ans, (int)st.size());
  }
  
  cout << ans << endl;
}

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

int main(){
  int N;
  cin >> N;
  int data[N];
  for(int i = 0;i<N;i++){
    cin >> data[i];
  }
  int ret = 0;
  for(int i = 0;i < N ;i++){
    if(i == 0){
      ret++;
      continue;
    }
    else{
      bool flag = true;
      for(int j=0;j < i;j++){
        if(data[j] > data[i]){
          flag = false;
        }
      }
      if(flag == true){
        ret++;
      }
    }
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
// Nurbakyt Madibek
// Look at my code! IT'S AWESOME

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <unordered_set>

using namespace std;

#define pb push_back
#define pp pop_back
#define f first
#define s second
#define mp make_pair
#define sz(a) (int)((a).size())
#ifdef _WIN32
#  define I64 "%I64d"
#else
#  define I64 "%lld"
#endif
#define fname "."

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pi;
typedef pair < int, ull > pu;
typedef pair < ll, ll > pl;

const int inf = (int)1e9 + 123;
const ll infl = (ll)1e18 + 123;
const double eps = 1e-9;

const int MAX_N = (int)1e5 + 5;
const int mod = (int)1e9 + 7;

int n;
int a[MAX_N], b[MAX_N];

vector < int > g[MAX_N];

bool u[MAX_N];

pi dfs(int v) {
    pi res = mp(1, sz(g[v]));
    u[v] = 1;
    for (auto to : g[v])
        if (!u[to]) {
            pi now = dfs(to);
            res.f += now.f, res.s += now.s;
        }
    return res;
}

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++)
        scanf("%d", &b[i]);
    a[0] = b[0] = 0;
    for (int i = 1; i <= n; i++)
        a[0] ^= a[i], b[0] ^= b[i];
    multiset < int > f, s;
    for (int i = 0; i <= n; i++)
        f.insert(a[i]), s.insert(b[i]);
    if (f != s) {
        puts("-1");
        return 0;
    }
    vector < int > q;
    for (int i = 0; i <= n; i++)
        q.pb(a[i]);
    sort(q.begin(), q.end());
    q.resize(unique(q.begin(), q.end()) - q.begin());
    for (int i = 0; i <= n; i++) {
        a[i] = (int)(lower_bound(q.begin(), q.end(), a[i]) - q.begin());
        b[i] = (int)(lower_bound(q.begin(), q.end(), b[i]) - q.begin());
    }
//    for (int i = 0; i <= n; i++)
//        cout << a[i] << ' ';
//    cout << endl;
//    for (int i = 0; i <= n; i++)
//        cout << b[i] << ' ';
//    cout << endl;
    for (int i = 0; i <= n; i++) {
        if (a[i] != b[i]) {
            g[a[i]].pb(b[i]);
            g[b[i]].pb(a[i]);
        }
    }
    int ans = 0;
    for (int i = 0; i <= n; i++) {
        if (!u[a[i]]) {
            pi now = dfs(a[i]);
            now.s /= 2;
            if (now.f == 1)
                continue;
            if (i != 0)
                ans += now.s + 1;
            else {
                if (a[i] != b[i])
                    ans += now.s - 1;
                else
                    ans += now.s;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 20988
# include <stdio.h>

int main(){
    int areia, temp;
    
    scanf("%d %d", &areia, &temp);
    
    if (areia > temp)
        printf("%d\n", areia - temp);
    if (temp > areia || temp == areia){
        printf("0\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1D(V,T,a) vector<T> V (a)
#define MAT2D(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3D(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

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; }

string to_string(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>::reference b) { return to_string(bool(b)); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(vector<vector<A>> v) { string res; for(const auto &x : v) {res+="\n ";res += to_string(x);} return res;}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,L;
  cin >> N >> L;

  if (L > 0) {
    cout << L * (N-1) + N * (N-1) / 2 << endl;
  } else if (L < -(N-1)){
    cout << L * (N-1) + (N-1) * (N-2) / 2 << endl;
  } else {
    cout << L * N + (N) * (N-1) / 2 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	ret := ""
	for _, v := range s {
		if v == '0' || v == '1' {
			ret += string(v)
		}
		if v == 'B' && len(ret) > 0 {
			ret = ret[:len(ret)-1]
		}
	}
	fmt.Println(ret)
}


Measured memory_bytes: 512
/***********************************************************
 *This code By @1353055672(Ligen)                          *
 *[Warning]You're not excepted to understand this code!    *
 *NOIP 2019 RP++                                      *
 ***********************************************************/
#pragma GCC optimize(3)
#define ADD_STACK int size = 512 << 20;\
    char *p = (char*)malloc(size) + size;  \
    __asm__("movl %0, %%esp\n" :: "r"(p))
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<bitset>
#include<ctime>
#include<vector>
#define ll long long
#define ull unsigned long long
#define mn 200020
#define Max(x,y) ((x>y)?x:y)
#define Min(x,y) ((x<y)?x:y)
#define Abs(x) (((x)<(0))?(-(x)):(x))
#define infll (ll)(1e18)
#define infint (int)(1<<30)
#define mod (int)(19260817)
#define FOR(a,b,c) for (register int a=b;a<=c;a++)
#define FORD(a,b,c) for (register int a=b;a>=c;a--)
using namespace std;
//char buf[1<<20],*p1=buf,*p2=buf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
inline int read(){
    int x=0,f=1;char c;
    for(c=getchar();c<'0'||c>'9';f=((c=='-')?-1:f),c=getchar());
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=getchar());return x*f;
}
template<typename T>
inline void write(T a){
    if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int h=0;
    while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
}
inline void write_(){return;}
template<typename T,typename... Args>
inline void write_(T a,Args... b){write(a);putchar(' ');write_(b...);}
inline void writeln(){putchar('\n');return;}
template<typename T,typename... Args>
inline void writeln(T a,Args... b){write(a);putchar(' ');writeln(b...);}
//need c++11

//inline void write(ll a){
//    if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int h=0;
//    while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
//}
//inline void write_(ll a){write(a);putchar(' ');}
//inline void writeln(ll a){write(a);putchar('\n');}
inline ll gcd(ll a,ll b){return a==0?b:gcd(b%a,a);}
inline ll lcm(ll a,ll b){return 1ll*a/gcd(a,b)*b;}
inline ll Pow(ll n,ll a){ll b=1;while(a){if(a&1)b=1ll*b*n%mod;n=1ll*n*n%mod;a>>=1;}return b;}
//---------------------Head Files--------------------------//

signed main(){
    int n=read(),m=read();
    writeln((n*3+m)/2);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

long long gcd(long long a, long long b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

// Returns LCM of array elements

long long findlcm(vector<long long> arr, int n)
{
    // Initialize result
    long long ans = arr[0];

    // ans contains LCM of arr[0], ..arr[i]
    // after i'th iteration,
    for (int i = 1; i < n; i++){
        ans = (((arr[i] * ans)) /
               (gcd(arr[i], ans)));
    }

    return ans;
}

int main() {
    long n,m;
    cin >> n >> m;
    vector<long long> a(n);
    long long gc = 2;
    int p  = 0;
    for(auto &i : a){
        cin >> i;
        long long k = i;
        if(k % gc == 0){
           
            k = k / gc;
            while(k % 2 == 0){
                if(p > 0){
                    cout << 0 << endl;
                    return 0 ;
                }
                k = k/ 2;
                gc*=2;
            }
        }else{
            cout << 0;
            return 0;
        }
        p++;
    }
    gc = gc/2;
    for(auto &i: a){
        i = i/gc;
    }
    m = m / gc ;

    long long lcm = findlcm(a,a.size());
    if(lcm % 4 == 0){
        lcm = 0/0;
        cout << 0 << endl;
        return 0;
    }
    long long mx = lcm/2;

    long long x = m / mx;
    x -= x/2;
    cout << x << endl;



    return 0;
}



Measured memory_bytes: 4400
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

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

	int N = scan.nextInt();

	Integer[] a_ = new Integer[N];
	for(int i = 0; i < N; i++){
	    a_[i] = scan.nextInt();
	}

	Arrays.sort(a_, Comparator.reverseOrder());

	int point = 0;
	for(int i = 0; i < N; i++){
	    if(i % 2 == 0){
		point += a_[i];
	    }else{
		point -= a_[i];
	    }
	}

	System.out.println(point);
    }
}


Measured memory_bytes: 21588
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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 ll INF=1e9+7;

int main()
{
    ll n;
    cin >> n;
    vector<vector<ll>> g(n);
    rep(i,n-1){
        ll x;
        cin >> x;
        x--;
        g[x].push_back(i+1);
    }
    rep(i,n){
        cout << g[i].size() << endl;
    }
    return 0;
} 

Measured memory_bytes: 13992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N, M;
int a[100010], b[100010];
pii v[100010];

int check(int i, int s) {
  auto lb = lower_bound(v, v + M, pii(i + 1, i - s + 1));
  return (lb->first == i + 1 && lb->second >= i - s + 1 && lb->second <= i);
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    v[i] = pii(b[i], a[i]);
  }
  sort(v, v + M);
  int s = 1, ans = 0;
  for (int i = 0; i < N - 1; i++) {
    if (check(i, s)) ans++, s = 1;
    else s++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1920
arr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split('')
n = gets.to_i
s = gets.chomp.split('')
map = {}
arr.each_with_index do |a, i|
  map[a] = arr[(i + n) % arr.count]
end
s.each do |a|
  print map[a]
end
puts

Measured memory_bytes: 2556