akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int t = sc.nextInt();
    int answer=0;
    answer = b*(t/a);
    System.out.println(answer);
  }
  

  
}


Measured memory_bytes: 23252
# coding: utf-8
# Your code here!
import sys
 
 
K = int(input())
S = input()
s_list = list(S)
if len(s_list) <= K:
    print(S)
    sys.exit()
else:
    ans = s_list[:K]
    ans.append('...')
    print(''.join(ans))

Measured memory_bytes: 9180
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

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

    int ans = 1;
    char tmp = S[0];
    for(int i = 1; i < N; ++i){
        if(tmp != S[i]){
            tmp = S[i];
            ans++;
        }
    }    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
typedef long long ll;

int main() {
  ll x;
  cin >> x;
  ll a = x%500;
  ll sum = 1000*(x/500)+5*(a/5);
  cout << sum << endl;
}



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

int n,pos;
vector<int> pre,in,post;

void rec(int l,int r){
	if(l>=r)return;
	int root = pre[pos++];
	int m = distance(in.begin(),find(in.begin(),in.end(),root));
	rec(l,m);
	rec(m+1,r);
	post.push_back(root);
}

void solve(){
	pos=0;
	rec(0,pre.size());
	for(int i=0;i<n;i++){
		if(i>0)cout << " ";
		cout << post[i];
	}
	cout << endl;
}

int main(){
	int r,l,a;
	cin >> n;
	for(int s=0;s<n;s++){
		cin >> a;
		pre.push_back(a);
	}
	for(int s=0;s<n;s++){
		cin >> a;
		in.push_back(a);
	}

	solve();
	return 0;
}



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

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
  int n;
  int i,j,tmp,res,in;
  int a[5010];

  while(scanf("%d",&n) && n != 0){
    res = -1000000;
    rep(i,n) scanf("%d", &a[i]);
    rep(i,n){
      tmp = 0;
      REP(j,i,n){
        tmp += a[j];
        if(res < tmp) res = tmp;
      }
    }

    printf("%d\n",res);
  }

  return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, m;
LL x[1000], y[1000], z[1000];
LL val[1000];

int main() {
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    forn(i, n) cin >> x[i] >> y[i] >> z[i];
    LL ans = -LL(1e18);
    forn(mask, 8) {
        int a = (mask & 1) ? -1 : 1;
        int b = (mask & 2) ? -1 : 1;
        int c = (mask & 4) ? -1 : 1;
        forn(i, n) {
            val[i] = a * x[i] + b * y[i] + c * z[i];
        }
        sort(val, val + n);
        reverse(val, val + n);
        LL cur = 0;
        forn(i, m) cur += val[i];
        ans = max(ans, cur);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n,m,x = map(int,input().split())

A = []
C = []
for i in range(n):
    a = list(map(int,input().split()))
    c = a[0]
    C.append(c)
    A.append(a[1:])
    
ans = 100100100100100

for i in range(2**n):
    total = 0
    r = [0]*m
    flag = True
    for j in range(n):
        if (i>>j) & 1:
            total += C[j] 
            for k in range(m):
                r[k] += A[j][k]
                
    for i in r:
        if i < x:
            flag=False
            break
    
    if flag:
        ans = min(ans,total)
        
if not flag:
    print(-1)
    exit()

print(ans)    

Measured memory_bytes: 73712
package main

import (
	"fmt"
)

func main() {
	var a int
	fmt.Scan(&a)

	if a == 22 {
		fmt.Println("Christmas Eve Eve Eve")
	} else if a == 23 {
		fmt.Println("Christmas Eve Eve")

	} else if a == 24 {
		fmt.Println("Christmas Eve")
	} else if a == 25 {
		fmt.Println("Christmas")
	}

	// fmt.Println(a)
}

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1000000000000000000;
long long mod=1000000007;


int main(){
    int h,w;
    cin>>h>>w;
    char maze[h+2][w+2];

    rep2(i,h){
        rep2(k,w){
            cin>>maze[i][k];
        }
    }

    int dx[4]={0,1,0,-1};
    int dy[4]={1,0,-1,0};
    int ans=0;
    
    rep2(i,h){
        rep2(k,w){
            queue<int>q;
            if(maze[i][k]=='#')continue;
            q.push(i);
            q.push(k);
            q.push(0);
            bool reached[h+1][w+1]={};
            reached[i][k]=true;
            int nowd;
            int total=0;

            while(!q.empty()){
            int nowy=q.front();q.pop();
            int nowx=q.front();q.pop();
            nowd=q.front();q.pop();
            total=max(nowd,total);
            rep(i,4){
                int nx=nowx+dx[i];
                int ny=nowy+dy[i];
                
                    if(nx>=1 && nx<=w && ny>=1 && ny<=h && maze[ny][nx]!='#'){

                    if(reached[ny][nx])continue;
                    q.push(ny);
                    q.push(nx);
                    q.push(nowd+1);
                    reached[ny][nx]=true;
                    }
                }
            }
            //cout<<nowd<<endl;
            ans=max(nowd,ans);
        }
        //cout<<endl;
    }
    cout<<ans<<endl;
    
    return 0;

}
/*


*/


Measured memory_bytes: 256
import sys
from collections import deque
from collections import defaultdict
import math
sys.setrecursionlimit(20000000)
input = sys.stdin.readline

n,q = map(int,input().split())
x = []
for i in range(n):
        x.append(list(map(int,input().split())))
x.sort(key = lambda x : x[2])
dd = []
zaa = []
for i in range(q):
        a = int(input())
        dd.append(a)
        zaa.append(a)
y = []

for i in range(n):
        a = x[i][0]-x[i][2]
        b = x[i][1]-1-x[i][2]
        y.append([a,b])
        zaa.append(a)
        zaa.append(b)
import bisect
ans = [-1]*q
tobi = [-1]*q
#print(dd,y)
for i in range(n):
        xx = bisect.bisect_left(dd,y[i][0])
        yy = bisect.bisect_left(dd,y[i][1]+1)
        j = xx
 #       print(xx,yy)
 #       print(ans,tobi)
        while j < yy:
                if ans[j] == -1:
                        ans[j] = x[i][2]
                        tobi[j] = yy
                        j += 1
                        
                else:
                        j = tobi[j]
for i in ans:
        print(i)

Measured memory_bytes: 125404
x , y , z , k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ab = []
for i in a:
    for j in b:
        ab.append(i+j)
ab.sort(reverse=True)
ab = ab[:k]
abc = []
for i in ab:
    for j in c:
        abc.append(i+j)
abc.sort(reverse=True)
for i in range(k):
    print(abc[i])

Measured memory_bytes: 217868
x1, y1, x2, y2 = map(int, input().split())

# 回転行列が王道らしい
x3 = x2-(y2-y1)
y3 = y2+(x2-x1)
x4 = x1-(y2-y1)
y4 = y1+(x2-x1)

print(x3, y3, x4, y4)


Measured memory_bytes: 2940
import java.util.*;
import java.lang.*;
import java.io.*;


public class Main {

    static final int MOD = 998244353;
    public static long addMod(long a, long b){
    	long tmp = (a+b)%MOD;
    	return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long subMod(long a, long b){
    	return addMod(a,-b);
    }
    public static long multMod(long a, long b){
    	long tmp = (a*b)%MOD;
    	return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long powerMod(long a, long x){ //calculate a^x
        if(x<0)return 0;
        if(x==0)return 1;
        if(x%2==0) {
        	long half = powerMod(a,x/2);
        	return multMod(half,half);
        }
        return (a*powerMod(a,x-1)) % MOD;
    }
    public static long inverseMod(long a){
        return powerMod(a,MOD-2);
    }
    public static long divMod(long a, long b){
    	return multMod(a, inverseMod(b));
    }
    public static long[] makeFactorialArray(int size){
        long[] array = new long[size];
        array[0]=1;
        for(int i=1;i<size;i++){
        	array[i]=multMod(array[i-1],i);
        }
        return array;
    }
    public static long[] makeInversedArray(long[] original){
        long[] array = new long[original.length];
        for(int i=0;i<original.length;i++){
        	array[i] = inverseMod(original[i]);
        }
        return array;
    }
    public static long combination(int n, int r, long[] fact, long[] factInv){
        return multMod(fact[n], multMod(factInv[r],factInv[n-r]));
    }

    public static void main(String[] args) {
        long[] fact = makeFactorialArray(10001);
        long[] factInv = makeInversedArray(fact);
        Scanner sc = new Scanner(System.in);
        
        int K = sc.nextInt();
        int N = sc.nextInt();
        for(int i=2;i<=2*K;i++){
        	System.out.println(solve(K,N,i,fact,factInv));
        }
    }

    //lemma 1.
    //roll N dice having K size
    //the number of all combinations is comb(N+K-1,N)
    public static long lemma1(int K,int N, long[] fact, long[] factInv){
        if(K<=0) return 0;
        return combination(N+K-1,K-1,fact,factInv);
    }
    public static long solve(int K, int N, int i, long[] fact, long[] factInv){
        if(i>K+1) return solve(K,N,2*K+2-i,fact,factInv);
        if(i%2==0){
        	int pair = i/2;
        	int independent = K - pair*2;
        	
        	int sign = 1;
        	long ans = 0;
        	for(int usePair = pair;usePair>=0;usePair--){
        	    long a = multMod(combination(pair,usePair,fact,factInv),powerMod(2,usePair));
        	    a = multMod(a, lemma1(independent+usePair,N,fact,factInv));
        	    ans = addMod(ans,a*sign);
        	    sign = -sign;
        	}
        	return ans;
        }else{
        	return solve(K,N,i-1,fact,factInv);
        }
    }
}


Measured memory_bytes: 25336
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoders {
	class Program {
		static void Main(string[] args) {
			var inputArray = retreiveLongArray();
			var inputCount = 2;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}

		 var H = inputArray[0];
          var A = inputArray[1];
          
          var count =0;
          
          while(H > 0){
            H= H-A;
            count++;
          }




			//答えの出力
			var ans =count;
			Console.WriteLine(ans);

		}

		

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray =  Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}


Measured memory_bytes: 28184
#include <iostream>
#include <stdio.h>
#include <string.h>
#define LEN 100005
using namespace std;

struct P{
	char name[1000];
	int t;
};

P Q[LEN];
int head,tail;

void enqueue(P x){
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}

P dequeue(){
	P x = Q[head];
	head = (head + 1)% LEN;
	return x;
}

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

int main(){
	int time = 0;
	int n,q;
	cin >> n >> q;
	P u;
	for(int i = 1; i <= n;i++){
		cin >> Q[i].name >> Q[i].t; 
	}
	head = 1;
	tail = n+1;

	while(head != tail){
		P u = dequeue();
		int c = min(q,u.t);
		u.t -= c;
		time += c;
		if(u.t > 0){
			enqueue(u);
		}else{
			cout << u.name << " " << time << endl;
		}

	}

	return 0;
}


Measured memory_bytes: 101132
#include<stdio.h>
#include<string.h>
int main(void)
{
    int i,j,k,n,x;
    char s[20005],p[20005],a[300]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
    scanf("%d",&x);
    scanf("%s",s);
    n = strlen(s);
    for(i=0;i<=n;i++)
    {
        for(j=0;j<26;j++)
        {
            if(s[i] == a[j])
                p[i] = a[(j+x)%26];
        }
    }
    printf("%s",p);
    return 0;
}

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

int main(){
  long int A, B;
  std::cin >> A >> B;
  long int K = A+B;
  if (K%2==0) { K /=2; }
  else { 
    std::cout << "IMPOSSIBLE" << std::endl; 
    return 0;
  }
  std::cout << K << std::endl;
  return 0;
}


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

int pos[51];

int main() {
    int n,m;
    cin >> n >> m;
    while(m--){
        int a,b;
        cin >> a >> b;
        pos[a]++,pos[b]++;
    }
    for(int i=1; i<=n; i++){
        cout << pos[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def _cmb(N, mod):
    N1 = N + 1
    fact = [1] * N1
    inv = [1] * N1

    for i in range(2, N1):
        fact[i] = fact[i-1] * i % mod

    inv[N] = pow(fact[N], mod-2, mod)
    for i in range(N-1, 1, -1):
        inv[i] = inv[i+1]*(i+1) % mod

    def cmb(a, b):
        return fact[a] * inv[b] % mod * inv[a-b] % mod
    return cmb

def resolve():
    K = int(input())
    s = input()
    ls = len(s) - 1
    mod = 10**9+7

    cmb = _cmb(ls+K, mod)

    ans = 0
    pp = 1 * pow(26, K, mod) % mod
    px = 25 * pow(26, mod-2, mod) % mod
    for i in range(K+1):
        ans = (ans + cmb(ls+i, ls) * pp % mod) % mod
        pp = pp * px % mod
    print(ans)

if __name__ == "__main__":
    resolve()


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

int main() {
  int N;
  int people = 0;
  cin >> N;
  vector<int> l(N);
  vector<int> r(N);
  for(int i = 0; i < N; i++) {
    cin >> l.at(i) >> r.at(i);
  }
  for(int i = 0; i < N; i++) {
    people += r.at(i) - l.at(i) + 1;
  }
  cout << people;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int A=sc.nextInt();
        int B=sc.nextInt();
        if(A+B>=10){
            System.out.println("error");
        }else{
            System.out.println(A+B);
        }
    }

}

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

int main()
{
    string b;
    cin>>b;
    bool a[26];
    memset(a,0,sizeof(a));
    int k=b.length();
    for(int i=0; i<k; i++)
    {
        a[b[i]-'a']=1;
    }
    int s=0;
    while(a[s]==1)
        s++;
    if(s<26&&s<=k)
    {
        char t=s+'a';
        cout<<b<<t<<endl;
    }
    else
    {
        int p=k-1;
        for(; p>=0; p--)
        {
            a[b[p]-'a']=0;
            b[p]++;
            while(a[b[p]-'a']==1)
            {
                b[p]++;
                if(b[p]>'z')
                    break;
            }
            if(b[p]<='z')
                break;
        }
        if(p==-1)
            printf("-1\n");
        else
        {
            for(int i=0; i<k; i++)
                {
                    if(b[i]<='z')
                    printf("%c",b[i]);
                    else break;
                }
            printf("\n");
        }
    }
    return 0;
}


Measured memory_bytes: 760
x1, x2, x3, x4, x5 = input().split()

if int(x1) == 0:
    print(1)
elif int(x2) == 0:
    print(2)
elif int(x3) == 0:
    print(3)
elif int(x4) == 0:
    print(4)
else:
    print(5)


Measured memory_bytes: 8980
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int sum = 0;

        for (int a = 1; a <= k; a++) {
            for (int b = 1; b <= k; b++) {
                for (int c = 1; c <= k; c++) {
                    sum += gcd(a, gcd(b, c));
                }
            }
        }
        System.out.println(sum);
    }

    private static int gcd(int m, int n){
        if(m % n == 0){
            return n;
        }
        return gcd(n, m % n);
    }
}

Measured memory_bytes: 35628
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = onem()

a = l()

a.sort()

k = a[0]

for i in range(1,n):
    k = (k+a[i])/2

print(k)

Measured memory_bytes: 66156
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    int k ,a,b;
    cin >> k >> a >> b;
    bool flag = false;
    for(int i = a; i <= b; i++){
        if(i % k == 0){
            flag = true;
        }
    }
    cout << (flag ? "OK":"NG") << endl;

}

Measured memory_bytes: 3612
#include<iostream>
#include<vector>
using namespace std;
typedef long long int ll;
static const ll MOD = 1000000007;

int main(){
	int n, k;
	cin >> n >> k;
	vector<vector<ll> > memo(k + 1, vector<ll>(n + 1, 0));
	for(int i = 0; i <= k; i++){
		for(int j = 0; j <= n; j++){
			if(i == 0 && j == 0) memo[i][j] = 1;
			else if(i == 0 || j == 0) continue;
			else{
				memo[i][j] = memo[i - 1][j - 1] + i * memo[i][j - 1];
				memo[i][j] %= MOD;
			}
		}
	}
	cout << memo[k][n] << endl;
	return 0;
}



Measured memory_bytes: 10808
n,q = map(int,input().split())
s = str(input())
a = [0]*(n+1)
c = 0
for i in range(n-1):
  if s[i] == "A" and s[i+1] == "C":
    c += 1
  a[i+2] = c
for i in range(q):
  l,r = map(int,input().split())
  print(a[r]-a[l])

Measured memory_bytes: 6060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int t,n,i,j=0,c=0;
  string s;
  cin>>s;
  for(i=1;i<s.size();i++)
  {
      if(s[i]=='1')
      {
          if(s[i-1]=='1'){
            s[i]='0';
            c++;
          }
      }
      if(s[i]=='0')
      {
          if(s[i-1]=='0'){
            s[i]='1';
            c++;
          }
      }
  }
  cout<<c<<"\n";


return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;

int main() {
    ll N, M; cin >> N >> M;
    atcoder::dsu d(N);
    for (int i = 0; i < M; ++i) {
        int a, b; cin >> a >> b; --a; --b;
        d.merge(a, b);
    }
    cout << d.groups().size() - 1 << endl;
    return 0;
}


Measured memory_bytes: 8944
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#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 rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

typedef pair<int, int> P;
int main(){
    long long n,k;
    cin>>n>>k;
    vector<int> v;
    rep(i,n){
        long long h;
        cin>>h;
        v.push_back(h);
    }
    sort(v.begin(),v.end());
    int q=v[0];
    rep(i,n){
        v[i]-=q;
        //cout<<v[i]<<endl;
    }
    vector<int> m(n-k+1);
    rep(i,n-k+1){
        m[i]=v[i+k-1]-v[i];
    }
    sort(m.begin(),m.end());
    cout<<m[0]<<endl;
}


Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int int64_t
#define ALL(a) (a).begin(),(a).end()
signed main(){
  int N;
  cin>>N;
  vector<tuple<string,int,int>> A(N);
  rep(i,0,N){
    string S;
    int X;
    cin>>S>>X;
    A.at(i)=make_tuple(S,X,i+1);
    }
  sort(ALL(A));
  string SS;
  int XX,YY;
  tie(SS,XX,YY)=A[0];
  stack<int> Q;
  Q.push(YY);
  rep(i,1,N){
    string S;
    int X,Y;
    tie(S,X,Y)=A.at(i);
    if(S!=SS){
      while(!Q.empty()){
        cout<<Q.top()<<endl;
        Q.pop();
        }
      }
    Q.push(Y);
    SS=S;
    YY=Y;
    }
  while(!Q.empty()){
        cout<<Q.top()<<endl;
        Q.pop();
        }
}


Measured memory_bytes: 256
import numba as nb
import sys
import numpy as np
@nb.njit
def solve(w,weight,value):
    total=w
    dp = np.zeros(shape=(n + 1, w + 1), dtype=np.int64)
    for i in range(l):
        for w in range(total+1):
            if weight[i]<=w:
                dp[i][w]=max(value[i]+dp[i-1][w-weight[i]],dp[i-1][w])
            else:
                dp[i][w] = dp[i-1][w]
    print(dp[l-1][total])
n,w=map(int,sys.stdin.readline().split())
weight=[0]*n
value=[0]*n
total=w
for i in range(n):
    x,y=map(int,sys.stdin.readline().split())
    weight[i]=x
    value[i]=y
l=len(weight)
solve(w,weight,value)

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

while True:
    n = list(map(int, input().split()))
    if n[0] == 0 & n[1] == 0:
        break

    for i in range(n[0]):
        for j in range(n[1]):
            if j == n[1] - 1:
                print("#")
            else:
                print('#', end='')

    print()



Measured memory_bytes: 7048
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	ld a, b, x;
	cin >> a >> b >> x;
	if (x <= a * a * b / 2) {
		ld d = x * 2 / a / b;
		cout << 90 - atan(d / b) * 180 / PI << '\n';
	}
	else {
		ld d = (a*a*b - x) * 2 / a / a;
		cout << 90 - atan(a / d) * 180 / PI << '\n';
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    int N, K;
    cin >> N >> K;
    cout << (N - K + 1) << endl;
}

Measured memory_bytes: 256
//#include<cstdio>
//#include<cstdlib>
#include <iostream>
#include <vector>
#include <queue>
//#include<bitset>
//#include<string>
//#include<stack>
//#include<set>
//#include<unordered_set>
//#include<map>
//#include<unordered_map>
//#include<cstring>
//#include<complex>
//#include<cmath>
//#include<iomanip>
//#include<numeric>
#include <algorithm>
#include <stdio.h>
//#include<list>
//#include<functional>
//#include<cassert>
using namespace std;
#define ll long long int
#define llu unsigned long long int
void pv(vector<ll> arr, ll size)
{

    for (ll i = 0; i < size; i++)
    {
        cout << arr[i] << ' ';
    }
}
ll gv(vector<ll> &arr)
{
    ll size = arr.size();
    ll m = INT32_MAX;
    for (ll i = 0; i < size; i++)
    {
        cin >> arr[i];
        m = min(m, arr[i]);
    }
    return m;
}
int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n, k;
    cin >> n >> k;
    vector<ll> arr(n);
    ll m = gv(arr);
    ll dp[k + 1] = {0};
    dp[0] = 2;
    for (ll i = 1; i <= k; i++)
    {
        dp[i] = 2;
        for (ll j = 0; j < n; j++)
        {
            if (i - arr[j] < 0)
                continue;
            if (dp[i - arr[j]] == 2)
            {
                dp[i] = 1;
            }
            // else if (dp[i - arr[i]] == 1)
            // {
            //     dp[i] = 2;
            // }
        }
    }
    if (dp[k] == 1)
    {
        cout << "First";
    }
    else
        cout << "Second";
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//-------------------------------------------------------
long DP1[100000];
long DP2[100000];
long DP3[100000];
void Calc(){
	int N = rei();
	DP1[0] = rei();
	DP2[0] = rei();
	DP3[0] = rei();
	for(int i=1;i<N;i++){
		int A = rei();
		int B = rei();
		int C = rei();
		DP1[i] = max(DP2[i-1],DP3[i-1]) + A;
		DP2[i] = max(DP1[i-1],DP3[i-1]) + B;
		DP3[i] = max(DP1[i-1],DP2[i-1]) + C;
	}
	cout << max(max(DP1[N-1],DP2[N-1]),DP3[N-1]) << endl;;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

std::string s;

int main()
{
	in >> s;
	if (s.length() % 2)
	{
		if (s[0] != s[s.length() - 1]) out << "First" << std::endl;
		else out << "Second" << std::endl;
	}
	else
	{
		if (s[0] == s[s.length() - 1]) out << "First" << std::endl;
		else out << "Second" << std::endl;
	}
	return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

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

    int n,a;
    cin >> n >> a;
    n%=500;
    if(n<=a){
        cout << "Yes";
    }
    else{
        cout << "No";
    }

    return 0;
}

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

using namespace std;

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0)
#define MAXX 200005

ll n , x;
ll a[MAXX];

int main()
{
    _FastIO;
    cin >> n;
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        if(!i)
            x = a[i];
        else
            x ^= a[i];
    }
    for(ll i = 0; i < n; i++){
        cout << (x ^ a[i])  << " ";
    }
    return 0;
}


Measured memory_bytes: 5144
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
#define N 605
int ma[N+10][N+10];
int dp[N+10][N+10],d2[N+10][N+10];
int main()
{
	int n,m;string s;
	//rep(i,N+10) ma[i]=string(N+10,'.');
	memset(ma,0,sizeof(ma));
	memset(dp,0,sizeof(dp));
	memset(d2,0,sizeof(d2));
	cin>>n>>m;
	rep(i,n){
		cin>>s;
		rep(j,m) ma[i+j][302+i-j]=(s[j]=='#');
	}
	rep(i,11){
		//REP(j,297,308) cout<<ma[i][j];cout<<endl;
	}
	rep(i,N){
		rep(j,N) dp[i][j+1]=dp[i][j]+ma[i][j],d2[i][j+1]=d2[i][j]+ma[j][i];
	}
	lint out=0;
	rep(i,N){
		rep(j,N) REP(k,j+1,N){
			if(ma[i][j]+ma[i][k]<2) continue;
			if(i>=k-j) out+=dp[i-(k-j)][k+1]-dp[i-(k-j)][j];
			if(i+k-j<=N) out+=dp[i+k-j][k+1]-dp[i+k-j][j];
		}
		rep(j,N) REP(k,j+1,N){
			if(ma[j][i]+ma[k][i]<2) continue;
			if(i>=k-j) out+=d2[i-(k-j)][k+1]-d2[i-(k-j)][j];
			if(i+k-j<=N) out+=d2[i+k-j][k+1]-d2[i+k-j][j];
		}
	}
	//cout<<out<<endl;
	rep(i,N) rep(j,N){
		if(ma[i][j]<1) continue;
		REP(k,1,N){
			if(i-k>=0 && j-k>=0 && ma[i-k][j]+ma[i][j-k]==2) out--;
			if(i+k<=N && j-k>=0 && ma[i+k][j]+ma[i][j-k]==2) out--;
			if(i-k>=0 && j+k<=N && ma[i-k][j]+ma[i][j+k]==2) out--;
			if(i+k<=N && j+k<=N && ma[i+k][j]+ma[i][j+k]==2) out--;
		}
	}
	cout<<out<<endl;
}


Measured memory_bytes: 4736
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
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 fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


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


def ZIP(n): return zip(*(MAP() for _ in range(n)))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    T = input()
    S = list(T)
    for i in range(len(S)):
        if S[i]  == "?":
            S[i] = "D"
    
    print(''.join(S))




if __name__ == '__main__':
    main()


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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, k, s;
    cin >> n >> k >> s;
    for (int i = 1; i <= k; i++) {
        cout << s << ' ';
    }
    for (int i = k + 1; i <= n; i++) {
        if (s < 50) cout << 100 << ' ';
        else cout << s - 1 << ' ';
    }
}

Measured memory_bytes: 1280
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;

int n, ans = 0, k;
vector<int> a;

int main() {
	cin >> n >> k;
	a.resize(26);
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		a[s[0] - 'A']++;
	}
	for (int i = 0; i < n; i++) {
		int no = k;

		sort(a.begin(), a.end());
		for (int j = 0; j < 26; j++) {
			if (a[25 - j] > 0) {
				a[25 - j]--;
				no--;
			}
			if (no == 0)
				break;
		}
		if (no == 0) {
			ans++;
		}
		else
			break;
	}
	cout << ans << endl;
	//cin >> n;
	return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,m,r = map(int,readline().split())
g = [[] for i in range(n)]
for i in range(m):
    x,y,w = map(int,readline().split())
    g[x].append((w,y))
    #g[y].append((w,x))

#新ダイクストラ
INF = 10**18
import heapq
push = heapq.heappush
pop = heapq.heappop
def dijkstra(s,g): #g:(weight,go)の順の隣接リスト※タプルで有ることに注意
    n = len(g)
    dist = [INF]*n
    dist[s] = 0
    used = [0]*n
    used[s] = 1
    hp = []
    for go in g[s]:
        push(hp,go)
    while hp:
        w,fr = pop(hp)

        if not used[fr]:
            dist[fr] = w
            used[fr] = 1
            for w,go in g[fr]:
                if not used[go]:
                    push(hp,(w+dist[fr],go))
    
    return dist

for i in dijkstra(r,g):
    print(i if i < INF else "INF")


Measured memory_bytes: 96968
//I am so vegetable
//#define err
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = acos(-1.0);
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }

int a[1005];
int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
    #ifdef err
	double be = clock();
    #endif
    int n,k;cin>>n>>k;
    _for(i,0,n)cin>>a[i];
    sort(a,a+n);
    int ans = 0;
    _for(i,0,k)ans+=a[i];
    cout<<ans;
    #ifdef err
	double en = clock();
    cout<<"time: "<<fixed<<setprecision(8)<<en-be;
    #endif
	return 0;
}

Measured memory_bytes: 3664
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    e = LI()
    d = defaultdict(int)
    for i in e:
        d[i] += 1
    for i in d.values():
        if i != 2:
            print("no")
            break
    else:
        print("yes")
    return

#B
def B():
    n = I()
    a = LI()
    a.sort()
    ans = -float("inf")
    for c in range(n):
        for d in range(c):
            m = a[c]-a[d]
            for i in range(n)[::-1]:
                if i != c and i != d:
                    e = i
                    break
            for i in range(e)[::-1]:
                if i != c and i != d:
                    b = i
                    break
            ans = max(ans, (a[e]+a[b])/m)
    print(ans)
    return

#C
def C():
    def gcd(a,b):
        if a == 0:
            return b
        return gcd(b%a, a)

    s = input()
    n = len(s)
    if s.count("(") == 0:
        s = float(s)
        b = 10**(n-2)
        a = round(s*b)
        g = gcd(a,b)
        a //= g
        b //= g
    else:
        n = s.find("(")
        t = float(s[:n])
        b = 10**(n-2)
        a = round(t*b)
        g = gcd(a,b)
        a //= g
        b //= g
        l = (s.find("(")-s.find(".")-1)
        s = s[n+1:-1]
        m = len(s)
        c = round(float(s))
        d = (10**m-1)*10**l
        g = gcd(c,d)
        c //= g
        d //= g
        a = a*d+b*c
        b = b*d
        g = gcd(a,b)
        a //= g
        b //= g
    print(str(a)+"/"+str(b))
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#I
def I_():
    return

#J
def J():
    return

#Solve
if __name__ == "__main__":
    C()



Measured memory_bytes: 8212
#include <iostream>

using namespace std;

char c[4];

void solve()
{
	int x = 0;
	char p;
	for (int i = 0; i < 4 && x < 3; i++) {
		if (x == 0 || p == c[i]) {
			x++;
		} else {
			x = 1;
		}
		p = c[i];
	}
	if (x == 3) cout << "Yes\n";
	else cout << "No\n";
}

int main()
{
	for (int i = 0; i < 4; i++) cin >> c[i];
	solve();
	return 0;
}

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

{
    int n,k,arr[1000],i,j;
    while(cin>>n>>k)
    {
        for(i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        sort(arr,arr+n);
        int sum=0,c=0;
        for(i=n-1;;i--)
        {
            if(c==k)break;
            sum+=arr[i];
            c++;
        }
        cout<<sum<<endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <utility>
#include <map>

/*
\cap_{u,v} \cup_{i\in (u,v) path} E_i

g(N) = |{E | {u,v\in M | \cup_{i\in (u,v) path} E_i} = N}|
G(N) = |{E | {u,v\in M | \cup_{i\in (u,v) path} E_i} \subseteq N}|
     = |{E | {u,v\in M-N | \cap_{i\in (u,v) path} !E_i}}|
*/

int n, m;
std::vector<int> E[50];

long long int M[20];
long long int A[1<<20];
std::map<std::pair<int, int>, int> edges;

long long int dfs(int u, int v, int p){
  if(u == v) return 0;
  for(int x: E[u]){
    if(x == p) continue;
    long long int b = dfs(x, v, u);
    if(b != -1) return (1LL << edges[{u, x}]) | b;
  }
  return -1;
}

int main(){
  scanf("%d", &n);
  for(int i = 0; i < n-1; i++){
    int a, b;
    scanf("%d%d", &a, &b);
    E[a-1].push_back(b-1);
    E[b-1].push_back(a-1);
    edges[{a-1,b-1}] = i;
    edges[{b-1,a-1}] = i;
  }
  scanf("%d", &m);
  for(int i = 0; i < m; i++){
    int a, b;
    scanf("%d%d", &a, &b);
    M[i] = dfs(a-1, b-1, -1);   
  }
  long long int ans = 1LL << (n-1);
  for(int i = 1; i < (1<<m); i++){
    A[i] = A[i&(i-1)] | M[__builtin_ctzll(i)];
    long long int x = 1LL << (n-1-__builtin_popcountll(A[i]));
    ans += (1-2*__builtin_parity(i))*x;
  }

  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 8448
#include<map>
#include<set>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
#define N 200010
#define int long long
#define mod 1000000007
#define debug cerr<<__LINE__<<" "<<__FUNCTION__<<"\n"

inline int read(){
    int x=0,y=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')y=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
    return x*y;
}
void put(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>=10) put(x/10);
    putchar((x%10)+48);
}
int n,m,A[N],B[N];
string s;
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read();m=read();
	cin>>s;
	if(s[0]=='B'){
		for(int i=0;i<m;i++) s[i]=(s[i]=='B'?'R':'B');
	}
	int pos=s.find('B');
	if(pos==string::npos){
		A[1]=A[2]=1;
		for(int i=3;i<=n;i++) A[i]=(A[i-1]+A[i-2])%mod;
		cout<<(A[n]+2*A[n-1]%mod)%mod<<"\n";
		return 0;
	}
	if(n&1){
		puts("0");
		return 0;
	}
	int l=0x7ffffffff,res=0,flag=1;
	for(int i=0;i<m;i++){
		if(s[i]=='B'){
			if(flag||(res&1)) l=min(l,res+2);
			flag=0;
			res=0;
		}else res++;
	}
//	cerr<<l<<"\n";
	l/=2;n/=2;
	A[0]=B[0]=1;
	for(int i=1;i<=n;i++){
		A[i]=B[i-1];
		if(i>l) A[i]=(A[i]-B[i-l-1]+mod)%mod;
		B[i]=(B[i-1]+A[i])%mod;
	}
	int ans=0;
	for(int i=1;i<=l;i++){
		ans=(ans+2*i%mod*A[n-i]%mod)%mod;
	}
	cout<<ans<<"\n";
//	fclose(stdin);
//	fclose(stdout);
	return 0;
}


Measured memory_bytes: 2180
#include<stdio.h>
#include<string.h>

int main(void){
    long int N;
    int n,k,a,p[10000],i=0;
    char s;
    
    
    scanf("%ld", &N);

    if(N>26){
        while(N>0){
            k = N % 26;
            N = (long int)(N / 26);

            p[i] = k+96;
            if(k==0){
                p[i] = 122;
                N = (long int)(N-1);
            }
            i++;
        }

        for(int j=i-1;j>-1;j--){
            printf("%c", p[j]);
        }
    }
    else{
        a=(int)N;
        printf("%c", a+96);
    }


    return 0;
}

Measured memory_bytes: 1652
n,t = map(int, input().split())

cl = []
tl = []

for i in range(n):
    cw,tw = map(int, input().split())

    if tw <= t:
        cl.append(cw)
        tl.append(tw)

if len(cl) == 0:
    print('TLE')
else:
    print(min(cl))

Measured memory_bytes: 38384
n,d = gets.split.map(&:to_i)
x = n.times.map{gets.split.map(&:to_i)}
ans = 0

for i in 0...n
  for j in i+1...n
    y = x[i]
    z = x[j]
    sum = 0
    d.times.map{|k|
      sum += (y[k]-z[k])**2
    }
    f = (1..1000).map{|k| sum/k==k && sum%k==0}.any?
    ans += 1 if f
  end
end

p ans

Measured memory_bytes: 2300
#include <iostream>
using namespace std;
int main(void){
    long long n,p,k=2,l=0,d=1;
    cin>>n>>p;
    if(n==1){
        cout<<p<<endl;
        return 0;
    }
    while(k*k<=p){
        if(p%k==0){
            p/=k;
            l++;
            if(p==k){
                l++;
                p/=k;
            }
            while(l>=n){
                d*=k;
                l-=n;
            }
            
        }else{
            k++;
            l=0;
        }
    }
    cout<<d<<endl;
}


Measured memory_bytes: 256
n=int(input())
t=0
if 600>n>399:
    t=8
elif 800>n>599:
    t=7
elif 1000>n>799:
    t=6
elif 1200>n>999:
    t=5
elif 1400>n>1199:
    t=4
elif 1600>n>1399:
    t=3
elif 1800>n>1599:
    t=2
else:
    t=1
print(t)


Measured memory_bytes: 61596
/*

*/
#include<iostream>
#include<iomanip>
#include<ios>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
#include<cstdlib>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)
#define MAX_N 10000

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

const int INF = 1<<30;
const ll MOD = ll(1e9+7);

int main(){
  string s;cin>>s;
  cout<<string(s.size(), 'x')<<endl;
  // system("read -n 1 -s -p \"Press any key to continue...\"");
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int main() {
    int N;
    string S, T;
    cin >> N >> S >> T;

    string ans = "";
    int i = 0;
    rep(j, N * 2) {
        if (j % 2 == 0) {
            ans.append(1, (char) S[i]);
        } else {
            ans.append(1, (char) T[i]);
            i++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt(), k = sc.nextInt();
		long[] a = new long[n];
		long s = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
			if(i < k) {
				s += a[i];
			}
		}
		long max = s;
		for(int i = k; i < n; i++) {
			s +=a[i] - a[i-k];
			if(s > max) {
				max = s;
			}
		}
		System.out.println((double)(max+k)/2);

	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 50648