akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H, W = MAP()

# 四方に一回り大きいグリッドを作る
grid = [['#'] * (W+2) for i in range(H+2)]
for i in range(1,H+1):
    row = list(input())
    for j in range(1, W+1):
        grid[i][j] = row[j-1]

dp = [[0] * (W+2) for i in range(H+2)]
# スタート地点に1通りを初期値設定
dp[1][1] = 1
for i in range(1,H+1):
    for j in range(1, W+1):
        # 現在位置が壁なら何もできない
        if grid[i][j] == '#':
            continue
        # 上が壁でなければ、値を持ってくる
        if grid[i-1][j] != '#':
            dp[i][j] += dp[i-1][j]
        # 左が壁でなければ、値を持ってくる
        if grid[i][j-1] != '#':
            dp[i][j] += dp[i][j-1]
# ゴール地点の値を確認する
print(dp[H][W] % MOD)


Measured memory_bytes: 252228
fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line);
    let x: f64 = line.trim().parse().unwrap();
    let mut cur: f64 = 100.0;
    let mut i = 0;
    loop {
        i += 1;
        cur = (cur * 1.01).floor();
        if cur >= x {
            println!("{}", i);
            break;
        }
    }
}


Measured memory_bytes: 2624
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
const ll MOD=1e9+7;
const int N=1000000;



main(){
    int n=in();
    vecll a;
    a.pb(in());
    rep(i,n-1)a.pb(in());
    ll ans=0;
    ll pre=1;
    ll b=0;
    rep(i,n){
        b+=a[i];
        ll sig=b/abs(b);
        if(b==0){
            b=pre;
            ans++;
        }
        else if(pre!=sig){
            ans+=abs(pre-b);
            b=pre;
        }
        pre*=-1;
    }
    ll ans1=0;
    pre=-1,b=0;
    rep(i,n){
        b+=a[i];
        ll sig=b/abs(b);
        if(b==0){
            b=pre;
            ans1++;
        }
        else if(pre!=sig){
            ans1+=abs(pre-b);
            b=pre;
        }
        pre*=-1;
    }
    cout<<min(ans,ans1);
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  
  int n;
  cin>>n;
  int a[n];
  for(int i=0; i<n; i++) cin>>a[i];
  
  bool flg=1;
  for(int i=0; i<n; i++){
  	if(a[i]%2==0){
    	if(a[i]%3!=0&&a[i]%5!=0) flg=0;
    }
  }
  
  if(flg) cout<<"APPROVED"<<endl;
  else cout<<"DENIED"<<endl;
  
}

Measured memory_bytes: 256
// 　　＿＿
// 　／　<＠ﾌ
//  ｜(ﾉﾉハ))
//  ﾉ从ﾟヮﾟ从
// 　ﾉ｜ｿﾉГ|つ author:hotarunx
// 〈_ﾉ^^^ヽ|
// 　~~tｧtｧ~
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int a, b, c;
    cin >> a >> b >> c;

    cout << min(b / a, c) << endl;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//以下回答
int main(){
    ll N;
    cin>>N;
    ll count=0;
    ll a=100;
    for(ll i=0;i<9999999;i++){
        a+=a/100;
        count++;
        if(a>=N){
            cout<<count<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3632
#include<iostream>

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

	if ((a + b) == 15)
		std::cout << '+' << std::endl;
	else if ((a*b) == 15)
		std::cout << '*' << std::endl;
	else
		std::cout << 'x' << std::endl;

	return 0;
}

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

typedef pair<int, int>P;

int main(void){
    // Your code here!
    int n;
    cin>>n;
    vector<P>left, right;
    int leftSum = 0, rightSum = 0;
    for(int i=0;i<n;i++){
        string str;
        cin>>str;
        int mn = 0, tmp = 0;
        for(int j=0;j<str.size();j++){
            if(str[j]=='(')tmp++;
            else tmp--;
            mn = min(mn, tmp);
        }
        if(tmp >= 0){
            left.push_back(P(-mn,tmp));
            leftSum+=tmp;
            continue;
        }
        mn=0;
        tmp=0;
        for(int j=str.size()-1;j>=0;j--){
            if(str[j]==')')tmp++;
            else tmp--;
            mn = min(mn, tmp);
        }
        right.push_back(P(-mn,tmp));
        rightSum+=tmp;
    }
    if(leftSum-rightSum!=0){
        cout<<"No"<<endl;
        return 0;
    }
    sort(left.begin(), left.end());
    sort(right.begin(), right.end());
    for(int i=0, tmp=0;i<left.size();i++){
        if(tmp < left[i].first){
            cout<<"No"<<endl;
            return 0;
        }
        tmp += left[i].second;
    }
    for(int i=0, tmp=0;i<right.size();i++){
        if(tmp < right[i].first){
            cout<<"No"<<endl;
            return 0;
        }
        tmp += right[i].second;
    }
    cout<<"Yes"<<endl;
    return 0;    
}



Measured memory_bytes: 3240
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <numeric>
#include <fstream>
#include <queue>
#include <cstdio>
#include <deque>
#define fol(i,n) for(int i=0;i<n;i++)
#define db(a) cout << a<< endl;
using namespace std;

int main(){
    int n,b;
    long long sum1=0,sum2=0,m,ans=9999999999999999,sum=0;
    vector<int>a;
    cin >> n;
    fol(i,n){
        cin >>b;
        a.push_back(b);
        sum += b;
    }
    for (int i=0;i<n-1;i++){
        sum1 += a[i];
        sum2 = sum - sum1;
        m = sum2-sum1;
        if (sum2-sum1<0) m = m*(-1);
        if (ans>m) ans = m;
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 1400
/*
* Welcome to my code!
*---------------------------------------------*
* author : lynmisakura(twitter : @andoreiji11)
*/

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define repn for(int i = 0;i < n;i++)
#define ain(a) for(auto& i : a)cin >> i;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size()) 
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define cont continue

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using pi = pair<int,int>;
using vpi = vector<pi>;
using pl = pair<ll,ll>;
using vpl = vector<pl>;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
template<class T> void print(std::vector<T> a){ int sz = a.size();
for(int i=0;i<a.size();i++)cout << a[i] << (i < sz-1 ? ' ' : '\n'); }
void ioboost(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}
///////////////////////////////////////////////////////////

ll dp[200020][3];

int main(int argc, char const *argv[])
{
	ioboost();
	int n;cin >> n;
	vl a(n);
	rep(i,n)cin >> a[i];

	int ex = 1 + (n % 2 == 1);

	rep(i,200020)rep(j,3)dp[i][j] = -LONG_MAX / 10;
	dp[0][0] = 0;

	rep(i,n){
		rep(j,ex + 1){
			if(j < ex){
				if((i + j) % 2 == 0){
					chmax(dp[i+1][j+1],dp[i][j]);
					chmax(dp[i+1][j],dp[i][j] + a[i]);
				}else{
					chmax(dp[i+1][j],dp[i][j]);
				}
			}else{
				if((i + j) % 2 == 0){
					chmax(dp[i+1][j],dp[i][j] + a[i]);
				}else{
					chmax(dp[i+1][j],dp[i][j]);
				}
			}
		}
	}
	
	if(n % 2 == 0){
		cout << max({dp[n][0],dp[n][1]}) << '\n';
	}else{
		cout << max({dp[n][1],dp[n][2]}) << '\n';
	}	

	return 0;
}


Measured memory_bytes: 9520
#include<bits/stdc++.h>
using namespace std;
int a[100005];
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    int l=a[n]/2,r=(a[n]+1)/2;
    int ans=0;
    int Min=1<<30;
    for(int i=1;i<n;i++){
        if(abs(a[i]-l)<Min){
            Min=abs(a[i]-l);
            ans=a[i];
        }
        if(abs(a[i]-r)<Min){
            Min=abs(a[i]-r);
            ans=a[i];
        }
    }
    cout<<a[n]<<" "<<ans<<endl;
    return 0;
}
/*
5
6 9 4 2 11
*/


Measured memory_bytes: 640
n,k = list(map(int, input().split()))
h = list(map(int, input().split()))

hd = sorted(h, reverse=True)
tmp = 0

if n < k:
    print(0)
else:
    for i in range(k): 
        tmp = tmp + hd[i]

    result = sum(h) - tmp
    print(result)

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

a_list = list(map(int, input().split()))

a_list = sorted(a_list)[::-1]

al = sum([a for i,a in enumerate(a_list) if i%2==0])
bo = sum([a for i,a in enumerate(a_list) if i%2==1])

print(al-bo)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long A,B,N;
    cin>>A>>B>>N;
    long long counter=0;
    counter=((A*N)/B)-A*(N/B);
    long long i=N-(N%B)-1;
    counter=max(counter,((A*i)/B)-A*(i/B));
    cout<<counter<<endl;
    
  return 0;
    }

    


Measured memory_bytes: 3508
#include <bits/stdc++.h>
#define re return
#define ull unsigned long long
#define ll long long
#define ld long double
#define f first
//#define s second
#define oo 1e9
#define pi acos(-1)
#define OO 4e18
#define EPS 1e-12
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define Hossam_Yehia ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int t,x,y,ans;
int main(){
    Hossam_Yehia;
    cin >> t;
    while(t--){
        cin >> x >> y;
        ans+=max(0,y-x+1);
    }
    cout<<ans<<endl;
    re 0;
}

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

signed main(){
  int n,p,A[2]={};
  cin>>n>>p;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    A[a%2]++;
  }
  if(A[1]==0){
    if(p)cout<<0<<endl;
    else cout<<((int)pow(2,n))<<endl;
  }else cout<<((int)pow(2,n-1))<<endl;
  return 0;
}


Measured memory_bytes: 256
// Problem Code: abc158_b

#include <iostream>
#include <algorithm>

using namespace std;

long long count_balls(long long N, long long A, long long B) {
	return A * (N / (A + B)) + min(A, N % (A + B));
}

int main() {
	long long N, A, B;
	cin >> N >> A >> B;
	cout << count_balls(N, A, B);
	return 0;
}

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

# define max_n 200001

int main(){
	
	int n,a[max_n],ans[max_n]={0};
		cin>>n;
	for(int i=1; i<n; i++)
		cin>>a[i];
	for(int i=1; i<n; i++)
		ans[a[i]]++;
	for(int i=1; i<=n; i++)
		cout<<ans[i]<<endl;
	
  	return 0; 
} 

Measured memory_bytes: 5188
#include<iostream>
#include<algorithm>

using namespace std;

static const int N_MAX = 100000;
long A[N_MAX];

int N;

int main(){
  cin >> N;
  for(int i=0;i<N;i++){
    scanf("%ld", &A[i]);
  }
  sort(A, A+N);
  //
  long tmp;
  for(int i=0;i<N-1;i++){
    while(true){
      A[i+1] %= A[i];
      tmp = A[i+1];
      A[i+1] = A[i];
      A[i] = tmp;
      if(A[i]==0){
        break;
      }else if(A[i]==1){
        cout << 1 << endl;
        return 0;
      }
    }
  }
  cout << A[N-1] << endl;
  return 0;
}


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


int main(){
long long h1,m1,h2,m2;
long long k;
cin>>h1>>m1>>h2>>m2>>k;
long long temp1=h1*60+m1;
long long temp2=h2*60+m2;
long long temp3=temp2-temp1;
long long ans;
if(temp3<k){
  ans=0;
}
else{
  ans=temp3-k;
}
cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3624
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int n,ans;

void dfs(ll num,bool f1,bool f2,bool f3){
  if(num>n) return;
  if(f1&&f2&&f3) ans++;
  dfs(num*10+3,1,f2,f3);
  dfs(num*10+5,f1,1,f3);
  dfs(num*10+7,f1,f2,1);
}

int main(){
  cin >> n;
  ans=0;
  dfs(0,0,0,0);
  cout << ans << endl;
}

Measured memory_bytes: 256
/*
created on 21/4/2020
*/
#include<bits/stdc++.h>
using namespace std;
#define Endl '\n'
typedef long long int lli;
void solve();
int main(int argc, char const *argv[]){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
}
int const mxlen = 100005;
int h[mxlen];
int dp[mxlen];
void solve(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  dp[0] = 0;
  dp[1] = dp[0] + abs(h[1] - h[0]);
  for(int i=2;i<n;i++){
    dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
  }
  cout<<dp[n-1]<<Endl;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define INF 1e9
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N, M, Q, H, W, D, L, R;
ll A;
ll B[200001];
ll ans;
string S;
ll K;
char s[52][52];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll BFS(ll x, ll y) {
	ll count = 0;
	queue < pair<ll, ll> >q;
	pair<ll, ll> p;
	p.first = x;
	p.second = y;
	q.push(p);
	while (!q.empty()) {
		ll loopnum = q.size();
		rep(i, 0,loopnum) {
			p = q.front();
			q.pop();
			ll x = p.first;
			ll y = p.second;
			if (x == W && y == H)return count - 1;
			if (s[y][x] == '#')continue;
			s[y][x] = '#';
			rep(j, 0, 4) {
				p.first = x + dx[j];
				p.second = y + dy[j];
				q.push(p);
			}
		}
		count++;
	}
	return ans+1;
}
int main() {
	cin >> H >> W;
	rep(i, 0, 52) {
		rep(j, 0, 52) {
			s[i][j] = '#';
		}
	}
	rep(i, 1, H+1) {
		rep(j, 1, W+1) {
			cin >>s[i][j];
			if (s[i][j] == '.')ans++;
		}
	}
	ans -= 2;
	cout << ans - BFS(1, 1) << endl;
	cin >> ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  string n; cin >> n;
  reverse(ALL(n));
  int cur = 0;
  for (int i = 0; i < n.size(); i++) {
    cur += (n[i] - '0');
    cur *= 10;
    cur %= 9;
  }

  if (cur % 9 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3748
import java.io.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        int N = Integer.parseInt (reader.readLine());
        String[] arr = reader.readLine().split (" ");
        String S, T;
        S = arr[0];
        T = arr[1];
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < N; i++) {
            ans.append (S.charAt (i));
            ans.append (T.charAt (i));
        }
        System.out.println (ans.toString());
        return;
    }
}

Measured memory_bytes: 32516
#include <iostream>
using namespace std;
int main() {
    int A=65,Z=90;
    int ite;
    string s;
    cin>>ite>>s;
    for(int i=0;i<s.size();i++){
        if(((int)s[i]+ite)>Z)
           s[i]=(char)(ite+((int)s[i])-26);
        else
            s[i]=(char)(((int)s[i])+ite);
    }
    cout<<s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main()
{
   int n,k;
   cin >> n >> k;
   vector<int> x(n);
   int ans=0;
   rep(i,n)
   {
      int x;
      cin >> x;
      ans += 2*min(k-x,x);
   }
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 384
import sys
x,n = map(int, input().split())
if n == 0:
  print(x)
  sys.exit()
data = [int(i) for i in input().split()]
for dif in range(100):
  if x - dif not in data:
    print(x - dif)
    break
  elif x + dif not in data:
    print(x + dif)
    break

Measured memory_bytes: 9180
#include "bits/stdc++.h"
using namespace std;

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

    bool flag = false;
    for (int i = 0; i < S.size(); i++) {
        for (int j = 0; j < S.size(); j++) {
            if (S.at(i) == S.at(j) && i != j) {
                flag = true;
                break;
            }
        }
        if (flag) {
            break;
        }
    }

    if (flag) {
        cout << "no" << endl;
    }
    else {
        cout << "yes" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <map>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 2019
#define PI 3.14159265358979323846
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, ll> pp;

ll Pow(ll n, ll k) {
	ll ans = 1, a = n % MOD;
	while (k > 0) {
		if (k & 1) {
			ans *= a;
			ans %= MOD;
		}
		a *= a;
		a %= MOD;
		k >>= 1;
	}
	return ans;
}

int main(void) {
	int num, i, j, a;
	ll x, ans = 0;
	string s;
	cin >> s;
	vector<int> d(s.size() + 1, 0);
	map<int, ll> mp;
	mp[0] = 1;
	for (i = s.size() - 1; i >= 0; i--) {
		a = s[i] - '0';
		d[i] = (d[i + 1] +  a * Pow(10, s.size() - i - 1)) % 2019;
		mp[d[i]]++;
	}
	for (auto it = mp.begin(); it != mp.end(); it++) {
		x = (*it).second;
		ans += x * (x - 1) / 2;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 4356
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int l = a*60+b, r = c*60+d-e;
  cout << max(r-l, 0) << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int A[1000][1000];
int E[1000];
int B[1000];
int p[1000];

int main() {
  int N, result;
  int i, j, d, n, fl, aite, aa;
  scanf ("%d", &N);
  
  for (i=0;i<N;i++) {
      for (j=0;j<N-1;j++) {
          scanf("%d", &A[i][j]);
          A[i][j]--;
      }
//      A[i][N-1]=-1;
  }
  
  for (i=0;i<N;i++) p[i]=0;
  
  d=0;
  for (i=0;i<N;i++) B[i]=1;
  while(1) {
      d++;
      fl = 0;
      for (i=0;i<N;i++) E[i]=0;
      for (n=0;n<N;n++) {
          if ((B[n]==1) &&  (E[n]==0) && (p[n]<N-1)) {
              aite=A[n][p[n]];
              if (A[aite][p[aite]]==n) {
                  if (E[aite]==0) {
                      fl = 1;
                      E[n]=1;
                      E[aite]=1;
                  }
              }
          }
      }
      
      for (n=0;n<N;n++) {
          if (E[n]) p[n]++;
      }
      
      if (fl==0) {
          printf("-1\n");
          return 0;
      }
      aa=0;
      for (i=0;i<N;i++) B[i]=E[i];
      for (n=0;n<N;n++) if (p[n]!=N-1) aa=1;
      if (aa==0) break;
  }
  
  printf("%d", d);
  return 0;
}




Measured memory_bytes: 4096
/*
I've been down this road once or twice before
through the open door
i come falling through it
there's a sign post up ahead
like a watershed
and it opens my eyes
ways, for me to begin
to be born again
and knowing for the first time
ways, all so differently
shine for me to see
the better man that I am

I've been places in my head
behind me worse than what's ahead
and on my path just like a dream
takes me from the inbetween
from out of nowhere you came strong as stone
and now I'll never have to be alone
what it is I know

you have always been my safe home
I walk, I run, I burn out into you
you have always been my safe home
my whole world has moved on

i know what i am and I'll always be
your reality, is better than I could dream
all my fears turn from black to white
and i'd stand and fight
the whole world for you
faith, and destiny
I never did believe
my only god is love and
faith, what I see in you
and I can hold it true
like a weight in my hand.
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-8
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 600031;

long long A,B,C,K;

int main(){
//	freopen("apache.in","r",stdin);
//	freopen("apache.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
//	cin.tie(0);

	cin>>A>>B>>C>>K;

	long long res=A-B;

	if (K%2==1)
		res*=-1;

	cout<<res<<endl;

//	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 256
import bisect

def sieve(n):
  num = [True]*n
  num[0] = num[1] = False
  for i in range(2,int(n**0.5)+1):
    if num[i]:
      for j in range(i**2, n, i):
        num[j] = False
  return [i for i in range(2,n) if num[i]]
      
x = int(input())

p = sieve(10**5+4)

index = bisect.bisect_left(p,x)

print(p[index])

Measured memory_bytes: 4200
n = int(input())
b = list(map(int, input().split()))

ans = 0
for i in range(n):
    if i == 0:
        ans += b[0]
    elif i == n-1:
        ans += b[n-2]
    else:
        ans += min(b[i-1], b[i])
print(ans)

Measured memory_bytes: 3060
N, K = map(int, input().split())
As = list(map(int, input().split()))

def getDistNexts(As):
    lenA = len(As)
    poss = dict()
    for i, A in enumerate(As):
        if A not in poss:
            poss[A] = i + lenA

    distNexts = [0]*(lenA)
    for i in reversed(range(lenA)):
        distNexts[i] = poss[As[i]] - i
        poss[As[i]] = i
    return distNexts

distNexts = getDistNexts(As)

NK = N*K

iNow = 0
dist = 0
hists = [-1] * N
hists[0] = 0
isSkipped = False
while dist + distNexts[iNow] + 1 < NK:
    dist += distNexts[iNow] + 1
    iNow = dist % N
    if not isSkipped and hists[iNow] != -1:
        period = dist - hists[iNow]
        dist += (NK-1-dist) // period * period
        isSkipped = True
    hists[iNow] = dist

Ss = []
setS = set()
for A in As[iNow:]:
    if A in setS:
        S = ''
        while S != A:
            S = Ss.pop()
            setS.remove(S)
    else:
        Ss.append(A)
        setS.add(A)

if Ss:
    print(' '.join(map(str, Ss)))


Measured memory_bytes: 48812
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

X,A = Is()
if X < A:
    print(0)
else:
    print(10)

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

int a[200005];
long long sum;

int main()
{
    int n;
	cin >> n;
	for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }

	int left = 1;
	int xorVal = 0;  // 累计的异或结果
	for(int right = 1; right <= n; right++)
 	{
	 	while(xorVal & a[right])
   		{
  			xorVal ^= a[left];
  			left++;
		}
		xorVal ^= a[right];
		sum += right - left + 1;
  	}

	cout << sum;
	return 0;
}


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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  string s;
  cin >> s;
  if (s == "ABC") {
    cout << "ARC\n";

  } else {
    cout << "ABC\n";
  }
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


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

int main(void) {
    int a,b;
    cin >> a >> b;
    if(a+b==15) cout << '+';
    else if(a*b==15) cout << '*';
    else cout << 'x';
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<cstdio>
#include<string>
#include<math.h>
#include<vector>
#include <queue>
#include <bits/stdc++.h>
using namespace std;
typedef vector<vector<char>> field_t;

typedef pair<int, int> point_t;

int main()
{
	int L;
    cin >> L;
	long double i,M;
	M=pow(L,3.0)/27;
		cout << fixed;
		cout << setprecision(12) << M <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n; cin >> n;
 
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i < 10) ans++;
        if (i >= 10 && i < 100) continue;
        if (i >= 100 && i < 1000) ans++;
        if (i >= 1000 && i < 10000) continue;
        if (i >= 10000 && i < 100000) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.BigDecimal;

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

        int n = sc.nextInt();
        int k = sc.nextInt();

        List<Integer> list = new ArrayList<Integer>();

        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }

        int max = 0;
        int num = 0;

        for (int j = 0; j < k; j++) {
            num += list.get(j);
        }
        
        max = num;

        for (int i = 0; i < n - k; i++) {

            num -= list.get(i);
            num += list.get(i + k);

            if (num > max) {
                max = num;
            }

        }


        BigDecimal ans = new BigDecimal((double)(max + k) / (double)2);

        System.out.println(ans);

    }
}

Measured memory_bytes: 83284
n = gets.to_i
s = gets.chomp
mod = 10**9+7
b = Hash.new(0)
n.times do |i|
    b[s[i]] += 1
end
c = b.keys.size
ans = 1
b.values.each do |i|
    ans *= i+1
    ans %= mod
end
puts (ans-1)%mod

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

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const LL INF = 1000 * 1000 *1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 500500;

int P[MAX];
int Q[MAX];

struct RMQ
{
	int A[MAX * 4];
	int n;

	void init(int n)
	{
		this->n = n;
	}

	void add(int tl, int tr, int v, int x, int val)
	{
		if (tl == tr)
		{
			A[v] = val;
			return;
		}

		int tm = (tl + tr) / 2;
		if (x <= tm) add(tl, tm, v*2, x, val);
		else add(tm+1, tr, v*2+1, x, val);

		A[v] = max(A[v*2], A[v*2+1]);
	}

	void add(int x, int val)
	{
		add(0, n-1, 1, x, val);
	}

	int get(int tl, int tr, int v, int l, int r)
	{
		if (l > r) return -INF;
		if (l == tl && r == tr)
		{
			return A[v];
		}

		int tm = (tl + tr) / 2;

		int res = get(tl, tm, v*2, l, min(tm, r));
		res = max(res, get(tm+1, tr, v*2+1, max(tm+1, l), r));
		return res;
	}

	int get(int l, int r)
	{
		return get(0, n-1, 1, l, r);
	}
} R;

int n, k;

bool isMax(int pos)
{
	int l = max(0, pos - k + 1);
	int r = min(n-1, pos + k - 1);

	int mx = R.get(l, r);
	if (mx == P[pos]) return true;
	return false;
}

set<int> S;

void upd(int ind)
{
	int l = ind * k;
	int r = min(n - 1, (ind + 1) * k - 1);

	int val = R.get(l, r);
	if (val == -INF) return;
	int pos = Q[val];

	if (isMax(pos))
	{
		S.insert(pos);
	}
}

int RES[MAX];

int main()
{
	//freopen("in.txt","r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	scanf("%d%d", &n, &k);

	R.init(n);

	FOR (i, 0, n)
	{
		scanf("%d", &P[i]);
		P[i]--;
		Q[P[i]] = i;

		R.add(i, P[i]);
	}


	FOR (i, 0, (n + k - 1) / k)
	{
		upd(i);
	}

	int ind = n-1;

	while(ind >= 0)
	{
		if (S.empty()) throw -1;
		int pos = *S.rbegin();
		S.erase(pos);

		if (!isMax(pos)) continue;

		RES[pos] = ind--;
		R.add(pos, -INF);

		int ind = pos / k;
		upd(ind);
		if (ind) upd(ind - 1);
		if (ind < (n + k - 1) / k - 1) upd(ind + 1);
	}

	FOR (i, 0, n)
	{
		printf("%d\n", RES[i] + 1);
	}
	printf("\n");



}


Measured memory_bytes: 38656
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)
const long double PI = (acos(-1));

int main() {

	char b;
	cin >> b;

	if (b == 'A') cout << "T";
	else if (b == 'T') cout << "A";
	else if (b == 'C') cout << "G";
	else cout << "C";

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;

int main(){
    int H,W,a[510][510],N=0;cin>>H>>W;
    vector<vector<int>> v(510);
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++)
            cin>>a[i][j];

            int k=0;
            while(k<W-1){
                while(a[i][k]%2==0){
                    k++;
                    if(k==W-1) goto lol1;  
                }
                a[i][k]--;
                v[i].push_back(k);
                k++;
                a[i][k]++;
                if(k==W-1)goto lol2;
                while(a[i][k]%2==1){
                    a[i][k]--;
                    v[i].push_back(k);
                    k++;
                    a[i][k]++;
                    if(k==W-1)goto lol3;
                }
                k++;
            }
            lol1:lol2:lol3:
            N+=v[i].size();
    }
    
    vector<int> w;
    int h=0,Z=0;
        while(h<H-1){
            while(a[h][W-1]%2==0){
                h++;
                if(h==H-1) goto lol4;  
            }
            a[h][W-1]--;
            w.push_back(h);
            h++;
            a[h][W-1]++;
            if(h==H-1)goto lol5;
            while(a[h][W-1]%2==1){
                    a[h][W-1]--;
                    w.push_back(h);
                    h++;
                    a[h][W-1]++;
                    if(h==H-1)goto lol6;
                }
                h++;
            }
            lol4:lol5:lol6:
            Z=w.size();
    
    cout<<N+Z<<endl;
    for(int i=0;i<H;i++){
        for(int j=0;j<v[i].size();j++)
            cout<<i+1<<" "<< v[i][j]+1<<" "<<i+1<<" "<<v[i][j]+2<<endl;
    }
    for(int i=0;i<Z;i++)
        cout<<w[i]+1<<" "<<W<<" "<<w[i]+2<<" "<<W<<endl;
    
    return 0;
}

Measured memory_bytes: 3840
a=Array.new(12);
a.map!{|i| Array.new(12,0) }
cnt=m=0

while true
	begin
		x,y,siz=gets.split(",").map{|i|i.to_i}
		a[x][y]+=1
		a[x+1][y]+=1
		a[x-1][y]+=1
		a[x][y+1]+=1
		a[x][y-1]+=1
		if siz>1
			a[x+1][y+1]+=1
			a[x+1][y-1]+=1
			a[x-1][y+1]+=1
			a[x-1][y-1]+=1
		end
		if siz==3
			a[x+2][y]+=1
			a[x-2][y]+=1
			a[x][y+2]+=1
			a[x][y-2]+=1
		end
	rescue
		break
	end
end

for i in 0..9 
	for j in 0..9
		cnt+=1 if a[i][j]==0
		m=a[i][j] if m<a[i][j]
	end
end

puts cnt,m

Measured memory_bytes: 6132
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll MOD = (ll)pow(10.0, 9.0) + 7;
pint dx[4] = { {0, 1}, {0, -1}, {1, 0}, {-1, 0} };
ll min(ll a, ll b)
{

	return (a < b) ? a : b;
}
ll max(ll a, ll b) { return (a > b) ? a : b; }

int main() {
	ll A, B;

	cin >> A >> B;

	if (A >= 13)
		cout << B;
	else if (A >= 6)
		cout << B / 2;
	else
		cout << 0 << endl;



	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()

def Z(S):
    n = len(S)
    res = [0] * n
    res[0] = n
    l = r = 0
    for i in range(1, n):
        if res[i - l] < r - i: # 過去の結果が全て使える
            res[i] = res[i - l]
        else:
            l = i
            r = max(i, r) # i < r ならば過去の結果が一部使える
            while r < n and S[r - l] == S[r]: r += 1
            res[i] = r - l
    return res

def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    C = [A[i] ^ A[(i + 1) % n] for i in range(n)]
    D = [B[i] ^ B[(i + 1) % n] for i in range(n)]
    prefix = Z(C + D + D)
    res = []
    for k in range(n):
        if prefix[n + k] >= n:
            res.append(((n - k) % n, A[0] ^ B[k]))
    res.sort()
    for pair in res:
        print(*pair)
resolve()

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

#define ran 101101

int n;
int a[ran];

int main() {
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%d", &a[i]);
	
	int ans = 1, cur = 1;
	for(int i=n-2;i>=0;i--){
		if(a[i]>=a[i+1]) cur++;
		else cur = 1;
		ans = max(ans, cur);
	}
	printf("%d\n", ans-1);
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int N,M;
int a[1010];
int b[1010];
int c[1010][12];

int dp[1 << 12];
const int INF = 1e9;

int main ()
{
    cin >> N >> M;
    REP(i,M) {
        cin >> a[i] >> b[i];
        REP(j,b[i]) cin >> c[i][j];
        REP(j,b[i]) c[i][j]--;
    }

    REP(i,(1 << 12)) dp[i] = INF;
    dp[0] = 0;

    REP(i,(1 << N)) {
        REP(j,M) {
            int mask = i;
            REP(k,b[j]) {
                int mt = 1 << c[j][k];
                mask |= mt;
            }
            dp[mask] = min(dp[mask], dp[i] + a[j]);
        }
    }

    if (dp[(1 << N) - 1] == INF) {
        cout << -1 << endl;
    } else {
        cout << dp[(1 << N) - 1] << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6+9;
int prime[N];
unordered_map<int, int> mp;
void func() {
	mp.clear();
	for (int i = 0; i < N; ++i) {
		prime[i] = 1;
	}
	prime[0] = prime[1] = 0;
	for (int i = 2; i < N; ++i) {
		if(prime[i] == 0)
			continue;
		// if(i < 100)
			// cout << i << " ";
		for (int j = 2; (i*j) < N; ++j) {
			prime[i*j] = 0;
		}
	}

	for (int i = 0; i < N; ++i) {
		if(prime[i])
			++mp[i];
	}
}

int main() {
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
	#endif
	// func();
	int n;	
	cin >> n;
	int a[n+5];
	int MAX = INT_MIN;
	// unordered_map<int, int> mp;
	// mp.clear();
	unordered_map<int, int> check;
	check.clear();
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		// MAX = max(a[i], MAX);
		// ++mp[a[i]];
		++check[a[i]];
	}
	int g = a[0];
	for (int i = 1; i < n; ++i) {
		g = __gcd(g, a[i]);
	}

	if(g > 1) {
		cout << "not coprime\n";
		return 0;
	}
	// for (auto it: mp) {
	// 	cout << it.first << " ";
	// }
	int cnt = 0;
	for (int i = 2; i < N; ++i) {
		cnt = 0;
		for (int j = i; j < N; j += i)
			cnt += check[j];

		if(cnt > 1) {
			cout << "setwise coprime\n";
			return 0;
		}
		// cnt	
		// for (int j = 1; (a[i] * j) <= MAX + 1; ++j) {
		// 	if(mp[a[i] * j] > 0)
		// 		++cnt;
		// }
		// if(cnt > 1)
			// cout << 
		// for (int j = )
			// ++cnt;

	}
	cout << "pairwise coprime\n";
	return 0;
}

Measured memory_bytes: 46408
#include<iostream>
#include<stack>
#include<string>
using namespace std;
int main()
{
	while (true)
	{
		string str = "";
		while (true)
		{
			char ch = cin.get();
			if (ch == '\n')
				continue;
			if (ch == '.')
				break;
			str.push_back(ch);
		}
		if (str.empty())
			break;
		stack<char> S;
		bool flag = true;
		for (int i = 0; i < str.length(); i++)
		{
			if (str[i] == '(' || str[i] == '[')
				S.push(str[i]);
			else if (str[i] == ')')
				if (S.empty() || S.top() != '(')
					flag = false;
				else
					S.pop();
			else if (str[i] == ']')
				if (S.empty() || S.top() != '[')
					flag = false;
				else
					S.pop();
		}
		if (!S.empty())
			flag = false;
		cout << (flag ? "yes" : "no") << endl;
	}
}


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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if(abs(a-c) <= d) cout << "Yes" << endl;
  else if(abs(a-b) <= d && abs(b-c) <= d) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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


int main()
{
    char s[1000],t[1000];
    for(int i=0;i<1000;i++)
    {
        s[i]='\0';
    }
    for(int i=0;i<1000;i++)
    {
        t[i]='\0';
    }
    cin>>s>>t;
   
    int a=0,c=0;
    int b = strlen(t);
    int d = strlen(s);
    int e = d-b;
    int x=0,y=0;
  
    for(int i=0;i<=e;i++)
    {
        x=0;
        for(int j=0;j<b;j++)
        {
            if(s[i+j]==t[j])
            {
                x++;
            }
        }
        
        if(y<x)
        {
            y=x;
        }
    }
    
    cout<<b-y;
    return 0;
}

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

using namespace std;

/*

        Bismillahir Rahmanir Rahim
        Problem :
        Problem Link :
        Topics :
        Solver : Masud Parves
        I Love Code More than Sharks Love Blood <3
*/


#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define SZ(a)           (int)a.size()
#define all(a)  a.begin(), a.end()
#define allr(a)  a.rbegin(), a.rend()


#define sf(a)           scanf("%d",&a)
#define sff(a,b)        scanf("%d %d",&a,&b)
#define sfff(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int zz=1 ; zz<=t ; zz++)
#define PRINT_CASE printf("Case %d: ",zz)
#define Debug(x)            cout<<#x " = "<<(x)<<endl
#define NOT_VISITED 0
#define IS_VISITED 1
#define WHITE 0
#define GRAY 1
#define BLACK 2



int fx[4]= {1,-1,0,0};
int fy[4]= {0,0,1,-1};

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N  (1<<pos);}
//int Reset(int N,int pos){return N= N & ~(1<<pos);}
//bool Check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/


const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)2e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<int, ll> pill;

int main() {
    CIN
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int x=0,MAX=0;
    int n;
    cin >> n;
    string s;
    cin >> s;

    for(int i=0 ; i<n ; i++){
        if(s[i]=='I') {
            x++;
        }else x--;

        MAX = max(x, MAX);
    }

    cout << MAX << endl;

    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

int dp[1000001];
//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	memset(dp, false, sizeof(dp));
	dp[1] = true;
	vector<int>ns{ 2,3,5 };
	for (int i = 1; i <= 1000000; ++i) {
		if (dp[i]) {
			for (int j = 0; j < 3; ++j) {
				if (i*ns[j] <= 1000000) {
					dp[i*ns[j]] = true;
				}
			}
		}
		
	}
	while (1) {
		int M; cin >> M;
		if (!M)break;
		int N; cin >> N;
		int ans = 0;
		for (int i = M; i <= N; ++i) {
			if (dp[i])ans++;
		}
		cout << ans << endl;

	}
	
	return 0;
}

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

//.define
// #define FILE_IN_OUT
#define RET(_x)    return cout << (_x) << '\n', 0;
#define all(_obj)  (_obj).begin(), (_obj).end()
#define loop(_n)   for (int i = 0; i < (_n); ++i)
#define sz(_obj)   static_cast<int>((_obj).size())
#ifdef SHJ_LOCAL
#define debug(_x)  std::cerr << (#_x) << " = " << (_x) << '\n' << std::flush;
#else
#define debug(_x)  {}
#endif
#define endl "\n"
template<typename Tp>
Tp CeilDiv(Tp _dividend, long long _divider) {
    return static_cast<Tp>((_dividend - 1LL + _divider) / _divider);
}
template<typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
    for (Tp current = _begin; current != _end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);

//.data

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream cin ("input.txt",  std::ios::in);
    std::ofstream cout("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    int n, k;
    cin >> n >> k;
    vector<ll> arr(n);
    loop(n) {
        cin >> arr[i];
    }
    for (int i = k; i < n; ++i) {
        if (arr[i] > arr[i - k]) {
            cout << "Yes" endl;
        } else {
            cout << "No" endl;
        }
    }

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 4692