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

int main() {
  ll n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n){
    cin>>a[i];
  }
  ll ans=1000000000000;
  rep(i,n){
    ll tmp=0;
    while(a[i]%2==0){
      a[i]/=2;
      tmp++;
    }
    ans=min(ans,tmp);
  }
  cout<<ans<<endl;
}

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

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

int main() {
  int H,W; cin>>H>>W;
  pair<int, int> start,goal,start2;
  cin>>start.first>>start.second;
  cin>>goal.first>>goal.second;
  start.first--;start.second--;goal.first--;goal.second--;
  vector<string> S(H);
  for(int i=0; i<H; ++i) cin>>S[i];
  // 二度塗りでどうだ
  // 最初に歩きパターンを見てから、次にワープパターンを見る
  vector<vector<int>> Graph(H,vector<int>(W,-1));
  vector<vector<bool>> isSeen(H,vector<bool>(W,false));
  int count = 0;
  queue<pair<int,int>> que,que2;
  Graph[start.first][start.second]=count;
  que.push(start);
  que2.push(start);
  isSeen[start.first][start.second]=true;
  while(!que.empty() || !que2.empty()) {
    int nh, nw;
    while(!que.empty()) {
      auto v = que.front();
      que.pop();
      que2.push(v);
      for(int dir=0; dir<4; ++dir) {
        nh=v.first+dx[dir];
        nw=v.second+dy[dir];
        if(nh<0||nh>=H||nw<0||nw>=W) continue;
        if(S[nh][nw]=='#') continue;
        if(!isSeen[nh][nw]) {
          isSeen[nh][nw]=true;
          Graph[nh][nw]=count;
          que.push({nh,nw});
        }
      }
    }
    count++;
    while(!que2.empty()) {
      auto v = que2.front();
      que2.pop();
      for(int i=-2; i<=2; ++i) {
        for(int j=-2; j<=2; ++j) {
          nh=v.first+i;
          nw=v.second+j;
          if((abs(i)<=1 && j==0) || (abs(j)<=1 && i==0)) continue;
          else {
            if(nh<0||nh>=H||nw<0||nw>=W) continue;
            if(S[nh][nw]=='#') continue;
            if(!isSeen[nh][nw]) {
              Graph[nh][nw]=count;
              isSeen[nh][nw]=true;
              que.push({nh,nw});
              start2={nh,nw};
            }
          }
        }
      }
    }
  }
  cout << Graph[goal.first][goal.second] << endl;
}


Measured memory_bytes: 9668
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+100;
ll a[maxn];
ll ans[maxn];
int n;
int main()
{
    scanf("%d",&n);
    ll sum=0;
    for(int i=0;i<10;i++);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        if(i%2==0)
            sum-=a[i];
        else
            sum+=a[i];
    }
    ans[1]=sum;
    a[1]-=ans[1]/2;
    for(int i=2;i<=n;i++)
    {
        ans[i]=a[i-1]*2;
        a[i]-=ans[i]/2;
    }
    for(int i=1;i<=n;i++)
        printf("%lld ",ans[i]);
    printf("\n");
}

Measured memory_bytes: 2816
IDENTIFICATION DIVISION.
PROGRAM-ID. 101C.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
  SELECT STDIO ASSIGN TO KEYBOARD. 
*>
DATA DIVISION.
FILE SECTION.
FD STDIO.
01 INP     PIC X(1100000).
*>
WORKING-STORAGE SECTION.
01 INW     PIC  X(15).
01 N       PIC  9(6) COMP.
01 K       PIC  9(6) COMP.
01 TBL.
   03 X    PIC S9(9) COMP OCCURS 100000. 
01 XW      PIC  9(9) COMP.
01 P1      PIC  9(7) COMP.
01 P2      PIC  9(7) COMP.
01 I       PIC  9(6) COMP.
01 I1      PIC S9(6) COMP.
01 I2      PIC S9(6) COMP.
01 MX      PIC  9(6) COMP.
01 P-CNT   PIC  9(6) COMP.
01 M-CNT   PIC  9(6) COMP.
01 MN      PIC  9(9) COMP.
01 DS      PIC  9(9) COMP.
01 CNT     PIC  9(9) COMP.
01 OUT     PIC  Z(8)9.
*>
PROCEDURE DIVISION.
  ACCEPT INW.
  UNSTRING INW DELIMITED BY ' '
      INTO N K. 
*>
  OPEN INPUT STDIO.
  READ STDIO.
  CLOSE STDIO.
*>
  MOVE 0 TO P-CNT M-CNT.  
  MOVE 999999999 TO MN.     
  MOVE 1 TO P1.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > N
    PERFORM VARYING P2 FROM P1 BY 1 UNTIL INP(P2:1) = ' '
    END-PERFORM
  *>
    MOVE INP(P1:P2 - P1) TO X(I) XW
    IF (XW < MN)
      MOVE XW TO MN
      MOVE I  TO MX
    END-IF
*>
    EVALUATE TRUE
      WHEN X(I) < 0
        ADD 1 TO M-CNT
      WHEN X(I) > 0
        ADD 1 TO P-CNT
    END-EVALUATE
*>
    COMPUTE P1 = P2 + 1
  END-PERFORM.
*>---
  IF (M-CNT >= K)
    IF (X(MX) = 0)
      COMPUTE I1 = M-CNT - K + 2
    ELSE  
      COMPUTE I1 = M-CNT - K + 1
    END-IF  
  ELSE
    COMPUTE I1 = 1
  END-IF.
  IF (P-CNT >= K)
    COMPUTE I2 = M-CNT + K
  ELSE
    COMPUTE I2 = N
  END-IF. 
*>
  MOVE 999999999 TO CNT.
  PERFORM VARYING I FROM I1 BY 1 UNTIL K > I2 - I + 1
    EVALUATE TRUE
      WHEN (X(I) < 0) AND (X(I + K - 1) > 0)
        IF (FUNCTION ABS(X(I)) < X(I + K - 1))
          COMPUTE DS = FUNCTION ABS(X(I)) * 2 + X(I + K - 1)
        ELSE
          COMPUTE DS = FUNCTION ABS(X(I)) + X(I + K - 1) * 2
        END-IF
      WHEN (X(I) < 0)
        MOVE X(I)         TO DS
      WHEN (X(I) >= 0)
        MOVE X(I + K - 1) TO DS
    END-EVALUATE
  *> 
    IF (DS < CNT)
      MOVE DS TO CNT
    END-IF
  END-PERFORM.
*>---
  MOVE CNT TO OUT.
  DISPLAY FUNCTION TRIM(OUT).
  STOP RUN.


Measured memory_bytes: 1792
import java.util.*;
public 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();
     String ans = "NO";
     if(a*b*c==5*7*5)ans="YES";
     System.out.println(ans);
   }
}

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

int main(){

	int n;
	cin >> n;
	int line[n];

	for(int i=0; n>i; i++){

		cin >> line[i];
	}

	for(int j=n-1; j>=0; j--){

		cout << line[j];
		if(j == 0)break;
		cout << " ";
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 3072
#include<stdio.h>
int main()
{
    int a,p,i,q;
    scanf("%d",&a);
    p=a;
    for(i=1;;i++){
        q=p%10;
        p=p/10;
        if(q==7){
            printf("Yes\n");
            break;
        }
        else if(p==0){
            printf("No\n");
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 1576
#include <bits/stdc++.h>
using namespace std;
string str;
void solve()
{
    int i,len=str.length(),xtag=0;
    vector < int > tag(26,0);
    for (i=0;i<len;i++)
        tag[str[i]-'a']++;
    for (i=0;i<26;i++)
        if (tag[i]%2) {xtag=1;break;}
    if (xtag) cout<<"No";
    else cout<<"Yes";
    cout<<endl;
}
int main()
{
    while(cin>>str)
        solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> P;
typedef pair<int, P> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int V, E;
vector<P>G[5001]; // first: cost second: to
vector<int>g[5001];
ll d[5001];

void dijkstra(int s, int r){
  fill(d, d+V, INF);

  priority_queue<P, vector<P>, greater<P> >q;
  q.push(P(0, s));
  d[s] = 0;

  while(!q.empty()){
    int cur = q.top().second, v = q.top().first;
    q.pop();
    if(v > r || v > d[cur]) continue;
    rep(i, g[cur].size()){
      int n = g[cur][i];
      if(d[n] > v+1){
	d[n] = v+1;
	//	cout << i << " " << d[n] << endl;
	q.push(P(d[n], n));
      }
    }
  }
  
  return;
}

void dijkstra(int s){
  fill(d, d+V, INF);

  priority_queue<P, vector<P>, greater<P> >q;
  q.push(P(0, s));
  d[s] = 0;

  while(!q.empty()){
    int cur = q.top().second, v = q.top().first;
    q.pop();
   if(v > d[cur]) continue;
   rep(i, G[cur].size()){
      P n = G[cur][i];
      if(d[n.second] > v+n.first){
	d[n.second] = v+n.first;
	q.push(P(d[n.second], n.second));
      }	 
    }
  }
  
  return;
}

int main(){
  scanf("%d%d", &V, &E);
  int C[5001], R[5001];
  rep(i, 5001) G[i].clear();
  rep(i, V) scanf("%d%d", C+i, R+i);
  int a, b;
  rep(i, E){
    scanf("%d%d", &a, &b); a--; b--;
    g[a].PB(b);
    g[b].PB(a);
  }

  rep(i, V){
    dijkstra(i, R[i]);
    rep(j, V){
      if(i==j) continue;
      //      cout << d[j] << " ";
      if(d[j] > R[i]) continue;
      G[i].PB(P(C[i], j));
    }
    //    cout << endl;
  }

  /*  rep(i, V){
    rep(j, G[i].size()) cout << G[i][j].second;
    cout << endl;
    }*/

  dijkstra(0);
  //  rep(i, V) cout << d[i] << " "; cout << endl;
  printf("%lld\n", d[V-1]);
  return 0;
}

Measured memory_bytes: 126004
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<utility>

using namespace std;

const int MOD = 1e9+7;


int N;
string s, t;
int dp[30] = {};

int main(){
	cin >> N >> s >> t;
	dp[s[0] - 'a']++;
	for(int i = 1; i < N - 1; i++){
		dp[s[i] - 'a'] += dp[t[i] - 'a'];
		dp[s[i] - 'a'] %= MOD;

	}
	cout << dp[t[N-1] - 'a'] % MOD << endl;

	return 0;
}


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

using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr int NMAX = 200010;

ll fact[NMAX];
ll invfact[NMAX];

ll modexp(ll b, ll e) {
	if (e == 0) return 1;
	else return (e & 1 ? b : 1) * modexp(b * b % MOD, e / 2) % MOD;
}

ll modinv(ll x) {return modexp(x, MOD - 2);}

vector<vector<int>> tree;
vector<int> stSize;
vector<ll> subtreeAns;
vector<int> aboveSize;
vector<ll> aboveAns;
vector<ll> finalAns;

ll merge(vector<ll> &subAnswers, vector<int> &subSizes) {
	ll sum = 0;
	ll ans = 1;
	for (ll x : subAnswers) ans = (ans * x) % MOD;
	for (ll s : subSizes) {sum += s; ans = (ans * invfact[s]) % MOD;}
//	printf("merge req has sum %lld invans %lld\n", sum, ans);
	return ans * fact[sum] % MOD;
}

vector<ll> massMerge(vector<ll> &subAnswers, vector<int> &subSizes, ll aboveAns, ll aboveSize) {
	int k = subAnswers.size();
	ll invProd = invfact[aboveSize], allAnsProd = aboveAns;
	int totalSize = aboveSize;
	for (int x : subSizes) invProd = (invProd * invfact[x]) % MOD, totalSize += x;
	for (ll x : subAnswers) allAnsProd = (allAnsProd * x) % MOD;
	vector<ll> ans(k);
	for (int i = 0; i < k; ++i) {
		ans[i] = (fact[totalSize - subSizes[i]] * invProd % MOD * fact[subSizes[i]] % MOD * allAnsProd % MOD * modinv(subAnswers[i])) % MOD;
	}
	return ans;
}

void computeSTInfo(int v, int p) {
	stSize[v] = 1;
	subtreeAns[v] = 1;
	vector<int> subSizes; vector<ll> subAns;
	for (int ch : tree[v]) {
		if (ch == p) continue;
		computeSTInfo(ch, v);
		subSizes.push_back(stSize[ch]);
		subAns.push_back(subtreeAns[ch]);
		stSize[v] += stSize[ch];
//		printf("subtree %d size %d\n", ch, stSize[ch]);
	}
	subtreeAns[v] = merge(subAns, subSizes);
//	printf("%d ans %lld size %d\n", v, subtreeAns[v], stSize[v]);
}

void computeAboveInfo(int v, int p) {
	// compute the final answer of this vertex
	vector<int> children, subSizes;
	vector<ll> subAns;
	for (int ch : tree[v]) {
		if (ch == p) continue;
		subSizes.push_back(stSize[ch]);
		children.push_back(ch);
		subAns.push_back(subtreeAns[ch]);
	}
	subSizes.push_back(aboveSize[v]);
	subAns.push_back(aboveAns[v]);
	finalAns[v] = merge(subAns, subSizes);
	subSizes.pop_back(); subAns.pop_back();
	// compute the above answers of the children
	vector<ll> subAboveAns = massMerge(subAns, subSizes, aboveAns[v], aboveSize[v]);
	for (int i = 0; i < children.size(); ++i) {
		aboveAns[children[i]] = subAboveAns[i];	
		aboveSize[children[i]] = (int)tree.size() - stSize[children[i]];
	}
	for (int ch : children) {
		 computeAboveInfo(ch, v);
	}
}

int main() {
	fact[0] = 1;
	for (int i = 1; i < NMAX; ++i) fact[i] = fact[i-1] * i % MOD;
	invfact[NMAX - 1] = modexp(fact[NMAX - 1], MOD - 2);
	for (int i = NMAX - 2; i >= 0; --i) invfact[i] = (invfact[i + 1] * (i + 1)) % MOD;
	int n; scanf("%d", &n);
	tree = vector<vector<int>>(n);
	for (int i = 0; i < n - 1; ++i) {
		int a, b; scanf("%d %d", &a, &b);
		tree[--a].push_back(--b);
		tree[b].push_back(a);
	}
	stSize = aboveSize = vector<int>(n);
	finalAns = subtreeAns = aboveAns = vector<ll>(n, 1);
	computeSTInfo(0, -1);
	computeAboveInfo(0, -1);
	for (int i = 0; i < n; ++i) printf("%lld\n", finalAns[i]);
	return 0;
}


Measured memory_bytes: 28272
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	X, Y := getInt(), getInt()

	cnt := 1
	for {
		X *= 2
		if X > Y {
			break
		}
		cnt++
	}
	out(cnt)
}


Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
char str[16];
int main(){
	scanf("%s",str);
	int n=strlen(str);
	int ret=0;
	for(int i=0;i<n;i++){
		int A=0;
		int B=0;
		for(int j=0;str[j+i+1];j++){
			A*=10;
			A+=str[j]-'0';
		}
		for(int j=0;j<=i;j++){
			B*=10;
			B+=str[n-1-i+j]-'0';
		}
		if(str[n-1-i]!='0'&&(A+B)%2==0&&B-A>=0){
			ret++;
	//		printf("%d %d\n",(A+B)/2,(B-A)/2);
		}
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 968
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner as = new Scanner(System.in);
		int n = as.nextInt();
		int[] a;
		a = new int[n];
		long t = 0;
		for(int i=0;i<n;i++){
			a[i] = Integer.parseInt(as.next());
			t+=a[i];
		}
		long l=0;
		boolean asa = true;
		if(t%((n+1)*(long)n/2)==0){
			long k=t/((n+1)*(long)n/2);
			for(int i=0;i<n;i++){
				l = a[(i+1)%n]-a[i];
				if(l>k||(k-l)%n!=0){
					asa = false;
					break;
				}
			}
		}else{
			asa = false;
		}
		if(asa){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 32128
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(void)
{
    char W[11], T[1001];
    int i, count = 0;
    scanf("%s", W);
    while(1){
        scanf("%s", T);

        if(strcmp(T, "END_OF_TEXT") == 0){
            break;
        }
        for(i = 0; T[i] != '\0'; i++){
            T[i] = tolower(T[i]);
        }
        if(strcmp(T, W) == 0){
            count++;
        }
    }

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

    return 0;
}


Measured memory_bytes: 2056
#include<bits/stdc++.h>
#define pi 31415926
#define maxn 100000007
#define minv -100000007
#define char cr
using namespace std;
long long n,ans=0;
int main(){
	cin>>n;
	for(long long i=1;i<=n;i++){
		ans+=(i+n-n%i)*((n-n%i-i)/i+1)/2;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
template<int mod>
struct ModInt{
    int x;
    ModInt():x(0){}
    ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
    ModInt &operator+=(const ModInt &p){
        if((x+=p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p){
        if((x+=mod-p.x)>=mod)x-=mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p){
        x=(int)(1LL*x*p.x%mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p){
        *this*=p.inverse();
        return *this;
    }
    ModInt operator-()const{return ModInt(-x);}
    ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
    ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
    ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
    ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
    bool operator==(const ModInt &p)const{return x==p.x;}
    bool operator!=(const ModInt &p)const{return x!=p.x;}
    ModInt inverse()const{
        int a=x,b=mod,u=1,v=0,t;
        while(b>0){
            t=a/b;
            a-=t*b;
            swap(a,b);
            u-=t*v;
            swap(u,v);
        }
        return ModInt(u);
    }
    friend ostream &operator<<(ostream &os,const ModInt<mod> &p){
        return os<<p.x;
    }
    friend istream &operator>>(istream &is,ModInt<mod> &a){
        long long x;
        is>>x;
        a=ModInt<mod>(x);
        return (is);
    }
};

const int mod=1e9+7;
using mint=ModInt<mod>;
int ppcnt(int x){
    return __builtin_popcount(x);
}
int main(){
    int n;
    cin>>n;
    vvi vec(n,vi(n));
    REP(i,n){
        REP(j,n){
            cin>>vec[i][j];
        }
    }
    vector<vector<mint>> dp(n+1,vector<mint>(1<<n));
    dp[0][0]=1;
    REP(i,n){
        REP(j,1<<n){
            int pc=ppcnt(j);
            if(i!=pc){
                continue;
            }
            REP(k,n){
                if(j&(1<<k)){
                    continue;
                }
                if(!vec[i][k]){
                    continue;
                }
                dp[i+1][j|(1<<k)]+=dp[i][j];
            }
        }
    }
    cout<<dp[n][(1<<n)-1]<<endl;
    return 0;
}

Measured memory_bytes: 188800
import java.util.*;
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int month = sc.nextInt();
        int day = sc.nextInt();

        int ans = 0;

        if (day >= month) {
            ans = month;
        } else {
            ans = month - 1;
        }
        
        System.out.println(ans);
        
    }
}

Measured memory_bytes: 21844
#include <iostream>

using namespace std;
#include <string>
typedef long long int ll;

int main(){
  double sum_=0;
  int a,N;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> a;
    sum_ += 1.0/a;
  }

  cout<<1/sum_;




  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); ++i)
#define repf(i, from, to) for (int i = (from); i < (to); ++i)
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int main() {
  string s;
  cin >> s;

  string ans = "";
  rep(i, s.size()) {
    if(i % 2 == 0) {
      ans += s[i];
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3668
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int N; cin >> N;
    int K; cin >> K;
    double ans = 0.0;

    double p = 1.0 / (double)N;

    for(int i = 1; i <= N; ++i){
        if(i < K){
            int num1 = ceil((double)K / (double)i);
            int num = (int) ceil( log2(num1) );
            double tmp = pow(0.5, (double)num);
            ans += tmp;
        }
        else{
            ans += 1.0;
        }
    }
    printf("%.12f\n", p * ans);
    return 0;
}

Measured memory_bytes: 256
# @author 

import sys

class DChatInACircle:
    def solve(self, tc=0):
        n = int(input())
        a = [int(_) for _ in input().split()]
        a.sort()
        it = [a[-1]]
        for i in range(n - 2, -1, -1):
            it.append(a[i])
            it.append(a[i])
        print(sum(it[:n - 1]))


solver = DChatInACircle()
input = sys.stdin.readline

solver.solve()


Measured memory_bytes: 118484
class Dice
  def initialize(t, s, e, w, n, b)
    $north = n
    $south = s
    $east = e
    $west = w
    $top = t
    $bottom = b
  end

  def execute_orders(orders)
    length = orders.length
    for i in 0...length
      if orders[i] == "N"
        move_north
      elsif orders[i] == "S"
        move_south
      elsif orders[i] == "E"
        move_east
      elsif orders[i] == "W"
        move_west
      else
        puts "error!"
      end
    end
  end

  def check_dices_same(order_t, order_s, order_e, order_w, order_n, order_b)
      60.times do
        execute_orders(["N", "W"].sample)
        return true if $top == order_t && $south == order_s && $east == order_e && $west == order_w && $north == order_n && $bottom == order_b
      end
    return false
  end


  private
  def move_north
    north = $north
    south = $south
    top = $top
    bottom = $bottom
    $north = top
    $top = south
    $bottom = north
    $south = bottom
  end

  def move_south
    north = $north
    south = $south
    top = $top
    bottom = $bottom
    $south = top
    $bottom = south
    $north = bottom
    $top = north
  end

  def move_east
    top = $top
    bottom = $bottom
    east = $east
    west = $west
    $east = top
    $bottom = east
    $west = bottom
    $top = west
  end

  def move_west
    top = $top
    bottom = $bottom
    east = $east
    west = $west
    $west = top
    $bottom = west
    $east = bottom
    $top = east
  end
end

dice_numbers_1 = gets.chomp.split.map(&:to_i)
dice_numbers_2 = gets.chomp.split.map(&:to_i)
dice1 = Dice.new(dice_numbers_1[0], dice_numbers_1[1], dice_numbers_1[2], dice_numbers_1[3], dice_numbers_1[4], dice_numbers_1[5])
if dice1.check_dices_same(dice_numbers_2[0], dice_numbers_2[1], dice_numbers_2[2], dice_numbers_2[3], dice_numbers_2[4], dice_numbers_2[5])
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 8744
#include <stdio.h>
 
int main(void){
 
int n, i, debt;
 
debt=100000;

 scanf("%d", &n);
 
for(i=0; i<n; i++){
 
debt=debt+(debt/20);
 
if(debt%1000!=0)
debt=debt+(1000-(debt%1000));
 
}

 printf("%d\n", debt);
 
return 0;
 
}

Measured memory_bytes: 592
#include <iostream>
#include <sstream>
#include <string>

int main()
{
	int input = 0;
	std::string sInput;
	std::istringstream ss;
	std::cin >> sInput;

	ss = std::istringstream(sInput);
	ss >> input;
	
	std::string s[100];
	int count = 0;
	while (count < input)
	{
		std::cin >> s[count];
		count++;
	}
	
	int v1;	// ソートする数値
	int v2;	// 比較対象

	// ソート前の数列を表示
	for (int k = 0; k < input; k++)
	{
		std::cout << s[k];
		if (k == input - 1)
		{
			std::cout << std::endl;
		}
		else
		{
			std::cout << " ";
		}
	}

	// 数列をソートして表示する
	for (int i = 1; i < input; i++)
	{
		ss = std::istringstream(s[i]);
		ss >> v1;
		ss = std::istringstream(s[0]);
		ss >> v2;
		for (int j = 0; j < i; j++)
		{
			ss = std::istringstream(s[j]);
			ss >> v2;
			if (v2 > v1)
			{
				s[j] = std::to_string(v1);
				while (j < i)
				{
					ss = std::istringstream(s[j + 1]);
					s[j + 1] = std::to_string(v2);
					ss >> v2;
					j++;
				}
			}
		}
		for (int k = 0; k < input; k++)
		{
			std::cout << s[k];
			if (k == input - 1)
			{
				//if (i < input - 1)
				//{
					std::cout << std::endl;
				//}
			}
			else
			{
				std::cout << " ";
			}
		}
	}
}


Measured memory_bytes: 3280
public class Main {
	static java.util.Scanner scan = new java.util.Scanner(System.in);
	public static void main(String[] args) {
		int count = scan.nextInt();
		while (0 < count--) {
			long[] l = {scan.nextLong(), scan.nextLong(), scan.nextLong()};
			java.util.Arrays.sort(l);
			print(l[0] * l[0] + l[1] * l[1] == l[2] * l[2] ? "YES" : "NO");
		}
	}
	
	public static void print(Object out) {
		System.out.println(out);
	}
}

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

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define fi first
#define se second
#define pb push_back
 
#define ll long long
#define pii pair<int, int>
//#define int ll
const int MOD = 1000000007;

string t[7];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int h, w, k; cin >> h >> w >> k;
    rep(i, h) cin >> t[i];
    int ans = 0;
    rep(a, 1<<h) rep(b, 1<<w) {
        int cnt = 0;
        rep(i, h) if(a & (1<<i)) rep(j, w) cnt += (b & (1<<j)) && (t[i][j] == '#');
        ans += (cnt == k);
    }
    cout << ans << endl;
}



Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
#include <string>
using namespace std;

int main(){
    int n; cin >> n;
    int i = 1;
    while( i*i < n ){
        i++;
    }
    if ( i*i == n) cout << i*i << endl;
    else cout << (i-1)*(i-1) << endl;
}

Measured memory_bytes: 256
N=int(input())
L = [0 for i in range(4)]
for i in range(N):
    s = input()
    if s=="AC":
        L[0] += 1
    elif s=="WA":
        L[1] += 1
    elif s == "TLE":
        L[2] += 1
    else:
        L[3] += 1

print("AC x"+" "+str(L[0]))
print("WA x"+" "+str(L[1]))
print("TLE x"+" "+str(L[2]))
print("RE x"+" "+str(L[3]))

Measured memory_bytes: 9192
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		FS r = new FS();
		int N = r.nextInt();
		int dig = String.valueOf(N).length();
		int K = r.nextInt();
		boolean[] dis = new boolean[10];
		for(int i=0; i<K; i++) {
			dis[r.nextInt()] = true;
		}
		int ans = N;
		while(true) {
			boolean isValid = true;
			String str = String.valueOf(ans);
			for(int i=0; i<str.length(); i++) {
				if(dis[Integer.parseInt("" + str.charAt(i))]) {
					isValid = false;
					break;
				}
			}
			if(isValid) break;
			ans++;
		}
		System.out.println(ans);
	}

	// Read Class
	static class FS {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
		private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
		private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}

		public boolean hasNext() { skipUnprintable(); return hasNextByte();}
		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while(isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
		public int nextInt() {
			return (int)nextLong();
		}
		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while(true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if(b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}
	}
}


Measured memory_bytes: 24404
def main():
	while True:
		n=int(raw_input())
		if n==0:	break;
		solve(n)
def solve(n):
	for _ in range(n):
		pm,pe,pj=map(int, raw_input().split(" "))
		ave,aveme=(pm+pe+pj)/3,(pm+pe)/2
# 		print ave,aveme
		if pm==100 or pe==100 or pj==100 or aveme>=90 or ave>=80:	print "A"
		elif ave>=70 or (ave>=50 and(pm>=80 or pe>=80)):	print "B"
		else:	print "C"

if __name__ == "__main__":	main()

Measured memory_bytes: 4240
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main(){
    input!{
        N: i32,
    }

    let mut ans: Vec<i32> = Vec::with_capacity((N + 1) as usize);
    for i in 0..N+1 {
        ans.push(0);
    }

    let mut x: i32 = 1;
    while x * x <= N {
        let mut y: i32 = 1;
        while x * x + y * y + x * y <= N {
            let mut z: i32 = 1;
            while x * x + y * y + z * z + x * y + y * z + z * x <= N {
                let mut n = x * x + y * y + z * z + x * y + y * z + z * x;
                if n <= N {
                    ans[n as usize] += 1;
                }
                z += 1;
            }
            y += 1;
        }
        x += 1;
    }

    for i in 1..N+1 {
        println!("{}", ans[i as usize]);
    }
}

Measured memory_bytes: 2104
program main
    use iso_fortran_env
    implicit none
    integer(int32) :: n, i
    integer(int32) :: ac, wa, tle, re
    character(3) :: si

    ac = 0
    wa = 0
    tle = 0
    re = 0
    read *, n

    do i = 1, n
        read *, si
        if (trim(si) == "AC") then
            ac = ac + 1
        elseif (trim(si) == "WA") then
            wa = wa + 1
        elseif (trim(si) == "TLE") then
            tle = tle + 1
        elseif (trim(si) == "RE") then
            re = re + 1
        endif
    enddo

    print "( 'AC x ', i0 )", ac
    print "( 'WA x ', i0 )", wa
    print "( 'TLE x ', i0 )", tle
    print "( 'RE x ', i0 )", re

end program main

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
struct edge{ll to, cost;};
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define INF 1000000000000

using graph = vector<vector<ll>>;

vector<bool> seen;
void dfs(const graph &G, int v){
    seen[v] = true;

    for(auto next_v : G[v]){
        if (seen[next_v]) continue;
        dfs(G, next_v);
    }
}

int main(){
    ll n,m;
    graph g(n);
    cin >> n >> m;
    int ans = 0;
    seen.assign(n, false);
    for(int i = 0; i < m;i++){
        ll temp1,temp2,temp3;
        cin >> temp1 >> temp2 >> temp3;
        g[temp1-1].push_back(temp2-1);
        g[temp2-1].push_back(temp1-1);
    }
    for(int i = 0; i < n; i++){
        if(!seen[i]){
            dfs(g,i);
            ans++;
        }
    }
    cout << ans << endl;



}

Measured memory_bytes: 155776
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<cmath>
#include<sstream>
#include<iomanip>
#include <map>
#include <stack>
 
const int64_t cc = pow( 10, 9 ) + 7;
//std::cout<< std::fixed << std::setprecision(10) << ( double )( max ) / 2;
bool sort_pair( std::pair< std::string, int64_t > origin, std::pair< std::string, int64_t > another )
{
    return origin.second  > another.second;
}

int64_t RepeatSquaring( int64_t n, int64_t p, int64_t mod )
{
    if( p == 0 )
    {
        return 1;
    }

    if( p % 2 == 0 )
    {
        int64_t t = RepeatSquaring( n, p / 2, mod );
        return t * t % mod;
    }

    return n * RepeatSquaring( n, p - 1, mod ) % mod;
}

//フェルマーの小定理を利用するのでmodが素数の時のみ
int64_t waru_mod( int64_t a, int64_t b, int64_t mod )
{
    b = RepeatSquaring( b, mod - 2, mod ) % mod;
    return  ( a * b ) % mod;
}

int64_t nCk( int64_t n, int64_t k, int64_t mod )
{
    int64_t ans_x = 1;
    int64_t ans_y = 1;

    for( int i = n; i > n - k; i-- )
    {
        ans_x *= i;
        ans_x %= mod;
    }

    for( int i = 1; i <= k; i++ )
    {
        ans_y *= i;
        ans_y %= mod;
    }

    return waru_mod( ans_x, ans_y, mod );
}

int main()
{
    std::string word = "aa";
    int64_t a,b,c,d,e,f;
    std::cin>> a;
    std::cin>> b;
    std::cin>> c;

    d = RepeatSquaring( 2, a, cc ) - 1;
    e = nCk( a, b, cc ) + nCk( a, c, cc );
    e %= cc;

    d = d - e + cc;
    d %= cc;

    std::cout<< d;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

int main(){
  ll a,b;
  cin>>a>>b;
  if(a%2!=b%2)cout<<"IMPOSSIBLE"<<endl;
  else cout<<(a+b)/2<<endl;
  return 0;
}

  



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int N;
    while(cin>>N)
    {
        unsigned long long int sum=0;
        for(int i=1;i<=N;i++)
        {
            if(i%3!=0&&i%5!=0)
            {
                sum=sum+i;
            }
        }
        cout<<sum<<endl;
    }
}


Measured memory_bytes: 3596
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD NUM000007
#define EPS 0.0000001
#define NUM 30000
using namespace std;
 
struct Info{
    double x,r;
};
 
double calc_dist(double left_x,double left_y,double right_x,double right_y){//info[k].x,info[k].r,m  m = (left+right)/2,tmp_r
    return sqrt((left_x-right_x)*(left_x-right_x)+(left_y-right_y)*(left_y-right_y));
}
 
int main(){
 
    int N;
    double tmp_r,tmp,maximum;
    double left,right,m,dist,tmp_loc;
    Info info[501];
 
    scanf("%d",&N);
    scanf("%lf",&tmp_r);
    info[0].x = tmp_r;
    info[0].r = tmp_r;
 
 
    for(int i = 1; i <= N-1; i++){
 
        scanf("%lf",&tmp_r);
 
        info[i].r = tmp_r;
        maximum = 0;
        for(int k = 0; k < i; k++){
 
            left = info[k].x;//double left_x
            right = info[k].x+info[k].r+tmp_r;
            m = (left+right)/2;
 
            dist = info[k].r+tmp_r;//圓的直徑 
 
            while(left<=right){
                tmp = calc_dist(info[k].x,info[k].r,m,tmp_r);
 
                if(abs(dist-tmp) < EPS){ //OK
                    tmp_loc = m;
                    if(tmp_loc < tmp_r)tmp_loc = tmp_r;
                    break;
                }else{
                    if(tmp > dist){
                        right = m-EPS;
                    }else{
                        left = m+EPS;
                    }
                }
                m = (left+right)/2;
            }
            maximum = max(maximum,tmp_loc);
        }
        info[i].x = maximum;
    }
 
    maximum = 0.0;
    for(int i = 0; i < N; i++)maximum = max(maximum,info[i].x+info[i].r);
 
    printf("%.8lf\n",maximum);
 
    return 0;
}


Measured memory_bytes: 2744
def euclid(x, y):
    c0, c1 = x, y
    a0, a1 = 1, 0
    b0, b1 = 0, 1
 
    while c1 != 0:
        m = c0 % c1
        q = c0 // c1
 
        c0, c1 = c1, m
        a0, a1 = a1, (a0 - q * a1)
        b0, b1 = b1, (b0 - q * b1)
 
    return a0, b0

n=int(input())
n*=2
soinsu=[]

num=n
for i in range(2,max(10,n)):
    if(i*i>n):
        if(num!=1):
            soinsu.append([num,1])
        break
    if(num%i!=0):
        continue
    cnt=0
    while(num%i==0):
        cnt+=1
        num//=i
    soinsu.append([i,cnt])

kazu=len(soinsu)
#print(soinsu,kazu)


ans=[]
for i in range(2**(kazu-1)):
    a=1
    for j in range(kazu):
        if((i&1<<j)!=0):
            a*=soinsu[j][0]**soinsu[j][1]
    b=n//a
    c,d=euclid(a,b)
    if(c*d==0):
        c+=b
        d+=a
    ans.append(max(a*c,b*d))
    #print(a,b,c,d)


if(kazu==1):
    print(min(ans)-2)
else:
    print(min(ans)-1)

Measured memory_bytes: 68492
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<ll> h(n);
    rep(i, n)cin >> h[i];
    for(int i = n - 1; i > 0; i--){
        if(h[i - 1] > h[i])h[i - 1]--;
    }
    bool d = true;
    rep(i, n - 1)if(h[i] > h[i + 1])d = false;
    cout << (d ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

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

		int ans = 2000;
		ans = Math.min(P+Q,ans);
		ans = Math.min(P+R,ans);
		ans = Math.min(Q+R,ans);
		System.out.println(ans);
	}
}


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

int main() {
  int A,B,count=0;
  cin >> A >> B;
  do
    if((B/100)==((B%10)*100+(B/10%10)*10+(B/100%10)))
      ++count;
  while((--B)>=A);
  cout << count << endl;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int s, t;
    while(cin >> s >> t, s or t)
    {
        vector<int> shop(5, 0);
        shop[0] = s + t;
        for(int i = 1; i <= 4; i++)
        {
            cin >> s >> t;
            shop[i] = s + t;
        }
        int maxv = 0;
        char ans;
        for(int i = 0; i < 5; i++)
        {
            if(maxv < shop[i])
            {
                maxv = shop[i];
                ans = 'A' + i;
            }
        }
        cout << ans << " " << maxv << endl;
    }
    return 0;
}




Measured memory_bytes: 3212
import Control.Monad
import Data.List
import Data.Map

readN :: String -> Int
readN s = read s

solve'' hm b (Just x) = Data.Map.insert b (x + 1) hm
solve'' hm b Nothing = Data.Map.insert b 1 hm

solve' hm b = solve'' hm b (Data.Map.lookup (b - 1) hm)

solve :: [Int] -> Map Int Int
solve is = Data.List.foldl' solve' empty is

main = do
        n <- readN <$> getLine
        l <- Data.List.map read <$> replicateM n getLine
        putStrLn $ show $ n - (maximum $ elems (solve l))


Measured memory_bytes: 103804
#include <stdio.h>

int main(void)
{
	float a, b;
	
	while (scanf("%f %f", &a, &b) != EOF){
	
		if ( a < 35.5 && b < 71){
			printf("AAA\n");
		}
		else if ( a < 37.5 && b < 77){
			printf("AA\n");
		}
		else if ( a < 40 && b < 83){
			printf("A\n");
		}
		else if ( a < 43 && b < 89){
			printf("B\n");
		}
		else if ( a < 50 && b < 105){
			printf("C\n");
		}
		else if ( a < 55 && b < 116){
			printf("D\n");
		}
		else if ( a < 70 && b < 148){
			printf("E\n");
		}
		else {
			printf("NA\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 604
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <string>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){


int n;
	
	while(cin >> n){
		if(n==0 || cin.eof()) break;
		int m2=0, m5=0,wk;
		rep2(i,1,n+1){
			wk=i;
			while(wk%2==0 || wk%5==0){
				if(wk%2==0){ 
					m2++;
					wk /= 2;
				}
				if(wk%5==0){ 
					m5++;
					wk /= 5;
				}
			}	
		}
		printf("%d\n",min(m5,m2));

	}

	return 0;
	
	
}

Measured memory_bytes: 1144
NOT_FOUND = 0
FOUND = 1
FINISHED = 2


class Stack(object):
    def __init__(self):
        self._stack = []

    def push(self, val):
        self._stack.append(val)

    def pop(self):
        val = self._stack[-1]
        del self._stack[-1]
        return val

    def top(self):
        if len(self._stack) > 0:
            return self._stack[-1]
        else:
            return None

    def is_stacked(self, val):
        if len(self._stack) > 0:
            return val in self._stack
        else:
            return None

    def get_len(self):
        return len(self._stack)


def parse_line(line):
    vals = [int(v) for v in line.split(' ')]
    node, n_node, nodes = vals[0], vals[1], vals[2:]
    # convert zero origin
    nodes = [n - 1 for n in nodes]
    return node, n_node, nodes


def main():
    # get input
    n = int(input().strip())
    graph = []
    for _ in range(n):
        line = input().strip()
        _, _, nodes = parse_line(line)
        graph.append(nodes)

    # initialize
    stack = Stack()
    stats = [NOT_FOUND for _ in range(n)]
    found_times = [None for _ in range(n)]
    finished_times = [None for _ in range(n)]
    counter = 0

    # dfs
    while sum(stats) < n * FINISHED:
        counter += 1
        init_node = None
        for node in range(n):
            if stats[node] == NOT_FOUND:
                init_node = node
                break
        assert init_node is not None
        stack.push(init_node)
        stats[init_node] = FOUND
        found_times[init_node] = counter

        while stack.get_len() > 0:
            counter += 1
            crr_node = stack.top()
            adj_nodes = graph[crr_node]
            for adj_node in adj_nodes:
                # exist not stacked node
                if stats[adj_node] == NOT_FOUND:
                    found_times[adj_node] = counter
                    stats[adj_node] = FOUND
                    stack.push(adj_node)
                    crr_node = adj_node
                    break
            else:
                # not exist not stacked node
                finished_times[crr_node] = counter
                stats[crr_node] = FINISHED
                stack.pop()
                crr_node = stack.top()

    for i in range(n):
        print('{} {} {}'.format(i + 1, found_times[i], finished_times[i]))


if __name__ == '__main__':
    main()



Measured memory_bytes: 5644
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
c = 1
ans = 0
prev = a[0]
for num in a[1:]:
    if num==prev:
        c += 1
    else:
        ans += (c//2)
        c = 1
    prev = num
ans += (c//2)
print(ans)

Measured memory_bytes: 38256
// #pragma GCC optimize "trapv" Uncomment when dealing with huge numbers
/*<----------PBDS---------->

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
template <typename T>
using order_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

order_set<datatype>oset;
Kth smallest : *oset.find_by_order(k-1); // 0 based index
No of elements less than k : oset.order_of_key(k);
Erase X : oset.erase(x)
<----------PBDS---------->*/
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define pb(x) push_back(x)
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define lcm(a,b) (a*b)/gcd(a,b)
#define bits(x) __builtin_popcountll(x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main()
{
	int n;
	cin >> n;
	int ans = (n/500)*1000;
	n = n%500;
	ans+=(n/5)*5;
	cout << ans;
}





Measured memory_bytes: 256
n,m = gets.split.map(&:to_i)
marks = Array.new(n)
links = []
m.times do
  a,b = gets.split.map(&:to_i)
  (links[a] ||= []) << b
  (links[b] ||= []) << a
end

visit = [1]
marks[0] = 0
while !visit.empty?
  next_visit = []
  visit.each do |i|
    links[i].each do |j|
      unless marks[j-1]
        marks[j-1] = i 
        next_visit << j
      end
    end
  end

  unless marks.any?(nil)
    puts "Yes"
    puts marks[1..].join("\n")
    return
  end

  visit = next_visit
end

puts "No"


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

int main(){
  int A;
  cin >> A;
  
  if(A<105)
    cout << 0 << endl;
  else if(A<135)
    cout << 1 << endl;
  else if(A<165)
    cout << 2 << endl;
  else if(A<189)
    cout << 3 << endl;
  else if(A<195)
    cout << 4 << endl;
  else
    cout << 5 << endl;
  
}

Measured memory_bytes: 256
com = ['AC','WA','TLE','RE']
cnt = [0, 0, 0, 0]
n = int(input(''))
for i in range(n):
    s = input('')
    for j in range(4):
        if s == com[j]:
            cnt[j] += 1

for i in range(4):
    print(com[i] + ' x ' + str(cnt[i]))

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
 
 
int main(){
  int N;
  string S;
  cin>>N>>S;
 
  int dot=0;
  //累積和
  int dotcount[200010]={0};
  int sharpcount[200010]={0};
  for(int i=0;i<N;i++){
    if(S[i]=='.')  dot++;
    dotcount[i+1]=dot;
    sharpcount[i+1]=i+1-dot;
  }
 
  int ans=10e6+1;
  for(int i=0;i<=N;i++){
    
    ans=min(ans,sharpcount[i]+dotcount[N]-dotcount[i]);
  }
  cout<<ans<<endl;
 
  return 0;
}

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

#define ln '\n'
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 0;
    FOR(i, 1, n) {
        int digit_n = log10(i) + 1;
        if (digit_n % 2 == 1) ans++;
    }
    cout << ans << ln;
    return 0;
}


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

/******************************
 * Minesweeper
 *****************************/

int main() {
  /*
  cout << ((true and true) ? "True" : "False") << endl;
  cout << ((true and false) ? "True" : "False") << endl;
  cout << ((true or true) ? "True" : "False") << endl;
  cout << ((true or false) ? "True" : "False") << endl;
  */
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for (int i = 0; i < H; i++) {
    cin >> S.at(i);
  }
  vector<string> res = S;
  for (int ih = 0; ih < H; ih++) {
    for (int iw = 0; iw < W; iw++) {
      char t = S.at(ih).at(iw);
      if (t == '#')  {
        continue;
      }
      int count = 0;
      for (int iih = -1; iih <=1; iih++) {
        for (int iiw = -1; iiw <= 1; iiw++) {
          int th = ih + iih;
          int tw = iw + iiw;
          if (0 <= th && th < H && 0 <= tw && tw < W) {
            if (S.at(th).at(tw) == '#') {
              count++;
            }
          }
        }
      }
      res.at(ih).at(iw) = '0' + count;
    }
  }

  // 出力
  for (int i = 0; i < H; i++) {
    cout << res.at(i) << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    #ifdef HOME
        freopen("input.txt", "r", stdin);
    #else 
        ios_base::sync_with_stdio(0);
        cin.tie(0);    
    #endif
    
    int n, a, b;
    cin >> n >> a >> b;
    cout << max(0ll, n - a + 1) * max(0ll, n - b + 1) << '\n';

    #ifdef HOME
        cerr << "TIME : " << (double)clock()/CLOCKS_PER_SEC<<'\n';
    #endif
}   

Measured memory_bytes: 256