akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;
#define upd_min(miner, updater) if (miner > updater) miner = updater;

void ansYes(bool flag) {
    if (flag) cout << "Yes" << endl; else cout << "No" << endl;
}

void ansYES(bool flag) {
    if (flag) cout << "YES" << endl; else cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

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

struct datas {
    Int max;
    Int size;
};

class ContainChecker {
protected:
    Int minx, miny, maxx, maxy;
public:
    ContainChecker(Int minx, Int miny, Int maxx, Int maxy) : minx(minx), miny(miny), maxx(maxx), maxy(maxy) {};

    bool in(Int x, Int y) {
        return (minx <= x && miny <= y && x <= maxx && y <= maxy);
    }
};


int main(void) {
    Int n;
    cin >> n;
    Int x = 0, y = 0, t = 0;
    REP(n,i){
        Int pt, px, py;
        cin >> pt >> px >> py;
        if (abs(pt - t) >= abs(px-x) + abs(py-y) && (pt - abs(px-x) + abs(py-y)) % 2 == 0) {

        }else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] arr = new int[N+1000][3];
        int[] memo = new int[N+1000];

        for (int i = 0; i < N; i++) {
            arr[i][0] = sc.nextInt();
            arr[i][1] = sc.nextInt();
            arr[i][2] = sc.nextInt();
            memo[i]=-1;
        }
        int[][] dp = new int[N+1000][3];
//        for (int i = 0; i <dp.length ; i++) {
//            dp[i] = Integer.MAX_VALUE;
//        }

        dp[1][0] = arr[0][0];
        dp[1][1] = arr[0][1];
        dp[1][2] = arr[0][2];

        for (int i = 2; i <= N ; i++) {
            //A
            dp[i][0]=Math.max(dp[i-1][1],dp[i-1][2]) + arr[i-1][0];
            dp[i][1]=Math.max(dp[i-1][0],dp[i-1][2]) + arr[i-1][1];
            dp[i][2]=Math.max(dp[i-1][0],dp[i-1][1]) + arr[i-1][2];
        }

        System.out.println(Math.max(Math.max(dp[N][0],dp[N][1]),dp[N][2]));

//        System.out.println(recur(arr,memo,K,N-1));

    }

    static public int recur(int[] arr,int[] memo,int K, int idx){
        if(memo[idx]!=-1) return memo[idx];
        if(idx <=0){
            return 0;
        }

        int min = Integer.MAX_VALUE;
        for (int i = Math.max(0,idx-K); i <= idx-1; i++) {
            min = Math.min(min, recur(arr,memo,K,i) + Math.abs(arr[idx] - arr[i]));
        }

        memo[idx] =min;
        return min;
    }


}


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

//Compiler version g++ 6.3.0

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin>>t;
    int one = t%10;
    
    if(one==2 || one==4 || one==5 
      || one==9 || one==7)
      cout << "hon\n";
    else if(one==0 || one==1 || one==6 || one==8)
    cout << "pon\n";
    else
    cout << "bon\n";
    return 0;
}

Measured memory_bytes: 3580
use std::io::*;

fn main() {
	let input = {
		let mut buf = vec![];
		stdin().read_to_end(&mut buf);
		buf.pop();
		unsafe { String::from_utf8_unchecked(buf) }
	};

	let mut stack: Vec<i32> = vec![];

	for token in input.split(' ') {
		match token {
			"+" => {
				let b = stack.pop().unwrap();
				*stack.last_mut().unwrap() += b;
			},
			"-" => {
				let b = stack.pop().unwrap();
				*stack.last_mut().unwrap() -= b;
			},
			"*" => {
				let b = stack.pop().unwrap();
				*stack.last_mut().unwrap() *= b;
			},
			n => {
				stack.push(n.parse().unwrap());
			}
		}
	}

	println!("{}", stack[0]);
}



Measured memory_bytes: 5020
import bisect as bi


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def f(M, i1, i2, i3):
    M1 = M[i1]
    M2 = M[i2]
    M3 = M[i3]

    if len(M1) == 0 or len(M2) == 0 or len(M3) == 0:
        return False

    front = M[i1][0]

    M2 = M[i2]
    if M2[-1] <= front:
        return False

    index = bi.bisect_right(M2, front)
    second = M2[index]

    return second < M[i3][-1]


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

    M = {i: [] for i in range(10)}
    for i, s in enumerate(S):
        M[int(s)].append(i)

    res = 0
    for i1 in range(10):
        for i2 in range(10):
            for i3 in range(10):
                if f(M, i1, i2, i3):
                    res += 1
    print(res)


if __name__ == '__main__':
    main()


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

int main(){
    int h, w;
    cin >> h >> w;

    vector<vector<char>> s(h, vector<char>(w));
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> s[i][j];
        }
    }

    vector<int> dx = {1,0,-1,0};
    vector<int> dy = {0,1,0,-1};
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if(s[i][j] == '#'){
                bool flag = false;
                for(int k=0; k<4; k++){
                    int ni = i + dx[k];
                    int nj = j + dy[k];
                    if(0 <= ni && ni < h
                    && 0 <= nj && nj < w){
                        if(s[ni][nj] == '#'){
                            flag = true;
                            break;
                        }
                    }
                }
                if(flag == false){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

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

  if (k <= 100) {
    int count = 0;
    string t;
    for (int i = 0; i < k; i++) t += s;
    for (int i = 0; i < t.size() - 1; i++) {
      if (t[i] == t[i + 1]) {
        count++;
        t[i + 1] = 'X';
      }
    }
    cout << count << endl;
    return 0;
  }

  ll count1 = 0, count2 = 0, count3 = 0;
  string t = s + s + s + s;
  string u = s + s;
  string w = s + s + s;

  for (int i = 0; i < t.size() - 1; i++) {
    if (t[i] == t[i + 1]) {
      count1++;
      t[i + 1] = 'X';
    }
  }

  for (int i = 0; i < u.size(); i++) {
    if (u[i] == u[i + 1]) {
      count2++;
      u[i + 1] = 'X';
    }
  }

  for (int i = 0; i < w.size(); i++) {
    if (w[i] == w[i + 1]) {
      count3++;
      w[i + 1] = 'X';
    }
  }

  ll huta = count1 - count2;

  if (k % 2 == 0) {  // 偶数連結
    cout << count2 + (k - 2) / 2 * huta << endl;
  } else {  // 奇数連結
    cout << count3 + (k - 3) / 2 * huta << endl;
  }
}


Measured memory_bytes: 256
//
//  main.cpp
//
 
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
 
template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)

int main() {
	ll N, L;
	cin >> N >> L;
	vector<ll> ais(N);
	rep(i,0,N) {
		cin >> ais[i];
	}
	ll idx = -1;
	rep(i,0,N-1) {
		if (ais[i]+ais[i+1]>=L) {
			idx = i;
			break;
		}
	}
	if (idx == -1) {
		cout << "Impossible" << endl;
		return 0;
	}
	cout << "Possible" << endl;
	vector<ll> ans;
	ans.push_back(idx);
	rrep(i,idx,0) {
		ans.push_back(i);
	}
	rep(i,idx+1,N-1) {
		ans.push_back(i);
	}
	rrep(i,ans.size(),0) {
		cout << ans[i] + 1 << endl;
	}
}


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

int main() {

    long long int n,a,b;

    cin>>n>>a>>b;

    if((b-a)*(n-2)+1 < 0 || n < 2 && a != b) cout<<0<<endl;
    else cout<<(b-a)*(n-2)+1<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long l[90];
	l[1]=2;
	l[2]=1;
	short n;
	cin>>n;
	for(int i=3;i<=n+1;i++)
		l[i]=l[i-1]+l[i-2];
	cout<<l[n+1]<<endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	int x;
	cin>>x;
	cout<<x*x<<endl;
	return 0;
}


Measured memory_bytes: 256
/*input
10 10 1
1 10 9 1
*/
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define mod 998244353
#define int long long
int n, m, q;
struct node {
	int a,b,c,d;
	node(int a1 , int b1, int c1, int d1): a(a1),b(b1),c(c1),d(d1) {}
	node() {}
};

vector<node> Q;
int ans = 0;

int cal(vector<int> &v) {
	int ans= 0;
	for(auto it: Q) {
		if(v[it.b] - v[it.a] == it.c) ans+=it.d;
	}
	return ans;
}

void rec(int index, int val, vector<int> &v) {
	if(index == n) {
		ans= max(ans, cal(v));
		return;
	}
	v[index] = val;
	for(int i= val;i<=m;i++){
		rec(index+1, i, v);
	}
}

signed main() {
	
	cin>>n>>m>>q;
	Q.resize(q);
	for(int i=0;i<q;i++) {
		int a,b,c,d;
		cin>>a>>b>>c>>d;b--;a--;
		Q[i] = node(a,b,c,d);
	}
	vector<int> v(n);
	rec(0, 1, v);
	cout<<ans<<endl;
}

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

int main() {
    long long N, M;
    cin >> N >> M;
    for(int i = 0; i < M; ++i) {
        long long A;
        cin >> A;
        N -= A;
    }
    if(N < 0) cout << -1 << endl;
    else cout << N << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<cmath>
#include<cstdio>
#define eps (1e-10)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
class Point{
    public:
    double x,y;
    Point(double x=0,double y=0):x(x),y(y){}
    Point operator -(Point p){
        return Point(x-p.x,y-p.y);
    }
    Point operator +(Point p){
        return Point(x+p.x,y+p.y);
    }
    Point operator *(double k){
        return Point(x*k,y*k);
    }
    Point operator /(double k){
        return Point(x/k,y/k);
    }
    Point operator == (Point p){
        return equals(x,p.x)&&equals(y,p.y);
    }
    Point operator <(Point p){
        return !equals(x,p.x)?(x-p.x)<eps:(y,p.y)<eps;
    }
    Point operator > (Point p){
        return !equals(x,p.x)?(x-p.x)>eps:(y,p.y)>eps;
    }
};
typedef Point Vector;
struct segment{
    Point p1,p2;
};
typedef segment line;
struct circle{
    Point c;
    double r;
};
typedef vector<Point>polygon;
double norm(Vector V){
    return V.x*V.x+V.y*V.y;
}
double abs(Vector V){
    return sqrt(norm(V));
}
double dot(Vector V1,Vector V2){
    return V1.x*V2.x+V1.y*V2.y;
}
double cross(Vector V1,Vector V2){
    return V1.x*V2.y-V1.y*V2.x;
}
bool isprallel(Vector V1,Vector V2){
    return equals(cross(V1,V2),0.0);
}
bool isprallel(line l1,line l2){
    return equals(cross(l1.p2-l1.p1,l2.p2-l2.p1),0.0);
}
bool isorthogonal(Vector V1,Vector V2){
    return equals(dot(V1,V2),0.0);
}
bool isorthogonal(line l1,line l2){
    return equals(dot(l1.p2-l1.p1,l2.p2-l2.p1),0.0);
}
Point projection(segment s,Point p){
    Vector hypo,base;
    hypo=p-s.p1;
    base=s.p2-s.p1;
    double r=dot(hypo,base)/norm(base);
    return s.p1+base*r;
}
Point reflection(segment s,Point p){
    return p+(projection(s,p)-p)*2.0;
}
double getdistance(Point a,Point b){
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double distancepl(Point p,line l){
    return abs(cross(p-l.p1,l.p2-l.p1)/abs(l.p2-l.p1));
}
double distanceps(Point p,segment s){
    if(dot(s.p2-s.p1,p-s.p2)>=0)return getdistance(p,s.p2);
    else if(dot(s.p2-s.p1,p-s.p1)>=0)return getdistance(p,s.p1);
    else return distancepl(p,s);
}
double distancess(segment s1,segment s2){
    return min(min(distanceps(s1.p1,s2),distanceps(s1.p2,s2)),min(distanceps(s2.p1,s1),distanceps(s2.p2,s1)));
}
int main(){
    int q;
    line l,l1;
    cin>>q;
    while(q--){
        cin>>l.p1.x>>l.p1.y>>l.p2.x>>l.p2.y>>l1.p1.x>>l1.p1.y>>l1.p2.x>>l1.p2.y;
        if(isprallel(l,l1))printf("2\n");
        else if(isorthogonal(l,l1))printf("1\n");
        else printf("0\n");
    }
}



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

int n,a,b,now,B;
int bitcount(int a){
  int tmp=0;
  while(a)tmp+=a&1,a>>=1;
  return tmp;
}
vector<int> ans;
vector<int> fans;
int rev(int x,int y){
  int res=0;
  for(int i=0;i<y;i++){
    res<<=1;
    res+=x&1;
    x>>=1;
  }
  return res;
}
void gray(int s,bool f){
  if(f){
    stack<int> sta;
    for(int i=0;i<(1<<s);i++)sta.push(rev(i^(i>>1),s)+now);
    while(sta.size()){
      ans.push_back(sta.top());
      sta.pop();
    }
  }
  else{
    queue<int> que;
    for(int i=0;i<(1<<s);i++)que.push(rev(i^(i>>1),s)+now);
    while(que.size()){
      ans.push_back(que.front());
      que.pop();
    }
  }
}
template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
vector<int> t(20);//t[i]:pの(1<<i)の部分がbの1<<t[i]を表している
//pは1<<(n-B)が黒くするから、1<<(n-B)~1<<(n-1)がbの黒い部分にあたるはず
int nowb,noww;
void make_change(){
  nowb=n-B;
  int tmp=b;
  for(int i=0;i<n;i++){
    if(tmp&1)t[nowb++]=i;
    else t[noww++]=i;
    tmp>>=1;
  }
}
int change(int p){
  int tmp=0;
  for(int i=0;i<n;i++){
    if(p&1)tmp+=1<<t[i];
    p>>=1;
  }
  return tmp^a;
}

signed main(){
  cin>>n>>a>>b;
  b^=a;
  if((bitcount(b)&1)==0)fin("NO");
  cout<<"YES"<<endl;
  B=bitcount(b);
  //cout<<B<<endl;
  make_change();
  int d=1<<(n-1);
  for(int i=0;i<B;i+=2){
    gray(n-i-1,0);
    now+=d;d>>=1;
    if(i<B-1)gray(n-i-2,1);
    else gray(n-i-1,1);
    now+=d;d>>=1;
  }
  //for(int p:ans)cout<<bitset<5>(p)<<endl;
  for(int p:ans)fans.push_back(change(p));
  //cout<<(1<<n)<<" "<<fans.size()<<endl;
  assert(fans.size()==1<<n);
  //for(int p:fans)cout<<bitset<5>(p)<<endl;
  for(int i=1;i<fans.size();i++)assert(bitcount(fans[i-1]^fans[i])==1);
  for(int p:fans)cout<<p<<" ";
  cout<<endl;
}


Measured memory_bytes: 2152
// エイシングプログラミングコンテスト2020-C
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る

int calc(int x,int y,int z){
    return x*x+y*y+z*z+x*y+y*z+z*x;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int max_=10000;
    vector<int> ans(max_+10,0);
    int n;
    cin>>n;
    for(int i=1;i<=100;i++){
        for(int j=1;j<=100;j++){
            for(int k=1;k<=100;k++){
                int cur=calc(i,j,k);
                if(cur<=max_) ans[cur]++;
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 3684
N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
cost = 0
for i in range(N-1):
    dist = X[i+1] - X[i]
    if dist * A < B:
        cost += (dist * A)
    else:
        cost += B
print(cost)

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


Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

	int K, S;
	cin >> K >> S;

	ll ans = 0;
	for(int i = 0; i <= K; i++) {
		for(int j = 0; j <= K; j++) {
			int r = S - i - j;
			if(0 <= r && r <= K) ans++;
		}
	}

	cout << ans << endl;
}

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

int main () {
  
  int N;
  cin >> N;
  bool answer = false;
  
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "Y")
    {
      answer = true;
     cout << "Four" << endl;
      break;
    }
  }
  if ( answer == false) {
      cout << "Three" << endl;
  }
}

      


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
typedef long long ll;
using namespace std;

const ll MAXN = 200000;

ll N, K, ans=0, tmp=0;
vector<ll> A(MAXN, 0);

signed main(){
    cin >> N >> K;
    if(K>(N-1)*(N-2)/2) {
        cout << -1 << endl;
        return 0;
    }
    else {
        cout << N-1+(N-1)*(N-2)/2-K << endl;
        for(int i=2;i<=N;i++) {
            cout << 1 << " " << i << endl;
        }
        ll i = 2;
        ll j = 2;
        ll ct=0;
        while(ct!=(N-1)*(N-2)/2-K) {
            ct++;
            if(j==N) {
                i++;
                j = i+1;
            }
            else {
                j++;
            }
            cout << i << " " << j << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1792
s = input()
cnt = [0,0]
I = ""
ans = [0] * len(s)
for i in range(len(s)):
    if s[i] == "R": 
        if I == "": cnt[0] += 1
        else:
            ans[I] = (cnt[0]+1)//2 + cnt[1]//2
            ans[I+1] = cnt[0]//2 + (cnt[1]+1)//2
            cnt = [1,0]
            I = ""
    else:
        if I == "": I = i-1
        cnt[1] += 1
ans[I] = (cnt[0]+1)//2 + cnt[1]//2
ans[I+1] = cnt[0]//2 + (cnt[1]+1)//2
print(" ".join(map(str, ans)))

Measured memory_bytes: 10484
using System;
class Program{
	static void Main(){
		long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long[][] arr=new long[s[0]][];
		bool[] h=new bool[s[0]];
		for(int i=0;i<s[0];i++){
			arr[i]=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		}
		Array.Sort(arr,ca);
		long ans=0,t=0,b=0,c=0;
		while(b!=s[0]){
			ans++;
			t=0;
			for(int i=0;i<s[0];i++){
				if(!h[i]&&arr[i][0]>=t+(arr[i][2]==c?0:1)){
					h[i]=true;
					t=arr[i][1];
					b++;
					c=arr[i][2];
				}
			}
		}
		Console.WriteLine("{0}",ans);
	}
	static int ca(long[] a,long[] b){
		if(a[0]>b[0]){return 1;}
		else if(a[0]<b[0]){return -1;}
		else{return 0;}
	}
}

Measured memory_bytes: 23488
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<stack>
#include<queue>
using namespace std;
typedef long long ll;

const int maxn = 200010;

ll n,t,mi,ans=0;;
ll der[2][maxn],vis,cnt[2]; // 0 left ; 1 right
string s;

ll read(){ ll s=0,f=1; char ch=getchar(); while(ch<'0' || ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0' && ch<='9'){ s=s*10+ch-'0'; ch=getchar(); } return s*f; }

int main(){
	ans=0;
	cin>>s;
	n=s.size();
	if(s[0]=='<') vis=0;
	else{
		vis=1;
		++cnt[0];
		der[0][1]=0;
	}
	
	cnt[vis]=1; ++der[vis][cnt[vis]];
	for(int i=1;i<n;i++){
		if(s[i]!=s[i-1]){
			vis=!vis;
			++cnt[vis];
		}
		++der[vis][cnt[vis]];
	}
	
	int m=min(cnt[0],cnt[1]);
	for(int i=1;i<=m;i++){
		ans+=max(der[0][i],der[1][i]);
		ans+=(der[0][i]-1ll)*der[0][i]/2;
		ans+=(der[1][i]-1ll)*der[1][i]/2;
	}
	
	if(cnt[0]>cnt[1]){
		ans+=(der[0][cnt[0]]+1)*der[0][cnt[0]]/2;
	}
	
//	printf("%d %d\n",cnt[0],cnt[1]);
//	for(int i=1;i<=cnt[0];i++){
//		printf("%d ",der[0][i]);
//	}printf("\n");
//	for(int i=1;i<=cnt[1];i++){
//		printf("%d ",der[1][i]);
//	}printf("\n");
	
	printf("%lld\n",ans);
	
	return 0;
}


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

using namespace std;

const int N=110;

int main()
{
    int n;
    cin>>n;
    cout<<n*(n-1)/2-n/2<<'\n';
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<i;j++)
        {
            if(i+j!=(n+1-(n&1)))
            {
                cout<<i<<' '<<j<<'\n';
            }
        }
    }
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> a(q);
  for (int i = 0; i < q; i++) cin >> a[i];
  vector<ll> score(n, k - q);
  for (int i = 0; i < q; i++) score[a[i] - 1]++;
  for (int i = 0; i < n; i++) {
    if (score[i] > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int l,r,d;
  cin>>l>>r>>d;
  cout<<r/d-(l-1)/d<<endl;
}

Measured memory_bytes: 3616
#include <iostream>
using namespace std;
int ar[200001] = {}, bt[200001] = {};
int main()
{
	int n; long long k;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {cin >> ar[i]; bt[i] = -1;}
	int ord = 0, idx = 0, pv = -1;
	while (bt[idx] == -1 && ord < k)
	{
		bt[idx] = ord++;
		pv = idx;
		idx = ar[idx] - 1;
	}
	if (ord == k) {cout << idx + 1 << "\n";}
	else 
	{
		k -= ord;
		int cyc = ord - bt[idx];
		k %= cyc; k += bt[idx];
		for (int i = 0; i < n; i++)
		{
			if (bt[i] == k)
			{
				cout << i + 1 << "\n";
			}
		}
	}
	return 0;
}

Measured memory_bytes: 5192
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <string.h>
using namespace std;
int main() {cin.tie(0);
   	ios::sync_with_stdio(false);
    long long k;
    cin >>k;
    long long a[50];
    long long q,r;
    r=k%50;
    q=(k-r)/50;
    for(int i=0;i<50;++i){
        a[i]=50+q-1;
    }
    for(int i=0;i<r;++i){
        a[i]+=50-r+1;
    }
    for(int i=r;i<50;++i){
        a[i]=a[i]-r;
    }
    cout<<50<<endl;
    for(int i=0;i<50;++i){
        cout<<a[i];
        if(i!=49){cout <<" ";}else{cout <<endl;}
    }
    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	a := make([][]int, 3)
	for i := range a {
		a[i] = make([]int, 3)
		for j := range a[i] {
			a[i][j] = scanInt()
		}
	}

	n := scanInt()
	for i := 0; i < n; i++ {
		b := scanInt()
		for i := range a {
			for j := range a[i] {
				if a[i][j] == b {
					a[i][j] = 0
				}
			}
		}
	}

	if a[0][0] == 0 && a[0][1] == 0 && a[0][2] == 0 {
		fmt.Println("Yes")
	} else if a[1][0] == 0 && a[1][1] == 0 && a[1][2] == 0 {
		fmt.Println("Yes")
	} else if a[2][0] == 0 && a[2][1] == 0 && a[2][2] == 0 {
		fmt.Println("Yes")
	} else if a[0][0] == 0 && a[1][0] == 0 && a[2][0] == 0 {
		fmt.Println("Yes")
	} else if a[0][1] == 0 && a[1][1] == 0 && a[2][1] == 0 {
		fmt.Println("Yes")
	} else if a[0][2] == 0 && a[1][2] == 0 && a[2][2] == 0 {
		fmt.Println("Yes")
	} else if a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0 {
		fmt.Println("Yes")
	} else if a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int main(){
	int n;
	scanf("%d", &n);
	int d = n%10; n /= 10;
	int c = n%10; n /= 10;
	int b = n%10; n /= 10;
	int a = n;
	
	if(a+b+c+d==7) printf("%d+%d+%d+%d=7\n", a, b, c, d);
	else if(a+b+c-d==7) printf("%d+%d+%d-%d=7\n", a, b, c, d);
	else if(a+b-c+d==7) printf("%d+%d-%d+%d=7\n", a, b, c, d);
	else if(a+b-c-d==7) printf("%d+%d-%d-%d=7\n", a, b, c, d);
	else if(a-b+c+d==7) printf("%d-%d+%d+%d=7\n", a, b, c, d);
	else if(a-b+c-d==7) printf("%d-%d+%d-%d=7\n", a, b, c, d);
	else if(a-b-c+d==7) printf("%d-%d-%d+%d=7\n", a, b, c, d);
	else if(a-b-c-d==7) printf("%d-%d-%d-%d=7\n", a, b, c, d);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;

int INF = 1<<29;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

int main(){
	int w,h,n;
	cin>>w>>h>>n;
	int hidari,migi,ue,sita;
	hidari = 0;
	migi = w;
	sita = 0;
	ue = h;
	int i,x,y,a;
	for(i=0;i<n;i++){
		cin>>x>>y>>a;
		if(a==1)hidari = max(x,hidari);
		else if(a==2)migi = min(x,migi);
		else if(a==3)sita = max(y,sita);
		else ue = min(y,ue);
	}
	cout<< max((ue-sita),0)*max((migi-hidari),0) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            int k = in.nextInt();
            int[][][] best = new int[s.length() + 1][s.length() + 1][k + 1];
            for (int pos = s.length() - 1; pos >= 0; --pos) {
                Arrays.fill(best[pos][1], 1);
                for (int len = 2; pos + len <= s.length(); ++len) {
                    if (s.charAt(pos) == s.charAt(pos + len - 1)) {
                        for (int i = 0; i <= k; ++i) {
                            best[pos][len][i] = 2 + best[pos + 1][len - 2][i];
                        }
                    } else {
                        for (int i = 0; i <= k; ++i) {
                            best[pos][len][i] = Math.max(best[pos + 1][len - 1][i], best[pos][len - 1][i]);
                            if (i > 0) {
                                best[pos][len][i] = Math.max(best[pos][len][i], 2 + best[pos + 1][len - 2][i - 1]);
                            }
                        }
                    }
                }
            }
            out.println(best[0][s.length()][k]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 169816
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
#define endl '\n'

void solve()
{
    int n , l ;
    cin >> n >> l ;
    vector<string> v(n) ;
    for (auto &x : v) cin >> x ;
    sort(v.begin() , v.end()) ;
    for (auto x: v) cout << x ;
    cout << endl ;
}

int32_t main()
{
    fast;
    int testcases = 1 ;
    //cin >> testcases ;
    while(testcases--)
    {
        solve() ;
    }
    return 0 ;
}
/*  CODED BY:-
 ___________________________________
|                       ___         |
|  /\   /\  \ /  |  |  |___   |__|  |        
| /~~\ /~~\  |   |__|   ___|  |  |  |
|___________________________________|
 
*/

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(void){
    // Here your code !
int a[4];

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

sort(a,a+5);

for(int i=4;i>0;i--){
cout<<a[i]<<" ";
}
cout<<a[0]<<endl;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

int score[100010];
int main()
{
	int n, m;
	cin >> n >> m;
	int ptot = 0;
	int atot = 0;
	rep(i, m)
	{
		int p;
		cin >> p;
		p--;
		string s;
		cin >> s;
		if(score[p]==-1){
			continue;
		}
		if(s=="AC"){
			ptot += score[p];
			atot++;
			score[p] = -1;
		}
		else
		{
			score[p]++;
		}
	}
	cout << atot << " " << ptot << endl;
	return 0;
}


Measured memory_bytes: 640
def study(A,C,m,n,b,x):
    B = [0 for _ in range(m)]
    cost = 0
    for i in range(n):
        if b[i] == "1":
            for j in range(m):
                B[j] += A[i][j]
            cost += C[i]
    if min(B) >= x:
        return (True,cost)
    else:
        return (False,-1)

def pad(b,n):
    if len(b) < n:
        b = "0"*(n-len(b)) + b
    return b

def main():
    N,M,X = map(int,input().split())
    CA = [list(map(int,input().split())) for _ in range(N)]

    C = [CA[i][0] for i in range(N)]
    A = [CA[i][1:] for i in range(N)]

    INF = 12*10**5+1
    ans = INF
    for i in range(2**N):
        b = pad(bin(i)[2:],N)
        st = study(A,C,M,N,b,X)
        if st[0]:
            cost = st[1]
            ans = min(ans,cost)

    if ans < INF:
        print(ans)
    else:
        print(-1)

if __name__ == "__main__":
    main()


Measured memory_bytes: 9264
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<string>
#include<map>
#include<set>
#include<list>
#define INF 1000000001
using namespace std;
typedef long long ll;
int n, m;
typedef pair<int, int> p;
list<p> a;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	int x, y;
	for (int i = 0; i < m; i++) {
		cin >> x >> y;
		a.push_back(make_pair(x, y));

	}
	//cout << "begin " << endl;
	a.sort();
	//for (auto itr = a.begin(); itr != a.end(); itr++) {
	//	cout << itr->first << " " << itr->second << endl;
	//}
	//cout << endl;
	int ans = 0;
	while (a.size()) {
	/*	cout << "NOW" << endl;
		for (auto itr = a.begin(); itr != a.end(); itr++) {
			cout << itr->first << "    " << itr->second << endl;
		}
		cout << "END" << endl;*/
		auto itr = a.begin();
		int min = itr->first;
		int max = itr->second;
		auto itrr = itr;
		itr++;
		a.erase((itrr));
		while (itr != a.end()) {
			int mi = itr->first;
			int ma = itr->second;
			if (max <= mi) {
				break;
			}
			itrr = itr;
			itr++;
			if (mi < max&&min < ma) {
				a.erase((itrr));
				if (min < mi) {
					min = mi;
				}
				if (ma < max) {
					max = ma;
				}
			}
		}

		//cout << " ss" << endl;
		ans++;
	}
	cout << ans;
	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

int main(){

	int n;
	cin>>n;
	char ch;
	int c[n];
	rep(i,n){
		cin>>ch;
		if(ch=='W')c[i]=0;
		else c[i]=1;
	}

	int r=n-1,l=0;
	int ans=0;
	while(r>l){
		if(c[l]==0){
			while(c[r]==0 && r>=0){
				r--;
			}
			if(c[r]==1 && r>l){
				ans++;
				r--;
			}
		}
		l++;
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 4408
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    string s,t;cin >> s >> t;
    int n = s.size();
    int ans = 0;
    rep(i,n){
        ans += (s[i] != t[i]);
    }cout << ans << endl;
    return 0;
}

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

using namespace std ;
const long long INF = 1e18 + 9 ;
int x , y , n ;

int main()
{
  cin >> n >> x >> y;
  x--;
  y--;
  vector < int > ans(n) ;
  for ( int i = 0 ; i < n ; i++ )
  {
    vector< long long > dist( n , INF) ;
    queue < int > q ;
    q.push(i);
    dist[i] = 0 ;
    while ( !q.empty() )
    {
      int v = q.front();
      q.pop() ;
      int d = dist[v];
      if ( v-1 >= 0 && dist[v-1] == INF )
      {
          q.push(v-1);
          dist[v-1] = d + 1 ;
      }
      if ( v+1 < n && dist[v+1] == INF )
      {
          q.push(v+1);
          dist[v+1] = d + 1 ;
      }
      if ( v == x && dist[y] == INF )
      {
          q.push(y);
          dist[y] = d + 1 ;
      }
      if (v == y && dist[x] == INF )
      {
          q.push(x);
          dist[x] = d + 1 ;
      }
    }
    for ( int j = 0 ; j < n ; j++ )
        ans[dist[j]]++;
  }

  for ( int i = 0 ; i < n ; i++ )
    ans[i] /= 2 ;

  for (int i = 1 ; i <= n-1 ; i++ )
  {
    cout << ans[i] << "\n" ;
  }

  return 0;
}


Measured memory_bytes: 384
// #define _GLIBCXX_DEBUG

#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <string>
#include <vector>
#include <chrono>
#include <cmath>

#define int long long

using namespace std;


signed main() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;

  int e = 60 * h2 + m2;
  int s = 60 * h1 + m1;

  int ans = max(e - s - k, 0LL);

  cout << ans << endl;

  return 0;
}


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


int main(int argc, char *argv[])
{
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, MAXA = 1000001;
    set<int> A;
    multiset<int> B;
    
    cin >> N;
    for (int i = 0; i < N; i++) {
        int t;
        cin >> t;
        
        A.insert(t);
        B.insert(t);
    }
    
    if (A.count(1)) {
        if (B.count(1) > 1) {
            cout << 0 << endl;
        } else {
            cout << 1 << endl;
        }
        return 0;
    }
    
    int visited[MAXA];
    memset(visited, 0, MAXA * sizeof(int));
    
    for (int i = 2; i < MAXA; i++) {
        if (visited[i]) {
            continue;
        }
        
        if (A.count(i) == 0) {
            visited[i] = 1;
            continue;
        }
        
        for (int j = i + i; j < MAXA; j += i) {
            set<int>::iterator it = A.find(j);
            if (it != A.end()) {
                A.erase(it);
            }
        }
        
    }
    
    int overlap = 0;
    for (auto a : A) {
        if (B.count(a) > 1) {
            overlap++;
        }
    }
    
    //cout << (1.0 * (clock() - ti) / CLOCKS_PER_SEC) << endl;
    cout << (int) A.size() - overlap << endl;
    
    return 0;
}


Measured memory_bytes: 26176
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
using Graph = vector<vector<int> >;
using GraphC = vector<vector<char> >;
typedef pair<int, int> P;
typedef int64_t ll;
const int MAX_N = 10000;
const int INF = 1000000000;

int N;
int a[108];

int main() {
	cin >> N;
	rep(i, N) {
		cin >> a[i];
	}
	sort(a, a + N, greater<int>());

	int ret = 0;
	rep(i, N) {
		ret += a[i] * (i & 1 ? -1 : 1);
	}
	cout << ret << endl;
	return 0;
}

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] NAB = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ab = NAB[2] - NAB[1];
            string ans = "Alice";
            if (ab % 2 == 1) ans = "Borys";
            Console.WriteLine(ans);
        }
    }
}

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

bool isint(double x)
{
    return x == floor(x);
}

int main()
{
    ios_base::sync_with_stdio(false);
    int x, y;
    cin >> x >> y;

    // 2a+4b=y
    // 2a+2b=2x

    // b=(y-2x)/2;
    // a=x-b;

    double b = (y - 2 * x) / 2.0;
    double a = x - b;

    if (isint(a) && isint(b) && a >= 0 && b >= 0) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}



Measured memory_bytes: 3648
K = int(input())
A,B = map(int, input().split())
C = K
count = 1
ans = "NG"

while (C<=B):
    #print("test")
    if(A<=C and C<=B):
        ans ="OK"
    C = K*count
    count += 1
    #print(C)


print(ans)


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

#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair

using namespace std;

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

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, s, t;
  cin >> n >> s >> t;
  vector <vector <int>> G(n + 1);
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    G[u].pb(v);
    G[v].pb(u);
  }
  function <void(int, int, vector <int>& dis, vector <int>& path)> dfs = [&] (int u, int p, vector <int>& dis, vector <int>& path) -> void {
    dis[u] = dis[p] + 1;
    for (int v: G[u]) {
      if (v == p) continue;
      path[v] = u;
      dfs(v, u, dis, path);
    }
  };
  vector <int> path_s(n + 1), path_t(n + 1);
  vector <int> dis_s(n + 1), dis_t(n + 1);
  dis_s[0] = dis_t[0] = -1;
  dfs(s, 0, dis_s, path_s);
  dfs(t, 0, dis_t, path_t);
  int ans = 0;
  int eq = INT_MAX;
  for (int i = 1; i <= n; i++) {
    // if (i == s or i == t) continue;
    if (dis_s[i] == dis_t[i]) eq = min(eq, dis_s[i]);
    if (dis_s[i] < dis_t[i]) ans = max(ans, dis_t[i] - 1);
  }
  if (eq < INT_MAX) ans = max(ans, eq);
  cout << ans << '\n';
  return (0);
}


Measured memory_bytes: 14976
#include <bits/stdc++.h>
using namespace std;
char rotate(char c, int n){
  int t = (c - 'A') + n;
  t = t % 26;
  return 'A' + t;
}

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int size = s.size();
  string out = "";
  for(int i =0; i<size; i++){
    out += rotate(s[i],n);
  }
  cout << out << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define SIZE(a) int((a).size();
const int INF=INT_MAX;
const int dx[5]={-1,0,0,0,1};
const int dy[5]={0,-1,0,1,0};
int main(){
  ll h,w;cin>>h>>w;
  vvb masu(h,vb(w));
  rep(i,0,h){
    rep(j,0,w){
      char x;cin>>x;
      masu[i][j]=(x=='#')?1:0;
    }
  }
  vll hh(h,0),ww(w,0);
  rep(i,0,h){
    ll count=0;
    rep(j,0,w){
      if(!masu[i][j]){count++;}
    }
    if(count==w){hh[i]++;}
  }
  rep(i,0,w){
    ll count=0;
    rep(j,0,h){
      if(masu[j][i]==0){count++;}
    }
    if(count==h){ww[i]++;}
  }
  rep(i,0,h){
    rep(j,0,w){
      if(hh[i]==0&&ww[j]==0){
        if(masu[i][j]){cout<<'#';}
        else{cout<<'.';}
      }
    }
    if(hh[i]==0)cout<<endl;
  }

}

Measured memory_bytes: 256
#include <cstdlib>
#include <iterator>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <functional>
#include <cmath>
#include <stack>
#include <bitset>

using namespace std;

#define int long long
#define MAX 1e18

signed main() {
    int n, m, x; 
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int> (m, 0));
    for(int i = 0; i < n; i++) {
        cin >> c[i];
        for(int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }

    int ans = MAX;
    for(int bit = 0; bit < (1 << n); bit++) {
        int sum = 0;
        vector<int> b(m, 0);
        for(int i = 0; i < n; i++) {
            if(bit & (1 << i)) {
                sum += c[i];
                for(int j = 0; j < m; j++) {
                    b[j] += a[i][j];
                }
            }           
        }
        bool flag = true;
        for(int i = 0; i < m; i++) {
            if(b[i] < x) flag = false;
        }
        if(flag) ans = min(ans, sum);
    }

    cout << (ans == MAX ? -1 : ans) << endl;
    return 0;
}

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

a = {}
for i in range(1, n + 1):
    k = str(i)
    j = (int(k[0]), int(k[-1]))
    if j in a:
        a[j] += 1
    else:
        a[j] = 1

def g(b):
    if b in a:
        return a[b]
    return 0
ans = 0
for i in range(10):
    for j in range(10):
        ans += g((i, j)) * g((j, i))
print(ans)

Measured memory_bytes: 3064
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) int __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
struct UnionFind
{
    V<int> par;
    V<int> siz;
    UnionFind(int n) : par(n), siz(n, 1)
    {
        rep(i, n) par[i] = i;
    }
    int root(int x)
    {
        while (par[x] != x) x = par[x] = par[par[x]];
        return x;
    }
    bool unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) false;
        if (siz[rx] < siz[ry]) swap(rx, ry);
        siz[rx] += siz[ry];
        par[ry] = rx;
        return true;
    }
    int same(int x, int y)
    {
        return root(x) == root(y);
    }
};

#pragma endregion RegionDefs

void solve()
{
    IN(n);
    VIN(int, v, n);
    int s = 0;
    rep(i, n) s += v[i];
    int a = 0;
    rep(i, n) a += v[i] * (s - v[i]);
    cout << a/2 << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n,m; cin>>n>>m;
    vector<ll> a(n);
    ll s = 0;
    rep(i,n) cin>>a[i], s += a[i];
    sort(a.begin(), a.end(), greater<>());

    bool ok = true;
    rep(i,m) {
        if (4*a[i]*m < s) ok = false;
    }

    if (ok) {
        cout << "Yes" << '\n';
    }
    else {
        cout << "No" << '\n';
    }

    return 0;
}

Measured memory_bytes: 3612
n = int(input())
restaurants = []
for index in range(1,n+1):
    # 文字列と点数を読み込んで、点数だけint型に変換
    tmp = list(map(lambda x:int(x)+1 if x.isdecimal() else x, input().split()))
    # ソート前のもともとの順番の番号を付与
    tmp.append(index)
    restaurants.append(tmp)
# 文字列の昇順、点数の降順でソート
ans = sorted(restaurants, key=lambda x:(x[0],-x[1]))
for i in ans:
    print(i[2])

Measured memory_bytes: 3060
/**
 *    author:  FromDihPout
 *    created: 2020-08-06
**/

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


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, d;
    cin >> n >> d;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        double x, y;
        cin >> x >> y;
        if (sqrt(x * x + y * y) <= d) {
            ans++;
        }
    }
    cout << ans << '\n';
    
    return 0;
}

Measured memory_bytes: 3740