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

/**
 * Created on 2017/10/25 7:15.
 */
public class Main {
    public static void main(String[] args) throws IOException {
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);

        while (sc.hasNextInt()) {
            int N = sc.nextInt();
            int M = sc.nextInt();
            int R = sc.nextInt();
            int[] r = new int[R];
            int[][] t = new int[N][N];
            for (int i = 0; i < R; i++) {
                r[i] = sc.nextInt() - 1;
            }
            for (int i = 0; i < N; i++) {
                Arrays.fill(t[i], 999999999);
            }
            for (int i = 0; i < M; i++) {
                int A = sc.nextInt() - 1;
                int B = sc.nextInt() - 1;
                int C = sc.nextInt();
                t[A][B] = t[B][A] = C;
            }
            for (int k = 0; k < N; k++) {
                for (int i = 0; i < N; i++) {
                    for (int j = 0; j < N; j++) {
                        t[i][j] = Math.min(t[i][j], t[i][k] + t[k][j]);
                    }
                }
            }
            System.out.println(calcMinDist(0, new int[R], new boolean[R], r, t));
        }
    }

    private static int calcMinDist(int size, int[] perm, boolean[] used, int[] r, int[][] t) {
        if (size == r.length) {
            int res = 0;
            for (int i = 0; i < r.length - 1; i++) {
                int from = perm[i];
                int to = perm[i + 1];
                res += t[from][to];
            }
            return res;
        }

        int res = Integer.MAX_VALUE;
        for (int i = 0; i < r.length; i++) {
            if (used[i]) {
                continue;
            }
            perm[size] = r[i];
            used[i] = true;
            res = Math.min(res, calcMinDist(size + 1, perm, used, r, t));
            used[i] = false;
        }
        return res;
    }
}


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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;

  vector<int> p(n);
  for ( int i = 0; i < n; i++ ) {
    cin >> p[i];
  }

  int cnt = 0;
  for ( int i = 1; i < n-1; i++ ) {
    vector<int> v = {p[i-1], p[i], p[i+1]};
    sort(v.begin(), v.end());
    if ( v[1] == p[i] ) cnt++;
  }

  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

k, s = na()
ct = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)











Measured memory_bytes: 42108
#include<bits/stdc++.h>
using namespace std;
const int maxn=2000;
int n,t;long long d;
long long a[maxn];
char str[maxn];
long long base[100];
int main()
{
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		bool f=1;d=0;
		memset(base,0,sizeof(base));
		for(int i=0;i<n;i++) {
			scanf("%lld",&a[i]);while((1ll<<d)<=a[i]) ++d;}
		scanf("%s",str);
		for(int i=n-1;i>=0;i--)
		{
			if(str[i]=='0') {
				for(long long j=d;j>=0;j--)
					if(a[i]&(1ll<<j)) {
						if(base[j]>0) a[i]^=base[j];
						else {base[j]=a[i];break;}
					}
			}
			else 
			{
				for(long long j=d;j>=0;j--)
					if(a[i]&(1ll<<j)) {
						if(base[j]>0) a[i]^=base[j];
						else f=0;
					}
			}
			
		}
		if(f==0) printf("1\n");
		else  printf("0\n");
	}
	return 0;
}

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

int main() {
  int n;
  int a,w,t,r;
  cin >> n;
  string str[n];
  a = 0;
  w = 0;
  t = 0;
  r = 0;

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


  for(int i = 0; i < n; i++){
    if(str[i] == "AC"){
        a++;
    }else if(str[i] == "WA"){
        w++;
    }else if(str[i] == "TLE"){
        t++;
    }else if(str[i] == "RE"){
        r++;
    }
  }

  cout << "AC " << "x " << a << endl;
  cout << "WA " << "x " << w << endl;
  cout << "TLE " <<  "x " << t << endl;
  cout << "RE " << "x " << r << endl;
}

Measured memory_bytes: 6732
from math import sqrt
from itertools import product

import numpy as np

def judge(D):
  n = 1
  while D%4==0:
    n *= 2
    D //= 4

  def h1(x,y):
    return ~(x//n+y//n)%2
  def h2(x,y):
    return ~(x//n)%2

  return h1 if D%2==1 else h2

N,D1,D2 = map(int,input().split())
j1,j2 = judge(D1),judge(D2)
cnt = 0
for x,y in product(range(N*2),repeat=2):
  if j1(x,y) and j2(x,y):
    print(x,y)
    cnt += 1
    if cnt >= N*N:
      break


Measured memory_bytes: 21424
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL N; cin >> N;
		UL n = 0, ex = 0;
		UL buf = 0;
		rep(i, N) {
			n++;
			buf += n;
			if (buf >= N) break;
		}
		ex = buf - N;
		rep(i, n) {
			if (ex == i + 1) continue;
			cout << (i + 1) << endl;
		}
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P pair<int,int>
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

signed main(){
  cout << fixed << setprecision(20);
  static const double pi = 3.141592653589793;
  int a,b,h,m;
  cin >> a >> b >> h >> m;
  double minute = 6*m;
  double hour = 30*h + 0.5*m;
  double dist = abs(minute-hour);
  double ans = a*a + b*b - 2*a*b*cos(dist*pi/180);
  cout << sqrt(ans) << endl;
}

Measured memory_bytes: 4256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
int main(){
    int n;
    int toint[256];
    for(int i = 0; i < 10; i++){
        toint[i + '0'] = i;
    }
    for(int i = 0; i < 26; i++){
        toint[i + 'A'] = 10 + i;
    }
    for(int i = 0; i < 26; i++){
        toint[i + 'a'] = 36 + i;
    }
    scanf("%d", &n);
    int sum = 0;
    for(int i = 0; i < n; i++){
        int x = 0;
        int p;
        char m[100];
        scanf("%d %s", &p, m);
        for(int idx = 0; m[idx]; idx++){
            x = x * p + toint[m[idx]];
        }
        sum = sum ^ x;
    }
    if(sum == 0){
        cout << "lose" << endl;
    }else{
        cout << "win" << endl;
    }
    return 0;
}

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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    // 入力
    int n, m;
    cin >> n >> m;
    char ary[n][m] = {};
    rep(i, n) {
        rep(j, m) { cin >> ary[i][j]; }
    }
    // 処理
    // 出力
    rep(i, m + 2) { cout << '#'; }
    cout << endl;
    rep(i, n) {
        cout << '#';
        rep(j, m) { cout << ary[i][j]; }
        cout << '#' << endl;
    }
    rep(i, m + 2) { cout << '#'; }

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
class Main {
    static long ans=0;
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // StringTokenizer st = new StringTokenizer(br.readLine());
        String s = br.readLine();
        dfs(0,0,s);
        System.out.println(ans);
    }   

    public static void dfs(long sum, int idx, String s){
        if(idx==s.length()){
            ans+=sum;
            return;
        }
        for(int i=idx+1; i<=s.length(); i++){
            dfs(sum+Long.parseLong(s.substring(idx,i)), i, s);
        }
        return;

    }


    // public static long recurse(String s){
    //     if(s.length()==0)
    //         return 0;
    //     long ans=0;
    //     for(int i=1; i<=s.length(); i++){
    //         long cur = Long.parseLong(s.substring(0,i));
    //         cur+=cur*(Math.max(s.length()-i-1,0));
    //         cur+=recurse(s.substring(i,s.length()));;
    //         ans += cur;
    //     }
    //     return ans;    
    // }

}


Measured memory_bytes: 21844
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;

int 
g[2100][2100],
mat[2100][2100],
tate[2100][2100],
yoko[2100][2100];

main(){
    int n=in(),m=in(),q=in();
    rep2(i,1,n){
        rep2(j,1,m){
            char c;
            cin>>c;
            g[i][j]=(c-'0');
            mat[i][j]=g[i][j]+mat[i-1][j]+mat[i][j-1]-mat[i-1][j-1];
        }
    }
    //rep2(i,1,n){rep2(j,1,m)cout<<mat[i][j];cout<<endl;}
    //cout<<endl;
    rep2(i,1,n){
        rep2(j,1,m){
            tate[i][j]=tate[i-1][j]+tate[i][j-1]-tate[i-1][j-1];
            yoko[i][j]=yoko[i-1][j]+yoko[i][j-1]-yoko[i-1][j-1];
            if(g[i][j]){
                if(g[i+1][j]){
                    tate[i][j]++;
                }
                if(g[i][j+1]){
                    yoko[i][j]++;
                }
            }
            //cout<<tate[i][j];
        }
        //cout<<endl;
    }
    //rep2(i,1,n){rep2(j,1,m)cout<<yoko[i][j];cout<<endl;}
    //cout<<endl;
    rep(iii,q){
        int a=in(),c=in(),b=in(),d=in();
        int ans=mat[b][d]-mat[a-1][d]-mat[b][c-1]+mat[a-1][c-1];
        ans-=(tate[b-1][d]-tate[a-1][d]-tate[b-1][c-1]+tate[a-1][c-1]);
        ans-=yoko[b][d-1]-yoko[a-1][d-1]-yoko[b][c-1]+yoko[a-1][c-1];
        /*cout<<mat[b][d]-mat[a-1][d]-mat[b][c-1]+mat[c-1][a-1]<<" "<<
        (tate[b-1][d]-tate[a-1][d]-tate[b-1][c-1]+tate[a-1][c-1])<<" "<<
        yoko[b][d-1]-yoko[a-1][d-1]-yoko[b][c-1]+yoko[a-1][c-1]<<" ";*/
        cout<<ans<<endl;
    }
}



Measured memory_bytes: 69888
Size = 3

A = [list(input().split()) for _ in range(Size)]
n = int(input())
b = [input() for _ in range(n)]

bingo = False
for row in A:
    if all(item in b for item in row):
        bingo = True
for col in zip(*A):
    if all(item in b for item in col):
        bingo = True
if all(A[i][i] in b for i in range(Size)):
    bingo = True
if all(A[i][Size - 1 - i] in b for i in range(Size)):
    bingo = True

print("Yes" if bingo else "No")


Measured memory_bytes: 3064
n , k = gets.split.map(&:to_i)

num = Hash.new(0)
# binding.pry
n.times do
  a , b = gets.split.map(&:to_i)
  num[a] += b
end
num2 = num.sort
pre = k
i = 0
# binding.pry
loop do
  if pre <= num2[i][1]
    puts num2[i][0]
    break
  else
    pre -= num2[i][1]
  end
  i += 1
end

Measured memory_bytes: 9992
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

//		long ans2 = 0;
		int ans = 0;

		Scanner sc = new Scanner(System.in);
		int  n = sc.nextInt();
		int  k = sc.nextInt();

//		int  k = sc.nextInt();
//		long d = sc.nextLong();

//		String string = sc.next();
//		StringBuilder s = new StringBuilder(string);

//		boolean f = true;
//
		int[] a = new int[n];
		int[] b = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
//		for (int i = 0; i < k; i++) {
//			b[i] = sc.nextInt();
//		}
//		for (int i = 1; i <n; i++) {
//			b[i] = sc.nextInt();
//		}
//		int[][] c = new int[h][w];
//		for (int i = 0; i < h; i++) {
//			for(int j = 0; j < w; j++) {
//				c[i][j] = 0;
//			}
//		}

//		int tmp_a = 0;
//		int tmp_b = 0;

		for(int i:a) {
			if(i>=k) {
				ans++;
			}
		}


		System.out.println(ans);

		sc.close();
	}
}

Measured memory_bytes: 60512
// #pragma GCC optimize(2)
// #pragma G++ optimize(2)
// #pragma comment(linker,"/STACK:102400000,102400000")

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

typedef long long int64;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef float fl;
typedef double dl;
typedef pair<int,int> pii;
#if (WIN32) || (WIN64) || (__WIN32) || (__WIN64) || (_WIN32) || (_WIN64) || (WINDOWS)
#define lld "%I64d"
#define llu "%I64u"
#else
#define lld "%lld"
#define llu "%llu"
#endif
#define uint(n) ((unsigned int)(n))
#define int64(n) ((long long)(n))
#define ull(n) ((unsigned long long)(n))
#define fl(n) ((float)(n))
#define dl(n) ((double)(n))
#define char(n) ((char)(n))
#define Bool(n) ((bool)(n))
#define fixpoint(n) fixed<<setprecision(n)

const int INF=1061109567;
const int NINF=-1044266559;
const int64 LINF=4557430888798830399;
const dl eps=1e-15;
#define MOD (1000000007)
#define PI (3.1415926535897932384626433832795028841971)

#define MP make_pair
#define MT make_tuple
#define All(a) (a).begin(),(a).end()
#define pall(a) (a).rbegin(),(a).rend()
#define Log(x,y) log(x)/log(y)
#define SZ(a) ((int)(a).size())
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define rep1(i,n) for(int i=1;i<=((int)(n));i++)
#define repd(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define repd1(i,n) for(int i=((int)(n));i>=1;i--)
#define repv(itr,v) for(__typeof((v).begin()) itr=(v).begin();itr!=(v).end();itr++)
#define repV(i,v) for(auto i:v)
#define repE(i,v) for(auto &i:v)
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x) MS(x,0)
#define MINF(x) MS(x,63)
#define MCP(x,y) memcpy(x,y,sizeof(y))
#define UN(v) sort(All(v)),v.erase(unique(All(v)),v.end())
#define filein(x) freopen(x,"r",stdin)
#define fileout(x) freopen(x,"w",stdout)
#define fileio(x)\
	freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout)
#define filein2(filename,name) ifstream name(filename,ios::in)
#define fileout2(filename,name) ofstream name(filename,ios::out)
#define fileio2(filename,name) fstream name(filename,ios::in|ios::out)
#define sqr(x) ((x)*(x))
#define Pause system("pause")
#define Cls system("cls")
#define fs first
#define sc second
#define SF scanf
#define PF printf

const int maxn=200010;

int n,q,col[maxn],row[maxn],c,r;
int64 ans;

int main()
{
	SF("%d%d",&n,&q);

	c=r=n;
	for(int i=2;i<=n-1;i++) col[i]=row[i]=n;

	ans=1ll*(n-2)*(n-2);
	while(q--)
	{
		int op,x;SF("%d%d",&op,&x);

		if(op==1)
		{
			if(x<c)
			{
				for(int i=x;i<c;i++) row[i]=r;
				c=x;
			}

			ans-=row[x]-2;
		}
		else
		{
			if(x<r)
			{
				for(int i=x;i<r;i++) col[i]=c;
				r=x;
			}

			ans-=col[x]-2;
		}
	}

	PF("%lld",ans);

	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

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

    bool flag = 0;
    if (!(s[0] == 'A') || count(s.begin() + 2, s.end() - 1, 'C') != 1)
        flag = 1;
    rep(i, s.size())
    {
        if (s[i] == 'A' || s[i] == 'C')
            continue;
        if (!('a' <= s[i] && s[i] <= 'z'))
            flag = 1;
    }

    flag == 1 ? OP("WA") : OP("AC");
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <memory.h>
#include <cstring>
#include <vector>
#include <deque>
#include <cstdlib>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <functional>
#include <iostream>
#include <set>
#include <list>
#include <map>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef unsigned long long llu;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
const ll MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

priority_queue<int, vector<int>, greater<int> > pq;
vector<int> v;

int main() {
	int q;
	scanf("%d", &q);

	ll a, b;
	while (q--) {
		scanf("%lld %lld", &a, &b);

		if (a == b) {
			printf("%lld\n", (a - 1) * 2);
			continue;
		}
		else {
			ll sum = a * b;
			ll sq = sqrt(sum);

			if (sq * sq > sum) sq--;
			else if ((sq + 1) * (sq + 1) <= sum) sq++;

			if (sq * sq == sum) printf("%lld\n", (sq - 1) * 2 - 1);
			else if (sq * (sq + 1) >= sum) printf("%lld\n", (sq - 1) * 2);
			else printf("%lld\n", sq * 2 - 1);
		}
	}
}

Measured memory_bytes: 256
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
a = []
a[0] = inp.shift().split(' ').map(x => +x)
a[1] = inp.shift().split(' ').map(x => +x)
a[2] = inp.shift().split(' ').map(x => +x)
N = inp.shift() * 1
for (i=0; i<N; i++) {
    for(j=0;j<3;j++) {
        for(k=0;k<3;k++) {
            if (a[j][k] == inp[i]) {
                a[j][k] = 0
            }
        }
    }
}
b = false
for(j=0;j<3;j++) {
    c = true
    for(k=0;k<3;k++) {
        c = a[j][k] === 0 && c
    }
    if (c) {
        b = true
    }
}
for(j=0;j<3;j++) {
    c = true
    for(k=0;k<3;k++) {
        c = a[k][j] === 0 && c
    }
    if (c) {
        b = true
    }
}

if (a[0][0] === 0 && a[1][1] === 0 && a[2][2] === 0) {
    b = true
}

if (a[2][0] === 0 && a[1][1] === 0 && a[0][2] === 0) {
    b = true
}

console.log(b ? "Yes" : "No")

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

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

dishes = [A, B, C, D, E]

order_time = (sum([(dish - 1) // 10 + 1 for dish in dishes])) * 10
final_dish = min([(dish - 1) % 10 + 1 for dish in dishes]) - 10

ans = order_time + final_dish
print(ans)

Measured memory_bytes: 3064
parseInt(x) = parse(Int,x)

function main()
  N = parseInt(readline())
  v = map(parseInt,split(readline()))
  v = sort(v)
  c = (v[1]+v[2])/2
  for i = 3:N
    c = (c+v[i])/2
  end
  println(c)  
end

main()

Measured memory_bytes: 168716
n = int(input())
xlist = list(map(int, input().split()))

dist_min = 10 ** 6
for p in range(1, 100, 1):
    dist = 0
    for x in xlist:
        dist += (x - p) ** 2
    dist_min = min(dist_min, dist)

print(dist_min)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    int n,t,res=0;
    cin>>n>>t;
    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    sort(arr,arr+n);
    for(int i=0;i<t;i++)
        res+=arr[i];
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3644
h,w=gets.split.map &:to_i
d=$<.map{|l|l.chomp.chars}
a="Yes"
for p in 0...h
for q in 0...w
if  d[p][q]=="#"  &&  (p==h-1 || d[p+1][q]==".")  && d[p][q+1]=="."  && (p==0  || d[p-1][q]==".")  && (q==0 || d[p][q-1]==".")
a="No"
break
end
end
break if a=="No"
end
print a

Measured memory_bytes: 1916
#include<stdio.h>
#include<stdlib.h>
int max(int a,int b){if(a<b) return b; return a;}
int cmp(const void *a,const void *b){return *(int*)a-*(int*)b;}
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    int l[m],r[m];
    for(int i=0;i<m;i++)
        scanf("%d%d",&l[i],&r[i]);
    qsort(l,m,sizeof(int),cmp);
    qsort(r,m,sizeof(int),cmp);
    printf("%d\n",max(0,r[0]-l[m-1]+1));
    return 0;
}

Measured memory_bytes: 1396
a, b, c, d = [int(x) for x in input()]


def f(ans, i, shift, operand):
    if int(bin(i >> shift)[-1]):
        ans += operand
        ops.append('+')
    else:
        ans -= operand
        ops.append('-')
    return ans, ops


for i in range(8):
    ops = []
    ans = a
    ans, ops = f(ans, i, 2, b)
    ans, ops = f(ans, i, 1, c)
    ans, ops = f(ans, i, 0, d)
    if ans == 7:
        print(a, ops[0], b, ops[1], c, ops[2], d, '=7', sep='')
        break


Measured memory_bytes: 3064
s = gets.chomp.chars
t = gets.chomp.chars
h = {}
g = {}
s.size.times do |i|
  if h[s[i]]
    if h[s[i]].count(t[i]) == 0
      h[s[i]] << t[i]
    end
  else
    h[s[i]] = [t[i]]
  end
  if g[t[i]]
    if g[t[i]].count(s[i]) == 0
      g[t[i]] << s[i]
    end
  else
    g[t[i]] = [s[i]]
  end
end
puts h.flatten(-1) == g.invert.flatten(-1) ? 'Yes' : 'No'

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

int n, m, ans = 1;

int main() {
	cin >> n >> m;
	for(int i = 1; i * i <= m; ++i)
		if(!(m % i)) {
			if(m / i >= n) ans = max(ans, i);
			if(i >= n) ans = max(ans, m / i);
		}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "YES" : "NO"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s;
	bool ans=true;
	bool last = true;
	cin >>s;
	string res = "AKIHABARA";
	int ats    = 0;
	int att    = 0;
	while (att<res.size() and ats<s.size() and ans)
	{
	//	clog << s[ats] << " " << res[att] << endl;
		if(s[ats]==res[att]){
			ats++;
			att++;
		}else if(res[att]=='A'){
			att++;
		}else{
			ans = false;
		}
		
	}
	if(att<res.size() and res[att]=='A'){
		att++;
	}
	ans &= ((att == res.size()) and (ats == s.size()));
	cout<<solve(ans)<<endl;
}

Measured memory_bytes: 3600
N, K = list(map(int, input().split()))
point= list(map(int, input().split()))
T = list(input())
d = dict()
d['s'] = point[0]
d['p'] = point[1]
d['r'] = point[2]
res = 0
ans = []
flag = [0,0,0]

for i in range(K):
  res += d[T[i]]
  ans.append(T[i])
for i in range(K,N):
  if ans[i-K] == T[i]:
    ans.append("n")
  else:
    res += d[T[i]]
    ans.append(T[i])
print(res)

Measured memory_bytes: 83676
N=int(input())
A=list(map(int,input().split()))
B=[]

if N==2:
    print(A[1])
    print(A[0])
    exit(0)

for i in range(N):
    B.append(A[i])

B.sort()

for i in range(N):
    if A[i]<B[N//2]:
        print(B[N//2])
    else:
        print(B[N//2-1])

Measured memory_bytes: 25220
import java.util.Scanner;

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

        int n = sc.nextInt();
        int v = n;

        int z = v % 10;
        while (v >= 10) {
            v /= 10;
            z += v % 10;
        }

        System.out.print(n % z == 0 ? "Yes" : "No");
    }
}


Measured memory_bytes: 24916
q, n = map(int, input().split())
s = input()
lr = [[int(i) for i in input().split()] for i in range(n)]

# s = 'ACACTACG'
# lr = [
#     [3, 7],
#     [2, 3],
#     [1, 8],
# ]

wa = [0]

for index in range(1, len(s)):

    if s[index - 1] == 'A' and s[index] == 'C':
        wa.append(wa[index - 1] + 1)
    else:
        wa.append(wa[index - 1])

for row in lr:
    start = row[0] - 1
    end = row[1] - 1

    diff = wa[end] - wa[start]
    print(diff)


Measured memory_bytes: 24476
#include<iostream>
#include<stack>
#include<string>

using namespace std;
int main(){
  stack<int> s;
  string c;
  getline(cin,c);
  bool first=true;
  int num=0,a,b,i=0;
  while(i<(int)c.size()){
    if(c[i]=='+'){
      a=s.top();
      s.pop();
      b=s.top();
      s.pop();
      //cout << b+a << endl;
      s.push(b+a);
      i++;
      continue;
    }
    if(c[i]=='-'){
      a=s.top();
      s.pop();
      b=s.top();
      s.pop();
      //cout << b-a << endl;
      s.push(b-a);
      i++;
      continue;
    }
    if(c[i]=='*'){
      a=s.top();
      s.pop();
      b=s.top();
      s.pop();
      //cout << a*b << endl;
      s.push(a*b);
      i++;
      continue;
    }
    
    if(c[i]==' '){
      first=true;
      i++;
      continue;
    }
    if(first){
      s.push(c[i]-'0');
      first=false;
    }else{
      num=s.top()*10+(c[i]-'0');
      s.pop();
      s.push(num);
    }
    i++;
    

    
  }

  cout << s.top() << endl;  
  return 0;
}



Measured memory_bytes: 3204
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] c = new int[N];
    for (int i = 0; i < N; i++) {
      int A = sc.nextInt();
      
      c[A]++;
    }
    
    for (int i = N%2; i < N; i++) {
      if ((N%2 == 0 && i%2 == 0 && c[i] != 0)
         || (N%2 == 0 && i%2 == 1 && c[i] != 2)
         || (N%2 == 1 && i == 0 && c[i] != 1)
         || (N%2 == 1 && i%2 == 0 && c[i] != 2)
         || (N%2 == 1 && i%2 == 1 && c[i] != 0)) { {
          System.out.println(0);
          return;
        }
      }
    }
    int p = N/2;
    long ans = 1;
    while(p > 0) {
      ans = ans*2 % 1000000007;
      p--;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 49676
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <set>
#include <iostream>
#include <iomanip>
using namespace std;
typedef long long LL;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main(){
    int N;
    cin >> N;
    vector<int> D1(N), D2(N);

    REP(i, N){
        cin >> D1[i] >> D2[i];
    }

    REP(i, N-2){
        if(D1[i] == D2[i] && D1[i+1] == D2[i+1] && D1[i+2]==D2[i+2]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;

}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(){
	int x=-1,y=-1;
	while ((x!=10001)&&(y!=10001)){
		cin >> x >> y; 
		if ((x==0)&&(y==0)){
			break;
		}
		else if (x<=y){
			cout<<x<<' '<<y<<endl;
		}
		else{
			cout<<y<<' '<<x<<endl;
		}
	}
}


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

min_index = 0
for index, i in enumerate(A):
    if i == 1:
        min_index = index
        break

if min_index == 0:
    left = 0
else:
    left = int((min_index + K - 2) / (K - 1))
    if min_index % (K - 1):
        add = (K - 1) - int(min_index % (K - 1))
        min_index += add
if min_index >= N - 1:
    right = 0
else:
    right = int((N - min_index + K - 3) / (K - 1))
ans = left + right

print(ans)

Measured memory_bytes: 14008
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  int x, y;
  cin >> x >> y;
  int ans = INF;
  int tx = x;
  int ty = y;
  if (tx <= ty)
  {
    ans = min(ans, ty - tx);
  }
  ty = -1 * y;
  if (tx <= ty)
  {
    ans = min(ans, ty - tx + 1);
  }
  tx = -1 * x;
  ty = y;
  if (tx <= ty)
  {
    ans = min(ans, ty - tx + 1);
  }
  ty = -1 * y;
  if (tx <= ty)
  {
    ans = min(ans, ty - tx + 2);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int dp[100010][3];
int a[100010][3];

int main(){
    int n; cin >> n;
    for(int i=0;i<n;++i) cin >> a[i][0] >> a[i][1] >> a[i][2];
    for(int i=0;i<n;++i){
        for(int j=0;j<3;++j){
            dp[i][j] = -1;
        }
    }
    for(int i=0;i<3;++i) dp[0][i] = 0;
    for(int i=0;i<n;++i){
        for(int j=0;j<3;++j){
            for(int k=0;k<3;++k){
                if(k==j) continue;
                dp[i+1][j] = max(dp[i][k] + a[i][j],dp[i+1][j]);
            }
        }
    }
    int ans = dp[n][0];
    for(int i=1;i<3;++i) ans = max(ans,dp[n][i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define int long long
#define rng(i, l, r) for (size_t i = (l); i < (r); ++i)
#define rep(i, n) rng(i, 0, n)
#define gnr(i, l, r) for (size_t i = (r)-1; i >= (l); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()    //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend() //...,3,2,1

using namespace std;

const int INF = 1e18;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

void solve()
{

    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    int t[n];
    rep(i, n) cin >> t[i];

    int ans = 0;
    rep(i, n)
    {
        if (i == 0)
        {
            ans = t[i];
        }
        else
        {
            ans = ans / gcd(ans, t[i]) * t[i];
        }
    }

    cout << ans << endl;
}

signed main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <cstdio>

using namespace std;

int main() {
	
	int x, y, z = 1;

	cin >> x >> y;

	if (y > x)	swap(x, y);

	while(z){
		z = x % y;
		if (z != 0) {
			x = y;
			y = z;
		}
	}

	cout << y << endl;

	return 0;

}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int x,a,b;cin>>x>>a>>b;
    if (b-a<=x){
        if (b<=x){
            cout<<"delicious";
        }else cout<<"safe";
    }else cout<<"dangerous";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int n;
	double ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		double x;
		scanf("%lf",&x);
		x=1.0/x;
		ans+=x;
	}
	ans=1.0/ans;
	printf("%lf",ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll  long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N=2e5+10;
const int mod=1e9+7;
int a[N];
int f[N];
ll sum;
int main()
{
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    for(int i=1; i<=n; i++)
    {
        if(a[i]>=i)
        {
            cout<<-1<<endl;
            return 0;
        }
        else if(a[i]>a[i-1]+1)
        {
            cout<<-1<<endl;
            return 0;
        }
        if(a[i]<a[i-1]+1)
        {
            sum+=a[i];
        }
        else if(a[i]==a[i-1]+1)
        {
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 4428
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int n,m;
    cin >> n >> m;
    int ans = min(n,m/2);
    n-=ans;
    m-=ans*2;
    ans += m/4;
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

if __name__ == '__main__':

    a = input().split(' ')
    b = []
    for i in a:
        if i == '+':
            tmp = b.pop(-1) + b.pop(-1)
            b.append(tmp)
        elif i == '-':
            p = b.pop(-1)
            tmp = b.pop(-1) - p
            b.append(tmp)
        elif i == '*':
            tmp = b.pop(-1) * b.pop(-1)
            b.append(tmp)
        else:
            b.append( int(i) )
    print(b[0])

Measured memory_bytes: 7660
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for(int i=0; i<(int)c; i++)
int main() {
	long long x;
	cin >>x;
	int ans=0;
	long long t=100;
	while(t<x){
		t*=1.01;
		ans++;
	}
	cout <<ans<<endl;
	return 0;
}


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

int main(){
    long long x;
    cin >> x;

    // aは常にせいであると仮定する
    int a = 0, b;
    for(int i = 0; i < 121; i++){
        for(int j = - 120; j < 121; j++){
            long long tmp = pow(i, 5) - pow(j, 5);
            if(tmp == x){
                a = i;
                b = j;
                break;
            }
        }
    }
    
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 4080
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <cctype>
#define int long long
using namespace std;

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

signed main() {

    int a,b;
    string s;
    bool ans = true;

    cin  >> a >> b >> s;

    if(s.length() != (a+b+1)) ans = false;
    else {
        for(int i = 0; i < s.length(); i ++){
            if(i == a){
                if(s[i] != '-') ans = false;
            }else{
                if(!isdigit(s[i])) ans = false;
            }
        }
    }
    if(ans) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 3616
#include "bits/stdc++.h"

#define rep(i, a) for (ll i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

using namespace std;

using ll = long long;

void Main() {
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  sort(l.begin(), l.end());
  int ans = 0;
  rep(i, n - 2) REP(j, i + 1, n - 1) {
    int a = l[i] + l[j];
    auto position = lower_bound(l.begin() + j, l.end(), a);
    ans += distance(l.begin(), position) - j - 1;
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


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

const ll mod = 998244353;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n;
    cin >> n;
    
    vector<ll> tree(n),cnt(n+1,0);
    
    for(int i = 0 ; i < n; i++){
        cin >> tree[i];
        cnt[tree[i]]++;
    }
    
    if(tree[0] != 0 || cnt[0] != 1) {
        cout << 0 << endl;
        return 0;
    }
    
    ll ans = 1;
    for(int i = 1; i < n ; i++){
        ans = (ans * cnt[tree[i] - 1]) % mod;
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 1792
def pow(x, n, mod):
    ret = 1
    while n > 0:
        if n % 2 == 1:
            ret = ret * x % mod
        x = x * x % mod
        n >>= 1
    return ret
def gcd(x,y):
    a,b = max(x,y),min(x,y)
    r = a % b
    while r != 0:
        a,b = b,r
        r = a % b
    return b
mod = 10**9+7
N = int(input())
a = list(map(int,input().split()))
g = a[0]
l = g
for i in range(1,N):
    g = gcd(l, a[i])
    l = (l*a[i])//g
ans = 0
l %= mod
for i in range(N):
    tmp = (pow(a[i], mod-2, mod)*l)%mod
    ans = (ans+tmp)%mod
print(ans%mod)

Measured memory_bytes: 4084
N = int(input())
 
k = N // 3
l = N // 5
m = N // 15
 
sum = (N * (N + 1) / 2) - (3* k * (k + 1) / 2) - (5* l * (l + 1) / 2) + (15* m * (m + 1) / 2)
print(int(sum))

Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ini(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define ll long long

ll dp[100005][3];
int main()
{
	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//ll tt;	cin>>tt;	while(tt--)
	{
		ll n,i;
		cin>>n;
		
		ll a[n+1],b[n+1],c[n+1];

		for(i=1;i<=n;i++)	
		{
			cin>>a[i]>>b[i]>>c[i];

			dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
			dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
			dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c[i];
		}
		

		cout<<max({dp[n][0],dp[n][1],dp[n][2]});
 	
 	}
	cerr<<" Execution : "<<(1.0*clock())/CLOCKS_PER_SEC<<"s \n";
		
		
return 0;
}

Measured memory_bytes: 4992
#include "bits/stdc++.h"

#pragma warning(disable:4996)
using namespace std;


int main() {
	long long int H,W;cin>>H>>W;
	int Y,X;cin>>Y>>X;
	X--;Y--;
	if (H > W) {
		swap(H,W);
		swap(X,Y);
	}
	assert(H<=W);
	bool ok;
	if (H == 1) {
		assert(Y==0);
		if(X==0||X==W-1)ok=true;
		else ok=false;
	}
	else {
		if((H*W)%2==1&&(X+Y)%2==1)ok=false;
		else ok=true;
	}

	if(ok)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}



Measured memory_bytes: 3096
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BSimilarArrays {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n;
	    in >> n;
	    vector<int> a(n);
	    int even = 0, odd = 0;
	    for(int i=0; i<n; i++){
	        in >> a[i];
	        if(a[i] % 2 == 0) even++;
	        else odd++;
	    }

        int res = pow(3, n);
	    out << res - pow(2, even) << endl;
	}
};


int main() {
	BSimilarArrays solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 384
import numpy as np

def input_numbers():
    temp = list(map(int, input().split()))
    return temp

def GCD(a, b):
    if(a < b):
        temp = a
        a = b
        b = temp
    a = a % b
    if(a == 0):
        return b
    else:
        return GCD(a, b)

class point:
    def __init__(self, x ,y):
        self.x = x
        self.y = y

n = int(input())

R_point = []
B_point = []

for i in range(n):
    temp = input_numbers()
    R_point += [point(temp[0], temp[1])]

for i in range(n):
    temp = input_numbers()
    B_point += [point(temp[0], temp[1])]

B_point.sort(key = lambda point:point.x)
R_point.sort(key = lambda point:point.y)
R_point.reverse()

count = 0

for i in range(len(B_point)):
    for j in range(len(R_point)):
        if(R_point[j].x < B_point[i].x and R_point[j].y < B_point[i].y):
            R_point.pop(j)
            count += 1
            break
print(count)

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	ll N; cin >> N;
	vll D(N); cin >> D;
	sort(begin(D), end(D));

	int minv = D[0];
	vint dats;
	for (int i = 0; i < N; i++) {
		dats.push_back(i&1 ? D[i] : 24 - D[i]);
	}
	sort(begin(dats), end(dats));
	for (int i = 0; i < N-1; i++) {
		chmin(minv, dats[i+1]-dats[i]);
	}
	cout << minv << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 3612
L = [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]
print(L[int(input()) - 1])


Measured memory_bytes: 2940
#include<iostream>
using namespace std;
int main(){
	int H;
	int W;
	for (;;){
		cin >> H >> W;
		if (H == 0 && W == 0){
			return 0;
		}else{for (int b = 0; b < H; b++){
				if (b % 2 == 0){
					for (int c = 0; c < W; c++){
						if (c % 2 == 0){
							cout << "#";
						}else{
							cout << ".";
						}
					}cout << endl;
				}else{
					for (int c = 0; c < W; c++){
						if (c % 2 == 0){
							cout << ".";
						}
						else{
							cout << "#";
						}
					}cout << endl;
				}
			}cout << endl;
		}

	}
}

Measured memory_bytes: 3096
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cstdlib>
#include<cassert>
#include<random>
using namespace std;

long long cal(long long x, long long y, long long z){
    return x*10000 + y*5000 + z* 1000;
}

int main(){
    long long N,Y;
    cin >> N >> Y;

    bool ok = false;
    
    for(long long x=0; x<N+1; x++){
        for(long long y=0; x+y<N+1; y++){
            long long z = N-x-y;
            if(cal(x,y,z) == Y){
                cout << x << " " << y << " " << z << endl;
                x = 2*N;
                y = 2*N;
                ok = true;
            }
        }
    }

    if(ok == false){
        cout << "-1 -1 -1" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int iH = int.Parse(sS[0]);
            int iW = int.Parse(sS[1]);
            List<string> lstInp = new List<string>();
            for (int i = 0; i < iH; i++) { lstInp.Add("#" + Console.ReadLine().Trim() + "#"); }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sTmp = "";
            lstInp.Insert(0, sTmp.PadLeft(iW + 2, '#'));
            lstInp.Add(sTmp.PadLeft(iW + 2, '#'));

            //出力
            for (int i = 0; i < lstInp.Count; i++)
            {
                Console.WriteLine("{0}", lstInp[i].ToString().Trim());
            }

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 13268