akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define USE_IOSTREAM \
{\
	ios::sync_with_stdio(false);\
	cin.tie(0);\
	cout.tie(0);\
}

#define pii pair<int, int>
#define mp make_pair

typedef long long ll;



int main()
{
	USE_IOSTREAM;
	int x, y, ans;
	cin >> x >> y;
	ans = 2e9;
	if (y >= x)
	{
		ans = min(ans, y - x);
	}
	
	if (y >= -x)
	{
		ans = min(ans, y + x + 1);
	}
	
	if (-y >= x)
	{
		ans = min(ans, -y - x + 1);
	}
	
	if (-y >= -x)
	{
		ans = min(ans, -y + x + 2);
	}
	
	cout << ans << endl;
	
	return 0;
}

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

int main() {
  int x, y, z, a;
  cin >> x >> y >> z;
  a = x * 100 + y * 10 + z;
  if(a % 4 == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
N = gets.chomp.to_i
A = gets.chomp.to_i
B = gets.chomp.to_i
C = gets.chomp.to_i
D = gets.chomp.to_i
E = gets.chomp.to_i

carry_count = [A, B, C, D, E].min
#
# sum = 0
# 5.upto(N+5) do |i|
#   sum += carry_count
#   if sum >= N
#     puts i
#     exit
#   end
# end

if N <= carry_count
  p 5
else
  if N % carry_count == 0
    p N / carry_count + 4
  else
    p N / carry_count + 5
  end
end


Measured memory_bytes: 1788
#define _USE_MATH_DEFINES                                  
#include <math.h>                                          
#include<iostream>                                         
#include<iomanip>                                          
using namespace std;                                       
                                                           
int main(){                                                
  double r,S,L;                                            
                                                           
  cin >> r;                                                
                                                           
  S = M_PI * r  * r;                                       
                                                           
  L = 2 * M_PI * r;                                        
                                                           
  cout << fixed << setprecision(6) << S << " " << L << end\
l;                                                         
                                                           
  return 0;                                                
                                                           
}

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

#define ll long long

int main() {
	int h, w, k;
	int h1, w1;
	int h2, w2;
	int i, j;
	int q1, q2;
	int buf;
	int cc;
	int kc = 0;
	int count = 0;
	cin >> h >> w >> k;
	char c;
	vector<vector<int>> s(h);
	vector<int> h_num(h);
	vector<int> h_buf;
	vector<int> w_num(w);
	vector<int> w_buf;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			cin >> c;
			if (c == '.')buf = 0;
			else {
				buf = 1;
				kc++;
				h_num[i]++;
				w_num[j]++;
			}
			s[i].push_back(buf);
		}
	}
	h2 = (int)pow(2.0, h);
	w2 = (int)pow(2.0, w);
	for (i = 0; i < h2; i++){
		for (j = 0; j < w2; j++) {
			h1 = i;
			w1 = j;
			buf = kc;
			cc = 0;
			while (h1 > 0) {
				if (h1 % 2 == 1) {
					buf -= h_num[cc];
					h_buf.push_back(cc);
					
				}
				h1 /= 2;
				cc++;
			}
			cc = 0;
			while (w1 > 0) {
				if (w1 % 2 == 1) {
					buf -= w_num[cc];
					w_buf.push_back(cc);
					
				}
				w1 /= 2;
				cc++;
			}
			for (q1 = 0; q1 < h_buf.size(); q1++) {
				for (q2 = 0; q2 < w_buf.size(); q2++) {
					if (s[h_buf[q1]][w_buf[q2]] == 1)buf++;
				}
			}
			if (buf == k)count++;
			h_buf.clear();
			w_buf.clear();
		}
	}
	cout << count << endl;
	return 0;
}

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

int main(){
  int N, X;
  int L[100];
  int tmp;
  cin >> N >> X;
  int cur = 0, cnt=1;
  for(int i=0;i<N;i++){
    cin >> tmp;
    cur += tmp;
    if(cur > X)
      break;
    cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from fractions import gcd
from functools import reduce


def read():
    N, K = map(int, input().strip().split())
    A = list(map(int, input().strip().split()))
    return N, K, A


def solve(N, K, A):
    a = reduce(gcd, A)
    if max(A) < K:
        return "IMPOSSIBLE"
    if a > 1 and K % a != 0:
        return "IMPOSSIBLE"
    return "POSSIBLE"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 16120
#include <iostream>
using namespace std;
int main(void){
    int m, f, b, debt;
    cin >> m >> f >> b;
    
    if(m>=b){
        cout << 0 << endl;
    }
    
    else{
        debt = b-m;
        if(f>=debt){
            cout << debt << endl;
        }
        else cout << "NA" << endl;
    }
    return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

template<class T, class Cond>
struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  bool operator()(T& a, const T& b) const {
    if(cond(a, b)) { a = b; return true; }
    return false;
  }
};
template<class T, class Cond>
chain<T, Cond> make_chain(Cond cond) { return chain<T, Cond>(cond); }

int main() {
  string s;
  string t;
  cin >> s >> t;
  if(s == t.substr(0, s.size())) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3632
import heapq

def dijkstra(graph, node, start):
    dist = [float("inf") for _ in range(node)]

    dist[start] = 0
    q = []
    heapq.heappush(q, (0, start))

    while q:
        cost, cur_node = heapq.heappop(q)

        if dist[cur_node] < cost:
            continue

        for nex_cost, nex_node in graph[cur_node]:
            dist_cand = dist[cur_node] + nex_cost
            if dist_cand < dist[nex_node]:
                dist[nex_node] = dist_cand
                heapq.heappush(q, (dist[nex_node], nex_node))

    return dist

h, w = map(int, input().split())
adj = [[] for _ in range(10)]
for i in range(10):
    c = list(map(int, input().split()))
    for j in range(10):
        adj[i].append((c[j], j))
shortest = []
for i in range(10):
    shortest.append(dijkstra(adj, 10, i)[1])
ans = 0
for i in range(h):
    a = list(map(int, input().split()))
    for j in a:
        if j != -1:
            ans += shortest[j]
print(ans)

Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int a,b,c,n,m;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	if(b<a)
		swap(a,b);
	if(c<b)
		swap(c,b);
	int n=c-a,m=c-b;
	if((n%2&&m%2)||(!(n%2)&&!(m%2)))
		printf("%d",(m+n)>>1);
	else
		printf("%d",((m+(++n))>>1)+1);
	return 0;
}

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

//要するに最小の経路を
//BFSだね

char s[55][55];
int dis[55][55];

int main(){
    int cnt=0;
    int H, W; cin >> H >> W;
    for(int i=0; i<H; i++){
        string S; cin >> S;
        for(int j=0; j<W; j++){
            s[i][j]=S.at(j);
            if(s[i][j]=='.') cnt++;
        }
    }

    //
    const int INF=pow(10,9);
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            dis[i][j]=INF;
        }
    }
    int dx[]={-1,0,1,0};
    int dy[]={0,1,0,-1};

    queue<P> que;
    que.push(P(0,0));
    dis[0][0]=0;
    while(!que.empty()){
        P now = que.front(); que.pop();
        int x=now.first, y=now.second;
        for(int i=0; i<4; i++){
            int newx=x+dx[i], newy=y+dy[i];
            if(newx<0 || newx>=H || newy<0 || newy>W) continue;
            if(s[newx][newy]=='#') continue;
            if(dis[newx][newy]!=INF) continue;
            dis[newx][newy]=dis[x][y]+1;
            que.push(P(newx,newy)); 
        }
    }
    if(dis[H-1][W-1]==INF) cout << -1 << endl;
    else{
        cout << cnt -dis[H-1][W-1]-1 << endl;
    }
}

Measured memory_bytes: 256
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
ll a[99], b[99], c[99], d[99], n, m, q, s, ans, f[99];
void all(ll i, ll x)
{
    f[i] = x;
    if (i == n)
    {
        s = 0;
        for (ll j = 0; j < q; j++)
            if (f[b[j]] - f[a[j]] == c[j])
                s += d[j];
        ans = max(ans, s);
        return;
    }
    for (ll j = x; j <= m; j++)
        all(i + 1, j);
}
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    cin >> n >> m >> q;
    for (ll i = 0; i < q; i++)
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    all(0, 1);
    cout << ans;
}

Measured memory_bytes: 3656
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
	Scanner in = new Scanner(System.in);
	int N = in.nextInt();
	Pair[] pair = new Pair[N];
	for (int i = 0; i < N; i++) {
	    pair[i] = new Pair(in.nextInt(), in.nextInt());
	}
	Arrays.sort(pair, (x, y) -> x.B - y.B);
	long time = 0;
	for(Pair p: pair) {
	    time += p.A;
	    if(time > p.B) {
		System.out.println("No");
		return;
	    }
	}
	System.out.println("Yes");
    }
}

class Pair {
    int A, B;
    public Pair(int A, int B) {
	this.A = A; this.B = B;
    }
}



Measured memory_bytes: 109016
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
int isP(int x){
    for(int i = 2; i <= sqrt(x); i++){
        if(x%i==0)return i;
    }
    return x;
}
void solve(){
    int n;
    cin>>n;
    map<int, int>cnt;
    while(n>1)
    {
        cnt[isP(n)]++;
        n/=isP(n);
    }
    int s=0;
    for(auto i:cnt){
        int x=(-1+sqrt(1+8*i.s))/2;
        if(x>0)s+=x;
    }
    cout<<s;
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t;
	cin >> t;
	while(t--) {
		ll n, a, b, c, d;
		cin >> n >> a >> b >> c >> d;
		std::vector<pair<int, ll>> ops;
		// ops.emplace_back(2, a);
		ops.push_back(make_pair(2, a));
		ops.push_back(make_pair(3, b));
		ops.push_back(make_pair(5, c));
		const ll inf = 4e18;
		map<ll, ll> mp;
		mp[0] = 0;
		mp[1] = d;
		function<ll(ll)> DFS = [&](ll x) {
			if(mp.find(x) != mp.end()) {	//如果找到了返回这个值
				return mp[x];
			}
			ll ret = inf;
			if((long double)d * (long double)x < ret) {
				ret = d * x;
			}
			for(auto& p : ops) {
				int num = p.first;
				ll cost = p.second;
				//分成了两种情况：第一种是减1；第二种是加1
				ret = min(ret, DFS(x / num) + cost + d * (x % num));
				if(x % num != 0) {
					ret = min(ret, DFS(x / num + 1) + cost + d * (num - x % num));
				}
			}
			return mp[x] = ret;
		};
		cout << DFS(n) << endl;
	}
	return 0;
}

Measured memory_bytes: 4292
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
const int mod = 1e9 + 7;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    string ans;
    int tk, ao;

    if (a % d != 0)
    {
        tk = a / d + 1;
    }
    else
    {
        tk = a / d;
    }

    if (c % b != 0)
    {
        ao = c / b + 1;
    }
    else
    {
        ao = c / b;
    }
    if (tk >= ao)
    {
        ans = "Yes";
    }
    else
    {
        ans = "No";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535
vector<int> arr;
int n, k;
int cal(int l)
{
	int f = 0; int cnt = 0;
	for (int i = 0; i < n; i++)
	{
		int u = (arr[i] + l - 1) / l;
		cnt += u - 1;
	}
	if (cnt <= k)
		return 1;
	else
		return 0;
}
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif


	cin >> n;
	cin >> k;
	arr.resize(n, 0);
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	int l = 1; int r = 1e9; int mid = l + r;
	mid /= 2;
	int f, f1; int u = 1;
	while (u)
	{

		mid = l + r + 1; mid /= 2;
		// cout << mid << " " << l << " " << r << endl;
		if (l == r)
			break;
		else
		{
			f = cal(mid);
			f1 = cal(mid - 1);
			if (f == 0)
			{
				l = mid + 1;
			}
			else
			{
				if (f1 == 0)
				{
					break;
				}
				else
				{
					r = mid - 1;
				}
			}
		}

	}
	cout << mid << endl;
	return 0;
}



Measured memory_bytes: 3900
# -*- coding: utf-8 -*-

"""
参考：https://img.atcoder.jp/agc017/editorial.pdf
"""

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

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

N, P = MAP()
aN = LIST()

has_odd = False
for i in range(N):
    if aN[i] % 2 == 1:
        has_odd = True
        break
if not has_odd:
    if P == 0:
        print(2 ** N)
    else:
        print(0)
else:
    print(2 ** (N-1))


Measured memory_bytes: 5284
import sys
import math
import itertools as it
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
p = intl()
cnt = 0
m = p[0]
for i in range(n):
    if m > p[i]:
        m = p[i]
    if p[i] <= m:
        cnt += 1
print(cnt)

Measured memory_bytes: 25252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int n;
string s[510];
vector<int> G[26];
int indeg[26];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> n, n) {
    for (int i = 0; i < 26; i++) {
      G[i].clear();
      indeg[i] = 0;
    }
    for (int i = 0; i < n; i++) {
      cin >> s[i];
    }
    bool no = false;
    for (int i = 0; i + 1 < n; i++) {
      if (s[i] == s[i + 1]) continue;
      int w = 0, lim = min(s[i].size(), s[i + 1].size());
      while (w < lim && s[i][w] == s[i + 1][w]) {
        w++;
      }
      no |= s[i].substr(0, s[i + 1].size()) == s[i + 1];
      if (w < lim) G[s[i][w] - 'a'].emplace_back(s[i + 1][w] - 'a');
    }
    for (int i = 0; i < 26; i++) {
      auto &v = G[i];
      sort(v.begin(), v.end());
      v.erase(unique(v.begin(), v.end()), v.end());
      for (int next : G[i]) {
        if (next != i) indeg[next]++;
      }
    }
    stack<int> st;
    int num = 0;
    for (int i = 0; i < 26; i++) {
      if (!indeg[i]) st.emplace(i);
    }
    while (!st.empty()) {
      int curr = st.top();
      st.pop();
      num++;
      for (int next : G[curr]) {
        if (--indeg[next]) continue;
        st.emplace(next);
      }
    }
    cout << (!no && num == 26 ? "yes" : "no") << endl;
  }

  return 0;
}


Measured memory_bytes: 3280
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 510000;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const ll longinf = 1LL << 60;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;


int a[100005], ans[100005], n;

int main() {

	cin >> n;

	rep(i, n)cin >> a[i];

	rep(i, n) {
		if (i % 2 == 0)ans[0] += a[i];
		else ans[0] -= a[i];
	}



	REP(i, 1, n) {
		ans[i] = (a[i - 1] - (ans[i - 1] / 2)) * 2;
	}

	rep(i, n) {
		if (i != n - 1) {
			cout << ans[i] << " ";
		}
		else cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 2048
using System;


class _2
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int M = int.Parse(input[1]);
        int C = int.Parse(input[2]);

        var B = new int[M];
        input = Console.ReadLine().Split(' ');
        for (int i = 0; i < M; i++)
        {
            B[i] = int.Parse(input[i]);
        }

        var A = new int[N,M];

        for(int i = 0; i < N; i++)
        {
            input = Console.ReadLine().Split(' ');
            for (int j = 0; j < M; j++)
            {
                A[i, j] = int.Parse(input[j]);
            }
        }

        int result = 0;
        for(int i = 0; i < N; i++)
        {
            int sum = C;
            for(int j = 0; j < M; j++)
            {
                sum += A[i, j] * B[j];
            }
            
            if(0 < sum)
            {
                result++;
            }
        }
        Console.WriteLine(result);
    }
}

Measured memory_bytes: 13140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class A { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		var S = GetString();
		var T = GetString();
		WriteLine(S.Equals(T.Substring(0, S.Length)) ? "Yes" : "No");
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 25912
#ALDS1_4_D Allocaion
def check(k, w, p):  # 積載制限 p 台数 k のトラックに乗り切るか確認
    j = 0
    for i in range(k):
        sum = 0
        while sum < p:
            if sum + w[j] > p:
                break
            else:
                sum += w[j]
                j += 1
            if j == len(w):  # 積載完了
                break
        if j == len(w):
            break

    if j == len(w):
        return True
    else:
        return False


n, k = map(int, input().split())
w = [int(input()) for _ in range(n)]

left = sum(w) // k - 1
right = left + max(w)

while True:
    mid = (left + right) // 2
    # print('mid : {}'.format(mid))

    if check(k, w, mid):
        right = mid
    else:
        left = mid
    if right - left <= 1:
        break
    # print('left : {}  right : {}'.format(left, right))

print(right)



Measured memory_bytes: 9560
n = int(input())
lens = list(map(int, input().split()))
lens.sort(reverse=True)

res = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        if lens[i] == lens[j]:
            continue
        for k in range(j + 1, n):
            if lens[i] == lens[k] or lens[j] == lens[k]:
                continue
            if lens[i] < lens[j] + lens[k]:
                res += 1

print(res)


Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

/*------------------------------------/
for library*/

/*------------------------------------*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int A[3];
    int sum = 0;
    rep(i,3){
        cin>>A[i];
        sum +=A[i];
    }
    cout<<((sum>=22)?"bust":"win")<<endl;
}

Measured memory_bytes: 256
# AOJ 1101 A Simple Offline Text Editor

class TextEditor
  def initialize(text)
    @text = text
    @cursor = 0
  end

  def to_s
    text_before_cursor + "^" + text_after_cursor
  end

  def inspect
    %Q|#<TextEditor:0x#{"%x".%(object_id)} "#{to_s}">|
  end

  def forward_char
    @cursor += 1 if @cursor < @text.length
    self
  end

  def forward_word
    # if @cursor < @text.length
    #   m = /^ +/.match(text_after_cursor)
    #   @cursor += m[0].length if m
    # end

    # if @cursor < @text.length
    #   m = /^[^ ]+/.match(text_after_cursor)
    #   @cursor += m[0].length if m
    # end

    @cursor += 1 while @cursor < @text.length && @text[@cursor] == " "
    @cursor += 1 while @cursor < @text.length && @text[@cursor] != " "

    self
  end

  def backward_char
    @cursor -= 1 if @cursor > 0
    self
  end

  def backward_word
    # if @cursor > 0
    #   last_blank_pos = text_before_cursor.sub(/\s+$/, "").rindex(" ")
    #   if last_blank_pos
    #     @cursor = last_blank_pos + 1
    #   else
    #     @cursor = 0
    #   end
    # end

    @cursor -= 1 while @cursor > 0 && @text[@cursor - 1] == " "
    @cursor -= 1 while @cursor > 0 && @text[@cursor - 1] != " "

    self
  end

  def insert(text)
    @text = text_before_cursor + text + text_after_cursor
    @cursor += text.length

    self
  end

  def delete_char
    unless @cursor == @text.length
      @text = text_before_cursor + text_after_cursor[1..-1]
    end

    self
  end

  def delete_word
    # unless @cursor == @text.length
    #   @text = text_before_cursor +
    #     text_after_cursor.sub(/ *[^ ]*/, "")
    # end

    if @cursor < @text.length
      word_end = @cursor
      word_end += 1 while word_end < @text.length && @text[word_end] == " "
      return self if word_end == @text.length

      word_end += 1 while word_end < @text.length && @text[word_end] != " "
      @text = text_before_cursor + @text[word_end..-1]
    end

    self
  end

  private
  def text_before_cursor
    if @cursor.zero?
      ""
    else
      @text[0..(@cursor - 1)]
    end
  end

  def text_after_cursor
    if @cursor == @text.length
      ""
    else
      @text[@cursor..-1]
    end
  end
end

n_texts = gets.to_i
n_texts.times do
  t = TextEditor.new(gets.chomp)

  n_commands = gets.to_i
  n_commands.times do
    command, argument = gets.chomp.split(" ", 2)
    argument.sub!(/^ +/, "")

    case command
    when "forward"
      case argument
      when "char"
        t.forward_char
      when "word"
        t.forward_word
      end
    when "backward"
      case argument
      when "char"
        t.backward_char
      when "word"
        t.backward_word
      end
    when "insert"
      m = /^"(.*)"/.match(argument)
      t.insert m[1] if m
    when "delete"
      case argument
      when "char"
        t.delete_char
      when "word"
        t.delete_word
      end
    end
  end

  puts t.to_s
end

Measured memory_bytes: 6100
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
const int N = 41, X = 11, Y = 11;
int a[N], b[N], c[N], dp[N][N * X][N * Y];
void solve(){
    int n, x, y;
    cin >> n >> x >> y;
    for (int i = 0; i < n; ++i) cin >> a[i] >> b[i] >> c[i];
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N * X; ++j) {
            for (int k = 0; k < N * Y; ++k) {
                dp[i][j][k] = mod;
            }
        }
    }
    for (int i = 0; i < n; ++i) {
        dp[i][0][0] = 0;
        for (int j = 0; j < N - a[i]; ++j) {
            for (int k = 0; k < N - b[i]; ++k) {
                if (dp[i][j][k] == mod) continue;
                dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
            }
        }
    }
    int ans = mod;
    for (int i = 1; i < N; ++i) ans = min(ans, dp[n][i * x][i * y]);
    if (ans == mod) cout << -1;
    else cout << ans;
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

Measured memory_bytes: 32896
from  collections import deque

d=deque()
n=int(input())
for i in range(n):
    q=list(map(int,input().split()))
    if q[0]==0:
        if q[1]==0:
            d.appendleft(q[2])
        else:
            d.append(q[2])
    elif q[0]==1:
        print(d[q[1]])
    else:
        if q[1]==0:
            d.popleft()
        else:
            d.pop()


Measured memory_bytes: 21984
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from collections import deque

def main():
    n = input()
    k = int(input())

    dp = [[[0] * 2 for _ in range(k + 1)] for _ in range(len(n) + 1)]
    dp[0][0][0] = 1
    for i in range(len(n)):
        dp[i + 1][0][1] = 1
        for j in range(k):
            if n[i] == '0':
                dp[i + 1][j + 1][0] = dp[i][j + 1][0]
                dp[i + 1][j + 1][1] = dp[i][j + 1][1] + dp[i][j][1]*9
            else:
                dp[i + 1][j + 1][0] = dp[i][j][0]
                dp[i + 1][j + 1][1] = dp[i][j + 1][0] + dp[i][j][0]*(int(n[i]) - 1) + dp[i][j + 1][1] + dp[i][j][1]*9
    print(sum(dp[-1][-1]))
if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <stdio.h>
#include <string.h>
int main(void)
{
  int x,t;
  char s[100004]={0};
  scanf("%s",s);
  x=(1+strlen(s))/2+1;
  for(t=0;t<x;++t){
    s[t]=s[2*t];
  }
  printf("%s\n", s);
  return 0;
}


Measured memory_bytes: 256
N, Y= map(int, input().split())
flag = False
for i in range(N+1):
	zandaka = Y - (10000*i)
	for j in range(N+1-i):
		k = (zandaka - 5000*j)//1000
		if(i + j + k == N):
			flag = True
			print(i, j, k)
			break
	if flag is True:
		break
if flag is False:
	print(-1,-1,-1)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m,k;
ll fact[500001];

ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d=a;
	if(b!=0LL){
		d=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}else{
		x=1LL;
		y=0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}

ll mod_fact(ll n,ll p,ll &e){
	e=0;
	if(n==0)return 1;
	ll res=mod_fact(n/p,p,e);
	e+=n/p;
	if(n/p%2LL!=0LL)return res*(p-fact[n%p])%p;
	return res*fact[n%p]%p;
}

ll mod_comb(ll n,ll k,ll p){
	if(n<0 || k<0 || n<k)return 0;
	ll e1,e2,e3;
	ll a1=mod_fact(n,p,e1),a2=mod_fact(k,p,e2),a3=mod_fact(n-k,p,e3);
	if(e1>e2+e3)return 0;
	return a1*mod_inverse(a2*a3%p,p)%p;
}

int main(void){
	fact[0]=1;
	fact[1]=1;
	for(int i=2;i<=500000;i++){
		fact[i]=(ll)i*fact[i-1]%MOD;
	}
	scanf("%d%d%d",&n,&m,&k);
	ll res=0;
	for(int i=0;i<=k;i++){
		ll v1=mod_comb(n+i*2,i,MOD);
		if(i>0){
			v1=(v1-mod_comb(n+i*2,i-1,MOD)+MOD)%MOD;
		}
		ll v2=mod_comb(m+(k-i)*2,k-i,MOD);
		if(k-i>0){
			v2=(v2-mod_comb(m+(k-i)*2,k-i-1,MOD)+MOD)%MOD;
		}
		ll v3=mod_comb(n+m+k*2,n+i*2,MOD);
		res=(res+((v1*v2%MOD)*v3%MOD))%MOD;
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 7132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
const int N = 50 + 5;
struct node{
	string s;
	int t;
}a[N];
int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
    	cin >> a[i].s;
    	cin >> a[i].t;
	}
	string str;
	cin >> str;
	int sum = 0,flag = 0;
	for(int i = 0; i < n; i++){
		if(a[i].s == str){
			flag = 1;
		}
		else if(flag)
			sum += a[i].t;
	}
	cout << sum << endl;
    return 0;
}

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

int main()
{
    int n, i, first = -1, second = -1;
    cin >> n;
    int a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    for (i = 0; i < n; i++)
    {
        if (first <= a[i])
        {
            second = first;
            first = a[i];
        }
        else if (second < a[i]) second = a[i];
    }
    for (i = 0; i < n; i++)
    {
        if (a[i] != first) cout << first << '\n';
        else cout << second << '\n';
    }
}

Measured memory_bytes: 2432
s = gets.chomp
array = s.split("")
str = "keyence"
answer = "NO"
if s[0,7] == str
  answer = "YES"
end
if s[-7,7] == str
  answer = "YES"
end

for i in (0..5)
  if s[i] ==  str[i]
    if s[-(6-i),(6-i)] == str[i+1,6-i]
    answer ="YES"
  end
end
end
puts answer


Measured memory_bytes: 1788
#include<stdio.h>

int main(void)
{
	int A,B,C,add_a;
	scanf("%d%d%d",&A,&B,&C);
	add_a=B+C;
	int end_2=add_a-A;
	if(A>=add_a){
		printf("0\n");
	}else{
		printf("%d\n",end_2);
	}
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
template <typename T>
using V = std::vector<T>;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

// auto mod int

const i64 MOD = 1'000'000'007;

struct mint {
  long long x;
  mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  i64 N, K;
  cin >> N >> K;
  mint ans = 1;
  for (i64 i = K; i <= N; ++i) {
    mint a = mint((2 * N - i + 1) * i / 2);
    mint b = mint((i - 1) * i / 2);
    ans += a - b + 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3656
using System;

namespace A___abc_of_ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            if(s[0]!=s[1]&&s[1]!=s[2]&&s[0]!=s[2])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

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

int main(){
    int N,X;
    cin >> N >> X;
    vector<int>L(N);
    int ans = 0;
    vector<int>cnt(N+1);
    cnt[0] = 0;
    for(int i = 0; i < N; i++) {
        cin >> L[i];
        cnt[i+1] = cnt[i]+L[i];
    }
    for(int i = 0; i <= N; i++) {
        if(cnt[i] <= X) {
            ans++;
        }
        else {
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
	int n;
	
	while (std::cin >> n, n) {
		int ans = 0;

		for (int i = 0; i < n / 4; ++i) {
			int x;
			std::cin >> x;

			ans += x;
		}

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

Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    int n;cin >> n;
    while(n){
        int a = n%10;
        if(a==7){
            cout << "Yes" << endl;
            return 0;
        }
        n /= 10;
    }
    cout << "No" << endl;
}

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

int main() {
    int k;
    string str;
    cin >> k;
    cin >> str;

    int s = str.size();

    if (s <= k) {
        cout << str << endl;
    } else {
        for (int i = 0; i < k; i++)
            cout << str[i];
        cout << "..." << endl;
    }
}

Measured memory_bytes: 3640
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
const int MAX_N = 300;
char second[MAX_N][MAX_N];

signed main() {
    int N;
    cin >> N;
    char grid[N][N];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> grid[i][j];
        }
    }

    int ret = 0;

    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                second[i][j] = grid[i][(j + k) % N];
            }
        }

        bool flag = true;

        for (int i = 0; i < N; i++) {
            for (int j = i; j < N; j++) {
                if (second[i][j] != second[j][i]) {
                    flag = false;
                    break;
                }
            }

            if (!flag) break;
        }

        if (flag) ret += N;
    }

    cout << ret << endl;


    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if(a + b >= c)cout << c + b << endl;
    else cout << a + b * 2 + 1 << endl;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int A,B,C;
    cin>>A>>B>>C;
    if(A>=(B+C))
    {
        cout <<"0";
    }
    else {
            B=B+C-A;
    cout<<B;

    }
    return 0;

}


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

typedef long long ll;
typedef pair<int,int> p_int;
typedef pair<ll,ll> p_ll;
typedef tuple<ll,ll,ll> t3_ll;
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
const ll inf = 1e9+7;

int main() {
	ll n;
	cin >> n;
	ll a[n],s[n];
	map<ll,ll> nums;
	ll ans = 0;
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}
	ll sum = 0;
	nums[sum]++;
	for (int i = 0;i < n;i++) {
		sum = sum + a[i];
		nums[sum]++;
	}
	for (auto itr = nums.begin();itr != nums.end();itr++) {
		ans += itr->second * (itr->second-1) / 2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 14336
package main

import (
        "fmt"
)

func main() {
        var n int
        fmt.Scan(&n)
        a := make([]int, n)
        for i := 0; i < n; i++ {
                fmt.Scan(&a[i])
        }

        cnt := 0
        for i := range a {
                for a[i]%2 == 0 {
                        a[i] /= 2
                        cnt++
                }
        }
        fmt.Println(cnt)
}

Measured memory_bytes: 1280
S = list(map(int, input().split(' ')))
#print(S)

count_7 = count_5 = 0
for num in S:
    if num == 5:
        count_5 += 1
    elif num == 7:
        count_7 += 1

if count_5 == 2 and count_7 == 1:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 2940
using System.Collections.Generic;
using System;

public class Atarikuji
{
    public string bango { get; set; }
    public int  shokin { get; set; }
}

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var atarikujis = new List<Atarikuji>();
            string[] line = Console.ReadLine().Trim().Split(' ');
            var n = int.Parse(line[0]);
            var m = int.Parse(line[1]);
            if (n == 0 && m == 0) break;
            for (int i = 0; i < n; i++)
            {
                string[] line2 = Console.ReadLine().Trim().Split(' ');
                var s1 = line2[0].Replace("*", "");
                var s2 = int.Parse(line2[1]);
                atarikujis.Add(new Atarikuji { bango = s1, shokin = s2 });
            }
            var totalshokin = 0;
            for (int i = 0; i < m; i++)
            {
                var s3 = Console.ReadLine().Trim();
                for (int j = 0; j < n; j++)
                    if (atarikujis[j].bango == s3.Substring(8 - atarikujis[j].bango.Length))
                        totalshokin += atarikujis[j].shokin;
            }
            Console.WriteLine(totalshokin);
        }
    }
}

Measured memory_bytes: 9416
N, K = map(int, input().split())
x = list(map(int, input().split()))
ans = 10 ** 10

for i in range(N - K + 1):
    ans = min(ans, abs(x[i + K - 1] - x[i]) + min(abs(x[i + K - 1]), abs(x[i])))

print(ans)


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

F = [0]*50
F[0] = 1
F[1] = 1
if n== 0 or n==1:
    print(F[n])
else:
    for i in range(2,n+1):
        F[i] = F[i-1]+ F[i-2]
    print(F[n])


Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vs vector<string>
int main()
{
    string s; cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes";
    else cout<<"No";
}

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

typedef struct{
  double x;
  double y;
}point;

void kock(int n,point p1, point p2){
  point s,t,u;
   double rad =60*M_PI/180;
  if (n == 0) return;

  s.x=(2*p1.x+p2.x)/3.0;
  s.y=(2*p1.y+p2.y)/3.0;
  t.x=(p1.x+2*p2.x)/3.0;
  t.y=(p1.y+2*p2.y)/3.0;
  u.x=(t.x-s.x)* cos(rad)-(t.y-s.y)*sin(rad)+s.x;
  u.y=(t.x-s.x)* sin(rad)+(t.y-s.y)*cos(rad)+s.y;
    
    kock(n-1, p1, s);
  
  printf("%f %f\n",s.x,s.y);
  kock(n-1, s, u);
  
  printf("%f %f\n",u.x,u.y);
  kock(n-1, u, t);
  
  printf("%f %f\n",t.x,t.y);
  kock(n-1, t, p2);
}

int main(){
  int n;
  scanf("%d",&n);
  point p1,p2;
 
  p1.x=0.0;
  p1.y=0.0;
  p2.x=100.0;
  p2.y=0.0;
  printf("%f %f\n",p1.x,p1.y);
  kock(n,p1,p2);
  printf("%f %f\n",p2.x,p2.y);
  return 0;
}

Measured memory_bytes: 640
k=int(input())
q=[1,2,3,4,5,6,7,8,9]
for i in range(k):
    l=q[i]
    if l%10!=0:
        q.append(10*l+l%10-1)
    q.append(10*l+l%10)
    if l%10!=9:
        q.append(10*l+l%10+1)
print(l)

Measured memory_bytes: 22820
def greatest_common_divisor(a, b):
    a, b = max(a, b), min(a, b)
    while b != 0:
        a, b = b, a % b
    return a


if __name__ == '__main__':
    a, b = list(map(int, input().split()))
    print(greatest_common_divisor(a, b))



Measured memory_bytes: 5600
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(
					System.in));
			int n = Integer.parseInt(br.readLine());
			String[] strArray = br.readLine().split("\\s");
			
			for (int i = n - 1; 0 < i + 1; i--) {
				System.out.print(strArray[i]);
				if(i == 0){
					System.out.println();
				}else{
					System.out.print(" ");
				}	
			}
			
			br.close();
		} catch (Exception e) {
			System.err.println(e);
		}
	}
}

Measured memory_bytes: 16908
#include <stdio.h>
#include <stdbool.h>

#define M 1000
#define VM 10000

int n,l;
int a[M],b[M],T[VM+1];

int sol(){
  int i,ans=0,an1,cur,s,m,v;
  bool V[M];

  for(i=0;i<n;i++){
    b[i]=a[i];
    V[i]=false;
  }

  asort(b);

  for(i=0;i<n;i++) T[b[i]]=i;
  for(i=0;i<n;i++){
    if(V[i]) continue;
    cur=i;
    s=0;
    m=VM;
    an1=0;
    while(1){
      V[cur]=true;
      an1++;
      v=a[cur];
      m=min(m,v);
      s+=v;
      cur=T[v];
      if(V[cur]) break;
    }
    ans+=min(s+(an1-2)*m,m+s+(an1+1)*l);
  }
  return ans;
}

int min(int a,int b){
  if(a>b) return b;
  else return a;
}
      
void asort(int b[]){
    int i,j,tmp;
    
    for (i=0;i<n;i++) {
    for (j=i+1;j<n;j++) {
      if (b[i]>b[j]) {
        tmp=b[i];
        b[i]=b[j];
        b[j]=tmp;
      }
    }
  }

  }

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

  l=VM;
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    l=min(l,a[i]);
	  }

  ans=sol();
  printf("%d\n",ans);
  
  return 0;
  
}

Measured memory_bytes: 616
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#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() {
  string S;
  cin >> S;
  int cnt = 0;
  rep(i,S.size()/2) {
    if (S[i] != S[S.size()-1-i]) ++cnt;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
using namespace std;


// ============union_find_tree===============
ll MAX_N = 200010;
vector<ll> par(MAX_N);//MAX_N == num of node
vector<ll> tree_rank(MAX_N);

void init(ll n)
{
  for (ll i = 0; i < n; ++i)
  {
    par.at(i) = i;
    tree_rank.at(i) = 0;
  }
}

ll find(ll x)
{
  if (par.at(x) == x)
  {
    return x;
  }
  else
  {
    return par.at(x) = find(par.at(x));
  }
}

void unite(ll x, ll y)
{
  x = find(x);
  y = find(y);
  if (x == y)
  {
    return;
  }
  if (tree_rank.at(x) < tree_rank.at(y))
  {
    par.at(x) = y;
  }
  else
  {
    par.at(y) = x;
    if (tree_rank.at(x) == tree_rank.at(y))
    {
      tree_rank.at(x)++;
    }
  }
}

bool same(ll x, ll y)
{
  return find(x) == find(y);
}
// =======================================


int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, M;
  cin >> N >> M;
  init(N);
  for (ll i = 0; i < M; ++i) {
    ll a, b;
    cin >> a >> b;
    a -= 1;b -= 1;
    unite(a, b);
  }
  vector<ll> num(N + 1, 0);
  for (ll i = 0; i < N; ++i) {
    num.at(find(i)) += 1;
  }
  ll ans = 0;
  for (ll i = 0; i <= N; ++i) {
    ans = max(num.at(i), ans);
  }
  cout << ans << "\n";
}


Measured memory_bytes: 7940
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
int main(){
    int n;
    cin>>n;
    vector<int> x(n);
    rep(i,n){
        cin>>x[i];
    }
    all(x);
    int xmin = x[0],xmax=x[n-1];
    int sumin=90000000;
    for(int p=xmin;p<=xmax;p++){//それぞれのpに対して消費体力を求める
        int sum=0;
        rep(i,n){
            sum += (p-x[i])*(p-x[i]);
        }
        if(sum<sumin){
            sumin = sum;
        }
    }
    cout<<sumin<<endl;
}

Measured memory_bytes: 256