akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;i++)

int main() {
  int k,tmp;
  double n,sum=0,dice,coin;

  cin >> n >> k;
  dice = 1/n;
  
  rep(i,1,n+1){
    tmp = i;
    int cnt=0;
    while(tmp<k){
      tmp *= 2;cnt++;
    }
    coin = pow(0.5,cnt);
    sum += dice * coin;
  }
  
  cout << fixed << setprecision(12) << sum << endl;
    
  return 0;

}

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

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

int main( void ) {
    int n;
    cin >> n;
    for( int i = 1; i <= n; ++i ) {
        int x = i;
        if( x % 3 == 0 )
            cout << " " << i;
        else {
            while( x ) {
                if( x % 10 == 3 ) {
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }
        }
    }
    cout << endl;
}



Measured memory_bytes: 3096
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br)+1;
        double root5 = Math.sqrt(5);
        double a = (1 + root5) / 2;
        double b = (1 - root5) / 2;
        double f = 1 / root5 * (Math.pow(a, n) - Math.pow(b, n));
        System.out.println((int) f);
    }

    static boolean isNumber(String num) {
        return Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find();
    }

    static int[] createListInt(BufferedReader br) throws IOException {
        String[] lines = br.readLine().split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static int ip(BufferedReader s) throws IOException {
        return Integer.parseInt(s.readLine());
    }
}

class Point {
    double x;
    double y;

    Point(double x, double y) {
        this.x = x;
        this.y = y;
    }
}

Measured memory_bytes: 24340
from sys import stdin,stdout
INT_MAX= 10**18
n,k=map(int,stdin.readline().split())
dp  = [INT_MAX]*(n)
h=[int(X) for X in stdin.readline().split()]
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    p=1
    while(p<k+1 and (i-p)>=0):
        dp[i]= min(dp[i-p]+abs(h[i-p]-h[i]),dp[i])
        p+=1
stdout.write(str(dp[n-1])+"\n")


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

int main() {
    int N;
    ll K;
    cin >> N >> K;

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

    vector<int> X(N+1);
    bool a = true;
    int x = A[1];
    ll jump = 1;
    while(a){
        if (X[x] == 1){
            break;
        }
        X[x] = 1;
        x = A[x];
        jump++;
    }

    ll loop = 1;
    int w = A[x];
    while(w != x){
        w = A[w];
        loop++;
    }


    if(K <= jump){
        int ans;
        int aa = 1;
        rep(i,K){
            ans = A[aa];
            aa = A[aa];
        }
        cout << ans << endl;
    } else {
        int ans;
        int bb = x;
        ll looptime = (K-jump) % loop;
        if (looptime == 0){
            cout << x << endl;
            return 0;
        }
        rep(i, looptime){
            ans = A[bb];
            bb = A[bb];
        }
        cout << ans << endl;
    }

}

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

using namespace std;
typedef unsigned long long int ll;
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

int main()
{
    ll n , d;
    cin>>n>>d;
    ll ans =0;
    for(ll i=0;i<n;i++)
    {
        ll a,b;
        cin>>a>>b;
        ll con = a*a + b*b;
        double dis = sqrt(con);
        if(dis<=d)
            ans++;
    }
    cout<<ans;

}


Measured memory_bytes: 3676
#include<stdio.h>
int main()
{
	int a,b;
	while(scanf("%d",&a)==1){
	b=a%39;
	if(b==0){
		printf("3C39\n");
	}
	else if(b<10){
		printf("3C0%d\n",b);
	}
	else
		printf("3C%d\n",b);
	}
	return 0;
}

Measured memory_bytes: 1036
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
if (a==1)
a=14;
if (b==1)
b=14;
else if (a>b)
cout<<"Alice";
if (b>a)
cout<<"Bob";
if (b==a)
cout<<"Draw";
system ("pause");
return 0;
}

Measured memory_bytes: 504
#include<iostream>
#include<algorithm>
using namespace std;
int main (void)
{ 
  int i,j,k,a[200000],b[200000],n;
  int c;
  cin>>n;
  
  for(i=0;i<n;i++)
  {
    cin>>a[i];
  }
  
  for(i=0;i<n;i++)
  {
    cin>>b[n-i-1];
  }
  j=0,k=n-1;
  
  for(i=0;i<n;i++)
  {
    if(a[i]==b[i])
    {
      c=b[i];
      b[i]=b[j];
      b[j]=c;
      
      if(b[i]==a[i]||a[j]==b[j])
      { 
        c=b[i];
        b[i]=b[j];
        b[j]=c;
        c=b[i];
        b[i]=b[k];
        b[k]=c;
        k--;
        if(a[i]==b[i])
        {
          cout<<"No"<<endl;
          return 0;
        }
        j--;
      }
      j++;
    }
    
  
  }
  cout<<"Yes"<<endl;
  for(i=0;i<n;i++)
  {
  cout<<b[i]<<" ";
  }
  cout<<endl;
  
  
  /*
  amax=0,bmax=0;
  cmax=1;
  for(i=1;i<n;i++)
  {
    if(a[i]==a[i-1]){cmax++;}
    else
    {
      if(cmax>amax){amax=cmax;anum=a[i-1];}
      cmax=1;
    }
    if(i==n-1)
    { 
      
      if(cmax>amax)
      {
        amax=cmax;
        anum=a[i];
      }
    }
  }
  
   for(i=1;i<n;i++)
  {
    if(b[i]==b[i-1]){cmax++;}
    else
    {
      if(cmax>bmax){bmax=cmax;bnum=a[i-1];}
      cmax=1;
    }
    if(i==n-1)
    { 
      
      if(cmax>bmax)
      {
        bmax=cmax;
        bnum=b[i];
      }
    }
  }
  
  
  cout<<"amax="<<amax<<",anum="<<anum<<endl;
  cout<<"bmax="<<bmax<<",bnum="<<bnum<<endl;
  */
  
}

Measured memory_bytes: 5080
import heapq as hq

x,y,z,k = map(int,input().split())
a = list(map(lambda x:int(x) * (-1),input().split()))
b =list(map(lambda x:int(x) * (-1),input().split()))
c = list(map(lambda x:int(x) * (-1),input().split()))
a.sort()
b.sort()
c.sort()
possibles = [(a[0]+b[0]+c[0],0,0,0)]

done = set()
done |= {(0,0,0)}
def neibor(ai,bi,ci,possibles,done):
    for aj,bj,cj in [(ai+1,bi,ci),(ai,bi+1,ci),(ai,bi,ci+1)]:
        if (aj<=x-1) and (bj<=y-1) and (cj<=z-1) and (not (aj,bj,cj) in done):
            hq.heappush(possibles,(a[aj]+b[bj]+c[cj],aj,bj,cj))
            done  |= {(aj,bj,cj)}
    

def conf(possibles,done):
    yam,ai,bi,ci = hq.heappop(possibles)
    print(-1*yam)
    neibor(ai,bi,ci,possibles,done)

for i in range(k):
    yam,ai,bi,ci = hq.heappop(possibles)
    print(-1*yam)
    for aj,bj,cj in [(ai+1,bi,ci),(ai,bi+1,ci),(ai,bi,ci+1)]:
        if (aj<=x-1) and (bj<=y-1) and (cj<=z-1) and (not (aj,bj,cj) in done):
            hq.heappush(possibles,(a[aj]+b[bj]+c[cj],aj,bj,cj))
            done  |= {(aj,bj,cj)}

Measured memory_bytes: 4724
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rt return 0
#define endln "\n"
#define all(v) v.begin(), v.end()
#define for1(i, a, b) for (long long int i = a; i < b; i++)
#define for2(i, a, b) for (long long int i = a; i > b; i--)
//  cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;typedef long long int i;
typedef long long int lli;
typedef pair<lli, lli> pll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n, k;
    cin >> n >> k;
    vector<lli> v;
    for1(i, 0, n)
    {
        lli a;
        cin >> a;
        v.pb(a);
    }
    sort(all(v));
    lli s = 0;
    for1(i, 0, k)
    {
        s += v[i];
    }
    cout << s << endl;
}

Measured memory_bytes: 3668
using System;
using System.Text.RegularExpressions;

//namespace b
//{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            for (int i = 0; i <= "^keyence$".Length; i++)
            {
                var s = "^keyence$".Insert(i, ".*");
                if (Regex.IsMatch(str,s)) { Console.WriteLine("YES"); return; }
            }
            Console.WriteLine("NO");
        }
    }

Measured memory_bytes: 16056
#include<stdio.h>

/*入居者情報から、アパートの入居状況を表示する*/
/*棟数(b)：4、階数(f)：3、部屋数(r)：10*/
int main(){
	
	int i,j,k,l;
	int info;
	int tou_n,kai,heya,ninzu;
	
	int apart[4][3][10]={0};
	
	scanf("%d",&info);
	
	for(i=0; i<info; i++){
		(void)getchar();
		scanf("%d %d %d %d",&tou_n,&kai,&heya,&ninzu);
		apart[tou_n-1][kai-1][heya-1] += ninzu;
	}
	
	for(i=0; i<4; i++){				//棟数
		for(j=0; j<3; j++){		//階
			for(k=0; k<10; k++){
				printf(" %d",apart[i][j][k]);
			}
			printf("\n");
		}
		if(i < 3){
			for(l=0;l<20; l++) printf("#");
			printf("\n");
		}
	}
	
	return 0;
}




Measured memory_bytes: 2036
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<iostream>
using namespace std;
#define LL long long
#define G() Cr=getchar()
int Xr;char Cr;
inline int rd(){
	Xr=0, G();
	while(Cr<'0'||Cr>'9') G();
	while(Cr>='0'&&Cr<='9') Xr=(Xr<<3)+(Xr<<1)+(Cr^48), G();
	return Xr;
}
#define MAX_N 5005
int n;
LL dp[MAX_N][MAX_N]; //ｵｽｵﾚ i ｸﾋ｣ｬﾒﾑｾｭﾑ｡ﾁﾋ j ｸﾋﾊｱｵﾄﾗ鐱ﾙﾗｩﾊ｡｣ 
struct node{
	LL w, va;
}e[MAX_N];

bool comp(node x,node y){
	return x.w+x.va<y.w+y.va;
}

int main(){
	n=rd();
	for(int i=1;i<=n;i++) e[i].w=rd(), e[i].va=rd();
	sort(e+1,e+1+n,comp);
	dp[1][1]=e[1].va;
	for(int i=2;i<=n;i++){
		for(int j=1;j<=i;j++){
			if( (dp[i-1][j-1] && dp[i-1][j-1]<=e[i].w) || j==1 ) dp[i][j] = dp[i-1][j-1] + e[i].va;
			if(dp[i-1][j]){
				if(dp[i][j]) dp[i][j] = min(dp[i][j],dp[i-1][j]);
				else dp[i][j] = dp[i-1][j];
			}
		}
	}
	for(int i=n;i;i--)
		if(dp[n][i]){
			cout<<i<<endl;
			return 0;
		}
}

Measured memory_bytes: 194176
// AOJ DPL_2_C Bitonic Traveling Salesman Problem
// 2018.5.9 bal4u

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

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int in()
{
	int n = 0, c = gc();
	if (c == '-') { c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

#define INF    1e12
#define MAX_N  1002

typedef struct { int x, y; } PP;
PP p[MAX_N];
double d[MAX_N][MAX_N];

double dist(PP p1, PP p2) { return hypot(p1.x - p2.x, p1.y - p2.y); }

double bitonic_tsp(int n, PP *p)
{
	int i, j, k;
	double t, ans;

	for (j = 1; j < n; j++) {
		for (i = 0; i < j; i++) {
			if (i == 0 && j == 1) d[i][j] = dist(p[i], p[j]);
			else if (i < j - 1) d[i][j] = d[i][j-1] + dist(p[j-1], p[j]);
			else {
				d[i][j] = INF;
				for (k = 0; k < i; k++) {
					t = d[k][i] + dist(p[k], p[j]);
					if (t < d[i][j]) d[i][j] = t;
				}
			}
		}
	}

	ans = INF;
	for (i = n-2; i >= 0; i--) {
		t = d[i][n-1] + dist(p[i], p[n-1]);
		if (t < ans) ans = t;
	}
	return ans;
}

int main()
{
	int N, i;

	N = in();
	for (i = 0; i < N; i++) p[i].x = in(), p[i].y = in();
	printf("%.10lf\n", bitonic_tsp(N, p));
	return 0;
}


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

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

    int ans = 100100;
    for (long long i = 1; i * i <= N; i++) {
        if (N % i != 0) continue;
        long long j = N / i;
        int digits = 0;
        while (j) {
            j /= 10;
            digits++;
        }
        ans = min(ans, digits);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class Hello{
    public static void Main()
    {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for(var n =0; n < input.Length;n++)
            {	for(var i =1; i < input.Length - n;i++)
				{
					if(input[i] < input[i-1])
					{
						var temp = input[i-1];
						input[i-1] = input[i];
						input[i] = temp;
					}
				}
            }
			Console.WriteLine(input[0] + " " + input[1] + " " + input[2]);
			
    }
}



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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int h,w;cin>>h>>w;
    vector<string> s(h);
    vector<int> yoko(h,0),tate(w,0);
    for(int i=0;i<h;i++){
        cin>>s[i];
        for(int j=0;j<w;j++){
            if(s[i][j]=='#'){
                yoko[i]++;
                tate[j]++;
            }
        }
    }
    for(int i=0;i<h;i++){
        if(yoko[i]==0) continue;
        for(int j=0;j<w;j++){
            if(tate[j]==0) continue;
            cout<<s[i][j];
        }
        cout<<endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){

  int car[100],num,i=0,in[100],countin=0,countout=0;

  while(scanf("%d",&num) != EOF){
    if(num != 0){
      in[countin] = num;
      countin++;
    }else{
      car[countout] = in[countin-1];
      countout++;
      if(countin != 0)countin--;
    }
  }


  for(i=0;i<countout;i++){
    printf("%d\n",car[i]);
  }

  return 0;

}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator sl
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
V<LL>v,u,w;
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,t,z;
    cin>>n>>m;
    k=m-(1000*n);
    p=10000-(1000);
    q=5000-(1000);
    l=k/p;
    s=0;
    for(i=0;i<=l;i++)
    {
        if((k-(p*i))%q==0 && i<=n && ((k-(p*i))/q)<=n && (n-(i+((k-(p*i))/q)))>=0)
        {
            s=1;
            cout<<i<<" "<<(k-(p*i))/q<<" "<<n-(i+((k-(p*i))/q))<<endl;
            break;
        }
    }
    if(s==0)
    {
        cout<<"-1 -1 -1"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
def gcd(a,b):
      if a==0:
            return(b)
      else:
            return(gcd(b%a,a))


n=int(input())
l=list(map(int,input().split()))
g=l[0]
for i in range(1,n):
      g=gcd(g,l[i])
print(g)


Measured memory_bytes: 15020
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class BResistorsInParallel {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int a[] = ReadInput.readIntArray(n, in);
            double ans = 0.0;
            for (int i = 0; i < n; i++) {
                ans += (double) 1 / a[i];
            }
            out.printf("%.5f", 1 / ans);
        }

    }

    static class ReadInput {
        public static int[] readIntArray(int size, Scanner in) {
            int a[] = new int[size];
            for (int i = 0; i < size; i++) {
                a[i] = in.nextInt();
            }
            return a;
        }

    }
}



Measured memory_bytes: 23760
#include <stdio.h>
 
int main(void){
    int n,k,i;
    int h[100000];
    int ans=0;
    scanf("%d %d",&n,&k);
    
    for(i=0; i<=n-1; i++){
        scanf("%d ",&h[i]);
    }
    
    for(i=0; i<=n-1; i++){
        if(h[i]>=k) ans+=1;
    }
    
    printf("%d",ans);
   
    return 0;
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

const ll mod=1e9+7;

int main()
{
    int n,T;
    scanf(" %d %d", &n, &T);
    vector<int> d(n);
    rep(i,n) scanf(" %d", &d[i]);
    sort(all(d));

    ll ans=1;
    int idx=0;
    for(int i=1; i<n; ++i)
    {
        while(idx<i && d[idx]<d[i]-T) ++idx;
        (ans*=(i-idx+1))%=mod;
    }

    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3412
def main():
    s: str = input()

    counter: int = 0
    res: int = 0

    for w in s:
        if w == 'R':
            counter += 1
            if counter > res:
                res = counter
        else:
            counter = 0

    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9000
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(int i=1;i<=p;i++)
#define ll long long

using namespace std;

int main(){

 ll int X;
 cin >> X;
 if (X==2){
	 cout << "2";
	 return 0;
 }
 else{}

  int a = 1;
 while( a == 1){

   for(int i =2;i<X;i++){
	   if(X%i==0){
		   break;
	   }
	   else if(i == X-1){
		   cout << X;
		   return 0;
	   }
	   else{}
   }
   X += 1;
 }








	return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
int check[1001][1001];
int dp[1001][1001];
int valid(int x,int y,int n,int m)
{
	if(x>=0 && x<n && y>=0 && y<m && check[x][y]==1)
		return 1;
	else
		return 0;
}
int fun(int lx,int ly,int n,int m)
{
	if(lx==n-1 && ly==m-1)
	{
		dp[lx][ly]=1;
		return 1;
	}
	if(dp[lx][ly]!=-1)
		return dp[lx][ly];
	int sum=0;
	if(valid(lx+1,ly,n,m))
	{
		//visited[lx+1][ly]=1;
		sum=(sum+fun(lx+1,ly,n,m))%MOD;
	}
	
	if(valid(lx,ly+1,n,m))
	{
		//visited[lx][ly+1]=1;
		sum=(sum+fun(lx,ly+1,n,m))%MOD;
	}
	sum=sum%MOD;
	return dp[lx][ly]=sum;
}

int main() {
int h,w;
cin>>h>>w;
char str[1001][1001];
for(int i=0;i<h;i++)
{
   scanf("%s",str[i]);
}
for(int i=0;i<h;i++)
{
	for(int j=0;j<w;j++)
	{
		if(str[i][j]=='.')
			check[i][j]=1;
		else
			check[i][j]=0;
		dp[i][j]=-1;
	}
}
int ans=fun(0,0,h,w);
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 9216
package main                     

import (
  "fmt"
  "sort"
)

func main() {
  var n int
  fmt.Scan(&n)

  a := make([]int, n)

  for i := range a {
    fmt.Scan(&a[i])
  }
  sort.Ints(a)

  var ans int = 0
  for i := range a {
    if i % 2 == 0 {
      ans += a[i]
    }else{
      ans -= a[i]
    }
  }
  if ans < 0 {
    ans *= -1
  }

  fmt.Printf("%d\n", ans)

}


Measured memory_bytes: 512
//g++  7.4.0

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 998244353

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll N; cin>>N;
    ll D1[N],D2[N];
    
    for(ll i=0;i<N;++i)
        cin>>D1[i]>>D2[i];
    
    for(ll i=2;i<N;++i)
    {
        if((D1[i] == D2[i]) && (D1[i - 1] == D2[i - 1]) && (D1[i - 2] == D2[i - 2]))
        {
            cout<<"Yes"<<endl;
            return(0);
        }
    }
    
    cout<<"No"<<endl;
}

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

int main(){
     int a,b,k;
     cin >> a >> b >> k;
     int j=0;
     if(b-a<=k){
         for(int i=a;i<=b;i++){
             cout << i << endl;
         }
     }
     else{
        for(int i=a;i<a+k;i++){
            cout <<  a+j << endl;
            j++;
        }

        if(a+j-1>=b-k){
            for(int i=a+j;i<=b;i++){
                cout << i << endl;
            }
        }
        else {
            for(int i=b-k+1;i<=b;i++){
                cout <<  i << endl;
            }
            //cout << "000" << endl;
        }
     }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    a = list(map(int,input().split()))
    odd, two, four = 0, 0, 0
    for i in range(N):
        if a[i]%4 == 0:
            four += 1
        elif a[i]%2 == 0:
            two += 1
        else:
            odd += 1
    if four == odd:
        print("Yes")
    elif two == N:
        print('Yes')    
    elif four >= N//2:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 14252
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;

void bfs(const vector<vector<int>>& cnct, vector<int>& rslt, int start) {
  queue<pair<int, int>> qs;
  qs.push({start, 0});
  while(!qs.empty()) {
    auto crnt = qs.front();
    qs.pop();
    if(rslt[crnt.first] >= 0) {
      continue;
    }
    rslt[crnt.first] = crnt.second;
    for(auto n : cnct[crnt.first]) {
      qs.push({n, crnt.second + 1});
    }
  }
}

int main() {
  int N;
  cin >> N;
  vector<vector<int>> cs(N + 1);
  int a, b;
  for(int i = 0; i < N - 1; ++i) {
    cin >> a >> b;
    cs[a].push_back(b);
    cs[b].push_back(a);
  }
  vector<int> fennec(N + 1, -1);
  vector<int> sunuke(N + 1, -1);
  bfs(cs, fennec, 1);
  bfs(cs, sunuke, N);

  int ans = 0;
  for(int i = 1; i <= N; ++i) {
    if(fennec[i] <= sunuke[i]) {
      ans++;
    } else {
      ans--;
    }
  }
  if(ans > 0) {
    cout << "Fennec" << endl;
  } else {
    cout << "Snuke" << endl;
  }

  return 0;
}

Measured memory_bytes: 6824
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <bitset>

using namespace std;
typedef long long ll;

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


    ll ans=0;
    ll anss =0;
    ll count=0;
    ll i,j;
    ll aa[5];
    ll k;
  
    ll Q,N;
    string S;
    cin>>N>>aa[0]>>aa[1]>>aa[2]>>aa[3]>>aa[4];
    ll min;
    ll flag=0;

    for(i = 0;i<5;i++){
                if(i==0){
            min=aa[0];
        }else{
            if(aa[i]<min){
                min=aa[i];
            }
        }
    }
    if(N%min==0){
    Q=N/min;
    }else{
        Q=N/min+1;
    }
    ans=Q+4;
    cout<<ans<<endl;
    // for(i=0;i<5;i++){
    //     for(j=1;j=4-i;j++){
    //         if(abs(aa[i]-aa[i+j])>k){
    //             cout<<":("<<endl;
    //             return 0;
    //         }
    //     }
    // }

// for(i=0;i<Q;i++){
//     cin>>a[i]>>b[i];
//     scanf("%d", &a);
//     scanf("%d", &b);
//     printf("%d\n",a[i]);
// }
// if(aa[4]-aa[0]>k){
//     cout<<":("<<endl;
// }else{
//     cout << "Yay!" << endl;
// }
// return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int N;
  string S, T, ans;

  cin >> N >> S >> T;

  for (int i=0; i<N; i++) {
    ans += S[i];
    ans += T[i];
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main(){
  
  long long n,k;
  cin>>n>>k;
  
  vector<long long> x(n);
  
  for(long long i=0;i<n;i++){
    cin>>x.at(i);
  }
  
  long long dis,min=999999999999;
  for(int i=0;(i+k-1)<n;i++){
    dis = abs(x.at(i+k-1) - x.at(i));
    if(abs(x.at(i))>abs(x.at(i+k-1))){
      dis += abs(x.at(i+k-1));
    }else{
      dis += abs(x.at(i));
    }
    if(dis<min){
      min = dis;
    }
  }
  
  cout<<min<<endl;
  
}


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

using namespace std;

template <typename T>
using V = vector<T>;

typedef long double ld;
typedef long long ll;

#define FO(i, N) for (int (i) = 0; (i) < (N); ++(i))
#define FOll(i, N) for (ll (i) = 0; (i) < (N); ++(i))
#define READALL(c) for (auto &e : c) { cin >> e; }
#define PRINTALL(c) for (const auto &e : c) { cout << e << "\t"; } cout << "\n";
#define MP(x, y) (make_pair((x), (y)))
#define MT(...) make_tuple(__VA_ARGS__)
#define G(i, x) get<i>(x)
#define ALL(x) begin(x), end(x)


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int A,B;
	cin>>A>>B;
	cout << (A*B-A-B+1) << endl;
}

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    int n; cin >> n;
    vector<int> a(n+2);
    REP(i, 1, n+1) cin >> a[i];
    int res = 0, cnt = 0;
    REP(i, 1, n+1) {
        if(a[i] == 1) cnt++;
        if(a[i] == 0) cnt = 0;
        res = max(res, cnt);
    }
    cout << res + 1 << '\n';
    return 0;
}


Measured memory_bytes: 3200
//与えられた数列の中である数がそれまでの数の中で最小値である場合の数を求める
#include <stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	int p[n];
	for (int i = 0;i < n;i++){
		scanf("%d",&p[i]);
    	}
  	int ans = 0;
  	int min = p[0];//これまでの最小値
  	for (int i = 0;i < n;i++){
      	if (min >= p[i]){
          	ans++;
          	min = p[i];
        }
    }
  	printf("%d",ans);
}

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

int main(void) {
    long L, R;
    cin >> L >> R;
    long ans = 2019;
    if(L + 2019 <= R){
        cout<<0<<endl;
        return 0;
    }
    for (long i = L; i < R; i++) {
        for (long j = i + 1; j <= R; j++) {
            ans = min(ans, (i * j) % 2019);
        }
    }


    cout << ans << endl;
}

Measured memory_bytes: 256
<?php 
fscanf(STDIN, "%d", $n);
fscanf(STDIN, "%s", $s);

if ($n%2 == 1) {
  echo "No";
}else {
  $arr = str_split($s, $n/2);
  if ($arr[0] == $arr[1]) {
    echo "Yes";
  }else {
    echo "No";
  }
}
?>

Measured memory_bytes: 3576
#include <cstdio>

int n, k;
bool d[10] = { false };

int main()
{
    scanf("%d%d", &n, &k);
    for (int i = 0, d_i; i < k; ++i) {
        scanf("%d", &d_i);
        d[d_i] = true;
    }

    for (; ; ++n) {
        int w = n;
        bool valid = true;
        while (w > 0) {
            if (d[w % 10]) { valid = false; break; }
            w /= 10;
        }
        if (valid) { printf("%d\n", n); break; }
    }

    return 0;
}


Measured memory_bytes: 128
n = int(input())
a = 0
b = 0
for i in range(n):
    c = input().split()
    if c[0] > c[1]:
        a += 3
    elif c[0] < c[1]:
        b += 3
    else:
        a += 1
        b += 1
print(a,b)


Measured memory_bytes: 5600
n = int(input())
a=0
w=0
t=0
r=0

for i in range(n):
    ans = input()

    if ans == 'AC':
        a+=1
    elif ans == 'WA':
        w+=1
    elif ans == 'TLE':
        t+=1
    else:
        r+=1

print("AC x"+" "+str(a))
print("WA x"+" "+str(w))
print("TLE x"+" "+str(t))
print("RE x"+" "+str(r))



Measured memory_bytes: 9152
s=input()
ans=""
l=[]
for i in range(len(s)):
    if s[i]=="0":
        l.append("0")
    elif s[i]=="1":
        l.append("1")
    else:
        if len(l)!=0:
            del l[len(l)-1]
for i in range(len(l)):
    ans=ans+l[i]
print(ans)

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>

#include <random>
#define all(x) (x).begin(), (x).end()


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

#define debug(x) cout << #x " = " << (x) << endl

using ll = long long;
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

//#define solvsh
//#define multi
#ifdef solvsh

void solve(){

}

#else

void solve() {

    string s;
    cin >> s;

    if (s[2] == s[3] && s[4] == s[5]){
        cout << "Yes";
    } else {
        cout << "No";
    }

}

#endif

void multisolve() {
    int t;
    cin >> t;

    int i = 1;
    while (t--) {
//        cout << "Case #" << (i++)  << ": ";
        solve();
//        cout << "\n";
    }
}


#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

#ifdef multi
    multisolve();
#else
    solve();
//    gen();
#endif

#ifdef LOCAL
    //cout << '\n' << (double)clock() / CLOCKS_PER_SEC << '\n';
#endif
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
int64_t INF = 1000000007;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n,k;
    cin >> n >> k;
    vi h(n);
    rep(i,n) cin >> h.at(i);
    vi cost(n);
    cost.at(0) = 0;
    cost.at(1) = abs(h.at(1) - h.at(0));
    int64_t dx = INF;
    for(int64_t i=2; i<n; i++){
        dx = INF;
        for(int64_t j=1; j<k+1; j++){
            if(i-j<0) break;
            dx = min(dx, abs((h.at(i) - h.at(i-j))) + cost.at(i-j));
        }
        cost.at(i) = dx;
    }
    cout << cost.at(n-1) << endl;
}

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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define mp make_pair


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  int n, x; cin >> n >> x;
  vll v(n);

  rep(i, n) cin >> v[i];
  v.eb(x);

  sort(all(v));

  ll ans = 0;
  rep(i, n) ans = gcd(ans, v[i+1] - v[i]);

  cout << ans << endl;
}


Measured memory_bytes: 4720
#include <stdio.h>

int main(void) {
    int a, b;
    char op;
    while(scanf("%d %s %d", &a, &op, &b), op != '?') {
        switch(op) {
          case '+':
            printf("%d\n", a + b);
            break;
          case '-':
            printf("%d\n", a - b);
            break;
          case '*':
            printf("%d\n", a * b);
            break;
          case '/':
            printf("%d\n", a / b);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <stdio.h>

using namespace std;
int main(void){
    int a,b;
    while(1){
        cin>>a;
        cin>>b;
        
        if(a==0&&b==0){
            break;
        }
        
        for(int i=0;i<a;i++){
            for(int j=0;j<b;j++){
                if(j%2==i%2)cout<<"#";
                else cout<<".";
            }
            cout<<endl;
        }
        
        cout<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

string conv(string s){
    string t;
    t += s[0];
    REP(i,s.length()-1){
        if (s[i] == 'a' || s[i] == 'i' || s[i] == 'u' || s[i] == 'e' || s[i] == 'o')
            t += s[i+1];
    }
    return t;
}

int main() {
    int n;
    while (cin >> n && n){
        vector<string> s(n);
        REP(i,n){
            cin >> s[i];
            s[i] = conv(s[i]);
        }
        bool f = 0;
        FOR(k,1,50){
            set<string> st;
            REP(i,n){
                if (s[i].length() <= k) st.insert(s[i]);
                else st.insert(s[i].substr(0,k));
            }
            if (st.size() == n){
                cout << k << endl;
                f = 1;
                break;
            }
        }
        if (!f) cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3176
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <chrono>

using namespace std;

class cNode
{
public:
	int key;
	cNode *prev, *next;

	cNode(){}
	cNode(int ikey)
	{
		key = ikey;
		prev = next = NULL;
	}
	cNode(int ikey, cNode *c)
	{
		key = ikey;
		prev = NULL;
		next = c;
	}
};

class cList 
{
	void insertKey(const int &);
	void deleteKey(const int &);
	void deleteFirst();
	void deleteLast();

	cNode *nHead, *nTail;
	cNode *tc;
public:
	cList()
	{
		nHead = nTail = NULL;
		tc = NULL;
	}

	void execute(const string &, const int &);
	void output();
};

void cList::output()
{
	cNode *cnout = nHead;
	ostringstream oss;
	while (cnout)
	{
		oss << cnout->key << " ";
		if (cnout->next == NULL)break;
		cnout = cnout->next;
	}
	string ans(oss.str());
	ans.rfind(" ");
	ans.replace(ans.rfind(" "),ans.size(), "");
	cout << ans << endl;
}

void cList::execute(const string &com, const int &key)
{
	if (com[0] == 'i')				insertKey(key);
	else if (com[6] == 'F')			deleteFirst();
	else if (com[6] == 'L')			deleteLast();
	else if (com[0] == 'd')			deleteKey(key);
}

void cList::insertKey(const int &ikey)
{
	if (nHead)
	{
		nHead = new cNode(ikey, nHead);
		nHead->next->prev = nHead;
	}
	else if (!nHead && !nTail)
	{
		nHead = nTail = new cNode(ikey);
	}
}

void cList::deleteKey(const int &dkey)
{
	tc = nHead;
	while (tc)
	{
		if (tc->key == dkey)
		{
			if (!tc->prev && tc->next)
			{
				tc->next->prev = NULL;
				nHead = tc->next;
				delete tc;
				break;
			}
			else if (tc->prev && tc->next)
			{
				tc->prev->next = tc->next;
				tc->next->prev = tc->prev;
				tc->next = tc->prev = NULL;
				delete tc;
				break;
			}
			else if (tc->prev && !tc->next)
			{
				tc->prev->next = NULL;
				nTail = tc->prev;
				delete tc;
				break;
			}
		}
		if (tc->next)
			tc = tc->next;
		else
			break;
	}
}

void cList::deleteFirst()
{
	if (!nHead->prev && nHead->next)
	{
		nHead->next->prev = NULL;
		nHead = nHead->next;
		delete nHead->prev;
	}
	else if (!nHead->prev && !nHead->next)
	{
		nHead = nTail = NULL;
	}
}

void cList::deleteLast()
{
	if (nTail->prev && !nTail->next)
	{
		nTail->prev->next = NULL;
		nTail = nTail->prev;
		delete nTail->next;
	}
	else if (!nTail->prev && !nTail->next)
	{
		nHead = nTail = NULL;
	}
}

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

	int n;
	cin >> n;

	cList cl;
	string tn;
	int tt;
	for (int i = 0; i < n; ++i)
	{
		cin >> tn;
		if (cin.peek() != '\n')cin >> tt;
		else tt = 0;

		cl.execute(tn, tt);
	}

	cl.output();

	return 0;
}

Measured memory_bytes: 39948
n,m=map(int,input().split())
s=[int(i) for i in input().split()]
t=[int(i) for i in input().split()]
mod=10**9+7
dp=[[0 for i in range(m+1)]for j in range(n+1)]
for i in range(n):
    for j in range(m):
        x=0
        if s[i]==t[j]:
            x=dp[i][j]+1
        dp[i+1][j+1]=(dp[i+1][j]+dp[i][j+1]-dp[i][j]+x)%mod

print((dp[n][m]+1)%mod)


Measured memory_bytes: 75100
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
using namespace std;


int main(){
    string s;
    cin >> s;
    int n = s.size();
    int c;
    bool flag = true;
    rep(i, n){
        if(i == 0){
            c = s[i] - '0';
        }else{
            if(s[i] != '9'){
                flag = false;
            }
        }
    }
    
    ll ans = 0;
    if(flag){
        ans += c + 9*(n-1); 
    }else{
        ans += (c-1) + 9*(n-1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int a[111][111];
int main(){
	int r,c,n;
	scanf("%d%d%d",&r,&c,&n);
	int x=1,y=1,d=1;
	for(int i=1,z; i<=n; i++){
		for(scanf("%d",&z); z--;){
			a[x][y] = i;
			y+=d;
			if(y==c+1){
				++x;
				y=c;
				d=-1;
			}
			if(y==0){
				++x;
				y=1;
				d=1;
			}
		}
	}
	for(int i=1; i<=r; i++)for(int j=1; j<=c; j++)
		printf("%d%c",a[i][j],j<c?' ':'\n');
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int n, k, a, d[15];

bool f(int p) {
	for(; p; p/=10) if(d[p%10]) return 0;
	return 1;
}

int main() {
	cin>>n>>k;
	while(k--) cin>>a, d[a] = 1;
	for(a=n; ; a++) if(f(a)) break;
	cout<<a;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int n=in.nextInt();
			int w=in.nextInt();
			if((n|w)==0)
				return;
			double cnt[]=new double[11];
			double sta=0;
			double ele=0;
			double ans=0.01;
			int v[]=new int[n];
			for(int i=0;i<n;i++)
				v[i]=in.nextInt();
			Arrays.sort(v);
			for(int i=0;i<n;i++)
			{
				for(int j=0;j<=10;j++)
				{
					int wi=w*j;
					if(v[i]>=wi&&v[i]<wi+w)
						cnt[j]++;
				}
			}

			for(int i=0;i<=10;i++)
				sta=Math.max(sta,cnt[i]);
			for(int i=10;i>=0;i--)
			{
				if(cnt[i]!=0)
				{
					ele=i;
					break;
				}
			}
			for(int i=0;i<=10;i++)
			{
				ans+=((ele-i)/ele)*(cnt[i]/sta);
			}
			System.out.println(ans);
		}
	}

	static public void debug(Object... o)
	{
		System.out.println(Arrays.deepToString(o));
	}
}

Measured memory_bytes: 25192
#include <iostream>
#include <cstdio>
#define N 2000005
using namespace std;

typedef long long ll;
ll M = 1e9 + 7;
ll r1, c1, r2, c2, ans, fac[N] = {1, 1}, inv[N] = {1, 1}, fiv[N] = {1, 1};
ll f(ll p, ll q) {
	return (((fac[p] * fiv[q]) % M) * fiv[p - q]) % M;
}

int main()
{
	ll i, j;
//	freopen ("input.txt", "r", stdin);
	cin >> r1 >> c1 >> r2 >>c2;
	r2++;
	c2++;
	for (i = 2; i <= r2 + c2; i++) {
		fac[i] = fac[i - 1] * i % M;
		inv[i] = inv[M % i] * (M - M / i) % M;
		fiv[i] = fiv[i - 1] * inv[i] % M;
	}
	ans += f(r2 + c2, r2);
    ans -= f(r2 + c1, r2);
    ans -= f(r1 + c2, r1);
	ans += f(r1 + c1, r1);
    cout << (ans + M * 2) % M << endl;
    return 0;
}


Measured memory_bytes: 47104
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll K;
	int N;
	int a[50];
	scan(K);
	ll minnum,maxnum,mina,maxa;
	if(K==0){
		printf("2\n0 0\n");
	}
	else if(K==1){
		printf("2\n0 2\n");
	}
	else{
		if(K>=50){
			N=50;
			ll kijun=K/50-1+50;
			if(K%50==0){
				minnum=50,maxnum=0,mina=kijun,maxa=kijun;
			}
			else{
				minnum=50-(K%50),maxnum=50-minnum,mina=kijun-maxnum,maxa=kijun+50-(K%50)+1;
			}
		}
		else{
			N=K;
			minnum=K,maxnum=0,mina=K,maxa=K;
		}
		prin(N);
		rep(j,minnum){
			printf("%lld ",mina);
		}
		rep(j,maxnum){
			printf("%lld ",maxa);
		}
		kaigyo;
	}
	return 0;
}


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

namespace ALDS1_4_A {
    class Program {
        static void Main(string[] args) {
            Console.ReadLine();
            int[] S = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Console.ReadLine();
            int[] T = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int count = T.Where(t => S.Contains(t)).Count();
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 10620
import java.util.*;

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

		while(sc.hasNextInt()){
			int value = sc.nextInt();
			if(value != 0){
				n.add(value);
			}
			else{
				break;
			}
		}

		for(int i = 0; i < n.size(); i++){
			System.out.println("Case " + (i + 1) + ": " + n.get(i));
		}
	}
}

Measured memory_bytes: 44072
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void puts_all(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void puts_all(const T &value, const Args&... args){std::cout << value << " ";puts_all(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  string s;
  while(cin >> s){
    REP(i,s.size()) cout << "x";
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
'use strict'
function main(arg) {
  const args = arg.split(/\r\n|\r|\n/).map(a => a.split(' ').map(Number))
  let index = 0
  let result = 0
  let prev = 0
  while (args[0] > index) {
    const current = args[1][index]
    result += args[2][current - 1]

    if (index > 0 && prev === current - 1) {
      result += args[3][current - 2]
    }

    prev = current
    index++
  }

  console.log(result)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(){
    int N;
    cin >> N;
    vector<int> list(N);
    for (int i = 0; i < N; i++){
        cin >> list.at(i);
    }
    int n = 0;
    int k = 0;
    int i = 0;
    while (k < N+1){
       while (i < N){
           if (list.at(i) % 2 == 0){
            k++;
           }
           list.at(i) /= 2;
           i++;
       }
       if (k == N){
           n++;
           i = 0;
           k = 0;
       }
       else{
           break;
       }
    }
    cout << n << endl;

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    int ans = 0;
    for(int i=a; i<=b; ++i){
        string s = to_string(i);
        string t = s;
        reverse(t.begin(), t.end());
        if(s == t)
            ++ ans;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
def process(x, a, k):
    n = len(x)
    f = range(0, n)
    for i in a:
        f[i], f[i+1] = f[i+1], f[i]
    #print 'f=%s' % str(f)
    b = 1
    while b<=k:
        if (k&b)!=0:
            t = [0 for i in xrange(n)]
            for i in xrange(n):
                t[i] = x[f[i]]
            x = [i for i in t]
            #print 'x=%s' % str(x)
        t = [0 for i in f]
        for i in xrange(n):
            t[i] = f[f[i]]
        f = [i for i in t]
        #print 'f=%s' % str(f)
        b <<= 1
    return x

def main():
    n = int(raw_input().strip())
    x = [int(i) for i in raw_input().strip().split()]
    for i in xrange(len(x)-1, 0, -1):
        x[i] = x[i]-x[i-1]
    m, k = [int(i) for i in raw_input().strip().split()]
    a = [int(i) for i in raw_input().strip().split()]
    for i in xrange(len(a)):
        a[i] -= 2
    r = process(x[1:], a, k)
    print x[0]
    for i in xrange(1, len(x)):
        x[i] = x[i-1]+r[i-1]
        print x[i]

if __name__ == '__main__':
    main()

Measured memory_bytes: 16064
#include <iostream>

 

using namespace std;

 

int main()
{
    int a,b,c;
    
    cin >>a>>b>>c;
    if (a<=b&&b<=c)
      cout <<a<<" "<<b<<" "<<c<<endl;
         else if (a<=c&&c<=b)
      cout <<a<<" "<<c<<" "<<b<<endl;
         else if (b<=a&&a<=c)
      cout <<b<<" "<<a<<" "<<c<<endl;
         else if (b<=c&&c<=a)
      cout <<b<<" "<<c<<" "<<a<<endl;  
          else if (c<=a&&a<=b)
      cout <<c<<" "<<a<<" "<<b<<endl;
          else
      cout <<c<<" "<<b<<" "<<a<<endl;
   
    return 0;
}


Measured memory_bytes: 3116