akhauriyash/Code-Regression huggingface dataset:
/*
ÂmÂ[ÂhÂÃ° n/2 ÂÃÂÃ2ÂÃÂÃÂOÂÂÂ[ÂvÂÃÂÂªÂÂ¯ÂÃ©

  ÂOÂÂÂ[Âv1   ÂOÂÂÂ[Âv2
  ---------   ---------
          1           0
          2           5
          3           4

ÂÂ±ÂÃ2ÂÃÂÃÂOÂÂÂ[ÂvÂÃ°ÂÃÂÂºÂÃÂÂÂÃÂÃÂMÂUÂMÂUÂÃÂÃÂÃÂÂ°ÂÃ©ÂÃ1ÂpÂ^Â[ÂÂÂÃÂÂ«ÂÂ ÂÂªÂÃ©.
  0 -> 1 -> 5 -> 2 -> 4 -> 3

ÂÂ³ÂÃ§ÂÃ, ÂÂ±ÂÃÂpÂ^Â[ÂÂÂÃ°ÂÂ½ÂÂÂvÂÃ±ÂÃ¨ÂÃÂÂÂÃÂÃÂÃ±Â]ÂÂ³ÂÂ¹ÂÃÂÂ¢ÂÂ­ÂÃ,
  0 -> 1 -> 5 -> 2 -> 4 -> 3
  1 -> 2 -> 0 -> 3 -> 5 -> 4
  2 -> 3 -> 1 -> 4 -> 0 -> 5
ÂÃÂÃ°ÂÂ¤ÂLÂÂµÂÃÂÂ¢(n / 2)ÂÃÂÃÂSÂÃ¦ÂÃÂÃ°ÂÂ¾ÂÃ©ÂÂ±ÂÃÂÂªÂÃÂÂ«ÂÃ©.

n=ÂÃ´ÂÂÂÃÂÂ ÂÃ©ÂÃÂÂ«, ÂÂ±ÂÃÂ@ÂÂ¥ÂÃÂÂµÂÂ½ÂÂªÂÃÂÃÂSÂÃ¦ÂÃÂÃ°ÂgÂÃÂÃÂÂ¢ÂÃÂÂ½ÂÃªÂÂ,
ÂSÂÃ¦ÂÃÂÃÂgÂÃ­ÂÃÂÂ¢ÂÃ¦ÂÂ¤ÂÃÂÂ³ÂÃÂÃÂGÂbÂWÂÂª1ÂÃÂÃ ÂÂ­ÂÂ¶ÂÂµÂÃÂÂ¢.

ÂÂ±ÂÃÂÂ±ÂÃÂÂ©ÂÃ§, ÂÂ±ÂÃÂÃ»Â@ÂÂªÂÃªÂÃÂÂ½ÂÂ­ÂÂ³ÂÃ±ÂSÂÃ¦ÂÃÂÃ°ÂÃ¬ÂÃ©ÂÂ±ÂÃÂÂªÂÃÂÂ«ÂÃ©.


ÂÂÂÂ½ÂÃÂÂ
  ÂoÂÃÂÂªÂÂ½ÂÂ·ÂÂ¬ÂÃ©ÂÃÂ\ÂzÂÃÂÂ«ÂÃ©ÂÃªÂÂÂÃ, printfÂÃ°ÂgÂÂ¤

 */

#include <iostream>
#include <cstdio>
using namespace std;

char buff[20], output[1000000];

int main(){
  int n, k;

  while(cin >> n >> k){
    if(n / 2 < k){
      printf("-1\n");
      //cout << "-1\n";
      continue;
    }

    int p[n + 2];
    p[0] = 0;

    for(int i = 1; i < n; i += 2){
      p[i] = i / 2 + 1;
      p[i + 1] = n - p[i];
    }

    for(int i = 0; i < k; i++){
      if(i != 0) puts("");

      output[0] = '\0';

      for(int j = 0; j < n - 1; j++){
        int a = (p[j] + i) % n + 1;
        int b = (p[j + 1] + i) % n + 1;

        printf("%d %d\n", a, b);
        //cout << a << " " << b << endl;
      }

      puts(output);
    }
  }
}

Measured memory_bytes: 912
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from functools import lru_cache
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
#main

n=int(input())
dp=[[inf]*3 for _ in range(n+1)]
for i in range(n):
    a,b,c=map(int,input().split())
    if i==0:
        dp[i]=[a,b,c]
    else:
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b
        dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c
print(max(dp[n-1]))



Measured memory_bytes: 89832
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
//#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x,s) for(i=x;i>=s;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<int,int>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define debug(x) cerr<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const ll MAX=2e9;
const ll MM=1e18;
const ll mod=1e9+7;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

ll expo(ll x,ll n,ll M=mod)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%M;}
                x=(x*x)%M;
                n>>=1;
    }
    return ans;
}

void solve()
{
  ll n,m,i;
  cin>>n;
  vl a(n);
  fn(i,n)cin>>a[i];
  //cout<<"Yes"<<i<<endl;
  fn(i,n)if(a[i]==0){cout<<0;return;}
  ull ans=1;
  fn(i,n)
  {
      //debug2(ans,i);
      //ans*=a[i];
      if(ans>(MM/a[i])){cout<<-1;return;}
      ans*=a[i];

  }
  cout<<ans<<endl;
}


int main()
{
  boost;
  ll t=1;
  //cin>>t;
  while(t--)
  {
      solve();
  }
}


Measured memory_bytes: 3988
#include<bits/stdc++.h>
#define pp pair<int,int>
#define MZ 1000000007
#define Pi acos(-1)
#define pq priority_queue

using namespace std;

long long sum[200005];

int main()
{
    int n;
    long long x;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&x);
        sum[i]=sum[i-1]+x;
    }
    x=abs(sum[n]-sum[1]-sum[1]);
    for(int i=2;i<n;i++)
        x=min(x,abs(sum[n]-sum[i]-sum[i]));
    printf("%lld\n",x);
    return 0;
}


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

template<typename T> vector<int> z_algorithm(const int len, const T& in) {
  vector<int> res(len, 0);
  int c = 0;
  for (int i = 1; i < len; ++i) {
    if (i + res[i - c] < c + res[c]) {
      res[i] = res[i - c];
    } else {
      int j = max(0, c + res[c] - i);
      while (i + j < len && in[j] == in[i + j]) j++;
      res[i] = j;
      c = i;
    }
  }
  res[0] = len;
  return res;
}

template<typename T> vector<int> z_algorithm(const T& in) {
  return z_algorithm((int) in.size(), in);
}

template<typename T> vector<int> z_algorithm(const T& in_first, const T& in_second) {
  T combined = T();
  combined.append(in_first);
  combined.append(in_second);
  int n = (int) in_first.size(), m = (int) in_second.size();
  vector<int> v = z_algorithm(n + m, combined);
  vector<int> res(m);
  for (int i = 0; i < m; i++) {
    res[i] = min(n, v[i + n]);
  }
  return res;
}

class UnionFind {
private:
  int siz;
  vector<int> a;

public:
  UnionFind(int x) : siz(x), a(x, -1) {}

  int root(int x) {
    return a[x] < 0 ? x : a[x] = root(a[x]);
  }

  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    siz--;
    if (a[x] > a[y]) swap(x, y);
    a[x] += a[y];
    a[y] =x;
    return true;
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  int size(int x) {
    return -a[root(x)];
  }
  
  int conneted_component() {
  	return siz;
  }
};

signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  string s, t;
  cin >> s >> t;
  int n = (int) s.size(), m = (int) t.size();
  s.append(s);
  s.append(s);
  while ((int) t.size() * 2 > (int) s.size()) s.append(s);
  vector<int> v = z_algorithm(t, s);
  UnionFind uf(n);
  for (int i = 0; i < n; i++) {
    if (v[i] == m && v[i + m] == m) {
      if (!uf.unite(i, (i + m) % n)) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] == m) ans = max(ans, uf.size(i));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 24284
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <tuple>
using namespace std;

signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << min(c, b / a) << endl;
	return 0;
}

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

#define N 100

int main(){
    int n;
    cin >> n;
    int A[N];

    for(int i=0;i < N; i++)A[i] = 0;
    for(int i=0;i < n; i++)cin >> A[i];

    sort(A,A+n);

    cout << A[n-1] - A[0] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = std::pair<ll, ll>;

const ll INF = 1ll<<60;

ll N, M;
std::vector<P> G[100010];
ll dist[100010];
std::priority_queue<P, std::vector<P>, std::greater<P>> pque;

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

  rep( i, N-1 )
    G[i+1].emplace_back( i, 0 );

  rep( i, M )
  {
    ll L, R, C;
    std::cin >> L >> R >> C;
    --L; --R;

    G[L].emplace_back( R, C );
  }

  std::fill( dist, dist+N, INF );
  dist[0] = 0;

  pque.emplace( dist[0], 0 );

  while( !pque.empty() )
  {
    P p = pque.top(); pque.pop();
    ll v = p.second, d = p.first;

    if( dist[v] < d )
      continue;

    for( auto up : G[v] )
    {
      ll u = up.first, cost = up.second;

      if( chmin( dist[u], dist[v]+cost ) )
        pque.emplace( dist[u], u );
    }
  }

  std::cout << (dist[N-1]==INF?-1:dist[N-1]) << std::endl;

  return 0;
}

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

int main() {
    int A, B; cin >> A >> B;

    if (B == 1) {
        cout << 0 << endl;
        exit(0);
    }
    
    int count = 1;

    while(true) {
        if ((1 + (A-1) * count) >= B) break;
        count++;
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
	int a,b,c,x,y,n;
	n=0;
	cin >> a >> b >> c;
	for (x=a;x<=b;x++){
		y= c % x;
		if ( y == 0 ){
			n++;
		}
	}
	cout << n << "\n";
    return 0;
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define vv vector<lli>
#define vp vector<pair<lli,lli>>
#define vpp vector<pair<lli,pair<lli,lli>>>
#define lims(w) (w).begin(),(w).end()
#define rlims(w) (w).rbegin(),(w).rend()
#define pb push_back
#define mp make_pair
#define f(i,a,b) for(lli i=a;i<b;i++)
#define ff first
#define ss second
#define sz(a) (lli)(a.size())
lli inf = (1e18 + 2);

int main()
{
	string s;
	cin>>s;
	lli val = 0;
	lli sum = 0;
	lli n = s.length();

	f(i,0,n)
	{
		val = (lli)(s[i] - '0');
		sum += val;
	}

	if(sum % 9 == 0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}


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

int main() {
  int D;
  scanf("%d", &D);
  int c[27];
  for(int i=1;i<=26;i++){
    scanf("%d", &c[i]);
  }
  int s[366][27];
  int smax[366];
  int smax_idx[366];
  int abc[27]={0};
  for(int i=1;i<=26;i++){
    abc[i]=1;
  }
  for(int i=1;i<=365;i++){
    for(int j=1;j<=26;j++){
      scanf("%d", &s[i][j]);
    }
  }

  for(int i=1;i<=365;i++){
    smax_idx[i]=1;
    smax[i]=0;
    for(int j=1;j<=26;j++){
      if(abc[j]==0) continue;
      if(smax[i]<s[i][j]){
        smax[i]=s[i][j];
        smax_idx[i]=j;
      }
    }
    abc[smax_idx[i]]--;

    if(i%26==0){
      for(int k=1;k<=26;k++){
        abc[k]=1;
      }
    } 
  }

  for(int i=1;i<=365;i++){
    printf("%d\n", smax_idx[i]);
  }
  return 0; 
}

Measured memory_bytes: 2192
#include <iostream>
#include <cstdio>
#include <cstring>

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() {
	int point[100], rank[100], n;
	bool table[301];
	cin >> n;
	
	memset(point, 0, sizeof(point));
	REP(i,n*(n-1)/2) {
		int a, b, c, d;
		scanf("%d %d %d %d", &a, &b, &c, &d);
		point[a-1] += c > d ? 3 : (c < d ? 0 : 1);
		point[b-1] += c < d ? 3 : (c > d ? 0 : 1);
	}

	memset(table, 0, sizeof(table));
	REP(i, n) table[point[i]] = true;
	
	for (int i = 300, k = 1; i >= 0; i--) if (table) {
		int count = 0;
		REP(j, n) if (point[j] == i) {
			rank[j] = k;
			count++;
		}
		k += count;
	}

	REP(i, n) cout << rank[i] << endl;

	return 0;
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int arr [] = {-1,1,3,1,2,1,2,1,1,2,1,2,1};
    int x, y ;
    cin >> x >> y ;
    cout << ( arr[x] == arr[y] ? " Yes " : " No ") << '\n' ;
    return 0;
}


Measured memory_bytes: 3636
import collections
import math
import copy

H,W=map(int,input().split())

A=[list(str(input())) for i in range(H)]
#1<=sy<=R
d=[[-1 for j in range(W)]for i in range(H)]
inf=10**6
ans=0
queue=collections.deque()
for i in range(H):
    for j in range(W):
        if A[i][j]=='#':
            queue.append([i,j])
            d[i][j]=0

moves=[[1,0],[-1,0],[0,1],[0,-1]]

nax=0
while len(queue)>0:
    now=queue.popleft()
    for i in range(4):
        ny=now[0]+moves[i][0]
        nx=now[1]+moves[i][1]
        if 0<=ny and ny<H and 0<=nx and nx<W and A[ny][nx]=='.' and d[ny][nx]==-1:
            d[ny][nx]=d[now[0]][now[1]]+1
            nax=max(nax,d[ny][nx])
            queue.append([ny,nx])


print(nax)


Measured memory_bytes: 211176
import java.util.*;

public class Main {

    public static List<List<Integer>> switchList;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int W = sc.nextInt();
        sc.close();

        if (W >= S) {
            System.out.println("unsafe");
        } else {
            System.out.println("safe");
        }

    }

}

Measured memory_bytes: 35568
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
const ll int INF = 1e18+5;
const ll int mod=1e9+7;
int main()
{
    int n;
    cin >> n;
    vector<double>dp(n+1,0);
    dp[0]=1;
    for(int i=1;i<=n;i++)
    {
        double p;
        cin >> p;
        for(int j=i;j>=0;j--)
        {
            dp[j]=(j==0 ? 0 : dp[j-1]*p) + dp[j]*(1-p);
        }
    }
    double ans=0;
    for(int i=0;i<=n;i++)
    {
        int tails=n-i;
        if(i>tails)
        ans += dp[i];
    }
    cout << setprecision(10)<<ans;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    char S[16]={};
    int count = 0;
    int countS = 0;
    int result = 0;
    
    scanf("%s",S);
    
    for (int i=0; i<16; i++) {
        if ('o'==S[i]) {
            countS++;
            count++;
        }else if('x'==S[i]){
            count++;
        }else{
            
        }
    }
    result = 15 - count;
    result = result + countS;
    if (result >= 8) {
        printf("YES");
    }else{
        printf("NO");
    }
    return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ina(x, n) rep(x_i,n) cin>>x[x_i]

const int INF = (1<<30);

int main() {
  int n, ans = INF; cin >> n;
  vector<int> d(n); ina(d,n);
  sort(d.begin(), d.end());
  int lr[2] = { 0, 0 };
  rep(i,n) {
    ans = min(ans, d[i] - lr[i&1]);
    lr[i&1] = d[i];
  }
  ans = min(ans, 24 - lr[0] - lr[1]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,Y,X;
  int U=0;
  cin>>N>>Y;
  vector<int>vec(N);
  for(X=0;X<N;X++){
    cin>>vec[X];
    if(U+vec[X]<=Y){
      U=U+vec[X];
    }
    else{
      break;
    }
  }
  cout<<X+1<<endl;
}


Measured memory_bytes: 3588
#pragma GCC optimize ('O3')
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mp make_pair
#define f first
#define s second
#define pb push_back

const int N = 5e3 + 5;
const int M = 1e5 + 5;
const ll OO = 1e18;
const int mod = 1e9 + 7;


int n,ans,dp[N][N];
string s;

int main() {

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

    cin >> n >> s;

    for (int i = n-1; ~i; --i) {
        for (int j = n-1; j>i ; --j) {
            if(s[i]==s[j]) ans = max(ans, dp[i][j] = min(dp[i+1][j+1]+1, j-i));
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 70440
#include<bits/stdc++.h>
#define     FAST            ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0);
typedef long long ll;
using namespace std;
int main()
{

    ll n,d,ans=0;
    cin>>n>>d;


    while(n--)
    {
        ll x,y;
        cin>>x>>y;

        x=abs(x);
        y=abs(y);


        double p=sqrt(double(x)*x+double(y)*y);

        //cout<<p<<" p"<<endl;

        if(p<=d)
        {
            ans++;
        }





    }

    cout<<ans<<endl;







    return 0;
}


Measured memory_bytes: 3648
N = input()
A = map(int,raw_input().split(' '))
count = 0
while A[0] != 1:
	flag = True
	for a in A:
		if a % 2 != 0:
			flag = False
			break
	if flag:
		count += 1
		A = [a/2 for a in A]
	else:
		break

print count

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

typedef long long ll;

void print(){ std::cout << std::endl; }
template <typename H> void print(H head) { std::cout << head << std::endl; }
template <typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }
template <typename V> void debugVec(V vec) { ll i = 0LL; for (auto v : vec) print(" [", i++, "] ", v); }

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

  ll N, M;
  std::cin >> N >> M;
  std::map<ll, ll> mcnt;
  std::vector< std::pair<ll, ll> > vp(M);
  //std::vector<ll, std::vector<ll> > vv(N);
  std::vector< std::priority_queue<ll, std::vector<ll>, std::greater<ll> > > vque(N+1);
  for (ll i = 0; i < M; i++) {
    ll P, Y;
    std::cin >> P >> Y;
    vp[i].first  = P;
    vp[i].second = Y;
    vque[P].push(Y);
  }

  std::map< std::pair<ll, ll>, ll > mnum;
  for (ll p = 1; p <= N; p++) {
    ll cnt = 1;
    while (!vque[p].empty()) {
      ll y = vque[p].top(); vque[p].pop();
      mnum[std::make_pair(p, y)] = cnt;
      cnt++;
    }
  }

  for (auto pp : vp) {
    std::cout << std::setfill('0') << std::setw(6) << pp.first;
    std::cout << std::setfill('0') << std::setw(6) << mnum[std::make_pair(pp.first, pp.second)];
    std::cout << std::endl;
  }

  return 0;
}


Measured memory_bytes: 15616
#include<iostream>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<queue>
#include<string.h>
#include<map>
#include<set>
#include<algorithm>
#define ll long long
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)
#define rep(i,a,b) for(int i = a;i < b;i++)
#define N 300004
#define INF 1e9+7

using namespace std;

ll ola,n,ar[N],ans[N];
pi dp[N];

bool ison(ll mask,ll ind)
{
    return (mask>>ind)&1;
}

void solve()
{
    dp[0].first = ar[0];
    dp[0].second = -INF;

    rep(i,1,ola)
    {
        dp[i].first = -INF;
        dp[i].second = -INF;

       // cout << "i: " << i << "\n";

        for(int j = i;j >= 0;j = i&(j-1))
        {
        //    cout << j << " ";
            if(ar[j] >= dp[i].first)
            {
                dp[i].second = dp[i].first;
                dp[i].first=ar[j];
            }
            else if(ar[j] > dp[i].second)
            {
                dp[i].second=ar[j];
            }

            if(j == 0)
                break;
        }

        //cout << endl << dp[i].first << " " << dp[i].second << endl;;

        ans[i] = dp[i].first+dp[i].second;
    }

    return;
}

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

    cin >> n;
    ola = (1<<n);

    rep(i,0,ola)
        cin >> ar[i];

    solve();

    rep(k,1,ola)
    {
        ans[k] = max(ans[k],ans[k-1]);
        cout << ans[k] << "\n";
  //      cout << dp[k].first << " " <<dp[k].second << "\n";
    }

    return 0;
}


Measured memory_bytes: 12288
#include <iostream>
#include <math.h>
using namespace std;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main()
{
    int x;
    cin >> x;
    while(x < 1000000){
        if(IsPrime(x))break;
        x++;
    }
    cout << x << endl;
}

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

const int N = 4005;
const int M = 400005;

int n, m, q;
int lab[N];
vector < pair<int, int> > g[N];
int par[N][13], wei[N][13], dep[N];
long long tot;

struct edge {
	int u; int v; int w;
	bool operator < (const edge &other) const {
		return w < other.w;
	}
} ed[M];

int anc(int p) { return p == lab[p] ? p : lab[p] = anc(lab[p]); }
void join(int p, int q) { lab[p] = q; } // p = anc(p), q = anc(q)

void dfs(int u) {
	for (auto &e : g[u]) {
		int v = e.second, w = e.first;
		if (v == par[u][0]) continue;

		dep[v] = dep[u] + 1;
		par[v][0] = u;
		wei[v][0] = w;
		dfs(v);
	}
}

int lca(int u, int v) {
	if (dep[u] < dep[v]) swap(u, v);
	for (int i = 12; i >= 0; --i) if (dep[par[u][i]] >= dep[v]) u = par[u][i];
	for (int i = 12; i >= 0; --i) if (par[u][i] != par[v][i]) u = par[u][i], v = par[v][i];
	return u == v ? u : par[u][0];
}

int get_max(int u, int x) {
	int ret = 0;
	for (int i = 12; i >= 0; --i) {
		if (dep[par[u][i]] >= dep[x]) {
			ret = max(ret, wei[u][i]);
			u = par[u][i];
		}
	}
	return ret;
}

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

	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		cin >> ed[i].u >> ed[i].v >> ed[i].w;
	}
	sort(ed, ed + m);

	for (int i = 1; i <= n; ++i) lab[i] = i;

	for (int i = 0; i < m; ++i) {
		int u = anc(ed[i].u);
		int v = anc(ed[i].v);
		if (u == v) continue;

		join(u, v);
		g[ed[i].u].push_back(make_pair(ed[i].w, ed[i].v));
		g[ed[i].v].push_back(make_pair(ed[i].w, ed[i].u));
		tot += ed[i].w;
	}

	par[1][0] = 1;
	dfs(1);
	for (int j = 1; j <= 12; ++j) {
		for (int i = 1; i <= n; ++i) {
			par[i][j] = par[par[i][j - 1]][j - 1];
			wei[i][j] = max(wei[i][j - 1], wei[par[i][j - 1]][j - 1]);
		}
	}

	cin >> q;
	while(q--) {
		int u, v; cin >> u >> v;
		int x = lca(u, v);

		int mx = max(get_max(u, x), get_max(v, x));

		printf("%lld\n", tot - mx);
	}
}

Measured memory_bytes: 6784
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c> {i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
	~debug() { cerr << endl; }
	eni( != ) cerr << boolalpha << i; ris;
}
eni( == ) ris << range(begin(i), end(i));
}
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void solve() {
	string s;
	cin >> s;
	int cnt = 0;
	int ans = 0;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == 'R')
			cnt++;
		else {
			ans = max(ans, cnt);
			cnt = 0;
		}
	}
	ans = max(ans, cnt);
	cout << ans;
}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}

	return 0;
}


Measured memory_bytes: 3652
// abc109_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;
    vector<string> S(N);
    REP(i, N) cin >> S[i];

    bool is_valid = true;
    REP(i, N-1){
        if (S[i][S[i].size()-1] != S[i+1][0]){
            is_valid = false;
            break;
        }
    }

    set<string> st;
    REP(i, N){
        if (st.find(S[i]) != st.end()){
            is_valid = false;
            break;
        }
        st.insert(S[i]);
    }

    if (is_valid){
        print("Yes");
    } else {
        print("No");
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define repi(i, a, b) for (long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    a += b;
    d += c;
    if (a == d)
    {
        cout << "Balanced" << endl;
        return 0;
    }
    else if (a > d)
    {
        cout << "Left" << endl;
    }
    else
    {
        cout << "Right" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
Scanf.(Array.(scanf" %d"@@fun n->
	let a=init n (fun _->scanf" %d"@@fun v->v) in
	let b=map (fun v->v) a in sort compare b;
	let l,r=b.(n/2-1),b.(n/2) in
	iter (fun v->print_int@@if v<=l then r else l;print_newline()) a))

Measured memory_bytes: 8576
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long ans = 2 * (x / 11);
        long amari = x % 11;
        if (amari > 0 && amari <= 6) {
            ans++;
        } else if (amari > 6) {
            ans += 2;
        }
        System.out.println(ans);
    }
}


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

using ll=long long;

int main(){

ll H, N;

cin >> H >> N;

vector<ll> A(N);

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

ll S=0;

for(ll i=0;i<N;++i){
S += A[i];
}

for(ll i=0;i<N;++i){
if(S>=H){
cout<< "Yes" << endl; goto xyz;
}
}

cout << "No" << endl;

xyz:;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const ll oo = 1e18;
const ll mod = 998244353,maxn = 3030;
const double PI = acos(-1);


int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    bool can = false;
    cin >> n >> m;

    for (int i=0; i<=n; i++){
        if (i*2 + (n-i)*4 == m) {
            can = true;
            break;
        }
    }

    if (can){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_V(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_M(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}

const int MAX = 200005;
V<ll> task[MAX];

int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        int a;
        ll b;
        cin >> a >> b;
        task[a].push_back(b);
    }

    ll ans = 0LL;
    priority_queue<int, V<int>> q;
    for (int i = 1; i <= m; i++) {
        for (int j = 0; j < task[i].size(); j++) {
            q.push(task[i][j]);
        }
        if(q.empty())continue;
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7936
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v);
#ifndef ONLINE_JUDGE
#define debug(a) cout<<#a<<" --> "<<(a)<<"\n";
#define debug2(a) cout<<#a<<" --> "<<(a)<<" ";
#define HERE cout<<"here - "<<__LINE__<<"\n";
#else
#define debug(a)
#define debug2(a)
#define HERE
#endif
const ll mod = 1e9+7;
const int N = 2e5+5;
typedef pair<int,int> pii;


void TEST_CASES(int cas)
{
    int a;
    cin>>a;
    int ans = a+ a*a + a*a*a;
    cout<<ans<<endl;

}


/*

*/

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1,cas=0;
    //scanf("%d",&t);
    while(t--)
    {
        TEST_CASES(++cas);
    }
    return 0;
}



//os.order_of_key(v): returns how many elements strictly less than v
//os.find_by_order()

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v)
{
    for(auto i:v)
    {
        os<<"Key : "<<i.first<<" , Value : "<<i.second<<endl;
    }
    return os;
}


Measured memory_bytes: 3608
#include<stdio.h>
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
int a[200200],b[200200],n;
int main(){
	char s[200200];
	scanf("%d%s", &n, s);
	for(int i=0;i<n;i++){
		a[i+1]=a[i]+(s[i]=='W');
		b[n-1-i]=b[n-i]+(s[n-1-i]=='R');
	}
	int ans=n;
	for(int i=0;i<=n;i++){
		ans=min(ans,max(a[i],b[i]));
	}
  printf("%d",ans);
}

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

using namespace std;

struct UnionFind{
  int n;
  vector<int> parent;
  vector<int> cardinality;
  
  UnionFind(int n) : n(n), parent(n), cardinality(n){
    for(int i = 0; i < n; i++){
      parent[i] = i;
      cardinality[i] = 1;
    }
  }
  
  int find(int x){
    if(parent[x] == x) return x;
    else{
      cardinality[x] = cardinality[find(parent[x])];
      return parent[x] = find(parent[x]);
    }
  }
  
  void unite(int x, int y){
    if(find(x) != find(y)) cardinality[find(y)] += cardinality[find(x)];
    parent[find(x)] = find(y);
  }
  
  int get_card(int x){
    return cardinality[find(x)];
  }
};

int main(){
  int N, M, K;
  cin >> N >> M >> K;
  
  vector<int> block(N, 0);
  vector<int> friends(N, 0);
  UnionFind friends_set(N);
  for(int i = 0; i < M; i++){
    int A, B;
    cin >> A >> B;
    A--; B--;
    friends_set.unite(A, B);
    friends[A]++;
    friends[B]++;
  }
  
  for(int j = 0; j < K; j++){
    int C, D;
    cin >> C >> D;
    C--; D--;
    if(friends_set.find(C) == friends_set.find(D)){
      block[C]++;
      block[D]++;
    }
  }
  
  for(int p = 0; p < N; p++){
    cout << (friends_set.get_card(p) - friends[p] - block[p] - 1) << ' ';
  }
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 3200
#include<cstdio>
char c[200005];
int n;
long long ans,t[26];
int main()
{
	scanf("%s",c);
	for(int i=0;c[i]!='\0';++i)++n,t[c[i]-'a']++;
	for(int i=0;i<26;++i)ans+=t[i]*(n-t[i]);
	printf("%lld\n",ans/2+1);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define SIZE 10
using namespace std;
typedef long long ll;

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

	int A,B,C;
	int i,j;
	int tmp;
	int counter=0;
	vector<int> given;
	string answer;

	cin >> A >> B >> C;
	
	if(A+B+C>=22){
		answer="bust";
	}else{
		answer="win";
	}
	
	cout << answer << endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int num[3];
	int ans = 0;
	int i;
	
	cin >> num[0] >> num[1] >> num[2];
	cin >> i;
	
	while (i > 0) {
		sort(num, num + 3);
		num[2] *= 2;
		i--;
	}
	
	cout << num[0] + num[1] + num[2] << endl;
}

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

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

double r;

int main(){
	cin.tie(0);
	
	cin>>r;
	
	cout<<fixed<<setprecision(5)<<r*r*M_PI<<' '<<2*r*M_PI<<endl;

	return 0;
}



Measured memory_bytes: 3240
import java.util.Scanner;
import static java.lang.Math.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0)break;
			int[] s = new int[n];
			for(int i = 0; i < n; i++){
				s[i] = sc.nextInt();
			}
			int sum = 0;
			for(int i = 0;i < n; i++){
				sum += s[i];
			}
			double ave = (double)sum / n;
			double ans = 0;
			for(int i = 0; i < n; i++){
				ans += pow(s[i] - ave, 2);
			}
			ans = sqrt(ans/n);
			System.out.println(ans);
		}
	}
}



Measured memory_bytes: 31348
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <sstream>
#include <map>
#include <deque>
using namespace std;
map <int,int> mp;
int main(){
	int n,ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		mp[a]++;
	}
	for(map <int,int> ::iterator it=mp.begin();it!=mp.end();it++){
		int a=(*it).second;//or it->second;
		int val=(*it).first;//or it->first;
		if(val>a) ans+=a;
		else if(val<a) ans+=a-val;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
#define cy cout << "YES" << endl;
#define cn cout << "NO" << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{

long long a,b,c,d,e,f,x,y,n,h=0,k;
    cin >> n >> k >> x >> y;

    if(n<k)
    {
        f=n*x;
        cout << f << endl;
    }
    else{

       d=k*x+max((n-k)*y,h);
    cout << d << endl;

    }






}


Measured memory_bytes: 3564
using System;
using System.Linq;

namespace Ex160424_1{
    public class Program{
        public static void Main(string[] args){
            var n = int.Parse(Console.ReadLine().Split(' ')[0]);
            var cm = Console.ReadLine().Split(' ').Select(int.Parse);
            var dp = new int[n + 1];

            foreach(var c in cm){
                if(c <= n) dp[c] = 1;
            }
            while(dp[n] == 0){
                foreach(var c in cm){
                    for(var i = 1; i <= n; i++){
                        if(i + c <= n && dp[i] != 0){
                            dp[i + c] = dp[i + c] == 0 ? dp[i] + 1 : Math.Min(dp[i + c], dp[i] + 1);
                        }
                    }
                }
            }
            Console.WriteLine(dp[n]);
        }
    }
}

Measured memory_bytes: 9620
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int t = sc.nextInt();
		double time = 0;
		int count = 0;
		while (time < t + 0.5) {
			count += b;
			time += a;
			if (time > t + 0.5) {
				count -= b;
				break;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 23124
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		if(a+b==c || a+c==b ||b+c==a) System.out.println("Yes");
		else System.out.println("No");
			

	}
}


Measured memory_bytes: 23764
#include <stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    if(n%2 == 0)
    {
        int odd = n/2;
        int even = n/2;
        printf("%d", odd*even);
    }
    else
    {
        int odd = n/2+1;
        int even = n/2;
        printf("%d", odd*even);
    }
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
	char s[11];
	scanf("%s",s);
	int ans = 999;
	for(int i=0;i<=strlen(s)-3;i++){
		int run = abs((s[i] - '0')*100 + (s[i+1] - '0')*10 + (s[i+2] - '0') - 753);
		if(run < ans) ans = run;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

#define N 1000000

using namespace std;

int main() {
	bool prime[N];
	prime[0] = prime[1] = false;

	//initialize
	for(int i=2; i<N; i++) prime[i] = true;
	//Sieve of Eratosthenes
	for(int i=2; i<=N/2; i++){
		if(prime[i]){
			for(int j=2; i*j<=N; j++)
			{
				prime[i*j] = false;
			}
		}
	}

	int countPrime[N];
	int cnt = 0;
	for(int i=0; i<N; i++){
		if(prime[i]){
			cnt++;
		}
		countPrime[i] = cnt;
	}

	int input;
	while(true) {
		cin>>input;
		if(cin.eof()){break;}
		cout<<countPrime[input]<<endl;
	}
	return 0;
}

Measured memory_bytes: 6040
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int n; cin >> n;
    string s; cin >> s;
    vector<int> cw(n+1, 0), cr(n+1, 0);
    rep(i, n){
        if(s[i]=='W') cw[i+1]++;
        else if(s[i]=='R') cr[i+1]++;
    }
    rep(i, n){
        cw[i+1] += cw[i];
        cr[i+1] += cr[i];
    }

    int w, r;
    int ans = INF;

    rep(i, n+1){
        w = cw[i];
        r = cr[n] - cr[i];
        int k = min(w, r);
        chmin(ans, k + (w-k) + (r-k));
    }

    pr(ans);
    return 0;}

Measured memory_bytes: 5220
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
int n,a[200000],f[200000],ans,te;
int main(){
	scanf("%d",&n);
	fo(i,1,n){
		scanf("%d",&a[i]);
		f[a[i]+1]++;
	}
	fo(i,1,n){
		te=f[a[i]]+f[a[i]+1]+f[a[i]+2];
		if (te>ans) ans=te;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
struct opt {
	int x1,y1,x2,y2;
};
int a[505][505];
vector<opt> p;
int read() {
	char c=getchar(); int x=0,f=1;
	while (c<'0' || c>'9') {
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
int main() {
	int n=read(),m=read();
	for (int i=1; i<=n; i++) {
		for (int j=1; j<=m; j++) {
			int t=read();
			if (t&1) a[i][j]=1;
			else a[i][j]=0;
		}
	}
	for (int i=1; i<=n; i++) {
		for (int j=1; j<=m; j++) {
			bool f=true;
			if (i>1) {
				if (f && a[i-1][j]==1 && a[i][j]==0) {
					opt temp; temp.x1=i-1; temp.y1=j; temp.x2=i; temp.y2=j;
					p.push_back(temp);
					f=false;
					swap(a[i-1][j],a[i][j]);
				}
				else if (f && a[i-1][j]==1 && a[i][j]==1) {
					opt temp; temp.x1=i-1; temp.y1=j; temp.x2=i; temp.y2=j;
					p.push_back(temp);
					f=false;
					a[i-1][j]=a[i][j]=0;
				}
			}
		}
	}
	for (int j=1; j<=m; j++) {
		int i=n;
		bool f=true;
		if (j>1) {
			if (f && a[i][j-1]==1 && a[i][j]==0) {
				opt temp; temp.x1=i; temp.y1=j-1; temp.x2=i; temp.y2=j;
				p.push_back(temp);
				f=false;
				swap(a[i][j-1],a[i][j]);
			}
			else if (f && a[i][j-1]==1 && a[i][j]==1) {
				opt temp; temp.x1=i; temp.y1=j-1; temp.x2=i; temp.y2=j;
				p.push_back(temp);
				f=false;
				a[i][j-1]=a[i][j]=0;
			}
		}
	}
	printf("%d\n", p.size());
	for (int i=0; i<p.size(); i++) {
		opt q=p[i];
		printf("%d %d %d %d\n", q.x1, q.y1, q.x2, q.y2);
	}
	return 0;
}

Measured memory_bytes: 5232
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
using namespace std;

typedef long long s64;

s64 n;

int cur;
deque<int> result;

void solve(s64 n)
{
	if (n == 1ll)
		cur = 0;
	else
	{
		solve(n / 2);
		result.push_back(++cur);

		if (n & 1)
			result.push_front(++cur);
	}
}

int main()
{
	cin >> n;

	solve(n + 1);

	for (int i = 1; i <= cur; ++i)
		result.push_back(i);

	cout << result.size() << endl;
	for (int i : result)
		cout << i << ' ';
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;


	static int rec(int n, int t, int l) {
		if (n == 0) return 1;
		if (t == 0) return 0;
		int res = 0;
		for (int i=l; i*i<=n; i++) {
			res += rec(n-i*i, t-1, i);
		}
		return res;
	}

	static boolean solve() {
		int n = in.nextInt();
		if (n == 0) return false;

		out.println(rec(n, 4, 1));

		return true;
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		while(solve());
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 27084
while True:
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    a=[int(input()) for _ in range(n)]
    s=sum(a[0:k])
    ss=[s]
    for i in range(k,n):
        s=s+a[i]-a[i-k]
        ss.append(s)
    print(max(ss))


Measured memory_bytes: 11704
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    a,b,c=parseMap(split(readline()))
    if a+b>=c
        println(b+c)
    else
        println(b*2+a+1)
    end
end
main()

Measured memory_bytes: 166008
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int X;
    cin >> X;
    int tmp = 1;
  	int maxval = 0;
    for (int j = 1;j<=31; j++)
    {
        for (int k = 2; k < 10; k++)
        {
            tmp = pow(j, k);
          	if(tmp>X){break;}
          	if(maxval<tmp){
            maxval = tmp;
            }
        }
    }
    cout << maxval << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n, k, ans = 0;
    cin >> n >> k;
    vector<int> snuke(n, 0);
    for(int i=0;i<k;++i) {
        int d, s;
        cin >> d;
        for(int j=0;j<d;++j) {
            cin >> s;
            ++snuke[s-1];
        }
    }

    for(int i=0;i<n;++i) {
        if(snuke[i] == 0) ++ans;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3664
a,b,c=sorted(map(int,input().split()))
#print(a,b,c)
cnt=0
if a%2==b%2==c%2:
    cnt=0
elif a%2==b%2:
    cnt+=1
    a+=1
    b+=1
elif b%2==c%2:
    cnt+=1
    b+=1
    c+=1
elif a%2==c%2:
    cnt+=1
    a+=1
    c+=1
#print(cnt,a,b,c)
cnt+=(c-a)//2+(c-b)//2
print(cnt)

Measured memory_bytes: 3064
n=int(input())
S=[list(map(str,input().split())) for _ in range(n)]
C=[list(map(int,input().split())) for _ in range(n)]
A=[]
for i in range(1,2**10):
    ans=0
    X=format(i,'b').zfill(10)
    for j in range(n):
        cnt=0
        for k in range(10):
            if S[j][k]=='1' and X[k]=='1':
                cnt+=1
        ans+=C[j][cnt]
    A.append(ans)
print(max(A))   

Measured memory_bytes: 42348