akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

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

		int h = scan.nextInt();
		int w = scan.nextInt();
		int k = scan.nextInt();

		char[][] s = new char[h+1][w+1];
		int[][] a = new int[h+1][w+1];

		for(int i = 1; i < h+1; i++) {
			String tmp = scan.next();
			for(int j = 1; j < w+1; j++) {
				s[i][j] = tmp.charAt(j-1);
			}
		}


		int cs = 0;	//何番目のイチゴの領域か
		boolean[] raws = new boolean[h+1];	//その行で既にイチゴに出会ったか

		for(int i = 1; i < h+1; i++) {
			raws[i] = false;

			for(int j = 1; j < w+1; j++) {
				if(s[i][j] == '#') {
					cs++;
					if(!raws[i]) {
						int p = 1;
						while(p < j) {
							a[i][p] = cs;
							p++;
						}
						raws[i] = true;
					}
				}

				if(raws[i]) {
					a[i][j] = cs;
				}
			}
		}

		//イチゴが無い行の領域分け
		int first = 0;	//最初にイチゴがある行
		int index = 1;
		while(first < 1) {
			if(raws[index]) {
				first = index;
			}
			index++;
		}


		for(int i = first-1; i > 0; i--) {//まずfirstより↑をうめる
			for(int j = 1; j < w+1; j++) {
				a[i][j] = a[i+1][j];
			}
		}

		for(int i = first+1; i < h+1; i++) {
			if(!raws[i]) {
				for(int j = 1; j < w+1; j++) {
					a[i][j] = a[i-1][j];
				}
			}
		}

		for(int i = 1; i < h+1; i++) {
			for(int j = 1; j < w+1; j++) {
				System.out.print(a[i][j]+" ");
			}
			System.out.println();
		}

	}

}


Measured memory_bytes: 46304
n, d = map(int, input().split())
Xlist = []

for i in range(n):
    l = list(map(int, input().split()))
    Xlist.append(l)

ans = 0
tmp = 0

for i in range(n-1):
    for j in range(i+1, n):
        for k in range(d):
            tmp += (Xlist[i][k] - Xlist[j][k]) ** 2
        a = int(tmp ** 0.5) ** 2
        if a == tmp:
            ans += 1
        tmp = 0

print(ans)

Measured memory_bytes: 3064
#coding:utf-8

s = input()
tap = list(s)
e_tap = tap[1::2]
o_tap = tap[0::2]
#print(o_tap, e_tap)
o = 0
e = 0
for i in e_tap:
    if i == 'R':
        o = 1
        break

for i in o_tap:
    if i == 'L':
        e = 1
        break

if o == 0 and e == 0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  const inf = 1e9;
  const dx = [0,1,0,-1], dy = [-1,0,1,0], dd = 4;
  var [h,w,k] = nexts(3);
  var [sy,sx,gy,gx] = nexts(4);
  var c = Array(h+2);
  c[0] = xArray("'@'",w+2).join("");
  for(var i = 0; i < h; i++)c[i+1] = "@"+nextstr()+"@";
  c[h+1] = xArray("'@'",w+2).join("");
  var dist = xArray(inf,h+2,w+2);
  dist[sy][sx] = 0;
  var q = [sy,sx], d = 0;
  while(q.length){
    var p = [];
    while(q.length){
      var x = q.pop(), y = q.pop();
      for(var i = 0; i < dd; i++){
        var xx = x, yy = y;
        for(var j = 0; j < k; j++){
          xx += dx[i], yy += dy[i];
          if(c[yy][xx] === "@")break;
          if(dist[yy][xx] <= d)break;
          if(dist[yy][xx] > d+1)p.push(yy,xx),dist[yy][xx] = d+1;
         }
      }
    }
    q = p, d++;
  }
  return dist[gy][gx] === inf ? -1 : dist[gy][gx];
}

Measured memory_bytes: 125380
// #includes {{{
#ifdef MY_DEBUG
#include "header/header.hpp"
#else
#include <bits/stdc++.h>
#endif

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug

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

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

template<class T>
T inf(){
	return numeric_limits<T>::has_infinity?numeric_limits<T>::infinity():(numeric_limits<T>::max()/2);
}

typedef pair<int,int> pii;

#ifdef MY_DEBUG
#include"print.hpp"
#include"debug.hpp"
#endif
// }}}

//{{{ main fucnction
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int N,M;
	cin>>N>>M;
	vector<uint> v(N);
	REP(i,M){
		int k;
		cin>>k;
		REP(j,k){
			int s;cin>>s;
			s--;
			v[s]^=(1<<i);
		}
	}
	vector<int> p(M);
	REP(i,M)cin>>p[i];
	int ans = 0;
	const uint B = (1u<<N);
	REP(b,B){
		uint t = 0;
		REP(i,N){
			if((1u<<i)&b){
				t ^= v[i];
			}
		}
		int sum = 0;
		REP(i,M){
			if(t&(1u<<i)){
				if(p[i])sum++;
			}else{
				if(!p[i])sum++;
			}
		}
		if(sum==M)ans++;
	}
	cout<<ans<<endl;
	return 0;
}
//}}}



Measured memory_bytes: 256
from itertools import combinations_with_replacement

n,m,q =map(int,input().split())
summa=[]
res=[]
for i in range(q):
    a=[int(i) for i in input().split()]
    summa.append(a)
    
for i in combinations_with_replacement(list(range(1,m+1)),n):
    cnt=0
    for j in summa:
            if i[j[1]-1]-i[j[0]-1]==j[2]:
                cnt += j[3]
            
    res.append(cnt)
    
print(max(res))

Measured memory_bytes: 12628
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        //Solve();
        return;
    }

    public static string Solve()
    {
        int N = ReadInt();
        int[] A = ReadInts();
        int[] B = ReadInts();
        int[] C = ReadInts();
        int old = -2;
        int ans = 0;
        for (int i = 0; i < N; i++)
        {
            ans += B[A[i] - 1];
            if (A[i] == old + 1)
            {
                ans += C[A[i] - 2];
            }
            old = A[i];
        }
        return ans.ToString();
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 13140
#include <iostream>
#include <cmath>
#include <cstdio>
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
    ll r,d,x;
    cin>>r>>d>>x;
    ll flag=x;
    for(int i=0;i<10;i++){
        flag=r*flag-d;
        cout<<flag<<endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 14;
const int INF = (int)1e9;
int dp[1 << MAXN];
bool OK[1 << MAXN];

int main() {
    int N, M;
    scanf("%d %d", &N, &M);
    OK[0] = 1;
    for (int i = 1; i < (1 << N); i++) {
        dp[i] = INF;
    }
    for (int i = 0; i < M; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        int num = 0;
        for (int j = 0; j < b; j++) {
            int tmp;
            scanf("%d", &tmp);
            tmp--;
            num |= (1 << tmp);
        }
        for (int j = (1 << N) - 1; j >= 0; j--) {
            if (!OK[j]) continue;
            OK[j | num] = 1;
            dp[j | num] = min(dp[j | num], dp[j] + a);
            //printf("j | num = %d dp[j | num] = %d\n", j | num, dp[j | num]);
        }
    }
    if (!OK[(1 << N) - 1]) puts("-1");
    else printf("%d\n", dp[(1 << N) - 1]);
    return 0;
}


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

int main() {
  string s;
  ll k;
  cin >> s >> k;
  int ans = 1;
  rep(i, min(k, (ll)s.size())) {
    if (s[i] != '1') {
      ans = s[i] - '0';
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#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 n,d;
    int count =0;
     cin >> n >> d;

    vector<vector<int>> zahyou(n,vector<int>(d));
    rep(i,n){
        rep(j,d){
            cin >> zahyou.at(i).at(j);
        }
    }
   for(int i=0; i<n-1; i++){
       for(int j=i+1; j<n; j++){
           int a=0;
           rep(k,d){
               a+= pow((zahyou.at(i).at(k) -zahyou.at(j).at(k)),2);
           }
           int d=sqrt(a);
           double e=sqrt(a);
           if(d==e) count ++;
       }
   }
   cout << count << endl;
}

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


int main(){
    int N,M;
    cin>>N>>M;
    vector<int>s(M);
    vector<int>c(M);
    for(int i=0;i<M;i++)
    {cin>>s[i]>>c[i];}
    int answer=0;
    int finish=0;
    while(answer<1001&&finish<1)
    {string copy=to_string(answer);
        int crt=0;
        if(copy.size()!=N){crt++;}
        for(int i=0;i<M;i++){
            
            if(copy[s[i]-1]!='0'+c[i]){crt++;}}
        if(crt==0){finish++;}
        answer++;
       
    }
    if(answer<1001){cout<<answer-1<<endl;}
    else{cout<<-1<<endl;}
}




Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define N 2*1000000
#define min(x,y) (x)<(y)?(x):(y)
long long a[N];
long long sum[N + 400];
long long Min =1e10;
int main() {
	long long n, m;
	scanf("%lld", &n);
	sum[0] = 0;
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &a[i]);
		sum[i] = sum[i - 1] + a[i];
	}
	for (int i = 1; i <= n - 1; i++) {
		Min = min(abs(sum[i] - (sum[n] - sum[i])), Min);
	}
	printf("%lld\n", Min);
	return 0;
}

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

int main(){
  string s,t;
  int count=0;
  cin >> s >> t;
  for(int i=0;i<s.size();i++){
    if(s[i] != t[i])
      count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3916
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<queue>
#include<cstring>
#include<climits>
#include<sstream>
#include<deque>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>

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

using namespace std;

typedef long long ll;

int cnt[100][300];
int main() {
  int n;
  cin >> n;
  rep(i,n) {
    string s;
    cin >> s;
    rep(j,(int)s.size()) ++cnt[i][s[j]];
  }
  string ans = "";
  vector<int> vec(26,INT_MAX);
  rep(i,n) {
    rep(j,26) vec[j] = min(vec[j],cnt[i]['a'+j]);
  }
  rep(i,26) {
    if( vec[i] == INT_MAX ) continue;
    ans += string(vec[i],'a'+i);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/*
 AUTHOR : ANSHU BABU RAJPUT
 
    JAI MAA SARASWATI
    OM NAMAH SHIVAY
    JAI SHRI KRISHNA
    JAI SHRI RAM
    BHARAT MATA KI JAI

    #PKMKB	
    #CKMKB
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int  long long 
#define endl    ("\n")
#define ff       first
#define ss      second
#define pb   push_back
#define pf  push_front
#define ppb   pop_back
#define ppf  pop_front
#define mp   make_pair
#define mod 1000000007

#define L(x)    x.length()
#define B(x)     x.begin()
#define E(x)       x.end()
#define F(x)     x.front()
#define SZ(x)     x.size()
#define CLR(x)   x.clear()

#define all(x)                      x.begin(),x.end()
#define sortD(x) sort(x.begin(),x.end(),greater<int>)
#define rev(x)             reverse(x.begin(),x.end())

#define intV vector<int>

#define PI          (3.141592653589)
#define PMAX     priority_queue<int>
#define PMIN             priority_queue<int,vi,greater<int>>
#define setbits(x)                   __builtin_popcountll(x)
#define zrobits(x)                        __builtin_ctzll(x)

#define KING(i, n) for (int(i) = 0; (i) < n; (i)++)
#define MAHAKAL(i, n) for (int(i) = n-1; (i) >= 0; (i)--)

#define Anshu        int t; cin>>t; while(t--)
#define SITARAM(n,type) type* input=new type[n]

mt19937                          rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void ViLiFY_KiNG()
{
    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);
    freopen("error.txt","w",stderr);
#endif
}
 
int32_t main()
{
    ViLiFY_KiNG();
    int a,b;
  cin>>a>>b;
  cout<<a*b<<endl;
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <stack>
#include <iomanip>
#include <functional>
#include <array>
#include <memory>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#undef NDEBUG
#include <assert.h>

using namespace std;
typedef long long ll;


ll cube(ll x) { return x*x*x;  }
ll f(ll n, ll k) {
	if (n <= 0) return 0;
	ll res = n / k;
	return cube(res);
}

ll sign(ll x) {
	return x == 0 ? 0 : x > 0 ? 1 : -1;
}

ll upp(ll a, ll b) {
	if (a%b == 0) return a / b;
	ll x = (ll)floor((long double)(a + b - 1) / (long double)b);
	return x;
};

ll dww(ll a, ll b) {
	if (a%b == 0) return a / b;
	ll x = (ll)floor((long double)a / (long double)b);
	return x;
}

ll f() {

	ll n, k;
	cin >> n >> k;
	if (k & 1)
		return f(n, k);
	
	
	ll lo = upp(1 - k / 2, k);
	ll hi = dww(n - k / 2, k);
	

	return f(n, k) + cube(max(0LL, hi - lo + 1));
}

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

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

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

#define pb push_back
#define mk make_pair
#define lob lower_bound
#define upb upper_bound
#define fst first
#define scd second

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

inline int read(){
	int f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
inline ll readll(){
	ll f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int MAXN=605;
const int dx[4]={1,1,-1,-1},dy[4]={1,-1,1,-1};
int n,d1,d2,a[MAXN][MAXN],b[MAXN][MAXN];
vector<pii>v1,v2;
void dfs1(int x,int y){
	for(int i=0;i<(int)v1.size();++i){
		for(int k=0;k<4;++k){
			int xx=x+v1[i].fst*dx[k],yy=y+v1[i].scd*dy[k];
			if(xx>=0&&xx<2*n&&yy>=0&&yy<2*n){
				if(!a[xx][yy]){
					a[xx][yy]=3-a[x][y];
					dfs1(xx,yy);
				}
				else assert(a[xx][yy]!=a[x][y]);
			}
		}
	}
}
void dfs2(int x,int y){
	for(int i=0;i<(int)v2.size();++i){
		for(int k=0;k<4;++k){
			int xx=x+v2[i].fst*dx[k],yy=y+v2[i].scd*dy[k];
			if(xx>=0&&xx<2*n&&yy>=0&&yy<2*n){
				if(!b[xx][yy]){
					b[xx][yy]=3-b[x][y];
					dfs2(xx,yy);
				}
				else assert(b[xx][yy]!=b[x][y]);
			}
		}
	}
}
int cnt[4];
int main() {
	n=read();d1=read();d2=read();
	for(int i=0;i*i<=d1;++i){
		int t=sqrt(d1-i*i);
		if(t*t==d1-i*i){
			//cout<<"v1 "<<i<<" "<<t<<endl;
			v1.pb(mk(i,t));
		}
	}
	for(int i=0;i*i<=d2;++i){
		int t=sqrt(d2-i*i);
		if(t*t==d2-i*i){
			//cout<<"v2 "<<i<<" "<<t<<endl;
			v2.pb(mk(i,t));
		}
	}
	for(int i=0;i<2*n;++i){
		for(int j=0;j<2*n;++j){
			if(!a[i][j])a[i][j]=1,dfs1(i,j);
		}
	}
	for(int i=0;i<2*n;++i){
		for(int j=0;j<2*n;++j){
			if(!b[i][j])b[i][j]=1,dfs2(i,j);
		}
	}
	for(int i=0;i<2*n;++i){
		for(int j=0;j<2*n;++j){
			assert(a[i][j]);
			assert(b[i][j]);
			int t=0;
			if(a[i][j]==1)t|=1;
			if(b[i][j]==1)t|=(1<<1);
			cnt[t]++;
		}
	}
	for(int t=0;t<4;++t){
		if(cnt[t]>=n*n){
			int cc=0;
			for(int i=0;i<2*n;++i){
				for(int j=0;j<2*n;++j){
					assert(a[i][j]);
					assert(b[i][j]);
					int tt=0;
					if(a[i][j]==1)tt|=1;
					if(b[i][j]==1)tt|=(1<<1);
					if(tt==t){
						printf("%d %d\n",i,j);
						cc++;
						if(cc==n*n)return 0;
					}
				}
			}
			assert(0);
		}
	}
	assert(0);
	return 0;
}

Measured memory_bytes: 32000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""abc081_a"""

import sys
import pprint
import re

import itertools
pp = pprint.PrettyPrinter(indent=2)

def main():
    """Main function."""
    s = input()

    print(s.count('1'))


if __name__ == '__main__':
    sys.exit(main())

Measured memory_bytes: 3700
using System;
class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(" ");
        var A = int.Parse(input[0]);
        var B = int.Parse(input[1]);

        var count = 0;
        for(int i = A; i <= B; i++)
        {
            var str = i.ToString();

            if (str[0] == str[4] && str[1] == str[3]) count++;
        }

        Console.WriteLine(count);
    }
}


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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end



int main(){
   int d,t,s; cin>>d>>t>>s;
   if(d<=t*s)puts("Yes");
   else puts("No");
   return 0;
}

Measured memory_bytes: 3628
import sys

s = input()
ans = 0

for i in range(1,len(s)):
    if s[0] == "0":
        if i % 2 != 0:
            if s[i] != "1":
                ans += 1
        else:
            if s[i] != "0":
                ans += 1
    elif s[0] == "1":
        if i % 2 != 0:
            if s[i] != "0":
                ans += 1
        else:
            if s[i] != "1":
                ans += 1

print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <stdio.h>
#include <vector>
#include <algorithm> // sort
#include <map>
#include <set> 
using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    vector<tuple<int,long long int,int>>pyi(m);
    int p;
    long long y;
    for(int i=0;i<m;i++){
        cin>>p>>y;
        pyi[i]=make_tuple(p,y,i);
    }
    sort(pyi.begin(),pyi.end());
    int c=1;
    int p1;
    int p2;
    int k;
    vector<tuple<int,int,int>>ipy1(m);
    for(int i=0;i<m;i++){
        tie(p1,y,k)=pyi[i];
        ipy1[i]=make_tuple(k,p1,c);
        if(i==m-1)break;
        tie(p2,y,k)=pyi[i+1];
        if(p1!=p2)c=1;
        else c++;
    }
    sort(ipy1.begin(),ipy1.end());
    for(int i=0;i<m;i++){
        tie(k,p,c)=ipy1[i];
        printf("%06d",p);
        printf("%06d\n",c);
    }
}

Measured memory_bytes: 4992
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Jul 25 22:14:29 JST 2020
 **/

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

signed main() {
    int n;
    std::cin >> n;
    int x[n], y[n];
    Int p[n];
    REP(i, n) std::cin >> x[i] >> y[i] >> p[i];
    std::vector<int> x_ord(n), y_ord(n);
    std::iota(ALL(x_ord), 0), std::sort(ALL(x_ord), [&](int i, int j) { return x[i] < x[j]; });
    std::iota(ALL(y_ord), 0), std::sort(ALL(y_ord), [&](int i, int j) { return y[i] < y[j]; });
    int min_dist[n], orig_dist[n];
    REP(i, n) orig_dist[i] = std::min(std::abs(x[i]), std::abs(y[i]));
    std::vector<Int> ans(n + 1, 1e18);
    REP(S, 1 << n) {
        Int cnt = __builtin_popcount(S);
        // Sの部分集合の列挙
        for (int T = S;; T = (T - 1) & S) {
            // 操作
            REP(i, n) min_dist[i] = orig_dist[i];
            REP(_, 2) {
                int l = 1e9;
                for (int i : x_ord) {
                    if (T >> i & 1) l = x[i];
                    chmin(min_dist[i], std::abs(x[i] - l));
                }
                std::reverse(ALL(x_ord));
            }
            REP(_, 2) {
                int l = 1e9;
                for (int i : y_ord) {
                    if ((S ^ T) >> i & 1) l = y[i];
                    chmin(min_dist[i], std::abs(y[i] - l));
                }
                std::reverse(ALL(y_ord));
            }
            Int acc = 0;
            REP(i, n) acc += p[i] * min_dist[i];
            chmin(ans[cnt], acc);
            if (T == 0) break;
        }
    }
    for (Int z : ans) std::cout << z << "\n";
}


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

signed main()
{
  int x,k,d;
  cin>>x>>k>>d;
  if(x<0)
    x*=-1;
  int ans;
  int closest_pos = (x/d)*d  ,  closest_neg = closest_pos + d ;
  if(k>=((x/d)+1))
  {
      if(k%2==(x/d)%2)
    ans = x - closest_pos  ;
    else
    ans = closest_neg - x;
  }
  else ans = x - (k*d);
  cout<<ans;
}


Measured memory_bytes: 3632
n = int(input())
V = [[] for i in range(n+1)]
for i in range(n-1):
    a,b = map(int,input().split())
    V[a].append([b,i])
    V[b].append([a,i])
m = 0
for W in V:
    m = max(m, len(W))
from collections import deque
q = deque([])
reach = [-1]*(n+1)
q.append([1,0])
reach[1] = 0
color = [0]*(n-1)
while q:
    x,c = q.popleft()
    j = 1
    for W,i in V[x]:
        if c == j:
            j += 1
        if reach[W] == -1:
            reach[W] = 0
            q.append([W, j])
            color[i] = j
            j += 1
print(m)
for i in range(n-1):
    print(color[i])

Measured memory_bytes: 47560
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define MAX 510000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

//cout << fixed << setprecision(10);//
//最小公倍数//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//逆元mod(mを法とするaの逆元)//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
ll COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//nが大

ll com(ll n,ll m){
	if(n<=0 || m<=0 || n==m){
		return 1;
	}
	if(n<m){
		return 0;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}

	return k;
}


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




int main() {

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

sort(a,a+n,greater<int>());
int k[201];
for(int i=1;i<=200;i++){
	k[i]=0;
}

int s;
if(a[0]%2){
s=(a[0]+1)/2;
for(int i=s;i<=a[0];i++){
	k[i]=2;
}
}

if(a[0]%2==0){
	s=a[0]/2;
	for(int i=s;i<=a[0];i++){
		if(i==s){k[s]=1;}
		else{k[i]=2;}
	}
}

for(int i=0;i<=n-1;i++){
if(a[i]<s){
	cout<<"Impossible"<<endl;
	return 0;}
	if(a[0]%2==0){
		int q=0;
		for(int k=0;k<=n-1;k++){
			if(a[k]==s) q++;
		}
		if(q>=2){
			cout<<"Impossible"<<endl;
			return 0;
		}
	}

if(a[0]%2==1){
		int q=0;
		for(int k=0;k<=n-1;k++){
			if(a[k]==s) q++;
		}
		if(q>=3){
			cout<<"Impossible"<<endl;
			return 0;
		}
	}

}

for(int i=1;i<=200;i++){
	if(k[i]){
		for(int j=0;j<=n-1;j++){
			if(a[j]==i){
				a[j]=0;
				k[i]--;
				break;
			}
		}
	}
if(k[i]){
		for(int j=0;j<=n-1;j++){
			if(a[j]==i){
				a[j]=0;
				k[i]--;
				break;
			}
		}
	}

}

for(int i=1;i<=200;i++){
	if(k[i]){
		cout<<"Impossible"<<endl;
		return 0;
	}
}

cout<<"Possible"<<endl;
return 0;



}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int N, K, h[100000];
    cin >> N >> K;
    REP(i, N) {
        cin >> h[i];
    }
    sort(h, h + N);
    int res = 1000000000;
    REP(i, N - K + 1) {
        amin(res, h[i + K - 1] - h[i]);
    }
    cout << res << endl;
    return 0;
}


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

class modint {
  public:
    using ll = long long;
    ll num;
    static const ll MOD = 1e9+7;
    static vector<modint> factorial;

    modint(): num(0) {};
    modint(ll n_): num((n_ + MOD) % MOD) {}
    modint(const modint &r): num(r.num) {}
    operator ll() const { return (num+MOD)%MOD; }
    friend istream& operator>>(istream& is, modint &r){
        ll num_;
        is >> num_;
        r = num_;
        return is;
    }
    modint operator+(const modint &r) const { return modint(num + r.num); }
    modint operator-(const modint &r) const { return modint(num - r.num); }
    modint operator*(const modint &r) const { return modint(num * r.num); }

    template<typename T>
    modint operator^(const T &r) const {
        if(r == 0) return 1;
        return (((*this)*(*this)) ^ (r/2)) * modint(r&1 ? num : 1);
    }
    modint operator/(const modint &r) const { return num * (r^(MOD-2)); }

    modint operator+=(const modint &r) { return *this = *this + r; }
    modint operator-=(const modint &r) { return *this = *this - r; }
    modint operator*=(const modint &r) { return *this = *this * r; }
    modint operator/=(const modint &r) { return *this = *this / r; }

    template<typename T>
    modint operator^=(const T &r) { return *this = *this ^ r; }

    static modint fact(int n){
        if((int)factorial.size() <= n) factorial.resize(n+1);
        if(factorial[n]) return factorial[n];
        if(n == 0) return 1;
        return factorial[n] = modint(n) * fact(n-1);
    }

    static modint C(ll n,ll r){
        return n >= r ? fact(n)/(fact(n-r)*fact(r)) : modint(0);
    }
};
vector<modint> modint::factorial;
#define fact(n) modint::fact(n)
#define C(n,r) modint::C(n,r)
#define H(a,b) C(a+b, a)

int main(void){
    ll n,m;
    cin >> n >> m;
    vector<bool> broken(n);
    rep(i,m){
        int a;
        cin >> a;
        broken[a] = true;
    }
    vector<modint> dp(n+2);
    dp[0] = 1;
    rep(i,n){
        if (broken[i]) continue;
        dp[i+1] += dp[i];
        dp[i+2] += dp[i];
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 1024
def func(s):
    alpha = [0, 0, 0]
    ques = 0
    nowQues = 1
    ab = 0  # ABの選び方
    count = 0
    for _s in s:
        if _s == "?":
            count *= 3  # 既にabcとなっている場合の数
            count += ab  # 「? == c」とする場合
            ab *= 3
            # ある?(== B)を末尾とするABの選び方は「A+?」か「?+?」
            if ques > 0:
                ab += alpha[0] * nowQues*3  # (3 ** ques)
            else:
                ab += alpha[0]
            # ？の中からaを選ぶ場合
            if ques > 0:
                ab += ques * nowQues  # (3 ** (ques - 1))
            ques += 1
            if ques > 1:
                nowQues *= 3
        elif _s == "A":
            alpha[0] += 1
        elif _s == "B":
            # あるBを末尾とするABの選び方は「A + B」か「? + B」
            if ques > 0:
                ab += alpha[0] * nowQues*3  # (3 ** ques)
            else:
                ab += alpha[0]
            if ques > 0:
                ab += ques * nowQues  # (3 ** (ques - 1))
            alpha[1] += 1
        elif _s == "C":
            # あるCを末尾とするABCの選び方は「bSelect通り」
            count += ab
            alpha[2] += 1
        count %= 10 ** 9 + 7
        ab %= 10 ** 9 + 7
        nowQues %= 10 ** 9 + 7
        # print("{} -> alpha:{} ab:{} count:{}".format(_s, alpha, ab, count))
    return count % (10 ** 9 + 7)


"""
print(func("A??C") == 8)
print(func("ABCBC") == 3)
print(func("????C?????B??????A???????") == 979596887)
def listToString(_list, split=""):
    maped_list = map(str, _list)  # mapで要素すべてを文字列に
    mojiretu = split.join(maped_list)
    return mojiretu
print(func(listToString(["?" for _ in range(10 ** 5)])))
print("finish")
"""
print(func(input()))


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

int main(){
    int n,m,l;
    long long a[100][100]={{}};
    long long b[100][100]={{}};
    long long sum;
    cin>>n>>m>>l;
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            cin>>a[i][j];
        }
    }
    for(int i=0; i<m; i++){
        for(int j=0; j<l; j++){
            cin>>b[i][j];
        }
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<l; j++){
            sum = 0;
            for(int k=0; k<m; k++){
                sum += a[i][k]*b[k][j];
            }
            if(j==0) cout << sum;
      		else cout << " " << sum;
        }
        cout<<endl;
    }
    return 0;
}


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


int main(){
    int n;
    cin >> n;
    vector<int> Bnumber (n-1);
    rep(i,n-1)cin >>Bnumber.at(i);
    vector<int>answer(n);
    answer.at(0) = Bnumber.at(0);
    rep(i,n-1){
        answer.at(i) = min(Bnumber.at(i),answer.at(i));
        answer.at(i+1) = Bnumber.at(i); 

    }
    int all = 0;
    rep(i,n) all+=answer.at(i);

    cout<<all<<endl;
   
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		
		int x = in.nextInt();
		
		if(x==0) {
			System.out.println(1);
		}
		else {
			System.out.println(0);
		}

	}

}


Measured memory_bytes: 27060
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)

int main(){
    string s,t;
    cin >> s >> t;
    int flag[26] = {};
    int k=1;
    for(int i=0;i<s.size();i++){
        if(flag[s[i]-'a']==0){
            flag[s[i]-'a']=k;
            k++;
        }
        s[i]='a'+flag[s[i]-'a']-1;
    }
    int flag2[26] = {};
    k=1;
    for(int i=0;i<t.size();i++){
        if(flag2[t[i]-'a']==0){
            flag2[t[i]-'a']=k;
            k++;
        }
        t[i]='a'+flag2[t[i]-'a']-1;
    }

    if(s==t){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;

}

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

int main(int, char**) {
  int H, W;
  cin >> H >> W;

  vector<string> grid;
  bitset<100> row_to_delete;
  for (int i = 0; i < H; i++) {
    string s;
    int cnt = 0;
    for (int j = 0; j < W; j++) {
      char c;
      cin >> c;
      s.push_back(c);
      if (c == '.')
        ++cnt;
    }
    grid.push_back(s);
    if (cnt == s.size())
      row_to_delete.set(i);
  }

  bitset<100> col_to_delete;
  for (int j = 0; j < W; j++) {
    int cnt = 0;
    for (int i = 0; i < H; i++) {
      if (grid[i][j] == '.')
        ++cnt;
    }
    if (cnt == H)
      col_to_delete.set(j);
  }

  for (int i = 0; i < H; i++) {
    if (row_to_delete[i])
      continue;
    for (int j = 0; j < W; j++) {
      if (!col_to_delete[j])
        cout << grid[i][j];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
// A.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
	string s;
	cin >> s;
	bool ans = (int)s.find('7') >= 0;
	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(void){
    int n, x, d = 0, l, m = 1;
    cin >> n >> x;
    for(int i=0;i<n;i++){
        cin >> l;
        d += l;
        if(d <= x)m++;
    }
    cout << m << endl;
    
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stack>
using namespace std;

int main(){
    int n,q,query,x,t;;
    scanf("%d %d", &n,&q);
    stack<int> A[n];
    for (int i = 0; i < q; i++)
    {        
        scanf("%d %d", &query,&t);
        switch (query){
            case 0:
                scanf("%d",&x);
                A[t].push(x);                       
                break;
            case 1:
                if (!A[t].empty()) printf("%d\n",A[t].top());
                break;
            case 2:
                if (!A[t].empty()) A[t].pop();
                break;
            default:
                break;
        }
    }    
    return 0;
}


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

using namespace std;

//note: Erd\"os-Straus conjecture

int main(void) {
	long long N;
	cin >> N;
	if(N % 2 == 0) {
		cout << (N / 2) << ' ' << N << ' ' << N << '\n';
		return 0;
	}
	long long p;
	for(long long i = 2; i <= N; ++i) {
		if(N % i == 0) {
			p = i;
			break;
		}
	}
	long long g = N / p;
	if(p % 4 == 3) {
		long long n = (p - 3) / 4;
		cout << g * 2 * (n + 1) << ' ' << g * 2 * (n + 1) << ' ' << g * (n + 1) * (4 * n + 3) << '\n';
		return 0;
	}
	if(p % 8 == 5) {
		long long m = (p - 5) / 8;
		cout << g * 2 * (m + 1) << ' ' << g * (m + 1) * (8 * m + 5) << ' ' << g * 2 * (m + 1) * (8 * m + 5) << '\n';
		return 0;
	}
	if(p % 24 == 17) {
		long long k = (p - 17) / 24;
		cout << g * 6 * (k + 1) << ' ' << g * (k + 1) * (24 * k + 17) << ' ' << g * 6 * (k + 1) * (24 * k + 17) << '\n';
		return 0;
	}
	for(long long h = 1; h <= 3500; ++h) {
		for(long long n = h; n <= 3500; ++n) {
			for(long long w = max(n, 3 * N / 4); w <= 3500; ++w) {
				if(4 * h * n * w == N * (n * w + h * w + h * n)) {
					cout << h << ' ' << n << ' ' << w << '\n';
					return 0;
				}
			}
		}
	}
	return 0;
}



Measured memory_bytes: 256
import bisect
N=int(input())
L=list(map(int,input().split()))
L.sort()
count=0
for i in range(N-2):
    for j in range(i+1,N-1):
        a=L[i]
        b=L[j]
        count+=bisect.bisect_left(L,a+b)-(j+1)
print(count)

Measured memory_bytes: 3188
package main

import (
	"bufio"
	"flag"
	"fmt"
	"io"
	"math/big"
	"os"
)

var reader *bufio.Reader
var writer *bufio.Writer

var inputFile = flag.String("input", "", "")

func init() {
	flag.Parse()
	var i io.Reader
	if *inputFile != "" {
		i, _ = os.Open(*inputFile)
	} else {
		i = os.Stdin
	}
	reader = bufio.NewReaderSize(i, 1<<20)
	writer = bufio.NewWriterSize(os.Stdout, 1<<20)
}

func println(a ...interface{}) {
	_, _ = fmt.Fprintln(writer, a...)
}

func printf(format string, a ...interface{}) {
	_, _ = fmt.Fprintf(writer, format, a...)
}

func scanf(format string, a ...interface{}) {
	_, _ = fmt.Fscanf(reader, format, a...)
}

func scan(a interface{}) {
	_, _ = fmt.Fscan(reader, a)
}

func NextInt64() int64 {
	var res int64
	scan(&res)
	return res
}

func NextInt() int {
	var res int
	scan(&res)
	return res
}

func NextIntArray(n int) []int {
	res := make([]int, n)
	for i := range res {
		scan(&res[i])
	}
	return res
}

func NextInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		scan(&res[i])
	}
	return res
}

func NextString() string {
	var res string
	scan(&res)
	return res
}

func NextBigInt() *big.Int {
	n := new(big.Int)
	n, _ = n.SetString(NextString(), 10)
	return n
}

func AbsInt64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func MinInt64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func MaxInt64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func MaxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func main() {
	defer writer.Flush()

	n := NextInt()

	var c1, c2, c3 int
	for i := 0; i < n; i++ {
		x := NextInt()
		switch x {
		case 1:
			c1 += 1
		case 2:
			c2 += 1
		case 3:
			c3 += 1
		}
	}

	dp := make([][][]float64, c1+c2+c3+1)
	for i := range dp {
		dp[i] = make([][]float64, c2+c3+1)
		for j := range dp[i] {
			dp[i][j] = make([]float64, c3+1)
		}
	}

	for k := 0; k <= c3; k++ {
		for j := 0; j+k <= c2+c3; j++ {
			for i := 0; i+j+k <= c1+c2+c3; i++ {

				if i == 0 && j == 0 && k == 0 {
					continue
				}

				dp[i][j][k] = float64(n)
				if i > 0 {
					dp[i][j][k] += float64(i) * dp[i-1][j][k]
				}
				if j > 0 {
					dp[i][j][k] += float64(j) * dp[i+1][j-1][k]
				}
				if k > 0 {
					dp[i][j][k] += float64(k) * dp[i][j+1][k-1]
				}
				dp[i][j][k] /= float64(i + j + k)
			}
		}
	}

	printf("%.10f\n", dp[c1][c2][c3])
}


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

using namespace std;
int sum(int n)
{
    int s=0;
  while(n)
  {
    s+=n%10;
    n=n/10;
  }

  return s;
}
int main()
{
  int n;
  cin>>n;
  int s;
  s=sum(n);

  if(n%s==0)
     cout<<"Yes";
     else
    cout<<"No";
}


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

using namespace std;

int cnt[2010];

int main() {
    int sum = 0;
    for (int i = 0; i <= 2000; i++)
        cnt[i] = 1000 - abs(i - 1000) + 1;
    
    int n;
    while (scanf("%d", &n) != EOF) {
        long long ans = 0;
        for (int i = 0; i <= n; i++) {
            if (i > 2000 || n - i > 2000) continue;
            ans += cnt[i] * cnt[n - i];
        }
        
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3200
#include<stdio.h>

int main()

{
    int a,b,c,d,e ;

    scanf("%d %d %d %d %d", &a, &b, &c, &d, &e) ;

    if(a==0)
    {
        printf("1\n") ;
    }
    else if(b==0)
    {
        printf("2\n") ;
    }
    else if(c==0)
    {
        printf("3\n") ;
    }
    else if(d==0)
    {
        printf("4\n") ;
    }
    else if(e==0)
    {
        printf("5\n") ;
    }


    return 0;
}

Measured memory_bytes: 1620
#include<iostream>

int main(){
    while(1){
        int a;
        char c;
        int b;
        std::cin >> a >> c >> b;
        if(c == '?') break;
        if(c == '+'){
            std::cout << a + b << std::endl;
        }
        if(c == '-'){
            std::cout << a - b << std::endl;
        }
        if(c == '*') std::cout << a * b << std::endl;
        if(c == '/') std::cout << a / b << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3092
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, X, T = MAP()

ans = -(-N//X) * T
print(ans)


Measured memory_bytes: 9928
#include <iostream>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
int main() {
  {
    char  S[3] ;
    int x;
    cin >> S ;
    FOR(i,0,3)
      if (S[i] == '1'){
        x += 1;
    }
    cout << x  << endl;
}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n,x,m[101],i,a=0,b=1001;
	scanf("%d%d",&n,&x);
	for(i=0; i<n; i++){
		scanf("%d",&m[i]);
		a=a+m[i];
		if(b>m[i]){
			b=m[i];
		}
	}
	printf("%d\n",n+(x-a)/b);
	return 0;
}

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

#define inf 0x3f3f3f3f
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <ull> vu;
typedef vector <vector <int>> vvi;
typedef pair <int, int> pi;
typedef vector <pair <int, int>> vpi;

int n;
int v[100001];

void read() {
  cin >> n;
}

void solve() {
  v[0] = 0; v[1] = 1;
  for(int i = 2; i <= n; ++i) {
    v[i] = v[i - 1] + 1;
    for(int j = 6; j <= i; j *= 6)
      v[i] = min(v[i - j] + 1, v[i]);
    for(int j = 9; j <= i; j *= 9)
      v[i] = min(v[i - j] + 1, v[i]);
  }
  cout << v[n] << "\n";
}

int main() {
  ios :: sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  //cin >> t           // PLEASE REMOVE IT IF NEEDED
  while(t) {
    --t;
    read();
    solve();
  }
  return 0;
}


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

N,M=map(int,input().split())
H=input().split()

S=[1]*N
for i in range(M):
    A,B=map(int,input().split())
    if int(H[A-1]) > int(H[B-1]): S[B-1]=0
    if int(H[A-1]) < int(H[B-1]): S[A-1]=0
    if int(H[A-1]) == int(H[B-1]): 
        S[A-1]=0
        S[B-1]=0

ans=sum(S)

print(ans)

Measured memory_bytes: 17596
#include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#define REP(i, x, n) for(int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
typedef long long int lli;
typedef pair<lli, lli> Pii;
const int INF = 10^9 +11555;

template <class T>
struct SegmentTree {
private:
    int n;
    using F = function<T(T,T)>;
    F func;
    vector<T> node;
    T initial;
public:
// vector, function,iniの順番に突っ込む。
    SegmentTree(vector<T> v,F f,T ini) {
        func = f;
        initial = ini;
        int sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, initial);
        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = func(node[2*i+1], node[2*i+2]);
    }

    void update(int x, T val) {
        x += (n - 1);
        node[x] = val;
        while(x > 0) {
            x = (x - 1) / 2;
            node[x] = func(node[2*x+1], node[2*x+2]);
        }
    }

    int find(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(r <= a || b <= l) return initial;
        if(a <= l && r <= b) return node[k];

        int vl = find(a, b, 2*k+1, l, (l+r)/2);
        int vr = find(a, b, 2*k+2, (l+r)/2, r);
        return func(vl, vr);
    }
};

int main() {
    int n,q;
    cin >> n >> q;
    lli ini ;
    ini =  ((lli) 1<<31) -1; 
    vector<lli> v(n,ini);
    //ここのsegmentTree<int>はtemplateと関係している。
    //seg(vector,λ式、初期値の順に突っ込む)
    SegmentTree<lli> seg(v,[](lli a,lli b){return min(a,b);},ini);
    for(int i=0; i<q; i++) {
        lli c, x, y; cin >> c >> x >> y;
        if(c == 0) seg.update(x, y);
        else cout << seg.find(x, y+1) << endl;
    }    
    return 0;
}


Measured memory_bytes: 6588
N,D = map(int,input().split())
#X_list = [int(input()) for i in range(N)]
#X2_list = [list(map(int,input().split())) for i in range(N)]
tmp = D + D + 1
condition = tmp
cnt = 1
while N > condition:
    condition +=tmp
    #print(condition)
    cnt+=1

print(cnt)

Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define FOR(i, c) \
  \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
const long long mod = 1e9 + 7;
typedef long long ll;  // ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef vector<VB> VBB;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>  // chmin(min,a)
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>  // operator << (cout,a);
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
int main() {
  ll z=0,k,n,m,h,w,ans=0,sum=0,Max=1,Min=1e9+1;
  double l;
  bool ok = false;
  string s,t,r;
  cin >> l;
  //cout << setprecision(15) << (double)l*l*l/27 << endl;
  double aa = l/3;
  //out << setprecision(15) << (double)aa*aa*aa << endl;
  cout << setprecision(15) << pow(l/3.0 , 3) << endl;
  return 0;
}

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

typedef long long ll;

int main()
{
    //freopen("input.txt", "r", stdin);


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

    ll* a = new ll[n + 1];

    a[0] = 0;
    for (int i = 0, x; i < n; ++i)
    {
        scanf("%d", &x);
        a[i + 1] = a[i] + x;
    }

    ll ans = 1e18;
    for (int i = n - 2; i > 1; --i)
    {

        static int cut1, cut2;
        cut1 = lower_bound(a, a + i, a[i] / 2) - a;
        if (cut1 - 1 > 0 && abs(a[i] - 2 * a[cut1 - 1]) < abs(a[i] - 2 * a[cut1]))
            --cut1;

        cut2 = lower_bound(a + i, a + n, a[i] + (a[n] - a[i]) / 2) - a;
        if (cut2 - 1 > 0 && abs(a[i] + a[n] - 2 * a[cut2 - 1]) < abs(a[i] + a[n] - 2 * a[cut2]))
            --cut2;

        static ll mx, mn;
        mx = max(max(a[cut1], a[i] - a[cut1]), max(a[cut2] - a[i], a[n] - a[cut2]));
        mn = min(min(a[cut1], a[i] - a[cut1]), min(a[cut2] - a[i], a[n] - a[cut2]));
        ans = min(ans, mx - mn);
    }

    printf("%lld", ans);

}


Measured memory_bytes: 1792
import java.io.*;
import java.util.*;
class Main{
  public static void main(String args[])throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(br.readLine());
    // String [][] dic = new String[n][2];
    Set<String> dic = new HashSet<>();
    String str[] =new String[2];
    int j;
    for(int i = 0; i<n; i++){
      str = br.readLine().split("\\s+");
      if(str[0].charAt(0)=='i'){
        dic.add(str[1]);
      }else{

        if(dic.contains(str[1])){
          System.out.println("yes");
        }else{
          System.out.println("no");
        }
      }
    }
  }
}


Measured memory_bytes: 339508