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

int main(){
  int A[3][3];
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> A[i][j];
    }
  }
  int N; cin >> N;

  for(int n = 0; n < N; n++){
    int b; cin >> b;

    for(int i = 0; i < 3; i++){
      for(int j = 0; j < 3; j++){
        if(A[i][j] == b) A[i][j] = -1;
      }
    }
  }

  bool clr = false;

  for(int i = 0; i < 3; i++){
    if(A[i][0] == -1 && A[i][1] == -1 && A[i][2] == -1)
      clr = true;
  }

  for(int i = 0; i < 3; i++){
    if(A[0][i] == -1 && A[1][i] == -1 && A[2][i] == -1)
      clr = true;
  }

  if(A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1)
    clr = true;

  if(A[0][2] == -1 && A[1][1] == -1 && A[2][0] == -1)
    clr = true;

  cout << (clr ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000)

N = int(input())
M = [[] for _ in range(N)]
for i in range(N-1):
    u, v, w = map(int, input().split())
    u, v = u-1, v-1
    M[u].append((v, w))
    M[v].append((u, w))

visited = [False] * N
color = [0] * N

def dfs(u, c):
    visited[u] = True   #; print('u, c', u, c)
    for vw in M[u]:
        v, w = vw       #; print(vw)
        if visited[v] == False:
            if w%2 == 0:
                color[v] = c * 0b1
            else:
                color[v] = c ^ 0b1
            #print('v, c', v, c)
            dfs(v, color[v])

dfs(u, 0)
for i in range(N):
    print(color[i])

Measured memory_bytes: 117912
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <utility>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <cctype>

typedef long long int lli;

using namespace std;

int main() {
   
   int N;
   cin >> N;
   vector<int> A;
   int x;
   bool *dp = new bool[1000001]();

   for(int i=0;i<N;i++){
      cin >> x;
      A.push_back(x);
   }
   for(int i=0;i<1000001;i++){
        dp[i]=true;
   }

    sort(A.begin(), A.end());

    for(int i=0;i<N;i++){
        if(i<N-1 && A[i]==A[i+1]){
            dp[A[i]]=false;
            dp[A[i+1]]=false;
        }
        int cnt=2;
        
        while(cnt*A[i]<=A[N-1]){
            dp[cnt*A[i]]=false;
            cnt++;
        }
    
    }
    int sum =0;
    for(auto i : A){
        //cout << i << " " << dp[i] << endl;
        sum+=dp[i];
    }
    cout << sum << endl;


}

Measured memory_bytes: 5308
#pragma GCC optimize("Ofast")
#include  "bits/stdc++.h"
using namespace std;
#define I_AM_SPEED  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define printclock  cerr <<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<" sec\n";
#define mp(a , b)   make_pair(a , b)
#define eb(a)       emplace_back(a)
#define SZ(n)       ((int)(n).size())
#define all(n)      (n).begin(), (n).end()
#define anal           '\n'
#define mod         1000000007
#define fst         first
#define sec         second
#define pr(n)       cerr << n  << " ";
#define pfor(a)       for(auto (w) : (a)) pr(w)
//const double PI = acos(-1.0);
typedef long long ll;
typedef unsigned long long ull;

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

vector<int> v(26, -1);

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      
int main(){
I_AM_SPEED;
#ifndef ONLINE_JUDGE  
        freopen("input.in", "r", stdin);
        freopen("output.in", "w", stdout);
#endif 

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      
     
      int x;
      cin >> x;
      if(x >= 400 && x <= 599){
          cout << "8";
      }
      else if(x >= 600 && x <= 799){
          cout <<"7";
      }
      else if(x >= 800 && x <= 999){
          cout << "6";
      }
      else if(x >= 1000 && x <= 1199){
          cout << "5";
      }
      else if(x >= 1200 && x <= 1399){
          cout << "4";
      }
      else if(x >= 1400 && x <= 1599){
          cout << "3";
      }
      else if(x >= 1600 && x <= 1799){
           cout << "2";
      }
      else cout << "1";

        

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
//printclock; 
return  0 ;      
}        



      

Measured memory_bytes: 3660
#include <cstdio>
int h[100010];

typedef unsigned int uint;
int in() {
    int x = 0, c;
    for (; (uint)((c = getchar()) - '0') >= 10; ) { if (c == '-') return -in(); if (!~c) throw ~0; }
    do { x = (x << 3) + (x << 1) + (c - '0'); } while ((uint)((c = getchar()) - '0') < 10);
    return x;
}

int main(){
	int n = in();
	for(int i = 0 ; i < n ; i++){ int a = in() , b = in() ; h[a-1]++ , h[b]--; }
	int ans = 0 , cur = 0;
	for(int i = 0 ; i <= 100001 ; i++){
		cur += h[i];
		if(cur >= i) ans = i;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 0
package main

import (
	"fmt"
)

func main() {
	var s, r int
	fmt.Scan(&s)
	arr := make([]int, 10000000)
	arr[0] = s
	i := 1
	for {
		w := arr[i-1]
		if w%2 == 0 {
			arr[i] = w / 2
		} else {
			arr[i] = 3*w + 1
		}
		var b bool
		for j := i - 1; j >= 0; j-- {
			if arr[i] == arr[j] {
				r = i + 1
				b = true
				break
			}
		}
		if b {
			break
		}
		i++
	}
	fmt.Println(r)
}

Measured memory_bytes: 3072
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

function main()
	n = readline() |> parseInt
	x = 0
	for i in 1:n
		if i%3!=0&&i%5!=0
			x += i
		end
	end
	println(x)
end

main()

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

int main() {
  int n;
  int sum = 0;
  cin>>n;
  vector<int> s(n);
  for (int i=0;i<n;i++) {
    cin>>s[i];
    sum += s[i];
  }
  int d = 10000;
  for (int i=0;i<n;i++) {
    int gou = 0;
    for (int j=0;j<i;j++) {
      gou += s[j];
    }
    int sa;
    if (sum >= gou*2) sa = sum-gou*2;
    else sa = gou*2-sum;
    d = min(d, sa);
  }
  cout<<d<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SIZE 10
#define PI 3.141592653589793

using namespace std;
typedef long long ll;

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

	int N;
	int i,j;
	int tmp;
	int answer=0;
	int counter=0;
	vector<int> given;

	cin >> N;

	if(N%10 == 7 || (N/10)%10 == 7 || (N/100)%10 == 7)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}



Measured memory_bytes: 3660
import math
from itertools import combinations
from itertools import combinations_with_replacement
from itertools import product
from collections import defaultdict
from collections import deque
from collections import Counter
import heapq


def input_li():
    return list(map(int, input().split()))


def input_int():
    return int(input())


N = input_int()
A_LI = input_li()
minus_cnt = 0
for a in A_LI:
    if a < 0:
        minus_cnt += 1

ans = 0
abs_min = 10 ** 9
for a in A_LI:
    ans += abs(a)
    abs_min = min(abs_min, abs(a))
print(ans) if minus_cnt % 2 == 0 else print(ans - abs_min * 2)


Measured memory_bytes: 87892
c1 = gets.split.map(&:to_i)
c2 = gets.split.map(&:to_i)
c3 = gets.split.map(&:to_i)
ans = 'No'
100.times do |i|
  a1 = i
  b1 = c1[0] - a1
  b2 = c1[1] - a1
  b3 = c1[2] - a1
  if (c2[0] - b1 == c2[1] - b2) && (c2[1] - b2 == c2[2] - b3)
    if (c3[0] - b1 == c3[1] - b2) && (c3[1] - b2 == c3[2] - b3)
      ans = 'Yes'
      isBreak = true
    end
  end
  break if isBreak
end
puts ans

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    string s; cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == s[i + 1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem0188 : Search **/
int main()
{
	int N;
	while (cin>>N, N) {
		vector<int> a(N);
		rep(i, N) cin>>a[i];
		int t; cin>>t;
		int ans=0;
		
		int l=0, r=N-1;
		while (l<=r) {
			ans++;
			int m=(l+r)/2;
			if (a[m] == t) {
				break;
			} else if (a[m]> t) {
				r = m-1;
			} else {
				l = m+1;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1192
while True:
    n = int(input())
    if n == 0: break
    
    trains = []
    for _ in range(n):
        dept, ariv = input().split()
        trains.append((dept, ariv))
    trains.sort(key=lambda x:x[0])
    dcheck = 0
    usecar = 0
    returntime = []
    for tridx in range(len(trains)):
        new = True
        for ariv in returntime:
            if ariv <= trains[tridx][0]:
                new = False
                returntime.remove(ariv)
                break
        if new: usecar += 1
        returntime.append(trains[tridx][1])
    print(usecar)



Measured memory_bytes: 7756
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll n;
    cin>>n;
    vector< pair <string,int> >v;
    map< pair<string,int >,int >m;
    for(int i=1;i<=n;i++)
    {
        string s;
        ll x;
        cin>>s>>x;
        v.pb(mp(s,-x));
        pair<string,int >p ={s,-x};
        m[p]=i;

    }
    sort(v.begin(),v.end());
    for(auto t:v)
        {
            pair<string,int>p={t.fi,t.se};
            cout<<m[p]<<endl;
            }
}
return 0;
}

Measured memory_bytes: 256
n, m, l = map(int, input().split())
A, B = [], []
for i in range(n):
    tmp = list(map(int, input().split()))
    A.append(tmp)

for i in range(m):
    tmp = list(map(int, input().split()))
    B.append(tmp)

hoge = []
C = []
for i in range(n):
    tmp2 = []
    for k in range(l):
        cnt = 0
        for j in range(m):
            cnt += A[i][j]*B[j][k]
        tmp2.append(cnt)

    C.append(tmp2)

for i in range(len(C)):
    print(*C[i])


Measured memory_bytes: 7064
#include <stdio.h>
#include <memory.h>
typedef struct{
	char name[2];
	int win;
	int lose;
}data;
int main(void){
	data s[10],tmp;
	int n,t,i,j;
	while(1){
		scanf("%d",&n);
		if(!n){
			break;
		}
		memset(s,0,sizeof(s));
		for(i=0;i<n;i++){
			scanf("%s",s[i].name);
			for(j=0;j<n-1;j++){
				scanf("%d",&t);
				if(t==0){
					s[i].win++;
				}
				else if(t==1){
					s[i].lose++;
				}
			}
		}
		for(i=0;i<n-1;i++){
			for(j=n-1;j>i;j--){
				if(s[j-1].win<s[j].win||s[j-1].win==s[j].win&&s[j-1].lose>s[j].lose){
					tmp=s[j-1];
					s[j-1]=s[j];
					s[j]=tmp;
				}
			}
		}
		for(i=0;i<n;i++){
			printf("%s\n",s[i].name);
		}
	}
	return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>

using namespace std;
typedef long long ll;

int gcd(int x, int y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    int r = x % y;
    x = y;
    y = r;
  }
  return x;
}

/*迷路
const int INF = 50;

typedef pair<int,int> P;
char field[52][52];
int d[51][51];
int r,c;
int sx,sy;
int gx,gy;

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

int bfs(){
    queue<P> que;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            d[i+1][j+1] = INF;
        }
    }
    que.push(P(sy,sx));
    d[sy][sx]=0;
while(que.size()){
    P p=que.front();
    que.pop();
    if(p.second==gx&&p.first==gy) break;
    for(int i=0;i<4;i++){
        int nx=p.second+dx[i];
        int ny=p.first+dy[i];

        if(1<=nx&&nx<=c&&1<=ny&&ny<=r&&field[ny][nx]!='#'&&d[ny][nx]==INF){
            que.push(P(ny,nx));
            d[ny][nx] = d[p.first][p.second] + 1;
        }
    }
}
return d[gy][gx];
}
*/

int main(){
    int a,b;
    cin>>a>>b;
    if(b%a == 0) cout<<a+b<<endl;
    else cout<<b-a<<endl; 
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	string s,left="",right="";
	cin>>s;
	int era=0;
	bool check=true;
	while(check){
		check=false;
		loop(i,1,s.size()){
			if(s[i]!=s[i-1]){
				left="";right="";
				era++;
				check=true;
				left=s.substr(0,i-1);
				right=s.substr(i+1,s.size()-i+1);
				s=left+right;
				i-=2;
				if(i<0)i=0;
			}
		}
	}
	cout<<era*2<<endl;
}

Measured memory_bytes: 780
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [r, g, b] <- map strToInt . words <$> getLine
    -- 出力
    putStrLn $ if (g * 10 + b) `mod` 4 == 0 then "YES" else "NO"


Measured memory_bytes: 508
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
def my_pow(base, n, mod):
    if n == 0:
        return 1
    x = base
    y = 1
    while n > 1:
        if n % 2 == 0:
            x *= x
            n //= 2
        else:
            y *= x
            n -= 1
        x %= mod
        y %= mod
    return x * y % mod

N, K = map(int, input().split())

cnt = [0] * (K + 1)

ans = 0
total = 0
for i in range(K, 0, -1):
    t = K // i
    now = my_pow(t, N, MOD)
    for j in range(i*2, K + 1, i):
        now -= cnt[j]
    cnt[i] = now
    ans += (now * i) % MOD
print(ans % MOD)


Measured memory_bytes: 11604
#include <iostream>
#include <vector>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
typedef long long ll;
using namespace std;
template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }
const int mod = 1e9+7;
int main() {
    int n, m; cin >> n >> m;
    auto dp = vectors(m+1, n+1, n+1, ll());
    dp[0][1][0] = 1;
    repeat (i,m) {
        repeat (j,n+1) {
            repeat (k,n+1) if (j+k <= n) {
                dp[i+1][j][k] %= mod;
                dp[i+1][j+k][0] += dp[i][j][k] * j % mod;
                dp[i+1][j][k]   += dp[i][j][k] * k % mod;
  if (k+1 <= n) dp[i+1][j][k+1] += dp[i][j][k] * (n-j-k) % mod;
            }
        }
    }
    cout << dp[m][n][0] % mod << endl;
    return 0;
}


Measured memory_bytes: 216832
#include <stdio.h>
int main (){
	char cnt[4];
	scanf("%s",cnt);
	if((cnt[0]==cnt[1])&&(cnt[1]==cnt[2])){
		printf("Yes\n");
	}else if((cnt[1]==cnt[2])&&(cnt[2]==cnt[3])){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;

int main(void) {
	string S;
	cin >> S;
	string ans = "yes";
	set<char> c;
	for (int i = 0; i < S.length(); i++) {
		if (!c.insert(S[i]).second) ans = "no";
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
//#include <iostream>
//#include <stdio.h>
//#include <algorithm>
//#include <functional>
using namespace std;

int main() {
	int w[10], k[10];
	int i, j;
	i = 0;
	j = 0;
	while (i < 10) {
		cin >> w[i];
		i++;
	}
	while (j < 10) {
		cin >> k[j];
		j++;
	}
	sort(w,w+10,greater<int>());
	sort(k,k+10,greater<int>());
	printf("%d %d\n", w[0]+w[1]+w[2], k[0]+k[1]+k[2]);
	return 0;
}

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

int N,M,Q;
int L,R,p,q;
int G[501][501] = {{0}};
int main(){
	cin >> N >> M >> Q;
	for(int i=0;i<M;i++){
		cin >> L >> R;
		G[L][R]++;
	}
	for(int i=1;i<=N;i++){
		for(int j=i;j>1;j--){
			G[j-1][i] += G[j][i];
		}
		for(int j=i;j<N;j++){
			G[i][j+1] += G[i][j];
		}
	}
	for(int i=0;i<Q;i++){
		cin >> p >> q;
		cout << (p<q? G[p][q]:G[q][p]) << endl;
	}
}

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

using namespace std;

int main(int argc, char const *argv[]) {
  long long n, alice, bob, ipt;
  vector<long long> a;

  cin >> n;

  for (long long i = 0; i < n; i++)
  {
    cin >> ipt;
    a.push_back(ipt);
  }

  sort(a.begin(), a.end());

  alice = 0;
  bob = 0;
  for (long long i = 0; i < n; i++)
  {
    if (i % 2 == 0)
    {
      alice += a[n - i - 1];
    }
    else
    {
      bob += a[n - i - 1];
    }
  }

  cout << alice - bob << endl;

  return 0;
}


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


public class Main {
    public static void main(String[] args) {
    	
    	try{
    		InputStreamReader isr = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(isr);
			String buf = br.readLine();
			int n = Integer.parseInt(buf);
			String buf2 = br.readLine();
			StringTokenizer st=new StringTokenizer(buf2," ");
			if(0 <=n && n <=10000){
				int max=-1000000;
				int min=1000000;
				long sum=0;
				int a=0;
				for(int i=1;i <= n; i++){
					if(0 >= st.countTokens())	break;
					a=Integer.parseInt( st.nextToken() );
					if(0 >= a && a>=1000000)	return;
					if(max < a)
						max=a;
					if(min > a)
						min=a;
					sum+=a;
				}
				System.out.println(min+" "+max+" "+sum);
			}
		} catch(IOException e) {
    		System.err.println(e);
		} catch(NoSuchElementException e) {
    		System.err.println(e);
		}
    }
}

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

using ll = long long;
const int mod = 1e9 + 7;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    for (int i = 0; i < N; i++)
        cin >> H[i];
    sort(H.begin(), H.end());
    ll ans = 0;
    for (int i = 0; i < max(N - K, 0); i++) {
        ans += H[i];
    }
    cout << ans << endl;
}

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

int main(void)
{
    long long int X, K, D;
    cin >> X >> K >> D;

    X = abs(X);

    long long int a1 = X%D;
    long long int a2 = a1 - D;

    long long int ans = 0;

    long long int Kd = K - (X - a1) / D;
    if(Kd < 0) ans = X - K*D;
    else if(Kd%2 == 0) ans = abs(a1);
    else ans = abs(a2);
    
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3568
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#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 <list>
#include <cmath>
using namespace std;
#define rep(i,m,n) for (int i = (int) (m); i < (int) (n); i++)
#define rep1(i,m,n) for (int i = (int) (m); i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
long long int comb(long long int n,long long int r){
    vector<vector<long long int> > v(n+1,vector<long long int>(n+1,0));
    long long int i,j;
    rep(i,0,n+1){
        v.at(i).at(0)=1;
        v.at(i).at(i)=1;
    }
    rep(i,0,n+1){
        rep(j,0,i)v.at(i).at(j)=v.at(i-1).at(j-1)+v.at(i-1).at(j);
    }
    return v.at(n).at(r);
}
int main(void){
    int A,B,C;
    cin>>A>>B>>C;
    if((A==B && A!=C) || (A==C && A!=B) || (B==C && A!=B))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main()
{
  int A[3];
  for(int i=0;i<3;i++)
    {
      cin >> A[i];
    }   
  sort(A,A+3);
  cout << A[0] << " " << A[1] << " " <<	A[2] << endl;
  return 0;
}

Measured memory_bytes: 3088
#include <stdio.h>
#define N 10000
#include <math.h>



int main()
{
  int n,i,j;
  int array[N];
  int a=0,amari,f=0;
  
  
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ){
    
    scanf("%d", &array[i]);
    
  }
  
  for(j = 0; j < n; j++){
    
    
 for(i = 2; i <= sqrt(array[j]); i++){
   
   amari = array[j] % i;
   if(amari == 0)
     
     break;
   
 }
 
  if(amari != 0){
    a++;
  }
  }
  
  printf("%d\n",a);
  
  
  return 0;
}

Measured memory_bytes: 628
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, M, X, count;
	count = 0;
	cin >> N >> M >> X;
	vector <int> A(M);
	for (int i=0; i<M; i++){
		cin >> A.at(i); //数字の読み込み
	}
	for (int i=0; i<M; i++){
		if (X > A.at(i)){
			count ++;
		}
		else{
			break;
		}
	}
    cout << min(count, M - count) << endl;
  return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 3e5 + 5;
int n;
int a[maxn];

int read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < 3 * n; i++) {
    scanf("%d", &a[i]);
  }
  return true;
}

void solve() {
  sort(a, a + 3 * n);
  long long res = 0;
  for (int i = 0; i < n; i++) {
    res += a[3 * n - 2 * (i + 1)];
  }
  printf("%lld\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
#define ll long long
#define umap unordered_map
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;

ll mod(ll x, ll y){if(x>=0||x%y==0) return x%y;return y+x%y;} //mod including minus
ll dv0(ll x, ll y){if(x>=0||x%y==0)return x/y;return x/y-1;} //rnd down
ll dv1(ll x, ll y){if(x%y==0) return dv0(x,y);return dv0(x,y)+1;} //rnd up
ll M=1e9+7;
int quick_pow(int x,int p){
    int a=1,po=x;
    while(p){
        if(p&1)  a=1ll*a*po%M;
        po=1ll*po*po%M;p>>=1;
    }
    return a;
}
//Start from Here
int main(){
    int n, a, b;
    cin>>n>>a>>b;
    int ans;
    ans=quick_pow(2, n)-1;
    ll a1=1, b1=1;
    ll a2=1, b2=1;
    rep(i, a){
        a1*=n-i;
        a1%=M;
    }
    rep2(i, a){
        a2*=i;
        a2%=M;
    }
    a2=quick_pow(a2, M-2);
    a1=a1*a2;
    a1%=M;
    rep(i, b){
        b1*=n-i;
        b1%=M;
    }
    rep2(i, b){
        b2*=i;
        b2%=M;
    }
    b2=quick_pow(b2, M-2);
    b1=b1*b2;
    b1%=M;
    ans-=a1+b1;
    ans=mod(ans, M);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
maze = [["#"]*(W+2)] + [["#"] + list(input()) + ["#"] for i in range(H)] + [["#"]*(W+2)]
from copy import deepcopy
grid = deepcopy(maze)
ans = 0

from collections import deque
for sh in range(H+2):
    for sw in range(W+2):
        
        if grid[sh][sw] == '.':
            
            grid[sh][sw] = 0
            depth = 0
            que = deque()
            que.append([sh,sw])
            dxs = [-1,1,0,0]
            dys = [0,0,-1,1]
            while que:
                h,w = que.popleft()
                for i in range(4):
                    dx = dxs[i]
                    dy = dys[i]

                    if grid[h+dx][w+dy] == '.':
                        grid[h+dx][w+dy] = grid[h][w] + 1
                        que.append([h+dx,w+dy])
                        depth = max(depth,grid[h+dx][w+dy])
            ans = max(ans,depth)
        grid = deepcopy(maze)
        #print(grid)
print(ans)
#print(grid)
#print(maze)

Measured memory_bytes: 9620
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;
#define N 100005
int n,a[N],Max,mark[N],ans;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]),Max=max(Max,a[i]);
        mark[a[i]]++,mark[a[i]+1]++;
        if(a[i]) mark[a[i]-1]++;
    }
    for(int i=0;i<=Max+1;i++) ans=max(ans,mark[i]);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		minMaxSum();

	}
	
	public static void minMaxSum() {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array = new int[n];
		int min, max;
		long sum;
		
		int num = sc.nextInt();
		min = num;
		max = num;
		sum = num;
		
		for (int i = 0; i < n - 1; i++) {
			array[i] = sc.nextInt();
			
			if (min > array[i]) {
				min = array[i];
			} else if (max < array[i]) {
				max = array[i];
			}
			
			sum += array[i];
		}
		
		System.out.println(min + " " + max + " " + sum);
	}
}


Measured memory_bytes: 41800
main = do
    str <- getLine
    --let M = 1000000007
    let [a, b] = map read $ words $ str :: [Integer]
    let i2b =  i2b' where i2b' 0 = []; i2b' n = mod n 2 : i2b' (div n 2)
    let toMod x = x `mod` 1000000007
    let ans = foldl (\x y -> toMod (x * y) ) 1 $ filter (/=0) $ zipWith (*) (iterate (toMod . (^2) ) a) $ i2b b
    putStrLn $ show ans

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int const N = 1001;
int n,m, a[N][N], color[N][N], colors=0;
vector<set<int>> adj;

vector<int> di = {1, -1, 0, 0}, dj = {0, 0, 1, -1};
bool valid(int i, int j){
    return i>=0 && j>=0 && i<n && j<m && a[i][j];
}
void dfs(int i, int j){
    color[i][j] = colors;
    for (int k=0; k<4; k++){
        if (valid(i+di[k], j+dj[k]) && !color[i+di[k]][j+dj[k]]){
            dfs(i+di[k], j+dj[k]);
        }
    }
}

void solvetask(){
    cin >> n >> m;
    int ai, aj, bi, bj; cin >> ai >> aj >> bi >> bj;
    ai--; aj--; bi--; bj--;
    for (int i=0; i<n; i++){
        for (int j=0; j<m; j++){
            char c; cin >> c;
            a[i][j] = (c == '.');
        }
    }

    for (int i=0; i<n; i++){
        for (int j=0; j<m; j++){
            if (!color[i][j] && a[i][j]){
                ++colors;
                dfs(i, j);
            }
        }
    }
    adj.resize(colors+1);
    for (int i=0; i<n; i++){
        for (int j=0; j<m; j++){
            if (!valid(i, j)) continue;
            for (int dii=-2; dii<=2; dii++){
                for (int djj=-2; djj<=2; djj++){
                    if (valid(i+dii, j+djj)){
                        int c1 = color[i][j], c2 = color[i+dii][j+djj];
                        if (c1 != c2){
                            adj[c1].insert(c2);
                            adj[c2].insert(c1);
                        }
                    }
                }
            }
        }
    }
    queue<int> f;
    vector<int> dist(colors+1, INT_MAX);
    f.push(color[ai][aj]);
    dist[color[ai][aj]] = 0;
    while(!f.empty()){
        int top = f.front(); f.pop();
        for (int c : adj[top]){
            if (dist[c] > dist[top] + 1){
                dist[c] = dist[top] + 1;
                f.push(c);
            }
        }
    }
    if (dist[color[bi][bj]] == INT_MAX) cout << "-1\n";
    else cout << dist[color[bi][bj]] << endl;
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1; //cin >> t;
    while(t--) solvetask();
}

Measured memory_bytes: 35672
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

typedef long long ll;
typedef pair<int, int> p_i;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repext(i, a, b) for (int i = a; i < b; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (int i = b - 1; i >= a; i--)
#define vec_all(vec) vec.begin(), vec.end()
#define sum(vec) accumulate(vec_all(vec), 0)

// vectorデバッグ
template <typename T>
void dump_vec(vector<T> vec)
{
    rep(i, vec.size())
    {
        cout << i << ": " << vec[i] << endl;
    }
}

// --- notice ---
// intの和はllにしろ
// 1-originと和解しろ

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

    vector<int> hole(m + 2);
    hole[0] = -1;
    hole[m + 1] = n + 1;
    rep(i, m) {
        cin >> hole[i + 1];
        if (hole[i + 1] - hole[i] == 1) {
            cout << 0 << endl;
            return 0;
        }
    }

    vector<int> stair_num;
    rep(i, m + 1) {
        stair_num.push_back(hole[i + 1] - hole[i] - 2);
    }

    ll mod = 1000000007;

    vector<ll> fib;
    fib.push_back(1);
    fib.push_back(1);

    repext(i, 2, n + 1) {
        fib.push_back((fib[i - 1] + fib[i - 2]) % mod);
    }

    ll cnt = 1;
    for (auto x : stair_num) {
        cnt *= fib[x];
        cnt %= mod;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 1784
#include<cstdio>
#include<algorithm>
using namespace std;
int a,b,c,x,y,ans1,ans2;
int main(){
	scanf("%d%d%d%d%d",&a,&b,&c,&x,&y);
	ans2=c*2*max(x,y);
	if (a+b>2*c){
		int d=min(x,y);
		x-=d;
		y-=d;
		ans1+=d*c*2;
	}
	if (x) ans1+=x*a;
	if (y) ans1+=y*b;
	printf("%d\n",min(ans1,ans2));
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<lli,lli> ii;
typedef vector<lli> vi;
#define deb(x) cout << #x": " << (x) << endl;

int main(){ _
  lli n;
  cin >> n;
  lli c = 0;
  fore (i,0,n){
    if (c == 3){
      cout << "Yes" << ENDL;
      return 0;
    }
    else{
      lli x, y;
      cin >> x >> y;
      if (x == y){
        c++;
      }
      else{
        c = 0;
      }
    }
  }
  if (c == 3){
    cout << "Yes" << ENDL;
  }
  else{
    cout << "No" << ENDL;
  }
  return 0;
}


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

typedef long long ll;
typedef long double ld;

bool visited[100005];
vector <int> graf[100005];
int col[100005];

void dfs(int v){
    visited[v] = 1;
    for(auto c : graf[v]){
        if(!visited[c]){
            col[c] = 1-col[v];
            dfs(c);
        }
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n, m;
    cin >> n >> m;
    for(int i=1; i<=m; i++){
        int a, b;
        cin >> a >> b;
        graf[a].push_back(b);
        graf[b].push_back(a);
    }
    dfs(1);
    int bipartite = 1, cb = 0, cw = 0;
    for(int i=1; i<=n; i++){
        if(col[i]) cw++;
        else cb++;
        for(auto c : graf[i]){
            if(col[i] == col[c]) bipartite = 0;
        }
    }
    if(bipartite){
        cout << (ll)cw*cb-m;
    }
    else cout << (ll)n*(n-1)/2-m;
    return 0;
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)


void solve(long long N, std::vector<long long> P){
    ll ans = 0;
    ll minval = numeric_limits<ll>::max();
    for(ll x : P){
        if(x <= minval){ ans++; }
        minval = min(minval, x);
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    solve(N, std::move(P));
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template< typename T > using matrix = vector< vector< T > >;

//FUNCTION  


void solve(void)
{
  double a,b,x;
  cin>>a>>b>>x;
  int V = a*a*b;
  double theta;
  if(2*x > V)
  {
    x = V -x;
    double c = 2*x/a/a;
    theta = atan(c/a);
  }
  else
  {
    double c = 2*x/b/a;
    theta = atan(b/c);
  }
  cout<<theta*180/M_PI<<endl;
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	i64 n, m;
	cin >> n >> m;
	i64 ans;
	if (n == 1 && m == 1) ans = 1;
	else if (n == 1 || m == 1) ans = n * m - 2;
	else ans = (n - 2)*(m - 2);
	cout << ans << endl;
}


Measured memory_bytes: 256
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N = I()
    mylist = LI()
    max_num = max(mylist)
    max_num2 = math.ceil(math.sqrt(max_num))
    D = [True]* (max_num+1)
    D[0] = D[1] = False
    mylist = Counter(mylist)
    setwise = True
    pairwise = True

        
    for i in range(2, max_num+1):
        temp = 0
        if D[i]:
            for j in range(i, max_num+1, i):
                D[j] = False
                
                try:
                    temp+=mylist[j]
                except:
                    pass

            if temp == N:
                print("not coprime")
                sys.exit()
            if temp >= 2:
                pairwise = False

    if pairwise:
        print("pairwise coprime")
    else:
        print("setwise coprime")
                    

            
    
    
if __name__ == "__main__":
    main()

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

#define CO const
#define IN inline
typedef long long LL;
typedef long double LD;

template<class T> T read(){
	T x=0,w=1;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-') w=-w;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*w;
}
template<class T> IN T read(T&x){
	return x=read<T>();
}

CO int mod=1e9+7;
IN int add(int a,int b){
	return (a+=b)>=mod?a-mod:a;
}
IN int mul(int a,int b){
	return (LL)a*b%mod;
}
IN int fpow(int a,int b){
	int ans=1;
	for(;b;b>>=1,a=mul(a,a))
		if(b&1) ans=mul(ans,a);
	return ans;
}

CO int N=5e3+10;
vector<int> to[N];
int g[N],f[N][N],siz[N];

void dfs(int u,int fa){
	f[u][1]=1,siz[u]=1;
	for(int v:to[u])if(v!=fa){
		dfs(v,u);
		static int tmp[N];
		copy(f[u],f[u]+siz[u]+1,tmp);
		fill(f[u],f[u]+siz[u]+1,0);
		for(int i=0;i<=siz[u];++i)for(int j=0;j<=siz[v];++j)
			f[u][i+j]=add(f[u][i+j],mul(tmp[i],f[v][j]));
		siz[u]+=siz[v];
	}
	for(int i=2;i<=siz[u];i+=2)
		f[u][0]=add(f[u][0],mod-mul(f[u][i],g[i]));
}
int main(){
	int n=read<int>();
	for(int i=1;i<n;++i){
		int u=read<int>(),v=read<int>();
		to[u].push_back(v),to[v].push_back(u);
	}
	g[0]=1;
	for(int i=2;i<=n;i+=2) g[i]=mul(g[i-2],i-1);
	dfs(1,0);
	printf("%d\n",mod-f[1][0]);
	return 0;
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

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

int main ()
{
    fastio
    lli a[4] ;
    loopcin(4 , a) ;

    if(a[0] + a[1] > a[2] + a[3])
        cout << "Left" ;
    else if(a[0] + a[1] < a[2] + a[3])
        cout << "Right" ;
    else if(a[0] + a[1] == a[2] + a[3])
        cout << "Balanced" ;


    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <limits>
#include <iomanip>
#include <bitset>

#define INF 1000000000
#define Inf 1000000000000000000
#define mp make_pair
#define pb push_back
#define EPS 1e-9

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

int n;
string a, b, aa, bb;
int main() {
    //freopen("in","r",stdin);

    cin >> n >> a >> b;
    for(int i = 0; i < n; ++i) {
        aa = a.substr(i);
        bb = b.substr(0, n - i);
        if (aa == bb) {
            cout << 2 * n - (n - i) << endl;
            return 0;
        }
    }
    cout << 2 * n << endl;
    return 0;
}

Measured memory_bytes: 256
dx[]={0,1,0,-1},dy[]={1,0,-1,0};
w,h,x,y,d;
move(r){
	x+=dx[d]*r,y+=dy[d]*r;
	if(x<1)x=1;
	if(x>w)x=w;
	if(y<1)y=1;
	if(y>h)y=h;
}
main(){
	for(;scanf("%d%d",&w,&h)*w;){
		char op[9];
		int r;
		x=y=1,d=0;
		for(;scanf("%s",op),strcmp(op,"STOP");){
			if(strcmp(op,"FORWARD")==0){
				scanf("%d",&r);
				move(r);
			}
			if(strcmp(op,"BACKWARD")==0){
				scanf("%d",&r);
				move(-r);
			}
			if(strcmp(op,"RIGHT")==0){
				d=(d+1)%4;
			}
			if(strcmp(op,"LEFT")==0){
				d=(d+3)%4;
			}
		}
		printf("%d %d\n",x,y);
	}
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;
int main() {
    int len;
    cin >> len ;
    int judge = 0;
    for (int i = 0; i < len; i++){
        int num ;
        cin >> num;
        if (num % 2 == 0){
            if (num % 3 == 0 || num % 5 == 0){
                judge += 0;
            }else{
                judge += 1;
            }
        }
    }
    if (judge == 0){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }
}


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

int main()
{
	std::string S;
	std::cin >> S;
	int ans{};
	for (int i{}; i < (int)S.size() - 1 - i; i++)
		if (S[i] != S[S.size() - 1 - i])
			ans++;
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
using namespace std;
using ll=long long;

#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 LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007


constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 

 
int main() {
    ll N,T;
    cin >>N>>T;
    ll c[N];
    ll t[N];
    ll cost=999999;
    FOR(i,0,N-1){
        cin>>c[i]>>t[i];
    }

    FOR(i,0,N-1){
        if(t[i]<=T){
            if(cost>c[i]){cost=c[i];}
        }
    }

    if(cost==999999){
        cout<<"TLE"<<endl;
    }else{
                cout<<cost<<endl;
    }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#define REP(i,a,b) for(i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(a) (a).begin(), (a).end()

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	cin >> n;
  	vector<int> v(n, 0);
  	rep(i, n) cin >> v[i];
  	
  	sort(all(v));
  	
  	float ans = v[0];
  	REP(i,1, n){
      ans += v[i];
      ans /= 2;
    }
  	
  	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
using namespace std;
typedef long long ll;

ll mmax(ll a, ll b) {
  return a > b ? a : b;
}

int main(void) {
  ll i, j, k, l, m, n[3], ans = 1e4;
  char s[3][2010], tmp[6010];
  for(i = 0; i < 3; ++i) scanf("%s", s[i]), n[i] = strlen(s[i]);
  bool b[3][3][5000];
  for(i = 0; i < 3; ++i) for(j = 0; j < 3; ++j) for(k = 0; k < 5000; ++k) b[i][j][k] = true;
  for(i = 0; i < 3; ++i) for(j = 0; j < 3; ++j) for(k = 0; k < n[i]; ++k) {
    bool t = true;
    for(l = 0; l < (n[i] - k < n[j] ? n[i] - k : n[j]); ++l) if(s[i][k + l] != '?' && s[j][l] != '?' && s[i][k + l] != s[j][l]) t = false;
    b[i][j][k] = t;
  }
  for(i = 0; i < 3; ++i) for(j = 0; j < 3; ++j) if(i != j) for(k = 0; k < 3; ++k) if(i != k && j != k) {
    for(l = 0; l <= n[i]; ++l) if(b[i][j][l]) for(m = 0; m <= mmax(n[j], n[i] - l); ++m) if(b[j][k][m] && b[i][k][l + m]) {
      if(ans > mmax(n[i], mmax(n[j] + l, n[k] + l + m))) ans = mmax(n[i], mmax(n[j] + l, n[k] + l + m));
    }
  }
  printf("%lld", ans);
  return 0;
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  ll ans = 1;
  ll n, k;
  cin >> n >> k;
  const ll mod = 1e9+7;

  vl a(n+1);
  iota(all(a), 0LL);

  rep(i,1,n+1) a[i] += a[i-1];
  rep(i,k,n+1) {
    ans += (a[n] - a[n-i] - a[i-1] + 1)%mod;
    ans %= mod;
  }

  ans %= mod;
  ans += mod;
  ans %= mod;

  cout << ans << '\n';

}

Measured memory_bytes: 4728