akhauriyash/Code-Regression huggingface dataset:
// 問題URL
//

import java.util.Scanner;
import java.util.Arrays;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String[] a = scanner.nextLine().split("");
        String[] b = scanner.nextLine().split("");

        int count = 0;
        for(int i =0; i<3; i++) {
            if(a[i].equals(b[i])) {
                count++;
            }
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 23764
N = int(input())
S = list(input())
ans = 0
for i in range(1, N):
    ans_tmp = 0
    S_unique = list(set(S[0:i]))
    for j in S_unique:
        if j in S[i:N]:
            ans_tmp += 1
    ans = max(ans, ans_tmp)
print(ans)


Measured memory_bytes: 2940
#include <stdio.h>

#define LOOP_END 0								/* ?????§??¬?´???°?????????break?????¶ */
#define EXIT_SUCCESS 0							/* ???????????????????????? */
#define INF_LOOP while( 1 )						/* ??????????????????????????? */

static void swap( void );
static void gdc_calc( void );

unsigned long ulG_Dtc_x;									/* ???????????±??????X */
unsigned long ulG_Dtc_y;									/* ???????????±??????Y */
unsigned long ulG_Dcalc;									/* ????\???¨?????° */

int main( void )
{

	scanf("%ld %ld", &ulG_Dtc_x, &ulG_Dtc_y);					/* ???????????±????????\??? */
	swap();														/* Y???X??\????????´???X??¨Y?????\????????? */

	gdc_calc();													/*?????§??¬?´???°????¨????*/
	printf("%ld\n", ulG_Dtc_y);									/* ?????§??¬?´???°????????? */

	return EXIT_SUCCESS;
}

static void swap( void )		/*??????????±?Y*/
{
	if( ulG_Dtc_x <= ulG_Dtc_y ){
		ulG_Dcalc = ulG_Dtc_x;					/* X???????\???¨?????°????????? */
		ulG_Dtc_x = ulG_Dtc_y;					/* X???Y???????????? */
		ulG_Dtc_y = ulG_Dcalc;					/* Y???????\???¨?????°(X)???????????? */
	}
	else{
		/* else?????????????????????????????\ */
	}
}

static void gdc_calc( void )
{
	/* ?????§??¬?´???°?¨????????????? */
	INF_LOOP{
		ulG_Dcalc = ulG_Dtc_x % ulG_Dtc_y;		/* ????\???¨?????°???X % Y?????????????????? */
		/* ?¨?????????????0?????´??? */
		if( ulG_Dcalc == LOOP_END){
			break;								/* ????????????????????? */
		}
		ulG_Dtc_x = ulG_Dtc_y;					/* X???Y???????????? */
		ulG_Dtc_y = ulG_Dcalc;					/* Y???????\???¨?????°(X % Y)???????????? */
	}/* ?????§??¬?´???°?¨?????????????????????? */
}

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

using namespace std;
int main(){
    int a,b=0;
    cin>>a;
    while(a!=0){
        if(a%10==2){
            b++;
        }
        a/=10;
    }

    cout<<b;


    return 0;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
int main(){
    int64_t x,k,d;
    cin>>x>>k>>d;
    x = abs(x);
    if(k==1){
        cout<<abs(x-d)<<endl;
        return 0;
    }
    if(x/d>=k){//0にたどり着けない
        cout<<x-d*k<<endl;
    }
    else{
        int cnt = x/d;//これで
        x -= cnt*d;
        k -= cnt;
        if(k%2==0){//ここか-2*d
            cout<<min(x,abs(x-2*d))<<endl;
        }
        else{
            cout<<min(x+d,abs(x-d))<<endl;
        }
        
    }
}

Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
using namespace std;


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


int main(){
  int a, b, k;
  cin >> a >> b >> k;


  for(int i = a; i <= b; ++i){
    if(i - a < k || b - i < k){
      cout << i << endl;
    }
  }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int gcd(int x,int y)
{
    if(y==0)
    return x;
    else {
            return gcd(y,x%y);
        }

}
int main()
{
    long long int k=0;
    int n,l,m,p;
    cin>>n;
    for(l=1;l<=n;l++)
    {
        for(m=1;m<=n;m++)
        {
            for(p=1;p<=n;p++)
            {
                k=k+gcd(p,gcd(m,l));
            }
        }
    }


    cout<<k<<endl;




    return 0;
}


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

int main() {
    int K, sum=0;
    cin >> K;
    int N = K;
    while (true){
      		sum += N%10;
      		N = (N-N%10)/10;
      		if (N==0) break;
    }
   
    if (K%sum==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3628
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import math
from decimal import Decimal as dec


N = int(input())
An = list(map(int, input().split()))
x = math.floor(dec(sum(An))/dec(N))

cost = [0,0]
for a in An:
  cost[0] += (x-a)**2
  cost[1] += (x+1-a)**2
print(min(cost))

Measured memory_bytes: 5844
# ABC158C
# 消費税率が 8 %のとき A 円、10 ％のとき B 円の消費税が課されるような商品の税抜き価格

# 税抜き価格は正の整数、消費税の計算において小数点以下は切り捨て
# 条件を満たす税抜き価格が複数存在する場合は最も小さい金額、条件を満たす税抜き価格が存在しない場合は -1
import numpy as np
def f(a, b):
    x = np.arange(1, 1001)
    xa = np.floor(x*0.08)
    xb = np.floor(x*0.10)
    for i, value in enumerate(x):
        if xa[i] == a and xb[i] == b:
            print(value)
            break
    else:
        print(-1)

a, b = map(int, input().split())
f(a, b)



Measured memory_bytes: 27144
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
#define LL long long

int main() {
	int n;
	int *a;
	scanf("%d", &n);
	a = new int[n];
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
	}
	LL res = 1;
	int b[3] = {0, 0, 0};
	for (int i = 0; i < n; ++i) {
		int ct = 0, lt = -1;
		for (int j = 0; j < 3; ++j) {
			if (b[j] == a[i]) {
				++ct;
				lt = j;
			}
		}
		if (ct == 0) {
			cout << 0 << endl;
			return 0;
		}
		res = res * (LL)(ct);
		res %= (LL)(1000000007);
		++b[lt];
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define maxn 111111
using namespace std;

int n,num[maxn],top;

signed main()
{
    scanf("%d",&n);
    while(n){
        num[++top]=n%10;
        n=n/10;
    }
    for(int i=top;i;i--){
        if(num[i]==1)   printf("9");
        if(num[i]==9)   printf("1");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
import java.io.*;

class Main{
	public static void main(String args[]) throws IOException{
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		String s = buf.readLine().toLowerCase();
		String[] str;
		int count=0;

		while(true){
			str = buf.readLine().split(" ");
			if(str[0].equals("END_OF_TEXT"))
				break;

			for(int i=0; i<str.length; i++){
				
				if(s.equals(str[i].toLowerCase()))
					count++;
			}

		}
		System.out.println(count);
	}
}

Measured memory_bytes: 24444
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include <assert.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
#include <limits>
#include <numeric>
#include<string.h>
#include<set>
#include <climits>
using namespace std;
typedef unsigned long long ull;
#define ll long long int
ll mod = 1000000007;
//typedef vector<int> V;
//typedef vector<V> VV;
//typedef vector<VV> VVV;

ll dp[200005][2];

int main() {
	string s;
	cin >> s;
	dp[0][0] = 1;
	dp[1][1] = 1;
	for (int i = 1; i < s.size(); i++) {
		for (int j = 0; j < 2; j++) {
			if (j == 0) {
				dp[i][0] = max(dp[i][0], dp[i - 1][1] + 1);
				if(s[i]!=s[i-1])dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1);
			}
			else {
				if (i - 2 >= 0) {
					if(i-3>=0)if (!(s[i] == s[i - 2] && s[i - 1] == s[i - 3]))dp[i][1] = max(dp[i][1], dp[i - 2][1] + 1);
					dp[i][1] = max(dp[i][1], dp[i - 2][0] + 1);
				}
			}
		}
	}


	cout<< max(dp[s.size() - 1][0], dp[s.size() - 1][1]) << endl;
}




Measured memory_bytes: 3716
import sys, heapq
input=sys.stdin.readline
N,M=map(int,input().split())
L=sorted([tuple(map(int,input().split())) for _ in range(N)])
Llen=len(L)
k=0
ans=0
heap=[]
for i in range(1,M+1):
    while k<Llen:
        a,b=L[k]
        if a<=i: heapq.heappush(heap,-b)
        else: break
        k+=1
    if len(heap)>0:
        ans+=-heapq.heappop(heap)
print(ans)


Measured memory_bytes: 71516
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

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

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll d; cin >> d; ll happy = 0;
  vl whatday(26);
  
  vector<bool> israted(26,false);
  
  vl human(26);
  rep(i,26) cin >> human[i];
  
  vvl userhappy(d,vl(26));  
  rep(i,d){
    rep(j,26){
      cin >> userhappy[i][j];
    }
  }
  
 
  rep(i,d){
    ll now = 0; ll nowhappy = 0;
    rep(j,26){
      if(israted[j]){
        if(userhappy[i][j] + 
           (human[j]*(i-whatday[j]))*(human[j]*(i-whatday[j])) > nowhappy){
          now = j;
          nowhappy = userhappy[i][now] + 
            human[j]*(i-whatday[j])*human[j]*(i-whatday[j]);
        }
      }
      else if(userhappy[i][j] > nowhappy){
        now = j;
        nowhappy = userhappy[i][now];
      }
    }
    
    cout << now+1 << endl;
    israted[now] = true;
    whatday[now] = i;
  }
  
  
}

Measured memory_bytes: 3748
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
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()))
MOD = 10**9 + 7

n = INT()
a = LIST()
c = Counter(a)
a = sorted(a)
M = max(a)
isprime = [0]*(M+1)

for i in range(n):
    if isprime[a[i]]==0:
        isprime[a[i]] = 1
        tmp = 2
        while a[i]*tmp < M+1:
            isprime[a[i]*tmp] = 2
            tmp += 1
    elif isprime[a[i]] == 1:
        isprime[a[i]] = 2

ans = 0
for ele in a:
    if isprime[ele] != 2:
        ans += 1
print(ans)

Measured memory_bytes: 126328
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		var h = new HashSet<long>();
		for(long x = 1;x * x <= 100000000000;x++){
			h.Add(x * x);
		}
		
		int cnt = 0;
		for(int i=0;i<N;i++){
			for(int j=i+1;j<N;j++){
				long s2 = 0;
				for(int k=0;k<D;k++) s2 += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
				if(h.Contains(s2)) cnt++;
			}
		}
		Console.WriteLine(cnt);
		
	}
	int N,D;
	long[][] X;
	public Sol(){
		var d = ria();
		N = d[0]; D = d[1];
		X = new long[N][];
		for(int i=0;i<N;i++) X[i] = rla();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 30560
import java.io.*;
import java.util.Scanner;

public class Main {

    static int N, W;
    static int[] w;
    static int[] v;
    static Long[][] memo;

    static long dp(int idx, int rem) {
        if(idx == N) return 0;
        if(memo[idx][rem] != null) return memo[idx][rem];
        long ans = 0;
        if(rem - w[idx] >= 0)
            ans = v[idx] + dp(idx + 1, rem - w[idx]);
        ans = Math.max(ans, dp(idx + 1, rem));
        return memo[idx][rem] = ans;
    }

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        W = sc.nextInt();
        w = new int[N];
        v = new int[N];
        memo = new Long[N][W + 1];
        for(int i = 0; i < N; i++) {
            w[i] = sc.nextInt();
            v[i] = sc.nextInt();
        }
        System.out.println(dp(0, W));
    }
}


Measured memory_bytes: 287416
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    a, v = nm()
    b, w = nm()
    t = ni()
    if abs(a - b) <= (v - w) * t:
        print('YES')
    else:
        print('NO')
    return

solve()


Measured memory_bytes: 9192
#include <stdio.h>

struct Data{
    int Number;
    char Mark;
};

void BubbleSort(struct Data *data,int N){
    int i,j;
    struct Data temp;
    for(i = 0; i < N ; i++) {
        for (j = N - 1; j > i; --j) {
            if (data[j].Number < data[j - 1].Number) {
                temp = data[j];
                data[j] = data[j - 1];
                data[j - 1] = temp;
            }
        }
    }
    for(i = 0; i < N-1; ++i){
        printf("%c%d ",data[i].Mark,data[i].Number);
    }
    printf("%c%d",data[N-1].Mark,data[N-1].Number);
    putchar('\n');
    printf("Stable\n");
}

void SelectionSort(struct Data *data,int N){
    int minj;
    int i,j;
    struct Data temp;
    for(i = 0; i < N ; i++){
        minj = i;
        for(j = i; j < N ; ++j) {
            if (data[minj].Number > data[j].Number) {
                minj = j;
            }
        }
        temp       = data[i];
        data[i]    = data[minj];
        data[minj] = temp;
    }

    for(i = 0; i < N-1; ++i){
        printf("%c%d ",data[i].Mark,data[i].Number);
    }
    printf("%c%d",data[N-1].Mark,data[N-1].Number);

    putchar('\n');
}

int main() {

    int i;
    struct Data data_B[110],data_S[110];
    int N;
    int count = 0;

    scanf("%d",&N);
    for (i = 0; i < N; ++i){
        scanf(" %c%d",&data_B[i].Mark,&data_B[i].Number);
        data_S[i].Number = data_B[i].Number;
        data_S[i].Mark = data_B[i].Mark;
    }

    BubbleSort(data_B,N);
    SelectionSort(data_S,N);
    for (i = 0; i < N; ++i){
        if(data_B[i].Mark != data_S[i].Mark){
            printf("Not stable\n");
            break;
        }
        count++;
    }
    if(count == N){
        printf("Stable\n");
    }


    return 0;
}


Measured memory_bytes: 2140
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      price = 500*a + 100*b + 50*c
      if price == X:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
int n,sum,j;
int main()
{
    scanf("%d",&n);
    j=n;
    while(n!=0)
    {
        sum+=n%10;
        n/=10;
    }
    if(j%sum==0)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define pi acos(-1.0)
#define ms(a, x) memset(a, x, sizeof(a))
#define lowbit(x) ((x)&(-(x)))
#define pb push_back
#define binarycount __builtin_popcount(x)
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define debug(x) cout<<x<<'\n'
#define pii pair<ll,pair<ll,ll> >
using namespace std;
const int inf = 0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9+7;
const double eps = 1e-8;
ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}
ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}
ll powmod(ll a,ll b){
    ll ans = 1, pow = a;
    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }
    return ans;
}
ll mul(ll a,ll b){//大数取模乘法防止溢出
    ll ans=0;
    a%=mod,b%=mod;
    while(b) { if(b&1) ans = (ans+a)%mod; a = (a*2)%mod; b >>= 1; }
    return ans;
}
//(b/a)%p=b*a^(p-2)%p
int pr(ll num){//判断素数
     if(num == 1) return 0;
     if(num ==2|| num==3 ) return 1 ;
     if(num %6!= 1&&num %6!= 5) return 0 ;
     int tmp =sqrt( num);
     for(int i= 5;i <=tmp; i+=6 )
          if(num %i== 0||num %(i+ 2)==0 )return 0 ;
     return 1 ;
}
int Day(int y,int m, int d){
    if(m==1||m==2) { m+=12; y--; }
    int w=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7;
    return w+1;
}
inline int read() {
    int c = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        c = c * 10 + ch - '0';
        ch = getchar();
    }
    return c * f;
}

//#pragma comment(linker, "/STACK:1024000000,1024000000")//外挂开栈
//stable_sort 排序不处理相同元素
//map<int,int>::reverse_iterator rit;
//for(rit=mp.rbegin();rit!=mp.rend();rit++)
//vec动态二维数组
//vector<vector<int>> g(26,vector<int>(100005));
//初始化vec里面套了n个vec

//lower_bound(begin,end,num) 有序数列中返回第一个>=num的数字的地址
//upper_bound( begin,end,num) 返回第一个>num的数字的地址

const int maxn=1e5+5;
int main(){
    ll x;
    cin>>x;
    for(ll i=-5000;i<5000;++i){
        for(ll j=-5000;j<5000;++j){
            ll a=i*i*i*i*i,b=j*j*j*j*j;
            if(a==b+x){
                cout<<i<<' '<<j<<endl;
                return 0;
            }
        }
    }
  //  cout<<1<<endl;
    return 0;
}


Measured memory_bytes: 3680
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>

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

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
ll INF = 1LL<<40;

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

    int N;
    cin >> N;
    vector<ll> p(N), po(N);
    REP(i, N){
        cin >> p[i];
    }
    po = p;
    
    sort(p.begin(), p.end());
//    reverse(p.begin(), p.end());

    ll cnt = 0;
    REP(i, N){
        //cout << p[i] << "," << po[i] << endl;
        if(p[i] != po[i]){
            cnt++;
        }
    }
    cout << (cnt <= 2 ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 256
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
from fractions  import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
def lcm(a,b):
    g=gcd(a,b)
    res=g*(a//g)*(b//g)
    return res
l=int(input())
for i in range(n-1):
    ti=int(input())
    l=lcm(l,ti)
print(l)

Measured memory_bytes: 77588
import Foundation

func splitCount(_ a: [Int], _ x: Int) -> Int {
  let res = a.reduce(0) { $0 + Int(ceil(Double($1) / Double(x))) - 1 }
  return res
}

let inp = readLine()!.split(separator: " ").map { Int($0)! }
let n = inp[0]
let k = inp[1]

let a = readLine()!.split(separator: " ").map { Int($0)! }

var left = 1
var right = a.max()!

var ans = right

while left <= right {
  let mid = left + (right - left) / 2
  let c = splitCount(a, mid)
  if c <= k {
    ans = min(ans, mid)
    right = mid - 1
  } else {
    left = mid + 1
  }
}
print(ans)

Measured memory_bytes: 24852
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define ins insert
#define ll long long
#define Pair pair<int,int>
#define MT make_tuple
#define MP make_pair
#define INF 0x3f3f3f3f
#define lim 1e9
#define Bigint 3e8+1
#define MAX 3e5
#define NL '\n'
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, //for indexed_set
        tree_order_statistics_node_update> indexed_set;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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

    int n,m,k,c;
    char ch;
    string s;
    cin >> n >> s;


    m = s.length();
    for(int i=0 ; i<m ; i++){
        k = (s[i]-'A'+n)%26;
        ch = k+'A';
        cout << ch;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <functional>
#include <cmath>
#include <numeric>

using namespace std;

struct mo {
    int n, q, width;
    vector<int> ql, qr, qi;
    int ptr = 0, nl = 0, nr = 0;

    mo(int n, int q) : n(n), q(q), width(n / sqrt(q)), ql(q), qr(q), qi(q) {}

    // [l, r)
    void insert(int l, int r) { ql[ptr] = l; qr[ptr] = r; ptr++; }

    void build() {
        ptr = 0;
        iota(qi.begin(), qi.end(), 0);
        sort(qi.begin(), qi.end(), [&](int i, int j) {
            if (ql[i] / width != ql[j] / width) return ql[i] < ql[j];
            else {
                if ((ql[i] / width) % 2 == 0) return qr[i] < qr[j];
                else return qr[i] > qr[j];
            }
        });
    }

    int process() {
        int i = qi[ptr++];
        while (ql[i] < nl) add(--nl);
        while (nr < qr[i]) add(nr++);
        while (nl < ql[i]) del(nl++);
        while (qr[i] < nr) del(--nr);
        return i;
    }

    void add(int i);
    void del(int i);
};

vector<int> a, cnt;
int sum = 0;

void mo::add(int i) { if (cnt[a[i]]++ == 0) sum++; }
void mo::del(int i) { if (--cnt[a[i]] == 0) --sum; }

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

    int n, q;
    cin >> n >> q;
    a.resize(n);
    for (int i = 0; i < n; ++i) cin >> a[i], a[i]--;

    mo query(n, q);

    for (int i = 0; i < q; ++i) {
        int ql, qr;
        cin >> ql >> qr;
        ql--;
        query.insert(ql, qr);
    }
    query.build();

    cnt.resize(n);
    vector<int> ans(q);
    for (int i = 0; i < q; ++i) {
        int idx = query.process();
        ans[idx] = sum;
    }

    for (int i = 0; i < q; ++i) cout << ans[i] << '\n';
}


Measured memory_bytes: 15492
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.math.*;
import java.io.*;


public class Main {

    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long K = sc.nextLong();

        int[] P = new int[N];
        for(int n=0; n<N; n++) P[n] = sc.nextInt()-1;
        long[] C = new long[N];
        for(int n=0; n<N; n++) C[n] = sc.nextLong();

        int[] loopLength = new int[N];
        long[] loopScore = new long[N];
        for(int n=0; n<N; n++){
            int i=n;
            int k=0;
            long s = 0;
            while(true){
                k++;
                i = P[i];
                s += C[i];
                if(i==n) break;
            }
            while(true){
                i = P[i];
                loopLength[i] = k;
                loopScore[i] = s;
                if(i==n) break;
            }
        }

        //System.out.println(Arrays.toString(loopLength));
        //System.out.println(Arrays.toString(loopScore));

        long ans = C[P[0]];

        for(int n=0; n<N; n++){
            int cur = n;
            long score = 0;
            for(long k=1; k<=K; k++){
                cur = P[cur];
                score += C[cur];
                ans = Math.max(ans, score);

                if(k==loopLength[n] && 5*k<K){
                    k = ((K/loopLength[n]-1))*loopLength[n];
                    cur = n;
                    score = loopScore[n] * (k / loopLength[n]);
                    ans = Math.max(ans, score);
                }
            }
        }

        System.out.println(ans);
        

    }
}


Measured memory_bytes: 48424
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String arg = br.readLine();
        String[] inputArray = arg.split(" ");
        int[] inputIntArray = new int[inputArray.length];

        for (int count = 0; count < inputIntArray.length; count++) {
            inputIntArray[count] = Integer.parseInt(inputArray[count]);
        }
        int a = inputIntArray[0];
        int b = inputIntArray[1];
        int c = inputIntArray[2];
        String retStr;

        if (a < b && b < c) {
            retStr = "Yes";
        } else {
            retStr = "No";
        }
        System.out.println(retStr);
    }
}

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

using namespace std;

int n,m,a[100010],b[100010],top;

int main()
{
	scanf("%d%d",&n,&m);
	int odd1=-1,odd2=-1;
	for(int i=1; i<=m; i++)
	{
		scanf("%d",&a[i]);
		if(a[i]&1)
		{
			if(odd1==-1)
				odd1=i;
			else if(odd2==-1)
				odd2=i;
			else
			{
				printf("Impossible");
				return 0;
			}
		}
	}
	if(m==1)
	{
		if(a[1]==1)
			printf("1\n1\n1\n");
		else
			printf("%d\n2\n1 %d\n",a[1],a[1]-1);
		return 0;
	}
	if(odd1!=-1)swap(a[1],a[odd1]);
	if(odd2!=-1)swap(a[m],a[odd2]);
	for(int i=1; i<=m; i++)printf("%d%c",a[i]," \n"[i==m]);
	if(a[m]==1)
	{
		printf("%d\n",m-1);
		printf("%d ",a[1]+1);
		for(int i=2; i<m; i++)printf("%d ",a[i]);
		return 0;
	}
	b[1]=a[1]+1;
	for(int i=2; i<m; i++)b[i]=a[i];
	b[m]=a[m]-1;
	printf("%d\n",m);
	for(int i=1; i<=m; i++)printf("%d%c",b[i]," \n"[i==m]);
	return 0;
}

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

int main(){
    int n,k,ans=0;
    cin>>n>>k;
    vector<int>d(n);
    for(int i=0;i<n;i++){
        cin>>d.at(i);
        if(d.at(i)>=k){
        ans++;
        }
        }
    cout<<ans<<endl;
    }

Measured memory_bytes: 640
use std::io;
use std::str::FromStr;

fn input_tuple() -> (u64, u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1], vec[2])
}

fn main() {
    let (a, b, k) = input_tuple();
    if k <= a {
        println!("{} {}", a - k, b);
    } else if k - a <= b {
        println!("0 {}", b - (k - a));
    } else {
        println!("0 0");
    }
}


Measured memory_bytes: 4352
using System;

namespace abc106_c
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var K = long.Parse(Console.ReadLine());

            for(int i = 1; i <= S.Length; i++)
            {
                if (i == K && S[i - 1] == '1')
                {
                    Console.WriteLine(1);
                    break;
                }
                else if (S[i - 1] != '1') 
                { 
                    Console.WriteLine(S[i - 1]);
                    break;
                }
            }
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
struct Dice {
  int top, base, front, back, left, right;
  friend istream& operator>>(istream& is, Dice& dice) {
    is >> dice.top >> dice.front >> dice.right >> dice.left >> dice.back >>
        dice.base;
    return is;
  }
  void SS() {
    int top = this->back, base = this->front, front = this->top,
        back = this->base;
    this->top = top, this->base = base, this->front = front, this->back = back;
  }
  void NN() {
    int top = this->front, base = this->back, front = this->base,
        back = this->top;
    this->top = top, this->base = base, this->front = front, this->back = back;
  }
  void EE() {
    int top = this->left, base = this->right, left = this->base,
        right = this->top;
    this->top = top, this->base = base, this->left = left, this->right = right;
  }

  void WW() {
    int top = this->right, base = this->left, left = this->top,
        right = this->base;
    this->top = top, this->base = base, this->left = left, this->right = right;
  }
};
int main() {
  Dice dice;
  string op;
  cin >> dice >> op;
  for (int i = 0; i < op.length(); i++) {
    if (op[i] == 'S')
      dice.SS();
    else if (op[i] == 'E')
      dice.EE();
    else if (op[i] == 'N')
      dice.NN();
    else if (op[i] == 'W')
      dice.WW();
  }
  cout << dice.top << endl;
  return 0;
}


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

int main() {
  int d, t, s;
  cin >> d >> t >> s;

  if (t * s >= d) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

//Global Variable
int n; // the size of target array
int q; // the number of querys
int* D;// the minimum value array.
int* lazy;
int x;
int i; // the variable for for loop. just lazy.
//End of Global Variable



// Function prototype Area
void __get_init_value(void);
int __min(int a, int b);
void initRMQ( int n_);
void update(int a, int b);
void __update(int a, int b, int k, int l, int r);
int findMin(int a,int b);
void __find(int k);
int query(int a , int b, int k, int l, int r);

void lazy_evaluate(int k);
// End of Funtion prototype Area


int main(int argc, char* argv[]){

	__get_init_value();
	//printf("init n = %d\n",n);
	initRMQ(n);
	//printf("after initRMQ n = %d\n",n);


	int com;
	int s;
	int t;
	//int x;
	int ans;
	while(q>0){
		scanf("%d",&com);
		if(com){
			scanf("%d %d",&s,&t);
			ans = findMin(s,t);
			printf("%d\n",ans);
		}else{
			scanf("%d %d %d",&s, &t, &x);
			update(s,t);
		}	
		q--;
	}

	return 0;
}

int __min(int a, int b){
	if(a > b){
	return b;
	}else{
	return a;
	}
}

void __get_init_value(void){

	scanf("%d %d", &n, &q);
	return;
}//end of get init value;

void initRMQ(int n_){
	// n_ is used to preserved original n;
	// after this function, n is not the total item number anymore.

	n = 1;
	while(n < n_){
		n *= 2;
	}
	
	D = malloc(sizeof(int)* (2*n-1));
	lazy = malloc(sizeof(int)* (2*n-1));
	if(D == NULL){
		printf("Init Array Failed, no memory or size is wrong\n");
		return;
	}

	for(i = 0; i< 2*n-1 ; i++){
		D[i] = INT_MAX;
		lazy[i] = INT_MAX;
	}
	return;
}// end of initRMQ;


void update(int a , int b){
	__update(a, b+1, 0, 0, n);
}// end of update;

void __update(int a, int b, int k , int l, int r){
	//printf("qurey a=%d b=%d k=%d l=%d r=%d\n",a,b,k,l,r);
	//
	if(k >= 2*n-1){return;}

	lazy_evaluate(k);

	if(r <= a || b <= l){
		return;
	}
	if(a <= l && r <= b){
		D[k] = x;
		if (l == r){
			return;
		}else{	
			if(k < n-1){
				lazy[k*2+1] = x;
				lazy[k*2+2] = x;
			}
			return;
		}
	}
	//printf("(L+R)/2 = %d\n",(l+r)/2);
	//printf("vl, l=%d\n",l);
	__update(a, b, k*2+1, l , (l+r)/2);
	//printf("vr, r=%d\n",r);
	__update(a, b, k*2+2, (l+r)/2, r);
	D[k] =  __min(D[k*2+1],D[k*2+2] );

}


int findMin(int a, int b){
	//printf("findMin n = %d\n",n);
	//a += n - 1;
	//__find(a);
	//return D[a];
	return query( a, b+1, 0, 0, n);
}// end of findMin;

void __find(int k){
	if(k > 0){
		__find((k-1)/2);
	}
	lazy_evaluate(k);

}

int query(int a, int b, int k , int l , int r){
	//printf("qurey a=%d b=%d k=%d l=%d r=%d\n",a,b,k,l,r);
	lazy_evaluate(k);
	if(r <= a || b <= l){
		return INT_MAX;
	}
	if(a <= l && r <= b){
		return D[k];
	}
	//printf("(L+R)/2 = %d\n",(l+r)/2);
	//printf("vl, l=%d\n",l);
	int vl = query(a, b, k*2+1, l , (l+r)/2);
	//printf("vr, r=%d\n",r);
	int vr = query(a, b, k*2+2, (l+r)/2, r);
	return __min(vl, vr);
}//end of query

void lazy_evaluate(int k){
	if( lazy[k] == INT_MAX){
		return;
	}
	D[k] = lazy[k];
	if(k < n-1){
		lazy[2*k +1] = lazy[k];
		lazy[2*k +2] = lazy[k];
	}
	lazy[k] = INT_MAX;
}



Measured memory_bytes: 3784
// 解説見た
// それでも分からんのでokojomoekoさんの回答みた

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <forward_list>
using namespace std;

int MSb(int n);

int main() {
	int N, dummy;
	dummy = scanf("%d", &N);

	map<int, int> m;
	vector<int> v;
	int tmp;
	for (int i = 0; i < N; i++) {
		dummy = scanf("%d", &tmp);
		v.push_back(tmp);
		m[tmp]++;
	}

	std::sort(v.begin(), v.end(), std::greater<int>());

	int ans = 0;
	int n;

	// 調査対象
	for (int i = 0; i < N - 1; i++) {
		if (m[v[i]] == 0) continue;
		m[v[i]]--;

		int target = MSb(v[i]) - v[i];
		if (m[target] != 0) {
			m[target]--;
			ans++;
		}
	}

	printf("%d\n", ans);

	return 0;
}

int MSb(int n){
    // bitシフトを用いて、2の冪乗を求める。
    int ret = 1;
    while (n > 0) { ret <<= 1; n >>= 1; }
    return ret;
}


Measured memory_bytes: 19700
N = int(input())
K = int(input())
l = len(str(N))
ans = 0

def neq(n):
    r = 0
    for i in range(10**(len(str(n))-1),n+1):
        ml = 1
        for j in range(len(str(n))):
            ml *= int(str(i)[j])
        if ml != 0:
            r += 1
    return(r)

if l == K:
    print(neq(N))

elif K == 3:
    for i in range(l-2):
        for j in range(i+1,l-1):
            for k in range(j+1,l):
                if i == 0:
                    ans += (int(str(N)[0])-1)*9**2
                    if int(str(N)[1:max(j,2)])>0 and j != 1:
                        ans += 9**2
                    else:
                        if int(str(N)[j+1:max(k,j+2)])>0 and k != j+1:
                                ans += int(str(N)[j])*9
                        else:
                            if int(str(N)[j])*int(str(N)[k]) != 0:
                                ans += neq(int(str(N)[j])*10+int(str(N)[k]))
                            
                else:
                    ans += 9**3
    print(ans)

elif K == 2:
    for i in range(l-1):
        for j in range(i+1,l):
            if i == 0:
                ans += (int(str(N)[0])-1)*9
                if int(str(N)[1:max(j,2)])>0 and j != 1:
                        ans += 9
                else:
                    ans += int(str(N)[j])

            else:
                ans  += 9**2
    print(ans)

else:
    for i in range(l):
        if i == 0:
            ans += int(str(N)[0])
        else:
            ans += 9
    print(ans)



Measured memory_bytes: 73444
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define int long long 
using namespace std;
inline int read(){
	int f=1,ans=0;char c;
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
	return ans*f;
}
const int MAXN=13;
int r,d,a[MAXN]; 
signed main(){
	r=read(),d=read(),a[0]=read();
	for(int i=1;i<=10;i++) a[i]=a[i-1]*r-d;
	for(int i=1;i<=10;i++) printf("%lld\n",a[i]);
}


Measured memory_bytes: 256
def main():
    from math import isqrt
    # Return the integer part of the square root of the input.

    N = int(input())

    def f(x):
        return x * (x + 1) // 2

    ans = 0
    for k in range(1, isqrt(N) + 1):
        # https://maspypy.com/atcoder-%e5%8f%82%e5%8a%a0%e6%84%9f%e6%83%b3-2020-06-27abc-172
        # a*b<=N
        # k=min(a,b)
        # k*k, k*(k+1),...,k*m
        # k*jはkの倍数かつjの倍数なので,2回計上される
        # k*kはkの倍数として1回だけ計上されるので,2回分計上して過剰分を減らす
        m = N // k
        ans += 2 * k * (f(m) - f(k - 1)) - k * k
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9180
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define SZ(X) ((int64_t)((X).size()))
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define intmax (std::numeric_limits<int64_t>::max() / 4)
#define doublemax (std::numeric_limits<double>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);




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

	int N;
	cin >> N;
	vector<string>S(N);
	rep(i, N)cin >> S[i];
	string T;
	cin >> T;

	int lb = 0, ub = 0;
	vector<string>SS(N + 1);

	//一番早いとして何番目か求める。
	rep(i, N) {
		SS[i] = S[i];
		rep(j, SS[i].size())if (SS[i][j] == '?')SS[i][j] = 'z';
	}
	SS[N] = T;
	sort(ALL(SS));
	rep(i, N + 1)if (SS[i] == T) { lb = i + 1; break; }

	//一番遅いとして何番目か求める。
	rep(i, N) {
		SS[i] = S[i];
		rep(j, SS[i].size())if (SS[i][j] == '?')SS[i][j] = 'a';
	}
	SS[N] = T;
	sort(ALL(SS));
	for(int i = N; 0 <= i; i--)if (SS[i] == T) { ub = i + 1; break; }

	for (int i = lb; i <= ub; i++) {
		if (i != lb)cout << " ";
		cout << i;
	}
	cout << endl;

	return 0;
}



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

 int main()
 {
    char a[201][201];
    int i,j;
    char b[101][101];
    int n,m;
    cin>>n>>m;
    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++)
            cin>>b[i][j];
    for(i=1;i<=2*n;i++)
        for(j=1;j<=m;j++)
        a[i][j]=b[(i+1)/2][j];
    for(i=1;i<=2*n;i++)
    {for(j=1;j<=m;j++)
    cout<<a[i][j];
    cout<<endl;
    }


 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ans=0;
  cin>>n;
  for(int i=1;i<=n;i++){
    if(i%2==0) continue;
    int cnt = 0;
    for(int j=1;j<=i;j++){
      if(i%j==0) cnt++;
    }
    if(cnt == 8){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int N_MAX = 510;
vector<vector<int> > ans(N_MAX,vector<int>(N_MAX));

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  repp(x,1,N+1) repp(y,x+1,N+1){
    int r = 0;
    while(((x^y)>>r&1)==0)++r;
    ans[x][y] = ans[y][x] = r+1;
  }
  repp(x,1,N+1){
    repp(y,x+1,N+1) cout << ans[x][y] SPF;
    cout << endl;
  }
  return 0;
}


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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

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

    int A, B, C; cin >> A >> B >> C;
    REPS(i, 10000)
    {
        if(A*i % B == C)
        {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}

Measured memory_bytes: 3540
"use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

var processData = function processData(lines) {
  var _lines$0$split = lines[0].split(' '),
      _lines$0$split2 = _slicedToArray(_lines$0$split, 2),
      n = _lines$0$split2[0],
      m = _lines$0$split2[1];

  var items = lines[1].split(' ').map(function (x) {
    return +x;
  });
  var total = items.reduce(function (r, x) {
    return r + x;
  }, 0);
  var filtered = items.filter(function (x) {
    return x >= total / (4 * m);
  });
  console.log(filtered.length >= m ? 'Yes' : 'No');
};

var i = '';
process.stdin.on('data', function (c) {
  return i += c;
});
process.stdin.on('end', function () {
  var _require = require('os'),
      EOL = _require.EOL;

  var lines = i.split(EOL);
  /*your input text, split by lines*/

  processData(lines);
});


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

public class Main {

	public static void main(String[] args) {
		FastReader fr = new FastReader();
		int n = fr.nextInt();
		String s = fr.nextLine();
		int[][] freq = new int[26][n];
		for (int i=0; i<n; i++) {
			for (int j=0; j<26; j++) {
				if (s.charAt(i) == 'a' + j) {
					freq[j][i] = i>0 ? freq[j][i-1] + 1 : 1;
				} else {
					freq[j][i] = i>0 ? freq[j][i-1] : 0;
				}
			}
			
		}
		int max = 0;
		for (int i=1; i<n; i++) {
			int temp = 0;
			for (int j=0; j<26; j++) {
				temp += freq[j][i-1] > 0 && freq[j][n-1] - freq[j][i-1] > 0 ? 1 : 0;
			}
			max = Math.max(max, temp);
		}
		System.out.println(max);
	}
	
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		public String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}


Measured memory_bytes: 25572
def p(a):
    for elem in a:
        print(elem)


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


curr, _max = 0, 0
for i in range(len(H) - 1):
    if H[i] >= H[i + 1]:
        curr += 1
        _max = max(curr, _max)
    else:
        curr = 0

print(_max)


Measured memory_bytes: 15020
#include <algorithm>
#include <climits>
#include <iostream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using std::cin;
using std::cerr;
using std::cout;
using std::endl;
using std::make_pair;
using std::pair;
using std::stack;
using std::string;
using std::unordered_set;
using std::vector;
using std::lower_bound;
using std::upper_bound;

long count_less_than(const vector<long>& a, long l, long* max) {
  long count = 0;
  int i, j;

  int z = lower_bound(a.begin(), a.end(), 0) - a.begin();

  // Count (a_i, a_j) where a_i >= 0 and a_j >= 0 and j > i.
  i = z;
  j = a.size() - 1;
  for (; i < a.size(); ++i) {
    while (j > i && a[i] * a[j] > l) {
      --j;
    }
    if (i == j) {
      break;
    }
    *max = std::max(*max, a[i] * a[j]);
    count += j - i;
  }

  // Count (a_i, a_j) where a_i >= 0 and a_j < 0 and i > j.
  i = a.size() - 1;
  j = z - 1;
  for (; i >= z; --i) {
    while (j >= 0 && a[i] * a[j] > l) {
      --j;
    }
    if (j < 0) {
      break;
    }
    *max = std::max(*max, a[i] * a[j]);
    count += j + 1;
  }

  // Count (a_i, a_j) where a_i < 0 and i > j.
  i = z - 1;
  j = 0;
  for (; i >= 0; --i) {
    while (i > j && a[i] * a[j] > l) {
      ++j;
    }
    if (i == j) {
      break;
    }
    *max = std::max(*max, a[i] * a[j]);
    count += i - j;
  }

  return count;
}

int main(int argc, char* argv[]) {
  long n, k;
  cin >> n >> k;
  vector<long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());

  long s = -1000000000000000000L;  // 10^9^2
  long e = 1000000000000000000L;
  long m;

  while (s < e) {
    m = (s + e) / 2;
    if (m == e) {
      --m;
    }
    long unused;
    if (count_less_than(a, m, &unused) < k) {
      s = m + 1;
    } else {
      e = m;
    }
  }
  long max = -1000000000000000000L;
  cerr << "count: " << count_less_than(a, s, &max) << endl;
  cout << max << endl;

  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(){
  int x=1,y=1;
  while(x>0 || y>0){scanf("%d %d",&x,&y);
if(x>0 || y>0){if(x>=y)printf("%d %d\n",y,x);
      else if(x<y)printf("%d %d\n",x,y);}}
  return 0;
}

Measured memory_bytes: 596
n = int(input())
l = list(map(int, input().split()))
sol = 1
nula = 0
over = 0
for i in l:
    if (i == 0):
        nula = 1
    sol = sol * i
    if sol>1000000000000000000:
        over = 1
        sol = 0
if (nula == 1):
    print(0)
elif (over == 1):
    print(-1)
else:
    print(sol)



Measured memory_bytes: 21592