akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vl vector<ll>
#define pll pair<ll, ll>
#define vll vector<pll>
#define coutp cout << fixed << setprecision(12)
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

ll power(ll x, ll y, ll m)
{
    ll res = 1;
    x = x % m;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % m;
        y = y >> 1;
        x = (x * x) % m;
    }
    return res;
}

void solve()
{
    int n;
    cin>>n;
    vector<ld> a(n);
    vector<vector<ld>> dp(n,vector<ld>(n+1,0));
    for(int i=0;i<n;i++) {
        cin>>a[i];
    }
    dp[0][0] = a[0];
    dp[0][1] = (ld)1-a[0];
    for(int i=1;i<n;i++) {
        dp[i][0] = dp[i-1][0]*a[i];
        for(int j=1;j<=i+1;j++) {
            dp[i][j] = dp[i-1][j]*a[i]+dp[i-1][j-1]*((ld)1-a[i]);
        }
    }
    ld ans=0;
    for(int i=0;i<(n+1)/2;i++) {
        ans+=dp[n-1][i];
    }

    coutp<<ans;


}

int main()
{
    fastio;
    int t;
    t = 1;
    //cin >> t;
    //int test=t;
    
    while (t-- > 0)
    {
        //cout<<"Case #"<<(test-t)<<": ";
        solve();
        cout << newl;
    }

    return 0;
}

Measured memory_bytes: 143928
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

typedef long long s64;

const int MaxNF = 1344;

const int M = 1000000007;
const int I2 = M + 1 >> 1;

inline int modpow(int a, const int &n)
{
	int res = 1;
	for (int i = n; i; i >>= 1)
	{
		if (i & 1)
			res = (s64)res * a % M;
		a = (s64)a * a % M;
	}
	return res;
}

int n, nK;

int nF = 0, fac[MaxNF];

int f[MaxNF];

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

	int l = floor(sqrt(n));
	for (int i = 1; i <= l; ++i)
		if (n % i == 0)
		{
			fac[nF++] = i;
			if (i != n / i)
				fac[nF++] = n / i;
		}

	sort(fac, fac + nF);

	int res = 0;
	for (int i = 0; i < nF; ++i)
	{
		f[i] = modpow(nK, fac[i] + 1 >> 1);

		for (int k = 0; k < i; ++k)
			if (fac[i] % fac[k] == 0)
				f[i] = (f[i] + M - f[k]) % M;

		int ways = (s64)f[i] * fac[i] % M;
		if (~fac[i] & 1)
			ways = (s64)ways * I2 % M;

		res = (res + ways) % M;
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
/* ex8_2 
melo */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 1000001
typedef struct node{
    char elem;
    struct node *next;
} node;
void push(node **first,char elem);
char pop(node **first);

int main(void){
    int i,count=0;
    char color[SIZE];
    node *first=NULL;
    scanf("%s",color);
    for(i=0;i<strlen(color);i++){
        if(first==NULL){
            push(&first,color[i]);
        }
        else if(color[i]==first->elem){
            push(&first,color[i]);
        }
        else{
            pop(&first);
            count+=2;
        }
    }
    printf("%d\n",count);
    return 0;
}

void push(node **first,char elem){
    node *new =calloc(1,sizeof(node));
    if(new==NULL)exit(1);
    new->elem=elem; 
    new->next=*first;
    *first=new;
}
char pop(node **first){
    char elem;
    node *tmp =*first;
    if(tmp==NULL)exit(1);
    elem=tmp->elem;
    *first=tmp->next;
    free(tmp);
    return elem;
}

Measured memory_bytes: 4964
#include <bits/stdc++.h>
#include <vector>
#include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9+5;
const int mod = 1e9+7;

signed main(){
    int n;
    cin >> n;
    int cnt = 0;
    rep(i,n) {
        int x,y;
        cin >> x >> y;
        if(x==y)cnt++;
        else cnt = 0;
        if(cnt==3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


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

struct Num_parse {
    ll num, ind;
    Num_parse(){}
    Num_parse(ll num, ll ind):num(num),ind(ind){}
};

Num_parse number_parse(const string &s, int ind) {
    string num;
    ll ret_ind;
    for (int i = ind; i >= 0; --i) {
        if ('0' <= s[i] && s[i] <= '9') {
            num.push_back(s[i]);
            ret_ind = i;
        }
        else break;
    }
    reverse(num.begin(), num.end());
    ll ret_num = stol(num);
    return (Num_parse(ret_num, ret_ind));
}

void parse(const string &s, vector<vector<int>> &g, vector<ll> &node) {
    int n = s.length();
    stack<int> st;
    int node_num = 0;
    
    st.push(node_num);

    for (int i = n-2; i >= 0; --i) {
        if (s[i] == ']') {
            node_num++;
            int v = st.top();
            g[v].push_back(node_num);
            st.push(node_num);
        }
        else if (s[i] == '[') {
            st.pop();
        }
        else {
            Num_parse info = number_parse(s,i);
            i = info.ind;
            node[node_num] = (info.num+1)/2;
        }
    }
    return;
}

ll dfs(int x, vector<vector<int>> &g, vector<ll> &node) {
    priority_queue<ll, vector<ll>, greater<ll>> pq;
    
    if (node[x] != -1) return node[x];

    for (auto &&e: g[x]) pq.push(dfs(e,g,node));

    int over_half_children = (pq.size()+1)/2;
    ll ret = 0;
    rep(i,over_half_children) {
        ret += pq.top();
        pq.pop();
    }

    return ret;
}

int main() {
    int n;
    cin >> n;
    rep(i,n) {
        string s;
        cin >> s;
        vector<vector<int>> g(114514);
        vector<ll> node(114514, -1ll);
        parse(s,g,node);
        cout << dfs(0, g, node) << endl;
    }

    return 0;
}


Measured memory_bytes: 6832
(let* ((n (read))
       (m (cons (read) (read)))
       (ans (make-array (1- n) :element-type 'fixnum :initial-element 0)))
  (loop :for to :from 2 :upto n
        :do(loop :for fr :from 1 :upto (1- to)
                 :do (incf (aref ans
                                 (1- (min (- to fr)
                                          (+ (abs (- (car m) fr)) 1 (abs (- (cdr m) to)))))))))
  (loop :for k :across ans
        :do(format t "~A~%" k)))

Measured memory_bytes: 17380
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;

int n;
bool prime[55556];

int main(){
  cin>>n;
  for(int i=0;i<55556;i++)prime[i]=1;
  prime[0]=0;prime[1]=0;
  for(int i=2;i<55556;i++){
    if(prime[i]!=1)continue;
    int now=i+i;
    while(now<55556){
      prime[now]=0;
      now+=i;
    }
  }
  int cont=0;
  for(int i=1;i<55556;i+=10){
    if(prime[i]==1){
      cout<<i;
      cont++;
      if(cont==n){
        cout<<endl;
        break;
      }else{
        cout<<" ";
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
 int main(void){
     int n, q;
     scanf("%d", &n);
     int S[n];
     for(int i=0; i<n; i++){
         scanf("%d", &S[i]);
     }
     scanf("%d", &q);
     int T[q];
     for(int i=0; i<q; i++){
         scanf("%d", &T[i]);
     }
    int count = 0;
    int flag=1;
     for(int i=0; i<q; i++){
         
         for(int j=0; j<n; j++){
             if(S[j]==T[i] && flag==1){
                 count++;
                 flag=0;
                 
                 
             }
             
         }
     flag=1;
     }
     

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

     return 0;
 }

 


Measured memory_bytes: 2108
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sys/time.h>

using namespace std;

const long long mod = 1000000007;

void solve(long long N, long long M, vector<long long> S, vector<long long> T){
  vector<long long> w(N, 1);
  long long a, t;
  long long ans = 1;
  for (int i = 0; i < M; i++) {
    a = 0;
    for (int j = 0; j < N; j++) {
      if (T[i] == S[j]) {
        ans += w[j];
        ans %= mod;
        t = a;
        a += w[j];
        a %= mod;
        w[j] += t;
        w[j] %= mod;
      } else {
        w[j] += a;
        w[j] %= mod;
      }
    }
  }
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  long long M;
  scanf("%lld",&N);
  vector<long long> S(N);
  scanf("%lld",&M);
  vector<long long> T(M);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&S[i]);
  }
  for(int i = 0 ; i < M ; i++){
    scanf("%lld",&T[i]);
  }
  solve(N, M, S, T);
  return 0;
}


Measured memory_bytes: 384
n = int(input())
w = 1000000007

if(n == 1):
  print(0)
  exit()
if(n == 2):
  print(2)
  exit()
  
ans1 = 1


for i in range(n):
  ans1 = ans1*10%w
  
ans2 = 2

for i in range(n):
  ans2 = ans2*9%w
  
ans3 = 1

for i in range(n):
  ans3 = ans3*8%w

ans = ans1-ans2+ans3
ans %= w
ans += w
ans %= w

print(ans)



Measured memory_bytes: 8996
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int W = sc.nextInt();
        // dp[i]：価値がiとなるときの最小の重さ
        int[] dp = new int[N * 1000 +1];
        Arrays.fill(dp, (int)Math.pow(10, 9)+1);
        dp[0] = 0;
        for(int i = 0; i < N; i++){
            int w = sc.nextInt();
            int v = sc.nextInt();
            for(int j = dp.length-1; j >= v; j--){
                dp[j] = Math.min(dp[j], dp[j-v] + w);
            }
        }
        for(int i = dp.length-1; i >= 0; i--){
            if(dp[i] <= W) {
                System.out.println(i);
                break;
            }
        }
        sc.close();

    }

}


Measured memory_bytes: 23508
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        int N = S.length;
        int K = sc.nextInt();
        int[][][] dp = new int[N+1][K+1][2];
        dp[0][0][1] = 1;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j <= K; j++) {
                dp[i+1][j][0] += dp[i][j][0];
                if (j+1 <= K) {
                    dp[i+1][j+1][0] += 9*dp[i][j][0];
                }
                int a = S[i]-'0';
                if (a == 0) {
                    dp[i+1][j][1] += dp[i][j][1];
                } else {
                    dp[i+1][j][0] += dp[i][j][1];
                    if (j+1 <= K) {
                        dp[i+1][j+1][0] += (a-1)*dp[i][j][1];
                        dp[i+1][j+1][1] += dp[i][j][1];
                    }
                }
            }
        }
        System.out.println(dp[N][K][0]+dp[N][K][1]);
    }
}



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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  string S; cin >> S;
  int n = S.size(), p = count(S.begin(), S.end(), 'p');
  int ans = n / 2 - p;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	 //cin.tie(0);
	//ios::sync_with_stdio(false);
	//std::cout << std::fixed;
	//std::cout << std::setprecision(12);
	//std::cout << std::defaultfloat;
	int n,k;
	cin>>n>>k;
	if(k==1)cout<<0<<endl;
	else{
		cout<<n-k<<endl;
	}
	return 0;
}


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

#include <cstdlib>  // abs() for integer 絶対値求めやつ

#include <cmath>    // abs() for float, and fabs()

#include <algorithm>

 

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

#define SORT(a) sort((a).begin(),(a).end());

#define che(a,string) cout<<string<<":"<<(a)<<endl;

#define ch(a,string) cout<<string<<":"<<(a)<<" ";

using namespace std;

typedef pair<int,int> P;






int main(){
  int n ; cin >>n ;
  int x = 0; 
  vector<string> S(n);
  rep(i,n){
	  cin>>S[i];
	  int a=S[i].size();
	  char fir,las;
	  fir = S[i].at(0);
	  //2番目以降のしりとりに対しての処理firはこの処理が
	 // 終わった後に更新する。
	  if(i!=0){
		if(fir != las){
		  cout<<"No"<<endl;
		  x=1;
		  break;
		  }
		}
	  las = S[i].at(a-1);
	//  ch(fir,"fir");ch(las,"las");
	  //とりあえず同じの出した時点でout判定して、break;
	  if(1!=x){
	  rep(k,i){
		  if(S[i]==S[k]){
			  cout<<"No"<<endl;
			  x=1;
			  break;
			}
		}
		if(1==x){
		  break;}
	  }
	}
	if(1!=x){
		cout<<"Yes"<<endl;
	  }
	  }


	


Measured memory_bytes: 256
x, y = list(map(int, input().split()))

gA = [1,3,5,7,8,10,12]
gB = [4,6,9,11]
gC = [2]

def ok(x, y, group):
    return (x in group) and (y in group)

if ok(x, y, gA):
    print("Yes")
elif ok(x, y, gB):
    print("Yes")
elif ok(x, y, gC):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
import java.util.Scanner;

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

		int n = sc.nextInt();
		n = n % 10;
		String yomi;
		switch (n) {
			case 3:
				yomi = "bon";
				break;
			case 0:
			case 1:
			case 6:
			case 8:
				yomi = "pon";
				break;
			default:
				yomi = "hon";
		}

		System.out.println(yomi);
	}
}


Measured memory_bytes: 35768
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
  int N, R;
  cin >> N >> R;
  int ans;
  if(N >= 10) ans = R;
  else ans = R + 100*(10-N);
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        final int MOD = 1000000007;
        boolean[] ary = new boolean[n + 1];
        for (int i = 0; i < m; i++) {
            int a = Integer.parseInt(sc.next());
            ary[a] = true;
        }
        int[] dp = new int[n + 1];
        dp[0] = 1;
        for (int i = 1; i <= n; i++) {
            if (!ary[i]) {
                dp[i] += dp[i - 1];
                if (i != 1) {
                    dp[i] += dp[i - 2];
                }
                dp[i] %= MOD;
            }
        }
        System.out.println(dp[n]);
    }
}

Measured memory_bytes: 45260
// H - Grid 1
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define rep(i,n) for(int i=0;i<(n);++i)
#define MOD 1000000007

int main(){
	int H,W; cin>>H>>W;

	vector<string> maze(H);
	rep(h, H) cin>>maze[h];

	vvi dp(H, vi(W, 0)); // (h,w): count
	queue<pair<int,int>> q; // <h,w>
	dp[0][0] = 1;
	q.push({0,0});

	while(q.size()){
		int h,w; tie(h,w) = q.front(); q.pop();

		// right (h,w+1)=(h,w)+(h-1,w+1)
		if(w+1 < W
		&& maze[h][w+1] == '.'
		&& dp[h][w+1] <= 0){
			if(dp[h][w+1] <= 0){
				dp[h][w+1] = dp[h][w];
				if(0 <= h-1) dp[h][w+1] += dp[h-1][w+1];
				dp[h][w+1] %= MOD;
				q.push({h,w+1});
			}
		}

		// down (h+1,w)=(h,w)+(h+1,w-1)
		if(h+1 < H
		&& maze[h+1][w] == '.'
		&& dp[h+1][w] <= 0){
			dp[h+1][w] = dp[h][w];
			if(0 <= w-1) dp[h+1][w] += dp[h+1][w-1];
			dp[h+1][w] %= MOD;
			q.push({h+1,w});
		}

	}
	cout<< dp[H-1][W-1] <<endl;

	// // print ==========================
	// puts("===");//
	// cout<<"H "<<H<<" W "<<W<<"\n";//
	// rep(h,H) cout<<maze[h]<<"\n";//
	// for(auto v:dp){
	// 	for(auto x:v)printf(" %2d",x);
	// 	puts("");
	// }
	// // =================================

}


Measured memory_bytes: 5248
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x=nxtl();
    ll cur=100;
    int c=0;
    while(cur<x)
    {
        cur=(cur*1.01);
        c++;
    }
    cout<<c<<endl;
    
    return 0;   
}




 
 


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

using namespace std;


int main() {
	string s;
	string a;
	cin >> s;
	cin >> a;
	int num = 100;
	for (int i = 0; i < s.length() - a.length() + 1; ++i) {
		bool check = true;
		for (int j = 0; j < a.length(); ++j) {
			if (s[i + j] != '?' && s[i + j] != a[j]) {
				check = false;
				break;
			}
		}
		if (check == true)num = i;
	}

	if (num == 100) {
		cout << "UNRESTORABLE" << endl;
	}
	else {
		for (int i = 0; i < a.length(); ++i) {
			s[num + i] = a[i];
		}
		for (int i = 0; i < s.length(); ++i) {
			if (s[i] == '?') {
				s[i] = 'a';
			}
		}
		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair <int, int>
#define iiii pair <int, pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i, x) for(int (i) = 0; (i) < (x); (i)++)
inline int getint() {
	int x = 0, p = 1; char c = getchar();	
	while (c <= 32) c = getchar();
	if (c == 45) p = -p, c = getchar();
	while (c > 32) x = x * 10 + c - 48, c = getchar();
	return x * p;
}
using namespace std;
//ruogu_alter
const int N = 5005;
int n, fac[N], sz[N], tmp[N], dp[N][N];
vector<int> g[N];
//
inline void add(int &x, int y) {
	x += y; if (x >= MOD) x -= MOD;
}
inline void sub(int &x, int y) {
	x -= y; if (x < 0) x += MOD;
}
inline int mul(int x, int y) {
	ll ans = 1ll * x * y;
	return ans % MOD;
}
inline int modpow(int x, int y) {
	int ans = 1;
	while (y) {
		if (y & 1) ans = mul(ans, x);
		x = mul(x, x);
		y >>= 1;
	}
	return ans;
}
void dfs(int x, int p) {
	sz[x] = dp[x][1] = 1;
	rep(ii, g[x].size()) {
		int to = g[x][ii];
		if (to == p) continue;
		dfs(to, x);
		rep(i, sz[x] + 1) {
			tmp[i] = dp[x][i];
		 	dp[x][i] = 0;
		}
		rep(i, sz[x] + 1) rep(j, sz[to] + 1) {
			add(dp[x][i + j], mul(tmp[i], dp[to][j]));
		}
		sz[x] += sz[to];
	}
	dp[x][0] = 0;
	for (int i = 2; i <= sz[x]; i += 2) {
		sub(dp[x][0], mul(dp[x][i], fac[i]));
	}
}
int main() {
	n = getint();
	fac[0] = 1;
	for (int i = 2; i <= n; i += 2) fac[i] = mul(fac[i - 2], i - 1);
	rep(i, n - 1) {
		int x = getint() - 1, y = getint() - 1;
		g[x].emplace_back(y);
		g[y].emplace_back(x);
	}
	dfs(0, -1);
	dp[0][0] = mul(dp[0][0], MOD - 1);
	cout << dp[0][0] << endl;
	return 0;
}


Measured memory_bytes: 97408
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define NMAX 200001

int a[NMAX], ind[NMAX];
int imos[NMAX];

void reset(int n) {
    for(int i = 0; i < n; i++) imos[i] = 0;
}

int get_int() {
    int res = 0;
    char c = getchar();
    while(c != EOF && c != ' ' && c != '\n') {
        res *= 10;
        res += c - '0';
        c = getchar();
    }
    return res;
}

void put_int(int n) {
    char c[30];
    int sz = 0;
    c[sz++] = (n % 10) + '0';
    n /= 10;
    while(n > 0) {
        c[sz++] = (n % 10) + '0';
        n /= 10;
    }
    for(int i = sz-1; i >= 0; i--) {
        putchar(c[i]);
    }
    putchar('\n');
}

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

int min(int a, int b) { 
    if(a < b) return a;
    else return b;
}

int main(){

    int n, k;
    n = get_int();
    k = get_int();
    for(int i = 0; i < n; i++) a[i] = get_int();

    for(int itr = 0; itr < k; itr++) {
        reset(n+1);
        for(int i = 0; i < n; i++) {
            ind[i] = max(0, i - a[i]);
        }
        for(int i = 0; i < n; i++){
            imos[ind[i]]++;
        }
        for(int i = 0; i < n; i++) {
            ind[i] = min(n, i + a[i] + 1);
        }
        for(int i = 0; i < n; i++) {
            imos[ind[i]]--;
        }
        int acc = 0;
        for(int i = 0; i < n; i++){
            acc += imos[i];
            a[i] = acc;
        }
        int sum = 0;
        for(int i = 0; i < n; i++) sum += a[i];
        if(sum == n * n) break;
    }

    for(int i = 0; i < n; i++) put_int(a[i]);
    return 0;
}


Measured memory_bytes: 4060
n, k = map(int, input().split())
k = k-1
s = input()

for i in range(n):
  if i != k:
    print(s[i], end="")
  else:
    if s[k] == "A":
      print("a", end="")
    elif s[k] == "B":
      print("b", end="")
    elif s[k] == "C":
      print("c", end="")

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

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
const int N=3e5+5,MAX=3e7,MOD=1e9+7;
 
using namespace std;


int n;
int main()
{
   	
 	

    	int n;

    	cin>>n;
    	n--;
    	cout<<(ll)n*(n+1)/2<<endl;

}	


Measured memory_bytes: 256
//    https://youtu.be/N3oCS85HvpY

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
typedef pair<long long, long long> pll;
const long long inf = 2000000000000000000LL;	// 2e18
#define pi                  acos(-1.0)
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define shesh               "\n"
#define ff                  first
#define ss                  second
#define pb                  push_back
#define bp                  pop_back
#define pf                  push_front
#define fp                  pop_front
#define ub                  upper_bound
#define lb                  lower_bound
#define all(x)              x.begin(), x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"
#define mest(a,b)           memset(a,b,sizeof(a))
set<ll>edges[60];
bool vis[60];
ll counter;
void dfs(ll node){
    vis[node]=true;
    counter++;
    for(auto it=edges[node].begin();it!=edges[node].end();it++){
        if(!vis[*it]) dfs(*it);
    }
    return;
}
int main(){
    fast;
    ll t,n,m,i,j,k,temp,flag,ans=0,a,b;
    cin>>n>>m;
    vector<pair<ll,ll> >v;
    for(i=0;i<m;i++){
        cin>>a>>b;
        v.pb({a,b});
        edges[a].insert(b);
        edges[b].insert(a);
    }
    for(i=0;i<m;i++){
        if(i){
            edges[v[i-1].ff].insert(v[i-1].ss);
            edges[v[i-1].ss].insert(v[i-1].ff);
        }
        edges[v[i].ff].erase(edges[v[i].ff].lower_bound(v[i].ss));
        edges[v[i].ss].erase(edges[v[i].ss].lower_bound(v[i].ff));
        for(j=1;j<=n;j++){
            vis[j]=false;
        }
        counter=0;
        dfs(1);
        if(counter<n) ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int N, i;
    long int dif=0;
    scanf("%d", &N);
    long int A[N];
    for(i=0; i<N; i++){
        scanf("%ld", &A[i]);
    }

    i=0;
    while(i < (N-1)) {
        if(A[i] > A[i+1]) {
            dif += A[i] - A[i+1];
            A[i+1] += A[i] - A[i+1];
        }
        i++;
    }

    printf("%ld\n", dif);
    
    return 0;
}

Measured memory_bytes: 3284
#include <stdlib.h>
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
    int N;
    cin >> N;

    long long A[N+1];

    long long diffA[N+5];
    long long cumsumA[N+5];
    long long ans[N+5];

    for(int i=0;i<N+5;i++){
        diffA[i] = 0;
        cumsumA[i] = 0;
        ans[i] = 0;
    }

    A[0] = 0;
    A[N+1] = 0;
    for(int i=1;i<=N;i++){
        cin >> A[i];
        cumsumA[i] = 0;
    }

    diffA[0] = A[0];
    for(int i=0;i<=N;i++){
        diffA[i+1] = abs(A[i+1] - A[i]);
    }
    cumsumA[0] = diffA[0];
    for(int i=1;i<=N+1;i++){
        cumsumA[i] = cumsumA[i-1] + diffA[i];
    }


    for(int i=1;i<=N;i++){
        if((A[i+1]- A[i]) * (A[i]- A[i-1]) >= 0){
            ans[i] = cumsumA[N+1];
        }
        else{
            ans[i] = cumsumA[N+1] - diffA[i] - diffA[i+1] + abs(A[i+1] - A[i-1]);
        }
    }
    for(int i=1;i<=N;i++){
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
typedef long long LL;
using namespace std;

int main() {
  LL n, m;
  cin >> n >> m;
  pair<LL, LL> p[n];
  for (int i = 0; i < n; i ++) cin >> p[i].first >> p[i].second;

  sort(p, p+n);
  LL ans = 0;
  int i = 0;
  while (m > 0) {
    if (m >= p[i].second) {
      ans += p[i].first * p[i].second;
      m -= p[i].second;
    } else {
      ans += m * p[i].first;
      m -= p[i].second;
    }
    i ++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <cstdio>
#include<iostream>
typedef long long ll;
using namespace std;
int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans1=a*c;
    ll ans2=a*d;
    ll ans3=b*c;
    ll ans4=b*d;
    cout<<max(max(ans1,ans2),max(ans3,ans4));
    return 0;
}


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

using ll = long long;
#define pq priority_queue
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

int main() {
   int t[] = {500, 100, 50, 10, 5, 1};
   int n, cnt;
   while (cin >> n, n) {
      n = 1000 - n, cnt = 0;
      for (int i = 0; i < 6; i++) {
         cnt += n / t[i];
         n %= t[i];
      }
      cout << cnt << endl;
   }

   return 0;
}


Measured memory_bytes: 2972
n,m,x,y=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=max(a);d=min(b)
if c>=d:print('War')
else:
  if c>=y or d<=x:print('War')
  else:print('No War')

Measured memory_bytes: 3060
str = gets.chomp
gets

while input = gets
    input = input.chomp.split(" ")
    
    case input[0]
    when "replace"
        str = str.slice(0, input[1].to_i) << input[3] << str.slice(input[2].to_i + 1, str.length - 1 - input[2].to_i)
    when "reverse"
        tmp = str.slice(input[1].to_i, input[2].to_i + 1 - input[1].to_i).split("").reverse
        str = str.slice(0, input[1].to_i) << tmp.join() << str.slice(input[2].to_i + 1, str.length - 1 - input[2].to_i)
    when "print"
        puts str.slice(input[1].to_i, input[2].to_i + 1 - input[1].to_i)
    end
end


Measured memory_bytes: 8936
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU

lcsTable :: BS.ByteString -> BS.ByteString -> V.Vector (VU.Vector Int)
lcsTable xs ys = V.scanl step (VU.replicate (m+1) 0) xs'
  where
    n = BS.length xs
    m = BS.length ys
    xs' = V.generate n $ BS.index xs :: V.Vector Char
    ys' = VU.generate m $ BS.index ys :: VU.Vector Char
    step :: VU.Vector Int -> Char -> VU.Vector Int
    step v x = VU.scanl innerStep 0 (VU.zip3 v (VU.tail v) ys')
      where
        innerStep :: Int -> (Int,Int,Char) -> Int
        innerStep a (b,c,y) | x == y = 1 + b
                            | otherwise = max a c

construct :: V.Vector (VU.Vector Int) -> BS.ByteString -> BS.ByteString -> (Int,Int) -> BS.ByteString -> BS.ByteString
construct dp xs ys (m,n) bs 
  | m == 0 || n == 0 = bs 
  | BS.index xs (m-1) == BS.index ys (n-1) = construct dp xs ys (m-1,n-1) (BS.cons (BS.index xs (m-1)) bs) 
  | otherwise = 
    let
      rd1 = (dp V.! (m-1)) VU.! n
      rd2 = (dp V.! m) VU.! (n-1)
    in
      if rd1 >= rd2 then construct dp xs ys (m-1,n) bs
                    else construct dp xs ys (m,n-1) bs
main = do 
  xs <- BS.getLine
  ys <- BS.getLine
  let dp = lcsTable xs ys 
  putStrLn $ BS.unpack $ construct dp xs ys (BS.length xs, BS.length ys) BS.empty

Measured memory_bytes: 74876
fun main() {
    val MOD = 1_000_000_007
    val s = next()
    val dp = sized2DArray(s.length + 1, 4, 0L)
    dp[s.length][3] = 1
    (s.lastIndex downTo 0).forEach { i ->
        val c = s[i]
        val m1 = if (c == '?') 3 else 1
        dp[i][3] = (dp[i + 1][3] * m1).rem(MOD)
        (2 downTo 0).forEach { j ->
            val m2 = when {
                c == '?' -> 1
                j == 0 && c == 'A' -> 1
                j == 1 && c == 'B' -> 1
                j == 2 && c == 'C' -> 1
                else -> 0
            }
            dp[i][j] = ((m1 * dp[i + 1][j]).rem(MOD) + (m2 * dp[i + 1][j + 1]).rem(MOD)).rem(MOD)
        }
    }
    println(dp[0][0])
}

// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)

// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }

// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

fun gcd(x: Int, y: Int): Int {
    fun innerGcd(x: Int, y: Int): Int {
        return if (x % y == 0) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

fun gcd(x: Long, y: Long): Long {
    fun innerGcd(x: Long, y: Long): Long {
        return if (x % y == 0L) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

// classes
class UnionFindTree(val size: Int) {
    private val r = sizedArray(size, -1)
    fun root(x: Int): Int {
        if (r[x] < 0) return x
        return root(r[x])
    }

    fun unite(x: Int, y: Int) {
        var rx = root(x)
        var ry = root(y)
        if (rx == ry) return
        if (r[rx] > r[ry]) {
            rx = ry.also { ry = rx }
        }
        r[rx] += r[ry]
        r[ry] = rx
    }

    fun size(x: Int) = -r[root(x)]

    override fun toString(): String {
        return r.joinToString(separator = ", ")
    }
}

Measured memory_bytes: 63568
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999


int main(){
    int pass[110][110];
    rep(i,110)rep(j,110)pass[i][j]=INF;
    
    int n,m;
    cin>>n>>m;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        for(int j=a;j<=b;j++)pass[j][b+1]=1;
    }
    
    rep(k,n+1){
        rep(i,n+1){
            rep(j,n+1){
                pass[i][j] = min(pass[i][j],pass[i][k]+pass[k][j]);
            }
        }
    }

    if(pass[0][n]>=10000)cout<<"Impossible"<<endl;
    else cout<<pass[0][n]<<endl;
}

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

const int N = 2e5 + 10;
const int M = 8010;
const int L = 4010;
const int mod = 1e9 + 7;

typedef long long LL;

LL F[M], R[M];
int dp[L][L];
int X[N], Y[N];

inline void add(int &x, int y){
	x += y;
	if(x >= mod)	x -= mod;
}

LL pow_mod(LL x, int p){
	LL s = 1;
	while(p){
		if(p & 1)	s = s * x % mod;
		x = x * x % mod;
		p >>= 1;
	}
	return s;
}

LL C(int n, int m){
	return F[n] * R[m] % mod * R[n-m] % mod;
}

int main(){
	F[0] = R[0] = 1;
	for(int i=1; i<M; i++){
		F[i] = F[i-1] * i % mod;
		R[i] = pow_mod(F[i], mod-2);
	}
	int n;
	while(~scanf("%d", &n)){
		memset(dp, 0, sizeof(dp));
		for(int i=0; i<n; i++){
			scanf("%d %d", X+i, Y+i);
			dp[2000-X[i]][2000-Y[i]]++;
		}
        for(int i=0; i<L; i++){
			for(int j=0; j<L; j++){
				if(i==0 && j==0){
					continue;
				} else if(i == 0){
					add(dp[i][j], dp[i][j-1]);
				} else if(j == 0){
					add(dp[i][j], dp[i-1][j]);
				} else{
					add(dp[i][j], dp[i][j-1]);
					add(dp[i][j], dp[i-1][j]);
				}
			}
        }
        LL ans = 0;
        for(int i=0; i<n; i++){
            ans = ans + dp[2000+X[i]][2000+Y[i]] - C(X[i]+Y[i]<<1, X[i]<<1);
            ans = (ans % mod + mod) % mod;
        }
        printf("%lld\n", ans * pow_mod(2, mod-2) % mod);
	}
	return 0;
}


Measured memory_bytes: 64640
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define MOD 1000000007
#define MAXN 100000

LL fastExponentiation(LL base, int p) {
    if (p == 0)
        return 1;

    LL half = fastExponentiation(base, p/2);
    LL halfhalf = (half * half)%MOD;

    if (p%2 == 0)
        return halfhalf;
    else
        return (halfhalf * base)%MOD;
}

int N, K;
vector<int> adj[MAXN + 3];
LL fact[MAXN + 3], answer;

LL P(int n, int k) {
    if (n < k)
        return 0;

    LL numerator = fact[n];
    LL denominator = fastExponentiation(fact[n - k], MOD - 2);
    return (numerator * denominator)%MOD;
}

void dfs(int u, int prv, int depth) {
    if (depth == 0) {
        int numChild = (int) adj[u].size();
        answer = (answer * P(K, numChild + 1))%MOD; //number of ways to color the first 2 depth
    } else {
        int numChild = (int) adj[u].size() - 1;
        answer = (answer * P(K - 2, numChild))%MOD;
    }

    for (auto v: adj[u]) {
        if (v != prv)
            dfs(v, u, depth + 1);
    }
}

int main() {
    fact[0] = 1;
    for (int i = 1; i <= MAXN; i++)
        fact[i] = (fact[i - 1] * i)%MOD;

    cin >> N >> K;
    for (int i = 1; i < N; i++) {
        int u, v;
        cin >> u >> v;

        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    answer = 1;
    dfs(1, 1, 0);

    cout << answer << endl;
}


Measured memory_bytes: 9984
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> count(100005);
  ll sum=0;
  rep(i, n){
    cin >> a[i];
    sum+=a[i];
    count[a[i]]++;
  }
  int q;
  cin >> q;
  rep(i, q){
    int b, c;
    cin >> b >> c;
    count[c]+=count[b];
    sum+=(c-b)*count[b];
    count[b]=0;
    cout << sum << endl;
  }
  return 0;
}


Measured memory_bytes: 4028
#include <iostream>
    #include <stdio.h>
    #include <string>
    #include <cstdlib>
    #include <cmath>
    #include <algorithm>
    #include <string.h>
    #include <queue>
    #include <stack>
    #define _USE_MATH_DEFINES
    #define LL long long
    #define front top
    using namespace std;
    const double PI = acos(-1.0);
     
    int smax(int ary[]) {
    	int m = 0;
    	for (int i = 0; i < sizeof(ary) / sizeof(ary[0]); i++)
    		if (m < ary[i]) m = ary[i];
    	return m;
    }
     
    int nmax(int ary[]) {
    	int max = 0, num;
    	for (int i = 0; i < sizeof(ary) / sizeof(ary[0]); i++)
    		if (max < ary[i]) {
    			max = ary[i];
    			num = i;
    		}
    	return max, num;
    }
     
    bool dfs(int q,int value) {
    	return false;
    }
     
    int max2(int a, int b) {
    	if (a < b) a = b;
    	return a;
    }
     
    int min2(int a, int b) {
    	if (a > b) a = b;
    	return a;
    }
     
    int max3(int a, int b, int c) {
    	return max2(a, max2(b, c));
    }
     
    int min3(int a, int b, int c) {
    	return min2(a, min2(b, c));
    }
     
    int main() {
    	int a, b;
    	cin >> a >> b;
    	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
    		cout << "Possible" << endl;
    	else
    		cout << "Impossible" << endl;
    	return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i < n; ++i)
#define repe(i, n) for(int i=0; i <= n; ++i)
#define repr(i, n) for(int i=n-1; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)

using namespace std;
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;}
template <class T> using V=vector<T>;
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main() {
    int a,b;
    cin >> a >> b;
    cout << max(a+b, max(a-b, a*b)) << "\n";
}




Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
const ll INF = (ll)1e18 + 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    int a,b; cin >> a >> b;
    
    if(a>b){
        cout << a+(a-1) << ln;
    }else if(a<b){
        cout << b+(b-1) << ln;
    }else{
        cout << a+b << ln;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long  
#define pb push_back 
#define mod 1e9+7
 
int main(){
      ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);    
       ll n;
            cin>>n;
      set<long>s;
  for(ll i=0; i<n; i++)
  {  ll k;
      cin>>k;
     s.insert(k);
   
  }
     if(s.size()==n)
        cout<<"YES"<<endl;
  else
      cout<<"NO"<<endl;
  
  
    }


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

int main(){
  long N;
  int f=0;
  cin >> N;
  long X = N;
  for(int i=1; i<=8; i++){
    f += X % 10;
    X /= 10;
  }
  if(N%f==0){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

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

#define MAX 1000000

int main(void)
{
    int i, j;

    bool isPrime[MAX];
    isPrime[0] = isPrime[1] = false;
    for (i = 2; i < MAX; i++) {
        isPrime[i] = true;
    }

    int n, n_max = 2;
    int cnt;
    while (scanf("%d", &n) != EOF) {
        if (n > n_max) {
            for (i = n_max; i <= n; i++) {
                if (isPrime[i] == true) {
                    for (j = i + i; j <= n; j += i) {
                        isPrime[j] = false;
                    }
                }
            }
        }
        cnt = 0;
        for (i = 2; i <= n; i++) {
            if (isPrime[i] == true) {
                cnt++;
            }
        }
        printf("%d\n", cnt);

    }

    return 0;
}

Measured memory_bytes: 1572
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	char a;
	cin >> a;
	cout << ++a << endl;


}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CTaxIncrease solver = new CTaxIncrease();
        solver.solve(1, in, out);
        out.close();
    }

    static class CTaxIncrease {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int l = 1;
            int r = 1250;
            while (l < r) {
                int mid = (l + r) / 2;
                if ((int) (mid * 0.08f) < a) {
                    l = mid + 1;
                } else if ((int) (mid * 0.1f) < b) {
                    l = mid + 1;
                } else {
                    r = mid;
                }
            }
            if ((int) (l * 0.08f) == a && (int) (l * 0.1f) == b) out.println(l);
            else out.println(-1);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 25300
#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(a>b) swap(a,b);
if(a>c) swap(a, c);
if(b>c) swap(b,c);
cout<<a<<" "<<b<<" "<<c<<endl;
return 0;

}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define M (ll)1000000007
#define MM (ll)1e8
#define INF (ll)1e18
#define arep(i, x, n) for (long long i = x; i < n; i++)
#define rep(i, n) for (long long i = 0; i < n; ++i)
#define pi 3.141592653589793
#define eps 0.00000001
int main() {
    ll a;
    ll b;
    ll c;
    cin >> a >> b >> c;
    ll k;
    cin >> k;

    ll cnt = 0;
    while (a >= b) {
        cnt++;
        b = b * 2;
    }
    while(b >= c){
        cnt++;
        c = c * 2;
    }

    if(cnt <= k){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int a[200000];
signed main(){
	int n,m;cin>>n>>m;
	rep(i,n)scanf("%d",&a[i]);
	map<int,int>mp;
	ll sum=0;
	mp[0]++;
	ll cnt=0;
	rep(i,n){
		sum+=a[i];
		sum%=m;
		cnt+=mp[sum];
		mp[sum]++;
	}
	cout<<cnt<<endl;
}

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

int main() {
    int n;
    cin >> n;
    map<string,int> m;
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        m[s]++;
    }
    vector<string> ans;
    int max = 0;
    for(auto x : m){
        if(x.second > max){
            max = x.second;
        }
    }
    for(auto x : m){
        if(x.second != max){
            continue;
        }
        ans.push_back(x.first);
    }
    sort(ans.begin(),ans.end());
    for(int i=0; i<ans.size(); i++){
        cout << ans.at(i) << endl;
    }
}

Measured memory_bytes: 26868
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
using namespace std;

double EPS = 1e-10;

struct edge{
    int u,v;
    double cost;
};

double add(double a,double b){
    if( fabs(a+b) < EPS * (fabs(a)+fabs(b)) ) return 0;
    return a+b;
}

struct P{
    
    double x,y;
    int id;
    
    P() {}
    
    P(double x,double y,int id) : x(x), y(y), id(id) {
    }
    
    P operator + (P p){
        return P(add(x,p.x),add(y,p.y),id);
    }
    
    P operator - (P p){
        return P(add(x,-p.x),add(y,-p.y),id);
    }
    
    P operator * (double d){
        return P(x*d,y*d,id);
    }
    
    double dot(P p){
        return add(x*p.x,y*p.y);
    }
    
    double cross(P p){
        return add(x*p.y,-y*p.x);
    }
};

struct UF{
    
    int par[110];
    
    UF(int n){
        for(int i=0;i<=n;i++) par[i] = i;
    }
    
    int find(int x){
        if(par[x] == x) return x;
        return par[x] = find(par[x]);
    }
    
    void unite(int x,int y){
        x = find(x);
        y = find(y);
        if(x < y) par[y] = x;
        if(x > y) par[x] = y;
    }
   
    bool same(int x,int y){
        return find(x) == find(y);
    }
    
};

bool comp(const edge& e1,const edge& e2){
    return e1.cost < e2.cost;
}

bool cmp_x(const P& p,const P& q){
    if(p.x != q.x) return p.x < q.x;
    return p.y < q.y;
}

vector<P> ps,qs;

void convex_hull(int n){
    sort(ps.begin(),ps.end(),cmp_x);
    int k=0;
    qs.resize(n*2);
    for(int i=0;i<n;i++){
        while(k>1 && (qs[k-1]-qs[k-2]).cross(ps[i]-qs[k-1]) <= 0) k--;
        qs[k] = ps[i];
        k++;
    }
    for(int i=n-2,t=k;i>=0;i--){
        while(k>t && (qs[k-1]-qs[k-2]).cross(ps[i]-qs[k-1]) <= 0) k--;
        qs[k] = ps[i];
        k++;
    }
    qs.resize(k-1);
    qs.push_back(qs[0]);
}

double dist(P p,P q){
    return sqrt( (p-q).dot(p-q) );
}


int main()
{
    int v,r,s,t;
    double x,y,ans;
    
    cin >> v >> r;
    for(int i=0;i<v;i++){
        cin >> x >> y;
        ps.push_back(P(x,y,i));
    }
    
    vector<edge> es;
    for(int i=0;i<r;i++){
        cin >> s >> t;
        es.push_back( (edge){s-1,t-1,dist(ps[s-1],ps[t-1])} );
    }
    
    ans = 0;
    convex_hull(v);
    UF uf(v);
    for(int i=0;i<qs.size()-1;i++){
        ans += dist(qs[i],qs[i+1]);
        uf.unite(qs[i].id,qs[i+1].id);
    }
    
    sort(es.begin(),es.end(),comp);
    for(int i=0;i<es.size();i++){
        if(!uf.same(es[i].u,es[i].v)){
            ans += es[i].cost;
            uf.unite(es[i].u,es[i].v);
        }
    }
    
    printf("%.6lf\n",ans);
    return 0;
}



Measured memory_bytes: 3280