akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#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 sp " "
#define INF 1e18
#define INT_INF 1e9

typedef long long ll;
const ll MOD = 1000000007;
const ll MOD_9 = 998244353;

vector<char> boin = {'a','i','u','e','o'};
vector<char> alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

int main(){
    int N,M;
    cin >> N >> M;
    vector<bool> j(N,false);
    vector<int> pen(N,0);
    int ans = 0;
    int cnt = 0;
    Rep(i,M){
        int p;
        string S;
        cin >> p >> S;
        p--;
        if(j[p]);
        else{
            if(S == "WA")pen[p]++;
            else{
                j[p] = true;
                cnt++;
            }
        }
    }
    Rep(i,N){
        if(j[i])ans += pen[i];
    }
    cout << cnt << sp << ans << endl;
    //cin >> N;
}

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

int main()
{
    int n,k,j;
    scanf ("%d %d",&n,&k);
    j=n/2;
    if(n%2!=0)j=j+1;
    if(k<=j)printf ("YES\n");
    else printf ("NO\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); }
    llong gcd   ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; }
    llong lcm   ( llong x, llong y ) { return ( x / gcd(x, y) * y ); }
    llong abs   ( llong n )          { return ( n < 0 ) ? -n : n; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    int q, w, e;

    signed call_of_Cthulhu( signed datum ) {

        int n;
        read n;
        int a, b;
        read a >> b;

        for ( int i = 0; i < n; i++ ) {
            int t;
            read t;
            if ( t <= a ) {
                q++;
            }
            elif ( t <= b ) {
                w++;
            }
            else {
                e++;
            }
        }
        echo std::min(std::min(q, w), e) fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 256
n, m = map(int, input().split())
scs = []
for i in range(m):
    scs.append(list(map(int, input().split())))
    
def set_number(scs):
    number = [-1] * n
    for sc in scs:
        if number[sc[0] - 1] == -1:
            number[sc[0] - 1] = sc[1]
        elif number[sc[0] - 1] != sc[1]:
            return None
    return number
  
def guess_number(number):
    if number is None:
        return -1

    if number[0] == 0 and n > 1:
        return -1
    
    guess = 0
    for i in range(n):
        if i == 0 and  number[i] == -1 and n == 1:
            return 0
        elif i == 0 and  number[i] == -1:
            guess += (10 ** (n - i - 1))
        elif number[i] != -1:
            guess += number[i] * (10 ** (n - i - 1))

    return guess

number = set_number(scs)
print(guess_number(number))

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

public class Main {

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

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int n = fs.nextInt();
		long x = fs.nextLong();
		
		long[] heightArr = new long[51];
		long[] pArr = new long[51];
		long[] bArr = new long[51];
		
		heightArr[0] = 1;
		pArr[0] = 1;
		
		for(int i = 1; i < 51; i++) {
			heightArr[i] = 3 + 2 * heightArr[i-1];
			pArr[i] = 1 + 2 * pArr[i-1];
			bArr[i] = 2 + 2 * bArr[i-1];
		}
		
		
		int nowIndex = n;
		long eatenP = 0;
		while(x > 0) {
			
			if(x < heightArr[nowIndex]) {
				// panを食う
				x--;
				nowIndex--;
			}else if(x > heightArr[nowIndex]) {
				
				x -= heightArr[nowIndex];
				// 間のpatyも食う
				x--;
				eatenP += pArr[nowIndex];
				eatenP++;
			}else if(x == heightArr[nowIndex]) {
				x = 0;
				eatenP += pArr[nowIndex];
			}
		}
		
		System.out.println(eatenP);
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


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

using namespace std;

int main(void) {
	string A,B,C;
	cin >> A >> B >> C;
	if (A[A.length()-1] == B[0] && B[B.length()-1] == C[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}


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

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

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

int main(){
    int X,Y,Z;
    cin>>X>>Y>>Z;
    int A=Y+Z;
    if(X-A<0)cout<<0<<endl;
    int ANS=0;
    X-=Z;
    while(1){
        if(X-A<0){
            cout<<ANS<<endl;
            return 0;
        }
        X-=A;
        ANS++;
    }
    return 0;
}

//a=97,z=122

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

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

#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 main()
{
    int a,b;
    cin >>a>>b;
    cout << max(a+b,max(a-b,a*b)) <<endl;
    
    return 0;
}

Measured memory_bytes: 256
m=int(input())
n=[]
for i in range(m):
  n.append(int(input()))
maxv=-1*10**9
minv=n[0]
for i in range(1,len(n)):
  maxv=max(maxv,n[i]-minv)
  minv=min(minv,n[i])

print(maxv)


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

int main() {
	string s;
	int count = 0;
	cin >> s;
	if(s[0]=='0'){
		for (int i = 0; i < s.size(); ++i) {
			if (i % 2 == 0 && s[i] != '0') {
				s[i] = '0';
				++count;
			}
			if (i % 2 != 0 && s[i] != '1') {
				s[i] = '1';
				++count;
			}
		}
	}
	else if (s[0] == '1') {
		for (int i = 0; i < s.size(); ++i) {
			if (i % 2 != 0 && s[i] != '0') {
				s[i] = '0';
				++count;
			}
			if (i % 2 == 0 && s[i] != '1') {
				s[i] = '1';
				++count;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  int d=0;
  string s1,s2;
  getline(cin,s1);
  getline(cin,s2);
  for(int i=0;i<s1.size();i++){
    if(s1[i]!=s2[i]) d++;
  }
  cout<<d;
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 
 
#define PI 3.14159265
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
 
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};
 
//const int mod = 998244353;
 
struct dsu{
	int parent[N];
	int cont;
	void make_set(int n){
		for(int i = 1; i <= n; i++)
			parent[i] = i;
		cont = n;
	}
	
	int find_set(int v){
		if(v == parent[v])
			return v;
		return find_set(parent[v]);
	}
	
	void union_sets(int a, int b){
		a = find_set(a);
		b = find_set(b);
		if(a != b){
			parent[b] = a;
			cont--;
		}
	}
};
 
 


int main()
{
	int n; cin>> n;
	string s, t; cin>> s >> t;
	string ans = "";
	int i = 0, j = 0;
	bool f = true;
	while(i < n && j < n){
		if(f){
			ans += s[i];
			i++;
			f = false;
		}
		else{
			ans += t[j];
			j++;
			f = true;
		}
	}
	ans += t[j];
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
//هوالحق
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    char A[4];
    for(int i = 0;i < 4; i++) cin >> A[i];
    if(A[0] == A[1] || A[1] == A[2] || A[2] == A[3]) cout << "Bad";
    else cout << "Good";
}


Measured memory_bytes: 256
#include <algorithm>
//#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define INF 10000000000

void chmin(ll &a, ll b) {
    if(a > b) {
        a = b;
    }
};

int main() {
    int n;
    cin >> n;
    ll dp[100100];
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    rep(i, n) dp[i] = INF;
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    REP(i, 1, n) {
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }
    cout << dp[n - 1] << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=2e5;

int main(){
	int N;
	cin>>N;
	int X[MAX],Y[MAX];
	rep(i,N){cin>>X[i];Y[i]=X[i];}
	sort(Y,Y+N);
	int a=Y[N/2-1];
	int b=Y[N/2];
	rep(i,N){
		if(X[i]<=a)cout<<b<<endl;
		else cout<<a<<endl;
    }
}

Measured memory_bytes: 3712
import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    x=ii()
    n=x%100
    cnt=0
    for i in range(1,6)[::-1]:
        m=n%i
        cnt+=n//i
        if m==0: break
        n=m
    print(1 if cnt*100<=x-n else 0)
        



if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func main() {
	var n,l,max,sum int
	fmt.Scan(&n)
	
	for i := 0; i < n; i++ {
		fmt.Scan(&l)
		if l > max {
			max = l
		}
		sum += l
	}
	
	if max >= sum - max {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
int main(void)
{
int n,a=0,b=0,c=0,d=0,i;
char s[10];
char *s1 = "AC";
char *s2 = "WA";
char *s3 = "TLE";
char *s4 = "RE";
scanf("%d",&n);
for(i=1;i<=n;i++){
  scanf("%s",&s);
  if(strcmp(s1,s) == 0)
    a++;
  else if(strcmp(s2,s) == 0)
    b++;
  else if(strcmp(s3,s) == 0)
    c++;
  else if(strcmp(s4,s) == 0)
    d++;
}
  printf("AC x %d\n",a);
  printf("WA x %d\n",b);
  printf("TLE x %d\n",c);
  printf("RE x %d\n",d);
  return 0;
}


Measured memory_bytes: 2128
#include <stdio.h>

int main(void)
{
	int a,b,c,d[10000],x=0,e=0,i;
	scanf("%d %d %d",&a,&b,&c);
	for(i=0;i<b;i++){
		scanf("%d",&d[i]);
	}
	for(i=0;i<b;i++){
		if(d[i]>c){
			x++;
		}
	}
	for(i=0;i<b;i++){
		if(d[i]<c){
			e++;
		}
	}
	if(x>e){
		x=e;
	}
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<int(n);i++)
#define FOR(i,m,n) for(int i=m;i<int(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define show(x) cout<< #x << " = " << x << endl
using namespace std;

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

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}	

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int N_MAX=100010;

int H, W, K;
int ans[1000][1000];

void fillup(int from, int to){
	if(from == H)return;
	bool exist=false;
	REP(j,W){
		if(ans[from][j]!=-1){
			exist=true;
		}
	}
	if(exist){
		REP(j,W){
			ans[to][j]=ans[from][j];
		}
	}else{
		fillup(from+1, from);
		REP(j,W){
			ans[to][j]=ans[from][j];
		}
	}
}

void filldown(int from, int to){
	if(from == -1)return;
	bool exist=false;
	REP(j,W){
		if(ans[from][j]!=-1){
			exist=true;
		}
	}
	if(exist){
		REP(j,W){
			ans[to][j]=ans[from][j];
		}
	}else{
		filldown(from, from-1);
		REP(j,W){
			ans[to][j]=ans[from][j];
		}
	}
}


int main(){
	cin>>H>>W>>K;
	char S[H][W];
	REP(i,H)REP(j,W)cin>>S[i][j];
	REP(i,H)REP(j,W)ans[i][j]=-1;
	int idx=1;
	REP(i,H){
		bool exist=false;
		REP(j,W){
			if(S[i][j]=='#'){
				if(!exist){
					exist=true;
					REP(k,j+1){
						ans[i][k]=idx;
					}
				}else{
					idx++;
					ans[i][j]=idx;
				}
			}else{
				if(exist){
					ans[i][j]=idx;
				}
			}
		}
		if(exist)idx++;
	}
	/*
	REP(i,H){
		REP(j,W){
			printf("%2d", ans[i][j]);
		}
		cout<<endl;
	}
	*/
	for(int i=0;i<H-1;i++){
		bool exist=false;
		REP(j,W){
			if(ans[i][j]!=-1)exist=true;
		}
		if(!exist){
			fillup(i+1,i);
		}
	}
	for(int i=1;i<H;i++){
		bool exist=false;
		REP(j,W){
			if(ans[i][j]!=-1)exist=true;
		}
		if(!exist){
			filldown(i-1,i);
		}
	}
	REP(i,H){
		REP(j,W){
			cout<<ans[i][j];
			if(j!=W-1)cout<<" ";
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 2048
#include <stdio.h>

int main(void){
	while(1){
		int n, i;
		long a[100], key;
	
		scanf(" %d", &n);
		if(n==0) break;
		
		for(i=0; i<n; i++) scanf(" %ld", &a[i]);
		scanf(" %ld", &key);
	
		int left=0, right=n-1;
		int count = 0;
		
		while(left <= right){
			++count;
		
			int p = (left+right)/2;
			if(a[p] > key) {
				right = p-1;
			}
			else if(a[p] < key) {
				left = p+1;
			}
			else break;
			
			//printf("%d~%d ;%d\n",left,right, p);
		}
	
		printf("%d\n", count);
	
	}

	return 0;
}

Measured memory_bytes: 600
def range(data)
  a = data >= 1
  b = data <= 100
  return (a and b)
end

input = gets
data = input.split(" ")
a = data[0].to_i
b = data[1].to_i

if range(a) and range(b) then
  puts "#{a * b} #{a * 2 + b * 2}"
end

Measured memory_bytes: 8580
#include <bits/stdc++.h>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	int N; cin >> N; 
	int A[200010] = {}; 
	for(int i = 1; i <= N; i++){
		cin >> A[i]; 
	} 
	int L[200010] = {}; int R[200010] = {}; 
	for(int i = 1; i <= N; i++){
		L[i] = max(L[i-1], A[i]); 
	} 
	for(int i = N; i >= 1; i--){
		R[i] = max(R[i+1], A[i]); 
	}
	for(int i = 1; i <= N; i++){
		cout << max(L[i-1], R[i+1]) << endl; 
	}
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = 0; i < (a); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

int n, m;

VI used(100, false);
VVI graph(100, VI(100, 0));

void dfs(int s) {
  used[s] = true;
  rep(i, n) {
    if(used[i]) continue;
    if(!graph[s][i]) continue;
    dfs(i);
  }
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  VI a(m), b(m);
  rep(i, m) {
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }
  int ans = 0;
  rep(i, m) {
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
    rep(i, n) used[i] = false;
    dfs(0);
    bool br = false;
    rep(i, n) if(!used[i]) br = true;
    if(br) ans++;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }
  out(ans);


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

int main(){
    int n, l;
    cin >> n >> l;
    vector<int> a(n);
    rep(i,n){
        a[i] = l + i;
    }
    int s = 0;
    rep(i,n) s += a[i];
    int ans = 1e9;
    rep(i,n){
        int t = s-a[i];
        if (abs(t-s) < abs(ans-s)) ans = t;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/

// 123456789
// 255456376
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m;
	cin>>n>>m;
	vi a(m);
	vi b={100,2,5,5,4,5,6,3,7,6};
	cin>>a;
	sort(all(a),[&](int x,int y){return b[x]<b[y] or (b[x]==b[y] and x<y);});
	vi x;

	vs dp(n+1,"-");
	dp[0]="";
	rep(i,n){
		if(dp[i]=="-")continue;
		rep(j,m){
			if(i+b[a[j]]>n)break;
			string nxt=dp[i]+to_string(a[j]);
			sort(rall(nxt));
			if(dp[i+b[a[j]]].size()>nxt.size()) continue;
			if(dp[i+b[a[j]]].size()==nxt.size() and dp[i+b[a[j]]]>nxt) continue;
			dp[i+b[a[j]]]=nxt;
		}
	}
	puta(dp[n]);
	return 0;
}


Measured memory_bytes: 26496
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#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;}

#define INF 2147483600

// Binary Indexed Tree
template<typename T>
class BIT {
private:
  vector<T> bit;
  int n;
public:
  BIT(int _n) : n(_n) {
    bit = vector<T>(n+1, 0); //0初期化
  }
  void add(int v, T a){ //vは0-indexed
    for(int x=v+1; x<=n; x += x&(-x)) bit[x] += a;
  }
  T sum(int v){ //vは0-indexed
    T ret=0;
    for(int x=v+1; x>0; x -= x&(-x)) ret += bit[x];
    return ret;
  }
}; // END class BIT


int main(){
  long n,k;
  cin>>n>>k;
  vector<long> vec(n);
  rep(i,n) cin>>vec[i];
  rep(i,n) vec[i] -= k;

  vector<long> acc(vec);
  rep(i,n-1) acc[i+1] += acc[i];

  vector<long> accu(acc);

  sort(all(accu));

  BIT<long> bit(n+2);

  long ans = 0;

  long accm = 0;
  rep(i,n){
    // acc以上が何個あるか調べる
    ans += (long) n - (lower_bound(all(accu), accm) - accu.begin());
    // 既に調べたacc以上の値を抜く
    int idx = lower_bound(all(accu), accm) - accu.begin();
    idx--;
    long mn;
    if(idx==-1) mn = i;
    else mn = i - bit.sum(idx);
    ans -= mn;

    bit.add(lower_bound(all(accu), acc[i]) - accu.begin(), 1);
    accm = acc[i];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6528
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int min = Math.min(a + b, Math.min(b + c, a + c));
        System.out.println(min);
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
const int INF_INT = 2147483647;
const long long INF_LONG = 9223372036854775807;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
     
int main() {
  char a;  cin >> a;
  if (a >= 'a' && a <= 'z') cout << 'a' << endl;
  else cout << 'A' << endl;
}

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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
using tp = tuple<ll, ll, ll>;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll)1e9 + 7;
constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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;
}

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n, q;
    cin >> n >> q;
    vec<ll> a(n, n), b(n, n);
    ll h = n;
    ll w = n;

    ll ans = (n - 2) * (n - 2);
    while(q--) {
        ll t, x;
        cin >> t >> x;
        if(t == 1) {
            if(x < w) {
                //一度区切られると縮むことはない
                rep(i, x, w) {
                    b[i] = h;
                }
                w = x;
            }
            ans -= b[x] - 2;
        } else {
            if(x < h) {
                rep(i, x, h) {
                    a[i] = w;
                }
                h = x;
            }
            ans -= a[x] - 2;
        }
    }
    cout << ans << en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


Measured memory_bytes: 6384
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define INF 100000000
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;

int main() {
    int a, b, x;
    cin >>a>>b>>x;
    if(a<=x && x<=a+b) {
        cout << "YES";
        return 0;
    }else
        cout << "NO";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
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 gcd(int a,int b) { return b ? gcd(b,a%b) : a;}
int lcm(int a,int b) { return a/gcd(a,b)*b;}
void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}
void putb(unsigned int v) {putchar('0'), putchar('b'), printb(v), putchar('\n');}
#define ALL(W) (W).begin(),(W).end()

signed main(){
  int a=1,A,B,i=0;
  cin >> A >> B;
  while(a<B){
    a+=A-1;
    i++;
  }
  cout << i << endl;
  return 0;
}


Measured memory_bytes: 256
procedure quickly_sort(var a:array of longint;l,r:longint);inline;
var i,j,x,y:longint;
begin
  while true do
  begin
    if r<l+74 then
      exit;
    i:=l;j:=r;
    x:=a[(l+r)>>1];
    repeat
      while a[i]<x do inc(i);
      while x<a[j] do dec(j);
      if not(i>j) then
      begin
        y:=a[i];a[i]:=a[j];
        a[j]:=y;inc(i);dec(j);
      end;
    until i>j;
    if l<j then quickly_sort(a,l,j);
    if not(i<r) then
      exit;
    l:=i;
  end;
end;
procedure sort(var a:array of longint;l,r:longint);inline;
var i,j,t:longint;
begin
  if r>l then
  begin
    quickly_sort(a,l,r);
    i:=l;
    for i:=l to r do
    begin
      j:=i; 
      while j>pred(l) do
        if a[j]<a[pred(j)] then
        begin
          t:=a[pred(j)];a[pred(j)]:=a[j];a[j]:=t;
          dec(j);
        end
        else
          break;
    end;
  end;
end;
procedure swap(var a,b:longint);inline;
var t:longint;
begin
  t:=a;a:=b;b:=t;
end;
function max(a,b:longint):longint;inline;
begin
  if a>b then
    exit(a);
  exit(b);
end;
function min(a,b:longint):longint;inline;
begin
  if a>b then
    exit(b);
  exit(a);
end;
function endl:ansistring;inline;
begin
  writeln;exit('');
end;
var a:array[0..1000000]of longint;
    n,ans,i:longint;
begin
  readln(n);
  for i:=1 to n do
    read(a[i]);
  sort(a,1,n);
  i:=1;
  while i<n do
    if a[i]=a[i+1] then
    begin
      inc(ans,2);
      inc(i,2);
    end
    else
      inc(i);
  writeln(n-ans);
end.

Measured memory_bytes: 512
#include<stdio.h>
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int main(){
  int n,m,a;
  scanf("%d %d",&n,&m);
  while(--n){
    scanf("%d",&a);
    m=gcd(m,a);
  }
  printf("%d\n",m);
  return 0;
}


Measured memory_bytes: 128
package main

import (
	"fmt"
)

func main() {
	var str string
	fmt.Scan(&str)
	m := make(map[rune]int)
	for _, v := range str {
		m[v]++
	}
	msg := "No"
	if len(m) == 2 {
		flag := true
		for _, v := range m {
			if v != 2 {
				flag = false
				break
			}
		}
		if flag {
			msg = "Yes"
		}
	}
	fmt.Println(msg)
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;

#define sz(x) (int)(x.size())
#define FOR(i,L,R) for(int i = L; i <= R; i++)
#define int long long

const int N = 2e5 + 2, inf = 1e18;

struct DSU
{
    int connected;
    int par[N], sz[N];
 
    void init(int n) 
    {
        for(int i=1;i<=n;i++)
        {
            par[i]=i;
            sz[i]=1;
        }
        connected=n;
    }
 
    int getPar(int k)
    {
        while(k!=par[k])
        {
            par[k]=par[par[k]];
            k=par[k];
        }
        return k;
    }
 
    int getSize(int k)
    {
        return sz[getPar(k)];
    }

    bool same(int u , int v)
    {
        return (getPar(u) == getPar(v));
    }
 
    bool unite(int u, int v)
    {
        int par1=getPar(u), par2=getPar(v);
 
        if(par1==par2)
            return false;
 
        connected--;
 
        if(sz[par1]>sz[par2])
            swap(par1, par2);
 
        sz[par2]+=sz[par1];
        sz[par1]=0;
        par[par1]=par[par2];
        return true;
    }
};

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

    int n, m;
    cin >> n >> m;
    DSU dsu;
    dsu.init(n);

    while(m--) {
        int u, v;
        cin >> u >> v;
        dsu.unite(u, v);
    }  

    int ans = 0;

    FOR(i,1,n) {
        ans = max(ans, dsu.getSize(i));
    }
    cout << ans;
}


Measured memory_bytes: 6768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main(){
    int d, n;
    cin >> d >> n;
    if(n == 100){
        cout << int(pow(100, d)*(n+1));
    }else{
        cout << int(pow(100, d)*n);
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include <string>
#include <sstream>
#include <queue>
#include <map>
#include <algorithm>
#include <deque>
using namespace std;

const long MOD = 1e9 + 7;
int main()
{
  long n,m;
  cin >>n;

  vector<long> a(n,0);
  vector<long> b;
  deque<long> c;
  for (int i = 0; i < n; ++i)
  {
     cin >> a[i]; 
     if (i%2==0)c.push_front(a[i]);
     if (i%2==1)c.push_back(a[i]);
  }

  if (n%2==0){
    reverse(c.begin(),c.end());
  }


  for (int i = 0; i < n; ++i){
    cout <<c[i] <<" ";
  }

  // cout <<"-1 -1 -1" << endl;

  return 0;
}






Measured memory_bytes: 5376
import math
def func(n):
    sq = math.sqrt(n)
    cnt = 0
    if sq.is_integer():
        for i in range(1, int(sq)):
            if n%i==0:
                cnt += 1
        return 2*cnt + 1
    else:
        for i in range(1, int(sq)+1):
            if n%i==0:
                cnt += 1
        return 2*cnt 

n = int(input())
cnt = 0
for i in range(1, n+1):
    if i%2==0:
        continue
    elif func(i)==8:
        cnt = cnt + 1
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
//#define MOD 100000007
long long N;
long long M;
int k;
using Graph = vector<vector<int>>;
vector<int> color(100000,0);
vector<bool> used(100000,false);
//vector<bool> ans(100000,false);

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};
int ans = 0;

bool bfs(Graph &data, int t,int col)
{
    color[t] = col;
    
    for(int i = 0;i<data[t].size();i++)
    {
        if(color[data[t][i]] != 0)
        {
            if(color[data[t][i]] == col)
            {
                color[t] = 0;
                return false;
            }
            else
            {
                continue;
            }
        }
        else
        {
            if(!bfs(data,data[t][i],col*-1)) return false;
        }
    }
    return true;
}
int main()
{
    cin >> N ;
    cin >> M;
    
    Graph data(N);
    
    for(int i = 0;i<M;i++)
    {
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        data[a].push_back(b);
        data[b].push_back(a);
    }
    
   
    if(bfs(data,0,1))
    {
        long long B = 0;
        long long  W = 0;
        for(int i=0;i<N;i++)
        {
            if(color[i] == 1)
            {
                B++;
            }
            else W++;
            
        }
        cout << B * W - M << endl;
    }
    else
    {
        cout << (N-1)*N/2 - M << endl;
    }
    
    
    //cout << ans << endl;
    
    return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, A, B;
    cin >> N >> A >> B;

    ll t = N / (A + B);
    ll ans = t * A + std::min(A, (N % (A + B)));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))

L.sort()

def hersCode(L, n, a, b):
  #if L[-1] < n:
  #  return len(L)
  ok = n
  ng = len(L)
  while abs(ok - ng) > 1:
    mid = abs(ok + ng) // 2
    if L[i] + L[j] > L[mid]:
      ok = mid
    else:
      ng = mid
  return ok - n

ans = 0
for i in range(N - 2):
  for j in range(i + 1, N - 1):
    ans += hersCode(L, j, L[i], L[j])

print(ans)

Measured memory_bytes: 46608
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define dcout cout<<fixed<<setprecision(20)
#define Accepted_MAGIC cin.tie(0);ios::sync_with_stdio(false);cerr << "compiled" << endl

// typedef long long ll;
using Real = long double;
#define int long long

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;
constexpr Real eps = 1e-9, pi = acos(-1);

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

signed main(void){
  Accepted_MAGIC;
  
  int A, B; cin >> A >> B;
  for(int i = 1; i <= 100000; i++){
  	int eight = (int)floor((double)i * 0.08);
  	int ten   = (int)floor((double)i * 0.10);
  	if(eight == A and ten == B){
  		cout << i << endl;
  		return 0;
  	}
  }
  cout << -1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */

void c2()
{
    size_t n;
    int64_t k;
    cin >> n >> k;
    vector<int64_t> a(n);
    cin >> a;

    size_t s;
    for(s = 0; s + 1 < n; ++ s)
        if(k < a[s] + a[s + 1] + 1)
            break;

    if(s + 1 == n)
    {
        cout << "Impossible";
        return;
    }

    cout << "Possible" << '\n';
    for(size_t i = 0; i < s; ++ i)
        cout << i + 1 << '\n';

    for(size_t i = n - 2; i < n && s < i; --i)
        cout << i + 1 << '\n';

    cout << s + 1 << '\n';
}

int main(const int argc, char * argv [])
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    c2();

    return EXIT_SUCCESS;
}


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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;



int main() {

    int N, D;
    cin >> N >> D;
    int X[N][D];
    REP(i, N)REP(j, D)cin >> X[i][j];
    int count = 0;

    REP(i, N){
        for(int j = i+1; j < N; j++){
            double kyori = 0;
            REP(k, D){
                double tmp = (X[i][k] - X[j][k]);
                kyori += pow(tmp);
            }
            kyori += sqrt(kyori);
            if(kyori == (int)kyori)count++;
        }
    }
    cout << count << endl;
  
    



}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


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

public class Main {
	Scanner sc = new Scanner(System.in);
	public void run(){
		while(true){
			int n = sc.nextInt();
			if(n == 0) break;
			calc(n);
		}
	}
	public void calc(int n){
		char[][] words = new char[n][];
		
		words[0] = sc.next().toCharArray();
		
		for(int i = 1; i < n; i++){
			words[i] = sc.next().toCharArray();
			
			int before = -1;
			int mmax = 0;
			for(int k = 0; k < words[i].length; k++){
				if(words[i][k+1] != '.'){
					words[i][k] = '+';
					for(int j = i-1; j >= 0; j--){
						if(words[j][k] == ' '){
							words[j][k] = '|';
						}
						else break;
					}
					break;
				}
				else {
					words[i][k] = ' ';
				}
			}
		}
		
		
		for(int i = 0; i < n; i++){
			System.out.println(words[i]);
		}
	}
	
	public static void main(String[] args){
		new Main().run();
	}
	
}

Measured memory_bytes: 78236
from itertools import combinations
while  True:
    n, x = [int(i) for i in input().split()]
    if n == x == 0: break
    count = 0
    array = set(range(1, n+1))
    for ele in combinations(array, 3):
        if sum(ele) == x:
            count += 1
    print(count)

Measured memory_bytes: 7744
n=int(input())
arr=list(map(int,input().split()))
mod=10**9+7
s=[0]*(n+1)
tmp=0
for i in range(1,n+1):
  tmp=pow(i,mod-2,mod)%mod
  s[i]=(s[i-1]+tmp)%mod
ans=0
for i in range(n):
  ans+=(arr[i]*(s[i+1]+s[n-i]-1))%mod
for i in range(1,n+1):
  ans=(ans*i)%mod
print(ans)

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

namespace ABC115A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = n[0];
            int K = n[1];

            int[] hi = new int[N];
            for(int i = 0; i < N; i++)
            {
                hi[i] = int.Parse(Console.ReadLine());
            }

            hi = hi.OrderBy(x => x).ToArray();
            int min = int.MaxValue;
            for(int i = 0; i < N - K + 1; i++)
            {
                min = Math.Min(hi[i + K - 1] - hi[i], min);
            }

            Console.WriteLine(min);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 20444
def winOrBust(string_numbers_in):
  num_array = string_numbers_in.split()
  result = 0
  for num in num_array:
    result += int(num)
  if result >= 22:
    print('bust')
  else:
    print('win')

if __name__ == "__main__":
    string_numbers_in = input()
    winOrBust(string_numbers_in)

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

int		main(void)
{
	int a, b;
	cin >> a >> b;
	int i = a * 10;

	while (i <= 2000)
	{
		if ((b == (i / 10)) && (a == ((i * 8) / 100)))
			break ;
		i++;
	}
	if ((b == (i / 10)) && (a == ((i * 8) / 100)))
		cout << i;
	else
		cout << -1;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using str = string;
using ll = long long;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define RREP(i,n) for(int i=int(n)-1; i>=0; i--)
#define FOR(i,f,t) for(int i=int(f); i<=int(t); i++)
#define RFOR(i,f,t) for(int i=int(f); i>=int(t); i--)
#define ALL(vec) (vec).begin(),(vec).end()
#define ASORT(vec) sort(ALL(vec))
#define DSORT(vec) sort(ALL(vec), greater<int>());
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define YES(ans) if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define Yes(ans) if(ans) cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define yes(ans) if(ans) cout<<"yes"<<endl; else cout<<"no"<<endl;

int main() {
    ll n, d, x, y, ans=0;
    cin >> n >> d;
    REP(i, n) {
        cin >> x >> y;
        if(x*x+y*y<=d*d) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <cstdio>

int n;
int y,m,d;

int days[]={-1,20,19,20,19,20,19,20,19,20,19};

int main(void)
{
	scanf("%d",&n);
	while(n--) {
		scanf("%d%d%d",&y,&m,&d);
		long long tot = 0;
		for(int i=y+1;i<1000;++i) {
			if(i%3==0) tot += 200;
			else tot += 195;
		}

		for(int i=m+1;i<=10;++i) {
			if(y%3==0) tot += 20;
			else tot += days[i];
		}

		if(y%3==0) tot += 20-d;
		else tot += days[m]-d;

		printf("%lld\n",tot+1);
		//if(n!=0) puts("");
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<int> g[101010];
int vis[101010];
void dfs(int u){
    vis[u] = 1;
    for(int i = 0; i < g[u].size(); i++){
        int v = g[u][i];
        if(vis[v])continue;
        dfs(v);
    }
}
int main(){
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        int x, y, z;
        cin >> x >> y >> z;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    int result = 0;
    for(int i = 1; i <= N; i++){
        if(!vis[i]){
            result ++;
            dfs(i);
        }
    }
    cout << result << '\n';
}


Measured memory_bytes: 9216
n=int(input())
b=list(map(int,input().split()))
a=[]
a.append(b[0])
for i in range(n-1):
    a[i] = b[i] if a[i] > b[i] else a[i]
    a.append(b[i])
#    print(a)
print(sum(a))

Measured memory_bytes: 3060
H,N = map(int,input().split())
INF = 10 ** 10
dp = [INF] * (H + 1)
dp[0] = 0

for i in range(N):
  attack,magic = map(int,input().split())
  for j in range(len(dp)):
    if dp[j] == INF:
      continue
    target = j + attack
    if j + attack > H:
      target = H
    if dp[target] > dp[j] + magic:
      dp[target] = dp[j] + magic
      
print(dp[-1])

Measured memory_bytes: 74564
/*
 _____ _             _              _           _ 
|_   _| |__   ___   / \   _ __  ___| |__  _   _| |
  | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  | | | | | |  __// ___ \| | | \__ \ | | | |_| | |
  |_| |_| |_|\___/_/   \_\_| |_|___/_| |_|\__,_|_|                                                

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll,ll>
#define msi         map<string,ll>
#define mis         map<ll, string>
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x) 	for(auto& a : x)
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define max(a,b)	(a>b?a:b)
#define min(a,b)	(a<b?a:b)

/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace __gnu_pbds;
using namespace std;
#define PI 3.141592653589793
#define N  100005

void solve()
{
	string s;
	cin>>s;
	ll n=s.length();
	s='#'+s;
	bool f=1;
	rep(i,1,n+1)
	{
		if(s[i]!=s[n-i+1])
			f=0;
	}
	rep(i,1,(n-1)/2+1)
	{
		if(s[i]!=s[(n-1)/2+1-i])
			f=0;
	}
	rep(i,(n+3)/2,n+1)
	{
		if(s[i]!=s[n-i+1])
			f=0;
	}
	cout<<(f?"Yes":"No")<<endl;
	return;
}
int main()
{
	FAST
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	TIME
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
string day[] = {"Satur","Sun","Mon","Tues","Wednes","Thurs","Fri"};
int main(){
	int m, d, h;
	while (cin >> m >> d, m) {
		h = d + (26 * m + (m < 3 ? 1418 : 1126)) / 10;
		cout << day[h % 7] + "day\n";
	}
}

Measured memory_bytes: 1176