akhauriyash/Code-Regression huggingface dataset:
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 200005;
const int mod = 1000000007;

int c[maxn];
int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  for(int i=2;i<=n;i++){
    int x;
    cin>>x;
    c[x]++;
  }
  for(int i=1;i<=n;i++)cout<<c[i]<<endl;
  return 0;
}

Measured memory_bytes: 4416
import sys
input = sys.stdin.readline
from collections import Counter



def main():
    N = int(input())
    S = input().strip()

    c = Counter(S)

    ans = float("inf")

    w_c = 0
    for i in range(N):
        tmp = w_c
        if S[i] == 'W':
            w_c += 1
        else:
            c['E'] -= 1
        tmp += c['E']
        ans = min(ans, tmp)

    print(ans)





if __name__ == '__main__':
    main()



Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define ff first
#define mp make_pair
#define ss second
#define rep(i,a,b) for(int i = a; i < b; i++)
#define repp(i,a,b) for(int i = a; i <= b; i++)
#define endl '\n'
#define mod 1000000007
#define mod_in(a) bin(a, mod - 2)
#define fact(n) rep(i, 1, n+1) ft.pb((ft[i-1] * i) % mod)
#define ncr(n, r) (n >= r ? ((ft[n] * mod_in((ft[r] * ft[(n)-(r)]) % mod)) % mod) : 0LL)
#define pi 3.14159265358979323
#define INF 1e15
#define lb(v, a) lower_bound(v.begin(), v.end(), a)
#define ub(v, a) upper_bound(v.begin(), v.end(), a)

int power(int x, int n){
    int res=1;
    while(n>0){
        if(n&1)
            res=res*x;
        x*=x;
        n>>=1;
    }
    return res;
}

int bin(int x, int n){
    int res=1; x%=mod;
    while(n){
        if(n&1) res=(res*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return res;
}

bool prime(int n){
    if(n==3)return 1;
    repp(i,2,sqrt(n)){
        if(n%i==0)return 0;
    }
    return 1;
}

set<int> v[26];
int flag=0;
int vis[26]={0}, par[200001]={0}, top[500001], a[200006], b[200006];

void dfs(int n){
    vis[n] = 1;
    cout<<char(n + 'a');
    for(auto i: v[n]){
        if(!vis[i]) dfs(i);
    }
}

// vector<int> adj[2000005];
// vector<int> pr(2000005, 1), xx[2000005];
// void sieve(int n){ 
//     for(int p=2; p<n; p++){ 
//         if(pr[p]){ 
//             for(int i=p; i<n; i += p){
//                 pr[i]=0;
//                 xx[i].pb(p);
//             }
//         } 
//     } 
// }  
// vector<int> ft(40);

void solve(){
    int n; cin>>n;
    cout<<((n>=30)?"Yes\n": "No\n");
}

signed main(){
    fast
    int t=1;
    // cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 3632
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, k = map(int, readline().split())
h = [int(readline()) for _ in range(n)]
h.sort()
ans = float('inf')
for bf, af in zip(h, h[k - 1:]):
    ans = min(ans, af - bf)
print(ans)


Measured memory_bytes: 7876
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

using namespace std;
int main() {
    int n, k;
    int ans = 0;
    cin >> n >> k;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    sort(all(l));
    reverse(all(l));
    rep(i, k) ans += l[i];
    cout << ans << endl;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
  input! {
    n: usize,
    bases: [isize;3],
    bs: [isize;n]
  }
  
  let mut min = isize::max_value();
  let max = 2usize.pow(2*n as u32);
  for i in 0..max {
    let mut bmps: Vec<Vec<isize>> = vec![vec![];3];
    for ii in 0..n {
      let powv = (2 * ii) as u32;
      let mut val = 0;      
      if (i >> powv) & 1 == 1 {
        val += 1;
      }
      
      if (i >> (powv+1u32)) & 1 == 1 {
        val += 2;
      }
      
      if val != 3 {
        bmps[val].push(bs[ii]);
      }
    }
    
    let mut sr = 0;
    let mut succeeded = true;
    for (i, bmp) in bmps.into_iter().enumerate() {
      if bmp.len() == 0 { 
        succeeded = false;
        break
      }
      sr += ((bmp.len() - 1) * 10) as isize;
      sr += (bases[i] - bmp.into_iter().sum::<isize>()).abs();
    }
    
    if succeeded {
      min = std::cmp::min(sr, min);
    }   
  }
  println!("{}", min);
}

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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    int N,W,H;
    cin >>N>>W>>H;

    vector<int> x(N),y(N),w(N);
    rep(i,N) cin >> x[i]>>y[i]>>w[i];
    vector<int> mapx(W+1,0),mapximo(W,0);
    vector<int> mapy(H+1,0),mapyimo(H,0);
    //-----------------------------------
    bool is=true,isb=true;
    rep(i,N){
        if(0<=x[i]-w[i])mapx[x[i]-w[i]]++;
        else mapx[0]++;

        if(x[i]+w[i]<=W)mapx[x[i]+w[i]]--;
        else mapx[W]--;

        if(0<=y[i]-w[i])mapy[y[i]-w[i]]++;
        else mapy[0]++;

        if(y[i]+w[i]<=H)mapy[y[i]+w[i]]--;
        else mapy[H]--;
    }
    mapximo[0]=mapx[0];
    repd(i,1,W) mapximo[i]=mapximo[i-1]+mapx[i];

    mapyimo[0]=mapy[0];
    repd(i,1,H) mapyimo[i]=mapyimo[i-1]+mapy[i];

    rep(i,W) is=is&&(mapximo[i]>0);
    rep(i,H)isb=isb&&(mapyimo[i]>0);

    
    cout << ((is||isb) ? "Yes" : "No") <<endl;
    return (0);
}


Measured memory_bytes: 5480
N,Y = map(int, input().split())


import sys


for x in range(N+1):
        for y in range(N+1):
                z = N-x-y
                if z < 0:
                        break
                if x * 10000 + y*5000 + z*1000 == Y:
                        print(x,y,z)
                        sys.exit()
print("-1 -1 -1")

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main()
{
	string a,b,c;
	int i,j,d,e;
	cin>>a>>b;
	c=a+b;
	d=0;
	for(i=0;i<c.length();i++)
	{
		d=(c[i]-48)*pow(10,c.length()-i-1)+d;
	}
	e=0;
	for(i=0;i<d;i++)
	{
		if(d==i*i)
		{
			e=1;
			break;
		}
	}
	if(e==0)
	{
		cout<<"No"<<endl;
	}
	else
	{
		cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int a, b;
    char op[2];
    while(scanf("%d %1s %d", &a, op, &b), op[0] != '?') {
        switch(op[0]) {
          case '+':
            printf("%d\n", a + b);
            break;
          case '-':
            printf("%d\n", a - b);
            break;
          case '*':
            printf("%d\n", a * b);
            break;
          case '/':
            printf("%d\n", a / b);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 600
from sys import stdin
import math

n, d = map(int,input().split())
cnt = 0
x =  [stdin.readline().rstrip().split() for _ in range(n)]
ans = 0
for i in range(n):
	for k in range(i+1,n):
		for j in range(d):
			ans += (int(x[i][j]) - int(x[k][j]))**2

		ans1 = math.sqrt(ans)
		#print(ans)
		if ans1.is_integer() == True: 
			cnt += 1
		ans = 0
print(cnt)

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    ll X = tx - sx, Y = ty - sy;

    cout << "D";
    REP(i,0,X+1) cout << "R";
    REP(i,0,Y+1) cout << "U";
    cout << "L";
    cout << "U";
    REP(i,0,X+1) cout << "L";
    REP(i,0,Y+1) cout << "D";
    cout << "R";
    REP(i,0,X) cout << "R";
    REP(i,0,Y) cout << "U";
    REP(i,0,X) cout << "L";
    REP(i,0,Y) cout << "D";
    cout << endl;

    return 0;
}

/*



*/

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n,k,ans=0;
    cin>>n>>k;
    vector<ll> h(n);
    for (int i = 0; i < n; i++)
    {
        cin>>h[i];
    }
    sort(all(h));
    for (int i = 0; i < n-k; i++)
    {
        ans+=h[i];
    }
    
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>

using namespace std;

int main(){
    string S;
    long cnt[26] = {0};
    cin >> S;
    //cout << S.size() << endl;
    for(int i = 0; i < S.size(); i++){
        cnt[S[i] - 'a']++;
    }
    long ans;
    ans = (S.size()*((S.size()+1)))/2 + 1;
    for(int i = 0; i < 26; i++){
        ans -= (cnt[i]*(cnt[i]+1))/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
package main

import (
	"fmt"
	"bufio"
	"os"
	"strings"
	"strconv"
)

func max(a, b int) int {
    if a < b {
        return b
    }
    return a
}

func min(a, b int) int {
    if a < b {
        return a
    }
    return b
}

func readLineNum(bf *bufio.Reader) int {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	N, _ := strconv.Atoi(line)
	return N
}

func readLineNums(bf *bufio.Reader) []int {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	fields := strings.Split(line, " ")
	nums := []int{}
	for _, field := range fields {
		num, _ := strconv.Atoi(field)
		nums = append(nums, num)
	}
	return nums
}

func readLineFloats(bf *bufio.Reader) []float64 {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	fields := strings.Split(line, " ")
	fs := []float64{}
	for _, field := range fields {
		f , _ := strconv.ParseFloat(field, 64)
		fs = append(fs, f)
	}
	return fs
}

func readLineStrs(bf *bufio.Reader) []string {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	return strings.Split(line, " ")
}

func main() {
	bf := bufio.NewReader(os.Stdin)
    nk := readLineNums(bf)
    _, K := nk[0], nk[1]
    A := readLineNums(bf)

	dp := make([]bool, K+1) // dp[i]: 记录包含i个初始的石头时, 第一个选择的人是否可以赢.
	for i:=1; i<=K; i++ {
		for _, stone := range A {
			if i < stone {
				continue
			}
			if !dp[i-stone] {
				dp[i] = true
			}
		}
	}

	if dp[K] {
		fmt.Println("First")
	} else {
		fmt.Println("Second")
	}
}


Measured memory_bytes: 768
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<complex>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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




const ll INF = 1e9;


/******************************************************************************************/


int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);

	
	ll n;
	cin >> n;
	ll a, b;
	cin >> a >> b;

	vector<ll> A(20), B(20);

	A[0] = a;
	B[0] = b;
	for (int i = 0; i < 12; i++)
	{
		if (i % 2 == 0) {
			A[i + 1] = A[i] - B[i];
			B[i + 1] = B[i];
		}
		else
		{
			A[i + 1] = A[i];
			B[i + 1] = A[i] + B[i];
		}
	}

	cout << A[n % 12] << " " << B[n % 12] << endl;


	return 0;
}



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

using namespace std;

int main(){
	string S;
	cin >> S;
	int w;
	cin >> w;
	for( size_t i = 0; i < S.length(); i++ ){
		if( i%w==0 ){
			cout << S[i];
		}
	}
	cout << endl;
}


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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}

long long weight[101], value[101];

vector<long long> wt[4];

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

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

    // 4 separate weights
    // maybe go by weights

    long long n, w; cin >> n >> w;

    for(int i = 0; i < n; ++i)
        cin >> weight[i] >> value[i];

    for(int i = 0; i < n; ++i){
        wt[weight[i] - weight[0]].push_back(value[i]);
    }

    for(int i = 0; i < 4; ++i)
        sort(wt[i].begin(), wt[i].end());

    int LA = wt[0].size(), LB = wt[1].size(), LC = wt[2].size(), LD = wt[3].size();

    long long best = 0, A = 0, B = 0, C = 0, D = 0, wa = 0, wb = 0, wc = 0, wd = 0;

    for(int a = LA; a >= 0; --a){
        if(a < LA){
            A += wt[0][a];
            wa += weight[0];
        }
        B = wb = 0;
        for(int b = LB; b >= 0; --b){
            if(b < LB){
                B += wt[1][b];
                wb += weight[0] + 1;
            }
            C = wc = 0;
            for(int c = LC; c >= 0; --c){
                if(c < LC){
                    C += wt[2][c];
                    wc += weight[0] + 2;
                }
                D = wd = 0;
                for(int d = LD; d >= 0; --d){
                    if(d < LD){
                        D += wt[3][d];
                        wd += weight[0] + 3;
                    }
                    if(wa + wb + wc + wd > w)
                        continue;
                    best = max(best, A + B + C + D);
                }
            }
        }
    }

    cout << best << "\n";

    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <algorithm>

using namespace std;

template<typename T> 
void show(T a){
  for(auto i : a){ cout << i << " "; }
  cout << endl;
}


int main(int argc, char *argv[]){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());
  
  cout << a[0]*a[1]/2 << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,r)for(int i=(l);i<(r);i++)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    int n;
    cin >> n;
    vector<int> v(10000,0);
    rep(i,1,100)v[i] = i*i;
    if(n == 1){
        cout << 1 << endl;
        return 0;
    }
    double ans = 0;
    for(int i = 2;i<=n;i++){
            double p = 1;
            for(int j = 2;pow(i,j) <= n;j++){
                p = pow(i,j);
            }
            ans = max(p,ans);
        }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
 
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define Get(t, i) get<(i)>((t))
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, f, n) for(int i = (int)(f); i < (int)(n); i++)
#define each(a, b) for(auto& a : b)
 
const int inf = 1 << 25;
const ll INF = 1LL << 55;

int w, h;
char c[22][22];
int d[22][22][1<<10];
int sx, sy;

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

typedef pair<Pi, Pi> PP;

int bfs(int n)
{
  memset(d, -1, sizeof(d));
  queue<PP> que;
  d[sy][sx][(1<<n)-1] = 0;
  que.push(PP(Pi(sx, sy), Pi((1<<n)-1, 0)));
  while(!que.empty()) {
    PP p = que.front(); que.pop();
    int x = p.F.F, y = p.F.S, vis = p.S.F, cost = p.S.S;
    if(vis == 0) return cost;
    rep(i, 4) {
      int nx = x + dx[i], ny = y + dy[i];
      int nvis = (isdigit(c[ny][nx]) ? vis & ~(1<<(c[ny][nx]-'0')) : vis);
      if(0 <= nx && nx < w && 0 <= ny && ny < h && c[ny][nx] != 'x' && d[ny][nx][nvis] == -1) {
	d[ny][nx][nvis] = d[y][x][vis] + 1;
	que.push(PP(Pi(nx, ny), Pi(nvis, d[ny][nx][nvis])));
      }
    }
  }
  return -1;
}

int main()
{
  while(cin >> w >> h, w) {
    int cnt = 0;
    rep(i, h) rep(j, w) {
      cin >> c[i][j];
      if(c[i][j] == '*') c[i][j] = cnt+'0', cnt++;
      if(c[i][j] == 'o') sx = j, sy = i;
    }
    cout << bfs(cnt) << endl;
  }

  return 0;
}

Measured memory_bytes: 5148
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int k = sc.nextInt();
        int x = sc.nextInt();
        String a = "";
        a = k * 500 >= x ? "Yes" : "No";

        System.out.println(a);

    }

}


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

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

    int ans = 0;
    rep(i, S.size()-1) {
        if (S[i] == S[i+1]) ans++;
    }

    int num = 0;
    rep(i, S.size()-1) {
        if (S[i] == 'R' and S[i+1] == 'L') num++;
    }

    if (S[0] == S[N-1]) {
        cout << ans + min(K, num) * 2 << endl;
    }
    else {
        if (S[0] == 'R') num--;
        if (K > num) ans++;
        num = max(num, 0);
        cout << ans + min(K, num) * 2 << endl;
    }


}


Measured memory_bytes: 512
var fs = require('fs')
var contents = fs.readFileSync('/dev/stdin', 'utf-8');

var watch = function(str) {
    var n = parseInt(str); 
    var h = Math.floor(n / 3600); 
    var m = Math.floor((n - 3600 * h) / 60); 
    var s = n % 60; 

return h + ":" + m + ":" + s ; 

}

console.log(watch(contents)); 

Measured memory_bytes: 15640
fun main(args: Array<String>) {
    a63(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

fun a63(args: Array<String>) {
    if (args.size != 1) {
        throw IllegalArgumentException()
    }
    val total = args[0].split(" ").map { it.toInt() }.sum()
    println(if (total >= 10) "error" else total.toString())
}

Measured memory_bytes: 38300
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;
list<long long int> Prime(int M) {
	list<long long int>P;
	P.push_back(2);
	P.push_back(3);
	for (int i = 5; i <= M; i += 6) {
		bool flag = true;
		for (auto j : P) {
			if (i%j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i);
		flag = true;
		for (auto j : P) {
			if ((i + 2) % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i + 2);
	}
	return P;
}


long long int N;
long long int ans;
long long int H, W;
long long int K;

long long int num[100001];
long long int A, B;

int main() {
	ios::sync_with_stdio(false);
	cin >> N;
	cin >> A >> B;
	for (int i = 0; i < N; i++)cin >> num[i];
	stable_sort(num, num + N);
	long long int l = 0;
	long long int r = 1000000000;
	while (r - l > 1) {
		long long int mid = (l + r) / 2;
		long long int box = 0;
		for (int i = 0; i < N; i++) {
			box += max((long long int)0,(num[i] - B*mid) / (A - B));
			if (((num[i] - B*mid) % (A - B)) && num[i] - B*mid > 0)box++;
		}
		if (box > mid)l = mid;
		else r = mid;
	}
	long long int box = 0;
	for (int i = 0; i < N; i++) {
		box += max((long long int)0,(num[i] - B*l) / (A - B));
		if (((num[i] - B*l) % (A - B))&&num[i]-B*l>0)box++;
	}
	if (box > l)cout << r << endl;
	else cout << l << endl;
	return 0;
}

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

using namespace std;

int main(){
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << a[k-1] << endl;
  return 0;
}


Measured memory_bytes: 764
#include<stdio.h>
#include<iostream>
using namespace std;
int gcd(int x, int y){
  if(x<y){
    int tmp;
    tmp = x;
    x = y;
    y= tmp;
  }
  int r;
  r= x%y;
  while(r!=0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}
int main(){
  int x,y;
  cin >> x >>y;
  cout << gcd(x,y) <<endl;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
 
 
#define mod(cans) cans%10**9+7
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(unsigned i=0;i<n;i++)
#define repr(i,n) for(unsigned i=n-1;i>=0;i--)
#define rep1(i,n) for(unsigned i=1;i<=n;i++)
#define cin_pl(n,x) rep(i,n){cin>>x[i];}
#define cins(s,n) rep(i,n)cin>>s.at[i];
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define prians(Answer) cout<<Answer<<"\n"
#define TF(X) X==1?cout<<"YES\n":cout<<"NO\n"
#define elcon else{continue;}
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int> > matrix;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef greater<int> gi;
typedef vector<unsigned> vu;


ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
bool is_prime(const unsigned n){
    switch(n){
        case 0:
        case 1: return false;
        case 2: return true;
    }
 
 
    for(unsigned i=2;i<n;++i){
        if(n%i == 0) return false;
    }
 
    return true;
}


bool F(string s,string t,string u)
{
    if(s[s.length()-1]==t[0]&&t[t.length()-1]==u[0])return true;
    return false;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t,u;cin>>s>>t>>u;
    TF(F(s,t,u));
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

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

    long long n,w=0,r=0,m;
    cin>>n;
    string s;
    cin>>s;
    for(long long i=0; i<n; i++)
    {
        if(s[i]=='R')
        {
            r++;
        }
        else
            w++;
    }
    for(long long i=0; i<n-w; i++)
    {
        if(s[i]=='R')
        {
            r--;
        }
    }
    cout<<r<<endl;
    return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int mod = 1e9+7;
ll gcd(ll a,ll b){
    if(b==0)
    return a;return gcd(b,a%b);
}
ll expo(ll base,ll pow){
    ll ans = 1;
    while(pow!=0){
        if(pow&1==1){
            ans = ans*base;
            ans = ans%mod;
        }
        base *= base;base%=mod;
        pow/=2;
    }return ans;
}
ll inv(ll x){
    return expo(x,mod-2);
}

const int M = 2e5 + 5;

int arr[100];

int main(){


    int n, m;

    cin >> n >> m;

    memset(arr , -1 , sizeof(arr));

    for(int i = 1 ; i <= m ; i++){
        int pos, dig;
        si(pos); si(dig);

        if(pos > n){
            cout<<"-1";
            return 0;
        }

        if(arr[pos] == -1 || arr[pos] == dig){
            arr[pos] = dig;
        }
        else{
            cout<<"-1";
            return 0;
        }

        if(n > 1 && pos == 1 && dig == 0){
            cout<<"-1";
            return 0;
        }
    }

    for(int i = 1 ; i <= n ; i++){
        if(arr[i] == -1){
            if(i == 1){
                if(n == 1){
                    arr[i] = 0;
                }
                else{
                    arr[i] = 1;
                }
            }
            else{
                arr[i] = 0;
            }
        }
        cout<<arr[i];
    }


}



Measured memory_bytes: 256
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a*b//gcd(a, b)


N = int(input())
T = [int(input()) for i in range(N)]

T.sort(reverse=True)
ans = 1
for i in T:
    ans = lcm(ans, i)
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const ll INF = LLONG_MAX/3;
const int W = 20010;

int main(){
    int n;
    cin >>n;
    vector<int> w(n),s(n),v(n);
    rep(i,n) cin >>w[i] >>s[i] >>v[i];

    vector<pair<int,int>> o(n);
    rep(i,n) o[i] = {s[i]+w[i], i};
    sort(all(o));

    vector<ll> dp(W,-INF);
    dp[0] = 0;
    rep(oidx,n){
        int idx = o[oidx].se;

        vector<ll> nx(dp);
        rep(i,W)if(dp[i] > -INF){
            int ni = i+w[idx];
            if(s[idx]<i || ni>=W) break;
            nx[ni] = max(nx[ni], dp[i]+v[idx]);
        }
        swap(dp,nx);
    }

    ll ans = 0;
    rep(i,W) ans = max(ans, dp[i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let d: i32 = read(&mut stdin_lock, &mut buf, b' ');
    let x: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let mut av = vec![0; n];
    for i in 0..n {
        av[i] = read(&mut stdin_lock, &mut buf, b'\n');
    }

    let mut ans = x;
    for a in av.iter() {
        ans += (d - 1) / a + 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
N = int(input())
S = str(input())

cnt = 0

for i in range(0, 1000):
    pin = str(i).zfill(3)

    head = S.find(pin[0])
    middle = S.find(pin[1], head + 1)
    tail = S.find(pin[2], middle + 1)

    if head != -1 and middle != -1 and tail != -1:
        cnt += 1

print(cnt)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define lowbit(i) ((i)&(-i))
#define ls (p << 1)
#define rs (p << 1 | 1)
using namespace std;

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

const double pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int MAXN = 2 * 1e5 + 15;
int n, k;
int len[MAXN];
bool check(int x) {
    int cnt = 0;
    for(int i = 1; i <= n; i++) {
        cnt += len[i] / x - 1 + (len[i] % x ? 1 : 0);
        if(cnt > k) return false;
    }
    return true;
}
int main() {
#ifdef CitricAcid
    freopen ("input.txt", "rt", stdin);
#endif

    int l = 1, r = 0;
    scanf("%d %d", &n, &k);
    for(int i = 1; i <= n; i++) {
        scanf("%d", &len[i]);
        r = max(r, len[i]);
    }
    int res;
    while(l <= r) {
        int mid = (l + r) / 2;
        if(check(mid)) {
            res = mid;
            r = mid - 1;
        }
        else l = mid + 1;
    }
    printf("%d\n", res);

#ifdef CitricAcid
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}
/*
# author : CitricAcid
# date : 2020/08/03
*/

Measured memory_bytes: 4512
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

using ll = long long int;

int main(void) {
  int a, b;
  cin>>a>>b;
  if(b%a==0)
    std::cout << a+b << std::endl;
  else
    std::cout << b-a << std::endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
int main() {
	int n;
	cin >> n;
	for(int i=0; i<n; i++)
	{
		string s;
		cin >> s;
		mp[s]++;
	}
	
	int maxx = 0;
	for(auto it = mp.begin(); it!=mp.end(); it++)
	{
		maxx = max(maxx, it->second);
	}
	for(auto it = mp.begin(); it!=mp.end(); it++)
	{
		if(it->second == maxx)
		{
			cout << it->first << endl;
		}
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 25216
H, W = map(int, input().split())
s = ['.' * (W + 2)] + ['.'+input()+'.' for _ in range(H)] + ['.' * (W + 2)]
for i in range(H):
    for j in range(W):
        if s[i][j] == '#' and '#' not in [s[i + 1][j], s[i][j + 1], s[i - 1][j], s[i][j - 1]]:
            print('No')
            exit()
print('Yes')


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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N, M;
    cin >> N >> M;
    vector<tuple<int, int, int>> v(M);
    REP(i, M) {
        int p, y;
        cin >> p >> y;
        v[i] = make_tuple(i, p, y);
    }
    sort(ALL(v), [](auto x, auto y){return get<1>(x) != get<1>(y) ? get<1>(x) < get<1>(y) : get<2>(x) < get<2>(y);});
    map<int, int> dic;
    REP(i, M) {
        dic[get<1>(v[i])] += 1;
        v[i] = make_tuple(get<0>(v[i]), get<1>(v[i]), dic[get<1>(v[i])]);
    }
    sort(ALL(v), [](auto x, auto y){return get<0>(x) < get<0>(y);});
    REP(i, M) {
        printf("%06d", get<1>(v[i]));
        printf("%06d\n", get<2>(v[i]));
    }
    return 0;
}



Measured memory_bytes: 7296
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;


#define REP(i,n) for(int i=0;i<(int)n;i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()


double EPS = 1e-10;

double add(double a, double b){
	if(abs(a+b) < EPS * (abs(a) + abs(b))) return 0;
	return a+b;
}

struct P{
	double x,y;
	P(){}
	P(double x, double y) : x(x), y(y){
	}
	P operator +(P p){
		return P(add(x,p.x), add(y,p.y));
	}
	P operator -(P p){
		return P(add(x,-p.x), add(y,-p.y));
	}
	P operator *(double d){
		return P(d*x, d*y);
	}
	double dot (P p){
		return add(x*p.x, y*p.y);
	}
	double det (P p){
		return add(x*p.y, -y*p.x);
	}
	void print (){
		printf("%.10lf %.10lf \n",x,y);
		return;
	}
};

P crossPoint(P p0, P p1, P p2, P p3){
	P q0 = p1-p0;
	P q1 = p3-p2;
	P r = p0 + (p1-p0)*((p3-p2).det(p2-p0)/(p3-p2).det(p1-p0));
	return r;
}

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

	REP(i, q){
		P p0, p1, p2, p3;
		cin >> p0.x >> p0.y >>p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y ;
		crossPoint(p0, p1, p2, p3).print();
	}
	return 0;
}

Measured memory_bytes: 1248
n = int(input())
calc_r = [0]*(n+1)
calc_r[0] = 2
calc_r[1] = 1

for i in range(2,n+1):
    calc_r[i] = calc_r[i-1] + calc_r[i-2]
ans = calc_r[n]
print(ans)

Measured memory_bytes: 9012
#include<iostream>
#include<string>
#include<queue>
#include<map>
#include<utility>

using namespace std;

int main(){
    int d[] = {-1,1,-4,4}; //右、左、上、下

    map<string,int> ans;
    ans["01234567"];

    queue< pair<int,string> > que;
    que.push(make_pair(0,"01234567"));

    while(!que.empty()){

        pair<int,string> p(que.front());
        que.pop();

        int k(ans[p.second]);

        for(int i=0;i<4;i++){

            int n(p.first+d[i]);

            if(i==0 && n==3) continue;
            if(i==1 && n==4) continue;

            if(n>=0 && n<8){
                string tmp(p.second);
                tmp[p.first] = tmp[n];
                tmp[n] = '0';

                if(ans.find(tmp) == ans.end()){
                    ans[tmp] = k+1;
                    que.push( make_pair(n, tmp) );
                }
            }
        }
    }

    string s;
    char t;
    while(cin >> t){
        s += t;

        for(int i=0;i<7;i++){
            cin >> t;
            s += t;
        }
        cout << ans[s] << endl;
        s = "";
    }

    return 0;
}


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

using namespace std;

int main() {
    int n, k;
    cin>>n>>k;
    vector<int> h(n, 0);
    for(int& x:h) 
        cin>>x;
    
    vector<int>dp(n, INT_MAX);

    dp[0] = 0;
    for(int i = 0; i < n; i++ ) {
        for(int j = i+1; j <= i+k; j++) {
            if(j < n) {
                dp[j] = min(dp[j], dp[i] + abs(h[j]-h[i]));
            }
        }
    }
    cout<<dp[n-1]<<endl;

}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        // 白く塗る キーは実際の座標より-1
        int[][] WH = new int[W][H];
        for (int i = 0; i < W; ++i) {
            for (int j = 0; j < H; ++j) {
                WH[i][j] = 1;
            }
        }
        // 黒く塗る キーは実際の座標より-1
        int N = sc.nextInt();
        int[][] XY = new int[N][N];
        for (int i = 0; i < N; ++i) {
            int X = sc.nextInt();
            int Y = sc.nextInt();
            int A = sc.nextInt();
            switch (A) {
            case 1:
                for (int j = 0; j < X; ++j) {
                    for (int k = 0; k < H; ++k) {
                        WH[j][k] = 0;
                    }
                }
                break;
            case 2:
                for (int j = X; j < W; ++j) {
                    for (int k = 0; k < H; ++k) {
                        WH[j][k] = 0;
                    }
                }
                break;
            case 3:
                for (int j = 0; j < W; ++j) {
                    for (int k = 0; k < Y; ++k) {
                        WH[j][k] = 0;
                    }
                }
                break;
            case 4:
                for (int j = 0; j < W; ++j) {
                    for (int k = Y; k < H; ++k) {
                        WH[j][k] = 0;
                    }
                }
                break;
            default:
                break;
            }
        }
        sc.close();

        int ans = 0;
        for (int[] ary : WH) {
            for (int white : ary) {
                ans += white;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23152
def main():
    n=int(input())
    s=input()
    d1=dict()
    d2=dict()
    temp1=[None]*n
    temp2=[None]*n
    for ii in range(2**n):
        i=("0"*n+bin(ii)[2:])[-n:]
        cnt1=0
        cnt2=n-1
        for k,j in enumerate(i):
            if j=="1":
                temp1[cnt1]=s[k]
                temp2[cnt1]=s[2*n-k-1]
                cnt1+=1
            else:
                temp1[cnt2]=s[k]
                temp2[cnt2]=s[2*n-k-1]
                cnt2-=1
        t1="".join(temp1)
        t2="".join(temp2)
        if (t1,cnt1) not in d1.keys():
            d1[(t1,cnt1)]=1
        else:
            d1[(t1,cnt1)]+=1
        if (t2,cnt1) not in d2.keys():
            d2[(t2,cnt1)]=1
        else:
            d2[(t2,cnt1)]+=1
    ans=0
    for i,j in d1.items():
        if i in d2.keys():
            ans+=j*d2[i]
    print(ans)
main()

Measured memory_bytes: 98628
import java.util.Scanner;

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

        int h = sc.nextInt();
        int w = sc.nextInt();

        int[][] a = new int[h+2][w+2];
        int[][] rA = new int[][]{
                {-1, 0}, {-1, 1}, {-1, -1}, {0, 1},
                {0, -1}, {1, 0}, {1, 1}, {1, -1}
        };

        for (int i = 1; i < h+1; i++) {
            String s = sc.next();
            for (int j = 1; j < w+1; j++) {
                char c = s.charAt(j-1);
                if (c == '#') {
                    a[i][j] = -100;
                    for (int[] r : rA)
                        a[i+r[0]][j+r[1]]++;
                }
            }
        }
        
        for (int i = 1; i < h+1; i++) {
            for (int j = 1; j < w+1; j++) {
                if (a[i][j] < 0)
                    System.out.print('#');
                else
                    System.out.print(a[i][j]);
            }
            System.out.println();
        }
    }
}


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

int main(){
    int n,d;
    cin>>n>>d;
    int a[2][n];
    rep(i,n){
        cin>>a[0][i]>>a[1][i];
    }
    double x;
    int ans=0;
    rep(i,n){
            x=pow(pow(a[0][i],2)+pow(a[1][i],2),0.5);
            if(x<=d)ans++;
    }
    cout<<ans<<endl;
}

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

public class Program
{
    public static void Main(string[] args)
    {
        string ans = "YES";
        int n = int.Parse(Console.ReadLine());
        string[] inputs = Console.ReadLine().Split(' ');
        List<string> lis = new List<string>();
        foreach(string input in inputs)
        {
            lis.Add(input);
        }
        if(lis.Distinct().Count() != lis.Count())
        {
            ans = "NO";
        }

        //出力
        Console.WriteLine(ans);
    }
}


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

int main(){
    int n;
    cin >>n;
    for (int i = 0; i < 50000; i++)
    {
        if ((i * 108)/100 == n)
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<functional>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	long long a,b,c,d,cc,dd,mm,ss,ama,x,y,sum,s2;
	scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
	ss=b-(a-1);
	cc=(b/c)-((a-1)/c);
	dd=(b/d)-((a-1)/d);
	x=c;	y=d;
	if(x<y)	swap(x,y);
	while(1)	{
		ama=x%y;
		if(ama==0)	break;
		x=y;	y=ama;
	}
	s2=c/y*d;
//	printf("%lld\n",s2);
	mm=(b/s2)-((a-1)/s2);
//	printf("%lld %lld %lld %lld\n",ss,cc,dd,mm);
	sum=ss-cc-dd+mm;
	printf("%lld\n",sum);
    return 0;
}

Measured memory_bytes: 128
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Bingo
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int M = 3;

/* typedef */

typedef long long ll;
typedef vector<int> vi;
typedef queue<int> qi;
typedef pair<int,int> pii;

/* global variables */

int as[M][M];
bool fs[M][M];

/* subroutines */

/* main */

int main() {
  for (int y = 0; y < M; y++)
    for (int x = 0; x < M; x++) scanf("%d", &as[y][x]);

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

  while (n--) {
    int b;
    scanf("%d", &b);

    for (int y = 0; y < M; y++)
      for (int x = 0; x < M; x++)
	if (b == as[y][x]) fs[y][x] = true;
  }

  if ((fs[0][0] && fs[0][1] && fs[0][2]) ||
      (fs[1][0] && fs[1][1] && fs[1][2]) ||
      (fs[2][0] && fs[2][1] && fs[2][2]) ||
      (fs[0][0] && fs[1][0] && fs[2][0]) ||
      (fs[0][1] && fs[1][1] && fs[2][1]) ||
      (fs[0][2] && fs[1][2] && fs[2][2]) ||
      (fs[0][0] && fs[1][1] && fs[2][2]) ||
      (fs[0][2] && fs[1][1] && fs[2][0]))
    puts("Yes");
  else
    puts("No");
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		String S = sc.next();
		String P = sc.next();

		if ((S + S).contains(P)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 26208
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int INF = 0x7fffffff;
const int tINF = INF>>2;
const ll LINF = 0x7fffffffffffffff;
const ll tLINF = LINF>>2;
const int maxn = 1e5;
const int modn = 1e9+7;

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

	ll r,d,x;
	cin>>r>>d>>x;
	int t=10;
	while (t--){
        x=r*x-d;
        cout<<x<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
long long a[100010];
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%lld",&a[i]);
int zero=0;

for(int i=0;i<n;i++)if(a[i]==0)zero++;
if(zero >0){
// a[i] contains 0
printf("0\n");
return 0;
}
long long prod=1;
for(int i=0;i<n;i++){
if(a[i] <=1000000000000000000/prod){
// This condition is equivalent to prod*a[i]<=10ˆ18
prod*=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod);
}

Measured memory_bytes: 2508
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
#include<iomanip>
namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
using lll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
template <typename T>
T gcd(T m, T n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
        // r %= 1000000007;
        // rr %= 1000000007;
    }
    r /= rr;
    // r %= 1000000007;
    return r;
}
int main(){
  ll N,R;
  cin>>N>>R;
  if(N>=10){
    cout<<R<<endl;
  }else{
    FOR(i,100000){
      ll r = i - 100*(10-N);
      if(r==R){
        cout<<i<<endl;
        break;
      }
    }
  }
  return 0;
}

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

using namespace std;

#define reps(i, j, n) for(int i = j; i < (int)n; i++)
#define rep(i, n) reps(i, 0, n)

using int64 = long long;
const int64 INF = 1LL << 62;

int main()
{
  int N, K, X[50], Y[50];

  cin >> N >> K;
  rep(i, N) {
    cin >> X[i] >> Y[i];
  }

  int64 ret = INF;
  rep(i, N) {
    rep(j, N) {
      rep(k, N) {
        rep(l, N) {
          int inner = 0;
          rep(m, N) inner += X[i] <= X[m] && X[m] <= X[j] && Y[k] <= Y[m] && Y[m] <= Y[l];
          if(inner >= K) ret = min(ret, 1LL * (X[j] - X[i]) * (Y[l] - Y[k]));
        }
      }
    }
  }

  cout << ret << endl;
}



Measured memory_bytes: 256
#include<stdio.h>

long int kotae=0;

int check(long int);
int saiki(long int,long int);

int main(void){
  long int i,n;
  scanf("%ld",&n);
  saiki(0,n);
  printf("%ld",kotae);
  return 0;
}

int check(long int n){
  int a=0,b=0,c=0;
  for(;n>0;n=n/10){
    switch(n%10){
      case 3:
        a++;
        break;
      case 5:
        b++;
        break;
      case 7:
        c++;
        break;
    }
  }
  if(a*b*c==0){
    return 0;
  }else{
    return 1;
  }
}

int saiki(long int n,long int max){
  if(n<=max){
    kotae+=check(n);
    saiki(10*n+3,max);
    saiki(10*n+5,max);
    saiki(10*n+7,max);
  }
}


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

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector < int >A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	double ans = 0;
	for (int i = 0; i < N; i++) {
		ans += 1.0 / (double)A[i];
	}

	printf("%.10f\n", 1.0 / ans);
	return 0;
}


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

int main() {
  int N, A;
  cin >> N >> A;
  
  if (N%500 == 0) cout << "Yes" << endl;
  else if (N/500 > 0) {
    if (N - N/500 *500 < A) cout << "Yes" << endl;
    else cout << "No" << endl;
  } 
  else {
    if(N < A) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


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


int main(){
    long long n;
    cin >> n;
    int ans=0;
    for(long long i=2;i*i<=n;i++){
        int cnt = 0;
        if(n%i!=0) continue;
        while(n%i==0){
            n/=i;
            cnt++;
        }
        ans += (-1+(sqrt(1+8*cnt)))/2;
    }
    if(n!=1) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3604
//#include<iostream>
//#include<algorithm>
//#include<string>
//#include <cmath>
//#include <vector>
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define REP(x,n) for(int x=0;x<n;x++)

// vector 操作  vector<int> data(10,5) 5が10個　data(10) 要素数10
// v.size(), v.empty(), v.insert(itr,値), v.erase(itr) (first,last),
// sort(itr), find(all(x),値),reverse(itr),accumulate(itr,0) 積算,
//v.swap
// stringも同じ itrがただの数字になる
// s.substr(n,m)n番目以降m文字取り出す　erase(n,m)も  s.find
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

// map 操作  map<string,int> mp キー=string 値=int型  pair< , >型
// 代入:mp["abc"]=123  mp.erase(キー)
// itr = mp.begin()のとき　itr->first = key, itr->second = val
// mp.find(key) itrを返す
typedef pair<int,int> P;  //q(p.first,p.second)で定義できる？

// lcm( , ) gcd( , ) 最大公約数　最小公倍数
//if(cin.eof()) break; 入力数が決まってないとき
//ifstream  while(ifs>>data)
int main (){
    ll int n;
    cin >> n;

    vector<ll int> v(0);
    ll int a;
    REP(i,n){
        cin >> a;
        v.pb(a);
    }
    sort(all(v));
    string ans = "YES";
    REP(i,n-1){
        if(v[i]==v[i+1]) {
            ans = "NO";
            break;
    }
    }
    cout << ans;
}

Measured memory_bytes: 2420