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

int main(){
    int N;
    cin>>N;
    vector<string> blues(N);
    for(int i=0;i<N;++i)cin>>blues[i];
    
    int M;
    cin>>M;
    vector<string> reds(M);
    for(int i=0;i<M;++i)cin>>reds[i];
    
    int maxInc=0;
    for(int i=0;i<N;++i){
        int result=0;
        for(int j=0;j<N;++j)
            if(blues[i]==blues[j])++result;
        for(int j=0;j<M;++j)
            if(blues[i]==reds[j])--result;
        maxInc=max(maxInc,result);
    }
    cout<<maxInc<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

int MOD_BIG = 1000000007;
int MOD_BIG2 = 998244353;
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////

//////////////////////////////////////

int main() {
    
    int K;
    cin >> K;
    vector<ll> A(K);
    REP(i, K) cin >> A[i];
    
    ll max = 2, min = 2;
    IREP(i, K) {
        ll test = ((min / A[i])) * A[i];
        if (test < min) test += A[i];
        min = test;
        test = ((max / A[i])) * A[i];
        if (test <= max) test += A[i];
        max = test - 1;
        //cerr << max << ", " << min << endl;
        if (max < min) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << min << " " << max << endl;
    
    return 0;
}


Measured memory_bytes: 3996
import sys
import numpy as np

def dijk(edge_list, start):
    checked = []
    queue = []
    dist = [100000 for i in range(10)]
    dist[start] = 0
    queue.append(start)
    while len(queue) != 0:
        index = np.argmin(list(map(lambda x: dist[x], queue)))
        node = queue.pop(index)
        checked.append(node)
        for child in edge_list[node]:
            dist[child[0]] = min(dist[child[0]], child[1] + dist[node])
            if (child[0] not in queue) and (child[0] not in checked):
                queue.append(child[0])
    return dist

H, W = list(map(int, sys.stdin.readline().strip().split(" ")))

edge_list = []
for i in range(10):
    l = list(map(int, sys.stdin.readline().strip().split(" ")))
    ll = []
    for j in range(10):
        ll.append((j, l[j]))
    edge_list.append(ll)

cost = []
for i in range(10):
    cost.append(dijk(edge_list, i)[1])

res = 0
for i in range(H):
    input_list = list(map(int, sys.stdin.readline().strip().split(" ")))
    res += np.sum(list(map(lambda x: 0 if (x == -1) else cost[x], input_list)))

print(res)


Measured memory_bytes: 21292
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int A[] = new int[100];
        int N = sc.nextInt();
        for(int i=0; i<N; i++){
            A[i] = sc.nextInt();
        }
        int flag = 1, t, minj = 0, change = 0;
        boolean dif = false;
        for(int i=0; i<=N-1; i++){
            minj = i;
            for(int j=i; j<=N-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    dif = true;
                }
            } 
            t = A[i];
            A[i] = A[minj];
            A[minj] = t;
            if(dif){
                change++;
                dif = false;
            }
        }
        for(int j=0; j<N; j++)  {
            System.out.print(A[j]);
            if(j != N-1) System.out.print(" ");
        }
        System.out.println("\n" + change);
    }
}


Measured memory_bytes: 26332
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll N, W;
    cin >> N >> W;
    vector<ll> v(N), w(N);
    rep(i, N) cin >> v[i] >> w[i];
    ll dp[11000];
    memset(dp, 0, sizeof(dp));
    rep(i, W+1) rep(j, N) {
        chmax(dp[i + w[j]], dp[i] + v[j]);
    }
    cout << dp[W] << endl;
}



Measured memory_bytes: 3176
#include<bits/stdc++.h>
#define INF 2147483647
#define SYOU(x) setprecision(x)
using namespace std;
long long i[300000];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=1,f=0;
  cin >>a>>b>>c;
  a+=b;
  cout <<a*c/2<<'\n';
  return (0);
}



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

int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	int count[n+1] ={0};
	for(int i = 0; i < n; i++){
		if(s[i] == 'W') count[i+ 1] = count[i] +1;
		else count[i+1] = count[i];
	}
	int ans = 1e9;
	for(int i = 0; i < n; ++i){
		int left_western = count[i] - count[0];
		int right_western = count[n] - count[i+1];
		int right_eastern = n - 1 - i - right_western;
		int sum = left_western + right_eastern;
		ans = min(ans, sum);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1796
A = int(input())
B = int(input())
C = int(input())
X = int(input())
pattern = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if 500 * a + 100 * b + 50 * c == X:
                pattern += 1
print(pattern)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	string s, t, r;
	int n, a, b;
	cin >> s >> n;
	for (int i = 0; i < n; i++) {
		cin >> t >> a >> b;
		if (t == "print")
			cout << s.substr(a, b - a + 1) << endl;
		else if (t == "reverse")
			reverse(s.begin() + a, s.begin() + b + 1);
		else {
			cin >> r;
			s.replace(a, b - a + 1, r);
		}
	}
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N;

int main()
{
    while (cin >> N)
    {
        if (N == 0)
            return 0;
        vector<int> a(N);
        int sum = 0, ans = 0;
        for (int i = 0; i < N; i++)
        {
            cin >> a[i];
            sum += a[i];
        }
        sum /= N;
        for (int i = 0; i < N; i++)
        {
            if (a[i] <= sum)
                ans++;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3132
#include <queue>
#include <iostream>
#include <algorithm>
#define ll long long
#define INF 100000000000000
using namespace std;

ll *par, *rk;

void init(ll n){
  n++;
  par = new ll[n];
  rk = new ll[n];
  for(ll i = 0; i < n; i++){
    par[i] = i;
    rk[i] = 0;
  }
}

ll ufind(ll x){
  if(par[x] == x)
    return x;
  return par[x] = ufind(par[x]);
}

void merge(ll x, ll y){
  x = ufind(x);
  y = ufind(y);
  if(rk[x] < rk[y]){
    par[x] = y;
  }else if(rk[x] > rk[y]){
    par[y] = x;
  }else{
    par[x] = y;
    rk[y]++;
  }
}

bool same(ll x, ll y){
  return ufind(x) == ufind(y);
}

  

int main(){
  ll n, q;
  cin >> n >> q;
  init(n);
  for(ll i = 0; i < q; i++){
    ll com, x, y;
    cin >> com >> x >> y;
    if(com == 0){
      merge(x,y);
    }else{
      if(same(x,y))
	cout << 1 << endl;
      else
	cout << 0 << endl;
    }
  }

}

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

using namespace std;
#define FAST ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.setf(ios::fixed), cout.precision(20)
#define file freopen("in.txt", "r", stdin), freopen("out.txt", "w+", stdout)
#define endl '\n'

int main() {

    //file;
    FAST;

    int a;
    cin >> a;

    if (a >= 30) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


Measured memory_bytes: 3624
# -*- coding: utf-8 -*-
# 整数入力
n = int(input())
# スペース区切りの整数の入力
w = list(map(int, input().split()))

tempDiff=0
ans=sum(w)

for i in range(len(w)-1):
    first = 0
    second = 0

    for j in range(i+1):
        first += w[j]
    for k in range(i+1,len(w)):
        second += w[k]

    tempDiff = abs(first - second)

    # print("first:{},second:{},diff:{}".format(first,second,tempDiff))

    if tempDiff < ans:
        ans = tempDiff
        
# 出力
print(ans)


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

using namespace std;

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

    p += p;
    int pos = p.find(s);
    if (pos != -1)
        cout << "Yes" <<endl;
    else
        cout << "No" << endl;
     return 0;
}

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

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<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//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 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())

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

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

int main(int argc, char const* argv[])
{
	int a,b;
	cin >> a >> b;
	int sub = b - a;
	int sum = 0;
	for (int i = 1; i < sub + 1; i++) {
		sum += i;
	}
	cout << sum - b << endl;
	return 0;
}


Measured memory_bytes: 256
from math import acos,cos,sin
pi = acos(-1)

A,B,H,M=map(int,input().split())

a = (H*60+M)/720*(2*pi)
b = M/60*(2*pi)

posA = A*cos(a),A*sin(a)
posB = B*cos(b),B*sin(b)

print(sum([(posA[i]-posB[i])**2 for i in range(2)])**.5)

Measured memory_bytes: 9320
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
int n,a[100010];
int cnt[31];
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	if(n%3==0){
		sort(a,a+n);
		rep(i,n){
			if(i%(n/3)==0){
				if(a[i]!=a[i+(n/3)-1]){
					puts("No");
					return 0;
				}
				rep(j,31){
					if((a[i]>>j)&1)cnt[j]++;
				}
			}
		}
		bool flag=true;
		rep(i,31){
			if(cnt[i]%2!=0)flag=false;
		}
		if(flag)puts("Yes");
		else puts("No");
	}
	else{
		bool flag=true;
		rep(i,n){
			if(a[i]!=0)flag=false;
		}
		if(flag)puts("Yes");
		else puts("No");
	}
	return 0;
}


Measured memory_bytes: 1024
n,k = map(int,input().split())
if n > k:
    if k == 1:
        print(0)
    elif k == 2:
        print(n%2)
    else:
        mod = n%k
        if k/2 < mod:
            print(k - mod)
        else:
            print(mod)
elif n == k:
    print(0)
else:
    if 2*n > k:
        print(k-n)
    else:
        print(n)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pob pop_back
#define vi vector<ll>
#define mp make_pair
#define sz size()
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define maxx 100005
#define se second
#define fi first
#define be begin()
#define en end()
#define sortv(v) sort(v.begin(),v.end());
#define w() ll _;cin>>_;while(_--)
#define edge pair<ll,ll>
#define pq priority_queue<ll>
#define mod 1000000007
#define Endl "\n"
#define cy cout<<"YES"<<endl;
#define cn cout<<"NO"<<endl;
using namespace std;

 string s="";
    
    void get(int a)
    {
        
        s=s+(char)('a'+a);
    }


int main()
{
		
	fast;
	
	ll n;
	cin>>n;
	  ll i;
       ll x=n;
        ll a;
        while(x>0)
        {
            x--;
             a=x%26;
            get(a);
            x/=26;
        }
        reverse(s.begin(),s.end());
        cout<<s<<endl;
	
	
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define INTMAX 2147483647LL
#define PII pair<int,int>
#define MK make_pair
#define re register
#define Eps (1e-10)
#define Equal(a,b) (fabs((a)-(b))<Eps)
using namespace std;
typedef long long ll;
typedef double db;
const double Pi=acos(-1.0);
const int Inf=0x3f3f3f3f;

inline int read(){
	re int x=0,f=1,ch=getchar();
	while(!isdigit(ch))f=ch=='-'?-1:1,ch=getchar();
	while(isdigit(ch))x=x*10+ch-48,ch=getchar();
	return x*f;
}
inline ll readll(){
	re ll x=0,f=1,ch=getchar();
	while(!isdigit(ch))f=ch=='-'?-1:1,ch=getchar();
	while(isdigit(ch))x=x*10+ch-48,ch=getchar();
	return x*f;
}

struct Point{
	db x,y;
	Point(){}
	Point(db xx,db yy):x(xx),y(yy){}
	inline Point operator +(const Point &p){return Point(x+p.x,y+p.y);}
	inline Point operator -(const Point &p){return Point(x-p.x,y-p.y);}
	inline Point operator *(const db &k){return Point(x*k,y*k);}
	inline Point operator /(const db &k){return Point(x/k,y/k);}
	inline db Norm(){return x*x+y*y;}
	inline db abs(){return sqrt(Norm());}
	inline bool operator <(const Point &p)const{return x!=p.x?x<p.x:y<p.y;}
	inline bool operator ==(const Point &p)const{return fabs(x-p.x)<Eps&&fabs(y-p.y)<Eps;}
}; 

typedef Point Vector;
typedef vector<Point> Poly;

double dot(Vector a,Vector b){
  return a.x*b.x+a.y*b.y;
}
double norm(Vector a){
  return a.x*a.x+a.y*a.y;
}
struct Segment{
	Point p1,p2;
	Segment(){}
	Segment(Point p1_,Point p2_):p1(p1_),p2(p2_){}
};
typedef Segment Line;
Point Project(Segment s,Point p){
	Vector bse=s.p2-s.p1;
	double res=dot(p-s.p1,bse)/norm(bse);
	return s.p1+bse*res;
}
int q;
int x,y,xx,yy;

int main(){
	x=read();y=read();xx=read();yy=read();q=read();
	Line bse=Line(Point(x,y),Point(xx,yy));
	while(q--){
		x=read();y=read();
		Point p=Project(bse,Point(x,y));
		printf("%.8lf %.8lf\n",p.x,p.y);
	}
	return 0;
}


Measured memory_bytes: 3232
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int n,l=0,r=0;
    string s;
    cin>>n>>s;
    for(int i=0;i<n;i++){
        if(s[i]=='('){
            l++;
        }else{
            if(l>0){
                l--;
            }else{
                r++;
            }
        }
    }
    
    for(int i=0;i<r;i++){
        cout<<'(';
    }
    cout<<s;
    for(int i=0;i<l;i++){
        cout<<')';
    }
    cout<<endl;
    
    
}


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

ll N, A, B;

int main() {
  cin >> N >> A >> B;
  if (A > B) swap(A, B);
  if ((A + B) % 2) {
    cout << min(N + B - (N - A + 1), 2 * N + (N - B + 1) - (N + A)) / 2 << endl;
  } else {
    cout << (B - A) / 2 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;

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

int weights[] = {512, 256, 128, 64, 32, 16, 8, 4, 2, 1};

int main() {
    int n;
    while(cin >> n) {
        vector<int> needed;
        REP(i,10) {
            if (n / weights[i]) {
                needed.push_back(weights[i]);
                n %= weights[i];
            }
        }
        reverse(needed.begin(), needed.end());
        REP(i,needed.size()-1) {
            cout << needed[i] << " ";
        }
        cout << needed[needed.size()-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1216
sa = input()
sb = input()
sc = input()

t = "a"
while True:
  if t == "a":
    if len(sa) == 0: break
    t = sa[0]
    sa = sa[1:]
  elif t == "b":
    if len(sb) == 0: break
    t = sb[0]
    sb = sb[1:]
  elif t == "c":
    if len(sc) == 0: break
    t = sc[0]
    sc = sc[1:]

print(t.upper())

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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
priority_queue<LL>pq;
int main()
{
    LL n,m;
    cin>>n>>m;
    for(LL i=0; i<n; i++)
    {
        LL a;
        cin>>a;
        pq.push(a);
    }
    for(LL i=0; i<m; i++)
    {
        LL g=pq.top();
        pq.pop();
        pq.push(g/2);
    }
    LL sum=0;
 while(!pq.empty())
 {
     sum+=pq.top();
     pq.pop();
 }
 cout<<sum;
}


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

int main(){
  int N; cin >> N;
  int a[N];
  int cnt = 0;
  for(int i = 0; i < N; i++) {
    cin >> a[N];
    if(a[N] % 2 == 1 && i % 2 == 0) cnt++;
  }
  cout << cnt << endl;
  return 0; 
}

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

int main(){
  ll n,d;
  cin >> n >> d;
  vector<ll> x(n),y(n);
  rep(i,n) cin >> x[i] >> y[i];
  
  ll ans = 0;
  rep(i,n){
    ld tmp = sqrt(pow(x[i],2.0)+pow(y[i],2.0));
    if(tmp<=d) ans++;
  }
  cout << ans << endl;
}

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

using namespace std;

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

    int N,M,P;
	cin>>N>>M>>P;
    struct Edge {
        int s, t, c;
    };
    vector<Edge> edges(M);
	for (int i = 0; i < M; i++) {
	    int a,b,c; cin>>a>>b>>c;
	    a--,b--;
	    edges[i] = {a, b, c-P};
	}
	const long inf = numeric_limits<long>::min();
	struct Node {
	    long dis = inf;
	    int pred = -1;
	};
	vector<Node> nodes(N);
	nodes[0].dis = 0;
	for (int i = 0; i < N-1; i++) {
	    for (auto& edge : edges) {
	        auto sdis = nodes[edge.s].dis;
	        if (sdis == inf)
	            continue;
	        if (nodes[edge.t].dis < sdis + edge.c) {
	            nodes[edge.t].dis = sdis + edge.c;
	            nodes[edge.t].pred = edge.s;
	        }
	    }
	}
	auto max_dis = nodes[N-1].dis;

    long ans = -1;
    for (int i = 0; i < N-1; i++) {
        for (auto& edge : edges) {
            auto sdis = nodes[edge.s].dis;
            if (sdis == inf)
                continue;
            if (nodes[edge.t].dis < sdis + edge.c) {
                nodes[edge.t].dis = sdis + edge.c;
                nodes[edge.t].pred = edge.s;
            }
        }
    }
    if (nodes[N-1].dis == max_dis) {
        ans = max(0l, max_dis);
    }
    cout << ans << endl;
	
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int h, w;
    string word;
    string dot = "#";
    cin >> h >> w;
    vector<string> a(h);

    for (int i = 0; i < h; i++) {
        cin >> a.at(i);
    }

    // 1行目はすべて#になる
    for (int i = 0; i < w; i++) {
        word += dot;
    }
    cout << dot << word << dot << endl;
    
    for (int i = 0; i < h; i++) {
        cout << dot << a.at(i) << dot << endl;
    }

    // 最終行もすべて#になる
    cout << dot << word << dot << endl;    
    
}

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


def main():
    n = int(input())
    s = input()

    # KeyInsight
    # 条件を満たす場合を直接求めるのが難しい場合は、補集合を考える

    # R, G, Bは、それぞれ独立に扱える
    r_count = s.count('R')
    g_count = s.count('G')
    b_count = s.count('B')

    ans = r_count * g_count * b_count

    # i, jを固定して全探索
    # 常にi < jとなるように添字を振るのもポイント
    for j in range(n):
        for i in range(j):
            # kは、i, jから計算
            k = 2 * j - i

            # インデックスエラーを回避
            if k < n:
                if s[i] == s[j]:
                    continue
                elif s[i] == s[k]:
                    continue
                elif s[j] == s[k]:
                    continue

                ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 73112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 1; i < n+1; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<
#define AA(i) cout<<i<<endl;
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
    ll N; cin >> N;
    int i;
    ll ans = 0;
    rep(i,N) ans += (N/i) * (i + N / i *i) / 2;
    AA(ans); 
    return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>
#include<string.h>
#include<math.h>
long long int a,s[200001],d[200001],f,g,h;
int main(void)
{

	int i,j;
	scanf("%lld",&a);
	for(i=0;i<a;i++){
		scanf("%lld",&s[i]);
	}
	f=(a-1)/2;
	if((a-1)%2==1) f=a/2;
	d[f]=s[0];
	g=f;
	if(a%2==1){
		for(i=1;i<a;i++){
			if((i+1)%2==0){
				g++;
				d[g]=s[i];
			}
			else{
				f--;
				d[f]=s[i];
			}
		}
	
	}
	if(a%2==0){
		for(i=1;i<a;i++){
			if((i+1)%2==0){
				g--;
				d[g]=s[i];
			}
			else{
				f++;
				d[f]=s[i];
			}
		}
	}
	for(i=0;i<a;i++){
		printf("%lld",d[i]);
		if(i!=a-1) printf(" ");
	}
	printf("\n");
}

Measured memory_bytes: 5376
S = input()
N = len(S)

MOD = 10**9+7

dp = []

for i in range(N+1):
  dp.append([0]*13)

dp[0][0] =1

for i in range(1,N+1):
  for j in range(13):
    if S[i-1] == "?":
      for k in range(10):
        dp[i][(j*10+k) % 13] += dp[i-1][j]

    else:
      dp[i][(j*10+int(S[i-1])) % 13] += dp[i-1][j]
    
  
  for j in range(13):
    dp[i][j] = dp[i][j] %MOD

print(dp[N][5]%MOD)

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

using namespace std;

int main(){
	vector<char> num_to_char(26);
	map<char, int> char_to_num;
	int N;
	string S;
	
	cin >> N >> S;
	
	for (int i=0; i<26; ++i) {
		num_to_char.at(i) = 'A' + i;
		char_to_num['A' + i] = i;
	}
	
	for (char c: S) {
		cout << num_to_char.at((char_to_num[c] + N) % 26);
	}
	
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int arr[] = new int[5];
		int ans = 0;
		for(int i = 0;i<5;i++) {
			arr[i] = sc.nextInt();
		}
		for(int i = 0;i<5;i++) {
			if(arr[i] == 0) {
				ans = i+1;
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 35652
from string import ascii_lowercase 

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

  ans = 0

  for i in range(1, N-1):
    left = S[:i]
    right = S[i:]

    letters = []
    for c in ascii_lowercase:
      if(c in left):
        letters.append(c)

    count = 0
    for c in letters:
      if c in right:
        count += 1

    ans = max(ans, count)

  print(ans)

if __name__ == "__main__":
  main()

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

int main(){
    int H,W,i,j;
    while(1){
    cin >> H >> W;
    for (i = 1; i <= H; i++ ){
        for (j = 1; j <= W; j++ ){
            cout << "#";
        }
        cout << '\n';
    }
    if (H == 0 && W == 0) break;
    cout << '\n';
    }

    return 0;
    
}



Measured memory_bytes: 3076
#include<iostream>
    #include<string>
    using namespace std;
    int main()
    {
      string s,d;
      cin>>s>>d;
      int count=0;
      int m=s.length();
       int n=d.length();
      for(int i=0;i<m;i++)
      {
        if(s[i]==d[i])
        {
          count++;
        }
      }
      if(n==m+1)
      {
        if(m==count)
        {
          cout<<"Yes";
        }
        else
          cout<<"No";
      }
       else
          cout<<"No";
    }

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

template<class edge_type,class weight_type> std::pair<std::vector<weight_type>,bool> bellmanford(const int size,const std::vector<edge_type> &edges ,const int start){
    std::vector<weight_type> dist(size,std::numeric_limits<weight_type>::max());
    bool negative_cycle=false;
    dist[start]=0;
    for(int i=0; i<size; ++i){
        bool update=false;
        for(const edge_type &e:edges){
            const int u=e.from,v=e.to;
            if(dist[u]!=std::numeric_limits<weight_type>::max() and dist[v]>dist[u]+e.weight){
                dist[v]=dist[u]+e.weight;
                update=true;
            }
        }
        if(!update) break;
        if(i==size-1 and update) negative_cycle=true;
    }
    return std::make_pair(dist,!negative_cycle);
}

struct edge{
    int from,to,weight;
};

void solve(){
    int v,e,r;
    cin >> v >> e >> r;
    vector<edge> edges;
    rep(i,0,e){
        int s,t,d;
        cin >> s >> t >> d;
        edges.push_back(edge{s,t,d});
    }
    auto ans=bellmanford<edge,int>(v,edges,r);
    if(!ans.second){
        cout << "NEGATIVE CYCLE" << endl;
        return;
    }
    rep(i,0,v){
        if(ans.first[i]==std::numeric_limits<int>::max()) cout << "INF" << endl;
        else cout << ans.first[i] << endl;
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}

Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000

int main() {
    while (true) {
        int n, m;
        cin >> n >> m;
        
        if (n==0 && m==0) {
            break;
        }
        
        int d_cost[m][m];
        int d_time[m][m];
        
        for (int i=0; i<m; i++) {
            for (int j=0; j<m; j++) {
                d_cost[i][j] = INF;
                d_time[i][j] = INF;
            }
        }
        
        for (int i=0; i<n; i++) {
            int ai, bi, cost_i, time_i;
            cin >> ai >> bi >> cost_i >> time_i;
            d_cost[ai-1][bi-1] = cost_i;
            d_cost[bi-1][ai-1] = cost_i;
            d_time[ai-1][bi-1] = time_i;
            d_time[bi-1][ai-1] = time_i;
        }
        
        for (int k=0; k<m; k++) {
            for (int i=0; i<m; i++) {
                for (int j=0; j<m; j++) {
                    d_cost[i][j] = min(d_cost[i][j], d_cost[i][k]+d_cost[k][j]);
                    d_time[i][j] = min(d_time[i][j], d_time[i][k]+d_time[k][j]);
                }
            }
        }
        
        int k;
        cin >> k;
        
        for (int i=0; i<k; i++) {
            int pi, qi, ri;
            cin >> pi >> qi >> ri;
            
            if (ri==0) {
                cout << d_cost[pi-1][qi-1] << endl;
            }
            else {
                cout << d_time[pi-1][qi-1] << endl;
            }
        }
    }
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int,int>;
using pq = priority_queue<int>;
typedef long long ll;
string yes = "Yes\n";
string no = "No\n";

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

	if (c >= a && c <= b)
		cout << yes;
	else
		cout << no;
	return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int r,c;//行数、列数
int n;//颜色总数
int x,y;//当前待着色点坐标
int ans[200][200];//答案记录表

int main()
{
    cin>>r>>c>>n;//分别输入行数、列数、颜色总数
    x=1,y=1;//初始坐标设置为（1，1）
    for(int i=1; i<=n; i++)
    {
        int cnt;//“当前颜色剩余着色块数”计数器
        cin>>cnt;
        while(cnt--)//对当前颜色一块一块着色
        {
            ans[x][y]=i;//着色
            if(y==c&&x%2==1)//如果该点在右边缘 且 在奇数行上
                y=c,x++;//下移一行，列数不变
            else if(y==1&&x%2==0)//如果该点在第一列上，且在偶数行上
                y=1,x++;//列数不变，下移一行
            else if(x&1)//如果在奇数行上
                y++;//右移一列
            else//否则左移一列
                y--;
        }
    }
    for(int i=1; i<=r; i++)
        for(int j=1; j<=c; j++)
            printf("%d%c",ans[i][j],j==c?'\n':' ');
    return 0;
}


Measured memory_bytes: 384
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			
			String[] tmp = br.readLine().split(" ");
			int n = Integer.parseInt(tmp[0]);
			int m = Integer.parseInt(tmp[1]);
			
			List<List<Integer>> g = new ArrayList<>(n);
			for (int i = 0; i < n; i++) {
				g.add(new ArrayList<>());
			}
			
			for (int i = 0; i < m; i++) {
				tmp = br.readLine().split(" ");
				int a = Integer.parseInt(tmp[0]) - 1;
				int b = Integer.parseInt(tmp[1]) - 1;
				g.get(a).add(b);
				g.get(b).add(a);
			}
			
			int[] ans = new int[n];
			
			Queue<Integer> q = new ArrayDeque<>();
			q.offer(0);
			while (!q.isEmpty()) {
				int p = q.poll();
				for (int v : g.get(p)) {
					if (ans[v] == 0) {
						ans[v] = p + 1;
						q.add(v);
					}
				}
			}
			
			PrintWriter pw = new PrintWriter(System.out);
			pw.println("Yes");
			for (int i = 1; i < n; i++) {
				pw.println(ans[i]);
			}
			pw.flush();
			
		}
	}
}

Measured memory_bytes: 71312
N = str(input())
if N[-1] == '2' or N[-1] == '4' or N[-1] == '5' or N[-1] == '7' or N[-1] == '9':
    print('hon')
elif N[-1] == '0' or N[-1] == '1' or N[-1] == '6' or N[-1] == '8':
    print('pon')
elif N[-1] == '3':
    print('bon')

Measured memory_bytes: 9064
#include <stdio.h>
int main(void){
        int i,j,k;
        int r,c;
        int table[101][101] = {};

        scanf("%d %d",&r,&c);
        for(i=0;i<r;i++){
                for(j=0;j<c;j++){
                        scanf("%d",&table[i][j]);
                }
        }                               //              表を読み込む

        for(i=0;i<=r;i++){
                for(j=0;j<c;j++){
                        printf("%d ",table[i][j]);
                        table[i][c] += table[i][j];
                        table[r][j] += table[i][j];
                }
                printf("%d\n",table[i][c]);
        }                               //              出力
        return 0;
}


Measured memory_bytes: 2036
N,X=map(int,input().split())
l=list(map(int,input().split()))
d=0
cnt=1
while True:
    
    d+=l[cnt-1]
    if d>X:
        print(cnt)
        break
    cnt+=1
    if cnt==N+1:
        print(N+1)
        break
else:
    
    print(cnt)

Measured memory_bytes: 3060
# coding: utf-8
# Your code here!
while True:
    n=input()
    if n=='END OF INPUT':
        break
    X=list(n)
    c=0
    for i in range(len(X)):
        if X[i]==' ':
            print(c,end='')
            c=0
        else:
            c+=1
    print(c)


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

int main() {
  long h,w,ans=0;
  cin >> h >> w;
  vector<string> s(h);
  vector<vector<long>> x(h,vector<long>(w));
  vector<vector<long>> y(w,vector<long>(h));
  for(long i=0;i<h;i++) cin >> s[i];

  for(long i=0;i<h;i++) {
    for(long j=0;j<w;j++) {
      if(s[i][j]=='#') {
        x[i][j]=-99999;
        continue;
      }
      if(j==0) x[i][j]=1;
      else x[i][j]=max(x[i][j-1]+1,1L);
      if(j+1==w) for(long k=1;k<x[i][j];k++) x[i][j-k]=x[i][j];
      else if(s[i][j+1]=='#') for(long k=1;k<x[i][j];k++) x[i][j-k]=x[i][j];
    }
  }
  for(long i=0;i<w;i++) {
    for(long j=0;j<h;j++) {
      if(s[j][i]=='#') {
        y[i][j]=-99999;
        continue;
      }
      if(j==0) y[i][j]=1;
      else y[i][j]=max(y[i][j-1]+1,1L);
      if(j+1==h) for(long k=1;k<y[i][j];k++) y[i][j-k]=y[i][j];
      else if(s[j+1][i]=='#') for(long k=1;k<y[i][j];k++) y[i][j-k]=y[i][j];
    }
  }
  for(long i=0;i<h;i++) {
    for(long j=0;j<w;j++) {
      ans=max(ans,x[i][j]+y[j][i]-1);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 67072
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ma,sum;
  ma=0;
  sum=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int s;
    cin>>s;
    sum+=s;
    ma=max(ma,s);
  }
  if(2*ma<sum){cout<<"Yes";}
  else{cout<<"No";}
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 
 
void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}
 
double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}
 
ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}
 
ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}
 
vec modncrlistp,modncrlistm;
 
ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}
 
ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}
 
ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}
 
ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}
void judgement(int a){
  if(a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  if(a){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}
int main(){
  startupcpp();
  ll i,j;
  string s,t;cin>>s>>t;
  if(s.size()<t.size()){
    cout<<"UNRESTORABLE"<<endl;
    return 0;
  }
  brep(i,s.size()-t.size()+1){
    rep(j,t.size()){
      if(s[i+j]!=t[j]&&s[i+j]!='?')break;
    }
    if(j==t.size()){
      rep(j,t.size()){
        s[i+j]=t[j];
      }
      i=inf;
      break;
    }
  }
  if(i==inf){
    rep(i,s.size())if(s[i]=='?')s[i]='a';
    cout<<s<<endl;
  }else{
    cout<<"UNRESTORABLE"<<endl;
  }
  return 0;
}

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


int main()
{
  int flag=0;
  string S;
  cin>>S;

  for(int i=0;i<2;i++)
  {
   
    if(S[i]!=S[i+1])
    {
      if( S[i]!='C'&& S[i+1]!='C')
       {
         flag++;
         goto label;
       }
    }
  }

label:
  if(flag==0)
   cout<<"No";
   else
   cout<<"Yes";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int a[N * N], x[N], id[N];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; ++ i) {
		scanf("%d", &x[i]);
		id[i] = i;
	}
	sort(id + 1, id + 1 + n, [&] (int i, int j) {return x[i] < x[j];});
	int j = 1;
	bool flag = 0;
	for (int i = 1; i <= n; ++ i) {
		int I = id[i];
		a[x[I]] = I;
		for (int k = 1; k <= I - 1; ++ k) {
			while (a[j]) ++ j;
			a[j] = I;
			if (j > x[I]) flag = 1;
		}
		if (flag) break;
	}
	for (int i = 1; i <= n; ++ i) {
		int I = id[i];
		for (int k = n; k > I; -- k) {
			while (a[j]) ++ j;
			a[j] = I;
			if (j < x[I]) flag = 1;
		}
		if (flag) break;
	}
	if (flag) puts("No"); else {
		puts("Yes");
		for (int i = 1; i <= n * n; ++ i) printf("%d%c", a[i], " \n"[i == n * n]);
		for (int i = 1; i <= n; ++ i) {
			int j = 0;
			for (int k = 1; k <= n * n; ++ k) {
				if (a[k] == i) ++ j;
				if (j == i) {
					assert(k == x[i]);
					break;
				}
			}
		}
		static int cnt[N];
		memset(cnt, 0, sizeof(cnt));
		for (int i = 1; i <= n * n; ++ i) {
			cnt[a[i]] ++;
		}
		for (int i = 1; i <= n; ++ i) assert(cnt[i] == n);
	}
}



Measured memory_bytes: 2176
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
const LL MOD = 1000000007LL;
int main() {
	int A[3];
	for (int i = 0; i < 3; i++) cin >> A[i];
	sort(A, A + 3);
	int ans = 0;
	while (A[0] + 2 <= A[1]) {
		A[0] += 2;
		ans++;
	}
	ans += A[2] - A[0];
	if (A[0] < A[1]) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 256
H, W, A, B = map(int, input().split())

ans = 0 
MOD = 10**9 + 7
N = H + W - 2
fac = [1] * N
inv = [1] * N

# 階乗
for i in range(1, N):
    fac[i] = (fac[i - 1] * i) % MOD
 
# 逆元
inv[N - 1] = pow(fac[N - 1], MOD - 2, MOD)
for i in range(N - 1, 0, -1):
    inv[i - 1] = (inv[i] * i) % MOD
 
 
def f(x, y):
    ans = fac[x + y] * inv[x] * inv[y] % MOD
    return ans
 

for x in range(B, W):
    ans += f(x, H - A - 1) * f(W - 1 - x, A - 1)
    ans %= MOD
    
print(ans % MOD)

Measured memory_bytes: 18804
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pll >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 

const ll mod = 1e9+7;
const ll inf=1e18+1e17;
//const ll mod = 998244353;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}

const ll N =2e5 + 6;
struct st{ int a,b,c;};
st arr[N];
int dep[N], ans[N],brr[N],crr[5*N];
vii tree[N];
bool comp( st x,st y){
	if ( x.a==y.a)
		return x.b>y.b;
	return x.a<y.a;
}
void dfa( int pos, int par,int d){
	dep[pos]=d;
	for ( int i:tree[pos])
		if ( i!=par)
			dfa( i,pos, d+1);
}
void update( int node, int st, int et, int val,int pos){
	if ( st>pos||et<pos)
		return;
	if ( st==et){
	//	cout<<"HERE\n";
		crr[node]=val;
		return;
	}
	int mid=( st+et)/2;
	update( node*2,st,mid,val,pos);
	update( node*2+1,mid+1,et,val,pos);
	//cout<<st<<' '<<et<<'\n';
	crr[node]=max( crr[node*2],crr[node*2+1]);
}
int query (int node ,int st, int et, int l ,int r){
	if ( st>r)
		return 0;
	if ( et<=r)
		return crr[node];
	return max( query(node*2,st,(st+et)/2,l,r),query( node*2+1,(st+et)/2+1,et,l,r));
}
void dfs( int pos, int par){
	//cout<<brr[pos]<<' '<<query( 1,1,N,1,brr[pos])<<'\n';
	int val=query( 1,1,N,1,brr[pos])+1;
	//cout<<val<<'\n';
	update( 1,1,N,val,brr[pos]);
	ans[pos]=crr[1];
	for ( int i: tree[pos])
		if ( i!=par)
			dfs( i,pos);
	update( 1,1,N,-val,brr[pos]);
}
void solve(){
	int n;
	cin>>n;
	memset( crr,0,sizeof ( crr));
	for ( int i=0;i<n;i++){
		cin>>arr[i].a;
		arr[i].c=i;
	}
	for ( int i=0;i<n-1;i++){
		int aa,bb;
		cin>>aa>>bb;
		aa--;bb--;
		tree[aa].pb( bb);tree[bb].pb( aa);
	}
	dfa( 0,-1,0);
	for ( int i=0;i<n;i++){
		arr[i].b=dep[i];
	}
	sort( arr,arr+n,comp);
	for ( int i=0;i<n;i++){
		brr[arr[i].c]=i+1;
	}
	/*
	// settree check()

		update( 1,1,N,10,1);
		cout<<query( 1,1,N,1,3);


	//*/
	dfs( 0,-1);
	for (int i=0;i<n;i++)
		cout<<ans[i]<<'\n';
}


int main(){
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);
	// #ifndef ONLINE_JUDGE
	// 	freopen ("INPUT.txt" , "r" , stdin);
	// 	freopen ("OUTPUT.txt", "w" , stdout);
	// #endif	
    ll t=1;
	//cin>>t;
    for (ll i=1;i<=t;i++){
    //	cout<<"Case #"<<i<<": ";
    	solve();
 	}
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> A(N);

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

    ll ans = LINF;
    for(ll i=-100; i<=100; i++){
        ll temp = 0;
        REP(j, N){
            temp += (A[j]-i)*(A[j]-i);
        }
        ans = min(ans, temp);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
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 long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

ll a,b,c;

void input(){
    cin >> a >> b >> c;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    if(a%2==0 || b%2==0 || c%2==0) cout << 0 << endl;
    else{
        ll tmp = a*b;
        chmin(tmp, b*c);
        chmin(tmp, c*a);
        cout << tmp << endl;
    }
    return 0;
}

Measured memory_bytes: 764
#include <iostream>

using namespace std;

int main(int argc, char** argv) {
	int a, b;
	cin >> a >> b;
	int sum = 0;
	for (int n = a; n <= b; n++) {
		int i = n;
		int i1 = i % 10;
		i /= 10;
		int i2 = i % 10;
		i /= 10;
		int i3 = i % 10;
		i /= 10;
		int i4 = i % 10;
		i /= 10;
		int i5 = i % 10;
		sum += i1 == i5 && i2 == i4;
	}
	cout << sum;
	return 0;
} 

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

#define N_MAX 100000
long long dp[N_MAX + 1];
long long N, K;
vector<long long> h;

int main(void)
{

    cin >> N >> K;
    h.resize(N);
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }

    for (int i = 0; i < N + 1; i++)
        dp[i] = 1000000000;

    dp[0] = 0;

    for (int i = 0; i < N; i++)
    {
        for (int j = 1; j <= K; j++)
        {
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    cout << dp[N - 1] << endl;

    return 0;
}

Measured memory_bytes: 4748
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<ll>
#define pb push_back
#define ff first
#define ss second
#define inf 2e18
#define ull unsigned long long
#define pi acos(-1.0)
#define mod 1000000007
#define lop0(n) for(ll i=0;i<n;i++)
#define lopj(n) for(ll j=0;j<n;j++)
#define lop1(n) for(ll i=1;i<=n;i++)
#define all(v) v.begin(),v.end()
ll Set(ll N,ll pos){ return N=N | (1LL<<pos); }
ll reset(ll N,ll pos){ return N= N & ~(1LL<<pos); }
bool check(ll N,ll pos){ return (bool)(N & (1LL<<pos)); }
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

main()
{
    ll n;
    cin>>n;
    if(n%2==0 or n%5==0)
    {
        cout<<-1;
        return 0;
    }
    ll ans=-1,vag=7,cnt=1;
    for(ll i=1;i<100000000;i+=1)
    {
        while(vag<n)
        {
            vag*=10;
            vag+=7;
            cnt+=1;
        }
        if(vag%n==0)
        {
            ans=cnt;
            break;
        }
        else
        {
            //cout<<vag<<endl;
            vag%=n;
            //cout<<vag<<endl;
        }
    }
    cout<<ans;
}



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

public class Main{
    public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            String line = reader.readLine();
            int x = Integer.parseInt(line);
            System.out.println(x*x*x);
        }
        catch(IOException e){
            System.out.println(e);
        }
        catch(NumberFormatException e){
            System.out.println("数字が正しくありません");
        }
    }
}


Measured memory_bytes: 24316