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

using namespace std;

#define MP make_pair
#define PB push_back
#define f first
#define s second

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 1000000007;
const int INF = 1000000007;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll times(ll a, ll b)
{
    return modx(modx(a)*modx(b));
}

ll add(ll a, ll b)
{
    return modx(modx(a)+modx(b));
}

ll sub(ll a, ll b)
{
    return modx(MOD+modx(a)-modx(b));
}

ll fastExp(ll base, ll exp)
{
    if(exp == 0LL)
    {
        return 1LL;
    }

    if(exp%2==0)
    {
        return fastExp(times(base, base), exp/2);
    }
    else
    {
        return times(base, fastExp(times(base, base), exp/2));
    }
}


const int MAXN = (int)1e5+1;
int N, K, heights[MAXN];


int main()
{
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> N >> K;
    int ans = 0;
    for(int i=0; i<N; i++)
    {
        int x;
        cin >> x;
        ans += (x>=K);
    }
    cout << ans;
    return 0;
}


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

	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		if(i%3==0)printf(" %d",i);
		else{
			int j=i;
			while(j>0){
				if(j%10==3){
					printf(" %d",i);break;
				}
				j/=10;
			}
		}
	}
	printf("\n");
	return 0;}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iomanip>
//#include <string.h>
#include <bits/stdc++.h>
#define INF 999999999
using namespace std;
#define ll long long
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
bool vis[100000]={0};
int main()
{
    boost;
    ll n , m;
    int hh[100000]={0};
    int sum=0,num=8,su[8]={0};
    while(cin >>n){
        for(int i=1;i<=n;i++){
        cin >>hh[i];
    }
    int fagl=0;
    for(int i=1;i<=n;i++){
        if(hh[i]>=1&&hh[i]<400){
            su[0]=1;
        }
        else if(hh[i]<800){

            su[1]=1;
        }
        else if(hh[i]<1200)
        {
            su[2]=1;
        }
        else if(hh[i]<1600){
            su[3]=1;
        }
        else if(hh[i]<2000){
            su[4]=1;
        }
        else if(hh[i]<2400){
            su[5]=1;
        }
        else if(hh[i]<2800){
            su[6]=1;
        }
        else if(hh[i]<3200){
            su[7]=1;
        }
        else if(hh[i]>=3200){
            su[8]++;
        }
    }
    for(int i=0;i<8;i++){
        if(su[i])
            sum++;
    }
    if(!sum)cout<<1<<" "<<su[8]<<endl;
    else
        cout<<sum<<" "<<sum+su[8]<<endl;

    }

    return 0;

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int64_t INF = 1LL << 60;

int main() {
	int R,G,B,N;
  cin>>R>>G>>B>>N;
  int cnt=0;
  for(int r=0;r<=3000;r++){
    for(int g=0;g<=3000;g++){
      if((N-r*R-g*G)%B==0&&(N-r*R-g*G)>=0){
       cnt++;
      }
    }
  }
  cout<<cnt<<endl;
  return 0;
}


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

int f(int x){ 
 return x * x;
}

int i,c;

int area(int d) {
    int sum = 0;
    for(i=d; i<=600-d;i += d){
        c = d * f(i);
        sum = sum + c;
        
    }
    return sum;
}

int main(void){
    int d;
    while(scanf("%d", &d) != EOF) {
       printf("%d\n", area(d));
    }
    return 0;
}



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

int main()
{
	int L;
	cin >> L;
	int n = 2;
	while (L >= (1 << n)) ++n;
	vector<int> u, v, c;
	for (int i = 1; i < n; i++) {
		u.push_back(i);
		v.push_back(i + 1);
		c.push_back(0);
		u.push_back(i);
		v.push_back(i + 1);
		c.push_back(1 << (i - 1));
	}
	for (int i = 0; i < n - 1; i++) {
		if (L & (1 << i)) {
			u.push_back(i + 1);
			v.push_back(n);
			L ^= 1 << i;
			c.push_back(L);
		}
	}
	cout << n << ' ' << u.size() << endl;
	for (int i = 0; i < (int)u.size(); i++) {
		cout << u[i] << ' ' << v[i] << ' ' << c[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 256
def abc177d():
    n, m = map(int, input().split())
    if m ==0:
        print(1)
        return 
    check = [-1] * n
    group_no = 0
    group = {}
    for i in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        if check[a] == check[b] != -1: continue
        if check[a] == check[b] == -1:
            group[group_no] = {a, b}
            check[a] = check[b] = group_no
            group_no += 1
        elif check[a] == -1 or check[b] == -1:
            max_g = max(check[a],check[b])
            group[max_g] |= {a,b}
            check[b] = check[a] = max_g
        else:
            re = min(check[a], check[b])
            de = max(check[a], check[b])
            for v in group[de]:
                check[v] = re
            group[re] |= group[de]
            del group[de]
    max_val = max(map(len, group.values()))
    print(max(1,max_val))


abc177d()

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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int D, T, S;
  cin >> D >> T >> S;
  if (D <= S*T)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 3636
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
int n,q;
ll m;
ll d[500010];
ll c[500010];
ll f[500010];
void rd(int &s)
{
	int c;
	while((c=getchar())<'0'||c>'9');
	s=c-'0';
	while((c=getchar())>='0'&&c<='9')
		s=s*10+c-'0';
}
void rd(ll &s)
{
	int c;
	while((c=getchar())<'0'||c>'9');
	s=c-'0';
	while((c=getchar())>='0'&&c<='9')
		s=s*10+c-'0';
}
int abs(int x)
{
	return x>0?x:-x;
}
void yes()
{
	putchar('Y');
	putchar('E');
	putchar('S');
	putchar('\n');
}
void no()
{
	putchar('N');
	putchar('O');
	putchar('\n');
}
int main()
{
#ifdef DEBUG
	freopen("a.in","r",stdin);
	freopen("a.out","w",stdout);
#endif
	scanf("%d%lld",&n,&m);
	int i;
	ll x;
	c[0]=m;
	for(i=1;i<=n;i++)
	{
		rd(d[i]);
		c[i]=min(c[i-1],abs(c[i-1]-d[i]));
	}
	f[n+1]=0;
	for(i=n;i>=1;i--)
	{
		f[i]=f[i+1];
		if(d[i]<=2*f[i+1]+1)
			f[i]=max(f[i],f[i+1]+d[i]);
	}
	scanf("%d",&q);
	for(i=1;i<=q;i++)
	{
		rd(x);
		if(c[x-1]>f[x+1])
			yes();
		else
			no();
	}
	return 0;
}

Measured memory_bytes: 13568
// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Sat Dec  8 21:11:58 2018
//
package main

import "fmt"

func main() {
	var D int
	fmt.Scan(&D)
	var t string
	if D == 25 {
		t = "Christmas"
	} else if D == 24 {
		t = "Christmas Eve"
	} else if D == 23 {
		t = "Christmas Eve Eve"
	} else if D == 22 {
		t = "Christmas Eve Eve Eve"
	}

	fmt.Println(t)
}


Measured memory_bytes: 512
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {


		int N = nextInt();
		int[] A = nextInts();
		Arrays.sort(A);
		int idx=0;
		int z=0;
		boolean flg=true;
		while(flg){
			flg=false;
			for(int i=A.length-1;i>idx;i--){
				A[i]=A[i]%A[idx];
				if(A[i]==0){
					z++;
				}else{
					flg=true;
				}
			}
			idx=z;
			Arrays.sort(A);
		}

		System.out.println(A[idx]);
	}



	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}

Measured memory_bytes: 47244
h,w = map(int,input().split())

a = [[int(i) for i in input().split()] for _ in range(h)]

total = 0

ans = []

for i,row in enumerate(a):
    for j,cell in enumerate(row):
        if(cell % 2 == 0):
            continue
        
        if(i == h - 1 and j == w -1):
            break
        
        if(j != w - 1):
            a[i][j+1] += 1
            ans.append([i+1,j+1,i+1,j+2])
            total += 1
        elif(i != h - 1):
            a[i+1][j] += 1
            ans.append([i+1,j+1,i+2,j+1])
            total += 1

        
print(total)

for a in ans:
    print(*a)

Measured memory_bytes: 30124
/*
　　　　　／＞　 フ
　　　　　| 　_　 _|
　 　　　／`ミ _x 彡
　　 　 /　　　 　 |
　　　 /　  ヽ　　 ?
　／￣|　　 |　|　|
　| (￣ヽ＿_ヽ_)_)
　＼二つ
 */

#include <queue>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MP make_pair
#define ll long long
#define fi first
#define se second
using namespace std;

template <typename T>
void read(T &x) {
    x = 0; bool f = 0;
    char c = getchar();
    for (;!isdigit(c);c=getchar()) if (c=='-') f=1;
    for (;isdigit(c);c=getchar()) x=x*10+(c^48);
    if (f) x=-x;
}

template<typename F>
inline void write(F x, char ed = '\n') {
	static short st[30];short tp=0;
	if(x<0) putchar('-'),x=-x;
	do st[++tp]=x%10,x/=10; while(x);
	while(tp) putchar('0'|st[tp--]);
	putchar(ed);
}

template <typename T>
inline void Mx(T &x, T y) { x < y && (x = y); }

template <typename T>
inline void Mn(T &x, T y) { x > y && (x = y); }

const int N = 5005;
int h[N], ne[N<<1], to[N<<1], tot;
inline void add(int x, int y) {
	ne[++tot] = h[x], to[h[x] = tot] = y;
}

const int inf = 0x3f3f3f3f;
int dp[N], f[N], lim[N], n;
void dfs(int x) {
	for (int i = h[x]; i; i = ne[i]) dfs(to[i]);
	memset(dp, 0x3f, sizeof(dp));
	f[x] = inf, dp[0] = 0;
	for (int i = h[x], y; i; i = ne[i]) {
		y = to[i];
		for (int j = lim[x];j >= 0; j--) {
			int tmp = inf;
			if (j >= lim[y]) Mn(tmp, dp[j-lim[y]] + f[y]);
			if (j >= f[y]) Mn(tmp, dp[j-f[y]] + lim[y]);
			dp[j] = tmp;
		}
	}
	for (int j = 0;j <= lim[x]; j++) Mn(f[x], dp[j]);
	if (f[x] >= inf) { puts("IMPOSSIBLE"); exit(0); }
}



int main() {
	read(n);
	for (int i = 2;i <= n; i++)
		read(f[i]), add(f[i], i);
	for (int i = 1;i <= n; i++) read(lim[i]);
	dfs(1), puts("POSSIBLE");
	return 0;
}

Measured memory_bytes: 3080
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {

	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int lo = Integer.MAX_VALUE;
		int cnt = 0;
		for (int i = 0; i < N; i++) {
			int x = input.nextInt();
			if (x<lo) {
				cnt++;
				lo=x;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 63460
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long int li;

int main(void){
    ll ans=0;
    ll n,h,w;
    cin >> n >> h >> w;
    ans = (n-w+1)*(n-h+1);
    
    
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1000000000000000LL
#define rep(i,n) for(i=0;i<n;i++)

typedef pair<int,int> pii;
int i,j;
ll dp[2005][2005];

int main(void) {
    int n,x;
    cin>>n>>x;
    rep(i,2005)rep(j,2005) dp[i][j]=0;
    ll sum[2005]={};//cost
    rep(i,n){
        cin>>dp[0][i];
        sum[0]+=dp[0][i];
    }
    for(i=1;i<n;i++){//trans
        rep(j,n)//j-slime
            dp[i][j]=min(dp[i-1][j],dp[0][(n+j-i)%n]);
        rep(j,n)
            sum[i]+=dp[i][j];
        sum[i]+=(ll)x*i;
    }
    ll ans=INF;
    rep(i,n)
        ans=min(ans,sum[i]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 31616
#include<stdio.h>
#define N 100
int main(){
  int minj, i, j, n,A[N],x,count=0,flag;
  
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  
  for(i=0;i<n;i++){
    minj = i;
    flag=0;
    for(j=i;j<n;j++){
      if(A[j] < A[minj]){
	minj = j;
	flag=1;
      }
    }
    x = A[i];
    A[i] = A[minj];
    A[minj]=x;
    if(flag==1)count++;
    
  }
  for(i=0;i<n;i++){
    if(i==n-1)printf("%d\n",A[i]);
    else printf("%d ",A[i]);
  }
  printf("%d\n",count);
  
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


int main(){
  const int n = 4;//数字の個数 今回はABCDの4だね
  vector<int> v(n);
  for(int i=0; i<n;i++){
    char c;
    cin >> c;
    v.at(i) = c - '0';
  }
  //for(int i=0; i<n; i++) cout << v.at(i) << " ";
  //cout << endl;
  
  
  //1なら+  0なら-  というbit全探索する
  const int loop = n-1;//今回は3だね
  string op[3];
  bool is_7 = false; // 7になる方法を見つけたらtrue
  for(int i=0; i<(1<<loop); i++){//bit全探索 8回ループ
    int wa = v[0];
    for(int j=0; j<loop; j++){//左から+か-を決めていく
      if(i & (1<<loop-j-1)){//左からj番目が1なら...
        wa = wa + v[j+1];
        op[j] = '+';
        //cout <<"i: " << i << " j: " << j << "+" << " wa: " << wa << endl;
      }
      else{
        wa = wa - v[j+1];
        op[j] = '-';
        //cout <<"i: " << i << " j: " << j << "-"<< " wa: " << wa << endl;
      }
      if(j==loop-1 && wa == 7){//loop回ループしたときに7だったら...
        //cout <<"i: " << i << op[0] << op[1] << op[2]<<endl;
        is_7 = true;
        break;
      }
    }
    if(is_7==true) break;
  }
  
  for(int i=0; i<loop; i++) cout << v[i] << op[i];
  cout << v[n-1] << "=7" << endl;
  
}

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

int main() {
  int n = 0;
  cin >> n;
  int a = 0, b = 0, c = 0, d = 0;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  a--;
  b--;
  c--;
  d--;

  string s;
  cin >> s;
  s += "     ";

  for (int i = a; i+1 <= c; ++i) {
    if (s[i] == '#' && s[i+1] == '#') {
      cout << "No" << endl;
      return 0;
    }
  }

  for (int i = b; i+1 <= d; ++i) {
    if (s[i] == '#' && s[i+1] == '#') {
      cout << "No" << endl;
      return 0;
    }
  }

  if (c > d) {
    for (int i = b; i <= d; ++i) {
      if (i == 0) continue;

      if (s[i-1] == '.' && s[i] == '.' && s[i+1] == '.') {
        cout << "Yes" << endl;
        return 0;
      }
    }
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll inf = numeric_limits<ll>::max()/3;

void update(string s, vector<string> &v){
  int sz = v.size();
  for(int i = 0;i < sz;++i){
    if(s < v[i]){
      for(int j = sz-1;j > i;--j){
        v[j] = v[j-1];
      }
      v[i] = s;
      return;
    }else if(s == v[i]){
      return;
    }
  }
}


int main(void){
  string s;
  int k;
  cin >> s >> k;
  vector<string> v(k,"{");
  for(int i = 0;i < (int)s.size();++i){
    for(int j = i;j < (int)s.size();++j){
      string str = s.substr(i,j-i+1);
      if(str > v[k-1])
        break;
      update(str, v);
    }
  }
  cout << v[k-1] << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

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

    int A[N];
    int count[100001] = {};
    fill(count, count+100001, -1);
    
    rep(i,N){
        cin >> A[i];
        count[A[i]]++;
    }
    rep(i,N)    count[A[i]] = count[A[i]] % 2;

    sort(A, A+N);
    //rep (i ,N) cout << A[i] << " ";
    int count0 = 0;
    int count1 = 0;
    rep (i ,100001) {
        if (count[i] == 0) count0++;
        if (count[i] == 1) count1++; 
        //if (count[i] >= 0) printf("count[%d] = %d\n", i, count[i]);
    }
    cout << count0 + count1 - (count1 % 2) << endl;

    return 0;
}


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

int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(1)
	{
		c-=b;
		if(c<=0)
		{
			cout<<"Yes";
			return 0;
		}
		a-=d;
		if(a<=0)
		{
			cout<<"No";
			return 0;
		}
	}
}

Measured memory_bytes: 3576
using System;
using System.Collections.Generic;
using System.Linq;
class MainClass
{
	static void Main(string[] args)
	{
		AnswerA();
	}
	public static void AnswerA()
	{
      var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
      int ansTotalSum = 0;
      for(int i = 1; i <= input[0]; i++)
      {
        int t_sum = 0;
        t_sum = i.ToString().ToArray().Select(v => int.Parse(v.ToString())).Sum();
        if (input[1] <= t_sum && t_sum <= input[2])
        {
          ansTotalSum += i;
        }
      }
      Console.WriteLine(ansTotalSum);
	}
}

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

bool isPrime(int a){
    int i;
    if(a == 2) return true;
    if(a % 2 == 0 || a < 2) return false;
    for(i=3;i<=sqrt(a)+1;i+=2) if(a % i == 0) return false;
    return true;
}

int main(){
    int n,i,count=0;
    cin >> n;
    int a[n];

    for(i=0;i<n;i++) cin >> a[i];

    for(i=0;i<n;i++) if(isPrime(a[i])) count++;

    cout << count << endl;
    return 0;
}



Measured memory_bytes: 3100
import collections

def main():
    N = int(input())
    S = []
    for _ in range(N):
        S.append(input())
    c = collections.Counter(S)
    count = 0
    for t in c.most_common():
        if t[1] % 2 != 0:
            count = count + 1
    print(count) 

if __name__ == "__main__":
    main()

Measured memory_bytes: 24444
#include<bits/stdc++.h>
typedef long long ll;
const int N=2e5+5;
int n,X,x[N],i,j;
ll ans=1ll<<60,su[N];
int main(){
	scanf("%d%d",&n,&X);
	for(i=1;i<=n;++i)scanf("%d",x+i),su[i]=su[i-1]+x[i];
	for(i=1;i<=n;++i){
		ll z=1ll*i*X+5*(su[n]-su[n-i]);
		for(j=2;n>(j-1)*i && z<ans;++j)z+=(j<<1|1)*(su[n-(j-1)*i]-su[std::max(0,n-j*i)]);
		ans=std::min(ans,z);
	}
	printf("%lld\n",ans+1ll*n*X);
	return 0;
}

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

// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}

int main(){
 int n;
 cin >> n;
 ll sum = 0;
 for(int i = 1;i < n+1;i++){
   if(!(i % 3 == 0 or i % 5 == 0))sum += i;
 }
 cout << sum << endl;
}


Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;

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

int main() {

    string S;
    cin >> S;
    ll N = S.length();
    ll out = 0;
    rep(i,N){
        if(i>0&&S[i]!=S[i-1]) out++;
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> p(n + 2, INF);
    for(int i = 1; i <= n; i++) cin >> p[i];
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        if(p[i] == i && p[i + 1] == i + 1)
        {
            ans++;
            i++;
        }
        else if(p[i] == i)
        {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}



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

int S, h, m, s;

scanf("%d", &S);

h = S / 3600;
m = ( S - h*3600 ) / 60;
s = S - ( h*3600 + m*60);

printf("%d:%d:%d\n", h, m, s);

return 0;
}

Measured memory_bytes: 592
import sys
input=sys.stdin.buffer.readline
from math import*
import copy


n=int(input())
arr=list(map(int,input().split()))
ans=arr[0]
for i in range(1,n):
	if arr[i]>=arr[i-1]:
		ans+=arr[i]-arr[i-1]
	else:
		continue
print(ans)


Measured memory_bytes: 68748
n = gets.to_i
as = gets.chomp.split.map(&:to_i)
sum = 0
ans = []
as.each_with_index do |a,i|
  if i.even?
    sum += a
  else
    sum -= a
  end
end
ans << sum
(0..n-2).each do |i|
  ans << 2 * as[i] - sum
  sum = ans[-1]
end
puts ans.join(" ")


Measured memory_bytes: 15108
use std::io;
use std::cmp;
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let N: i32 = iter.next().unwrap().parse().unwrap();
    let M: i32 = iter.next().unwrap().parse().unwrap();
    let mut max: i32 = 0;
    for d in divisor(M) {
        if M / d >= N {
            max = cmp::max(max, d);
        }
    }
    println!("{}", max);
}
fn divisor(n: i32) -> Vec<i32> {
    let mut res: Vec<i32> = Vec::new();
    let sqrtN: i32 = ((n as f64).sqrt() as i32) + 2;    
    for i in 1..sqrtN {
        if n % i == 0 {
            res.push(i);
            if n / i != i {
                res.push(n / i);
            }
        }
    }
    return res;
}


Measured memory_bytes: 4352
#include <iostream>
using namespace std;
int main(void){
    int N,Y;
    cin >> N >> Y;
    for(int i=0;i<=N;i++){
        for(int j=0;j<=N-i;j++){
            int k=N-i-j;
            if(10000*i+5000*j+1000*k==Y){
                cout<<i<<" "<<j<<" "<<k<<endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define all(x) x.begin(),x.end()
using namespace std;
inline int mex(unordered_set<int> st)
{
	int m = 0;
	while (st.find(m) != st.end())
	{
		m += 1;
	}
	return m;
}
inline int calculateGrundy(int n)
{
	if (n == 1)
		return 0;
	unordered_set<int> mexi;
	for (int i = 1; i <= sqrt(n); i += 1)
	{
		if (n % i == 0)
		{
			if (n / i != n)
				mexi.insert(calculateGrundy(n / i));
			mexi.insert(calculateGrundy(i));
		}
	}
	return mex(mexi);
}
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
inline ll power(ll base, ll exp)
{
	ll ans = 1;
	while (exp > 0)
	{


		if (exp % 2 != 0)
			ans = (ans * base) % N;

		base = (base * base) % N;
		exp /= 2;
	}
	return ans % N;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	double r;
	cin >> r;
	double ans;
	ans = 2.0000000000000 * 3.141592653 * r;
	cout << setprecision(6);
	cout << ans;
	return 0;
}

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

int main() {
  int x, n;
  cin >> x >> n;
  vector<int> a(103);
  rep(i, 103) a[i] = i;
  rep(i, n) {
    int p;
    cin >> p;
    a[p] = 1000;
  }
  int minnum = 10000;
  int ans = 0;
  rep(i, 103) {
    int sa = abs(a[i] - x);
    if(sa < minnum) {
      minnum = sa;
      ans = a[i];
    }
  }
  cout << ans << endl;
  return 0;
}
    

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define all(x) x.begin(),x.end()
#define watch(x) cout<<(#x)<<" = "<<(x)<<'\n'
#define mset(a,v) memset(a,v,sizeof(a))
#define setp(x) cout<<fixed<<setprecision(x)
#define EPS 0.00000000001
#define PI acos(-1)
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

const int MOD = 1e9 + 7;
const LL MX = 1e9;
const LL INF = 1e9;

void print_a(VI v)
{
    if(v.size()) cout<<v[0];
    loop(i,1,v.size()) cout<<' '<<v[i];
    cout<<'\n';
}

VVI init_vvi(int n, int m, int val)
{
    return VVI(n,VI(m,val));
}

VVL init_vvl(int n, int m, LL val)
{
    return VVL(n,VL(m,val));
}

int main()
{
    //ofstream out("output.txt");
    //ifstream in("input.txt");
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int x, ans;
    loop(i,0,5)
    {
        cin>>x;
        if(x == 0) ans = i+1;
    }

    cout<<ans<<'\n';

    /*
    int t,n;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int a[n];
        loop(i,0,n)
        {
            cin>>a[i];
        }
    }
    */

    /*
    int n;
    cin>>n;
    int a[n];
    loop(i,0,n)
    {
        cin>>a[i];
    }
    */

    /*
    cout<<ans<<'\n';

    if(f) cout<<"YES\n";
    else cout<<"NO\n";

    if(f) cout<<"Yes\n";
    else cout<<"No\n";
    */

    return 0;
}


Measured memory_bytes: 3604
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    int X; cin >> X;
    int res = 1;
    for (int b = 2; b*b <= X; ++b) {
      int bp = b*b;
      while (bp <= X) {
        res = max(res, bp);
        bp *= b;
      }
    }
  
    cout << res << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=1e6+10;
int n,m,a[4][N];
ll ans,cnt[N];

 
int main()
{
//	freopen("in.in","r",stdin);
//	freopen("out.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=3;i++)
		for(int j=1;j<=n;j++)
		scanf("%d",&a[i][j]);
	for(int i=1;i<=3;i++)
		sort(a[i]+1,a[i]+n+1);
	for(int i=1,j=1;j<=n;j++)
	{
		while(a[1][i]<a[2][j]&&i<=n) i++;
		cnt[j]=i-1;
	}
//	for(int i=1;i<=n;i++)
//		printf("cnt=%d\n",cnt[i]);
//改用前缀和（dp思想） 
	for(int i=1;i<=n-1;i++) cnt[i+1]=cnt[i]+cnt[i+1]; 
	for(int i=1,j=1;j<=n;j++)
	{
		while(a[2][i]<a[3][j]&&i<=n) i++;
//		for(int m=1;m<=i-1;m++)
//			ans+=cnt[m] ;
		ans+=cnt[i-1];
	 	
	 } 

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

Measured memory_bytes: 9216
#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() {
  int a[3][3];
  rep(i, 3) rep(j, 3) cin >> a[i][j];

  int n;
  cin >> n;
  bool d[3][3];
  rep(i, 3) rep(j, 3) d[i][j] = false;

  rep(i, n) {
    int b;
    cin >> b;
    rep(i, 3) rep(j, 3) if (a[i][j] == b) d[i][j] = true;
  }

  rep(i, 3) {
    if (d[i][0] && d[i][1] && d[i][2]) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  rep(i, 3) {
    if (d[0][i] && d[1][i] && d[2][i]) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  if (d[0][0] && d[1][1] && d[2][2]) {
    cout << "Yes" << endl;
    return 0;
  }

  if (d[0][2] && d[1][1] && d[2][0]) {
    cout << "Yes" << endl;
    return 0;
  }

  // rep(i, 3) {
  //   bool now = true;
  //   rep(j, 3) if (!d[i][j]) now = false;
  //   if (now) {
  //     cout << "Yes" << endl;
  //     return 0;
  //   }
  // }
  //
  // rep(i, 3) {
  //   bool now = true;
  //   rep(j, 3) if (!d[j][i]) now = false;
  //   if (now) {
  //     cout << "Yes" << endl;
  //     return 0;
  //   }
  // }
  //
  // rep(i, 3) {
  //   bool now = true;
  //   if (!d[i][2 - i]) now = false;
  //   if (now) {
  //     cout << "Yes" << endl;
  //     return 0;
  //   }
  // }
  //
  // rep(i, 3) {
  //   bool now = true;
  //   if (!d[2 - i][i]) now = false;
  //   if (now) {
  //     cout << "Yes" << endl;
  //     return 0;
  //   }
  // }

  cout << "No" << endl;

  return 0;
}


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

const int N = 1e6 + 5;

#define st first
#define nd second
#define make(a,b) make_pair(a,b)

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

bool dasie(int n, int a, int b, int c, int d) {
	b -= a;
	a = 0;
	if (n % 2) {
		long long m = min((double)(n-1), abs(b) / ((d+c)/2.0));
		long long m1;
		long long m2;
		if (m % 2) m ++;
		if (m > (n-1)) m -= 2;
		if (m + 2 <= (n-1)) m1 = m + 2;
		else m1 = m;
		if (m - 2 <= (n-1)) m2 = m - 2;
		else m2 = m;
		if (b < 0) {
			m *= -1;
			m1 *= -1;
			m2 *= -1;
		}
//		cout << m << " " << m1 << " " << m2 << "\n";
		return abs(m * (d+c)/2.0 - b) <= (d - c)/2.0 * (long long)(n-1) ||
		abs(m1 * (d+c)/2.0 - b) <= (d - c)/2.0 * (long long)(n-1) ||
		abs(m2 * (d+c)/2.0 - b) <= (d - c)/2.0 * (long long)(n-1);
	} else {
		long long m = min((double)(n-1), abs(b) / ((d+c)/2.0));
		long long m1;
		long long m2;
		if (m % 2 == 0) m ++;
		if (m > (n-1)) m -= 2;
		if (m + 2 <= (n-1)) m1 = m + 2;
		else m1 = m;
		if (m - 2 <= (n-1)) m2 = m - 2;
		else m2 = m;
		if (b < 0) {
			m *= -1;
			m1 *= -1;
			m2 *= -1;
		}
// 		cout << m << " " << m1 << " " << m2 << "\n";
// 		cout << "wiel: " <<  (d - c) * (long long)(n-1) << endl;
// 		cout << "ile: " << (long long) (m * (d+c)/2.0 - b) << endl;
		return abs(m * (d+c)/2.0 - b) <= (d - c)/2.0 * (long long)(n-1) ||
		abs(m1 * (d+c)/2.0 - b) <= (d - c)/2.0 * (long long)(n-1) ||
		abs(m2 * (d+c)/2.0 - b) <= (d - c)/2.0 * (long long)(n-1);
	}
}

int main()
{
	int n, a, b, c, d;
	scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);
	printf("%s", dasie(n, a, b, c, d) ? "YES" : "NO");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int INF = 1001001001;
const int MOD = 1e9+7;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n,m; cin >> n >> m;
  int ans = 0;
  rep(i,1<<m){
    ans += (n-m)*100;
    ans += m*1900;
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
const long long MOD=1e9+7;
const int MAXN=1e6+5;

long long n;
long long a,b,c;

int main()
{
	cin >> n;
	a=1;b=1;c=1;
	for(int i=1;i<=n;i++)
	{
		a=(a*10)%MOD;
		b=(b*9)%MOD;
		c=(c*8)%MOD;
	}
	cout << (a-2*b+c+2*MOD)%MOD << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    cout << (N==M? "Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
}

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

int main() { 
  int A, B;
  cin >> A >> B;
  int d = 0;
  for (int i = A; i <= B; i++) {
    if(i/10000==i%10 && i/1000%10==i%100/10){
      d++;

    }
  }
  cout << d << endl;
}

Measured memory_bytes: 3516
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;
bool sr(ll a, ll b)
{
	return a > b;
}
bool ps1(const P &element1, const P &element2)
{ //first昇順
	return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
	return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
	return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
	return element1.second > element2.second;
}
int digits(ll n)
{
	int count = 0;
	while (n > 0)
	{
		n /= 10;
		count++;
	}
	return count;
}
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}

int main()
{
	int n;
	cin>>n;
	FOR(h,1,3501){
		FOR(w,1,3501){
			double hw=h*w;
			double hpw=h+w;
		    long double u=n*hw/(4*hw-n*hpw);
			long iu=u;
			if(u==iu&&iu>0){
				cout<<h<<" "<<w<<" "<<iu<<endl;
				h=w=3600;
			}
			
		}
	}
}


Measured memory_bytes: 256
l = 5.times.map{gets.chomp}.sort_by{|c| c[-1]}.map(&:to_i)
l.rotate!(l.count{|n| n%10==0})
p l[1..4].inject(l[0]){|sum, n| sum + (n%10==0 ? n : n/10*10+10)}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define fi first
#define se second
#define sz(x) ((int)x.size())
using namespace std;

typedef long long lli;
typedef pair<int,int> pii;

const int MAXN=100000,mod=1e9+7;
int n,m,a[MAXN],b[MAXN];
int main() {
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)scanf("%d",a+i);
	for(int i=0;i<m;i++) scanf("%d",b+i);

	lli as=0,bs=0;
	for(int i=0;i<n-1;i++) as=(as+1ll*(a[i+1]-a[i])*(i+1)%mod*(n-i-1)%mod)%mod;
	for(int i=0;i<m-1;i++) bs=(bs+1ll*(b[i+1]-b[i])*(i+1)%mod*(m-i-1)%mod)%mod;

	printf("%lld\n",as*bs%mod);
	
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;
int main()
{
int x1,y1,x2,y2;
cin >> x1>>y1>>x2>>y2;
int sabx,saby,x3,y3,x4,y4;
sabx=x2-x1;
saby=y2-y1;
x4=x1-saby;
y4=y1+sabx;
int sabbx,sabby;
sabbx=x4-x1;
sabby=y4-y1;
x3=x1+sabx+sabbx;
y3=y1+saby+sabby;
cout<<x3<<" "<< y3<< " " << x4 <<" "<<y4;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e6;
const int inf=1<<30;
int i,j,k,m,n,tot;
int a[N],ver[N],nxt[N],edge[N],head[N];
char s[N],t[N];
void add(int x,int y,int w)
{
	ver[++tot]=y,edge[tot]=w,nxt[tot]=head[x],head[x]=tot;
}
int main()
{
	scanf("%d%d",&n,&m);
	if(n>=13) 
	{
		printf("%d",m);
		return 0;
	}
	else if(n>=6&&n<=12)
	{
		printf("%d",m/2);
		return 0;
	}
	else
	{
		printf("0");
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a[101]={0},k=0;
  while(cin>>n){
    a[n]++;
    k=max(a[n],k);
  }
  for(int i=1;i<101;i++)if(a[i]==k)cout<<i<<endl;
}

Measured memory_bytes: 3012
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int num = N / 111;
		if (N % 111 != 0) {
			num++;
		}
		System.out.println(num * 111);
	}
}


Measured memory_bytes: 27028
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vll vec(n);
	unordered_map<ll, ll> mp;
	for(ll i=0;i<n;i++){
		cin>>vec[i];
		mp[vec[i]]++;
	}
	ll sum = 0;
	for(auto i:mp){
		sum+= i.first*i.second;
	}
	ll q;
	cin>>q;
	for(ll i=0;i<q;i++){
		ll b, c;
		cin>>b>>c;
		if(mp.count(b)){
			ll count = mp[b];
			sum-=b*count;
			mp.erase(b);
			mp[c] += count;
			sum+=c*count;
		}
		cout<<sum<<endl;
	}

	return 0;
}


Measured memory_bytes: 7364
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << -1 << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

signed main(void){
    string S;
    cin >> S;
    int N=S.size();
    vector<pair<int,int>> Ans;
    if(S[N-1]!='0')GOODBYE;
    if(S[0]!='1')GOODBYE;
    if(S[N-2]!='1')GOODBYE;
    REP(i,N-1){
        if(S[i]!=S[N-2-i])GOODBYE;
    }
    int now=0;
    REP(i,N-1){
        Ans.push_back({now,i+1});
        if(S[i]=='1'){
            now=i+1;
        }
    }
    
    REP(i,Ans.size()){
        cout << Ans[i].first+1 MM Ans[i].second+1 << endl; 
    }
    
  return 0;
}



Measured memory_bytes: 3312
N = int(input())
A = list(map(int, input().split()))
A.append(0)
total = 0
cur = 0
for i in range(N+1):
    total += abs(A[i]-cur)
    cur = A[i]

cur = 0
for i in range(N):
    if (cur <= A[i] <= A[i+1]) or (A[i+1] <= A[i] <= cur):
        print(total)
    elif (A[i+1] <= cur <= A[i]) or (A[i] <= cur <= A[i+1]):
        print(total-abs(A[i]-cur)*2)
    elif (A[i] <= A[i+1] <= cur) or (cur <= A[i+1] <= A[i]):
        print(total-abs(A[i+1]-A[i])*2)
    cur = A[i]


Measured memory_bytes: 66156
import java.io.*;
import java.util.*;
public class Main {
	static Scanner sc;
	static PrintWriter out;
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		int l = sc.nextInt();
		double side = l/3.0;
		out.printf("%f\n",side*side*side);
		out.flush();
	} 
	static boolean isPalindrome(String s) {
		int l = s.length();
		char[] sa = s.toCharArray();
		for(int i=0;i<l/2;i++) {
			if(sa[i] != sa[l-i-1])
				return false;
		}
		return true;
	}
	static class Scanner{
		private BufferedReader br;
		private StringTokenizer st;
		public Scanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}
		public String next() throws IOException{
			while(st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException{
			return Long.parseLong(next());
		}
		public double nextDouble() throws IOException{
			return Double.parseDouble(next());
		}
		public int[] inArr(int n) throws Exception{
			int a [] = new int[n];
			st = new StringTokenizer(br.readLine());
			for(int i=0;i<n;i++) {
				a[i] = Integer.parseInt(st.nextToken());
			}
			return a;
		}
	}
}

Measured memory_bytes: 21332
// https://atcoder.jp/contests/arc093/tasks/arc093_a

#include "algorithm"
#include "iostream"
#include "set"
#include "vector"
#define rep(i, from, to) for (ll i = from; i < (to); ++i)
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

ll N;
V<ll> as;

void solve() {
  cin >> N;
  as.resize(N);
  rep(i, 0, N) cin >> as[i];

  V<ll> acc(N + 2);  // acc[i]: 0 から i 番目までの累積和. acc[1]: 番目まで、
                     // acc[N+1]: 0 に戻ってくるまで
  acc[0] = 0;

  rep(i, 0, N + 1) {
    ll prev = i == 0 ? 0 : as[i - 1];
    ll curr = i == N ? 0 : as[i];

    acc[i + 1] = acc[i] + abs(curr - prev);
  }

  rep(i, 0, N) {
    ll add = i == 0 ? abs(as[1])
                    : i == N - 1 ? abs(as[N - 2]) : abs(as[i + 1] - as[i - 1]);
    ll res = (acc[i]) + (acc[N + 1] - acc[i + 2]) + add;
    cout << res << endl;
  }
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, 0, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
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; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int N, K; cin >> N >> K;
    string S; cin >> S;

    // 「1 の個数」「0 の個数」を交互に記録していく
    vector<int> nums;    
    if (S[0] == '0') nums.push_back(0); // 先頭が 0 だったら
    for (int i = 0; i < S.size();) {
        int j = i;
        while (j < S.size() && S[j] == S[i]) ++j; // S[i] の数値がどこまで続くか
        nums.push_back(j - i);
        i = j;
    }
    if (S.back() == '0') nums.push_back(0); // 最後尾が 0 だったら

    // 累積和
    vector<int> sums((int)nums.size() + 1, 0);
    for (int i = 0; i < nums.size(); ++i) sums[i+1] = sums[i] + nums[i];

    // 偶数番目の添字から始まる、長さ 2K+1 (以下) の区間の総和のうち、最大値を求める
    int res = 0;
    for (int left = 0; left < sums.size(); left += 2) {
        int right = left + K*2+1;
        if (right >= sums.size()) right = (int)sums.size() - 1;
        res = max(res, sums[right] - sums[left]);
    }
    cout << res << endl;
}

Measured memory_bytes: 1272
#include<stdio.h>
 
int main(){
	int a[100], i, n, max = 0, min = 0, t;
	scanf("%d", &t);
	for(int j = 0; j < t; j++){
		scanf("%d", &n);
		for(i = 0; i < n; i++){
			scanf("%d", &a[i]);
			if(i == 0) continue;
			else if(i == n - 1){
				if(a[i] - a[i - 1] < min) min = a[i] - a[i - 1];
				if(a[i] - a[i - 1] > max) max = a[i] - a[i - 1];
			}else{
				if(a[i] - a[i - 1] < min) min = a[i] - a[i - 1];
				if(a[i] - a[i - 1] > max) max = a[i] - a[i - 1];
			}
		}
		printf("%d %d\n", max, min * -1);
		max = 0;
		min = 0;
	}
	return 0;
}

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

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

    std::deque<char> q;
    for (size_t i = 0; i < s.size(); ++i) {
        if (s[i] == 'B') {
            if (q.size() != 0) {
                q.pop_back();
            }
        } else {
            q.push_back(s[i]);
        }
    }

    std::string str(q.begin(),  q.end());
    std::cout << str << std::endl;

    return 0;
}


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

int main() {
	string N;
	cin >> N;
  rep(i,3){
		if(N[i]=='1'){
			cout << "9";
		} else {
			cout << "1";
		}
	}
	cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b;
    cin>>a>>b;
    if((a+b)&1==0){
        cout<<(a+b)/2;
    }
    else{
        cout<<(a+b+1)/2;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n,a,now,b,c,x,y[1010];
	while(cin>>n>>a>>b>>c>>x,n){
		now=0;
		for(int i=0;i<n;i++)
		cin>>y[i];
		int i;
		for(i=0;i<=10000;i++){
			if(x==y[now]){
				now++;
				if(now==n)
				break;
			}
			x=(x*a+b)%c;
		}
		if(i==10001)
		cout<<-1<<endl;
		else
		cout<<i<<endl;
	}
	return 0;
}

Measured memory_bytes: 0