akhauriyash/Code-Regression huggingface dataset:
N=int(input())
A=[0]
B=map(int,input().split())
for i in B:
  A.append(i)
A.append(0)
A2=[]
total=0
for i in range(len(A)-1):
  A2.append(abs(A[i]-A[i+1]))
  total+=A2[i]
for i in range(N):
  i+=1
  print(total-A2[i-1]-A2[i]+abs(A[i-1]-A[i+1]))

Measured memory_bytes: 14048
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,h,w;

    cin >> n;
    cin >> h;
    cin >> w;

    cout << (n-h+1)*(n-w+1) << endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys
import math
from collections import Counter
import itertools
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

n,L=MI()
l=[0]*n
for i in range(1,n+1):
    l[i-1] = L+i-1
s=sum(l)

mini=999
target=0
for i in range(n):
    if mini > abs(s-(s-l[i])):
        mini =abs(s-(s-l[i]))
        target=l[i]

print(s-target)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <math.h>
#define uint unsigned long long
#define ll long long
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define ept 1e-9

using namespace std;
inline int read()
{
    int x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
    return x * f;
}
inline ll read1()
{
	ll x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}

int n;
int f(int x, int k)
{
	if(x % k == 0) return x / k;
	int t = x % k;
	return f(x - max(1, t / ((x / k) + 1)) * ((x / k) + 1), k);
}
int main()
{
	int ans = 0;
	n = read();
	while(n --)
	{
		int x = read();
		int k = read();
		ans ^= f(x, k);
	}
	printf("%s\n",ans == 0 ? "Aoki" : "Takahashi");
}


Measured memory_bytes: 384
n, p = map(int, input().split())

if n == 1:
    print(p)
else:
    m = int((p + 1) ** (1 / n))
    while m ** n > p:
        m -= 1
    for i in reversed(range(1, m + 1)):
        if p % (i ** n) == 0:
            print(i)
            break


Measured memory_bytes: 2940
#include <stdio.h>
#include <math.h>

int n;

int main() {
  scanf("%d", &n);
  double height[n];
  double cost[n];
  for (size_t i = 0; i < n; i++) {
    scanf("%lf", &height[i]);
  }
  cost[0] = 0;
  for (size_t i = 1; i < n; i++) {
    cost[i] = 1000000000;
  }
  for (size_t i = 0; i < n; i++) {
    if (i < n - 1) cost[i + 1] = fmin(cost[i] + fabs(height[i] - height[i + 1]), cost[i + 1]);
    if (i < n - 2) cost[i + 2] = fmin(cost[i] + fabs(height[i] - height[i + 2]), cost[i + 2]);
  }
  printf("%d", (int)cost[n - 1]);
  return 0;
}


Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)
#define  max(x,y) ((x)>(y)?(x):(y))
#define  min(x,y) ((x)>(y)?(y):(x))


int main()
{
	int n;
	cin >> n;
	if (n % 2 != 0) cout << n / 2; else cout << n / 2 - 1;
	
}
	




Measured memory_bytes: 256
//#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
ll num[200001],ni[200001]={},go[200001]={};
ll ruigo[30][200001];
vpll nigo;
int main(){
	int N;
	scan(N);
	rep(i,N){
		string S;
		scan(S);
		bool flag=0;
		int ten=-1;
		int keta=0;
		rep(j,S.size()){
			if(S[j]=='.'){
				flag=1;
				ten=j;
				break;
			}
		}
		if(flag){
			keta=(int)S.size()-ten-1;
			num[i]=stoll(S.substr(0,ten)+S.substr(ten+1));
		}
		else{
			keta=0;
			num[i]=stoll(S);
		}
		ll tmp=num[i];
		while(tmp%2==0){
			tmp/=2;
			ni[i]++;
		}
		while(tmp%5==0){
			tmp/=5;
			go[i]++;
		}
		ni[i]-=keta;
		go[i]-=keta;
		nigo.push_back({ni[i],go[i]});
	}
	sort(ALL(nigo));
	rep(k,30){
		rep(i,N){
			ruigo[k][i+1]=ruigo[k][i]+(nigo[i].second+10>=k);
		}
	}
	ll ans=0;
	rep(i,N){
		auto itr=lower_bound(nigo.begin(),nigo.end(),make_pair(-nigo[i].first,-INFl));
		int st=distance(nigo.begin(),itr);
		if(st<N){
			ll k=max(0LL,-nigo[i].second+10);
			ans+=ruigo[k][N]-ruigo[k][st];
		}
		debug(i,nigo[i].first,nigo[i].second,st);
		/*if(st<N){
			ll k=max(0LL,-nigo[i].second+10);
			debug(k,ruigo[k][N]-ruigo[k][st]);
		}*/
	}
	rep(i,N){
		if(min(nigo[i].first,nigo[i].second)>=0) ans--;
	}
	prin(ans/2);
	return 0;
}


Measured memory_bytes: 58020
#include <bits/stdc++.h>
#define pb push_back

using namespace std;

    string s;

    bool check(string s){
        int n = s.size() - 1;
        for(int i=0; i<s.size(); i++){
            if( s[i] != s[n] ){
                return false;
            }
            n--;
        }
        return true;
    }

int main(){

    cin >> s;

    int a = s.size() / 2;

    if( check(s) && check( s.substr(0, a) ) && check(s.substr(a+1, a)) ){
        cout << "Yes";
    }
    else{
        cout << "No";
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define BUF_SIZE 20

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

#define NUM_MAX 3

int main(void) {
    int n, queries;
    static char map[NUM_MAX];
    int i;
    memset(map, -1, NUM_MAX);
    get_int2(&n, &queries);
    int flag = 1;
    for(i = 0; i < queries; i++) {
        int pos, digit;
        get_int2(&pos, &digit);
        pos--;
        if(map[pos] != -1 && map[pos] != digit) { flag = 0; }
        map[pos] = digit;
    }
    if(map[0]==0) {
        if(n>1) flag = 0;
    }
    map[0] = (map[0] == -1) ? (n>1) : map[0];
    map[1] = (map[1] == -1) ? 0 : map[1];
    map[2] = (map[2] == -1) ? 0 : map[2];
    int ans = -1;
    if(flag) {
        int guess = 0;
        int d = 1;
        for(i = n-1; i >= 0; i--) {
            guess += map[i]*d;
            d *= 10;
        }
        ans = guess;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
(* O(n) *)
let n = Scanf.scanf " %d" @@ (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let p = ref @@ -1
let xys = ref []
let _ =
  Array.sort (-) a_s;
  let i = ref 0 in while !p < 0 && !i < n do if a_s.(!i) >= 0 then p := !i; incr i done;
  if !p = -1 then p := n - 1
  else if !p = 0 then p := 1;
  for i = !p to n - 2 do
    xys := (a_s.(0), a_s.(i)) :: !xys;
    a_s.(0) <- a_s.(0) - a_s.(i)
  done;
  for i = 0 to !p - 1 do
    xys := (a_s.(n - 1), a_s.(i)) :: !xys;
    a_s.(n - 1) <- a_s.(n - 1) - a_s.(i)
  done;
  Printf.printf "%d\n" a_s.(n - 1);
  List.rev !xys |> List.iter @@ fun (x, y) -> Printf.printf "%d %d\n" x y

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

int main(){
  int H, W;
  cin >> H >> W;
  vector<vector<char>> vec(H,vector<char>(W));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> vec.at(i).at(j);
    }
  }
  
  vector<int> H_blanc(0);
  vector<int> W_blanc(0);
  for(int k=0; k<H; k++){
    int cH = 0;
    for(int l=0; l<W; l++){
      if(vec.at(k).at(l) == '.'){
        cH++;
      }
    }
    if(cH == W){
      H_blanc.push_back(k);
    }
  }
  
  for(int m=0; m<W; m++){
    int cW = 0;
    for(int n=0; n<H; n++){
      if(vec.at(n).at(m) == '.'){
        cW++;
      }
    }
    if(cW == H){
      W_blanc.push_back(m);
    }
  }
  
   int a = 0;
  
  for(int x=0; x<H; x++){
    if(H_blanc.size() != 0){
      if(x == H_blanc.at(a)){
        if(a < H_blanc.size()-1){
         a++;
        }
        continue;
      }
    }
    int b = 0;
    int y = 0;
   while(y<W){
      if(W_blanc.size() != 0){
        if(y == W_blanc.at(b)){
        y++;
         if(b < W_blanc.size()-1){
         b++;
         }
         continue;
        }
       }
      
    cout << vec.at(x).at(y);
    y++;
    }
    cout << endl;
  }
  
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int start_zero = 0, start_one = 0;

		// starts with zero
		for(int i = 0; i < S.length(); i++) {
			if(i % 2 == 0) {
				start_zero += (S.charAt(i) == '0') ? 0 : 1;
			}
			else {
				start_zero += (S.charAt(i) == '1') ? 0 : 1;
			}
		}

		// starts with one
		for(int i = 0; i < S.length(); i++) {
			if(i % 2 == 0) {
				start_one += (S.charAt(i) == '1') ? 0 : 1;
			}
			else {
				start_one += (S.charAt(i) == '0') ? 0 : 1;
			}
		}

		System.out.println(Math.min(start_one, start_zero));
	}
}

Measured memory_bytes: 25556
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //d
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> in;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    in.emplace_back(a, b);
  }
  sort(in.begin(), in.end());
  priority_queue<int> que;
  long long ans = 0;
  int j = 0;
  for (int i = 1; i <= m; i++) {
    while (j < n && in[j].first <= i) {
      que.push(in[j].second);
      j++;
    }
    if (que.empty()) continue;
    ans += que.top();
    //cerr << i << " " << que.top() << endl;
    que.pop();
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1908
N,x = (int(i) for i in input().split())
a = [int(i) for i in input().split()]

a.sort()

count = 0
for i in range(N):
    x = x - a[i]
    if x >= 0:
        count += 1
    if i == N -1 and x > 0:
        count -= 1
    
print(count)

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

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

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

#define fastio                  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define input_output            freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 

#define ll                      long long
#define read1(x)                 cin>>x
#define read2(x,y)               cin>>x>>y
#define print(x)				cout<<x<<endl
#define pii                     pair<int, int>
#define pli                     pair<ll, int>
#define pil                     pair<int, ll>
#define pll                     pair<ll, ll>
#define vi                      vector<int>
#define vll                     vector<ll>
#define vb                      vector<bool>
#define vd                      vector<double>
#define vs                      vector<string>
#define ff                      first
#define ss                      second
#define pb                      push_back
#define ppb                     pop_back
#define pf                      push_front
#define ppf                     pop_front
#define vpii                    vector<pii>
#define umap                    unordered_map
#define uset                    unordered_set
#define clr(a,b)                memset(a,b,sizeof a)
#define all(ds)                 ds.begin(), ds.end()
#define rev(ds)                 ds.rbegin(), ds.rend()
#define asc(A)                  sort(A.begin(), A.end())
#define dsc(A)                  sort(A.begin(), A.end(), greater<int>())
#define gcd(x,y)                __gcd(x,y)
#define clr(a,b)                memset(a,b,sizeof a)
#define fr(i, n)                for(int i=0; i<n;++i)
#define fr1(i, n)               for(int i=1; i<=n; ++i)
#define rfr(i, n)               for(int i=n-1; i>=0; --i)
#define printVector(v)          for(int i= 0;i<v.size();i++) {cout<<v[i]<<" ";} cout<<endl;
#define precise(x)              cout<<fixed<<setprecision(x)
#define inf                     10000000000000

 

ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }
ll power(ll x, ll y, ll m) { if(!y) return 1; ll p=power(x, y>>1, m)%m; p=p*p%m; return (y&1)?(x*p)%m:p;}
ll modInverse(ll a, ll m){ return power(a, m-2, m); }
bool isPrime(ll num){bool flag=true;for(ll i =2;i<=num/2;i++){if(num%i==0) {flag=false; break;} }return flag;}
ll sumofdigits(ll n){ll c=0;while(n>0){c++;n/=10;}return c;}
bool sortinrev(const pair<int,int>&a,const pair<int,int>&b) {return a.first > b.first; }
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) {return a.second < b.second; }

//const double PI= 2*acos(0.0);
const long long MOD= 1000000007;


void solve(){
    
    int n; cin>>n;
    vi v(n);
    fr(i, n)cin>>v[i];
    dsc(v);
    ll ans = 0;
    ans += v[0];
    n-=2;
    int i = 1;
    while(n){
        ans += v[i];
        if(n == 1)break;
        ans += v[i];
        n -= 2;
        i++;
    }
    print(ans);
}
int main()
{
#ifndef ONLINE_JUDGE  
    input_output  
#else   
    fastio
#endif

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

    return 0;
}

Measured memory_bytes: 3976
#include <stdio.h>

int main(void) {

	int i = 0;
	int x = 0;
	int y = 0;

	do{
		scanf("%d",&x);
		scanf("%d",&y);
		
		if( x > y){
			i = x ;
			x = y ;
			y = i ;
		}
		
		if(x || y){
			printf("%d %d\n", x, y);
                }
	}while(x || y);

	return 0;
}

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved

int main(){
    long long a,v,b,w;
    cin>>a>>v>>b>>w;
    long long t;
    cin>>t;
    
    if(v<=w ){
        cout<<"NO\n";
        return 0;
    }
    
    else if(abs(b-a)<=(v-w)*t){
        cout<<"YES\n";
    }
    else{
        cout<<"NO"<<endl;
    }
    return 0;

}
/*
1 3
3 2
3

*/


Measured memory_bytes: 3624
#include <cstdio>
#include <algorithm>

typedef long long LL;
const int Mod = 1000000007;
const int MN = 5005;

inline int qPow(int b, int e) {
	int a = 1;
	for (; e; e >>= 1, b = (LL)b * b % Mod)
		if (e & 1) a = (LL)a * b % Mod;
	return a;
}

int N, A, B;
int f1[MN], f2[MN], f3[MN], f4[MN];
int g1[MN], g2[MN];

int main() {
	scanf("%d%d%d", &N, &A, &B);
	if (A > B) std::swap(A, B);
	if (A == 1) return printf("%d\n", qPow(2, N)), 0;
	f1[1] = 1;
	for (int i = 2; i < B; ++i) {
		f1[i] = 1;
		for (int j = 1; j <= i - 1; ++j)
			f1[i] = (f1[i] + f2[i - j]) % Mod;
		for (int j = A; j <= i - 1; ++j)
			f2[i] = (f2[i] + f1[i - j]) % Mod;
		for (int j = 1; j <= i - 1; ++j)
			f3[i] = (f3[i] + f4[i - j]) % Mod;
		if (i >= A) f4[i] = 1;
		for (int j = A; j <= i - 1; ++j)
			f4[i] = (f4[i] + f3[i - j]) % Mod;
	}
//	for (int i = 1; i < B; ++i) printf("(f1, f2, f3, f4)[%d] = (%d, %d, %d, %d)\n", i, f1[i], f2[i], f3[i], f4[i]);
	for (int i = 1; i <= N; ++i) {
		if (i < B) g1[i] = (f1[i] + f3[i]) % Mod;
		for (int j = 1; j < B && j <= i - 1; ++j)
			g1[i] = (g1[i] + (LL)g2[i - j] * f1[j]) % Mod;
		if (i < A) g2[i] = 1;
		for (int j = 1; j < A && j <= i - 1; ++j)
			g2[i] = (g2[i] + g1[i - j]) % Mod;
//		printf("(g1, g2)[%d] = (%d, %d)\n", i, g1[i], g2[i]);
	}
	int Ans = (g1[N] + g2[N]) % Mod;
	for (int j = 1; j <= N - 1; ++j)
		Ans = (Ans + (LL)g2[N - j] * f2[j]) % Mod;
	printf("%d\n", (qPow(2, N) - Ans + Mod) % Mod);
	return 0;
}

Measured memory_bytes: 1824
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>

using namespace std;

#define ALL(g) (g).begin(), (g).end()
#define REP(i, x, n) for (int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define F(i, j, k) fill(i[0], i[0] + j * j, k)
#define P(p) cout << (p) << endl;
#define EXIST(s, e) ((s).find(e) != (s).end())
#define INF 1 << 25
#define pb push_back

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;

int main() {
  int n;
  cin >> n;
  vi a;
  rep(i, n) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  int count = 0;
  rep(i, n) {
    for (int j = n - 1; j > i; j--) {
      if (a[j] < a[j - 1]) {
        swap(a[j], a[j - 1]);
        count++;
      }
    }
  }
  rep(i, n - 1) cout << a[i] << " ";
  cout << a[n - 1] << endl;
  cout << count << endl;
	return 0;
}


Measured memory_bytes: 1216
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using namespace std;



int main(){
    string S;
    char A[26] = {0};
    cin >> S;

    for(int i = 0; i < S.length(); i++){
        A[S[i]-'a']++;
    }
    for(int i = 0; i < 26; i++){
        if(A[i] == 0){
            printf("%c",i+'a');
            return 0;
        }
    }

    puts("None");
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;

typedef long long lli;

lli toSec(lli h, lli m, lli s) {
  return h * 3600LL + m * 60LL + s;
}

vector<lli> toHMS(lli s) {
  vector<lli> v(3);
  v[0] = s / 3600LL;
  s %= 3600LL;
  v[1] = s / 60;
  s %= 60;
  v[2] = s;
  return v;
}

void show(const vector<lli> &v) {
  printf("%02lld:%02lld:%02lld\n", v[0], v[1], v[2]);
}

int main() {
  lli h, m, s;
  while(cin >> h >> m >> s) {
    if(h == -1 && m == -1 && s == -1) break;
    lli sec = toSec(h,m,s);
    lli remain = toSec(0,120,0) - sec;
    vector<lli> a = toHMS(remain);
    vector<lli> b = toHMS(remain*3);
    show(a);
    show(b);
  }
  return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main()
{
    int n;cin>>n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    int ans=0;
    a.push_back(-1);
    for (int i = 0; i < n; i++)
    {
        int tmp=1;
        while(a[i]==a[i+1]){
            tmp++;
            i++;
        }
        ans+=tmp/2;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n,l[maxn], r[maxn], a[maxn];

int gcd(int a, int b) {
//	if(b == 1)
//		return a;
//	return gcd(b, a % b);
	return __gcd(a, b);
}

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	l[0] = a[1];
	r[n + 1] = a[n];
	for(int i = 1; i <= n; i++)
		l[i] = gcd(l[i - 1], a[i]);
	
	for(int i = n; i >= 1; i--) {
		r[i] = gcd(r[i + 1], a[i]);
	}
	int ans = 0;
	for(int i = 2; i < n; i++) {
		ans = max(ans, gcd(l[i - 1], r[i + 1]));
	}
	ans = max(ans, r[2]);
	ans = max(ans, l[n - 1]);
	cout << ans;
}

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

int main(){
    int n; cin >> n;
    string s,t;
    cin >> s >> t;
    string ans = "";
    for( int i = 0; i < n; i++ ){
        ans += s [ i ];
        ans += t [ i ];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv
mod = 998244353
K, N = map(int, input().split())
comb = Combination(10000, mod=mod)
def C(n, r):
    if n<r or r<0:
        return 0
    else:
        return comb(n, r)
def H(n, r):
    return C(n+r-1, r)
L = []
for i in range(2, 2*K+1, 2):
    ans = 0
    M = i//2
    b = 1
    for j, a in enumerate(range(M, K)):
        if M-j<0:
            break
        ans += pow(2, M-j, mod) * C(M, j) * H(K-a, N) * b
        #print((j, a), C(M, j) , H(N, K-a), b, pow(2, M-j, mod) * C(M, j) * H(K-a, N) * b)
        ans %= mod
        b = -b
    print(ans)
    if i == K+1:
        break
    elif i == K:
        print(ans)
        print(ans)
        break
    L.append(ans)
    print(ans)
    L.append(ans)

print(*L[::-1], sep="\n")


Measured memory_bytes: 4572
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
int main(){
	int n;
	scanf("%d",&n);
	unsigned long long sum=0;
	unsigned long long nex=0;
	int an[n+1]={0};
	int bn[n]={0};
	
	rep(i,n+1){
		scanf("%d",&an[i]);
	}
	rep(m,n){
		scanf("%d",&bn[m]);
	}
	rep(k,n){
		//printf("%d %d %d\n",an[k],bn[k],next);
		if(an[k]>=nex){
			an[k]-=nex;
			sum+=nex;
			//cout<<next<<endl;
			if(an[k]>=bn[k]){
				sum+=bn[k];
				nex=0;
			}else if(an[k]<bn[k]){
				sum+=an[k];
				nex=(bn[k]-an[k]);
			}
		}else{
			sum+=an[k];
			nex=bn[k];
		}
	}
	if(an[n]>=nex){
		sum+=nex;
	}else{
		sum+=an[n];
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
int N,a[300000];
long long lr[2][100001],s;
main(){
	scanf("%d",&N);
	for(int i=0;i<3*N;++i)scanf("%d",a+i);
	for(int j=0;j<2;++j){
		for(int i=0;i<3*N;++i)a[i]*=-1;
		std::priority_queue<long long>p;
		s=0;
		for(int i=0;i<N;++i){
			p.push(a[i]);
			s+=a[i];
		}
		lr[j][0]=s;
		for(int i=N;i<2*N;++i){
			p.push(a[i]);
			s+=a[i];
			lr[j][i+1-N]=s-=p.top();
			p.pop();
		}
		std::reverse(a,a+3*N);
	}
	long long x=-1e15;
	for(int i=0;i<=N;++i){
		x=std::max(x,-lr[0][i]-lr[1][N-i]);
	}
	printf("%lld\n",x);
}


Measured memory_bytes: 4840
//============================================================================
// Name        : abcd.cpp
// Author      : aaaa
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

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

int main() {
	int h = 0, w = 0, ans = 0, ansh = 0, answ = 0, e = 1, m = 100000, i, j,
			base;
	while (e != 0) {
		ans = 40000;
		ansh = 0;
		answ = 0;
		scanf("%d%d", &h, &w);
		if (h == 0 && w == 0) {
			break;
		}
		base = h * h + w * w;
		for (i = 150; i >= 1; i--) {
			for (j = 150; j >= 1; j--) {
				if (base < i * i + j * j) {
					if (i < j) {
						if (i * i + j * j <= ans) {
							ans = i * i + j * j;
							ansh = i;
							answ = j;
						}
					}
				}
				if (i < j) {
					if (i * i + j * j == base) {
						if (i > h) {
							ans = i * i + j * j;
							ansh = i;
							answ = j;
						}
					}
				}
			}
		}
		printf("%d %d\n", ansh, answ);
	}
	return 0;
}

Measured memory_bytes: 2720
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false)
#define ll long long
#define pi pair<ll,ll>
ll a[800001],  b[500009], lastcall[800000], value[500000];
string s;
vector<ll>v;
map<ll, ll>mp;
int main()
{
    IO;
    ll j=1, n, m, k, kk=1, m1=0, a1=8, grtr=0, a2=20, l, t, ds,r,mx=0, cnt=0, mn=INT_MAX, h=0, mod=1e9+7, i; char ch;
    cin>>n;
    for(i=1; i<=n; i++) {
            cin>>a[i]; cnt^=a[i];
    }

    for(i=1; i<=n; i++){
        cout<<(cnt^a[i])<<' ';
    }
    return 0;
}


Measured memory_bytes: 5096
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int c = 0;
        for (int i = 0 ; i < 100 ; i++) {
            if (n > 0) {
                c++;
                n /= k;
            }
        }
        System.out.println(c);
    }

}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cassert>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

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

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

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

  int a, b, t; cin >> a >> b >> t;
  cout << t/a*b << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            String inputString = br.readLine();

            String isContainNine = "No";
            if (inputString.charAt(0) == '9' || inputString.charAt(1) == '9') {
                isContainNine = "Yes";
            }

            System.out.println(isContainNine);

        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)

typedef long long ll;

void Main()
{
	int N; cin >> N;
	int cnt = 0;
	rep(i,N) {
		int n;
		cin >> n;
		if (n != (i + 1)) {
			++cnt;
		}
	}
	cout << (cnt == 0 || cnt == 2 ? "YES" : "NO") << endl;
}

int main()
{
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	Main();
}


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

#ifdef _MSC_VER
#include <agents.h>
#endif

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define X first
#define Y second

using namespace std;

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

P m[1010];
map<int, int> ans;
int dx[] = { 0, 1, 0, -1, -1, -1, 1, 1 };
int dy[] = { 1, 0, -1, 0, 1, -1, 1, -1 };

vector<string> v;

int n;
void dfs(int x, int y){
	m[y].first = min(m[y].first, x);
	m[y].second = max(m[y].second, x);
	v[y][x] = '.';
	rep(i, 8){
		int nx = x + dx[i], ny = y + dy[i];
		if (ny < 0 || ny >= n || nx < 0 || nx >= v[ny].size()) continue;
		if (v[ny][nx] != '*') continue;
		dfs(nx, ny);
	}
}

int main(){
	bool f = true;
	while (cin >> n, n){
		if (!f) cout << "----------" << endl;
		f = false;
		v.clear();
		ans.clear();

		v.resize(n);
		cin.ignore();
		rep(i, n) getline(cin, v[i]);
		rep(i, n) rep(j, v[i].size()){
			if (v[i][j] == '*'){
				rep(k, n) m[k].first = 100, m[k].second = -1;
				dfs(j, i);
				int s = 0;
				rep(k, n) s += max(0, m[k].second - m[k].first + 1);
				++ans[s];
			}
		}
		for (auto &e : ans){
			cout << e.first << " " << e.second << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1272
#include<bits/stdc++.h>
#define fast_io ios_base::sync_with_stdio(NULL); cin.tie(NULL);
#define endl '\n'
using namespace std;


int main(){
        fast_io
        map<string,string> m;
        m["Sunny"]="Cloudy";
        m["Cloudy"]="Rainy";
        m["Rainy"]="Sunny";
        
        string s; cin>>s;
        cout<<m[s]<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

int main(){
    while(true){
        int h,w;
        cin >> h >> w;
        if(h==0 && w==0){
            break;
        }
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;

    }
    return 0;
}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
#define sz(x) ((int)x.size())
#define pb push_back
#define ii pair<int,int>
#define ppb pop_back
#define orta ((bas+son)>>1)
#define st first
#define nd second
#define ll long long
#define N 1000005
#define inf 100000005
#define MOD 998244353 
#define LOG 25
#define EPS 0.000000001
#define M 305
using namespace std;

int n;
int a[N];
int f[N];
string s;

int solve() {

	int x=0;
	for(int i=0;i<n;i++) {
		if(!(f[n-1]-f[i]-f[n-1-i]))
			x^=a[i];
	}
	return x;

}

int cnt(int x) {

	int z=0;
	while(x%2==0)
		x/=2,
		z++;
	return z;

}

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

	cin>>n;
	cin>>s;
	if(n==1) {
		cout<<s;
		return 0;
	}
	for(int i=0;i<n;i++)
		a[i]=s[i]-'0';
	for(int i=0;i<n;i++)
		a[i]=abs(a[i+1]-a[i]);
	n--;
	bool one=0;
	for(int i=0;i<n;i++) {
		if(a[i]==1)
			one=1;
	}
	f[0]=0;
	for(int i=1;i<n;i++)
		f[i]=f[i-1]+cnt(i);
	if(one) {
		cout<<solve()%2;	
	} else {
		cout<<solve();
	}

}

Measured memory_bytes: 9116
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
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 ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,x,t;cin >> n >> x >> t;
    cout << (n+x-1)/x*t << endl;
}


Measured memory_bytes: 3632
#include<stdio.h>

#define INFTY 2000000000
#define MAX 500000

int n,count=0;

void merge(int A[],int n,int left, int mid,int right)
{
	int n1=mid-left;
	int n2=right-mid;
	int L[MAX/2+2],R[MAX/2+2];
	int i,j;
	
	for(i=0;i<n1;i++)
	{
		L[i]=A[left+i];
	}
	
	for(i=0;i<n2;i++)
	{
		R[i]=A[mid+i];
	}
	
	L[n1]=INFTY;
	R[n2]=INFTY;
	
	i=0;
	j=0;
	
	for(int k=left;k<right;k++)
	{
		count++;
		if(L[i]<=R[j])
		{
			A[k]=L[i];
			i=i+1;
		}
		else
		{
			A[k]=R[j];
			j=j+1;
		}
	}
}

void mergeSort(int A[],int n,int left, int right)
{
	if(left+1<right)
	{
		int mid=(left+right)/2;
		mergeSort(A,n,left,mid);
		mergeSort(A,n,mid,right);
		merge(A,n,left,mid,right);
	}
}

int main(void)
{
	int i;
	
	scanf("%d",&n);
	
	int S[n];
	
	for(i=0;i<n;i++)
	{
		scanf("%d",&S[i]);
	}
	
	int left=0,right=n;
	
	mergeSort(S,n,left,right);
	
	for(i=0;i<n;i++)
	{
		printf("%d",S[i]);
		if(i!=n-1)
		{
			printf(" ");
		}
	}
	
	printf("\n");
	printf("%d\n",count);
}


Measured memory_bytes: 5612
#include <stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define INF ((1LL<<62)-(1LL<<31))
#define min(p,q)((p)<(q)?(p):(q))

ll a[310][310];
ll d[310];//deleted flag
ll ans=INF;
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	rep(i,0,n)rep(j,0,m)scanf("%lld",&a[i][j]);
	rep(xxx,0,m){
		ll cnt[310]={};
		rep(i,0,n){
			rep(j,0,m)if(!d[a[i][j]]){
				cnt[a[i][j]]++;
				break;
			}
		}
		ll M=0,Mi;
		rep(i,1,m+1)if(M<cnt[i]){
			M=cnt[i];
			Mi=i;
		}
		ans=min(ans,M);
		d[Mi]=1;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 896
import java.util.Scanner;

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

        int n = sc.nextInt();

        int inputNum = sc.nextInt();
        int min = inputNum, max = inputNum;
        long sum = inputNum;

        for(int i = 0; i < n - 1; i++){
            inputNum = sc.nextInt();
            if(inputNum < min)
                min = inputNum;
            if(inputNum > max)
                max = inputNum;
            sum += (long)inputNum;
        }
        System.out.println(min + " " + max + " " + sum);
    }
}



Measured memory_bytes: 41148
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    N, M = read_values()
    H = read_list()

    F = [True] * N
    for _ in range(M):
        A, B = read_index()
        if H[A] >= H[B]:
            F[B] = False
        if H[A] <= H[B]:
            F[A] = False

    print(F.count(True))


if __name__ == "__main__":
    main()


Measured memory_bytes: 21864
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc161/abc161_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, M;
  cin >> N >> M;

  vector<int> c(N);
  rep(i, N) { cin >> c[i]; }

  double tot = 0;
  rep(i, N) { tot += c[i]; }
  sort(c.begin(), c.end(), greater<int>());

  int ret = 0;
  double th = (tot / (4 * M));
  rep(i, N) {
    if (c[i] >= th) ret++;
  }

  cout << (ret >= M ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf (1ll << 62)
using namespace std;
const int maxn = 1e5+5;
typedef long long ll;
ll memo[105][maxn];
int N,W;
int w[maxn],v[maxn];
ll solve(int pos,int remw){
    if (pos == N+1&& remw <=W)return 0;
    if (pos == N+1|| remw > W)return -inf;
    ll &ans = memo[pos][remw];
    if (ans != -1)return ans;
    ans = solve(pos+1,remw+w[pos])+v[pos];
    ans = max(ans,solve(pos+1,remw));
    return ans;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen(".in","r",stdin);
    cin >> N >> W;
    for (int i = 1; i <= N;i++){
        cin >> w[i] >> v[i];
    }
    memset(memo,-1,sizeof memo);
    cout << solve(1,0);
    return 0;
}


Measured memory_bytes: 82304
N = int(input())


def SieveofEratosthenes(N):
    prime = [2]
    limit = int(N**0.5)
    data = [i + 1 for i in range(2, N, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


primeList = SieveofEratosthenes(55555)
primeList = [p for p in primeList if p % 5 == 1]
ans = str(primeList[0])
for i in range(1, N):
    ans = ans + ' ' + str(primeList[i])
print(ans)

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;


bool ff(string s) {
    string buf=s;
    reverse(buf.begin(), buf.end());
    return buf==s;
}

string s;
int n;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    
    cin>>s;
    n=s.length();
    if (ff(s) && ff(s.substr(0,n/2)) && ff(s.substr(n-n/2))) out("Yes");
    out("No");
  

    return 0;
}


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

#ifdef DEBUG
    #include "debug.h"
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//////////////////

#define int long long
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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 (a>b) { a=b; return 1; } return 0; }

/*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)


void solve(){
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    int ans = 0;
    rep(i,N)for(int j=i+1;j<N; j++)for(int k=j+1;k<N; k++){
        if(a[i]==a[j] || a[j]==a[k] || a[i]==a[k]) continue;
        if(abs(a[i]-a[j]) < a[k] && a[k] < a[i]+a[j]){
            ans++;
        }
    }
    cout << ans << endl;
    
}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 3632
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a, b, c, i, count = 0;
    scanf("%d %d %d", &a, &b, &c);
    for(i = a; i <= b; i++){
        if(c % i == 0){
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
int main(){
	int m1,d1;
  	int m2,d2;
	cin>>m1>>d1>>m2>>d2;
  	if(d2==1){
    	cout<<'1'<<endl;
    }
  	else{
    cout<<'0'<<endl;
    }
}

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

int main(void)
{
	// 頂点数と辺数
	int N;
	cin >> N;

	Graph G(N + 1);
	for (int i = 1; i <= N; i++)
	{
		int u, k, v;
		cin >> u >> k;
		for (int i = 0; i < k; i++)
		{
			cin >> v;
			G[u].push_back(v);
		}
	}

	// BFSのためのデータ構造
	vector<int> dist(N + 1, -1); // 全頂点を未訪問に初期化
	queue<int> que;

	// 初期条件
	dist[1] = 0;
	que.push(1); // 0を橙色頂点に

	// BFS開始
	while (!que.empty())
	{
		int v = que.front();
		que.pop();

		// vから辿れる頂点をすべて探索
		for (int nv : G[v])
		{
			if (dist[nv] != -1) continue; // 発見済みの頂点は探索しない

			//　新たな白色頂点 nv について距離情報を更新しキューに追加
			dist[nv] = dist[v] + 1;
			que.push(nv);
		}
	}

	// 結果出力 (各頂点の頂点 0 からの距離を見る)
	for (int v = 1; v <= N; ++v) cout << v << " " << dist[v] << endl;
}


Measured memory_bytes: 3172
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;

typedef long long ll;

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

	for (int i = 0; i < N; i++) {
		if (A[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}

	ll res = 1;
	for (int i = 0; i < N; i++) {
		if (1000000000000000000 / res >= A[i]) {
			res *= A[i];
		}
		else {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 4416
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ist insert
#define vec vector <int>
#define vecc vector <char>
#define vecs vector <string>
#define vecl vector <ll int>
#define vecp vector <pair<int,int>>
#define vecpl vector <pair<ll int,ll int>>
#define ub upper_bound
#define lb lower_bound
#define bs binary_search
#define bg begin()
#define en end()
#define el endl
#define ff first
#define ss second
#define fr(i,n) for(int i=0;i<n;i++)
#define rp(i,a,b) for(int i=a;i<b;i++)
#define rr(i,a,b) for(int i=a;i>=b;i--)
#define ft(x) for(auto it : x)
#define wl while
#define sz size()
#define mapi map<int,int>
#define mapl map<ll int,ll int>
#define mapc map<char,ll int>
#define maps map<string,ll int>
#define mapss map<string,string>
#define scni(x) scanf("%d",&x)
#define scns(x) scanf("%s",x)
#define scnc(x) scanf("%c",&x)
#define pti(x) printf("%d",x)
#define pts(x) printf("%s",x)
#define ptc(x) printf("%c",x)
#define test(t) int t;cin>>t;while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
const int mod=1e9+7;
const int mex=1e6+1;
ll power(ll a,ll b)
{
    ll ans=1,temp=a;
    while(b!=0)
    {
        if(b&1)
        ans=ans*temp;
        ans=ans%mod;
        temp=temp*temp;
        temp=temp%mod;
        b/=2;
    }
    return ans;
}
int spf[mex];
void seive()
{
    int p[mex];
    for(int i=0;i<mex;i++) p[i]=1;
    p[0]=0;
    p[1]=0;
    for(int i=2;i*i<mex;i++)
    {
        if(p[i])
        for(int j=i*i;j<mex;j+=i)
        p[j]=0;
    }
    
}
ll int x1,x2,d1;
void exeu(ll int a1,ll int b1)
{
    if(b1==0)
    {
        x1=1;
        x2=0;
        d1=a1;
    }
    else
    {
        exeu(b1,a1%b1);
        ll int temp=x1;
        x1=x2;
        x2=temp-(a1/b1)*x2;
    }
}
ll int modinv(ll int A,ll int M)
{
    exeu(A,M);
    return (x1%M+M)%M;
}
int main()
{
    fast
    int m,d;
    cin>>m>>d;
    int ans=0;
    for(int i=22;i<=d;i++)
    {
        int x=i%10;
        int y=(i/10)%10;
        if(x>=2 && y>=2)
        {
            int z=x*y;
            if(z<=m) ans++;
        }
        
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
const int INF = 1001001001;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define re0 return 0
#include<string.h>
int npr(int n , int r){//nPr
    r = n - r;
    int sum = 1;
    int i;
    for (i=n;i>=r+1;i--)sum*=i;
    return sum;
}
int gcd(int a, int b) {//最大公約数
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {//最小公倍数
    return a * b / gcd(a, b);
}
int digsum(int n) {//桁和
    int res = 0;
    while(n > 0) {
        //res += n%10;
        //　↑をres++;にすれば桁数
         res++;
        n /= 10;
    }
    return res;
}
bool isPrime(int x){//素数判定
    if(x==1)return 0;
    if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i++)if(x%i==0)return 0;
    return 1;
}
/*bit全探索
for (int bit = 0; bit < (1<<N); ++bit) {
}
if (bit & (1 << i)) {
}
*/


signed main(){
    int n;
    cin >> n;
    while(1){
        if(n<=1000){
            n = 1000-n;
            break;
        }
        n-=1000;
    }
    cout << n <<endl;
    return 0;
}


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

string sl, s;
int q, t, f;
char c;
bool ord;

int main(){
    cin >> s >> q;
    ord = true;
    for (int i = 0; i < q; ++i){
        cin >> t;
        if (t == 1) ord = !ord;
        else{
            cin >> f >> c;
            if ((f == 1 && ord) || (f == 2 && !ord)) sl.push_back(c);
            else s.push_back(c);
        }
    }
    if (ord){
        for (auto iter=sl.rbegin(); iter!=sl.rend(); ++iter) cout << (*iter);
        cout << s;
    }
    else{
        for (auto iter=s.rbegin(); iter!=s.rend(); ++iter) cout << (*iter);
        cout << sl;
    }
}

Measured memory_bytes: 960
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
        int result = (a - b) + (a - b - 1) * (a - b) / 2 - a;
		System.out.println(result);
	}
}


Measured memory_bytes: 27112