akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N;
    cin >> N;
    pii ba[200000];
    REP(i, N) {
        int a, b;
        cin >> a >> b;
        ba[i] = {b, a};
    }
    sort(ba, ba + N);

    ll time = 0;
    REP(i, N) {
        if (ba[i].second + time <= ba[i].first) {
            time += ba[i].second;
        } else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		//int n = sc.nextInt();
		String s = sc.next();
		String t = sc.next();		
		//long n = sc.nextLong();
		//double n = sc.nextDouble();
		int sum = 0;
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i)!=t.charAt(i)) {
				sum++;
			}
		}

		//System.out.println("Yes");
		System.out.println(sum);
	

	}
}



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

int main() {
  int X,sum,s;
  cin >> X;
  sum = 0;
  s = X;
  for(int i = 0;i < 8;i++)
  {
  	sum += s % 10;
  	s /= 10;
  }
  if(sum == 0)
  {
  	cout << "No" << endl;
  }
  else
  {
  	if(X % sum == 0)
  	{
  		cout << "Yes" <<endl;
  	}
  	else
  	{
      cout << "No" << endl;
  	}
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 100009;
ll n;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n;
    if(n & 1) cout<<(n / 2) * (n / 2 + 1);
    else
        cout<<(n / 2) * (n / 2);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>

int main() {
    long long n, a, b;

    std::cin >> n >> a >> b;
    std::vector<long long> v(n);

    for (int i = 0; i < n; i++) {
        std::cin >> v[i];
    }

    long long ans = 0;

    for (int i = 1; i < n; i++) {
        if ((v[i] - v[i - 1]) * a <= b) {
            ans += (v[i] - v[i - 1]) * a;
        } else {
            ans += b;
        }
    }

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

Measured memory_bytes: 1024
n = int(input())
s = input()

ans = float('inf')
w_left = [0]*n
e_right = [0]*n

for i in range(1,n):
  if s[i-1] == 'W':
    w_left[i] = w_left[i-1]+1
  else :
    w_left[i] = w_left[i-1]
      
for i in range(1,n):
  if s[n-i] == 'E':
    e_right[n-i-1] = e_right[n-i]+1
  else :
    e_right[n-i-1] = e_right[n-i]

for i in range(n):
    if ans > w_left[i]+e_right[i]:
        ans = w_left[i]+e_right[i]
print(ans)

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

typedef long long lint;

const int MAXN = 200010;
const int MOD = 998244353;

char X[MAXN];
int cnt[MAXN];
int two;

void addm(int &a, int b) {
	a += b;
	if(a >= MOD) a -= MOD;
}

void mnsm(int &a, int b) {
	a += MOD - b;
	if(a >= MOD) a -= MOD;
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int N;
	cin >> N >> X;
	
	int K, M;
	for(K = 0; N % (1 << K) == 0; K++);
	K--;
	M = N >> K;
	two = 1;
	for(int i = 1; i <= K + 1; i++) two = two * 2 % MOD;

	int ans = 0;
	vector<int> v;
	for(int i = 1; i * i <= M; i++) if(M % i == 0) {
		v.push_back(i);
		if(i * i != M) v.push_back(M / i);
	}
	sort(v.begin(), v.end());
	for(auto a : v) {
		for(int i = 0; i < (a << K); i++) cnt[a] = (cnt[a] * 2 + X[i] - '0') % MOD;
		bool b = false;
		for(int i = 0; i < N; i++) {
			int k = X[i % (a << K)] - '0';
			if(i / (a << K) % 2 == 1) k = 1 - k;
			if(k < X[i] - '0') break;
			if(k > X[i] - '0') {
				b = true;
				break;
			}
		}
		if(!b) cnt[a]++;
		for(auto aa : v) if(aa < a && a % aa == 0) mnsm(cnt[a], cnt[aa]);
		addm(ans, (lint)cnt[a] * a % MOD * two % MOD);
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int N, M, X, Y, tmp;
    vector<int> x, y;
    cin >> N >> M >> X >> Y;
    for(int i = 0; i < N; i++){
        cin >> tmp;
        x.push_back(tmp);
    }
    for(int i = 0; i < M; i++){
        cin >> tmp;
        y.push_back(tmp);
    }
    bool war = false;
    if(Y <= X){
        war = true;
    }
    if(!war){
        int max = *max_element(x.begin(), x.end());
        int min = *min_element(y.begin(), y.end());
        if(min <= max) war = true;
        else if(min <= X) war = true;
        else if(Y <= max) war = true;
    }
    if(war) cout << "War" << endl;
    else cout << "No War" << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
	
	private static BufferedReader br;
	private static StringTokenizer tokenizer;
	public static String next() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null)
                throw new IOException();
            tokenizer = new StringTokenizer(line);
        }
        return tokenizer.nextToken();
    } 
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    } 
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    } 
    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
    
	public static void main(String[] args) throws IOException {		
		
		br = new BufferedReader(new InputStreamReader(System.in));
		int h = nextInt();
		int a = nextInt();
		int ans = h/a;
		ans += h%a==0 ? 0:1;
		System.out.println(ans);
	}
}






















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

int main(){
  
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  for(int i = 0;i < N;i++){
    if(i%2!=0){
        vec.at(i) = (-1) * vec.at(i);
    }
  }
  cout << accumulate(vec.begin(),vec.end(),0)<< endl;


}




Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	string s1,s2;
	cin >> s1;
	if(cin.eof()) break;
	cin >> s2;
	int ans = 0;
	int h = s1.size()+1;
	int l = 0;
	int m = (h+l)/2;
	REP(i,20){
	    bool flg = false;
	    set<string> ss;
	    REP(i,s1.size()-m+1){
		ss.insert(s1.substr(i,m));
	    }

	    REP(i,s2.size()-m+1){
		if(ss.find(s2.substr(i,m)) != ss.end()){
		    flg = true;
		}
	    }
	    if(flg){
		l = m;
//		printf("m = %d\n",m);
	    }else{
		h = m;
	    }
	    m = (h+l)/2;
	}
	cout << m << endl;

    }
    return 0;
}

Measured memory_bytes: 5280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const int INF=1<<30,MOD=1000000007;
const ll LINF=1ll<<60;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPARR(i,v) for(int i=0;i<v.size();++i)
#define all(v) (v).begin(),(v).end()
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define bit(n) (1ll<<(n))
template<class T>bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"":"im")<<"possible"<<endl
#define Poss(n) cout<<((n)?"P":"Imp")<<"ossible"<<endl
template<typename T>ostream&operator<<(ostream&o,const vector<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<typename T>ostream&operator<<(ostream&o,const set<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T,typename U>ostream&operator<<(ostream&o,const pair<T,U>&v){o<<v.first<<' '<<v.second;return o;}

int main(){
    vi n(4);
    vi N({1,4,7,9});
    REP(i,4)cin>>n[i];
    sort(all(n));
    YES(n==N);
    
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] input = br.readLine().split(" ");
    int n = Integer.parseInt(input[0]);
    int x = Integer.parseInt(input[1]);
    int t = Integer.parseInt(input[2]);
    br.close();
    System.out.println((x + n - 1) / x * t);
  }
}

Measured memory_bytes: 32704
N = int(input())
S = []
for i in range(N):
    S.append(input())

d = {
    'AC': 0,
    'WA': 0,
    'TLE': 0,
    'RE': 0,
}

for s in S:
    d[s] += 1

print(f"AC x {d['AC']}\nWA x {d['WA']}\nTLE x {d['TLE']}\nRE x {d['RE']}")


Measured memory_bytes: 16208
import java.util.Scanner;

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

    String str = scanner.nextLine();
    String sup;
    char Ans[] = new char[10000];


    for(int i=0;i<str.length();i++){
      sup = String.valueOf(str.charAt(i));
      if(Character.isUpperCase(str.charAt(i))){
        Ans[i] = Character.toLowerCase(str.charAt(i));
      }else if(Character.isLowerCase(str.charAt(i))){
      Ans[i] = Character.toUpperCase(str.charAt(i));
      }else{
        Ans[i] = str.charAt(i);
      }
    }

    for(int i=0;i<str.length();i++){
      System.out.print(Ans[i]);
    }

    System.out.println();

  }
}



Measured memory_bytes: 26984
#include<iostream>
using namespace std;
int main(){int n,f=0;while(1){int m[501]={};cin>>n;if(n==0) break;cin>>m[10]>>m[50]>>m[100]>>m[500];if(f==1) cout<<endl;n=m[500]*500+m[100]*100+m[50]*50+m[10]*10-n;m[500]-=n/500,n%=500,m[100]-=n/100,n%=100,m[50]-=n/50,n%=50,m[10]-=n/10;for(int i=10;i<=500;i+=10) if(m[i]>0) cout<<i<<" "<<m[i]<<endl;f=1;}return 0;}

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

int main() {
	int N, a, n[10][100];
	char c;

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> c >> a;

		if (c == 'S')
			n[0][a] = a;

		else if (c == 'H')
			n[1][a] = a;

		else if (c == 'C')
			n[2][a] = a;

		else if (c == 'D')
			n[3][a] = a;
	}

	for (int i = 1; i <= 13; i++) {
		if (n[0][i] != i)
			cout << 'S' << ' ' << i << endl;
	}
	for (int i = 1; i <= 13; i++) {
		if (n[1][i] != i)
			cout << 'H' << ' ' << i << endl;
	}
	for (int i = 1; i <= 13; i++) {
		if (n[2][i] != i)
			cout << 'C' << ' ' << i << endl;
	}
	for (int i = 1; i <= 13; i++) {
		if (n[3][i] != i)
			cout << 'D' << ' ' << i << endl;
	}
	return 0;
}

Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
int32_t main()
{
   int x,y;
   cin>>x>>y;
   vector<string> s;
   for(int i=0;i<x;i++)
   {
       string t;
       cin>>t;
       if(count(t.begin(),t.end(),'.')!=t.size())
       s.push_back(t);
   }
     char a[s.size()][s[0].size()];
     int allow[s[0].size()];
     for(int i=0;i<=s[0].size();i++)
     allow[i]=0;

     for(int i=0;i<s.size();i++)
     for(int j=0;j<s[0].size();j++)
     a[i][j]=s[i][j];

   
     for(int j=0;j<s[0].size();j++)
      for(int i=0;i<s.size();i++)
     if(a[i][j]=='.')allow[j]++;
    //  for(auto i:allow)
    //  cout<<i<<" ";
    //  cout<<endl;
     for(int i=0;i<s.size();i++){
     for(int j=0;j<s[0].size();j++)
     {
         if(allow[j]==s.size())continue;
         cout<<a[i][j];
     }
     cout<<endl;
     }

}

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


typedef long long int int64;

int cmp1(const void *p,const void *q)
{
    int64 ret = *(int64 *)q - *(int64 *)p;
    if(ret>0)return 1;
    else if(ret<0)return -1;
    else return 0;
}

int main() {
    int n, k,ll;
    int64 ans = 0;
    int i, j;

    int64 p[5010];
    int64 c[5010];
    int64 score=0;
    scanf("%d %d",&n,&k);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&(p[i]));
    }
    for(i=0;i<n;i++)
    {
        scanf("%lld",&(c[i]));
    }
    //roop回数を数える
    int roop[5010];
    for(i=0;i<n;i++)
    {
        int anum=i;
        j=0;
        while(j<n)
        {
            j++;
            anum=p[anum]-1;
            if(anum==i)
            {
                roop[i]=j;
                break;
            }
        }
        //printf("%d ",roop[i]);
    }


    i=0;
    j=0;
    //n*nのテーブルをつくる
    int64 num[5010]={0};
    int64 ansnum[5010]={0};
    //int64 candnum[5010]={0};
    //if(n<k)k=n;
    int kk=k;//破壊的なk
    for(i=0;i<n;i++)
    {
        if(n<kk)kk=n;
        for(j=0;j<kk;j++)num[j]=0;

        j=0;
        score=0;
        while(j<kk)
        {
            if(j==0)ll=p[i]-1;
            score+=c[ll];
            num[j]=score;
            ll=p[ll]-1;
            //if(j+1==k%n)modnum[i]=score;
            j++;
        }
        //printf("%lld ",num[kk-1]);
        if(num[roop[i]-1]>0)
        {
            int divnum=roop[i]-1;
            for(j=0;j<=divnum;j++)
            {
                if((k-1)%roop[i]+1>j)num[j]+=(num[divnum]*((int64)((k-1)/roop[i])));
                else num[j]+=(num[divnum]*((int64)((k-1)/roop[i])-1));
            }
            /*
            if(k%n==0)candnum[i]=num[divnum];
            else candnum[i]=num[divnum]*((int64)(k/divnum))+num[(k%divnum)-1];
             */
        }
        qsort(num,kk,sizeof(int64),cmp1);
        //printf("%lld\n",num[0]);
        ansnum[i]=num[0];
    }
    //for(i=0;i<n;i++)printf("%lld ",ansnum[i]);
    qsort(ansnum,n,sizeof(int64),cmp1);
    //qsort(candnum,n,sizeof(int64),cmp1);
    //printf("\n");
    //for(i=0;i<n;i++)printf("%lld ",candnum[i]);
    //if(candnum[0]>ansnum[0])ans=candnum[0];
    ans=ansnum[0];
    //if(ans<0)ans=0;
    printf("%lld",ans);
}


Measured memory_bytes: 1932
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 
using namespace std;
 
int dp[2020][11];
 
void solve(){
 int n,K,c,g;
 cin>>n>>K;
 vector<int> book[10],pr[10];
 ZERO(dp);
 FOR(i,n){
  cin>>c>>g;
  g--;
  book[g].pb(c);
 }
 FOR(i,10) sort(ALL(book[i]),greater<int>());
 FOR(i,10){
  int tot=0;
  pr[i].pb(0);
  FOR(j,book[i].size()){
   tot+=book[i][j];
   pr[i].pb(tot+j*(j+1));
  }
 }
 for(int i=K;i>=0;i--){
  for(int j=9;j>=0;j--){
   FOR(k,pr[j].size()){
    if(i+k<=K) dp[i][j]=max(dp[i][j],dp[i+k][j+1]+pr[j][k]);
    else break;
   }
  }
 }
 cout<<dp[0][0]<<endl;
}
 
int main(){
 solve();
 return 0;
}

Measured memory_bytes: 3192
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>


int main(void)
{
	//変数の宣言
	
	char s[100010];
	int i,j,k;
	int len;
	int alphabet[30];
	int abets[30];
	int flag=0;
	
	
	//データの読み込み
	scanf("%s",&s);
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	len=strlen(s);
	for(i=0;i<len;i++){
		for(j=0;j<26;j++){
			if(s[i]=='a'+j){
				if(abets[j]==0){
					alphabet[j]=1;
					abets[j]=i+1;
				}else{
					flag=j+1;
					break;
				}
			}else if(alphabet[j]==1){
				alphabet[j]=0;
			}else{
				abets[j]=0;
			}
//			printf("%c alphabet=%d,abets=%d\n",'a'+j,alphabet[j],abets[j]);
		}
		if(flag!=0){
			printf("%d %d",abets[j],i+1);
			return 0;
		}
	}
	
	
	
//	printf("計算部分終了\n");
	
	//出力
	
	
	printf("-1 -1");
	
	
//	printf("結果の出力終了\n");
	
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    string s, ss;
    int l = 0;
    cin>>s;
    int len = s.size();
    for(int i = 0; i < len; i++){
        if(s[i] == '0')ss[l++] = '0';
        else if(s[i] == '1')ss[l++] = '1';
        else if(s[i] == 'B' && l!=0)l--;
    }
    for(int i = 0; i < l; i++)printf("%c", ss[i]);



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16000000")
using namespace std;

typedef long long ll;

const int Maxn = 5005;
const int mod = 1000000007;

int fac[Maxn];
int n;
vector <int> neigh[Maxn];
int siz[Maxn];
int dp[Maxn][Maxn][2];
int res;

void Traverse(int v, int p = 0)
{
	dp[v][1][0] = 1; siz[v] = 1;
	for (int i = 0; i < neigh[v].size(); i++) {
		int u = neigh[v][i];
		if (u == p) continue;
		Traverse(u, v);
		for (int j = siz[v]; j > 0; j--) {
			int cur[2] = {dp[v][j][0], dp[v][j][1]};
			dp[v][j][0] = dp[v][j][1] = 0;
			for (int k = 0; k < 2; k++) if (cur[k]) {
				for (int z = 1; z <= siz[u]; z++)
					for (int c = 0; c < 2; c++) if (dp[u][z][c]) {
						int nj = j + z;
						int nk = (k + c) % 2;
						dp[v][nj][nk] = (dp[v][nj][nk] + ll(cur[k]) * dp[u][z][c]) % mod;
						if (z % 2 == 0) {
							int nways = ll(cur[k]) * fac[z] % mod;
							int nk = (k + c + 1) % 2;
							dp[v][j][nk] = (dp[v][j][nk] + ll(nways) * dp[u][z][c]) % mod;
						}
					}
			}
		}
		siz[v] += siz[u];
	}
}

int main()
{
	fac[0] = 1;
	for (int i = 2; i < Maxn; i += 2)
		fac[i] = ll(i - 1) * fac[i - 2] % mod;
	scanf("%d", &n);
	for (int i = 0; i < n - 1; i++) {
		int a, b; scanf("%d %d", &a, &b);
		neigh[a].push_back(b);
		neigh[b].push_back(a);
	}
	Traverse(1);
	for (int j = 2; j <= n; j += 2) {
		int ways = fac[j];
		res = (res + ll(ways) * dp[1][j][0]) % mod;
		res = (res - ll(ways) * dp[1][j][1] % mod + mod) % mod;
	}
	printf("%d\n", res);
	return 0;
}

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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  
  if(max(A,B)-min(B,A) < max(A,C)-min(C,A)){
    cout << "A" << endl;
  }
  else{
    cout << "B" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    int sum = n;
    for(int i = 0; i < n; i++) {
        int a;
        cin >> a;
        int roop = 1;
        while(roop * a + 1 <= d) {
            sum++;
            roop++;
        }
    }
    cout << sum + x << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100
 
int num;
int r[MAX];
int c[MAX];
int dp[MAX][MAX];

void matrixChainOrder();

int main(){

  int i;

  scanf("%d", &num);

  for(i = 0; i < num; i++){ 

    scanf("%d %d", &r[i], &c[i]);

  }

  matrixChainOrder();

  printf("%d\n", dp[0][num - 1]);

  return 0;

}


void matrixChainOrder(){

  int i, j, k, cost;
  
  for(i = 0; i < num; i++){ 
   
    for(j = 0; j < num; j++){
 
      dp[i][j] = 100000000;

    }
  }

  for(i = 0; i < num; i++){ 
    
    dp[i][i] = 0;

  }

  for(i = 1; i < num; i++){
    
    for(j = 0; (j + i)< num; j++){

      for(k = 0; k < i; k++){

        cost = dp[j][j + k] + dp[j + k + 1][j + i] + r[j] * c[j + k] * c[j + i];

        if(dp[j][j+i] > cost)
	  dp[j][j+i] = cost;

      }

    }

  }

}

Measured memory_bytes: 636
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+9;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL my_pow(LL x, LL y){
	LL a=1;
	REP(i,y){
		a *= x;
		//a %= MOD;
	}
	//return a % MOD;
	return a;
}


void Main()
{
	LL n; cin >> n;
	if(n%2 == 1){
		cout << 0 << endl;
		return;
	}


	LL result = 0;
	LL bunbo = 10;
	while(n>=bunbo){
		result += n/bunbo;
		bunbo *= 5;
	}

	
	cout << result << endl;

	return;
}

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

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define tsort(v) sort((v).begin(), (v).end())
#define trev(v) reverse((v).begin(), (v).end())
#define siz(x) ((int)(x).size())
#define el "\n"
#ifdef LOCAL_tqk
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	lint n, cp, s = 0;
	cin >> n;
	cp = n;
	rep(i, 10) {
		s += n % 10;
		n /= 10;
	}
	if (cp%s)cout << "No\n";
	else cout << "Yes\n";
	gc();
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

int main() {
    int a, b, h;
    scanf("%d%d%d", &a, &b, &h);
    printf("%d\n", (a+b)*h/2);
}

Measured memory_bytes: 256
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
#include<list>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  string s,t;
  cin >> s >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end(),greater<char>() );
  if(s<t){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <algorithm>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define SREP(i,a,n)	for(int i=a;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define fst	first
#define scn second
#define bucnt(x)	__buildin__popcount(x)
#define debug(x)	cout<<"debug: "<<x<<endl

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;
const ld eps = 1e-9;
const int dx[] = { 0,1,0,-1 };
const int dy[] = { 1,0,-1,0 };

int main() {
	int n;	cin >> n;
	vint a(n);
	rep(i, n)	cin >> a[i];
	vint b(n);
	int left = 0, right = n - 1;
	rep(i, n) {
		if (i & 1)	b[right--] = a[n - i - 1];
		else	b[left++] = a[n - i - 1];
	}
	rep(i, n){
		cout << (i ? " " : "") << b[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3712
#include <iostream>
using namespace std;
#include <stdio.h>
int main (int argc, const char * argv[])
{
    int a,b;
    char op;   
    while(1){
        cin >> a >> op >> b;
        if(op == '?' ){
            break;
        }            
    
        else if( op == '+' ){
         
            cout << a+b <<endl;
        } else if ( op == '-' ){
           
            cout << a-b <<endl;
        } else if ( op == '*' ){
         
            cout<< a*b <<endl;
        } else  {
            cout<< a/b <<endl;
            
         
        }
    }
      // insert code here...
  //  std::cout << "Hello, World!\n";
    return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();
        int x = 0;
        int y = 0;
        x = ((n+a-1) / a) * b;
        y = ((n+c-1) / c) * d;
        if (x >= y) {
            System.out.println(y);
        } else {
            System.out.println(x);
        }
    }
}


Measured memory_bytes: 26304
import java.util.*;
import java.util.Map.Entry;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);

		HashMap<String, String> map1=new HashMap<String, String>();
		map1.put("A", "00000");
		map1.put("B", "00001");
		map1.put("C", "00010");
		map1.put("D", "00011");
		map1.put("E", "00100");
		map1.put("F", "00101");
		map1.put("G", "00110");
		map1.put("H", "00111");
		map1.put("I", "01000");
		map1.put("J", "01001");
		map1.put("K", "01010");
		map1.put("L", "01011");
		map1.put("M", "01100");
		map1.put("N", "01101");
		map1.put("O", "01110");
		map1.put("P", "01111");
		map1.put("Q", "10000");
		map1.put("R", "10001");
		map1.put("S", "10010");
		map1.put("T", "10011");
		map1.put("U", "10100");
		map1.put("V", "10101");
		map1.put("W", "10110");
		map1.put("X", "10111");
		map1.put("Y", "11000");
		map1.put("Z", "11001");
		map1.put(" ", "11010");
		map1.put(".", "11011");
		map1.put(",", "11100");
		map1.put("-", "11101");
		map1.put("'", "11110");
		map1.put("?", "11111");

		HashMap<String, String> map2=new HashMap<String, String>();
		map2.put("101", " ");
		map2.put("000000", "'");
		map2.put("000011", ",");
		map2.put("10010001", "-");
		map2.put("010001", ".");
		map2.put("000001", "?");
		map2.put("100101", "A");
		map2.put("10011010", "B");
		map2.put("0101", "C");
		map2.put("0001", "D");
		map2.put("110", "E");
		map2.put("01001", "F");
		map2.put("10011011", "G");
		map2.put("010000", "H");
		map2.put("0111", "I");
		map2.put("10011000", "J");
		map2.put("0110", "K");
		map2.put("00100", "L");
		map2.put("10011001", "M");
		map2.put("10011110", "N");
		map2.put("00101", "O");
		map2.put("111", "P");
		map2.put("10011111", "Q");
		map2.put("1000", "R");
		map2.put("00110", "S");
		map2.put("00111", "T");
		map2.put("10011100", "U");
		map2.put("10011101", "V");
		map2.put("000010", "W");
		map2.put("10010010", "X");
		map2.put("10010011", "Y");
		map2.put("10010000", "Z");

		for(; sc.hasNextLine();){
			String s=sc.nextLine();
			String t="";
			for(char c : s.toCharArray())
				t+=map1.get(c+"");
//			println(t);
			for(;;){
				boolean f=false;
				for(Entry<String, String> entry : map2.entrySet()){
					if(t.matches("\\D*"+entry.getKey()+"\\d*")){
						t=t.replaceFirst(entry.getKey(), entry.getValue());
//						println(t);
						f=true;
						break;
					}
				}
				if(!f)
					break;
			}
			t=t.replaceAll("\\d", "");
			println(t);
			// t.matches(regex)
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 2e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.141592653589793
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define input(x, n)for(ll i = 0; i <(ll)(n); i++)cin >> x[i];
#define until(i,n) for(ll i = 1; i <= (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << "=" << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl

int main(){

    ll k, s;
    cin >> k >> s;

    int ans = 0;

    for(ll i = 0; i <= k; i++){
        for(ll j = 0; j <= k; j++){
            if(s-i-j >= 0 && s-i-j <= k)ans++;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3588
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;

ll n;

int main()
{
	cin>>n;
	ll sum=0;
	ll tem;
//	cout<<__gcd(2,2)<<endl;
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=n;j++)
		{
//			cout<<"tem : "<<tem<<endl;
			for(ll k=1;k<=n;k++)
			{
				tem=__gcd(__gcd(i,j),k);
//				cout<<"tem : "<<tem<<endl;
				sum+=tem;
			}
		}
	}
	cout<<sum;
	return 0;
}

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

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        string ans = "No";
        if (inpt[2] >= inpt[0] && inpt[2] <= inpt[1])
        {
            ans = "Yes";
        }
        Console.WriteLine(ans);


    
    }




    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"






";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}

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

using namespace std;



int main(){
    
    int n;
    string s;
    cin>>n>>s;
    if(n&1) cout<<"No";
    else{
    	string a = s.substr(0,n/2);
    	string b = s.substr(n/2,n);
    	if(a!=b) cout<<"No";
    	else cout<<"Yes";
    }

    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int dp[3002][3002], sum[3002];
int R[3002];
char s[3002];
int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    scanf("%s", s+1);
    for(int i=1;i<=n;i++){
        if(s[i] == '1') sum[i]++;
        sum[i] += sum[i-1];
        R[i] = i;
    }
    for(int i=1;i<=m;i++){
        int l, r;
        scanf("%d%d", &l, &r);
        R[l] = max(R[l], r);
    }
    dp[1][0] = 1;
    int last = 0;
    for(int i=1;i<=n;i++){
        int add = 0;
        if(R[i] > last) add += sum[R[i]] - sum[last];
        last = max(last, R[i]);
        for(int j=0;j<=n;j++){
            if(dp[i][j] == 0) continue;

            int one = j + add;
            int zero = last-i+1 - one;

            if(one > 0){
                dp[i+1][one-1] = (dp[i+1][one-1] + dp[i][j])%mod;
            }
            if(zero > 0){
                dp[i+1][one] = (dp[i+1][one] + dp[i][j])%mod;
            }
        }
    }
    printf("%d\n", dp[n+1][0]);
}

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

using namespace std;
typedef long long ll;
ll t , n , k1 , k2 ,a , b, c, d, x, y, z, cntr , sum , ans ;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    ll arr[n+1];
    ll dams[n+1];
    for( int i=0;i<n; i++)
    {
        cin >> arr[i];
    }
    ll prv=0;
    ll start=0;
    for(ll i = 0 ; i < n;i++ )
    {
        prv=arr[i]-prv;
    }
    ll diff= prv/2 ;
    for(int i = 0 ; i < n ; i++)
    {
        cout << diff*2 << " ";
        diff=arr[i]-diff ;
    }
    //cout << ans;
    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define ll long long int
#define f(i,a,n) for(i=a;i<n;i++)
#define fast() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define test() ll tc;cin>>tc;while(tc--)

using namespace std;

/*ll fact(ll n);

ll comb(ll n, ll r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

ll fact(ll n)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
        res = ((res%mod * i%mod)%mod)%mod;
    return res;
}


ll power(ll x, ll y)
{
    ll temp;
    if( y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return temp*temp;
    else
        return x*temp*temp;
}

*/



int main()
{
        fast();
        ll n,i,k;
        cin>>n>>k;
        ll a[n];
        f(i,0,n)
        {
            cin>>a[i];
        }
        ll dp[n];
        for(ll i=0;i<n;i++)
        {

            dp[i]=INT_MAX;
        }
        dp[0]=0;
        for(ll i=1;i<n;i++)
        {
            for(ll j=0;j<k;j++)
            {
                if(j>n-1)
                {
                    break;
                }
                dp[i+j]=min((abs(a[i+j]-a[i-1])+dp[i-1]),dp[i+j]);
            }

        }
        cout<<dp[n-1];



        return 0;
}


Measured memory_bytes: 1792
use strict;
use warnings;

my $input = <>;
chomp $input;

my $rev = reverse $input;
my @input_array = split "", $input;
my @rev_array   = split "", $rev;

my $count = 0;
for (0..$#input_array) {
    if ( $input_array[$_] ne $rev_array[$_] ) {
        $count++;
    }
}
print $count / 2; 


Measured memory_bytes: 640
import numpy as np

n = int(input())
aaa = np.fromiter(map(int, input().split()), np.int64)

all_x = np.bitwise_xor.reduce(aaa)
mask = ~all_x
bbb = aaa & mask

ans = 0
while any(bbb):
    a = bbb.max()
    b = 1 << (int(a).bit_length() - 1)
    bbb[bbb & b > 0] ^= a
    if ans & b == 0:
        ans ^= a

print(2 * ans + all_x)


Measured memory_bytes: 22792
import bisect
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
Bpatan=[0]*N
Bpatan[0]=bisect.bisect_left(A,B[0])*(N-bisect.bisect_right(C,B[0]))
for i in range(1,N):
    Bpatan[i]=Bpatan[i-1]+bisect.bisect_left(A,B[i])*(N-bisect.bisect_right(C,B[i]))
print(Bpatan[N-1])

Measured memory_bytes: 23360
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MOD2=998244353;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll n,a,b;
  cin >> n >> a >> b;
  if((b-a)%2==0){
    cout << "Alice" << endl;
  }
  else{
    cout << "Borys" << endl;
  }
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, X, Y = map(int, rl().split())
    X -= 1
    Y -= 1
    
    ans = [0] * N
    for i in range(N - 1):
        for j in range(i + 1, N):
            ans[min(j - i, abs(X - i) + 1 + abs(j - Y), abs(Y - i) + 1 + abs(j - X))] += 1
    print('\n'.join(map(str, ans[1:])))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 42096
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<set>
#include<map>

using namespace std;
long long MOD = 1000000007LL;
const double PI = 3.14159265358979323846;
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define endl "\n"



int main() {
	int N;
	cin >> N;
	vector<long long> vec(N);
	for (int i = 0; i < N; ++i) {
		cin >> vec[i];
	}

	sort(vec.rbegin(), vec.rend());
	if (vec[vec.size() - 1] == 0) {
		cout << 0 << endl;
		return 0;
	}

	long long pA = 1;

	for (int i = 0; i < N; ++i) {
		if (1000000000000000000 / vec[i] < pA && 2 <= vec[i]) {
			cout << -1 << endl;
			return 0;
		}
		pA *= vec[i];
	}

	cout << pA << endl;

	return 0;
}




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

using namespace std;

typedef long long ll;

#define faster ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

#define endl "\n"

int main()
{
	faster;
	
	int n,k;
	cin >> n >> k;
	multiset<int> p;

	for(int i = 0; i < n; i++){
		int input;
		cin >> input;
		p.insert(input);
	}

	int i = 0,sum=0;
	auto ps = p.begin();
	while(++i <= k){
		sum += *ps;
		ps++;
	}

	cout << sum << endl;
	
	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>

#define N 100
 
int main(){
  int i, j, count, A[N], key;
  scanf("%d", &count);

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

  for(j = 0; j < count-1; j++){
      printf("%d ",A[j]);
    }

    printf("%d\n", A[count-1]);

  for(i = 1; i < count; i++){
    key = A[i];
    j = i-1;
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
      A[j+1] = key;
    }

    for(j = 0; j < count-1; j++){
      printf("%d ",A[j]);
    }
    printf("%d\n", A[count-1]);
  }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF 2e9
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

int main()
{
	int n;
	cin >> n;
	cout << 2 * n * acos(-1) << endl;

	return 0;
}


Measured memory_bytes: 3752
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
int N;
int u[150005], v[150005];
vector<int> Adj[150005];

long double D[150005];

int check[150005];

long double dfs(int idx, int par) {

	//cout << "idx= " << idx << " par= " << par << endl;

	if (check[idx] == 1) { return D[idx]; }

	long double tmp = 0.0L;

	int child_num = 0;


	for (auto y : Adj[idx]) {
		if (y == par) { continue; }
		tmp += dfs(y, idx); child_num++;
	}


	if (child_num == 0) { D[idx] = 0.0L; check[idx] = 1; return D[idx]; }
	D[idx] = tmp / (1.0L*child_num) + 1.0L;

	check[idx] = 1;
	return D[idx];
}


long double ans[150005];

void dfs2(int idx, long double D_par, int par) {

	int num = Adj[idx].size();

	long double tmp = 0.0L;

	for (auto y : Adj[idx]) {
		if (y == par) { tmp += D_par+1.0L; continue; }
		tmp += D[y]+1.0L;
	}

	ans[idx] = tmp / (1.0L*num);

	for (auto y : Adj[idx]) {
		if (y == par) { continue; }
		long double D_par;
		if (num == 1) { D_par = 0.0L; }
		else {
			D_par = (ans[idx] - (D[y] + 1.0L) / (1.0L*num))*num/(1.0L*num-1.0L);
		}
		dfs2(y, D_par, idx);
	}

}


int main(void) {

	cin >> N;

	for (int i = 1; i <= N - 1; i++) {
		cin >> u[i] >> v[i];
		Adj[u[i]].push_back(v[i]);
		Adj[v[i]].push_back(u[i]);
	}

	for (int i = 1; i <= N; i++) { D[i] = 0.0L; }

	dfs(1, -1);


	/*for (int i = 1; i <= N; i++) {
		cout << "i= " << i << "  D[" << i << "]= " << D[i] << endl;
	}*/

	for (int i = 1; i <= N; i++) { ans[i] = 0.0L; }

	ans[1] = D[1];

	dfs2(1, 0.0, -1);

	for (int i = 1; i <= N; i++) {
		cout <<setprecision(12)<<fixed<< ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 25344
import random
D=int(input())                                          #コンテの日数
c=list(map(int,input().split()))                        #26タイプ(AAC~AZC)のコンテストの満足度低下度
s=[list(map(int,input().split())) for _ in range(D)]    #s[d][i]...d(1<=d<=D)日目にi(1<=i<=26)番目のコンテストを行った時の満足度上昇
#types=[int(input()) for _ in range(D)]                  #コンテタイプ(1~26)
#満足度低下はΣ(1<=i<=26)ci*(d-last(d,i))                  #なおlast(d,i)=d日目以前に最後にタイプiのコンテストをやった日にち(ない場合0)
#よって満足度はs[d][i]-Σ(1<=i<=26)ci*(d-last(d,i))
#i日目のスコアはmax(10^6+s[d][i]-Σ(1<=i<=26)ci*(d-last(d,i)),0)
#last=[0]*26                                             #typeごとに、最後に使われた日にちを記録するよ
typ=0
ans=0
#D=365
types=[(i%26)+1 for i in range(D)]
#print(l)
sc = [0] * D
last=[0]*26
for i in range(D):
    typ = types[i] - 1
    score = s[i][typ]
    dwn = 0
    last[typ] = (i + 1)
    for j in range(26):
        dwn = dwn + c[j] * ((i + 1) - last[j])
    ans = score - dwn
    # print(score,last)
    sc[i] = ans
all = sum(sc)
for _ in range(800):
    types2 = []
    mi=float("inf")
    ind=0
    for i in range(D):
        if mi>sc[i]:
            mi=sc[i]
            ind=i
    l=list(range(1,27))
    #print(l)
    #print(ind,types[ind]-1)
    lab1=l.pop(types[ind]-1)
    lab2=random.choice(l)
    spans=ind//26
    types2=types
    for i in range(spans*26,min((spans+1)*26,D)):
        if types[i]==lab2:
            types[i]=lab1
            types[ind]=lab2
            break
    sc2=[0]*D
    last=[0]*26
    for i in range(D):
        typ = types[i] - 1
        score = s[i][typ]
        dwn = 0
        last[typ] = (i + 1)
        for j in range(26):
            dwn = dwn + c[j] * ((i + 1) - last[j])
        ans = score - dwn
                # print(score,last)
        sc2[i] = ans
    all2 = sum(sc2)
    if all2<all:
        types=types2
    else:
        sc=sc2
        all=all2
        sc2=[]
    #print(max(all,all2))
for i in range(D):
    print(types[i])



Measured memory_bytes: 79640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  string s;
  cin >> s;
  
  if(s.size()<26) {
    vector<char> cha;
    rep(i, s.size()) cha.push_back(s[i]);
    rep(i, 26) if(!count(all(cha), char('a'+i))) {s+=char('a'+i); break;}
    cout << s << newl;
    return 0;
  }
  
  if(s.size()==26) {
    ll k=0;
    vector<char> cha={s[25]};
    for(;k<25;k++) {
      if(s[24-k]<s[25-k]) {
        sort(all(cha));
        s[24-k]=cha[upper_bound(all(cha), s[24-k])-cha.begin()];
        break;
      }
      else cha.push_back(s[24-k]);
    }
    if(cha.size()==26) cout << -1 << newl;
    else cout << s.substr(0, 25-k) << newl;
    return 0;
  }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;

#define rep(i,x,y) for(int i=(x); i<(y); ++i)
const int INF = (1<<30);
const ll INFLL = 1LL<<62;
const long double EPS = 1e-12;

#ifndef INT_MAX
#define INT_MAX (1<<10)
#endif

#ifndef INT_MIN
#define INT_MIN -(1<<10)
#endif

template <typename T>
void vec_print(vector<T> VEC){
  rep(i, 0, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  rep(i, 0, MAT.size()){
    rep(j, 0, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

class HOGE{
  public:
    ll index;
    ll value;
    HOGE(ll index, ll value){
      this->index = index;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "index : " << index << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N;
  cin >> N;
  ll min_N = INT_MAX;
  ll max_N = INT_MIN;
  for(int i=0; i<N; ++i){
    ll tmp;
    cin >> tmp;
    min_N = min(min_N, tmp);
    max_N = max(max_N, tmp);
  }

  cout << (max_N - min_N) << "\n";

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int ac=0,wa=0,tle=0,re=0;
	while(n--)
	{
		string s;
		cin>>s;
		if(s=="AC")
			ac++;
		if(s=="WA")
			wa++;
		if(s=="TLE")
			tle++;
		if(s=="RE")
			re++;
	}
	cout<<"AC x "<<ac<<"\n";
	cout<<"WA x "<<wa<<"\n";
	cout<<"TLE x "<<tle<<"\n";
	cout<<"RE x "<<re<<"\n";
}

Measured memory_bytes: 3612
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int main() {
    int V,E,r;
    cin>>V>>E>>r;
    int finalD[100001];
    for (int i = 0; i < V; i++) finalD[i] = -1;
    multimap<int, pair<int, int> > ds;
    for (int i = 0; i < E; i++) {
        int s,t,d;
        cin>>s>>t>>d;
        ds.insert(make_pair(s, make_pair(t, d)));
    }

    priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > pqueue;
    pqueue.push(make_pair(0,r));
    while (!pqueue.empty()) {
        pair<int, int> p = pqueue.top();
        pqueue.pop();
        if (finalD[p.second] == -1) finalD[p.second] = p.first;
        else continue;

        multimap<int, pair<int, int> >::iterator it = ds.lower_bound(p.second);
        multimap<int, pair<int, int> >::iterator last = ds.upper_bound(p.second);
        for (; it != last; it++) pqueue.push(make_pair(p.first + it->second.second, it->second.first));
    }

    for (int i = 0; i < V; i++) {
        if (finalD[i] == -1) cout<<"INF"<<endl;
        else cout<<finalD[i]<<endl;
    }
}

Measured memory_bytes: 35896