akhauriyash/Code-Regression huggingface dataset:
n=int(input())

c=0
flag=0
for i in range(n):
  a,b = map(int,input().split())
  if(a==b):
    c+=1
  else:
    c=0
  if(c==3):
    print("Yes")
    flag=1
    break
if(flag==0):
  print("No")

Measured memory_bytes: 9180
#include <stdio.h>
int main()
{
    char a,b;
    while(scanf("%c %c",&a,&b)==2)
    {
        if(a=='H'&&b=='H')printf("H\n");
        else if(a=='H'&&b=='D')printf("D\n");
        else if(a=='D'&&b=='D')printf("H\n");
        else if(a=='D'&&b=='H')printf("D\n");
        getchar();
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int a,b,c;
  cin>>a>>b>>c;
  int ans;
  if(a >= b && a >= c) {
    ans = a  * 10 + b + c;
  } else if(b >= a && b >= c) {
    ans = b * 10 + c + a;
  } else{
    ans = c * 10 + a + b;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
typedef long long ll;
const long long INF = 1LL << 60;


int main(){
 int n,m;
 cin>>n>>m;
 ll ans=1;
 ll MOD=1000000007;
  for(int i=1;i<=n;i++){
    ans=ans*i%MOD;
  }
  for(int i=1;i<=m;i++){
    ans=ans*i%MOD;
  }
 if(abs(n-m)>1) cout<<0<<endl;
 else if(abs(n-m)==1) {
  cout<<ans<<endl;
 }
 else {
   cout<<ans*2%MOD<<endl;
 }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline T read(){
	T f=0,x=0;char c=getchar();
	while(!isdigit(c)) f=c=='-',c=getchar();
	while(isdigit(c)) x=x*10+c-48,c=getchar();
	return f?-x:x;
}
namespace run{
	const int N=6e5+9,mod=924844033;
	inline int add(int x,int y){return x+y>=mod?x-mod+y:x+y;}
	inline int sub(int x,int y){return x>=y?x-y:x+mod-y;}
	inline int qpow(int x,int y){
		int ret=1;
		while(y){
			if(y&1) ret=1LL*x*ret%mod;
			x=1LL*x*x%mod,y>>=1;
		}
		return ret;
	}

	int rev[N],limit,bit,Gi=qpow(5,mod-2);
	inline void prepare(int len){
		limit=1,bit=0;
		while(limit<len) limit<<=1,bit++;
		for(int i=1;i<limit;i++)
			rev[i]=(rev[i>>1]>>1)|((i&1)<<(bit-1));
	}
	inline void NTT(int *a,int inv){
		for(int i=1;i<limit;i++)
			if(i<rev[i]) swap(a[i],a[rev[i]]);
		for(int mid=1;mid<limit;mid<<=1){
			int tmp=qpow(~inv?5:Gi,(mod-1)/(mid<<1));
			for(int i=0,R=mid<<1;i<limit;i+=R)
				for(int j=0,omega=1;j<mid;j++,omega=1LL*omega*tmp%mod){
					int x=a[i+j],y=1LL*omega*a[i+j+mid]%mod;
					a[i+j]=add(x,y),a[i+j+mid]=sub(x,y);
				}
		}
		if(inv==-1){
			inv=qpow(limit,mod-2);
			for(int i=0;i<limit;i++) a[i]=1LL*a[i]*inv%mod;
		}
	}

	int head[N],nex[N],to[N],cnt;
	inline void adde(int u,int v){
		nex[++cnt]=head[u];
		head[u]=cnt,to[cnt]=v;
	}
	int g[N],f[N],n,siz[N],num[N],fac[N],ifac[N];
	inline void dfs(int u,int _f){
		siz[u]=1;
		for(int i=head[u];i;i=nex[i]) if(to[i]^_f)
			dfs(to[i],u),siz[u]+=siz[to[i]],num[siz[to[i]]]++;
		num[n-siz[u]]++;
	}

	inline int C(int _n,int _m){
		if(_n<0 || _m<0 || _n<_m) return 0;
		return 1LL*fac[_n]*ifac[_m]%mod*ifac[_n-_m]%mod;
	}

	int main(){
		n=read<int>();
		for(int i=1;i<n;i++){
			int u=read<int>(),v=read<int>();
			adde(u,v),adde(v,u);
		}
		dfs(1,0);
		fac[0]=ifac[0]=1;
		for(int i=1;i<=n;i++) fac[i]=1LL*fac[i-1]*i%mod;
		ifac[n]=qpow(fac[n],mod-2);
		for(int i=n-1;i>=1;i--) ifac[i]=1LL*ifac[i+1]*(i+1)%mod;
	
	//	for(int i=1;i<=n;i++) cout<<num[i]<<" ";cout<<endl;	
		for(int i=1;i<=n;i++) g[n-i]=1LL*num[i]*fac[i]%mod;
		for(int i=0;i<=n;i++) f[i]=ifac[i];
		prepare(n+1+n+1-1),NTT(f,1),NTT(g,1);
		for(int i=0;i<limit;i++) f[i]=1LL*f[i]*g[i]%mod;
		NTT(f,-1);

		for(int k=1;k<=n;k++){
			int ret=1LL*n*C(n,k)%mod;
			ret=sub(ret,1LL*ifac[k]*f[n-k]%mod);
			printf("%d\n",ret);
		}
		return 0;
	}
}
int main(){
#ifdef my
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	return run::main();
}

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

int A,B,C,x;
int main(){
  int res = 0;
  cin >> A >> B >> C >> x;
  for(int a = 0; a <= A; ++a){
    for(int b = 0; b <= B; ++b){  
      for(int c = 0; c <= C; ++c){
        int total = (a*500 + b*100 + c*50);
        if(total == x) ++res;  
      }
    } 
  }
  cout << res << endl;
}

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

#define ll long long
#define NIL 0
#define INF 1e18
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vl vector<ll>
#define vvl vector<vector<ll>> 
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define pb push_back
#define F first
#define S second
#define pp pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define rpk(i,k,n) for(int i=k;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++) 
#define RPK(i,k,n) for(int i=k;i<=n;i++) 
#define ritr(i,gr) for(auto i=gr.begin();i!=gr.end();i++)

const int M = 1e9+7;

int V, E, i, j, k, u, v, x, y, p, q, r, t, n,m;
vi *g;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    cin>>n>>k;
    ll a[n+1];
    REP(i,n) cin>>a[i];
    vvl dp(n+1, vl(k+1, 0));
    REP(i,n) dp[i][0] = 1;
    REP(i,k) if(i<=a[1]) dp[1][i] = 1;
    ll psum[k+1];
    RPK(i,2,n) {
        psum[0] =1;
        REP(j,k) psum[j]= (psum[j-1]+dp[i-1][j]+M)%M;
        REP(j,k) {
            if(j>a[i]) 
                dp[i][j] += (psum[j]-psum[j-a[i]-1]+M)%M;
            else dp[i][j] += psum[j];
        }
    }   
    cout<<dp[n][k]<<endl;
}
    

Measured memory_bytes: 83192
n,d = map(int,input().split())
x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 = [],[],[],[],[],[],[],[],[],[]
all_x = [x1,x2,x3,x4,x5,x6,x7,x8,x9,x10]

import math

for i in range(n):
    all_x[i] += map(int,input().split())


t = 0
for i in range(n):
    for k in range(n):
        if i < k:
            y = 0
            for j in range(d):
                y += (all_x[i][j] - all_x[k][j])**2
            z = math.sqrt(y)
            if z - int(z) == 0:
                t += 1

print(t)

Measured memory_bytes: 3064
X, Y =map(int, input().split())
mod = 1000000007

import sys
if (X + Y) % 3 != 0:
    print(0)
    sys.exit()
offset = (X+Y)//3
X, Y = X-offset, Y-offset

if X<0 or Y<0:
    print(0)
    sys.exit()
    
X, Y = max(X, Y), min(X, Y)

def C(n, r, mod):
    num = 1
    den = 1
    for i in range(r):
        num*=n-i
        num%=mod
        den*=i+1
        den%=mod
    return (num*pow(den, mod-2, mod))%mod

print(C(X+Y, Y, mod))


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

using namespace std;

int main(){

  int n;
  string st;
  int res = n;
  unordered_set<string> s;
  cin >> n;

  for(int i = 0 ; i < n; i++){
    cin >> st;
    s.insert(st);
  }
  res = min((int)s.size(), n);
  cout << res << endl;



  return 0;

}


Measured memory_bytes: 17796
N, A, B = gets.split.map(&:to_i)
S = gets.chomp

a = 0
b = 0

S.each_char do |c|
  case c
  when 'a'
    if a + b < A + B
      puts 'Yes'
      a += 1
    else
      puts 'No'
    end
  when 'b'
    if (a + b < A + B) && (b < B)
      puts 'Yes'
      b += 1
    else
      puts 'No'
    end
  when 'c'
    puts 'No'
  end
end

Measured memory_bytes: 2428
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_ON			1										// 汎用フラグ - ON
#define D_OFF			0										// 汎用フラグ - OFF
#define D_LIGHT_MAX		10										// 最大電球数
#define D_SW_MAX		10										// 最大スイッチ数

// 内部構造体 - 電球情報
typedef struct Light {
	int mi1Sw[D_SW_MAX];										// スイッチ
	int miSCnt;													// スイッチ数
	int miP;													// 点灯条件
} Light;

// 内部変数
static FILE *szpFpI;											// 入力
static int siSCnt;												// スイッチ数
static Light sz1Light[D_LIGHT_MAX];								// 電球
static int siLCnt;												// 電球数
static int siPCnt;												// パターン数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// 出力
int
fOut(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// スイッチ - 選択
int
fSelSw(
	int piSNo					// <I> スイッチ 0～
	, int *pipSw				// <I> 選択スイッチ
)
{
	int i, j;

	// 選択中
	if (piSNo < siSCnt) {

		// スイッチ - ON
		pipSw[piSNo] = D_ON;
		fSelSw(piSNo + 1, pipSw);

		// スイッチ - OFF
		pipSw[piSNo] = D_OFF;
		fSelSw(piSNo + 1, pipSw);

		return 0;
	}

	// 点灯 - チェック
	for (i = 0; i < siLCnt; i++) {
		int liCnt = 0;
		for (j = 0; j < sz1Light[i].miSCnt; j++) {
			if (pipSw[sz1Light[i].mi1Sw[j]] == D_ON) {
				liCnt++;
			}
		}
		if (liCnt % 2 != sz1Light[i].miP) {
			return 0;
		}
	}

	// パターン数
	siPCnt++;

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i, j;
	char lc1Buf[1024];

	// スイッチ数・電球数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d", &siSCnt, &siLCnt);

	// 電球 - スイッチ - 取得
	for (i = 0; i < siLCnt; i++) {
		fscanf(szpFpI, "%d", &sz1Light[i].miSCnt);
		for (j = 0; j < sz1Light[i].miSCnt; j++) {
			fscanf(szpFpI, "%d", &sz1Light[i].mi1Sw[j]);
			sz1Light[i].mi1Sw[j]--;
		}
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	}

	// 電球 - 点灯条件 - 取得
	for (i = 0; i < siLCnt; i++) {
		fscanf(szpFpI, "%d", &sz1Light[i].miP);
	}
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);

	// スイッチ - 選択
	int li1Sw[D_SW_MAX];
	fSelSw(0, li1Sw);

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// データ - 初期化
	siPCnt = 0;													// パターン数

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	sprintf(lc1Buf, "%d\n", siPCnt);
	fOut(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 128
//#include<bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <list>
#include <climits>
#include <bitset>

/*
Not easy to be successful,Dont give up
*/

using namespace std;
#define all(v)          ((v).begin()), ((v).end())
#define pb push_back
#define Compiler_Beso ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define clr(v,d)        memset(v, d, sizeof(v))
#define endl '\n'
const double EPS = 1e-12;
typedef long long ll;
const double PI = 3.14159265359;
enum dir       { DOWN = 0, UP, RIGHT, LEFT, DOWN_RIGHT, DOWN_LEFT, UP_RIGHT, UP_LEFT };
int  dir_r[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int  dir_c[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
map<char, int>m;
int main()
{
	Compiler_Beso


		int n;
	string s;
	cin >> n >> s; 
	string a, b;
	b = s;
	int mx = 0;
	for (int i = 1; i < n; i++){
		a += s[i - 1];
		b[a.size()-1] = 'Z';
		m[a[a.size() - 1]] = 1;
		map<char, int>mp;
		int ans = 0;
		for (int k = 0; k < b.size(); k++){
			if (!mp[b[k]])
				ans += m[b[k]];
			mp[b[k]] = 1;
		}
		mx = max(mx, ans);
	}
	cout << mx;
	return 0;
}

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


ll memo[20001][20001]; //各点の最短距離を記録したもの

int main()
{
    ll n;
    ll x;
    ll y;
    cin >> n >> x >> y;
    x--;
    y--;
    
    rep(i, n)
    {
        rep(j, n)
        {
            memo[i][j] = -1;
        }
    }
    rep(i, n - 1)
    {
        
        memo[i][i] = 0;
        memo[i][i + 1] = 1;
        memo[i + 1][i] = 1;
    }
    memo[n - 1][n - 1] = 0;
    memo[x][y] = 1;
    memo[y][x] = 1;

     for (ll k = 2; k < n; k++)
    {
        for (ll i = 0; i < n - 2; i++)
        {
          if (memo[i][i+k]!=-1){
          continue;
          }


            ll p = min(memo[i][i + k-1], memo[i+1][i + k]);
            ll j=labs(i-x)+labs(i+k-y);
            ll h=labs(i-y)+labs(i+k-x);
            ll g=min(p + 1,j+1);
            
          memo[i][i + k] = min(g,h+1);
            memo[i + k][i] = min(g,h+1);
        }
    }
    map<ll, ll> score;
    rep(i, n)
    {
        rep(j, n)
        {
            score[memo[i][j]] += 1;
          
        }
   
    
    }
  
 rep(i, n - 1)
    {
        cout << score[i+1]/2 << endl;
    }
}

Measured memory_bytes: 311936
n = int(input())

a = []
b = []

for i in range(n):
    k = int(input())
    if k % 10 == 0:
        a.append(k)
    else:
        b.append(k)

if len(b) == 0:
    print(0)
else:
    b.sort()
    su = sum(a) + sum(b)
    if su % 10 == 0:
        su -= b[0]
    print(su)


Measured memory_bytes: 38384
#include <iostream>
#include <string.h>
#include <cmath>
using namespace std;

int n;
int a[5000];

int main()
{
	cin >> n;

	memset(a, 0, sizeof(a));

	int t = 0;

	for (int i = 2; i <= 55555; i++) {
		bool f = 0;
		for (int j = 2; j <= sqrt(i); j++) {
			if (i % j == 0) {
				f = 1;
				break;
			}
		}
		if (!f && (i % 5 == 2)) {
			a[t] = i;
			t++;
		}
	}

	for (int i = 0; i < n - 1; i++)
		cout << a[i] << " ";
	cout << a[n - 1] << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.*;

public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = reader.readLine();
            String[] num = line.split(" ", -1);
            int a = Integer.parseInt(num[0]);
            int b = Integer.parseInt(num[1]);
            int c = Integer.parseInt(num[2]);
            if (a <= b && b <= c && a <= c) {
                int x = a;
                int y = b;
                int z = c;
                System.out.println(x + " " + y + " "  + z);
            } else if (a <= b && b >= c && a <= c) {
                int x = a;
                int y = c;
                int z = b;
                System.out.println(x + " " + y + " "  + z);
            } else if (a >= b && b <= c && a <= c) {
                int x = b;
                int y = a;
                int z = c;
                System.out.println(x + " " + y + " "  + z);
            } else if (a <= b & b >= c && a >= c) {
                int x = c;
                int y = a;
                int z = b;
                System.out.println(x + " " + y + " "  + z);
            } else if (a >= b && b <= c && a >= c) {
                int x = b;
                int y = c;
                int z = a;
                System.out.println(x + " " + y + " "  + z);
            } else if (a >= b && b >= c && a >= c) {
                int x = c;
                int y = b;
                int z = a;
                System.out.println(x + " " + y + " "  + z);
            }
        } catch (IOException e) {
            System.out.println(e);
        } catch (NumberFormatException e) {
            System.out.println("error");
        }
    }
}

Measured memory_bytes: 24352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////

int main(){
    ll k,x;cin>>k>>x;
    if(k*500>=x){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
    
    
    return 0;
}


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

#include <iostream>
#include <fstream>

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>

using namespace std;

#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i,1,n)
#define REP(i,n) FOR(i, 0, (int)(n)-1)
#define fst first
#define snd second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}



void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

int XMOV[4] = {0, 0, 1, -1};
int YMOV[4] = {1, -1, 0, 0};

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using namespace std;

class CMaximalValue {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n;
		in >> n;

		int b[101];
		for (int i = 0; i < n-1; i++)
			in >> b[i];

		int a[101];
		a[0] = b[0];
		a[n-1] = b[n-2];
		ll sum = b[0]+b[n-2];
		for (int i = 1; i < n-1; i++){
			a[i] = min(b[i-1], b[i]);
			sum += a[i];
		}

		out << sum;



	}
};

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n[2];
	while(cin>>n[0]>>n[1],n[0],n[1]){
		int num[2][101],sum[2]={};
		for(int i=0;i<2;i++){
			for(int j=0;j<n[i];j++){
				cin>>num[i][j];
				sum[i]+=num[i][j];
			}
			sort(num[i],num[i]+n[i]);
		}
		int ans[2]={101,101};
		for(int i=0;i<n[0];i++){
			int now[2]={sum[0]-num[0][i],sum[1]+num[0][i]};
			for(int j=0;j<n[1];j++){
				if(now[0]+num[1][j]==now[1]-num[1][j]){
					if(num[0][i]+num[1][j]<ans[0]+ans[1]){
						swap(num[0][i],ans[0]);
						swap(num[1][j],ans[1]);
					}
					break;
				}
			}
		}
		if(ans[0]==101)cout<<-1<<endl;
		else cout<<ans[0]<<" "<<ans[1]<<endl;
	}
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
#define RI register int
using namespace std;

inline int in()
{
	int aa=0,ff=1;char cc=getchar();
	for(;!isdigit(cc);cc=getchar())if(cc=='-')ff=-1;
	for(;isdigit(cc);cc=getchar())aa=(aa<<3)+(aa<<1)+(cc&15);
	return aa*ff;
}

string s;
bool C=0,F=0;

int main()
{
	cin>>s;
	int l=s.length();
	for(int i=0;i<l;++i)
	{
		if(s[i]=='C')
		{
			for(int j=i+1;j<l;++j)
			{
				if(s[j]=='F')
				{
					puts("Yes");
					return 0;
				}
			}
		}
	}
	puts("No");
	
	return 0;
}

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

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int, int>
#define all(x) x.begin(), x.end()
#define Matrix vector<vector<int>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = ((int64_t)2e18);
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 3;

int p5(int x) {
  int ans = 1;
  for (int i = 0; i < 5; ++i)
    ans *= x;
  return ans;
}

signed main() {

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

  int t;

  // cin >> t;
  t = 1;

  while (t--) {
    int n;
    cin >> n;

    for (int i = -4000; i <= 4000; ++i) {
      for (int j = -4000; j <= 4000; ++j) {
        if (p5(i) - p5(j) == n)
          return cout << i << ' ' << j << endl, 0;
      }
    }
  }
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;

    

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    if(n >= 30) cout << "Yes";
    else cout  << "No";

    return 0;
}


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

public class Main {

	// Atcoder用のサンプルプログラム
	public static void main(String[] args) {
		String line = "";
		try {
			line = readLine();

			StringTokenizer st = new StringTokenizer(line, " ");
			String tempK = st.nextToken();
			String tempS = st.nextToken();

			int k = Integer.parseInt(tempK);
			int s = Integer.parseInt(tempS);
			int cnt = 0;

			int result=0;
			if (k -s >= 0) {
				result=k-s;
			} else {
				result=0;
			}
			System.out.println(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private static String readLine() throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		return br.readLine();
	}

}


Measured memory_bytes: 20692
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    sm = 0
    pl = []
    for i in range(n):
        x,y = map(int,ipt().split())
        pl.append((x,y))
    nm = 0
    for i in range(n):
        xi,yi = pl[i]
        for j in range(i+1,n):
            xj,yj = pl[j]
            sm += math.sqrt((xj-xi)**2+(yj-yi)**2)
            nm += 1
    print(sm/nm*(n-1))



    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 75024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define loop(i, a, b) for(ll i = a; i < b; i++)
#define rloop(i, e, s) for(ll i = e; i >= s i--)
#define mod 1000000007
#define pb push_back

bool comp(pair<pair<string, int> , int> x, pair<pair<string, int> , int> y)
{
    if(x.first.first < y.first.first) return true;
    if(x.first.first==y.first.first) return x.first.second > y.first.second;
    return false;
}

int main()
{
    int n;
    cin >> n;
    vector<pair<pair<string, int> , int> > v(n);
    loop(i, 0, n){
        cin >> v[i].first.first >> v[i].first.second;
        v[i].second = i+1;
    }
    sort(v.begin(), v.end(), comp);
    for(auto p : v) {
        cout << p.second << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	int n, m; cin >> n >> m;
	cout << n * (n - 1) / 2 + m * (m - 1) / 2;
}

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

typedef long long ll;

int main () {
	int N;
	ll D;
	int cnt = 0;
	cin >> N >> D;
	D = D*D;
	for (int i=0; i<N; i++) {
		ll x, y;
		cin >> x >> y;
		if (x*x+y*y<=D)
			cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3628
def main():
    N, M = map(int, input().split())
    l = [-1] * N
    for i in range(M):
        s, c = map(int, input().split())
        if l[s-1] == -1 or l[s-1] == c:
            l[s-1] = c
        else:
            print('-1')
            return
    if N > 1 and l[0] == -1:
        l[0] = 1
    l = [0 if i == -1 else i for i in l]
    if N > 1 and l[0] == 0:
        print('-1')
        return
    print(''.join(str(i) for i in l))
main()


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

#define MAXN 500*1000

map<pair<int, int>, int> id;

vector<int> g[MAXN], topo;
int color[MAXN], dp[MAXN];

bool dfs(int u) {
	color[u] = 1;
	
	for(int v : g[u]) {
		if(color[v] == 1) {
			return false;
		} else if(color[v] == 0) {
			if(!dfs(v)) {
				return false;
			}
		}
	}
	
	color[u] = 2;
	topo.push_back(u);
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	int t = 0;
	for(int i = 0; i < n; i++) {
		vector<int> nodes;
		for(int j = 0; j < n-1; j++) {
			int u = i+1, v;
			cin >> v;
			if(u > v) swap(u, v);
			pair<int, int> p = {u, v};
			if(id.count(p) == 0) {
				id[p] = t++;
			}
			nodes.push_back(id[p]);
		}
		for(int j = 1; j < (int) nodes.size(); j++) {
			g[nodes[j-1]].push_back(nodes[j]);
		}
	}
	
	for(int i = 0; i < t; i++) {
		if(color[i] == 0) {
			if(!dfs(i)) {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	
	int ans = 0;
	for(int u : topo) {
		dp[u] = 1;
		for(int v : g[u]) {
			dp[u] = max(dp[u], dp[v] + 1);
		}
		ans = max(ans, dp[u]);
	}
	
	cout << ans << endl;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> d(N);
    for(int i=0; i<N; i++) cin >> d[i];
    sort(d.begin(), d.end());
    d.erase(unique(d.begin(), d.end()), d.end());
    cout << d.size() << endl;
}

Measured memory_bytes: 256
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    s = II()
    a = s
    aset = set([a])
    cnt = 1
    while True:
        if a%2==0: a=a//2
        else: a=3*a+1
        if a in aset: break
        else: aset.add(a)
        cnt += 1
    print(cnt+1)

if __name__ == '__main__':
    main()


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

int main() {
	int N, M;
	cin >> N >> M;
	vector<string> A(N);
	rep(i, N) cin >> A.at(i);
	vector<string> B(M);
	rep(i, M) cin >> B.at(i);
	rep(i, N - M + 1) {
		rep(j, N - M + 1) {
			bool flag = true;
			rep(k, M) {
				rep(l, M) {
					if (A.at(i + k).at(j + l) != B.at(k).at(l)) flag = false;
				}
			}
			if (flag == true) {
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
	return 0;
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  if (n % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }
  else {
    bool flg = true;
    for (int i = 0;i < n / 2; i++) {
      if (s.at(i) != s.at(i + n/2))  flg = false;
    }
    cout << (flg ? "Yes" : "No") << endl;
  }
}

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

int main()
{
  int N;
  cin >> N;
  while(N--) {
    int R, T;
    cin >> R >> T;
    int base = T / 30 * 5 + R / 100;
    if(R % 100 == 0 && T % 30 == 0) {
      cout << base << endl;
    } else if(R % 100 == 0) {
      cout << base << " " << base + 5 << endl;
    } else if(T % 30 == 0) {
      cout << base << " " << base + 1 << endl;
    } else {
      cout << base << " " << base + 1 << " " << base + 5 << " " << base + 6 << endl;
    }
  }
}

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

int main()
{
	int n;
	int a[100000];
	int count = 0;
	int light = 1;

	cin >> n;

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

	for (int i = 0; i < n; ++i)
	{
		light = a[light];
		count++;
		if (light == 2)
		{
			break;
		}
	}

	if (count != n)
	{
		cout << count << endl;
	} else {
		cout << -1 << endl;
	}

	return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[15];
int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%s",s);
	if(s[0]!='A') {
		puts("WA");
		return 0;
	}
	int x=0;
	for(int i=0;i<strlen(s);i++) {
		if(s[i]=='C'&&i>1&&i<strlen(s)-1)
			x++;
		else if(i!=0&&'A'<=s[i]&&s[i]<='Z') {
			puts("WA");
			return 0;
		}
	}
	if(x!=1) {
		puts("WA");
		return 0;
	}
	puts("AC");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdio>
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <cstring>
#include <string>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <iterator>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
const int INF = 0x3f3f3f3f;

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

int N, M;
char arr[1100][1100];
int dp[1100][1100];

const int MOD = 1e9+7;

int main(){
    scanf("%d%d", &N, &M);
    for (int i = 1; i <= N; i++){
        for (int j = 1; j <= M; j++){
            cin >> arr[i][j];
        }
    }
    dp[1][1] = 1;
    for (int i = 1; i <= N; i++){
        for (int j = 1; j <= M; j++){
            if (arr[i][j] == '#') continue;
            dp[i][j] += dp[i-1][j];
            dp[i][j] += dp[i][j-1];
            dp[i][j] %= MOD;
        }
    }
    printf("%d", dp[N][M]);
}


Measured memory_bytes: 8980
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
 
 
 
void solve(){
    string s;
    cin>>s;
    cout<<s.substr(0,5)<<" "<<s.substr(6, 7)<<" "<<s.substr(14, 5)<<endl;
}
 
signed main(){
    //while(1)
    solve();
}

Measured memory_bytes: 256
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
#======================================================#
def main():
    a, b, c = MII()
    k = II()
    while a >= b and k > 0:
        b *= 2
        k -= 1
    while b >= c and k > 0:
        c *= 2
        k -= 1

    if a < b and b < c:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 9200
#include <cstdio>

int main()
{
  int n;
  int p;
  scanf("%d", &n);
  int w = 0;
  for (int i = 0; i < n; ++i)
  {
    scanf("%d", &p);
    if (i + 1 != p)
    {
      ++w;
    }
  }
  puts(w <= 2 ? "YES" : "NO");
  return 0;
}

Measured memory_bytes: 128
n=int(input())
p=10**9+7
a=list(map(int,input().split()))
bit=[0]*61
for i in range(n):
    b=bin(a[i])[2:].zfill(61)
    for j in range(61):
        if b[j]=="1":
            bit[j]+=1
ans=0
for i in range(61):
    x=bit.pop()
    ans+=x*(n-x)*(2**i)%p
print(ans%p)

Measured memory_bytes: 124680
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	long N;
	cin >> N;
	
	vector<long> a(N + 1);
	for (int i = 0; i < N; i++)
	{
		cin >> a[i + 1];
	}
	
	vector<long> b(N + 1);
	
	// 大きい倍数から処理する
	for (long i = N; i >= 1; i--)
	{
		long sum = 0;
		
		// i以外の倍数をの総和
		for (int j = i + i; j <= N; j += i)
		{
			sum += b[j];
		}
		
		sum %= 2;
		// ボールの総数を2で割った余りの数がa[i]でない場合に
		if (sum != a[i])
		{
			// 現在のiの箱にボールをいれます。
			b[i] = 1;
		}
	}
	
	vector<long> answer;
	
	// 1の倍数からNの倍数の箱
	for (long i = 1; i <= N; i++)
	{
		// ボールがある場合
		if (b[i])
		{
			// ボールを入れる箱に書かれた整数を格納する
			answer.push_back(i);
		}
	}
	
	// 出力
	cout << answer.size() << endl;
	for (int i = 0; i < answer.size(); i++)
	{
		cout << answer[i] << " ";
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 4980
#include <bits/stdc++.h>
#define INF (1LL<<60)
#define MOD7 1000000007LL
#define PREP(i, s, x) for(ll i = (s); i < (x); i ++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i --)
#define REP(i, x) PREP(i, 0, x)
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;
template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return 1;}return 0;}

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

ll llpow(ll a, ll n){
    ll res = 1;
    while(n > 0){
        if(n & 1)
            res = res * a % MOD7;
        a = a * a % MOD7;
        n >>= 1;
    }
    return res;
}

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> kumi(k+10, 0);
    for (ll p = k; p >= 1; p --){
        if(p == 0){
            continue;
        }
        ll a = k / p;
        ll mimi = 0;
        for(ll i = 2 * p; i <= k; i += p){
            mimi += kumi[i];
            mimi %= MOD7;
        }
        kumi[p] = (llpow(a, n) - mimi) % MOD7;
        kumi[p] %= MOD7;
        if(kumi[p] < 0){
            kumi[p] += MOD7;
        }
    }

    ll ans = 0;
    for (ll i = 1; i <= k; i ++){
        ans += (kumi[i] * i) % MOD7;
        ans %= MOD7;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3972
import numpy as np

a_list = list(map(int, input().split()))
a_list_2 = list(map(int, input().split()))
a_list_3 = list(map(int, input().split()))

a_total_list = np.array([a_list, a_list_2, a_list_3])
bingo_array = np.zeros((3, 3))

N = int(input())

b_list = []

for i in range(N):
    b = int(input())
    if b in a_total_list:
        bingo_array[np.where(a_total_list == b)[0][0]][np.where(a_total_list == b)[1][0]] = 1

bingo_x_y = 0
break_flag = False
for i in range(3):
    if break_flag is True:
        break
    else:
        bingo_x = 0
        bingo_y = 0
    for j in range(3):
        if bingo_array[i][j] == 1:
            bingo_x += 1
            if bingo_x == 3:
                break_flag = True
                break
        if bingo_array[j][i] == 1:
            bingo_y += 1
            if bingo_y == 3:
                break_flag = True
                break
        if i == j:
            if bingo_array[i][j] == 1:
                bingo_x_y += 1
                if bingo_x_y == 3:
                    break_flag = True
                    break

if bingo_x >= 3:
    print("Yes")
    exit()
elif bingo_y >= 3:
    print("Yes")
    exit()
elif bingo_x_y >= 3:
    print("Yes")
    exit()
elif bingo_array[0][2] == 1 and bingo_array[1][1] == 1 and bingo_array[2][0] == 1:
    print("Yes")
    exit()
else:
    print("No")
    exit()

Measured memory_bytes: 12516
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main()
{
    int h;
    cin>>h;
    int w;
    cin>>w;
    vector<string> a(h);
    for(int i =0; i<h; i++)
    {
        cin>>a[i];
    }
    vector<bool> row(h,false);
    vector<bool> col(w,false);
    for(int i=0; i<h; i++ )
    {
        for(int j=0; j<w; j++)
        {
            if(a[i][j]=='#')
            {
                row[i]=true;
                col[j]=true;
            }
        }
    }

    for(int i=0; i<h; i++)
    {
        if(row[i])
        {
            for(int j=0; j<w; j++)
            {
                if(col[j])
                {
                    cout<<a[i][j];
                }
            }
            cout<<endl;
        }
    }
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define MSGF(x, n) MSG(fixed << setprecision(n) << x)
#define END(x) cout << x << endl; exit(0);
#define IPT(v, n) REP(i, 0, n){ cin >> v[i]; }
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
const static ll INF = 1 << 30;

ll a, b, c, d, k, l, m, n, h, w, q, x, y;
string s, t;

ll ans = 0;
ll sum = 0;
ll cnt = 0;
ll tmp = 0;
ll mini = INF;
ll maxi = 0;

double ave = 0.0;

int main() {
    cin >> n;
    ll t_this, a_this, t_act, a_act;
    NREP() {
        cin >> t_this >> a_this;
        if (i == 0) {
            t_act = t_this;
            a_act = a_this;
            continue;
        }

        ll t_rat = (t_act + t_this - 1) / t_this;
        ll a_rat = (a_act + a_this - 1) / a_this;
        t_act = t_this * max(t_rat, a_rat);
        a_act = a_this * max(t_rat, a_rat);
    }
    MSG(t_act + a_act)
}


Measured memory_bytes: 256
import numpy as np

a, b, h, m = map(int, input().split())

alpha = 360 * (h / 12) + 30 * (m / 60)
beta = 360 * (m / 60)
sa = abs(alpha - beta)

ans = np.sqrt(a ** 2 + b ** 2 - 2 * a * b * np.cos(2 * np.pi * (sa / 360)))
print(ans)



Measured memory_bytes: 27216
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5+5;

int n, m, p[N], marked[N];
vector<int> adj[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for(int i=0; i<m; i++) {
        int u, v; cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    queue<int> q;
    marked[1] = 1;
    q.push(1);
    while(!q.empty()) {
        int v = q.front(); 
        q.pop();
        for(int w : adj[v]) {
            if(marked[w])   continue;
            marked[w] = 1; 
            p[w] = v; 
            q.push(w);
        }
    }
    cout << "Yes\n";
    for(int v=2; v<=n; v++) {
        cout << p[v] << "\n";
    }
}


Measured memory_bytes: 13316
#include <stdio.h>
int main(void) {
    int l1,l2,l3,num,fr,temp,i;
    double rad;
    while (1) {
        scanf("%d %d %d",&l1,&l2,&l3);
        if (l1==0&&l2==0&&l3==0) break;
        if (l1>l2) {
            temp=l1;
            l1=l2;
            l2=temp;
        }
        if (l2>l3) {
            temp=l2;
            l2=l3;
            l3=temp;
        }
        rad=(l1*l1+l2*l2)/4.0;
        scanf("%d",&num);
        for (i=0; i<num; i++) {
            scanf("%d",&fr);
            if (rad<1.0*fr*fr) {
                printf("OK\n");
            } else {
                printf("NA\n");
            }
        }
    }
    return 0;
}

Measured memory_bytes: 584
#include<stdio.h>
int main(void)
{
	int a;
	int b;
	int c;
	
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	
	if(a<b && b<c){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	
	
	return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll X,Y;
    cin >> X >> Y;
    if(X % Y == 0){
        cout << "-1" << endl;
    } else {
        cout << X << endl;
    }
}

Measured memory_bytes: 3548
//二次元幾何ライブラリ
#include <iostream>
#include <cstdio>
#include <complex>
#include <map>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define MC make_pair
#define ML make_pair 
#define X real()
#define Y imag()
typedef double D;
typedef bool B;
typedef complex<D> P;   //点
typedef complex<D> V;   //ベクトル
typedef pair<P,P>  L;   //直線
typedef pair<P,D>  C;   //円
typedef vector<P>  Pol; //多角形

//変数名定義
const D INF = 1e100;
const D EPS = 1e-8;
const D PI = acos(-1);

template<class T> bool operator==(T a, T b){return abs(a - b )< EPS;}
template<class T> int sig(T r) {return (r==0||r==-0) ? 0 : r > 0 ? 1 : -1;}

P points[4];

// ベクトルaの絶対値を求める
// D Length = abs(a);

// 2点a,b間の距離を求める
// D Distance = abs(a-b); 

// 内積 (Inner Product) : a・b = |a||b|cosθ 1
D IP(V a, V b) {
	return (a.real() * b.real() + a.imag() * b.imag());
}

// 外積 (Exterior Product) : |a×b| = |a||b|sinθ 2
D EP(V a, V b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}

// 点の進行方向について 3
int ccw(P a, P b, P c) {              //点aと点bが与えられた問いに
  b -= a; c -= a;
  if (EP(b, c) > 0)   return +1;      // counter clockwise
  if (EP(b, c) < 0)   return -1;      // clockwise
  if (IP(b, c) < 0)     return +2;    // c--a--b on line
  if (norm(b) < norm(c)) return -2;   // a--b--c on line
  return 0;                           // a--c--b on line  aとbの線分判定はこれ
}

int main(void){
	char tmp;
	while(true){
		cin >> points[0].X >> tmp >> points[0].Y;
		if(cin.eof())
			break;
		rep(i,3)
			cin >> tmp >> points[i+1].X >>tmp >> points[i+1].Y ;
		int dir;
		bool flag=true;
		dir=ccw(points[0],points[1],points[2]);
		rep(i,4){
			int cur=ccw(points[i%4],points[(i+1)%4],points[(i+2)%4]);
			if(cur != dir)
				flag=false;
		}
		if(flag)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
str = input()
mae = str[0:2]
ato = str[2:4]

month = ["01","02","03","04","05","06","07","08","09","10","11","12"]
if mae in month:
  if ato in month:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if ato in month:
    print("YYMM")
  else:
    print("NA")

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Solve.Answer();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    static class Solve
    {
        public static void Answer()
        {
            var NK = IO_ShortCut.ReadSplitLong;
            var N = NK[0];
            var K = NK[1];

            var mod = N % K;
            WriteLine(mod >= K - mod ? K - mod : mod);
        }
    }

    static class IO_ShortCut
    {
        #region Input
        public static string ReadString => ReadLine();
        public static int ReadInt => int.Parse(ReadLine());
        public static long ReadLong => long.Parse(ReadLine());
        public static double ReadDouble => double.Parse(ReadLine());

        public static List<string> ReadSplitString => ReadLine().Split().ToList();
        public static List<int> ReadSplitInt => ReadLine().Split().Select(s => int.Parse(s)).ToList();
        public static List<long> ReadSplitLong => ReadLine().Split().Select(s => long.Parse(s)).ToList();
        public static List<double> ReadSplitdouble => ReadLine().Split().Select(s => double.Parse(s)).ToList();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        #endregion
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 998244353LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}
};
ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x %mod;
		x = x * x%mod;
		n >>= 1;
	}
	return res;
}
typedef vector<vector<Edge>> Graph;


signed main(void) {
	int n,k;
	cin >> n >> k;

	cout << max(0,n-k + 1)<< endl;
	return 0;
}


Measured memory_bytes: 256
from math import sqrt 

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

n,d =map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in range(n):
  for j in range(i+1,n):
    dis=0
    for k in range(d):
      dis+=(x[i][k]-x[j][k])**2
    if is_integer(sqrt(dis)):
      cnt+=1
print(cnt)



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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#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())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a);i>(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1000000000;
const LL MOD = 1000000007;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

int main() {
  int N, ans=0;
  cin >> N;
  int M=N;
  int k=1;
  while(N>=10) {
    N /= 10;
    k++;
  }
  int l = k/2;
  int m=1;
  REP(i,l) {
    ans += m*9;
    m *= 100;
  }
  if (k%2) {
    ans += M - m +1;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256