akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <map>

using namespace std;

int x;
int ans=0;
string s;
map<char,int>pig;

int main()
{
    cin>>x;
    cin>>s;
    for(int i=1;i<x;i++)
    {
        int cow=0;
        for(int j=0;j<=i;j++) pig[s[j]]++;
        for(int j=i+1;j<x;j++)
        {
            if(pig[s[j]]>0) {
                    cow++;
                    pig[s[j]]=0;
            }
        }
        ans=cow>ans?cow:ans;
        pig.clear();
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
char in[110000];
int main(){
	scanf("%s",in);
	int n=strlen(in);
	if(in[0]=='0'||in[n-1]=='1'||in[n-2]=='0'){
		printf("-1\n");return 0;
	}
	for(int i=0;i<n-1;i++){
		if(in[i]!=in[n-i-2]){
			printf("-1\n");return 0;
		}
	}
	int left=0;
	for(int i=0;i<n;i++){
		if(in[i]=='1'||i==n-1){
			while(left<i){
				printf("%d %d\n",left+1,i+1);
				left++;
			}
		}
	}
}

Measured memory_bytes: 1408
import java.util.Scanner;

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

        String str = sc.next();

        char[] ch = new char[4];
        String result = "Good";

        for(int i = 0; i < ch.length; i++){
            ch[i] = str.charAt(i);
        }

        for(int i = 1; i < ch.length; i++){
            if(ch[i - 1] == ch[i])
                result = "Bad";
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
bool kai(string s) {
    for(int i = 0; i < s.size() / 2; i++) {
        if(s[i] != s[s.size() - i - 1]) {
            return false;
        }
    }
    return true;
}
int main() {
    string s;
    cin >> s;
    int n = s.size();
    if(kai(s) && kai(s.substr(0, (n - 1) / 2)) &&
       kai(s.substr((n + 3) / 2 - 1, n + 1 - (n + 3) / 2))) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define mp make_pair
#define endl "\n"
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define lb lower_bound
#define forn(i,n) for(ll i=0 ; i<n ; i++)
#define arr(a,n) for(ll i=0;i<n;i++){ cin>>a[i]; }
#define ub upper_bound
#define pb push_back
#define pi pair<int,int>
#define mod 1000000007
#define vectormax *max_element
#define vectormin *min_element
#define arraysize 1000000
#define setbit _builtin_popcountll
using namespace std;

ll ipow(ll x, ll n)
{
    ll result = 1;
    while (n) {
        if (n & 1)
            result = result * x ;
        n = n / 2;
        x = x * x;
    }
    return result;
}

int main() {
	string s;
	cin>>s;
	if(s[s.size()-1]=='s')
	s+="es";
	else
	s+="s";
	cout<<s<<endl;
return 0;
}


Measured memory_bytes: 3628
def main():
    N, M = map(int, input().split())
    students = [input().split() for _ in range(N)]
    checkpoints = [input().split() for _ in range(M) ]
    nearest = [None]*N

    for i, s in enumerate(students) :
        min_d = 10**9

        for j, p in enumerate(checkpoints, 1) :
            a, b = map(int, s)
            c, d = map(int, p)
            d = abs(a - c) + abs(b - d)

            if min_d > d:
                min_d = d
                nearest[i] = j

    for i in range(N):
        print(nearest[i]) 
main()

Measured memory_bytes: 39792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n), s(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    a.at(i)--;
  }
  for (int i = 0; i < n; i++) {
    s.at(i + 1) = (s.at(i) + a.at(i)) % k;
  }
  long long ans = 0;
  map<int, int> mp;
  queue<int> q;
  for (int i = 0; i < n + 1; i++) {
    ans += mp[s.at(i)];
    mp[s.at(i)]++;
 
    q.push(s.at(i));
    if (q.size() == k) {
      mp[q.front()]--;
      q.pop();
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 12032
x, y, a, b, c = map(int, input().split())
red = list(map(int, input().split()))
green = list(map(int, input().split()))
no = list(map(int, input().split()))

red.sort()
green.sort()
no.sort()
a -= 1
b -= 1
c -= 1
max_a = int(a)
max_b = int(b)

ans = 0
for i in range(x):
    ans += red[a]
    a -= 1
for i in range(y):
    ans += green[b]
    b -= 1
a += 1
b += 1

for i in range(x+y):
    if c >= 0 and a <= max_a and b <= max_b:
        gr = no[c] - red[a]
        gg = no[c] - green[b]
        if gr >= gg:
            if gr > 0:
                ans += no[c]
                ans -= red[a]
                c -= 1
                a += 1
        elif gg >= gr:
            if gg > 0:
                ans += no[c]
                ans -= green[b]
                c -= 1
                b += 1
    elif c >= 0 and a <= max_a:
        if no[c] - red[a] > 0:
            ans += no[c]
            ans -= red[a]
            c -= 1
            a += 1
    elif c >= 0 and b <= max_b:
        if no[c] - green[b] > 0:
            ans += no[c]
            ans -= green[b]
            c -= 1
            b += 1
    else:
        break

print(ans)


Measured memory_bytes: 23456
#include<bits/stdc++.h>
using namespace std;
#define oo (long long)1e18
#define ll long long
#define setdp memset(dp,-1,sizeof(dp))
const ll mod = 1e9+7;
void _IOS(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);}
#define PI 3.14159265359
int n,l,r,x;
    vector<int>b(200009),a(200009);
int main()
{
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(i&1&&a[i]&1)
            ans++;
    }
    cout<<ans;
}


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

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef pair <ll ,ll> pll;
typedef pair <int ,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define print(a) {for (auto iiiiiiiiii : a) cout << iiiiiiiiii << ' '; cout << '\n';}
#define fi first
#define se second
#define all(x) (x).begin() , (x).end()

ll next() {ll x; cin >> x; return x;}

const ll inf = 1e18 , mod = 998244353;
const int intf = 2e9 , maxn = 2e5 + 2;
const double PI = 3.141592653589 , eps = 1e-8;

vector < vector <int> > g;

vector <int> cnt = {0 , 0};

void dfs(int prev , int v , vector <int> &col){
    if (prev != v){
        col[v] = (col[prev] + 1) % 2;
        cnt[col[v]]++;
    }
    for(auto to : g[v]){
        if (to == prev) continue;
        dfs(v , to , col);
    }
}

void solve(){
    int n; cin >> n;
    g.resize(n);
    vector <int> col(n);
    for (int i = 1; i < n;  i ++){
        int u , v; cin >> u >> v; u-- , v--;
        g[u].pb(v);
        g[v].pb(u);
    }
    if (n == 2){
        cout << "1 2";
        return;
    }
    col[0] = 0;
    dfs(0 , 0 , col);
    vector <int> num = {3 , 1 , 2};
    vector <int> ans(n);
    if (min(cnt[0] , cnt[1]) < (n + 2) / 3){
        int cur = 0;
        if (cnt[1] < cnt[0]) cur = 1;

        for (int i = 0; i < n; i ++){
            if (col[i] == cur){
                ans[i] = num[0];
                num[0] += 3;
            }
        }

        for (int i = 0; i < n; i++){
            if (col[i] != cur){
                if (num[0] > n){
                    if (num[1] > n){
                        ans[i] = num[2];
                        num[2] += 3;
                    } else {
                        ans[i] = num[1];
                        num[1] += 3;
                    }
                } else {
                    ans[i] = num[0];
                    num[0] += 3;
                }
            }
        }
    } else {
        for (int i = 0; i < n; i ++){
            if (col[i] == 0){
                if (num[1] > n){
                    ans[i] = num[0];
                    num[0] += 3;
                } else {
                    ans[i] = num[1];
                    num[1] += 3;
                }
            } else {
                if (num[2] > n){
                    ans[i] = num[0];
                    num[0] += 3;
                } else {
                    ans[i] = num[2];
                    num[2] += 3;
                }
            }
        }
    }

    print(ans);
}

int main()
{
    #ifdef HERE
        freopen("input.txt" , "r" , stdin);
    #else
        //freopen(".in" , "r" , stdin); freopen(".out" , "w" , stdout);
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #endif
    cout.precision(20);

    for (int t = 1; t--;) solve();

    #ifdef HERE
        cout << setprecision(3) << fixed << "\n\nRuntime: " << (long double)(clock()) / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0;
}
/*

*/


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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;


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

	int n , a , b , c , d;
	cin >> n >> a >> b >> c >> d;
	--a, --b, --c, --d;
	string s;
	cin >> s;
	
	if(c < a || d < b) dier("No");
	if(s[c] == '#' || s[d] == '#') dier("No");
	
	if(a > b)
	{
		swap(a , b);
		swap(c , d);
	}
	
	if(c > d)
	{
		bool f1 = true;
		for(int i = a ; i < n ;)
		{
			if(i + 2 <= c && (s[i + 2] == '.' && i + 2 != b)) { i += 2; continue; }
			if(i + 1 <= c && (s[i + 1] == '.' && i + 1 != b)) { i += 1; continue; }
			if(i != c) f1 = false;
			break;
		}
		if(f1) dier("Yes");
		
		bool f2 = true;
		for(int i = b + 1 ; i < n ;)
		{
			if(i > 0 && i + 1 <= d + 1 && s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.')
			{
				b = i;
				break;
			}
			if(i + 1 <= d && (s[i + 1] == '.')) { i += 1; continue; }
			if(i + 2 <= d && (s[i + 2] == '.')) { i += 2; continue; }
			f2 = false;
			break;
		}
		if(!f2) dier("No");
		f1 = true;
		for(int i = a ; i < n ;)
		{
			if(i + 2 <= c && (s[i + 2] == '.' && i + 2 != b)) { i += 2; continue; }
			if(i + 1 <= c && (s[i + 1] == '.' && i + 1 != b)) { i += 1; continue; }
			if(i != c) f1 = false;
			break;
		}
		dier((f1 ? "Yes" : "No"));
	}
	else
	{
		bool f1 = true;
		for(int i = b ; i < n ;)
		{
			if(i + 2 <= d && s[i + 2] == '.') { i += 2; continue; }
			if(i + 1 <= d && s[i + 1] == '.') { i += 1; continue; }
			if(i == d) break;
			f1 = false;
			break;
		}
		if(!f1) dier("No");
		for(int i = a ; i < n ;)
		{
			if(i + 2 <= c && s[i + 2] == '.') { i += 2; continue; }
			if(i + 1 <= c && s[i + 1] == '.') { i += 1; continue; }
			if(i == c) break;
			f1 = false;
			break;			
		}
		dier((f1 ? "Yes" : "No"));
	}
	

	return 0;
}

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

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

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


int k;

int main(){
	cin >> k;
	
	cout << (k/2)*(k/2+(k%2)) << endl;
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())
nums = [None] * n

for i in range(n):
    nums[i] = int(input())
sorted_nums = sorted(nums)

for i in range(n):
    max_val = sorted_nums[n - 1]
    if nums[i] == max_val:
        max_val = sorted_nums[n - 2]
    print(max_val)


Measured memory_bytes: 14140
#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define sz(a) int(a.size())
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
#define lson l,mid,p<<1
#define ll long long
#define pb push_back
#define mp make_pair
#define se second
#define fi first
using namespace std;
const double eps=1e-8;
const int mod=1e9+7;
const int N=1e5+10;
const int inf=1e9;

int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;

long double pi = acos(-1);

#define MOD 1000000007LL

int main()
{
    ll n, k;
    cin >> n >> k;
    
    ll sum = 0;
    for(ll i = k; i <= n + 1; i++) {
        sum +=  ((n + (n - i + 1)) * i / 2) - (((i - 1) * i) / 2) + 1;
        //cerr << (n + (n - i + 1)) * i / 2 << " : "<< ((i - 1) * i) / 2 << endl;
        sum %= MOD;
        //cerr << sum << endl;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
typedef long long ll;

int main(){
  int c1, c5, c10, c50, c100, c500, sum;
  cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;
  sum = c1 + c5*5 + c10*10 + c50*50 + c100*100 + c500*500;
  if (sum >= 1000) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 3096
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef vector<int>     Vi;
typedef vector<ll>      Vl;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD1    = 1000000007;
constexpr ll MOD2   = 998244353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define psb push_back
#define epb emplace_back
#define psf push_front
#define mkp make_pair
#define fst first
#define scd second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define repbit(bit, n)  for(int bit = 0; (bit) < (1 << (n)); ++(bit))
#define ifbit(bit, i)   if((bit) & (1 << (i)))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main(int argc, char *argv[]) {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    string s; cin >> s;
    vector<char> c;
    rep(i, (int)s.length()){
        c.psb(s[i]);
    }
    if(c.size() == 2){
        cout << s << endl;
        return 0;
    }
    else{
        reverse(all(c));
        for(auto x : c){
            cout << x;
        }
        cout << endl;
        return 0;
    }

return 0;
}

Measured memory_bytes: 3672
N,M,C = map(int, input().split())
B = tuple(map(int,input().split()))
A = []
for i in range(N):
    A.append(tuple(map(int,input().split())))

ans = 0
for i in A:
    judge = 0
    for j in range(M):
        judge += i[j]*B[j]
    judge += C
    if judge > 0:
        ans += 1
print(ans)


Measured memory_bytes: 9188
#include <cstdio>
using namespace std;
int main(void){
  int h,m,s;
  int h1,m1,s1,h2,m2,s2;
  while(~scanf("%d %d %d %d %d %d",&h1,&m1,&s1,&h2,&m2,&s2)){
    s=(s2+m2*60+h2*3600)-(s1+m1*60+h1*3600);
    h=s/3600;m=s%3600/60;s=s%60;
    printf("%d %d %d\n",h,m,s);
  }
  return 0;
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
//long long int countt[200003];
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds; //necessary for the GNU based Policy based data structures.
typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define int long long
#define endl "\n"

signed main()
{
    FAST;
    
    int i=0,j=0,k=0,n=0,m=0,count=0,temp=0;
    int temp1=0,temp2=0,temp3=0,x=0,l=0,y=0,sum=0;
    int left=0,up=0,anss=0,start=0,end=0,r=0,qq=0,total=0;
    int maxx=0,minn=0,curr=0,ans=0,places=0,zeroes=0,low=0,high=0;
    int prev=0,mid=0,z=0,d=0,val=0,pos=0,shift=0,h=0,right=0,var=0;
    int reqd=0;
    
    cin>>n>>m;
    int a[m];
    for(i=0;i<m;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    
    if(sum>n) cout<<-1<<endl;
    else cout<<n-sum<<endl;
    
    
    
    
}

Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define LI list<int>
#define vct vector
#define vi vct<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vvi vct<vi>
#define vll vct<ll>
#define vvll vct<vll>
#define vpii vct<pii>
#define vpll vct<pll>
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ff first
#define ss second
#define bg begin()
#define ft cout<<"for test"<<endl;
#define read(v,a,n) for(int i=a; i<n; i++)cin>>v[i];
#define PI 2*acos(0.0)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define t_c int test,cs=1;cin>>test;while(test--)
///................Graph's Move.................
///const int dx[] = {+1,-1,+0,+0}; ///Rock's Move
///const int dy[] = {+0,+0,+1,-1}; ///Rock's Move
///const int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move
///const int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int dx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's Move
///const int dy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's Move
///*.....................-_-........................*///
int main()
{
    FIO;
    ///freopen("in.txt","r",stdin);
    ///freopen("output.txt","w",stdout);
    int i;
    int n,x;
    cin>>x>>n;
    vi v(n);
    read(v,0,n);
    vi cnt(102);
    for(i=0; i<n; i++)
        cnt[v[i]]=1;
    vi ans;
    for(i=0; i<=101; i++)
        if(!cnt[i])ans.pb(i);
    int jjj=101,jj;
    for(i=0; i<ans.size(); i++)
    {
        if(abs(x-ans[i])<jjj)
        {
            jjj=abs(ans[i]-x);
            jj=ans[i];
        }
    }
    cout<<jj<<endl;
    return 0;
}


Measured memory_bytes: 3656
# -*- coding: utf-8 -*-
N = int(input())
A_list = list(map(int, input().split()))

ans = "APPROVED"
for i in range(N):
    now_num = A_list[i]
    if now_num % 2 == 0:
        if now_num % 3 != 0 and now_num % 5 != 0:
            ans = "DENIED"
            break

print(ans)

Measured memory_bytes: 2940
import sys
n,k=map(int,input().split())
w=list(map(int,sys.stdin.readlines()))
def f():
 c=t=0
 for j in w:
  t+=j
  if t>m:
   t=j
   c+=1
   if c>=k:return 0
 return 1
l,r=max(w),sum(w)
while l<r:
 m=(l+r)//2
 if f():r=m
 else:l=m+1
print(r)


Measured memory_bytes: 15828
/*
  AtCoder Beginner Contest 092
  B - Chocolate
*/

#include<iostream>
using namespace std;

int N, D, X;
int A;

int main() {
  scanf("%d%d%d", &N, &D, &X);

  int count = X;
  for (int i = 0; i < N; ++i) {
    scanf("%d", &A);
    count += (D - 1) / A + 1;
  }

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

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

int main(){
  string s;
  cin >> s;
  if(s[2] == s[3] && s[4] == s[5]){
    puts("Yes");
    return 0;
  }
  puts("No");
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

int a[100];

signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int2(k, t);
    scn(t, a);

    int ma = 0;
    rep(i, t)ma = max(ma, a[i]);
    if((k + 1) / 2 >= ma){
      pri(0);
    }else{
      int x = ma - ((k + 1) / 2);
      x = x * 2 - 1;
      pri(x);
    }


/*/

//*/ break;
  }
  return 0;
}


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

using namespace std;


signed main(){
    int N;cin >> N;
    vector<int> vec;
    for(int i = 0;i < N;i++){
        int b;cin >> b;
        vec.push_back(b);
    }
    map<int, int> mp1;
    set<int> s;
    map<int, int> mp2;
    vector<int> ans;
    for(int i = 0;i < N;i++){
        int j = N - i - 1;
        mp1[vec.at(i)]++;
        mp2[vec.at(j)]++;
        if(mp1[vec.at(i)] != mp2[vec.at(i)]){
            s.insert(vec.at(i));
        }else{
            s.erase(vec.at(i));
        }
        if(mp1[vec.at(j)] != mp2[vec.at(j)]){
            s.insert(vec.at(j));
        }else{
            s.erase(vec.at(j));
        }
        //cout<<s.size()<<endl;
        if(s.empty()){
            ans.push_back(i+1);
        }
    }
    for(int i = 0;i < ans.size();i++){
        cout<<ans.at(i)<<(i == ans.size() -1 ? "" : " ");
    }
    cout<<endl;
}



Measured memory_bytes: 8824
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		
		ArrayList<Integer>Array= new ArrayList<Integer>();
		
		for(int i=1;i<10;i++) {
			for(int j=1;j<10;j++) {
			Array.add(i*j);
			}
		}
		
		if(Array.contains(n)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
}

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

#define N 100
#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
  long long ans, acc[N+1][N+1];
  int n;
  
  cin >> n;
  for (int i=0; i<=n; i++) acc[i][0] = acc[0][i] = 0;
  for (int i=0; i<n; i++){
    for (int j=0; j<n; j++){
      int t; cin >> t;
      acc[j+1][i+1] = t + acc[j][i+1] + acc[j+1][i] - acc[j][i];
    }
  }
  ans = -(1<<30);
  for (int xr=0; xr<n; xr++){
    for (int xl=0; xl<=xr; xl++){
      for (int yb=0; yb<n; yb++){
        for (int ya=0; ya<=yb; ya++){
          int sum;
          sum = acc[xr+1][yb+1] + acc[xl][ya]
            - acc[xl][yb+1] - acc[xr+1][ya];
          ans = MAX(ans, sum);
//          cout << "(" << xl << "," << ya << ") - ";
//          cout << "(" << xr << "," << yb << ") = " << sum << endl;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3176
object Main{
    def main(args: Array[String]): Unit ={
        var in = scala.io.StdIn.readLine().split(" ").map(_.toInt)
        if(in(2) - in(4) < 0
           || in(2) + in(4) > in(0)
           || in(3) + in(4) > in(1)
           || in(3) - in(4) < 0
           )
        println("No")
        else println("Yes")
    }
}

Measured memory_bytes: 43676
from math import factorial
def C(a,b):
    return (factorial(a)//factorial(b))//factorial(a-b)
N,K=map(int,input().split())
MOD=10**9+7
for i in range(1,K+1):
    if N-K+1>=i:print((C(N-K+1,i)*(C(K-1,i-1)))%MOD)
    else:print(0)

Measured memory_bytes: 3316
K = int(input())
n7 = 7
# もしそのような倍数が存在するとしたらK項よりも必ず少ないというクソみたいな仮定をおいてみる
for i in range(1,10**6+10):
    if n7<K:
        n7 = n7 * 10 + 7
        continue
    m = n7 % K
    if m == 0:
        print(i)
        exit()
    n7=m*10+7
print('-1')

Measured memory_bytes: 9172
# 早くなるおまじない
import sys
input = sys.stdin.buffer.readline

# 再帰関数の呼び出し制限
sys.setrecursionlimit(3 * 10 ** 5)

# 深さが一つ前のやつのresの値を足す
# dfsはおk，ここで累積和を使う発想が出てこなかった
# def dfs(node, prev):
#     visited.add(node)
#     if prev != 0:
#         res[node-1] += res[prev-1]
#     for i in dic[node]:
#         if i not in visited:
#             prev = node
#             dfs(i, prev)

def dfs(node, prev, visited, res, dic):
    visited.add(node)
    if prev != 0:
        res[node-1] += res[prev-1]
    for i in dic[node]:
        if i not in visited:
            prev = node
            dfs(i, prev, visited, res, dic)


def main():
    n,q = map(int,input().split())

    dic = {}
    for i in range(n-1):
        aa, bb = map(int,input().split())

        if aa not in dic:
            dic[aa] = set()
            dic[aa].add(bb)
        else:
            dic[aa].add(bb)

        if bb not in dic:
            dic[bb] = set()
            dic[bb].add(aa)
        else:
            dic[bb].add(aa)


    p = []
    x = []
    for _ in range(q):
        s, t = map(int,input().split())
        p.append(s)
        x.append(t)

    res = [0]*n
    for i in range(q):
        res[p[i]-1] += x[i]

    visited = set()

    dfs(1, 0, visited, res, dic)
    print(*res, sep=" ")

if __name__ == '__main__':
    main()

Measured memory_bytes: 305756
#include<cstdio>
#include<algorithm>
using namespace std;
inline int read()
{
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
	return x;
}
#define MN 100000
int a[MN+5];
int main()
{
	int n,m,i;
	n=read();m=read();
	for(i=1;i<=m;++i)a[i]=read();
	for(i=2;i<m;++i)if(a[i]&1)
		if(a[1]&1)
			if(a[m]&1)return 0*puts("Impossible");
			else swap(a[i],a[m]);
		else swap(a[1],a[i]);
	for(i=1;i<=m;++i)printf("%d ",a[i]);puts("");
	if(m==1){if(a[1]==1)puts("1\n1");else printf("2\n%d %d",a[1]-1,1);return 0;}
	printf("%d\n",m-(a[1]<2));
	if(a[1]>1)printf("%d ",a[1]-1);
	for(i=2;i<m;++i)printf("%d ",a[i]);printf("%d",a[m]+1);
}

Measured memory_bytes: 128
var
  n,a,b,i,j,s,sum:longint;
begin
  readln(n,a,b);
  for i:=1 to n do
    begin
      j:=i; s:=0;
      while j>0 do
        begin
          s:=s+j mod 10;
          j:=j div 10;
        end;
      if (s>=a) and (s<=b) then sum:=sum+i;
    end;
  write(sum);
end.


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

const int MOD = 1000000007;


int main(){
    
    int N; cin >> N;
    vector<int> p(N);
    rep(i,N) cin >> p[i];

    int ans = 0;
    rep(i,N){
        if (p[i] == (i+1)){
            int tmp = p[i];
            p[i] = p[i+1];
            p[i+1] = tmp;
            ans++;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 3764
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int len_s = s.length();
    if(t.length() - s.length() == 1 && s.equals(t.substring(0, s.length()))){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 35576
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a;
for (int i=0;i<a;i++)
{
cin>>b;
if (b%2==0&&b%3&&b%5)
{
cout<<"DENIED"<<endl;
return 0;
}
}
cout<<"APPROVED"<<endl;
return 0;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>; using vi2 = vector<vi>;
#define loopi(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define loop(i, n) for (int i = 0; i < (int)n; i++)
#define loopeq(i, n) for (int i = 0; i <= (int)n; i++)
#define loopll(i, n) for (ll i = 0; i < (ll)n; i++)

class uftree {
	vector<int> par;
	vector<int> rank;
	
public:
    vector<int> hs;
	// 初期化
	uftree(int n, vi _hs) : par(n), rank(n) {
		for (int i = 0; i < n; i++) {
			par[i] = i;
			rank[i] = 0;
		}
        hs = _hs;
	}

	// xが属する集合のroot要素を返す
	int find(int x) {
		if (par[x] == x) return x;
		return par[x] = find(par[x]); // 経路圧縮
	}

	// xとyの木を併合
	void unite(int x, int y) {
		int rx = find(x);
		int ry = find(y);
		if (rx == ry) return;
		if (rank[rx] < rank[ry]) { 
            par[rx] = ry;
            hs[rx] = max(hs[rx], hs[ry]);
            hs[ry] = max(hs[rx], hs[ry]);
        }
		else { // ランク付けによる併合方向付け
			par[ry] = rx;
            hs[rx] = max(hs[rx], hs[ry]);
            hs[ry] = max(hs[rx], hs[ry]);
			if (rank[rx] == rank[ry]) rank[rx]++;
		}
	}

	// xとyが同じ集合に属するかを判定
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

int main() {
    int n, m; cin >> n >> m;
    vi hs(n, 0);
    vector<vector<int> > graph(n);
    loop(i, n) cin >> hs[i];
    loop(i, m) {
        int a, b; cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    int sum = n;
    loop(i, n) {
        loop(j, graph[i].size()) {
            if (hs[i] <= hs[graph[i][j]]) {
                sum--; break;
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 8736
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val rate = sc.nextInt() match {
    case i if i < 600 => 8
    case i if i < 800 => 7
    case i if i < 1000 => 6
    case i if i < 1200 => 5
    case i if i < 1400 => 4
    case i if i < 1600 => 3
    case i if i < 1800 => 2
    case _ => 1
  }
  println(rate)
}


Measured memory_bytes: 55440
#include <stdio.h>

int main(void){
  int n,i,j,p;
  scanf("%d",&n);
  
  for( i=0; i<= n/4; i++) for( j=0; j<= n/7; j++){
    if( 4*i+7*j == n ){
      printf("Yes\n");
      return 0;
    }
  }
  
  printf("No\n");
  
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e7) + 5;
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
string dir[] = {"R", "D", "L", "U"};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

int h,w;
int mi=1000,mj=1000;
string s[505], land[1005];

void dfsq(int pi, int pj){
    land[pi][pj] = '#';
    if(mi>pi){
        mi = pi;
        mj = pj;
    }
    if(mi==pi && mj>pj) mj = pj;
    REP(k,4){
        int ni = pi+di[k], nj = pj+dj[k];
        string res;
        if(land[ni][nj] == '#')continue;
        //cout << "? " << dir[k] << endl;
        printf("? %s\n",dir[k].c_str());
        cout << flush;
        cin >> res;
        if(res == "YES"){
            
            if(land[ni][nj] != '#'){
                land[ni][nj] = '#';
                dfsq(ni,nj);
            }
            //cout << "? " << dir[(k+2)%4] << endl;
            printf("? %s\n",dir[(k+2)%4].c_str());
            cout << flush;
            cin >> res;
        }
    }
}

bool visited[505][505]{};

bool dfss(int pi, int pj, int ai, int aj){
    
    REP(k,4){
        int ni = pi+di[k], nj = pj+dj[k];
        if(s[ni][nj] != land[ni+mi-ai][nj+mj-aj])
            return false;
        if(s[ni][nj] == '#' && !visited[ni][nj]){
            visited[ni][nj] = true;
            if(!dfss(ni,nj,ai,aj))return false;
        }
    }
    return true;
}

void dfsc(int pi, int pj){
    s[pi][pj] = '.';
    REP(k,4){
        int ni = pi+di[k], nj = pj+dj[k];
        if(s[ni][nj] == '#'){
            dfsc(ni,nj);
        }
    }
}

void search(){
    REP(i,h){
        REP(j,w){
            if(s[i][j] == '#'){
                if(!dfss(i,j,i,j)){
                    dfsc(i,j);
                }
                else{
                    cout << "! " << i+500-mi << " " << j+500-mj << endl;
                    return;
                }
            }
        }
    }
}


int main() {
    cin >> h >> w;
    REP(i,h)cin >> s[i];
    REP(i,1005)REP(j,1005)land[i].push_back('.');
    dfsq(500,500);
    /*
    REP(i,1000){
        REP(j,1000){
            if(land[i][j] == '#')cout << i << ' ' << j << endl;
        }
    }
    */
    search();
    return 0;
}



Measured memory_bytes: 42556
#include<bits/stdc++.h>
using namespace std;
int main(){
  int K,S;cin>>K>>S;
  int count=0;
  for(int X=0;X<=K;X++){
    for(int Y=0;Y<=K;Y++){
      if(X+Y<=S && S<=X+Y+K)count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
A = list(map(int, input().split()))

Town = []
#まだ訪れていない町は-1
rec = [-1] * (n+1)
idx = 1
#周期までループをまわす
while (rec[idx] == -1):
    rec[idx] = len(Town)
    Town.append(idx)
    idx = A[idx-1]

#周期前
Exce = rec[idx]
#周期内
Cycl = len(Town) - Exce

if Exce > k:
    print(Town[k])
else:
    Warp = (k - Exce) % Cycl
    print(Town[Exce+Warp])

Measured memory_bytes: 32360
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;


/* TEMPLATE ENDS HERE */

#define MAXN (1 << 20)

int p[MAXN];
int a[MAXN];
int n;
int s[MAXN];

int gcd(int a, int b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

int main() {
	cout << fixed << setprecision(12);	
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		s[a[i]]++;
	}
	for (int i = 2; i < MAXN; i++) {
		p[i] = 1;
	}
	for (int i = 2; i < MAXN; i++) {
		if (p[i]) {
			for (int j = 2 * i; j < MAXN; j += i) {
				p[j] = 0;
			}
		}
	}
	bool pw = true;
	for (int i = 2; i < MAXN; i++) {
		int cnt = 0;
		if (p[i]) {
			for (int j = i; j < MAXN; j += i) {
				cnt += s[j];
			}
		}
		if (cnt > 1) {
			pw = false;
		}
	}
	
	int ret = a[0];
	for (int i = 1; i < n; i++) {
		ret = gcd(ret, a[i]);
	}
	bool sw = (ret == 1);
	
	if (sw && !pw) {
		cout << "setwise coprime" << endl;
	} else if (pw) {
		cout << "pairwise coprime" << endl;
	} else if (!sw && !pw) {
		cout << "not coprime" << endl;
	}

	return 0;
}


ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
		x %= MOD;
	}
	
	mod& operator=(const ll & tx) {
		x = tx % MOD;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return mod((x + m2.x) % MOD);
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return mod((x - m2.x + MOD) % MOD);
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return mod((x * m2.x) % MOD);
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return (*this) * m2.inv();
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}



Measured memory_bytes: 15376
#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{
    int n,tmp;
    int i;
    int a[4];
    char c[3];
    int sum = 0;

    scanf("%d", &n);
    
    tmp = n;

    for (i = 0; i < 4; i++) {
        a[i] = tmp % 10;
        tmp = tmp / 10;
    }

    for (i = 0; i < 2; i++) {
        int dum = a[i];
        a[i] = a[3 - i];
        a[3 - i] = dum;
    }

    for (int bits = 0; bits < (1 << 3); bits++) {
        sum = a[0];
        for (i = 0; i < 3; i++) {
            if (bits & (1 << i)) {
                sum += a[i + 1];
                c[i] = '+';
            }
            else {
                sum -= a[i + 1];
                c[i] = '-';
            }
        }
        if (sum == 7)
            break;
    }


    printf("%d%c%d%c%d%c%d=7", a[0],c[0],a[1],c[1],a[2],c[2],a[3]);

    return 0;
}

Measured memory_bytes: 2152
import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.IArray             as IA
import qualified Data.Array.IO                 as AI
import qualified Data.Array.MArray             as MA
import qualified Data.Array.ST                 as STA
import qualified Data.Array.Unboxed            as AU
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import qualified Data.Graph                    as G
import           Data.Int
import qualified Data.IntMap                   as IM
import qualified Data.IntSet                   as IS
import           Data.List
import qualified Data.Map.Strict               as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Sequence                 as SQ
import qualified Data.Set                      as S
import           Data.Time
import qualified Data.Tree                     as T
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readInt :: IO Int
readInt = fst . fromJust . BS.readInt <$> BS.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readIntLists :: Int -> IO [[Int]]
readIntLists n = replicateM n readInts

readInteger :: IO Integer
readInteger = fst . fromJust . BS.readInteger <$> BS.getLine

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegerLists :: Int -> IO [[Integer]]
readIntegerLists n = replicateM n readIntegers

readStrings :: IO [String]
readStrings = map BS.unpack . BS.words <$> BS.getLine

readStringLists :: Int -> IO [[String]]
readStringLists n = replicateM n <$> readStrings

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

put :: Show a => a -> IO ()
put = putStr . show

putList :: Show a => [a] -> IO ()
putList [n     ] = print n
putList (n : ns) = do
  put n
  putStr " "
  putList ns

putStrList :: [String] -> IO ()
putStrList [n     ] = putStrLn n
putStrList (n : ns) = do
  putStr n
  putStr " "
  putStrList ns

yesNoUpper b | b         = putStrLn "YES"
             | otherwise = putStrLn "NO"

yesNo b | b         = putStrLn "Yes"
        | otherwise = putStrLn "No"

divCeiling x n | b == 0    = a
               | otherwise = a + 1
  where (a, b) = x `divMod` n

main = do
  n  <- readInt
  ps <- readInts
  print $ f ps [1 ..] 0

f [] _ acc = acc
f [a] (n : ns) acc | a == n    = acc + 1
                   | otherwise = acc
f (a : b : ps) (n : n' : ns) acc | a == n && b == n' = f ps ns (acc + 1)
                                 | a == n = f (b : ps) (n' : ns) (acc + 1)
                                 | otherwise = f (b : ps) (n' : ns) acc


Measured memory_bytes: 2172
#include<stdio.h>


int main(){
  int N, K;
  int work;
  int a[100000];
  int i;
  scanf("%d %d", &N, &K);
  for(i = 0; i<N; i++){
    scanf("%d", &a[i]);
  }
  if(N<=K){
    printf("1\n");
  }else if(N > K){
    work = (N-K)/(K-1);
    if((N-K)%(K-1) != 0){
      work += 1;
    }
    printf("%d\n", work +1);
  }
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<cstdio>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(int i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep0(i,n) REP(i,0,n-1)
#define repG(i,x) for(int i=pos[x];~i;i=e[i].next)
#define ll long long
#define db double
const int N=1e5+7;
const int INF=1e9+7;
int n,k;
int x[N];

int main(){
	scanf("%d%d",&n,&k);
	rep(i,n)scanf("%d",&x[i]);
	int ans=INF;
	rep(i,n-k+1){
		int L=x[i],R=x[i+k-1];
		if(L<0&&R>0){
			L=-L;
			ans=min(ans,min(L,R)+L+R);
		}
		else{
			if(L<0)ans=min(ans,-L);
			else ans=min(ans,R);
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  map<char,ll> M;
  ll N; cin>>N>>M['A']>>M['B']>>M['C'];
  if(M['A']+M['B']+M['C']==0){
    cout<<"No"<<endl; return 0;
  }
  vector<string> Z(N+1,"xx");
  vector<char> ans(0,0);
  bool out=false;
  for(int i=0; i<N; i++) cin>>Z[i];
  for(int i=0; i<N; i++){
    char x=Z[i][0], y=Z[i][1];
    char xx=Z[i+1][0], yy=Z[i+1][1];
    if(M[x]==0 && M[y]==0){
      out=true;
      break;
    }
    else if(M[x]==0) M[x]++, M[y]--, ans.emplace_back(x);
    else if(M[y]==0) M[x]--, M[y]++, ans.emplace_back(y);
    else if(M[x]==1 && M[y]==1){
      if(xx=='x') ans.emplace_back(x);//おしまい
      else if(x==xx || x==yy) M[x]++, M[y]--, ans.emplace_back(x);
      else if(y==xx || y==yy) M[x]--, M[y]++, ans.emplace_back(y);
    }
    else{
      if(M[x]>=M[y]) M[x]--,M[y]++,ans.emplace_back(y);
      else M[x]++,M[y]--,ans.emplace_back(x);
    }
  }
  ll asz=ans.size();
  if(out) cout<<"No"<<endl;
  else{
    cout<<"Yes"<<endl;
    for(int i=0; i<asz; i++) cout<<ans[i]<<endl;
  }
}


Measured memory_bytes: 6744
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long s,x,y;
  cin >> s;
  const int c=1000000000;
  x=(c-s%c)%c;
  y=(s+x)/c;
  cout << "0 0 1000000000 1 " << x << " " << y << endl;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007
ll fac[1000000];
ll finv[1000000];
ll inv[1000000];

void comb_init(){
  fac[0] = 1;
  for(int i=1;i<1000000;i++){
    fac[i] = i*fac[i-1];
    fac[i] %= MOD;
  }
  inv[1] = 1;
  for(int i=2;i<1000000;i++){
    inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
  }
  finv[0] = 1;
  for(int i=1;i<1000000;i++){
    finv[i] = inv[i]*finv[i-1];
    finv[i] %= MOD;
  }
}

ll comb(ll n,ll k){
  ll c = fac[n];
  c *= finv[k];c %= MOD;
  c *= finv[n-k];c %= MOD;
  return c;
}
int main(){
  ll n;
  cin >> n;
  ll a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  ll b[n+1];
  b[0] = 0;
  for(int i=0;i<n;i++) b[i+1] = b[i]+a[i];
  ll ans = 1000000000000000000;
  ll temp;
  for(int i=0;i<n+1;i++){
    temp = abs((b[n]-b[i])-b[i]);
    ans = min(ans,temp);
  }
  cout << ans << endl;


  return 0;
}


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

void fanc(int n, int level, pair<double, double> l, pair<double, double> r){
	if(level == n){
		printf("%.8f %.8f\n", l.first, l.second);
		return;
	}
	pair<double, double> s, t, u;
	s.first = (2.*l.first + r.first)/3;
	s.second = (2.*l.second + r.second)/3;
	fanc(n, level+1, l, s);
	
	t.first = (l.first + 2.*r.first)/3;
	t.second = (l.second + 2.*r.second)/3;
	
	
	double pi = acos(-1);
	double d60 = pi/3;
	u.first = s.first + (t.first-s.first)*cos(d60) - (t.second - s.second)*sin(d60);
	u.second = s.second + (t.first - s.first)*sin(d60) + (t.second - s.second)*cos(d60);
	fanc(n, level+1, s, u);
	fanc(n, level+1, u, t);
	fanc(n, level+1, t, r);
}

int main(){
	int n;
	cin >> n;
	pair<double, double> l(0, 0), r(100, 0);
	fanc(n, 0, l, r);
	printf("%.8f %.8f\n", r.first, r.second);
	return 0;
}


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

int main(){
	int W, H;
	string o = "";
	while (true){
		cin >> H >> W;
		if (W == 0 && H == 0){
			break;
		}
		for (int i = 0; i < H; i++){
			for (int j = 0; j < W; j++){
				o += ((i+j)%2==0) ? "#" : ".";
			}
			o += "\n";
		}
		o += "\n";
	}
	cout << o;
}

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

int b()
{
    long long n;
    std::cin >> n;
    
    long long year = 0;
    long long money = 100;
    while(1)
    {
        year++;
        money *= 1.01;
        if(n <= money)
        {
            break;
        }
    }
    
    std::cout << year << std::endl;
    
    return 0;
}

int main(int argc, const char * argv[])
{
    b();
    return 0;
}


Measured memory_bytes: 3620