akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    print(input().count('1'))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 1e5
#define INF 1<<30
#define EPS 1e-5
#define all(a) (a).begin(),(a).end()
#define INTCEIL(x, y) -(-(x) / (y))
constexpr ll mod = 1e9 + 7;
using namespace std;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;


int main() {
	cin >> N >> M;
	vector<int> a(N);
	for (int i = 0; i < N; i++)cin >> a[i];
	int sum = accumulate(a.begin(), a.end(), 0);
	for (int i = 0; i < N; i++) {
		if (a[i] < sum / (4.0 * M)) {
			ans++;
		}
	}
	ans = N - ans;
	if (ans >= M) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


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

public class Main {

  static int n;
  static int a;
  static int b;
  static int c;
  static int[] l;

  public static void main(String[] args) {
    InputReader in = new InputReader(System.in);
    PrintWriter out = new PrintWriter(System.out);

    n = in.nextInt();
    a = in.nextInt();
    b = in.nextInt();
    c = in.nextInt();

    l = new int[n];

    for (int i = 0; i < n; i++)
      l[i] = in.nextInt();

    out.println(dfs(0, 0, 0, 0));

    out.close();
  }

  static int dfs(int cur, int a, int b, int c) {
    if (cur == n)
      return (min3(a, b, c) > 0) ? Math.abs(a - Main.a) + Math.abs(b - Main.b) + Math.abs(c - Main.c) - 30 : 1000000000;

    int ret0 = dfs(cur + 1, a, b, c);
    int ret1 = dfs(cur + 1, a + l[cur], b, c) + 10;
    int ret2 = dfs(cur + 1, a, b + l[cur], c) + 10;
    int ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10;
    return min4(ret0, ret1, ret2, ret3);
  }

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

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

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

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

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }
  }

  static int min3(int a, int b, int c) {return Math.min(a, Math.min(b, c));}
  static double min3(double a, double b, double c) {return Math.min(a, Math.min(b, c));}
  static long min3(long a, long b, long c) {return Math.min(a, Math.min(b, c));}

  static int min4(int a, int b, int c, int d) {return Math.min(Math.min(a, b), Math.min(c, d));}
  static double min4(double a, double b, double c, double d) {return Math.min(Math.min(a, b), Math.min(c, d));}
  static long min4(long a, long b, long c, long d) {return Math.min(Math.min(a, b), Math.min(c, d));}

  static int max3(int a, int b, int c) {return Math.max(a, Math.max(b, c));}
  static double max3(double a, double b, double c) {return Math.max(a, Math.max(b, c));}
  static long max3(long a, long b, long c) {return Math.max(a, Math.max(b, c));}

  static int max4(int a, int b, int c, int d) {return Math.max(Math.max(a, b), Math.max(c, d));}
  static double max4(double a, double b, double c, double d) {return Math.max(Math.max(a, b), Math.max(c, d));}
  static long max4(long a, long b, long c, long d) {return Math.max(Math.max(a, b), Math.max(c, d));}

}



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

int main() {
  int N;
  cin >> N;
  vector<pair<int64_t,int64_t>>data(N);
  for(int i=0;i<N;i++){
    int64_t a;
    cin >> a;
    int64_t x;
    cin >> x;
    data.at(i).first=a+x;
    data.at(i).second=a-x;
  }
  sort(data.begin(),data.end());
  
  int ans=0;
  int64_t A=-1000000010;
  
  for(int i=0;i<N;i++){
    if(data.at(i).second>=A){
      ans++;
      A=data.at(i).first;
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 4792
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)


/// 方針
/// 与数Mを素因数分解する 素因数とその指数をpairとしてリストPに格納
/// P(素因数:s,  個数:t)
/// N個の数の積に分解したいので、各pairについてN個に分割
/// 積を取れば良い

// aのp乗を求める関数
ll modpow(ll a, int p)  {
  if (p == 0) return 1;
  if (p%2 == 0) {
    int halfP = p / 2;
    ll half = modpow(a, halfP);
    return half * half % MOD;
  }
  else  {
    return a * modpow(a, p-1) % MOD;
  }
}


/// aCbを求める関数
ll mod_combination(int a, int b)  {
  if (b > a-b)  return mod_combination(a, a-b);
  ll ansMul = 1;
  ll ansDiv = 1;
  rep(i, b) {
    ansMul *= (a - i);
    ansDiv *= (i + 1);
    ansMul %= MOD;
    ansDiv %= MOD;
  }
  ll ans = ansMul * modpow(ansDiv, MOD-2) % MOD;
  return ans;
}


int main(void){
	ll N, M; cin >> N >> M;
	vector< pair<int,ll> > P;
  /// 素因数分解してリストPに格納
  ll original = M;
  int flag = 1;
  while (M != 1) {  /// 素因数分解が終わるまで繰り返す
    for (int i=2; i*i < original; i++)  {  /// 考える素因数の値を変えていく
      ll cnt = 0;
      while (flag)  {
        if (M%i == 0) {
          cnt++;
          M /= i;
        } else  {
          if (cnt)  {
            pair<int, ll> pa;
            pa.first = i;
            pa.second = cnt;
            P.push_back(pa);
          }
          flag = 0;
        }
      }
      flag = 1;
    }
    if (M != 1)  {
      pair<int, ll> pa;
      pa.first = M;
      pa.second = 1;
      P.push_back(pa);
      M = 1;
    }
  }
  flag = 1;
  ll ans = 1;
  rep(i, P.size())  {
    if (P[i].second == 0) {
      break;
    }
    ans *= mod_combination((P[i].second+N-1), N-1);
    ans %= MOD;
  }
  if (ans < 0)  {
    ans = MOD - ans;
  }
  cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int n,d,x,xx,sum;
int main()
{
    fast;
    cin>>n>>d>>x;
    for (int i=1;i<=n;i++)
    {
    	cin>>xx;
    	for (int i=1;i<=d;i+=xx)
    	   x++;
    }
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int x, y, z;

  scanf("%d%d", &x, &y);

  if(x > y)
    {
      z = x;
      x = y;
      y = z;
    }
  
  while(z = y%x)
    {
      y = x;
      x = z;
    }

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

  return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for (int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for (int (i) = (a) - 1; (i) >= (b); (i)--)
#define PI acos(-1.0)
#define DEBUG(C) cout<< C <<endl;
#define VI vector <int>
#define VII vector <VI>
#define VL vector <LL>
#define VLL vector <VL>
#define VD vector <double>
#define VDD vector <VD>
#define PII pair <int, int>
#define PDD pair <double, double>
#define PLL pair <LL, LL>
#define VPII vector <PII>
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define EB emplace_back
#define FORE(a, b) for (auto &&a:b)
#define FIND(s, n) (s.find(n) != s.end())

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 1e9;
const int MOD = INF + 7;

int main(void) {
    string X;
    cin >> X;
    int len = X.size();
    int cnt = 0;
    int ch = 0;
    REP(i, len) {
        if (X[i] == 'S') {
            ch++;
        } else {
            if (ch > 0) {
                cnt++;
                ch--;
            }
        }
    }
    cout << len - (cnt * 2) << endl;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define ck cout<<" xxx  "<<endl
typedef long long ll;
const int maxn=1e3+100;
const int maxc=26;
const int inf=0x3f3f3f3f;
ll countFactorNumber(ll n)
{
 ll s = 1;
 for (int i = 2; (ll)i*i <= n; ++i)
 {
  if (n%i == 0)
  {
   int a = 0;
   while (n%i == 0)
   {
    n /= i;
    a++;
   }
   s *= a + 1;
  }
 }
 if (n>1)
  s *= 2;
 return s;
}
int main()
{
    ll n;
    scanf("%lld",&n);
    ll lim=(ll)sqrt(n+0.5);
    ll tot=0;
    for(int i=2;i<=lim;i++){
        ll x=n;
        if(x%i!=0)
            continue;
        while(x%i==0){
            x/=i;
        }
        x--;
        //ck;
        if(!x||x%i==0){
            tot++;
        }
    }
    //ck;
    printf("%lld\n",tot+countFactorNumber(n-1));
    return 0;
}
/*

*/


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
using namespace std;
const int MAXN = 1e5 + 5;
struct { int v, w, next; } e[MAXN * 12];
int cnt_edge, head[MAXN * 5];
inline void add_edge(int u, int v, int w) {
	e[cnt_edge] = { v, w, head[u] };
	head[u] = cnt_edge++;
}
int dis[MAXN * 5];
bool inque[MAXN * 5];
int spfa(int s, int t) {
	memset(dis, 0x3f, sizeof(dis));
	queue<int> que;

	dis[s] = 0;
	inque[s] = true;
	que.push(s);
	while(!que.empty()) {
		int u = que.front(); que.pop();
		inque[u] = false;
		for(int i = head[u]; i != -1; i = e[i].next) {
			if(dis[e[i].v] > dis[u] + e[i].w) {
				dis[e[i].v] = dis[u] + e[i].w;
				if(!inque[e[i].v]) {
					inque[e[i].v] = true;
					que.push(e[i].v);
				}
			}
		}
	}

	return dis[t];
}
int n, m;
map<int, int> mapper[MAXN];
int main() {
	memset(head, 0xff, sizeof(head));
	scanf("%d%d", &n, &m);
	int idx = 1 + n;
	for(int i = 0; i < m; i++) {
		int p, q, c;
		scanf("%d%d%d", &p, &q, &c);
		if(mapper[p][c] == 0) mapper[p][c] = idx++;
		if(mapper[q][c] == 0) mapper[q][c] = idx++;
		add_edge(mapper[p][c], mapper[q][c], 0);
		add_edge(mapper[q][c], mapper[p][c], 0);
	}
	for(int i = 1; i <= n; i++) {
		for(auto itr = mapper[i].begin(); itr != mapper[i].end(); ++itr) {
			add_edge(i, itr->second, 1);
			add_edge(itr->second, i, 0);
		}
	}
	int ans = spfa(1, n);
	if(ans == 0x3f3f3f3f) ans = -1;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 42624
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Graph Partition
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200;
const int INF = 1 << 29;

/* typedef */

typedef queue<int> qi;

/* global variables */

char s[MAX_N + 4];
int ms[MAX_N][MAX_N], ps[MAX_N];

/* subroutines */

inline void setmin(int &a, int b) { if (a > b) a = b; }
inline void setmax(int &a, int b) { if (a < b) a = b; }

/* main */

int main() {
  int n;
  scanf("%d", &n);

  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    for (int j = 0; j < n; j++) ms[i][j] = (s[j] == '1') ? 1 : INF;
    ms[i][i] = 0;
  }

  memset(ps, -1, sizeof(ps));
  ps[0] = 0;
  qi q;
  q.push(0);

  while (! q.empty()) {
    int u = q.front(); q.pop();
    int pv = ps[u] ^ 1;

    for (int v = 0; v < n; v++)
      if (ms[u][v] == 1) {
	if (ps[v] < 0) {
	  ps[v] = pv;
	  q.push(v);
	}
	else if (ps[v] != pv) {
	  puts("-1");
	  return 0;
	}
      }
  }

  for (int k = 0; k < n; k++)
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
	setmin(ms[i][j], ms[i][k] + ms[k][j]);

  int maxd = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      setmax(maxd, ms[i][j]);

  printf("%d\n", maxd + 1);
  return 0;
}


Measured memory_bytes: 384
from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

h,w = mi()
a = [input() for i in range(h)]

print("#"*(w+2))

for i in range(h):
    print("#",end="")
    for j in range(w):
        print(a[i][j],end="")
    print("#")
print("#"*(w+2))

Measured memory_bytes: 4340
#include<ctime>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath> 
#include<cstring> 
#include<cassert>
#include<string>
#include<sstream>
#include<fstream>
#include<deque>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<set>
#include<bitset>
#include<iomanip>
#include<utility>
#include<functional>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cwchar>
#include<cwctype>
#include<exception>
#include<locale>
#include<numeric>
#include<new>
#include<stdexcept>
#include<limits>
using namespace std;

#define ll long long
#define INF 1e9
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
#define pii pair<int,int>


class BigInt
{
	public:
	int c;
	int a[100];
	BigInt()
	{
		c=1;
		memset(a,0,sizeof(a));
	}
	BigInt(int x)
	{
		if(!x)
		{
			c=1;
			memset(a,0,sizeof(a));
			return;
		}
		c=0;
		memset(a,0,sizeof(a));
		while(x!=0)
		{
			a[c++]=x%10000;
			x/=10000;
		}
	}
	BigInt operator+(const BigInt &b)const
	{
		BigInt result;
		result.c=max(c,b.c);
		for(int i=0;i<result.c;i++)
		{
			result.a[i]+=a[i]+b.a[i];
			result.a[i+1]=result.a[i]/10000;
			result.a[i]%=10000;
		}
		if(result.a[result.c]>0)
		{
			result.c++;
		}
		return result;
	}
	BigInt operator*(const BigInt &b)const
	{
		BigInt result;
		result.c=c+b.c;
		for(int i=0;i<c;i++)
		for(int j=0;j<b.c;j++)
		{
			result.a[i+j]+=a[i]*b.a[j];
		}
		int d=0;
		for(int i=0;i<result.c;i++)
		{
			result.a[i]+=d;
			d=result.a[i]/10000;
			result.a[i]%=10000;
		}
		if(d)result.a[result.c++]=d;
		while(result.a[result.c-1]==0)result.c--;
		return result;
	}
	BigInt operator-(const BigInt &b)const
	{
		BigInt result;
		result.c=max(c,b.c);
		for(int i=0;i<result.c;i++)
		{
			result.a[i]+=a[i]-b.a[i];
			if(result.a[i]<0)result.a[i+1]--,result.a[i]+=10000;
		}
		while(result.a[result.c-1]==0)result.c--;
		return result;
	}
	void print()const
	{
		printf("%d",a[c-1]);
		for(int i=c-2;i>=0;i--)
		{
			printf("%04d",a[i]);
		}
	}
};

const int maxn=100005;
int n,A,B;
ll l,r,sum;
int a[maxn];

bool check(ll cnt){
	ll k=cnt*B;
	ll need=0;
	rep(i,n){
		if(a[i]-k<0)continue;
		need+=(ll)(a[i]-k)/(ll)(A-B)+((ll)(a[i]-k)%(ll)(A-B)!=0);
	}
	return need<=cnt;
}

int main(){
	scanf("%d%d%d",&n,&A,&B);
	rep(i,n)scanf("%d",&a[i]),sum+=(ll)a[i];
	l=0;r=sum/B+1;
	while(r-l>1){
		ll mid=(l+r)>>1;
//		cout<<l<<" "<<r<<" "<<mid<<endl;
		if(check(mid))r=mid;
		else l=mid;
	}
	printf("%I64d",r);
	return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
using namespace std;
#define ll long long
int main()
{
    ll n,m;
    while(~scanf("%lld %lld",&n,&m))
    {
        if(n * 2 >= m)
        {
            printf("%lld\n",m/2);
        }
        else {
            printf("%lld\n",n + (m -  2 * n)/4);
        }
    }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
char a[200005];

int main() {
	scanf("%s",a+1);
	int len=strlen(a+1),ans=0;
	for(int i=1;i<=len;i++) {
		ans+=a[i]-'0';
		ans%=9;
	}
	if(ans==0) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 3912
n,k=map(int,input().split())
ans=[1]*n
for i in range(k):
    s=int(input())
    l=list(map(int,input().split()))
    for j in range(s):
        if ans[l[j]-1]==1:
            ans[l[j]-1]=0
print(sum(ans))
            
        
        


Measured memory_bytes: 9160
function Main(input) {
  input = input.split(' ')
  var N = parseInt(input[0])
  var D = parseInt(input[1])
  var i = 1

  while (N > (2 * D + 1) * i) {
    i++
  }

  console.log(i)
}

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



Measured memory_bytes: 21064
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
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;}

int main(){
	int n;
	string s;
	cin >> n >> s;
	
	int ans=0;
	for(int i=0; i<n-1; i++){
		int before[26]={};
		int after[26]={};
		REP(j,n){
			if(j <= i) before[(int)s[j]-(int)'a']=1;
			else after[(int)s[j]-(int)'a']=1;
		}
		
		int count = 0;
		REP(j,26) count += before[j]*after[j];
		chmax(ans, count); 
	}
	
	cout << ans << endl;
	
	
	
	
	return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int N, M;
  cin >> N >> M;
  vector<int> X(M);
  rep(i, M) cin >> X[i];
  if (N >= M) {
    cout << "0\n";
    return 0;
  }

  std::sort(X.begin(), X.end());
  vector<int> C(M-1);
  rep(i, M-1) {
    C[i] = X[i+1] - X[i];
  }
  std::sort(C.begin(), C.end());
  ull answer {};
  rep(i, M-N) {
    answer += C[i];
  }
  cout << answer << '\n';
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
	int a, b, c, k;
	cin>> a >> b >> c >> k;

	int MAX;
	MAX = max (a,max(b,c));
	int exa = a + b + c - MAX;

	for(int i = 0;i<k;i++){
		MAX *= 2;
	}

	
	cout<< exa + MAX <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
int main(){
	reg int n;reg ll sum=0;
	scanf("%d",&n);
	for(reg int i=1;i<=n;i++){
		if(i%3==0||i%5==0)continue;
		sum+=i;
	}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 3760
#include<cstdlib>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<cstring>
#include<cmath>
using namespace std;
const int MAXN = (int) 2e4 + 10;
const int INF = (int) 0x3f3f3f3f;
typedef long long LL;

int N;
char s[MAXN];
int st[MAXN],top;
vector<pair<int,int> > g;
vector<int> ANS;

void work(){
    scanf("%s",s);
    int len=strlen(s);
    top=0;
    g.clear();
    int ans=0;
    for(int i=0;i<len;i++){
        if(s[i]=='\\') st[++top]=i;
        else if(s[i]=='/'){
            if(top>0){
                int id=st[top--];
                ans+=i-id;
                g.push_back(make_pair(id,i));
            }
        }
    }
    for(int i=g.size()-1;i>=0;){
        int l=g[i].first;
        int r=g[i].second;
        int x=r-l;
        int j=i-1;
        while(j>=0&&g[j].first>=l&&g[j].second<=r){
            int L=g[j].first;
            int R=g[j].second;
            j--;
            x+=R-L;
        }
        i=j;
        ANS.push_back(x);
    }
    printf("%d\n",ans);
    printf("%d",ANS.size());
    for(int i=ANS.size()-1;i>=0;i--) printf(" %d",ANS[i]);
    printf("\n");
}

int main(){
#ifdef NNever
//    freopen("data.in","r",stdin);
//    freopen("out.txt","w",stdout);
#endif // NNever
    work();
    return 0;
}





Measured memory_bytes: 3400
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i];
    int cnt = 0;
    rep(i, n) {
        if ( i == n - 1 && p[i] == i + 1 ) {
            swap(p[i], p[i-1]);
            ++cnt;
        }
        if ( p[i] == i + 1 ) {
            swap(p[i], p[i+1]);
            ++cnt;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 640
using System;
using System.Linq;
using System.Collections.Generic;

class AOJ
{
    static void Main()
    {
        for (int i = 1; i <= 9; i++)
        {
            for (int j = 1; j <= 9; j++)
            {
                Console.WriteLine($"{i}x{j}={i * j}");
            }
        }
    }
}


Measured memory_bytes: 15876
#include <bits/stdc++.h>
using namespace std;
constexpr auto MOD = 1000000007;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;

string s;
long long n, m;

int main()
{
  cin >> n >> s;
  int cnt = 0;
  for (int i = 0; i < n - 2; i++)
  {
    if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
    {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Arrays;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayList<Integer> cont = new ArrayList<Integer>();
        HashMap<Integer, Integer> times = new HashMap<Integer, Integer>();
        // 意地悪で全く同じデータがある場合、arraylist<string>で重複を管理する必要あり

        String line;
        while (!(line = br.readLine()).equals("")) {
            String[] input = line.split(",");
            int company = Integer.parseInt(input[0]);
            // int day = Integer.parseInt(input[1]);

            if (!cont.contains(company)) {
                cont.add(company);
            }

            if (times.containsKey(company)) {
                times.put(company, times.get(company) + 1);
            } else {
                times.put(company, 1);
            }
        }

        ArrayList<Integer> ok = new ArrayList<Integer>();

        while ((line = br.readLine()) != null) {
            String[] input = line.split(",");
            int company = Integer.parseInt(input[0]);
            // int day = Integer.parseInt(input[1]);

            if (cont.contains(company)) {
                if (!ok.contains(company))
                    ok.add(company);
            }

            if (times.containsKey(company)) {
                times.put(company, times.get(company) + 1);
            }
        }

        Object[] companiesO = ok.toArray();
        int[] companies = new int[companiesO.length];
        for (int i = 0; i < companies.length; i++) {
            companies[i] = (int) companiesO[i];
        }
        Arrays.sort(companies);

        for (int i = 0; i < companies.length; i++) {
            System.out.println(companies[i] + " " + times.get(companies[i]));
        }
    }
}


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

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

  string answer = "Three";

  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;

    if (S == "Y") {
      answer = "Four";
      break;
    }
  }

  cout << answer << endl;
}


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

using namespace std; 

int main()
{
	string c;
	cin>>c;
	if(c[0]=='S')
		cout<<"Cloudy"<<endl;
	else if(c[0]=='C')
		cout<<"Rainy"<<endl;
	else if(c[0]=='R')
		cout<<"Sunny"<<endl;
	return 0;		
}




Measured memory_bytes: 256
s = input()



#ans = 'Yes' if\
#    s.count('a') == 1 and \
#    s.count('b') == 1 and \
#    s.count('c') == 1 else 'No'



abc = 'abc'
ans = 'Yes' if 3 == sum(1 if s.count(c)==1 else 0 for c in abc ) else 'No'

print( ans )

Measured memory_bytes: 2940
n, m = map(int, input().split())
ps = [input().split() for _ in range(m)]
all_ac = set(int(p) for p,s in ps if s=='AC')
ac = set()
pena_cnt = 0
ac_cnt = 0
for p,s in ps:
  p = int(p)
  if p in all_ac:
    if p not in ac:
      if s == 'WA':
        pena_cnt += 1
      else:
        ac_cnt += 1
        ac.add(p)
print(ac_cnt, pena_cnt)

Measured memory_bytes: 49416
#!/usr/bin/env python
# coding: utf-8

# In[11]:


A,B = map(int, input().split())


# In[12]:


for x in range(B*10,B*10+10):
    if x*0.08//1 == A:
        print(x)
        break
else:
    print(-1)


# In[ ]:






Measured memory_bytes: 2940
import java.util.*;
import java.awt.*;

public class Main {

  double total = 0;
  int count = 0;
  Point[] town;


  public Main(Point[] town){
    this.town = town;
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int townnum = Integer.parseInt(sc.next());
    Point[] town = new Point[townnum];
    int[] arr = new int[townnum];

    for(int i = 0; i < townnum; i++)
      arr[i] = i;

    for(int i = 0; i < townnum; i++){
      int x = Integer.parseInt(sc.next());
      int y = Integer.parseInt(sc.next());
      Point point = new Point(x, y);
      town[i] = point;
    }
    Main main = new Main(town);

    main.permute(arr);

    System.out.println(main.getTotal()/main.getCount());
  }

  // swap 2 elements of an array,
  void swap(int[] arr, int x, int y) {
      int temp = arr[x];
      arr[x] = arr[y];
      arr[y] = temp;
  }

  /**
   * print permutations of array
   * @param arr
   *            original int array,
   */
  void permute(int[] arr) {
      permute(arr, 0, arr.length - 1);
  }

  /**
   * print permutations of array
   *
   * @param arr
   *            original int array,
   * @param i
   *            start index
   * @param n
   *            end index
   */
  void permute(int[] arr, int i, int n) {
      int j;
      if (i == n){
          for(int k = 0; k < arr.length-1; k++){
            total += town[arr[k]].distance(town[arr[k+1]]);
          }
          count++;
      }
      else {
          for (j = i; j <= n; j++) {
              swap(arr, i, j);
              permute(arr, i + 1, n);
              swap(arr, i, j); // backtrack
          }
      }
  }

  public double getTotal(){
    return total;
  }

  public int getCount(){
    return count;
  }
}

Measured memory_bytes: 24276
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;

bool guu(string S){
 int N = sz(S);
  if(N%2 ==1) return false;
  rep(i,N/2){
	if(S[i]!=S[i+(N/2)]) return false;
  }
  return true;
}


int main() {
ll N;
  in(N);
  out((N-1)*N/2);
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  //N*Nマスのうち，Aマスを白で塗れば，黒で塗るのはN*N-Aマスになる．

  cout << N*N-A << endl;

  return 0;
}


Measured memory_bytes: 256
def solve(m, a) -> int:
    from bisect import bisect_left
    from itertools import accumulate

    *a, = sorted(a)
    n = len(a)

    acc = (0,) + tuple(accumulate(a))

    def is_ok(h):
        ret = 0
        for x in a:
            j = bisect_left(a, h - x)
            ret += (n - j)
            if ret >= m:
                return True
        return False

    def binary_search():
        """M通り以上の握手ができる幸福度の上限"""
        ok = 0
        ng = a[-1] * 2 + 1
        while abs(ng - ok) > 1:
            mid = (ok + ng) // 2
            if is_ok(mid):
                ok = mid
            else:
                ng = mid
        return ok

    sup = binary_search()  # 上限

    ret = 0
    rest = m
    for x in a:
        j = bisect_left(a, sup - x)
        # sup+1以上になるような握手を全て行った残りの握手回数restはすべてsupになるはず
        use = n - j
        rest -= use

        ret += use * x + (acc[n] - acc[n - use])

    ret += rest * sup

    return ret


def main():
    n, m = map(int, input().split())
    *a, = map(int, input().split())
    print(solve(m, a))


if __name__ == '__main__':
    main()

# k 回目の握手で、左手でゲスト xk と、右手でゲスト yk と手を握ったとする。
# このとき、 (xp,yp)=(xq,yq) を満たすような p,q(1≤p<q≤M) が存在しない。
#
# サンプル2の3,5は重複があるが、3a,3bとおくと
# (3a,v)と(3b,v)は値が等しい組なので、両方選べない
# よって、Aをset(A)に変換する必要がある
# と考えたが、それだとサンプルが合わない
#
# (3a,v)と(3b,v)を区別する場合の値を返すコードを提出してみる


Measured memory_bytes: 14636
import bisect
n, m = map(int, input().split())
arr = sorted(list(map(int, input().split())))
ope = []
d = []
for i in range(m):
    ope.append(list(map(int,input().split())))
ope = sorted(ope,key = lambda x:-x[1])
i = 0
ok = True
for b,c in ope:
    for rep in range(b):
        if i >= n or arr[i] > c:
            ok = False
            break
        arr[i] = c
        i += 1
    if ok:
        continue
    else:
        break
print(sum(arr))

Measured memory_bytes: 36840
#include <bits/stdc++.h>
//debug
#define vecprint(v) cout << "  vector: ";rep(i,v.size())cout << v[i] << " ";cout << endl;
#define setprint(s) cout << "  set: ";for(auto i=s.begin();i!=s.end();i++)cout << *i << " ";cout << endl;
#define mappairprint(s) cout << "  map: ";for(auto i=s.begin();i!=s.end();i++)cout << i->first << " " << i->second << endl;cout << endl;
//reader
#define r1(a) cin>>(a)
#define r2(a,b) cin>>(a)>>(b)
#define r3(a,b,c) cin>>(a)>>(b)>>(c)
//writer
#define w1(a) cout<<(a)<<" "
#define w2(a,b) cout<<(a)<<" "<<(b)<<" "
#define w3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "
#define wl1(a) cout<<(a)<<endl
#define wl2(a,b) cout<<(a)<<" "<<(b)<<endl
#define wl3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
//variable definition
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
//roop
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define all(c) c.begin(),c.end()
//term
#define elif else if
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
using namespace std;
using ll = long long;
//const
constexpr double PI = 3.141592653589793238462643383279;
vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};



int main() {
  //input
  int h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  
  int h = h2 - h1;
  int m = m2 - m1;
  if(m < 0) {
    m += 60;
    h--;
  }
  int ans = h * 60 + m - k;
  cout << ans << endl;
  
  
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
#include <regex>
#include <climits>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (n); (i)--)
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define forin(i, a) for(auto i: (a))
#define p(...) printf(__VA_ARGS__); cout << endl;
#define in(...) __VA_ARGS__; input__(__VA_ARGS__);
#define input(...) in(__VA_ARGS__)
#define out(...) output__(__VA_ARGS__);
#define output(...) out(__VA_ARGS__)
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](auto const &a, auto const &b){ return c ;}
#define key(t, x, compare) [](const t &a, const t &b){ return a x compare b x ;}
#define unless(a) if(!(a))

using namespace std;

using pii = pair<int, int>;

template <class... T>
void input__(T &...a) {
  for(auto v: {&a...}) {
    cin >> *v;
  }
}

void output__(){
  cout << endl;
}

template <class Head, class... T>
void output__(Head const &v, T const &...a) {
  if(sizeof...(a) == 0) {
    cout << v;
  } else {
    cout << v << " ";
  }
  output__(a...);
}

int main(){
  int in(n);
  string list_input(a, n);
  string MARCH = "MARCH";
  long long fields[MARCH.size()];
  memset(fields, 0, sizeof fields);

  forin(i, a) {
    switch(i[0]) {
      case 'M':
        fields[0]++;
        break;
      case 'A':
        fields[1]++;
        break;
      case 'R':
        fields[2]++;
        break;
      case 'C':
        fields[3]++;
        break;
      case 'H':
        fields[4]++;
        break;
      default:
        break;
    }
  }

  long long result = 0;
  int m = MARCH.size();
  FOR(i, 0, m) {
    FOR(j, i + 1, m) {
      FOR(k, j + 1, m) {
        result += fields[i] * fields[j] * fields[k];
      }
    }
  }
  out(result);
}


Measured memory_bytes: 6144
let readCharArray _ = stdin.ReadLine().ToCharArray()

let a = readCharArray ()
let b = readCharArray ()

let rec cmp a b =
    let aLen = a |> Array.length
    let bLen = b |> Array.length
    if aLen > bLen then
        "GREATER"
    elif aLen < bLen then
        "LESS"
    elif aLen = 0 then
        "EQUAL"
    else
        let x = a |> Array.head |> int
        let y = b |> Array.head |> int
        if x > y then "GREATER"
        elif x < y then "LESS"
        else cmp (a |> Array.tail) (b |> Array.tail)

cmp a b |> printfn "%s"


Measured memory_bytes: 29436
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, K;
    cin >> N >> K;

    ll ans = 0;

    if(K % 2 == 0) {
        ll x = N / K;
        if(N % K >= K / 2LL) {
            x++;
        }
        ans += x * x * x;
    }

    ll x = N / K;
    ans += x * x * x;

    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class C
{
	public static void Main()
	{
		int N = GetInt();
		long[] T = Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
		long[] A = Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();

		bool[] isKnown = new bool[N];
		long max = long.MinValue;
		for(int i = 0; i < N; i++)
		{
			if(T[i] > max)
			{
				max = T[i];
				isKnown[i] = true;
			}
		}

		max = long.MinValue;
		for(int i = N - 1; i >= 0; i--)
		{
			if(A[i] > max)
			{
				if(isKnown[i])
				{
					if(A[i] != T[i])
					{
						Console.WriteLine(0);
						return;
					}
				}
				else
				{
					if(A[i] > T[i])
					{
						Console.WriteLine(0);
						return;
					}
				}
	
				max = A[i];
				isKnown[i] = true;
			}
		}

		long ans = 1;
		for(int i = 0; i < N; i++)
		{
			if(isKnown[i])
				continue;

			ans = (ans * Math.Min(T[i], A[i])) % 1000000007;			
		}
		Console.WriteLine(ans);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n,q;
    cin>>n>>q;
    queue<pair<string,int>> que;
    REP(i,n){
        string a;
        int b;
        cin>>a>>b;
        que.push(make_pair(a,b));
    }

    ll t=0;
    while(!que.empty()){
        pair<string,int> p = que.front();
        que.pop();
        t += min(q, p.second);
        p.second = max(0, p.second-q);
        if(p.second>0) que.push(p);
        else cout<<p.first<<" "<<t<<endl;
    }
    //cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6340
import java.util.*;

public class Main {
	public static void main(String[] args) {

		Scanner keyboard = new Scanner(System.in);

		int N = keyboard.nextInt();
		String[] S = new String[N];
		
		for(int n=0; n<N; n++) {
			S[n] = keyboard.next();
		}
		Arrays.parallelSort(S);
		int ans = 0;
		
		for(int i =0; i<N; i++) {
			if(i == 0) {
				ans++;
			}else {
				if(!(S[i].equals(S[i-1]))) {
					ans++;
				}
			}
		}
		
		System.out.println(ans);
		keyboard.close();
	}
}


Measured memory_bytes: 70988
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
ll n, x, y, ans[200009], l[10009], r[10009];
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//    freopen("task2-test-input.txt", "r", stdin);
//    freopen("task2-test-output.txt", "w", stdout);
    cin>>n>>x>>y;
    for(int i=1;i<n;i++) {
        for(int j=i+1;j<=n;j++) {
            ll dist = j - i;
            ll dist2 = abs(x - i) + abs(y - j) + 1;
            dist = min(dist, dist2);
//            cout<<i<<" "<<j<<" "<<dist<<endl;
            ans[dist]++;
        }
    }
    for(int i=1;i<n;i++)
        cout<<ans[i]<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 2000000
#define MOD 1000000007

int main(){
  ll N,L;
  cin>>N>>L;
  vector<ll> a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  int k=-1;
  for(int i=0;i<N-1;i++){
    if(a.at(i)+a.at(i+1)>=L){
      k=i+1;
    }
  }
  if(k==-1){
    cout<<"Impossible"<<endl;
  }else{
    cout<<"Possible"<<endl;
    for(int i=1;i<k;i++){
      cout<<i<<endl;
    }
    for(int i=N-1;i>k;i--){
      cout<<i<<endl;
    }
    cout<<k<<endl;
  }
}


Measured memory_bytes: 1664
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
const double PI = acos(-1);

bool isprime[10001];
void MakePrime(int n) {
	isprime[2] = true;
	for (int i = 3; i < n; i += 2) {
		bool a = false;
		for (int j = 3; j <= std::sqrt(i); j += 2) {
			if (i%j == 0) {
				a = true;
			}
		}
		if (a == false) {
			isprime[i] = true;
		}
	}
}

int main() {
	int n;
	MakePrime(10000);
	while (cin >> n) {
		int ans = 0;
		for (int i = 2; i < n; i++) {
			if (isprime[i] && isprime[n + 1 - i])ans++;
		}
		cout << ans << endl;
	}
}

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

struct iostream_init_struct
{ 
	iostream_init_struct()
	{
		std::cin.tie(0);
		std::ios::sync_with_stdio(false);
	}
} iostream_init;

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

	int n = 0;
	while (true)
	{
		if (A % 2 == 1 ||
			B % 2 == 1 ||
			C % 2 == 1)
		{
			cout << n << endl;
			return 0;
		}

		if (A == B && B == C)
		{
			cout << -1 << endl;
			return 0;
		}

		int A_ = A;
		int B_ = B;
		int C_ = C;
		A = (B_ + C_) / 2;
		B = (C_ + A_) / 2;
		C = (A_ + B_) / 2;
		++n;
	}
}


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 ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N=200005;
int a[N],b[N];
set<ii> s;
void rekt()
{
  cout<<-1<<endl;
  exit(0);
}
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  int n;
  cin>>n;
  int cnt=0;
  rep(i,1,n+1) cin>>a[i];
  rep(i,1,n+1)
    {
      cin>>b[i];
      if(a[i]==b[i]) cnt++;
      else s.insert(mp(b[i],i));
    }
  b[n+1]=b[1];
  b[0]=b[n];
  ll ans=0;
  while(cnt!=n)
    {
      auto it=*s.rbegin();
      s.erase(it);
      int id=it.se;
      if(b[id]==a[id]) rekt();
      int sum=b[id-1]+b[id+1];
      int num=(b[id]-a[id])/sum;
      num=min(num,(b[id]-1)/sum);
      if(!num) rekt();
      ans+=num;
      b[id]-=num*sum;
      if(b[id]==a[id]) cnt++;
      else s.insert(mp(b[id],id));
      if(id==n) b[0]-=num*sum;
      if(id==1) b[n+1]-=num*sum;
    }
  cout<<ans<<endl;
  return 0 ;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
vector<int> d;
int mxd=0;
int ans=0;
int main(void)
{
  int N;
  cin >> N;
  for(int i=0;i<N;i++)
  {
    int dif;
    cin >> dif;
    d.push_back(dif);
    mxd=max(mxd,dif);
  }
  sort(d.begin(),d.end());
  for(int K=1;K<=mxd;K++)
  {
    int hard=lower_bound(d.begin(),d.end(),K)-d.begin();
    if(hard==N-hard) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 892
fn read_split<T : std::str::FromStr>() -> Vec<T> {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}

fn main() {
    let inputs : Vec<i64> = read_split();
    if inputs[1] - inputs[0] >= 2019{
        println!("0");
        return;
    }
    let xx = inputs[0] / 2019;
    let a = inputs[0] - (xx * 2019);
    let b = inputs[1] - (xx * 2019);
    let mut p = 2019;

    for i in a..b + 1 {
        for x in i + 1..b + 1 {
            let c = (i * x) % 2019;
            if p > c {
                p = c;
            }
        }
    }
    let result = p;

    println!("{}", result);
}



Measured memory_bytes: 4352
/*
    Author: Mohammad faisal
    Problem: Multiple of 2 and N.
    Date: 07/08/2019

*/
// #include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
using namespace std;
// long long gcd(long long a,long long b)
// {
//   if(b)
//     return gcd(b,a%b);
//   else
//     return a;
// }
// Author: Mohammad Faisal
// #include<bits/stdc++.h>
// using namespace std;
long long gcd(long long a,long long b)
{
  if(b)
    return gcd(b,a%b);
  else
    return a;
}
int main()
{
  long long n;
    cin >> n;
    long long g = gcd(n,2);
    cout<<(n*2)/g<<endl;
    return 0;
}

// int main()
// {
//   int n;
//   cin >> n;
//   int * arr = new int[n];
//   int sum=0;
//   for(int i=0;i<n;i++)
//   {
//     cin >> arr[i];
//     sum+=arr[i];
//   }
//   int max = *max_element(arr,arr+n);
//   int res = (2*sum)/n;
//   if(res < max)
//   {
//     cout<<max<<endl;
//   }
//   else
//   {
//   cout<<((2*sum)/n)+1<<endl;
//   }
//   return 0;

// }

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void a() {
	int d;
	cin >> d;
	if (d == 25)
		cout << "Christmas" << endl;
	else if (d == 24)
		cout << "Christmas Eve" << endl;
	else if (d == 23)
		cout << "Christmas Eve Eve" << endl;
	else if (d == 22)
		cout << "Christmas Eve Eve Eve" << endl;
}
int main()
{
	a();
}


Measured memory_bytes: 256
class AtCoder {
  // 入力系
  input=[];
  input_i=-1;
  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n){
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n){
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }
 
  // コンソール
  o(...a:any){
    console.log(...a);
  }
 
  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }
 
  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }
 
  // 自作
  gcd(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
}
const o = new AtCoder()
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line',(line:any)=> {
  o.input.push(...line.split(/[\s]/));
});

process.stdin.on('end', ()=> {
  let obj={}
  obj[o.s()] = 1;
  obj[o.s()] = 1;
  obj[o.s()] = 1;
  console.log(Object.keys(obj).length == 2 ? 'Yes' : 'No')
});


Measured memory_bytes: 7500