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

using namespace std;

int main(){
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int ans = 0;
  for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
      for(int k=0;k<=c;k++){
        if(x == (i*500 + j*100 + k*50)) ans++;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
n,t[999];
int main(i){for(;n*=scanf("%d",&n);puts("")){
    for(i=999;t[--i]=i;);
    for(;n--;t[i]=*t)scanf(" %c %c",&i,t);
    for(scanf("%d",&n);n--;putchar(t[i]))scanf(" %c",&i);
  }
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define   pr pair<int,int>
using namespace std::chrono;
const int N = 1e5+4 , M=N,inf=(int)1e9;
const ll mod=1e9+7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
int ans ;
map< pair<int,int> , int > mp;
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
void solve(){
    int a , b , t ;
    cin >> a >> b >> t ;
    int r = t / a ;
    cout << b*r ;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
    //cin >> q;
    while(q--)
        solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repri(i, a, b) for(int i=int(a); i>=int(b); i--)
#define _reps(i,n) repsi(i,1,n)
#define repsi(i,a,b) for(int i=a;i<=int(b);++i)
#define reps(...) _overload3(__VA_ARGS__,repsi,_reps,)(__VA_ARGS__)
#define repr(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define reprs(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define LF "\n"

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

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;
typedef vector<int> VI;
typedef vector<ll> VL;

int N, A, B, C, D;
string S;

int check(int a, int b) {
  rep(i,a,b) {
    if (S[i] == '#' && S[i + 1] == '#') {
      return 0;
    }
  }
  reps(i,a,b) {
    if (i - 1 >= 0 && i + 1 < N && S[i - 1] == '.' && S[i] == '.' && S[i + 1] == '.') {
      return 2;
    }
  }
  return 1;
}

void Main() {
	cin >> N >> A >> B >> C >> D >> S;
	A--;B--;C--;D--;

	int snk = check(A, C);
	int fnk = check(B, D);

	if (snk == 0 || fnk == 0) {
		puts("No");
		return;
	}
 
	if (C > D) {
		puts(fnk == 2 ? "Yes" : "No");
	} else {
		puts("Yes");
	}

	return;
}

int main(){
	FAST;
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

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

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> hoge(n);
    for(int i=0;i<n;i++) cin>>hoge.at(i);
    int ans=0;
    
    while(true){
        bool ok=true;
        for(int i=0;i<n;i++) {if(hoge.at(i)%2==1) ok=false;}
        if(!ok) break;
        
        for(int i=0;i<n;i++) hoge.at(i)/=2;
        
        ans++;
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

int main() {
    int n, q;
    cin >> n >> q;
    vector<pair<P, int>> v;
    for (int i = 0; i < n; ++i) {
        int s, t, x;
        cin >> s >> t >> x;
        v.push_back({ { s - x, 1 }, x });
        v.push_back({ { t - x, -1 }, x });
    }
    sort(v.begin(), v.end());
    set<int> se;
    int j = 0;
    for (int i = 0; i < q; ++i) {
        int d;
        cin >> d;
        while (j < v.size() && v[j].first.first <= d) {
            if (v[j].first.second == 1) {
                se.insert(v[j].second);
            }
            else {
                se.erase(v[j].second);
            }
            ++j;
        }
        if (se.size())
            cout << *se.begin() << '\n';
        else
            cout << "-1\n";
    }

    return 0;
}


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

int main() {
	int a, b;
  cin  >>a >>b;
  if (a+b  >= a-b && a+b   >= a*b){
    cout<< a+b;
  } else if (a-b >= a*b) {
    cout<<a-b;
  } else {
    cout << a*b;
  }
  
	return 0;
}


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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

typedef unsigned long long LL;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL N;
	string s, t;
	cin >> N;
	cin >> s;
	cin >> t;

	int w = 0;
	for(w=0; w<N; w++){
		int match = 1;
		for(int i=0; i<t.size() - w; i++){
			if(s[w+i] != t[i]){
				match = 0;
				break;
			}
		}
		if(match == 1){
			break;
		}
	}
	printf("%lld\n", N+w);
	return 0;
}

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

int main() {
	int x,y;
	cin >> x >> y;
	bool flag =false;
	for(int i=0;i<=x;i++){
		if(i*2+(x-i)*4==y) flag=true;
	}
	if(flag) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 3632
n,m,k = map(int,input().split())
frag=list(range(n+1))

def takefrag(p):
    stock=[]
    while frag[frag[p]]!=frag[p]:
        stock.append(p)
        p=frag[p]
    p=frag[p]
    for i in stock:
        frag[i]=p
    return p
    
ans=[-1]*(n+1)
for i in range(m):
    a,b = map(int,input().split())
    ans[a]-=1
    ans[b]-=1
    a,b = takefrag(a),takefrag(b)
    a,b = min(a,b),max(a,b)
    frag[a]=b

fragteam=[0]*(n+1)
for i in range(n+1):
    frag[i]=takefrag(i)
    fragteam[frag[i]]+=1
for i in range(k):
    a,b = map(int,input().split())
    if frag[a]==frag[b]:
        ans[a]-=1
        ans[b]-=1
for i in range(n+1):
    ans[i]+=fragteam[frag[i]]
for i in ans[1:-1]:
    print(i,end=" ")
print(ans[-1])

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

#define ll long long
#define MAX 100105

const ll INF = 1LL << 60;

int N;
ll a[MAX];
ll b[MAX];
ll c[MAX];
ll dp[MAX][3];

int main() {
    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }

    for(int i = 0; i < MAX; i++) {
        for(int j = 0; j < 3; j++) {
            dp[i][j] = 0;
        }
    }

    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for(int i = 0; i < N; i++) {
        dp[i + 1][0] = a[i + 1] + max(dp[i][1], dp[i][2]);
        dp[i + 1][1] = b[i + 1] + max(dp[i][0], dp[i][2]);
        dp[i + 1][2] = c[i + 1] + max(dp[i][0], dp[i][1]);
    }

    // cout << endl;
    // for(int i = 0; i < N; i++) {
    //     for(int j = 0; j < 3; j++) {
    //         if(j)
    //             cout << " ";
    //         cout << dp[i][j];
    //     }
    //     cout << endl;
    // }

    printf("%lld\n", max(dp[N][0], max(dp[N][1], dp[N][2])));
}

Measured memory_bytes: 4992
package main

import "fmt"

func main() {
	var S string
	fmt.Scan(&S)

	x := make(map[rune]bool)
	y := make(map[rune]bool)

	for _, v := range S {
		switch rune(v) {
		case 'N', 'S':
			y[v] = true
		case 'W', 'E':
			x[v] = true
		}
	}

	if len(x)%2 == 0 && len(y)%2 == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<cstdio>

const int maxn=1e5+5;

const int INF=1<<30;

int cost[maxn];

int dp[maxn];

int min(int a,int b) { return a>b?b:a; }

int get_value(int,int);

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

	for(int i=1;i<=n;i++){

		scanf("%d",&cost[i]);
	}
	
	for(int i=0;i<=maxn-3;i++){
	
		dp[i]=INF;
	}

	dp[1]=0; dp[2]=get_value(1,2);

	for(int i=3;i<=n;i++){
	
		for(int k=1; i-k>=1 && k<=step ; k++){
	
			dp[i]=min(dp[i],dp[i-k]+get_value(i,i-k));
		}
	}

	printf("%d\n",dp[n]);

	return 0;
}

int get_value(int a,int b){
	
	int value=cost[a]-cost[b];

	return value>0?value:((-1)*value);
}



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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int L = A + B, R = C + D;
  cout << ((L > R) ? "Left" :
          ((L < R) ? "Right" : "Balanced")) << endl;
  return 0;
}


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

int main() {
  int n,sum=0,saisyob=0,saigoa=0,dottimo=0;
  cin >> n;
  string s[n];
  r(i,n){
    cin>>s[i];
    r(j,s[i].length()-1){
      if(s[i][j]=='A'&&s[i][j+1]=='B')sum++;
    }
    if(s[i][0]=='B'&&s[i][s[i].length()-1]=='A')dottimo++;
    else{
    if(s[i][0]=='B')saisyob++;
    if(s[i][s[i].length()-1]=='A')saigoa++;
    }
  }
  if(saisyob+saigoa==0)cout<<max(dottimo-1,0)+sum<<endl;
  else cout<<sum+dottimo+min(saisyob,saigoa)<<endl;
}

Measured memory_bytes: 768
#include<iostream>
#include<cmath>
#include<iomanip>
#define PI 3.14159265
using namespace std;

int main()
{
	double a, b, c,C,val;
	val = PI / 180.0;
	cin >> a >> b>>C;
	c = sqrt(a * a + b * b - 2 * a * b * cos(C*val));
	double S, L, h;
	S = (a * b * sin(C*val)) / 2.0;
	L = a + b + c;
	h = (2 * S) / a;
	cout << setprecision(8) << fixed
		<< S << endl
		<< L << endl
		<< h << endl;
}


Measured memory_bytes: 3368
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;

const ld pi = 3.141592653589793;

string n;

int main() {
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n.size(); i++) {
    sum += n[i] % '0';
  }
  if (sum % 9 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main() {
  int a, b;
  cin >> a >> b;
  if (a <= 9 && b <= 9) {
    cout << a * b << endl;
    return 0;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, H):
    ans = 0
    hm = 0
    for h in H:
        if h >= hm:
            ans += 1
            hm = h
        
    return ans


def main():
    N = read_int()
    H = read_int_n()
    print(slv(N, H))


if __name__ == '__main__':
    main()


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

ll mod_pow(ll x, ll n){
    ll ans = 1;
    while(n){
        if(n & 1) ans = ans*x;
        x = x*x;
        n >>= 1;
    }
    return ans;
}

int main(){
    int n, k; cin >> n >> k;

    double ans = 0.0;
    loop(i, 1, n+1){
        int point = i;
        int cnt = 0;
        while(point < k){
            point *= 2;
            cnt++;
        }
        ans += 1.0/double(n*mod_pow(2, cnt));
    }
    printf("%.10lf\n", ans);

    return 0;
}

Measured memory_bytes: 256
use proconio::input;

const RGB: [char; 3] = ['R', 'G', 'B'];

fn main() {
    input! {
        n: i64,
        s: String,
    }
    let s: Vec<char> = s.chars().collect();

    let mut rgb: Vec<Vec<i64>> = vec![vec![0; n as usize + 1]; 3];

    for (j, c) in s.iter().enumerate() {
        for i in 0..3 {
            rgb[i][j + 1] = rgb[i][j];
            if *c == RGB[i] {
                rgb[i][j + 1] += 1;
            }
        }
    }

    let mut ans = 0;
    for mid in 0..n {
        let (l_col, m_col, r_col) = {
            let mut m_col = 0;
            for i in 0..3 {
                if s[mid as usize] == RGB[i] {
                    m_col = i;
                }
            }

            ((m_col + 2) % 3, m_col, (m_col + 1) % 3)
        };
        ans += rgb[l_col as usize][mid as usize] * (rgb[r_col as usize][n as usize] - rgb[r_col][mid as usize]);

        let (l_col, _m_col, r_col) = ((m_col + 1) % 3, m_col, (m_col + 2) % 3);

        ans += rgb[l_col as usize][mid as usize] * (rgb[r_col as usize][n as usize] - rgb[r_col as usize][mid as usize]);


        let (mut left, mut right) = (mid - 1, mid + 1);
        while 0 <= left && right < n {
            if s[left as usize] != s[mid as usize] &&
                s[right as usize] != s[mid as usize] && 
                s[left as usize] != s[right as usize] 
            {
                ans -= 1;
            }
            left -= 1;
            right += 1;
        }
    }

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


Measured memory_bytes: 2204
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll pow(ll x,ll y){
  ll res=1;
  if(y==0) return 0;
  for(int i=0;i<y;i++) res*=x;
  return res;
}
int main(){
  ll n,m;
  cin>>n>>m;
  vector<P> query;
  for(int i=0;i<m;i++){
    ll s,c;
    cin>>s>>c;
    query.push_back(P(n-s+1,c));
  }

  for(int i=pow(10,n-1);i<pow(10,n);i++){
    bool f=true;
    for(int j=0;j<m;j++){
      ll kt=query[j].first,num=query[j].second;
      ll k=i;
      for(int ina=1;ina<kt;ina++) k/=10;
      k%=10;
      if(num!=k) f=false;
      //if(i==702) cout<<k<<" "<<kt<<" "<<num<<endl;
    }
    if(f) {
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<-1<<endl;
}


Measured memory_bytes: 256
from collections import defaultdict

def main():
    N = int(input())
    MARCH = ['M','A','R','C','H']
    S = [0] * len(MARCH)
    for _ in range(N):
        s = input()
        if not s[0] in MARCH:
            continue
        if s[0] == MARCH[0]: S[0] += 1
        elif s[0] == MARCH[1]: S[1] += 1
        elif s[0] == MARCH[2]: S[2] += 1
        elif s[0] == MARCH[3]: S[3] += 1
        elif s[0] == MARCH[4]: S[4] += 1
    cnt = 0
    for i in range(len(S)-2):
        for j in range(i+1,len(S)-1):
            for k in range(j+1,len(S)):
                cnt += S[i]*S[j]*S[k]
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 44760
#include <stdio.h>
#include <iostream>

using namespace std;

int n, f[7];

int dfs(int m,int i,int j,double r){
	int k, l, ret = 0;
	if(!(int)(r * 100000000)){
/*		for(int t = 0;t < i;t++){
			printf("1 / %d ",f[t]);
			if(t != i - 1) printf("+ ");
			else printf("\n");
		}*/
		return 1;
	}
	if(i == n || r < 0)
		return 0;
	for(k = min(m,j);k >= 1;k--){
		f[i] = k;
		ret += dfs(m / k,i + 1,k,r - 1.0 / k);
	}
	return ret;
}
		
int main(void){
	int p, q, a, i, ans;
	while(1){
		scanf("%d%d%d%d",&p,&q,&a,&n);
		if(p == 0 && q == 0 && a == 0 && n == 0)
			break;
		ans = 0;
		ans = dfs(a,0,a,(double)p / q);
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    //一行ずつとってきてwhileで処理する
    string word;
    getline(cin,word);
    string text;
    int H={};
    while(1)
    {
        cin>>text;
        if(text=="END_OF_TEXT") break;
        for(int i=0;i<text.size();i++)
        {
            if(text[i]>='A'&&text[i]<='Z')text[i]+='a'-'A';
        }
        /*p=text.find(word);//これがYesならばポインタを返す
        if(p!=-1) H++;//これなら大文字小文字を区別するので一回全て小文字に変換してから検索する*/
        if(text==word)H++;
    }
    cout<<H<<endl;
    return 0;
}



Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>; // グラフ型
using pint = pair<int, int>;

int main()
{
    string S;
    cin >> S;
    if (S == "ABC")
    {
        cout << "ARC" << endl;
    }
    else
    {
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 3596
S = input()
K = int(input())
if len(set(S)) == 1:
    print(len(S) * K // 2)
    exit()

i = 0
cnt = 0
while i + 1 < len(S):
    if S[i] == S[i + 1]:
        cnt += 1
        i += 2
    else:
        i += 1

if S[0] != S[-1]:
    print(cnt * K)
else:
    i = 1
    a = 1
    prev = S[0]
    while i < len(S):
        if prev != S[i]:
            break
        else:
            a += 1
        i += 1
    prev = S[-1]
    b = 1
    i = len(S) - 2
    while 0 <= i:
        if prev != S[i]:
            break
        else:
            b += 1
        i -= 1
    print(cnt * K - (K - 1) * (a // 2 + b // 2 - (a + b) // 2))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	while(1){
		int t,p,r;
		cin >> t >> p >> r;
		if(t==0) break;
		pair<int,pair<int,int> > data[51]; //?§£????????????????????°,Penalty,TeamID		
		int WAnum[51][11];
		REP(i,51){
			REP(j,11) WAnum[i][j] = 0;
			data[i].first = p;
			data[i].second.first = 0;
			data[i].second.second = i;
		}
		REP(i,r){
			int tid,pid,tt;
			string ms;
			cin >> tid >> pid >> tt >> ms;
			tid--;
			if(ms=="WRONG"){
				WAnum[tid][pid]++;
			}else if(ms=="CORRECT"){
				data[tid].first--;
				data[tid].second.first += (WAnum[tid][pid]*1200+tt);
			}
		}
		sort(data,data+t);
		REP(i,t){
			cout << data[i].second.second+1 << " " << p-data[i].first <<" "<< data[i].second.first << endl;
		}
	}
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
 
  
int main(){
 
int  n,k;
cin>>n;
cin>>k;
 int x[n];
for(int i=0;i<n;i++){
    cin>>x[i];
}
int l,r;
 int mini= INT_MAX;
if(n==1){
    cout<<"0"; return 0;
}
for(int i=0;i<n-k+1;i++){
    l=i;
    r=i+k-1;
    int d1= abs(x[r]-x[l]) + abs(x[l]);
    int d2= abs(x[r]-x[l]) + abs(x[r]);
    mini = min(mini,min(d1,d2));
}
cout<<mini;
 
 return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long lint;
const lint INF = LLONG_MAX;
using namespace std;
int main(){
	lint n;
	cin>>n;
	vector<lint> dp(n),h(n);
	rep(i,n) cin>>h.at(i);
	rep(i,n) dp.at(i)=INF;
	rep(i,n){
		if(i==0){
			dp.at(i)=0;
			continue;
		}
		if(i==1){
			dp.at(i)=abs(h.at(i)-h.at(i-1));
			continue;
		}
		dp.at(i)=min(abs(h.at(i)-h.at(i-1))+dp.at(i-1),
			 abs(h.at(i)-h.at(i-2))+dp.at(i-2));
	}
	cout<<dp.at(n-1)<<endl;
}



Measured memory_bytes: 1792
h, w = map(int, input().split())
s = [input() for i in range(h)]
mx=[1, -1, 0, 0]
my=[0, 0, 1, -1]
vis=[[0]*w for i in range(h)]
import queue
q=queue.Queue()
ans=0
for i in range(h):
  for j in range(w):
    if vis[i][j]==0:
      white=0
      black=0
      q.put([i, j])
      vis[i][j]=1
      while not q.empty():
        y, x = q.get()
        if s[y][x]==".":
          white+=1
        else:
          black+=1
        #vis[y][x]=1
        for k in range(4):
          nx=x+mx[k]
          ny=y+my[k]
          if 0<=nx<=w-1 and 0<=ny<=h-1 and vis[ny][nx]==0:
            if s[y][x] != s[ny][nx]:
              q.put([ny, nx])
              vis[ny][nx]=1
      if white+black!=1:
        ans+=white*black
print(ans)
            
    

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

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

  vector<int> A(N);
  for(auto& x: A){
    cin >> x;
  }

  // migimawari hidarimawari
  int ans = A[N - 1] - A[0];
  for(int i = 0; i + 1 < N; i++){
    ans = min(ans, K - (A[i + 1] - A[i]));
  }

  cout << ans << endl;
}


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

int main(){
  const long long INF = 1e18 + 10;
  long long N, K; cin >> N >> K;
  int chk = 0;
  long long min = INF;
  N = N - K * (N / K);

  while (chk==0)
  {
    N = abs(N - K);
    if (N==min) chk++;
    if(N<min) min = N;
  }
  cout << min << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 10000
int isprime(int, int);
int main()
{
  int input;
  int data[N];
  int count=0;
  int  n;
  int i, j;

  scanf("%d",&n);
  for( i=0; i<n; i++ )
    {
      scanf("%d",&input);
      if( input >= 2 || input <= 10^8)
	{
	  data[i] = input;
	}
    }

  for( i = 0; i < n; i++ )
    {
      if( isprime(data[i],n) == 1 )
	{
	  count++;
	}
    }

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

int isprime(int x,int n)
{
  /*this function will return 1 for a prime number and 0 for non-prime number*/
  int i = 2;
  int tmp = 1;
  for( i = 2; i < n; i++ )
    {
      if( x <= i ) break;
      if( x == 2 )
	{
	  return 1;
	}
      else if ( x == 0)
	{
	  return 0;
	} 
      else if( x % i == 0 )
	{
	  tmp = 0;  
	}
    }
  if( tmp == 1 )
    {
      return 1;
    }
  else return 0;
}

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

int main() {
  int d,n;cin>>d>>n;
  int ans=1;
  rep(i,d)ans*=100;
  if(n==100)n++;
  cout<<ans*n<<endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k;
	cin >> k;
	queue<ll> que;
	rep(i, 9) que.emplace(i + 1);
	if (k <= 9) {
		cout << k << endl;
		return 0;
	}
	int cnt = 9;
	while (que.size()) {
		ll tmp = que.front(); que.pop();
		if (tmp % 10 != 0) {
			ll now = tmp * 10 + tmp % 10 - 1;
			que.emplace(now);
			cnt++;
			if (cnt == k) {
				cout << now << endl;
				return 0;
			}
		}
		que.emplace(tmp * 10 + tmp % 10);
		cnt++;
		if (cnt == k) {
			cout << tmp * 10 + tmp % 10 << endl;
			return 0;
		}
		if (tmp % 10 != 9) {
			ll now = tmp * 10 + tmp % 10 + 1;
			que.emplace(now);
			cnt++;
			if (cnt == k) {
				cout << now << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int a[n + 5], ans = 0;

    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n - 1; i++) ans += (a[i] < a[i + 1]);
    cout << ans << endl;

}


Measured memory_bytes: 3488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n,H,W;
    cin >> n >> H >> W;
    ll ans=0;
    for(ll i=0;i<n;i++){
        ll a,b;
        cin >> a >> b;
        if(a>=H&&b>=W)ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int K,S,ans=0;
  cin>>K>>S;
  REP(i,0,K){
    REP(j,0,K){
      if(i+j<=S&&S<=i+j+K)
        ans++;
      }
    }
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
public static void main (String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
if (a >= -1000 && a <= 1000){
if (b >= -1000 && b <= 1000){
if (a < b){
System.out.println("a < b");
} else if (a > b) {
System.out.println("a > b");
} else {
System.out.println("a == b");
}
}
}
}
}



Measured memory_bytes: 26120
#include<bits/stdc++.h>
                #define ll long long
                #define f   first
                #define s   second
                #define pb          push_back
                #define mod        1000000007
                #define mod1       1000000009
                #define hell        998244353
                #define inf         1000000000000000000LL
                #define pi          3.14159265358979323
                //#define N           100005 
                const int N=200005;
                using namespace std;
                ll n,k,sum,q,res,m,val,ans;
                ll x,y;
                ll xx[]={1,0,-1,0};
                ll yy[]={0,1,0,-1};
                ll cnt[1000005];  
                void solve()    
                {   
                    cin>>n;
                    vector<ll> v(n);
                    for(int i=0;i<n;i++)
                    {
                        cin>>v[i];
                    }
                    int i=0;
                    ll cnt=0;
                    for(int j=1;j<=n;j++)
                    {
                        while(i<n and v[i]!=j){i++;}
                        if(i<n and v[i]==j) cnt++;
                    }
                    if(cnt==0) cout<<"-1";
                    else
                    cout<<(n-cnt);



                }   
                int main()
                {   ios_base::sync_with_stdio(false);
                    cin.tie(0);cout.tie(0);
                    ll t=1; 
                   //cin>>t;
                     for(ll i=1;i<=t;i++)
                        solve();
                }            

Measured memory_bytes: 4752
#include<iostream>
#include <algorithm>
#include<string>
using namespace std;
int main(){

	int w,h,n,t,X,Y;
	cin >> w >> h >> n;

	for(int i=0; i<n; i++){
		int x,y;
		cin >> x >> y;

		if(i == 0){
			t=0;
		}

		else{
			if( (x-X)*(y-Y) >= 0){
				t += min(abs(x-X),abs(y-Y));
				t += max(abs(x-X),abs(y-Y))-min(abs(x-X),abs(y-Y));
			}
			else{
				t += abs(x-X);
				t += abs(y-Y);
			}
		}
		X=x;
		Y=y;

	}

	cout << t << endl;

	return 0;
}



Measured memory_bytes: 3068
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans = 0
min_diff = 100000

for i in range(N):
    temp = T - H[i] * 0.006
    diff = abs(temp - A)

    if min_diff > diff:
        min_diff = diff
        ans = i + 1
    
print(ans)

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

const int N = 200005;

ll n;
ll a[N];
vector<int> v[N];
map<P, int> mp;

int main () {
  ios::sync_with_stdio(false); cin.tie(nullptr);
  cin >> n;
  rep(i,n) cin >> a[i];
  int idx = 1;
  rep(i,n) {
    if(idx == a[i]) idx++;
  }
  idx--;
  idx = idx == 0 ? n+1 : idx;
  cout << n - idx << endl;
}


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

#include <stdio.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, k, n) for (int i = (k); i < (n); i++)
#define rrep(i, k, n) for (int i = (k); i > (n); i++)
#define pb push_back
#define vec vector
#define ref(a) &(a)

typedef long long ll;

using namespace std;

int n;
vec<int> d;

int solve() {
  int c = 0;
  sort(d.begin(), d.end());
  int p = n/2;
  return d[p] - d[p-1];
}

int main() {
  cin >> n;
  rep(i, n) {
    int x; cin >> x;
    d.pb(x);
  }

  cout << solve() << endl;
  return 0;
}

Measured memory_bytes: 892
P[1000000];m,c,i;main(n){for(;~scanf("%d",&n);printf("%d\n",c))for(memset(P,c=0,n*4),m=1;m++<n;)for(c+=!P[m],i=m+P[m]*n;i<=n;i+=m)P[i]=1;}

Measured memory_bytes: 4316
#include <stdio.h>
//#include <string.h>

int main(){
    int a;
    char s[4];
    scanf("%s",&s);
    for(int i=0;i<4;i++){
        if(s[i]=='+'){
            a++;
        }else{
            a--;
        }
    }
    printf("%d",a);
    return 0;
}

Measured memory_bytes: 128
//AtCoder ABC043 A - キャンディーとN人の子供イージー / Children and Candies (ABC Edit)s
#include <bits/stdc++.h>
using namespace std;
using lli=int64_t;

int main() {
    int N;
    cin>>N;
    int ans=0;
    for(int i=1;i<=N;++i){
		ans += i;
	}
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main() {
    ll h, w;
    cin>>H>>W>>h>>w;
    if((H%h == 0) && (W%w == 0)){
        cout<<"No"<<endl;
    }else {
        mat ans(H, vec(W, 1e+5));
        if(H%h != 0){
            for(int i = h - 1; i < H; i += h){
                rep(j,W) ans[i][j] = -((1e+5) * (h - 1LL)) - 1LL;
            }
        }else{
            for(int j = w - 1; j < W; j += w){
                rep(i,H) ans[i][j] = -((1e+5) * (w - 1LL)) - 1LL;
            }
        }
        cout<<"Yes"<<endl;
        rep(i,H){
            rep(j,W){
                cout<<ans[i][j]<<' ';
                //j != W - 1 ? cout<<' ' : cout<<endl;
            }
            cout<<endl;
        }
    }
}

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

int main() {
  int N;
  int N1;
  int N2;
  int N3;
  int N4;
  cin >> N;
  
  N1 = N/1000;
  N2 = (N-N1*1000)/100;
  N3 = (N-N1*1000-N2*100)/10;
  N4 = (N-N1*1000-N2*100-N3*10);
    
  if (N1 == N2 && N1 ==N3) {
    cout << "Yes" << endl;
  }
  else if (N1 == N2 && N1 == N4){
    cout << "No" << endl;
  }
  else if (N2 == N3 && N2 == N4){
    cout << "Yes" << endl;
  }
  else if (N1 == N3 && N1 == N4){
    cout << "No" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	cin >> N;
	vector<int> data(100000, 0);
	for (int i = 0; i < N; i++)
	{
		int tmp;
		cin >> tmp;
		for (int j = max(0, tmp - 1); j <= min(100000 - 1, tmp + 1); j++)
		{
			data[j]++;
		}
	}
	int ans = 0;
	for (int i = 0; i < 100000; i++)
	{
		ans = max(ans, data[i]);
	}

	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, result = 1;
  cin >> N >> K;

  for (int i = 0; i < N; i++) {
    result = result * 2 <= result + K ? result * 2 : result + K;
  }

  cout << result << endl;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())

if a > b:
    print("GREATER")
elif a < b:
    print("LESS")
else :
    print("EQUAL")


"""
if len(str(a)) > len(str(b)):
    print("GREATER")
elif len(str(a)) < len(str(b)):
    print("LESS")
else:
    if a > b:
        print("GREATER")
    elif a < b:
        print("LESS")
    else :
        print("EQUAL")
"""

Measured memory_bytes: 2940
use text_io::*;
use std::process::exit;

fn main() {
    let n:usize = read!();
    let k:usize = read!();
    let mut c:usize = 0;
    let mut e:usize = 0;
    let mut f:usize = 10000000000;
    let mut va:Vec<usize> = Vec::new();
    for i in 0..n {
        let mut a:usize = read!();
        va.push(a);
    }
    if k==0 {
        va.sort();
        println!("{}",va[n-1]);
        exit(0);
    }
    for j in 0..100 {
        if e+f<=1 {
            c=1;
        }
        else {
            c = (e + f) / 2;
        }
        let mut d:usize = 0;
        for i in 0..n {
            if va[i] > c {
                d += va[i] / c;
            }
        }
        if d <= k {
            f = c;
        } else {
            e = c;
        }
    }
    println!("{}",f);
}


Measured memory_bytes: 4204
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <limits>
#include <set>

int main()
{
    long long n{}, r{};
    std::cin >> n >> r;

    if (n >= 10) {
        std::cout << r << std::endl;
    } else {
        std::cout << (r + 100 * (10 - n)) << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int x,y,a,b,c;
ll p[100001],q[100001],r[100001];
int main(){
	ios::sync_with_stdio(0);
	cin>>x>>y>>a>>b>>c;
	rep(i,a)
	cin>>p[i];
	rep(i,b)
	cin>>q[i];
	rep(i,c)
	cin>>r[i];
	sort(r,r+c);
	reverse(r,r+c);
	sort(p,p+a);
	reverse(p,p+a);
	sort(q,q+b);
	reverse(q,q+b);
	x--,y--;
	ll ans=0;
	rep(i,x+1)
	ans+=p[i];
	rep(i,y+1)
	ans+=q[i];
	int z=0;
	while(z<c){
		if(x<0&&y<0)
		break;
		if(x==-1&&q[y]>r[z])
		break;
		if(y==-1&&p[x]>r[z])
		break;
		if(min(p[x],q[y])>r[z])
		break;
		if(x==-1){
			ans+=r[z++]-q[y--];
			continue;
		}
		if(y==-1){
			ans+=r[z++]-p[x--];
			continue;
		}
		if(p[x]>q[y])
		ans+=r[z++]-q[y--];
		else
		ans+=r[z++]-p[x--];
	}
	cout<<ans;
	re 0;
}

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

int main() {
  
  int N, K, x, ans;
  ans = 0;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
    cin >> x;
    if (x <= K - x) {
      ans += 2 * x;
    }
    else {
      ans += 2 * (K - x);
    }
  }
  
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

int main() {

    int K, A, B;
    cin >> K >> A >> B;

    cout << (A % K == 0 || (B - A >= K) || A % K > B % K ? "OK" : "NG") << endl;
    
    
    return 0;
}

Measured memory_bytes: 3536
/*

  "With age, comes wisdom. With travel, comes understanding.
   Remember that happiness is a way of travel – not a destination"

*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int            long long int
#define ld             long double
#define F              first
#define S              second
#define pb             push_back
#define si             set <int>
#define vi             vector <int>
#define pii            pair <int, int>
#define vpi            vector <pii>
#define vpp            vector <pair<int, pii>>
#define mii            map <int, int>
#define mpi            map <pii, int>
#define spi            set <pii>
#define endl           "\n"
#define sz(x)          ((int) x.size())
#define all(p)         p.begin(), p.end()
#define que_max        priority_queue <int>
#define que_min        priority_queue <int, vi, greater<int>>
#define bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)       for(auto x : a) cout << x << " "; cout << endl
#define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
#define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
     int x = 1;
     while (b)
     {
          if (b & 1) x *= a;
          a *= a;
          b >>= 1;
     }
     return x;
}

typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> Set;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 200005;
int a[N], n, m, k, s;

void solve()
{
     int i, j;
     cin >> n >> k >> s;

     for (i = 1; i <= k; i++)
          a[i] = s;

     int x = 1e9;
     if (s == x)
          x--;

     for (i = k + 1; i <= n; i++)
          a[i] = x;

     print2(a, 1, n + 1);

}

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

     cout << setprecision(9) << fixed;
     clock_t z = clock();
     solve();
     cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);

     return 0;
}

Measured memory_bytes: 2176
S = input()
T = input()
a_idx = ord('a')
S_Lis = {0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [], 11: [], 12: [],
         13: [], 14: [], 15: [], 16: [], 17: [], 18: [], 19: [], 20: [], 21: [], 22: [], 23: [], 24: [], 25: []}
T_Lis = {0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [], 11: [], 12: [],
         13: [], 14: [], 15: [], 16: [], 17: [], 18: [], 19: [], 20: [], 21: [], 22: [], 23: [], 24: [], 25: []}
leng = len(S)
for i in range(leng):
    S_Lis[ord(S[i]) - a_idx].append(i)
    T_Lis[ord(T[i]) - a_idx].append(i)
if sorted(S_Lis.values()) == sorted(T_Lis.values()):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 20168
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
void print(const vector<int> &v)
{
    for(int i = 0; i < v.size(); i++)
    {
        if(i > 0) cout << " " << v[i];
        else cout << v[i];
    }
    cout << endl;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> vec;
    for(int i = 0; i < n; i++)
    {
        int x; cin >> x;
        vec.push_back(x);
    }
    vector<int> mid(vec), tmp;
    sort(vec.begin(), vec.end());
    bool flag = false, head = false;
    do
    {
        if(flag)
        {
            print(vec);
            break;
        }
        if(equal(mid.begin(), mid.end(), vec.begin(), vec.end()))
        {
            if(head) print(tmp);
            print(mid);
            flag = true;
        }
        tmp = vec;
        head = true;
    }
    while(next_permutation(vec.begin(), vec.end()));
    return 0;
}




Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int MOD = 1000000007; 

int main() {
    int k,a,b; cin >> k >> a >> b;
    string ret = (k*((k+a-1)/k) <= b) ? "OK" : "NG"; 
    cout << ret << endl;
    return 0;
}

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

int main(void){
int a,b,c;
int ca=0,cb=0;
char ch;

while(cin>>a>>ch>>b>>ch>>c){
if(a*a+b*b==c*c) ca++;
else if(a==b) cb++;
}
cout<<ca<<endl;
cout<<cb<<endl;
return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();

    	int a=N/15;

    	int result=N*800-a*200;

    	System.out.println(result);

    }
}


Measured memory_bytes: 21844
n = int(input())

arrey = [[[0 for r in range(10)]for f in range(3)]for b in range(4)]

for i in range(n):
    b, f, r, v = [int(j) for j in input().split()]
    arrey[b-1][f-1][r-1] = arrey[b-1][f-1][r-1] + v

for b in range(len(arrey)):
    for f in range(len(arrey[b])):
        for r in range(len(arrey[b][f])):
            print(' ' + str(arrey[b][f][r]),end='') if r != len(arrey[b][f]) - 1 else print(' ' + str(arrey[b][f][r]))
    if b != len(arrey) - 1:
        print('####################')

Measured memory_bytes: 7724
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>

class P {
public:
  P() {}
  P(double x_, double y_) : x(x_), y(y_) {}
  double Norm2() { return x * x + y * y; }
  double x, y;
};

P operator - (const P& a, const P& b) {
  return P(a.x - b.x, a.y - b.y);
}

double cross(P a, P b) {
  return a.x * b.y - a.y * b.x;
}

int n;
int m[128];
P p[128][128];

void load() {
  scanf("%d", &n);
  if( n == 0 ) return;
  for(int i = 0; i <= (int)n; ++i) {
    scanf("%d", &m[i]);
    for(int j = 0; j < (int)m[i]; ++j) {
      scanf("%lf %lf", &p[i][j].x, &p[i][j].y);
    }
  }
}

std::vector<int> solve() {
  std::vector<int> res;
  for(int i = 1; i <= (int)n; ++i) {
    if( m[0] != m[i] ) continue;
    bool b1 = [&]() {
      if( (p[0][1] - p[0][0]).Norm2() != (p[i][1] - p[i][0]).Norm2() ) return false;
      for(int j = 0; j < (int)m[i]-2; ++j) {
        if( cross(p[i][j+1] - p[i][j], p[i][j+2] - p[i][j+1]) != cross(p[0][j+1] - p[0][j], p[0][j+2] - p[0][j+1]) ) {
          return false;
        }
      }
      return true;
    }();
    for(int j = 0; j < (int)m[i]/2; ++j) {
      std::swap(p[i][j], p[i][m[i]-j-1]);
    }
    bool b2 = [&]() {
      if( (p[0][1] - p[0][0]).Norm2() != (p[i][1] - p[i][0]).Norm2() ) return false;
      for(int j = 0; j < (int)m[i]-2; ++j) {
        if( cross(p[i][j+1] - p[i][j], p[i][j+2] - p[i][j+1]) != cross(p[0][j+1] - p[0][j], p[0][j+2] - p[0][j+1]) ) {
          return false;
        }
      }
      return true;
    }();
    for(int j = 0; j < (int)m[i]/2; ++j) {
      std::swap(p[i][j], p[i][m[i]-j]);
    }
    if( b1 or b2 ) {
      res.push_back(i);
    }        
  }
  return res;
}

int main() {
  for(;;) {
    load();
    if( n == 0 ) break;
    std::vector<int> res = solve();
    for(int i = 0; i < (int)res.size(); ++i) {
      printf("%d\n", res[i]);
    }
    printf("+++++\n");
  }
  
  return 0;
}

Measured memory_bytes: 3376
/*
    In the name of Allah

    MohammadErfan Gooneh

*/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

#define endl                        '\n'
#define all(a, n)                   for (int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;
#define IOS                         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


const ll MAXN = 1e6 + 10;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
int main() {
    IOS ;
    ll n ;
    cin >> n ; 
    cout << n/3 ;





















return 0 ;
}


Measured memory_bytes: 3652
using System;

class Program
{
    static void Main(string[] args)
    {
        var a = new int[1000010];

        for (var i = 0; i < 40; i++)
        {
            var input = int.Parse(Console.ReadLine());
            if (input == 0) break;
            a[i] = input;
        }

        foreach (var elem in a)
        {
            if (elem == 0) break;

            var dp = new int[10000010];

            dp[0] = 1;

            for (var i = 1; i <= elem; i++)
            {
                dp[i] += dp[i - 1];
                if (i > 1) dp[i] += dp[i - 2];
                if (i > 2) dp[i] += dp[i - 3];
            }
            
            Console.WriteLine(((dp[elem] < 10 ? dp[elem] : dp[elem] / 10) + 364) / 365);
        }
    }
}



Measured memory_bytes: 13844
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <iomanip>
#include <functional>
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
using namespace std;

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

	int N, A, B;

	cin >> N >> A >> B;

	cout << min(N*A, B) << endl;

	return 0;
}

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

int main()
{
    int a,b,ans,flg;

    cin >> a >> b;

    ans = -1;
    flg = 0;
    for (int x = 1;x < 10000;++x) {
        if ((x * 8 / 100 == a) && (x * 10 / 100 == b)) {
            ans = x;
            ++flg;
            break;
        }
    }

    std::cout << ans << endl;
}


Measured memory_bytes: 3640