akhauriyash/Code-Regression huggingface dataset:
{-# OPTIONS_GHC -O #-}

import Control.Monad
import Data.List
import Data.Char

main=do
    k<-readLn :: IO Int
    forM_ (take k $ chk $ [1..9] ++ [19,29..99] ++ [n*10^k+(10^k-1) | k<-[0..12], n<-[100..999]]) print

chk [] = []
chk (n:ns) = case find (\v -> (s n) > (s v)) ns of
                Just _ -> chk ns
                Nothing -> n:(chk ns)

s a = (fromIntegral a) / (fromIntegral $ sum $ map digitToInt $ show a)

Measured memory_bytes: 1660
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    H,W = map(int,input().split())
    A = [list(map(int,input().split())) for _ in range(H)]
    B = [list(map(int,input().split())) for _ in range(H)]

    dp = [[0]*(1 + W) for _ in range(H + 1)]
    x = abs(A[0][0] - B[0][0])
    dp[0][0] = 1 << (12800 + x)
    dp[0][0] |= 1 << (12800 - x)
    for i in range(H):
        for j in range(W):
            c = abs(A[i][j] - B[i][j])
            if i > 0:
                dp[i][j] |= dp[i - 1][j] << c
                dp[i][j] |= dp[i - 1][j] >> c
            if j > 0:
                dp[i][j] |= dp[i][j - 1] << c
                dp[i][j] |= dp[i][j - 1] >> c
    ans = INF
    x = dp[H - 1][W - 1]
    for i in range(25600):
        if x&1:
            ans = min(ans,abs(i - 12800))
        x >>= 1
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 20340
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);
	int height[10];
	for(int i = 0; i < 10; i++)
		cin >> height[i];

	sort(height,height + 10);

	for(int i = 9; i >= 7; i--)
		cout << height[i] << endl;
	//while(1){}
    return 0;
}

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

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

    vector<int> cnt(M, 0);
    for (int i = 0; i < N; i++)
    {
        int K;
        cin >> K;

        for (int j = 0; j < K; j++)
        {
            int A;
            cin >> A;

            cnt[--A] += 1;
        }
    }

    int ans = 0;
    for (int i = 0; i < M; i++)
    {
        if(cnt[i] == N)
        {
            ans += 1;
        }
    }

    cout << ans << endl;
    return 0;
}

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

double fun(double x)
{
	return (x*M_PI)/180.0;
}
double fun2(double x)
{
	if (x<0)
		return x*-1;
	else
		return x;
}
int main()
{
	int a,b,c,d;
	double angle,angle2,x;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	angle=fun2(30*c-5.5*d);
	angle2=fun(angle);
	x=sqrt(a*a+b*b-2*a*b*cos(angle2));
	printf("%.20lf",x);
	return 0;

}


Measured memory_bytes: 2604
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin >> A >> B;
  if(A==1)A+=13;
  if(B==1)B+=13;
  if(A>B)cout <<"Alice"<<endl;
  else if(B>A)cout <<"Bob"<<endl;
  else cout <<"Draw"<<endl;
}


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

#define fo(i, n) for(i = 0; i < n; i++)
#define of(i, n) for(i = n - 1; i >= 0; i--)
#define ll long long

bool comp(int a, int b)
{
    return (a < b);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k,max=0,flag=0,cnt=0,m,i,j,sum=0,t,y;
    long long x,ans,min;
    int a[3][3];
    fo(i,3) {fo(j,3) cin>>a[i][j];}
    cin>>n;
    vector<int> v;
    fo(i,n) {cin>>k; v.push_back(k);}
    int b[3][3];
    fo(i,n){
    fo(j,3){fo(k,3) if(v[i]==a[j][k]) b[j][k]=1; }
    }
    fo(i,3) if(b[0][i]+b[1][i]+b[2][i]==3){cout<<"Yes"<<endl; return 0;}
    fo(i,3) if(b[i][0]+b[i][1]+b[i][2]==3){cout<<"Yes"<<endl; return 0;}
    if(b[1][1]+b[2][2]+b[0][0]==3){cout<<"Yes"<<endl; return 0;}
    else if (b[0][2]+b[1][1]+b[2][0]==3) {cout<<"Yes"<<endl; return 0;}
    else cout<<"No"<<endl;
}



Measured memory_bytes: 256
import numpy as np
n,k=map(int,input().split())
h=np.array(list(map(int,input().split())))
dp=np.zeros(n,dtype="int32")
for i in range(1,n):
    start=0 if k>i else i-k
    dp[i]=np.min(dp[start:i]+np.abs(h[i]-h[start:i]))
print(dp[-1])

Measured memory_bytes: 22836
import java.util.*;

public class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		
		int a=sc.nextInt();
		if(a==3 ||a==5 || a==7)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
//#define int long long
#define double long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define ff first
#define ss second
#define frr(i,n) for(int i=0;i<n;i++)
#define td(v) v.begin(),v.end()
#define inf 1000000000 // 1e9
#define M   1000000007 // 1e9 + 7
//#define MAXN 1001000
using namespace std;
typedef vector<int> vi;
typedef set<int> se;
typedef pair<int,int> pii;
inline int mod(int n, int m){
int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}

int check(int x){
	int dig=0;
	while(x>0){
		dig++;
		x=x/10;
	}
	if(dig&1)return true;
	return false;
}

int32_t main(){
	fastio;
 	int n;
 	cin>>n;
 	int res=0;
 	for(int i=1;i<=n;i++){
		 if(check(i))res++;
	 }
	cout<<res<<endl;
}

Measured memory_bytes: 256
def examA():
    K = I()
    A, B = LI()
    for i in range(A,B+1):
        if i%K==0:
            print("OK")
            return
    print("NG")
    return

def examB():
    X = I()
    now = 100
    ans = 0
    while(now<X):
        ans += 1
        now += now//100
    print(ans)
    return

def examC():
    N, M, Q = LI()

    ans = 0
    print(ans)
    return

def examD():
    A, B, N = LI()
    if N>=B-1:
        ans = (A*(B-1))//B
    else:
        ans = (A*N)//B
    print(ans)
    return

def examE():
    N, M = LI()
    ans = []
    if N%2==1:
        for i in range(N // 2):
            ans.append((i + 1, N - i))
    else:
        flag = False
        for i in range(N // 2):
            if N-i-(i+1)<=N//2:
                flag = True
            if flag:
                ans.append((i+1,N-i-1))
            else:
                ans.append((i + 1, N - i))
    #print(ans)
    for v in ans[:M]:
        print(" ".join(map(str,v)))
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examE()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

int main() {
	string s;
  	cin >> s;
  
  	int a_num,z_num;
    for(int i = 0; i < s.size(); i++) {
    	if(s.at(i) == 'A')  {
        a_num = i;
      	break;
      }
    }
  
    for(int i = s.size() - 1; i >= 0; i--) {
    	if(s.at(i) == 'Z')  {
        z_num = i;
      	break;
      }
    }
  
  	cout << z_num - a_num + 1 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
#define INF 1000000000000LL
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<long, long> pll;
typedef pair<pll, string> pls;

int N, Q, Y, W;
string Name;
pls E[1001];

int main(void) {
  while(cin >> N >> Q, N || Q) {
    REP(i, 0, N) {
      cin >> Name >> Y >> W;
      E[i] = pls(pll(W - Y + 1, Y), Name);
    }
    E[N] = pls(pll(INF, 0), "");

    sort(E, E + N);

    REP(i, 0, Q) {
      int q; cin >> q;
      if(q < E[0].fi.fi) {
        cout << "Unknown" << endl;
        continue;
      }
      REP(j, 0, N) {
        if(E[j].fi.fi <= q && q < E[j + 1].fi.fi) {
          int ans = q - E[j].fi.fi + 1;
          if(ans <= E[j].fi.se) {
            cout << E[j].se << " " << ans << endl;
            goto END;
          }
        }
      }
      cout << "Unknown" << endl;
END:;
    }
  }
  return 0;
}

Measured memory_bytes: 3232
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, k int
	var s string
	fmt.Fscan(r, &n)
	fmt.Fscan(r, &k)
	fmt.Fscan(r, &s)

	score := 0
	for i := 0; i < n-1; i++ {
		if s[i] == s[i+1] {
			score++
		}
	}

	ans := min(score+2*k, n-1)
	fmt.Println(ans)
}

// Union-Find
type unionFind struct {
	d []int
}

func newUnionFind(n int) *unionFind {
	uf := new(unionFind)
	uf.d = make([]int, n)
	for i := 0; i < n; i++ {
		uf.d[i] = -1
	}
	return uf
}

func (uf *unionFind) find(x int) int {
	if uf.d[x] < 0 {
		return x
	}
	uf.d[x] = uf.find(uf.d[x])
	return uf.d[x]
}

func (uf *unionFind) unite(x, y int) bool {
	rootX := uf.find(x)
	rootY := uf.find(y)
	if rootX == rootY {
		return false
	}

	if uf.d[rootX] < uf.d[rootY] {
		uf.d[rootX] += uf.d[rootY]
		uf.d[rootY] = rootX
	} else {
		uf.d[rootY] += uf.d[rootX]
		uf.d[rootX] = rootY
	}

	return true
}

func (uf *unionFind) same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *unionFind) size(x int) int {
	return -uf.d[uf.find(x)]
}

// mod combination
func modpow(a, n, mod int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n = n / 2
	}
	return res
}

func modcomb(n, a, mod int) int {
	x := 1
	y := 1
	for i := 0; i < a; i++ {
		x = x * (n - i)
		x %= mod
		y = y * (i + 1)
		y %= mod
	}
	return x * modpow(y, mod-2, mod) % mod
}

func modfactorial(n, mod int) int {
	result := 1
	for i := 1; i <= n; i++ {
		result = (result * i) % mod
	}
	return result
}

// Utility

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

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

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}

func reverseString(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

// Queue ...
type Queue []int

// pop ...
func (q *Queue) empty() bool {
	return len(*q) == 0
}

// push ...
func (q *Queue) push(i int) {
	*q = append(*q, i)
}

// pop ...
func (q *Queue) pop() (int, bool) {
	if q.empty() {
		return 0, false
	} else {
		res := (*q)[0]
		*q = (*q)[1:]
		return res, true
	}
}

// Stack ...
type Stack []int

// pop ...
func (s *Stack) empty() bool {
	return len(*s) == 0
}

// push ...
func (s *Stack) push(i int) {
	*s = append(*s, i)
}

// pop ...
func (s *Stack) pop() (int, bool) {
	if s.empty() {
		return 0, false
	} else {
		index := len(*s) - 1
		res := (*s)[index]
		*s = (*s)[:index]
		return res, true
	}
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,x;
  cin>>a>>b>>c;
  for(int i=1;i<a+1;i++){
    int d=i/10000;
    int e=i%10000/1000;
    int f=i%1000/100;
    int g=i%100/10;
    int h=i%10;
    int j=d+e+f+g+h;
    if(j>=b && j<=c){
      x+=i;
    }
  }
  cout<<x<<endl;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin>>n;
  
  vector<ll> A(10001,0);
  
  for(int i=1;i<=100;i++){
    for(int j=1;j<=100;j++){
      for(int k=1;k<=100;k++){
        if(i*i+j*j+k*k+i*j+j*k+k*i>10000) continue;
        A[i*i+j*j+k*k+i*j+j*k+k*i]++;
      }
    }
  }
  
  for(int i=1;i<=n;i++){
    cout<<A[i]<<endl;
  }
 
  return 0;
}

Measured memory_bytes: 3628
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
#define ll long long
using namespace std;
int main(){
int n;
cin>>n;
if(n%1000==0){cout<<"0";return 0;}
cout<<1000-n%1000;
return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <cstdio>
#include <math.h>
#include <utility>
#include <list>
#include <functional>
using namespace std;

#define ll long long
#define vecint vector<int>
#define Pii pair<int, int>

#define REP(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define print(a) cout << a << endl

#define MOD 1000000007
#define NIL -1

int alpha[26];

int main(){
  vector<string> S;
  int n;

  rep(i,26){
    alpha[i]=0;
  }

  cin>>n;
  rep(i,n){
    string x;
    cin>>x;
    sort(x.begin(),x.end());
    S.push_back(x);
  }
  // rep(i,n){
  //   print(S[i]);
  // }
  rep(i,26){
    int count=0;
    rep(j,n){
      int min_count=0;
      while(S[j].size()!=0&&S[j][0]==(char)(i+(int)'a')){
        min_count++;
        S[j].erase(S[j].begin());
        // print(min_count);
      }
      if(j!=0){
        count=min(count,min_count);
      }else{
        count=min_count;
      }
    }
    rep(j,count){
      cout<<(char)(i+(int)'a');
    }
  }
  print("");
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    s = S()
    t = S()
    ans = 0
    for i in range(3):
        if s[i] == t[i]:
            ans += 1
    print(ans)
    return

#B
def B():
    a, b = LI()
    ans = 0
    b -= 1
    while b > 0:
        b -= a - 1
        ans += 1
    print(ans)

    return

#C
def C():
    n = II()
    h = LI()
    i = 0
    ans = 0
    while i < n:
        down = i+1
        while down < n:
            if h[down - 1] >= h[down]:
                down += 1
            else:
                break
        ans = max(ans, down - i - 1)
        i = down
    print(ans)
    return

#D
def D():
    n = II()
    print(n * (n - 1) // 2)
    return

#E
def E():
    return

#F
def F():
    return

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


Measured memory_bytes: 60144
#include<bits/stdc++.h>
#define maxn 100005
using namespace std;
inline int read(){
	int x=0,c;while(!isdigit(c=getchar()));
	while(x=x*10+c-'0',isdigit(c=getchar()));
	return x;
}
int cnt[1<<18],ans[18][1<<17],n,A,B;
void solve(int k,int A,int B,int *a,int l,int r){
	if(k==1){a[l]=A;a[r]=B;return;}
	int C=A^B,x=C&(-C),mid=(l+r)>>1;
	int nA=A%x+A/(x<<1)*x,nB=B%x+B/(x<<1)*x;
	solve(k-1,nA,nA^1,ans[k-1],l,mid);
	solve(k-1,nA^1,nB,ans[k-1],mid+1,r);
	for(int i=l;i<=mid;i++)
	a[i]=ans[k-1][i]%x+ans[k-1][i]/x*(x<<1)+((A&x)?x:0);
	for(int i=mid+1;i<=r;i++)
	a[i]=ans[k-1][i]%x+ans[k-1][i]/x*(x<<1)+((B&x)?x:0);
}
int main(){
	n=read();A=read();B=read();int N=1<<n;N--;
	for(int i=1;i<=N;i++)cnt[i]=cnt[i>>1]+(i&1);
	if(cnt[A^B]&1){printf("YES\n");solve(n,A,B,ans[n],0,N);
	for(int i=0;i<=N;i++)printf("%d ",ans[n][i]);
	return 0;}
	printf("NO\n");
}

Measured memory_bytes: 10752
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int h = sc.nextInt();
		int w = sc.nextInt();
		int d = sc.nextInt();
		int[][] p = new int[h*w][2];
		for(int i = 0; i < h; i++){
		    for(int j = 0; j < w; j++){
		        int a = sc.nextInt() - 1;
		        p[a][0] = i;
		        p[a][1] = j;
		    }
		}
		int q = sc.nextInt();
		int[][] lr = new int[q][2];
		for(int i = 0; i < q; i++){
		    lr[i][0] = sc.nextInt()-1;
		    lr[i][1] = sc.nextInt()-1;
		}
		
		// 計算
		long result = 0;
		int[] dist = new int[h*w];
		for(int a = 0; a < h*w; a++){
		    if(a - d >= 0){
		        dist[a] = dist[a-d] + abs(p[a-d][0] - p[a][0]) + abs(p[a-d][1] - p[a][1]);
		    }
		}
		
		// 出力
		for(int i = 0; i < q; i++){
		    System.out.println(dist[lr[i][1]] - dist[lr[i][0]]);
		}
	}
}




Measured memory_bytes: 100388
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
int main(void){
    lint N,X;
    cin >> N >> X;
    lint A[N];
    rep(i,N) cin >> A[i];
    lint ans=0;
    for(int i=1;i<N;i++){
        if(A[i]+A[i-1]>X) ans+=min(A[i],A[i]+A[i-1]-X),A[i]-=min(A[i],A[i]+A[i-1]-X);
    }
    if(A[0]+A[1]>X) ans+=A[0]+A[1]-X;
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    string key = "keyence", s;
    cin >> s;
    if(key == s.substr(0, 7) || key == s.substr(s.size()-7, 7)){
        YOUT;
        return 0;
    } 

    REP(i, 7){
        if(s[i] != key[i]){
            key.erase(key.begin(), key.begin() +i);
            break;
        }
    }
    if(s.substr(s.size()-key.size(), key.size()) == key){
        YOUT;
    }
    else NOUT;
}



Measured memory_bytes: 256
def main():
    a, b, c, d = map(int, input().split())

    for i in range(d - b):
        print('U', end='')

    for i in range(c - a):
        print('R', end='')

    for i in range(d - b):
        print('D', end='')

    for i in range(c - a):
        print('L', end='')

    print('L', end='')

    for i in range(d - b + 1):
        print('U', end='')

    for i in range(c - a + 1):
        print('R', end='')

    print('D', end='')

    print('R', end='')

    for i in range(d - b + 1):
        print('D', end='')

    for i in range(c - a + 1):
        print('L', end='')

    print('U')




if __name__ == '__main__':
    main()


Measured memory_bytes: 53868
from sys import stdin
from collections import deque


V, E, R = [int(x) for x in stdin.readline().split()]
d = {}
tick = False
INF = float('inf')
for i in range(V):
    d[i] = INF
d[R] = 0
weight = {}
st = deque([])
for i in range(1, V+1):

    for j in range(E):
        if i == 1:
            s, t, w = [int(x) for x in stdin.readline().split()]
            weight[(s, t)] = w
            st.append((s, t))
        (s, t) = st.popleft()
        if d[t] > d[s] + weight[(s, t)]:
            d[t] = d[s] + weight[(s, t)]
            if i == V:
                print('NEGATIVE CYCLE')
                tick = True
                break
        st.append((s, t))


if not tick:
    for k in range(V):
        if d[k] == float('inf'):
            print("INF")
        else:
            print(d[k])

Measured memory_bytes: 8696
$s=<>;
chomp($s);
@ary=split//,$s;
@ary = sort {$a cmp $b} @ary;
if($ary[0] eq $ary[1] && $ary[2] eq $ary[3]){
	if($ary[0] ne $ary[2] && $ary[1] ne $ary[3] ){
    	print "Yes";
    } else {
    	print "No";
    }
}else{
	print"No";
}

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

int main(){
    int a,b,count=0;
    char s;
    cin>>a;
    int bubble[36];
    int sel[36];
    int g;
    char Bubble[36];
    char Select[36];
    for(int i=0;i<a;i++){
        cin>>s;
        cin>>b;
        Bubble[i]=s;
        Select[i]=s;
        bubble[i]=b;
        sel[i]=b;
    }
    
   
    for(int i=0;i<a;i++){
        int flag = 1 ;
        while (flag){
            flag = 0;
            for (int j= a-1;j>0;j--) {
                if (bubble[j] < bubble[j-1]){
                    int c=bubble[j];
                    int d=bubble[j-1];
                    char e=Bubble[j];
                    char f=Bubble[j-1];
                    bubble[j]= d;
                    bubble[j-1]=c;
                    Bubble[j]=f;
                    Bubble[j-1]=e;
                    flag = 1;
                }
                
            }
            
        }
        

    }
    for (int i=0;i<a-1;i++){
        int minj = i;
        for (int j= i ;j<a;j++){
            
            if (sel[j] <sel[minj]){
                minj = j;
            }
        }
        if(i!=minj){
            int n=sel[i];
            int m=sel[minj];
            char e=Select[i];
            char f=Select[minj];
            sel[i]=m;
            sel[minj]=n;
            Select[i]=f;
            Select[minj]=e;
         
        }
        
            
        
    } 
    
    for(int p=0;p<a;p++){
        if(p<a-1){
            cout<<Bubble[p]<<bubble[p]<<" ";
        }
        else if(p==a-1){
            cout<<Bubble[p]<<bubble[p]<<endl;
        }
    }
    cout<<"Stable"<<endl;
    for(int p=0;p<a;p++){
        if(p<a-1){
            cout<<Select[p]<<sel[p]<<" ";
        }
        else if(p==a-1){
            cout<<Select[p]<<sel[p]<<endl;
        }
    }
    for(int i=0;i<a;i++){
        if(Bubble[i]==Select[i]){
            count++;
        }
    }
    if(count==a){
        cout<<"Stable"<<endl;
    }
    else cout<<"Not stable"<<endl;
    return 0;
}








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

const int mxN = 2e5 + 10;
int last[26][mxN];

int main() {
	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < mxN; j++) {
			last[i][j] = -1;
		}
	}
	string s, t;
	cin >> s >> t;
	int n = s.length();
	map<char, int> mp;
	for (int i = 0; i < (int)s.length(); i++) {
		mp[s[i]]++;
	}
	bool ok = true;
	for (int i = 0; i < (int)t.length(); i++) {
		if (mp[t[i]] <= 0) ok = false;
	}
	if (!ok) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = n - 1; i >= 0; i--) {
		int c = (int)s[i]- 'a';
		last[c][i] = i+1;
		for (int j = i-1; j >= 0; j--) {
			last[c][j] = last[c][j + 1];
		}
	}
	int n1 = t.length();
	long long l = 0;
	long long cnt = 0;
	for (int i = 0; i < n1; i++) {
		char c = (int)t[i] - 'a';
		if (last[c][l] == -1) {
			cnt += n - l;
			l = 0;
		}
		cnt += (long long)last[c][l] - l;
		l = last[c][l];
	}
	if (ok) cout << cnt << endl;
	else cout << -1 << endl;
	return 0;
}

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

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

  bool cond1 = S[0] == 'A';

  int C_cnt = 0;
  for(int i = 2; i < S.length() - 1; i++){
    C_cnt += S[i] == 'C';
  }
  bool cond2 = C_cnt == 1;

  int upper_cnt = 0;
  for(int i = 0; i < S.length(); i++){
    upper_cnt += S[i] >= 'A' && S[i] <= 'Z';
  }
  bool cond3 = upper_cnt == 2;

  if(cond1 && cond2 && cond3){
    cout << "AC" << endl;
  }else{
    cout << "WA" << endl;
  }
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

pub fn lower_bound<T: Ord>(a: &Vec<T>, x: &T) -> Option<usize> {
    use std::cmp::Ordering;
    let mut l = 0;
    let mut r = a.len();
    while l != r {
        let m = l + (r - l) / 2;
        match a[m].cmp(x) {
            Ordering::Less => l = m + 1,
            Ordering::Equal | Ordering::Greater => r = m,
        }
    }
    if l == a.len() {
        None
    } else {
        Some(l)
    }
}

fn main() {
    input!{
      n: usize,
      m: usize,
      pys: [(usize,usize); m]
    }
    let mut prefs = vec![vec![]; n+1];
    for &(p, y) in pys.iter() {
        prefs[p].push(y);
    }
    for i in 0..n+1 {
        prefs[i].sort();
        prefs[i].dedup();
    }

    for &(p, y) in pys.iter() {
        let id = lower_bound(&prefs[p], &y).unwrap()+1;
        println!("{:06}{:06}", p, id);
    }
}


Measured memory_bytes: 13820
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

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

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

	mint non0=1;
	rep(i, n) non0*=9;
	mint non9=non0;
	mint non09=1;
	rep(i, n) non09*=8;
	mint al=1;
	rep(i, n) al*=10;
	mint ans=al-non0-non9+non09;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3640
#include<stdlib.h>
#include<stdio.h>
#include <string.h>
#include <iostream>
#include <string>
#include <algorithm>
#include<queue>
#include<map>
using namespace std;
int main() {
	int n;
	scanf("%d",&n);
	map<int,int> mp;
	int num = 0;
	for(int i=0;i<n;i++)
	{
		int temp;
		scanf("%d",&temp);
		if(mp[temp]==1)
		{
			mp[temp]=0;
			num--;
		}
		else
		{
			 mp[temp] = 1;
			 num++;
		}
	}
	printf("%d",num);
	return 0;
}


Measured memory_bytes: 4864
#include <iostream>
#include <queue>
#include <set>

using namespace std;
typedef pair<int,int> pii;
typedef pair<int,set<pii> > pis;
typedef pair<pii,pis> pp;
int dy[4] = {-1, 0, 1, 0};
int dx[4] = { 0, 1, 0,-1};
int g[21][21];
int w, h;
int sx, sy, gx, gy;
queue<pp> que;

bool f(int ny, int nx) {
    if (ny >= 0 && ny < h && nx >= 0 && nx < w) return true;
    else return false;
}

int bfs(int c) {
    while (!que.empty()) {
        pp p = que.front();
        que.pop();
        int ty = p.first.first, tx = p.first.second, c = p.second.first;
        set<pii> se = p.second.second;
        if (c == 10) return -1;
        
        for (int i = 0; i < 4; i++) {
            int ny = ty, nx = tx;
            if (g[ny+dy[i]][nx+dx[i]]==1 && !se.count(make_pair(ny+dy[i], nx+dx[i]))) continue;
            while (f(ny+dy[i], nx+dx[i]) && (g[ny+dy[i]][nx+dx[i]] != 1 || se.count(make_pair(ny+dy[i],nx+dx[i])))) {
                ny += dy[i], nx += dx[i];
                if (ny == gy && nx == gx) return c+1;
            }
            if (ny+dy[i] < 0 || ny+dy[i] >= h || nx+dx[i] < 0 || nx+dx[i] >= w) continue;
            set<pii> s = se;
            s.insert(make_pair(ny+dy[i],nx+dx[i]));
            que.push(make_pair(make_pair(ny,nx), make_pair(c+1,s)));
        }
    }
    return -1;
}

int main(void){
    while (cin>>w>>h && w) {
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cin >> g[i][j];
                if (g[i][j] == 2) sy = i, sx = j;
                if (g[i][j] == 3) gy = i, gx = j;
            }
        }
        queue<pp> empty;
        que = empty;
        set<pii> se;
        que.push(make_pair(make_pair(sy,sx), make_pair(0,se)));
        cout << bfs(0) << endl;
    }
}

Measured memory_bytes: 42492
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;

int main()
{
    char AtCoder[10], s[105], Contest[10];
    cin >> AtCoder >> s >> Contest;
    cout << AtCoder[0] << s[0] << Contest[0] << endl;
    
    return 0;
}

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

int main(){
	int n;
	cin>>n;
	for(int a=1000;;a+=1000){
		if(a==n){
			cout<<"0\n";
			break;
		}
		else if(a > n){
			cout<<a-n<<"\n";
			break;
		}
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

const ll Inf = 1e18;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n;
    cin >> n;
    vector <int> h(n), p(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i] >> p[i];
    }
    vector <int> idx(n);
    iota(idx.begin(), idx.end(), 0);
    sort(idx.begin(), idx.end(), [&] (int i, int j) {
        return h[i] + p[i] > h[j] + p[j];
    });
    reverse(idx.begin(), idx.end());
    vector <vector <ll>> dp(n + 1, vector <ll> (n + 1, Inf));
    dp[0][0] = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= i; ++j) {
            dp[i][j] = dp[i - 1][j];
            if (dp[i - 1][j - 1] <= h[idx[i - 1]]) {
                dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + p[idx[i - 1]]);
            }
        }
    }
    for (int i = n; i >= 0; --i) {
        if (dp[n][i] < Inf) {
            cout << i << '\n';
            return 0;
        }
    }
}

Measured memory_bytes: 195968
N = int(input())
xy = [[] for _ in range(N)]
for i in range(N):
    for _ in range(int(input())):
        xy[i].append(list(map(int, input().split())))

res = 0

for i in range(2**N):
    ok = True
    cnt = 0
    for j in range(N):
        if (i>>j)&1:
            for x, y in xy[j]:
                if (i>>(x-1))&1 != y:
                    ok = False
                    break
            if not ok:
                break
            cnt += 1
    if ok:
        res = max(cnt, res)

print(res)

Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))

tmp1 = []
tmp2 = []
from collections import defaultdict
d1 = defaultdict(int)
d2 = defaultdict(int)
for i in range(N):
    tmp1 = A[i] + i
    tmp2 = i - A[i]
    d1[tmp1] += 1
    d2[tmp2] += 1

ans = 0

for key1, value1 in d1.items():
    if d2[key1]:
        ans += value1 * d2[key1]
print(ans)

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

int main()
{
    int N;
    cin>>N;
    vector<int> a(N+1);
    for (int i=1; i<=N; i++)
        cin>>a[i];

    vector<int> b(N+1);
    for (int i=N; i>=1; i--)
    {
        int c = 0;
        for (int j=i+i; j<=N; j+=i)
            c += b[j];
        b[i] = c%2==a[i] ? 0 : 1;
    }

    int c = 0;
    for (int t: b)
        c += t;
    cout<<c<<endl;
    bool f = true;
    for (int i=1; i<=N; i++)
        if (b[i])
        {
            cout<<(f?"":" ")<<i;
            f = false;
        }
    cout<<endl;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
const int MAX = (2e5)+1;

int n, m, cover, a[MAX], curr[2*MAX+10], f[2*MAX+10];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	for(int i = 1; i <= n; i++) curr[i] = (MAX-1)+i+1;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
		--curr[a[i]];
		if(curr[a[i]] > MAX-1) cover += !f[curr[a[i]]];
		++f[curr[a[i]]];
	}
	for(int x, y; m > 0; m--) {
		cin >> x >> y;
		--f[curr[a[x]]];
		if(curr[a[x]] > MAX-1) cover -= !f[curr[a[x]]];
		++curr[a[x]];

		a[x] = y;
		--curr[a[x]];
		if(curr[a[x]] > MAX-1) cover += !f[curr[a[x]]];
		++f[curr[a[x]]];

		cout << n - cover << '\n';
	}
}

Measured memory_bytes: 4608
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

using namespace std;
typedef long long ll;

int main() {

    ll A,B;
    cin >> A >> B;
    ll out = 0;
    ll sum = 1 + (A-1)*out;
    while(sum<B){
        out ++;
        sum += (A-1);
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int n,p[30];
int cntp = 0;

int main()
{
	cin >> n;
	for(int i = 1;i <= n;i ++)
		cin >> p[i];
	for(int i = 2;i <= n-1;i ++)
		if((p[i]>p[i-1]&&p[i]<p[i+1])||(p[i]>p[i+1]&&p[i]<p[i-1]))
			cntp++;
	cout << cntp << endl;
	return 0;
}

Measured memory_bytes: 256
S = input()

kisu = ['R', 'U', 'D']
gusu = ['L', 'U', 'D']

hard = 0
#S = "RDULULDURURLRDULRLR"

for i in range(len(S)):
    moji = S[i]
    if i % 2 == 1:
#        print("{} th : {} is in  Kisu(R,U,D)".format(i,moji))
        if moji not in gusu:
            hard = 1
            break
    if i % 2 == 0:
#        print("{} th : {} is in Gusu(L,U,D)".format(i,moji))
        if moji not in kisu:
            hard = 1
            break
if hard == 0:
    print("Yes")
else:
    print("No")
            

Measured memory_bytes: 3064
def shownum(list):
    stri = str()
    for s in list:
        stri += str(s) + " "
    print(stri[:-1])
    
r , c = map(int,input().split())
csum =[list() for x in range(c)]
rlist = [list() for x in range(r+1)]




for i in range(r):
    sum = 0
    rlist[i] = list(map(int,input().split()))
    for j in range(c):
        csum[j].append(rlist[i][j])
    for j in rlist[i]:
        sum += j
    rlist[i].append(sum)
    
    
for s in csum:
    sum = 0
    for l in s:
        sum += l
    rlist[r].append(sum)

sum = 0
for i in rlist[r]:
   sum += i
rlist[r].append(sum)


for i in range(r+1):
    shownum(rlist[i])



Measured memory_bytes: 5848
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;

#define pf(n) cout << n << endl
#define ps() cout <<" ";
#define sf(n) cin >> n
#define in(i,n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vp vector<pair<int, int>>
#define graph vector< vector<int> >
#define vs vector<string>
/**  '' "\n" ^ - = + **/


typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,
                 tree_order_statistics_node_update>
        new_data_set;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    string str;
    cin>>str;
    for(int i=0;i<str.length();i++)
    {
        str[i]+=n;
        if(str[i]>90)
        {
            str[i]=64+(str[i]-90);
        }
    }
    cout<<str<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  long a, b, tmp, sosu, tmp_b;
  scanf("%ld %ld", &a, &b);

  if (a > b) {
    tmp = a;
    a = b;
    b = tmp;
  }

  tmp_b = b;
  while(1) {
    if (b % a == 0) {
      break;
    }
    b += tmp_b;
  }

  printf("%ld\n", b);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

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

int main()
{
    char X, Y;
    cin >> X >> Y;

    string ans;
    if (X == Y) {
        ans = "=";        
    } else if (X < Y) {
        ans = "<";
    } else {
        ans = ">";
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=t.in(),r=new Array(e),n=0;n<e;n++)r[n]=t.in();var i=new Array(e+1),o=new Array(e+1);i[e]=2,o[e]=2;for(var s=e-1;s>=0;s--)if(i[s]=Math.floor(i[s+1]/r[s])*r[s]+r[s]-1,o[s]=Math.ceil(o[s+1]/r[s])*r[s],i[s]<r[s]||o[s]>i[s]||(r[s]-o[s]%r[s])%r[s]>i[s]-o[s]+1)return void console.log(-1);console.log(`${o[0]} ${i[0]}`)}}]);

Measured memory_bytes: 47424
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
p=0
ao=abs(a-(t-h[0]*0.006))
for i in range(n):
    if abs(a-(t-h[i]*0.006))<=ao:
        ao=abs(a-(t-h[i]*0.006))
        p=i+1
print(p)


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

int n;
int a[3000][3000];
int cx, cy, cnt;

int main() {
	while (cin >> n) {
		if (n == 0) { break; }
		memset(a, 0, sizeof(a));
		cx = n / 2;
		cy = n / 2 + 1;
		cnt = 1;
		a[cy][cx] = cnt;
		while (cnt < n*n) {
			cnt++;
			if (a[(cy + 1) % n][(cx + 1) % n] == 0) {
				cx = (cx + 1) % n;
				cy = (cy + 1) % n;
				a[cy][cx] = cnt;
			}
			else {
				cy = (cy + 2) % n;
				a[cy][cx] = cnt;
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				printf("% 4d", a[i][j]);
			}
			printf("\n");
		}
	}
}

Measured memory_bytes: 36324
//by Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<s32>
#define p32 pair<int,int>
#define p64 pair<ll,ll>
#define fi first
#define se second
#define ln '\n'
#define debug(x) cout << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream& operator<<(ostream& out, const pair<T,U>& p){
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename ...Args>
void print_container(const ContainerType<ValueType, Args...>& c){
	cout << "{ ";
	for(const auto& v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

int main()
{
	FASTIO;
	int n;
	cin >> n;
	string str;
	map<string,int> M;
	for(int i = 0;i < n;i++)
	{
		cin >> str;
		sort(str.begin(),str.end());
		M[str]++;
	}
	ll ans = 0;
	for(auto itr : M)
		ans += (1ll * itr.se * (itr.se - 1)) / 2;
	cout << ans << ln;
	return 0;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;
vector<int> v;

     signed main(){
int k,n;
cin>>k>>n;
if(k%2==0){
     cout<<k/2<<' ';
     for(int i=1;i<n;i++)cout<<k<<' ';
     cout<<endl;
     return 0;
}
for(int i=0;i<n;i++)v.push_back((k+1)/2);
int t=n/2;
while(t){
     if(v[v.size()-1]==1)v.pop_back();
     else {
          v[v.size()-1]--;
          while(v.size()<n)v.push_back(k);
     }
     t--;

}
for(int i=0;i<v.size();i++)cout<<v[i]<<' ';
cout<<endl;





 }

 


 






    





      

        


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

int main(void) {
	
	int N;
	cin >> N;
	int sn = 0;

	for(int i=N; i>0; i/=10) {
		sn += i%10;
	}
	if(N%sn)
	cout << "No";
	else
	cout << "Yes";
	

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int main(){
  in a,b,c,k;
  cin>>a>>b>>c>>k;
  in ans=0;
  if(k<=a){
    cout<<k<<endl;
    return 0;
  }
  if(k<=a+b){
    cout<<a<<endl;
    return 0;
  }
  cout<<a-(k-a-b)<<endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    int maxx = 0;
    rep(i, n){
        int tmp;
        cin >> tmp;
        a[i] = tmp;
        chmax(maxx, tmp);
    }
    if(a[0] != 0){
        cout << 0 << endl;
        return 0;
    }
    vector<int> aa(maxx+2, 0);
    ll ans;
    rep(i, n){
        if(i==0){
            ans = 3;
            aa[0]++;
            continue;
        }
        int tmp = a[i];
        if(aa[tmp] >= 3){
            cout << 0 << endl;
            return 0;
        }
        if(tmp != 0){
            ans = ans *  (aa[tmp-1]-aa[tmp]) % mod;
        }else{
            ans = ans *  (3-aa[tmp]) % mod;
        }
        ans %= mod;
        aa[tmp]++;
    }
    if(ans <= 0){
        ans = 0;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
  
  int N;
  cin>>N;
  
  for(int i=0; i<N; i++){
    string s;
  cin>>s;
    if(s=="Y"){
    cout << "Four"<<endl;
      break;
    }
    
     if(i==N-1){
    cout <<"Three"<<endl;
     }
   
 
  }  
 }

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,A,B;
ll V[1010];

ll ma[51][51];
ll num[51][51];



void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>A>>B;
	FOR(i,N) cin>>V[i];
	MINUS(ma);
	ma[0][0]=0;
	num[0][0]=1;
	
	FOR(i,N) {
		FOR(x,N) if(num[i][x]>0) {
			
			// take
			if(ma[i+1][x+1] < ma[i][x]+V[i]) {
				ma[i+1][x+1] = ma[i][x]+V[i];
				num[i+1][x+1]=0;
			}
			if(ma[i+1][x+1] == ma[i][x]+V[i]) {
				num[i+1][x+1] += num[i][x];
			}
			// not take
			if(ma[i+1][x] < ma[i][x]) {
				ma[i+1][x] = ma[i][x];
				num[i+1][x]=0;
			}
			if(ma[i+1][x] == ma[i][x]) {
				num[i+1][x] += num[i][x];
			}
		}
	}
	long double ret=0;
	ll p=0,q=1;
	for(i=A;i<=B;i++) {
		if(q*ma[N][i] > p*i) {
			p=ma[N][i];
			q=i;
		}
	}
	_P("%.12lf\n",(double)p/q);
	ll hoge=0;
	for(i=A;i<=B;i++) {
		if(q*ma[N][i] == p*i) hoge += num[N][i];
	}
	_P("%lld\n",hoge);
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 256