akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int n;
  cin>>n;
  long long x[n], l[n];
  typedef pair<long long, long long> P;
  vector<P> xl;
  REP(i,n){
    cin>>x[i]>>l[i];
    xl.push_back(P(x[i], l[i]));
  }
  auto cmp = [](P a, P b){
    long long ar = a.first + a.second;
    long long br = b.first + b.second;
    return ar < br;
  };
  sort(ALL(xl), cmp);
  REP(i,n){
    x[i] = xl[i].first;
    l[i] = xl[i].second;
  }
  long long dp[n][2] = {};
  long long mdp[n] = {};
  vector<long long> xpl;
  REP(i,n){
    if(i == 0){
      dp[i][0] = 0;
      dp[i][1] = 1;
      mdp[i] = dp[i][1];
      xpl.push_back(x[i] + l[i]);
      continue;
    }
    dp[i][0] = max(dp[i-1][0], dp[i-1][1]);
    long long cnt = upper_bound(ALL(xpl), x[i]-l[i]) - xpl.begin();
    if(cnt == 0){
      dp[i][1] = 1;
    }else{
      dp[i][1] = mdp[cnt-1] + 1;
    }
    mdp[i] = max(mdp[i-1], dp[i][1]);
    xpl.push_back(x[i] + l[i]);
  }
  long long ans = max(dp[n-1][0], dp[n-1][1]);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 7536
N, T = map(int, input().split())
Timers = [int(i) for i in input().split()]
subTs = [0] * N
for t in range(1, N):
    subTs[t] = Timers[t] - Timers[t - 1]

score = T * N
time = T
for i in range(1, N):
    # お湯でている時にスイッチが押された場合
    if subTs[i] < time:
        lost = T - subTs[i]
        score -= lost
print(score)


Measured memory_bytes: 25196
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
struct each{
    int x,y;
}a[N];
bool com(each x,each y){
    if(x.y==y.y)    return x.x<y.x;
    return  x.y<y.y;
}
int n;
int main(){
    int t=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i].x,&a[i].y);
    sort(a+1,a+n+1,com);
    for(int i=1;i<=n;i++)
        if(t+a[i].x<=a[i].y)    t+=a[i].x;
        else{
            puts("No");
            return 0;
        }
    puts("Yes");
    return 0;
}

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


int32_t main()
{
 ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
 int n,d,x,y; cin>>n>>d; int ct=0;
 while(n--)
 {

     cin>>x>>y;
     if(((x*x)+(y*y))<=d*d)ct++;

 }
 cout<<ct<<endl;
}


Measured memory_bytes: 3808
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long N;
	cin>>N;
     
     if(N<10)
     	cout<<N;
     else if(N<100)
     	cout<<9;
     else if(N<1000)
     	cout<<(N-99)+9;
     else if(N<10000)
     	cout<<900+9;
     else if(N<100000)
     	cout<<(N-9999)+900+9;
     else if(N=100000)
     	cout<<90909;
     else cout<<0;
     

}

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

typedef long long ll;

using namespace std;

inline ll rd(){
	ll x=0,y=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')y=-y;c=getchar();}
	while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
	return x*y;
}

int main(){
	ll a=rd(),b=rd();
	int ans=0;
	while(a<=b){
		a<<=1;
		ans++;
	}
	printf("%d\n",ans);
	
	return 0;
}

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

char str[2048];

bool is_punc(char c){
	return c == ' ' || c == '.' || c == ',';
}

int main(){
	fgets(str,sizeof(str),stdin);
	int len = strlen(str);
	int state = 0; // 0->inval,1->reading
	int ptr = 0;
	bool first = true;

	str[len] = ' ';
	for(int i = 0; i < len; i++){
		if(state == 0){
			if(is_punc(str[i])){
				state = 0;
			}
			else{
				state = 1;
				ptr = i;
			}
		}
		else if (state == 1){
			if(is_punc(str[i])){
				state = 0;
				if(i-ptr >= 3 && i-ptr <= 6){
					if(!first){
						printf(" ");
					}
					for(int j = ptr; j < i; j++){
						printf("%c",str[j]);
						first = false;
					}
				}
			}
			else{
				state = 1;
			}
		}
	}
	printf("\n");
	return 0;
}



Measured memory_bytes: 2912
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n,k,q,a[100000],b=0,c=0;
    cin>>n>>k>>q;
    for(int i=0;i<q;i++){
        cin>>a[i];
    }
    sort(a,a+q);
    
    for(int i=1;i<=n;i++){
        while(i==a[b]){
            c++;
            b++;
        }
        
        if(k-q+c>0){
            cout<<"Yes"<<endl;
        }
        else{cout<<"No"<<endl;}
        c=0;
    }
        
}


Measured memory_bytes: 1024
include Math
a, b, c = gets.split(" ").map(&:to_f)
puts (0.5*a*b*sin(c*PI/180)).round(8)
puts (sqrt(a**2+b**2-2*a*b*cos(c*PI/180)) + a + b).round(8)
puts (b*sin(c*PI/180)).round(8)

Measured memory_bytes: 9004
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n,k = gets.chomp.split.map(&:to_i)
ans = Set.new
k.times do
  d = gets.chomp.to_i
  a = gets.chomp.split.map(&:to_i)
  ans += Set.new(a)
end

puts n - ans.size


Measured memory_bytes: 14792
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

struct edge{int to,cost;};

signed main(){
    //cin.tie(nullptr);
    //ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    vector<vector<edge>> g(n);
    vector<int> color(n,-1);
    rep(i,n-1){
        int u,v,w;
        //cin >> u >> v >> w;
        scanf("%lld%lld%lld",&u,&v,&w);
        u--; v--;
        g[u].PB(edge{v,w});
        g[v].PB(edge{u,w});
    }

    color[0]=0;
    queue<int> que;
    que.push(0);
    while(!que.empty()){
        int v=que.front();
        que.pop();
        for(auto nv:g[v]){
            if(color[nv.to]!=-1) continue;
            if(nv.cost%2==0){
                color[nv.to]=color[v];
                que.push(nv.to);
            }else{
                color[nv.to]=color[v]^1;que.push(nv.to);
            }
        }
    }
    rep(i,n) cout<<color[i]<<endl;
}

Measured memory_bytes: 11372
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int SIZE=1001;
//int arr[SIZE]={};
//ここまでテンプレ
//整数a,bの最大公約数を返す
//ユークリッドの互除法
long long gcd(long long a,long long b){
	if(b==0)
		return a;
	else
		return gcd(b,a%b);
}

//整数a,bの最小公倍数を返す
long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
int main(){
	int N;
	cin>>N;
	ll T[101]={};
	for(int i=0;i<N;i++){
		cin>>T[i];
	}
	ll l=lcm(T[0],T[1]);
	for(int i=1;i<N;i++){
		l=lcm(T[i],l);
	}
	if(N==1)
		l=T[0];
	cout<<l<<endl;
	return 0;
}


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

count = 0
rem = 0
for i in range(N):
    if A[i] >= B[i] + rem:
        count += B[i] + rem
        rem = 0
    elif A[i] <= rem:
        count += A[i]
        rem = B[i]
    else:
        count += A[i]
        rem = B[i] +rem - A[i]
        
if A[N] < rem:
    count += A[N]
else:
    count+= rem
print(count)

Measured memory_bytes: 82020
#include<bits/stdc++.h>
using namespace std;
using Int = long long;

template <typename T,typename E>
struct SegmentTree{
  typedef function<T(T,T)> F;
  typedef function<T(T,E)> G;
  typedef function<T(E,E)> H;
  typedef function<E(E,int)> P;
  int n;
  F f;
  G g;
  H h;
  P p;
  T d1;
  E d0;
  vector<T> dat;
  vector<E> laz;
  SegmentTree(){};
  SegmentTree(int n_,F f,G g,H h,T d1,E d0,
	      vector<T> v=vector<T>(),P p=[](E a,int b){return a;}):
    f(f),g(g),h(h),d1(d1),d0(d0),p(p){
    init(n_);
    if(n_==(int)v.size()) build(n_,v);
  }
  void init(int n_){
    n=1;
    while(n<n_) n*=2;
    dat.clear();
    dat.resize(2*n-1,d1);
    laz.clear();
    laz.resize(2*n-1,d0);
  }
  void build(int n_, vector<T> v){
    for(int i=0;i<n_;i++) dat[i+n-1]=v[i];
    for(int i=n-2;i>=0;i--)
      dat[i]=f(dat[i*2+1],dat[i*2+2]);
  }
  void update(int a,int b,E x,int k,int l,int r){
    if(r<=a||b<=l) return;
    if(a<=l&&r<=b){
      laz[k]=h(laz[k],x);
      return;
    }
    update(a,b,x,k*2+1,l,(l+r)/2);
    update(a,b,x,k*2+2,(l+r)/2,r);
    dat[k]=f(g(dat[k*2+1],p(laz[k*2+1],(r-l)>>1)),
	     g(dat[k*2+2],p(laz[k*2+2],(r-l)>>1)));
  }
  void update(int a,int b,E x){
    update(a,b,x,0,0,n);
  }
  T query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l) return d1;
    if(a<=l&&r<=b) return g(dat[k],p(laz[k],r-l));
    T vl=query(a,b,k*2+1,l,(l+r)/2);
    T vr=query(a,b,k*2+2,(l+r)/2,r);
    return g(f(vl,vr),p(laz[k],min(r,b)-max(l,a)));
  }
  T query(int a,int b){
    return query(a,b,0,0,n);
  }
};


signed main(){
  int n,q;
  cin>>n>>q;
  SegmentTree<Int,Int> ch(n,
			  [](Int a,Int b){return a+b;},
			  [](Int a,Int b){return a+b;},
			  [](Int a,Int b){return a+b;},
			  0,0,vector<Int>(n,0),
			  [](Int a,int b){return a*b;});
  for(int i=0;i<q;i++){
    int c,s,t,x;
    cin>>c;
    if(c){
      cin>>s>>t;
      cout<<ch.query(s-1,t)<<endl;
    }else{
      cin>>s>>t>>x;
      ch.update(s-1,t,x);
    }
  }
}

/*
verified on 2017/10/15
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_G
*/

Measured memory_bytes: 8424
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x) do{rep(__i,(x).size()) pri(x,__i);}while(0)
#define pran(x,n) do{rep(__i,n) pri(x,__i);}while(0)
#define pral(x) do{cerr << (#x) << " =";rep(__i,(x).size()) cerr<<" "<<(x[__i]);cerr<<endl;}while(0)
#define prar(x,b,e) do{repr(__i,b,e) pri(x,__i);}while(0)

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

ll MOD = 1000000007;

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

int main() {
	int N = in();
	vint data(N);
	rep(i, N) data[i] = in();
	sort(data.begin(), data.end());
	map<int, int> hoge;
	rep(i, N) hoge[data[i]]++;
	int ans = 0;
	for (auto &&p : hoge) {
		if (p.second >= p.first) ans += p.second - p.first;
		else ans += p.second;
	}
	cout << ans << endl;
	return 0;
}


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

typedef long long int llint;

int n, m, q;
int a[501][501] = {};

int main()
{
  cin>> n >> m >> q;

  int l, r;
  for(int i = 0; i < m; i++) {
    cin>> l >> r;
    a[l][r]++;
  }

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

  int ql, qr;
  for(int i = 0; i < q; i++) {
    cin>> ql >> qr;

    int cnt = 0;
    for(int j = ql; j <= qr; j++) {
      cnt += a[j][qr] - a[j][ql - 1];
    }

    cout<< cnt <<endl;
  }

  return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};


int main(){
  ll x; cin>>x;
  ll c=x%11;
  ll ans=x/11*2;
  if(c!=0){
    if(c<=6)
    ans++;
    else
    ans+=2;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin >> a;
  string b;
  cin >> b;
  int c = 1;
  for(int i = 0;i < a-1;i++){
    if(b.at(i) != b.at(i+1))c++;}
  cout << c << endl;
  }

Measured memory_bytes: 512
import java.io.*;

class Main{
    public static void main(String[] args) throws Exception{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int num = 0;

       while(true){

            String num1 = br.readLine();
            String[] num2 = num1.split(" ");
            int H = Integer.parseInt(num2[0]);
            int W = Integer.parseInt(num2[1]);

            if(H == 0 && W == 0){
                break;
            }

            for(int i=0; i<H; i++){
                for(int j=0; j<W; j++){
                    if(i == 0 || i == H-1){
                        System.out.print("#");
                    }else if(j == 0 || j == W-1){
                        System.out.print("#");
                    }else {
                        System.out.print(".");
                    }
                }
                    System.out.println("");
            }
            System.out.println("");
        }
    }
}

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

vector<ll>adj[100005];
ll visited[100005],a[100005];

ll dfs(ll pa)
{
    visited[pa]=1;
    //x++;
    for(ll i=0;i<adj[pa].size();i++)
    {
        if(visited[adj[pa][i]]==0)
        {
            a[pa]=max(a[pa],1+dfs(adj[pa][i]));
        }
        else
        {
            a[pa]=max(1+a[adj[pa][i]],a[pa]);
        }
    }
    return a[pa];
}

int main()
{
    ll n,m,i,x,y;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>x>>y;
        adj[x].push_back(y);
    }
    for(i=1;i<=n;i++)
    {
        if(visited[i]==0)
        {
            dfs(i);
        }
    }
    ll max1=0;
    for(i=1;i<=n;i++)
    {
        max1=max(max1,a[i]);
    }
    cout<<max1<<endl;
}

Measured memory_bytes: 9344
array = Array.new
str = gets.chomp.split(" ")
str.each do |s|
    if s == "0"
        array << s.to_i
    elsif s.to_i == 0
        a = array.pop
        b = array.pop
        if s == "+"
            array << a + b
        elsif s == "-"
            array << b - a
        elsif s == "*"
            array << b * a
        end
    else
        array << s.to_i
    end
end

puts array[0]


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

def main():
    h,w,k = map(int,ipt().split())
    x1,y1,x2,y2 = map(int,ipt().split())
    x1 -= 1; y1 -= 1; x2 -= 1; y2 -= 1
    ms = [input()+"@" for _ in range(h)]
    ms.append("@"*(w+1))
    hq = []
    al = [[10**18]*w for _ in range(h)]
    al[x1][y1] = 0
    dr = [(0,1),(1,0),(0,-1),(-1,0)]
    hpq.heappush(hq,(0,x1,y1))
    while hq:
        c,x,y = hpq.heappop(hq)
        cn = c+1
        if x == x2 and y == y2:
            print(c)
            exit()
        for dx,dy in dr:
            xx = x
            yy = y
            for i in range(k):
                xx += dx
                yy += dy
                if ms[xx][yy] == "." and al[xx][yy] > cn:
                    al[xx][yy] = cn
                    hpq.heappush(hq,(cn,xx,yy))
                elif ms[xx][yy] == "." and al[xx][yy] == cn:
                    continue
                else:
                    break
    print(-1)

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 133732
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll ,ll );
ll mod_add(ll ,ll );
ll mod_mul(ll ,ll );
ll mod_div(ll ,ll );
void make_fact(ll );
void make_invfact(ll );



int main(void){

  ll n;
  cin>>n;
  
  cout << n*n*n << endl;

  return 0;

}

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

ll mod_mul(ll a,ll b){
  return (a*b)%mod;
}

ll mod_div(ll a,ll b){
  return mod_mul(a,mod_pow(b,mod-2));
}

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}

Measured memory_bytes: 256
#include<stdio.h> 

int main() {
	int H, W, cnt;
	char weather[100][100];
	int ans[100][100];
	scanf("%d%d", &H, &W);
	for (int i = 0; i < H; i++){
		scanf("%s", weather[i]);
	}
	for (int i = 0; i < H; i++){
		cnt = -1;
		for (int j = 0; j < W; j++){
			if (weather[i][j] == 'c')ans[i][j] = cnt = 0;
			else if (cnt >= 0)ans[i][j] = ++cnt;
			else ans[i][j] = -1;
		}
	}
	for (int i = 0; i < H; i++){
		for (int j = 0; j < W; j++){
			printf("%d", ans[i][j]);
			if (j == W - 1)putchar('\n');
			else putchar(' ');
		}
	}
	return 0;
}

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

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

  int cnt = 0;
  for (char c : s) {
    if (c == 'A') cnt++;
  }

  if (cnt == 0 || cnt == 3) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
 using namespace std ;
 int main()
{
short int c=0;
char s[3];

cin>>s;

if(((s[0]=='a')&&(s[1]=='b')&&(s[2])=='c')||
  ((s[0]=='a')&&(s[1]=='c')&&(s[2])=='b')||
  
((s[0]=='b')&&(s[1]=='a')&&(s[2])=='c')||
((s[0]=='b')&&(s[1]=='c')&&(s[2])=='a')||

((s[0]=='c')&&(s[1]=='b')&&(s[2])=='a')||
((s[0]=='c')&&(s[1]=='a')&&(s[2])=='b'))

 cout<<"Yes";
else
cout<<"No";

}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main() 
{
  string a, b, c; cin >> a >> b >> c;
  if(a[a.size()-1] == b[0] && b[b.size()-1] == c[0]){
    cout << "YES" <<endl;
  }
  else cout << "NO" << endl;
  system("pause");
}

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

int main() {
  string s , t ;
  cin >> s >> t ;
  
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  
  if(s<t){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void){
    
    int l;
    int r;
    int minus;
    int minusx;
    int id;
    int jd;
    int ans = 2018;
    int tmp;
    int loop;
    
    scanf("%d%d", &l, &r);
    
    minus = r - l;
    minusx = minus / 20190;
    minus = minusx * 20190;
    r -= minus;
    
    for(int i=l; i<r; i++){
        
        loop = 0;
        
        for(int j=i+1; j<=r; j++){
            
            id = i % 2019;
            jd = j % 2019;
            
            tmp = id * jd;
            tmp %= 2019;
            
            if(tmp<ans){
                
                ans = tmp;
                
            }
            
            
        }
        
    }
    
    printf("%d", ans);
    
    return 0;
    
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<cstdio>
#include<iomanip>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int INF = 1e9 + 7;
int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int Max = min(A, B);
	int Min;
	if (N >= A + B)Min = 0;
	else Min = A + B - N;
	cout <<  Max <<" "<< Min << endl;
	return 0;
}

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

int main(){
  int A,B,C,D;
  
  cin >> A >> B >> C >> D;
  
  while (1){
    C -= B;
    A -= D;
    
    if(C <= 0){
      cout << "Yes" << endl;
      break;
    }
    if(A <= 0){
      cout << "No" << endl;
      break;
    }
  }
}



Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ll n,m;
vl g[MAX];
ll d[MAX];
ll vis[MAX],p[MAX];
void bfs(){
  queue<ll>q;
  q.push(1);
  vis[1] = 1;
  d[1] = 0;
  p[1] = 0;
  while(!q.empty()){
    ll u = q.front();q.pop();
    for(auto v:g[u]){
      if(!vis[v]){
        vis[v]=1;
        d[v]=d[u]+1;
        p[v] = u;
        q.push(v);
      }
    }
  }
  return;
}

int main(){FAST;
cin>>n>>m;
for(ll i=1;i<=m;++i){
  ll u,v;cin>>u>>v;
  g[u].pb(v);
  g[v].pb(u);
}
bfs();

ll ok = 1;

for(ll i=2;i<=n;++i){
  if(!d[i]){
    ok = 0;
    break;
  }
}

if(!ok){
  cout<<"No\n";
}
else{
  cout<<"Yes\n";
  for(ll i=2;i<=n;++i){
    cout<<p[i]<<'\n';
  }
}

return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */


Measured memory_bytes: 14664
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

n,m = map(int,input().split())
uf = UnionFind(n)

A = [0]*m
B = [0]*m

for i in range(m):
  a,b = map(int,input().split())
  A[i],B[i] = a-1, b-1

total = n*(n-1)//2  
ans = [total] 
cost = 0

for a,b in zip(A[::-1],B[::-1]):    
  if uf.same(a,b):
    ans.append(ans[-1])
  else:
    ans.append(ans[-1] - uf.size(a)*uf.size(b))
      
  uf.union(a,b)

ans.pop()
for a in ans[::-1]:
  print(a)

Measured memory_bytes: 17708
for(a=[],b=100;b--;)c=a[b]=0;require("fs").readFileSync("/dev/stdin","utf8").split('\n').some(function(i){if(+i)a[+i]++,c=a[+i]>c?a[+i]:c});a.some(function(i,j){if(i==c)console.log(j)})

Measured memory_bytes: 7384
# coding:utf-8
import numpy as np

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

X = int(input())

l = seachPrimeNum(100003)

for n in l:
    if n >= X:
        print(n)
        exit(0)

Measured memory_bytes: 25656
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
const int MR=1e5+10;
typedef long long LL;

int a[MR],b[MR];

int main() {
	int n,H;
	cin>>n>>H;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	sort(a,a+n);
	sort(b,b+n);
	int maxa=a[n-1],cnt=0;
	for(int i=n-1;i>=0;i--){
		if(b[i]>maxa && H>0){
			H-=b[i];
			cnt++;
		}
		else break;
	}
	if(H>0) cnt+=(H+maxa-1)/maxa;
	printf("%d\n",cnt);
    return 0;
}

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

int main(){ // O(N+logA+logM)
    using namespace std;
    unsigned long N, M;
    cin >> N >> M; // O(logN+logM)
    vector<unsigned long> A;
    A.reserve(N); // O(N)
    copy_n(istream_iterator<unsigned long>(cin), N, back_inserter(A)); // O(N)
    {
        vector<unsigned long> s(31);
        for(const auto& i : A)++s[__builtin_clzl(i) - 33UL]; // O(N)
        partial_sum(s.cbegin(), s.cend(), s.begin()); // O(logA)
        partial_sum(s.cbegin(), s.cend(), s.begin()); // O(logA)
        s[30] = M + 2;
        auto t = s.end() - upper_bound(s.cbegin(), s.cend(), M); // O(loglogA)
        for(auto& i : A)if(64UL > t + __builtin_clzl(i)){ // O(N)
            auto k = 64UL - t - __builtin_clzl(i);
            M -= k;
            i >>= k;
        }
    }
    nth_element(A.begin(), A.begin() + M - 1, A.end(), greater<>()); // expected O(N)
    unsigned long ans{0};
    for(unsigned long i = 0; i < N; ++i)ans += A[i] >> (i < M); // O(N)
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
int main()
{
    int a,b,c,x,y;
    scanf("%d %d %d", &a, &b, &c);

    x=b-a;

    y=c-b;


    if(x==y)
    {
        printf("YES");
    }
    else{
        printf("NO");
    }
    return 0;
}


Measured memory_bytes: 1732
#include <stdio.h>
#include <string.h>
 int main()
 {
     int i,j,k=0;
	 char str[26];
     gets(str);
     for (i = 0; i < strlen(str); i++)
	 	{
         for (j =i + 1; j < strlen(str);j++) 
		 	{
             if (str[i] == str[j]) 
			 k=1;
            }
        }
     if(k==1) printf("no");
     else printf("yes");
 }

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

int main(){
    int N;
    cin >> N;

    vector<int> a(N);
    vector<int> b(N);
    for(int i = 0; i < N; i++) cin >> a[i];
    for(int i = 0; i < N; i++) cin >> b[i];

    int ans = 0;
    for(int i = 0; i < N; i++){
        int sum = 0;
        for(int j = 0; j <= i; j++){
            sum += a[j];
        }
        for(int k = i; k < N; k++){
            sum += b[k];
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
S = input()

'''
考え方

1.奇数番目、偶数番目に0,1のいずれが何個多いのか、を確認する。
1-1.それぞれ0,1,と異なる数字の方が多く出現する。
それぞれの奇数＆偶数番目の少数派の数字を合わせる。

1-2.奇数・偶数共に同じ数字が多く出現する
多く出現する方をその数字に合わせる。
'''

len_S = len(S)

# 奇数番目
odd_0 = 0
for s in range(0,len_S,2):
  if S[s] == '0':
    odd_0 += 1

# 偶数番目
even_0 = 0
for s in range(1,len_S,2):
  if S[s] == '0':
    even_0 += 1

# 状況整理
import math
odd_1 = math.ceil(len_S / 2) - odd_0
even_1 = math.floor(len_S / 2) - even_0

# ans
# 1.奇数列において０が過半数
if odd_0 >= odd_1:
  # 1-1.偶数列の方が多く0が出現.(偶数列における1の数) + (奇数列における0の数)
  if odd_0 <= even_0:
    ans = even_1 + odd_0
  # 1-2.偶数列の方が0出現頻度が小さい.(偶数列における0の数) + (奇数列における1の数)
  else:
    ans = even_0 + odd_1
# 2.奇数列において１が過半数
else:
  # 2-1.偶数列の方が1が多い.(偶数列の０) + (奇数列の1)
  if odd_1 <= even_1:
    ans = even_0 + odd_1
  else:
    ans = even_1 + odd_0
    
print(ans)

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.D_Challenge
{
    class ABC_046
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string s = Read();
            int res = 0;
            for(int i = 0; i < s.Length; i++)
            {
                if (i % 2 == 0)
                {//グー
                    res += s[i] == 'g' ? 0 : -1;
                }
                else
                {
                    res += s[i] == 'g' ? 1 : 0;
                }
            }
            Console.WriteLine(res);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11232
import itertools
from collections import defaultdict


def main():
    N = int(input())
    A = defaultdict(int)
    for x in range(1, N + 1):
        breakflag = False
        for y in range(1, N + 1):
            for z in range(1, N + 1):
                a = x**2 + y**2 + z**2 + x * y + y * z + z * x
                if a <= N:
                    A[a] += 1
                else:
                    break
    for i in range(N):
        print(A[i + 1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 76372
def hsum(num1, num2)
  num1array = num1.to_s(2).chars.map(&:to_i)
  num2array = num2.to_s(2).chars.map(&:to_i)
  keta = [num1array.count, num2array.count].max
  sum = []
  keta.times do |i|
    if ((num1array[-1 * (i+1)] || 0) + (num2array[-1 * (i+1)] || 0)) == 1
      sum << 1
    else
      sum << 0
    end
  end
  sum.reverse!.join.to_i(2)
end

n = gets.chomp.to_i
as = gets.split.map(&:to_i)
bool = "No"
if as.uniq.count == 1 && as.uniq[0] == hsum(as.uniq[0],as.uniq[0]).to_s(10).to_i
  bool = "Yes"
elsif n % 3 == 0
  asuniq = as.uniq
  if asuniq.count == 2
    if asuniq[0] == hsum(asuniq[1],asuniq[1]).to_s(10).to_i
      if as.count(asuniq[0]) * 2 == as.count(asuniq[1])
        bool = "Yes"
      end
    end
    if asuniq[1] == hsum(asuniq[0],asuniq[0]).to_s(10).to_i
      if as.count(asuniq[1]) * 2 == as.count(asuniq[0])
        bool = "Yes"
      end
    end
  end
  if asuniq.count == 3
    if asuniq[1] == hsum(asuniq[0],asuniq[2]).to_s(10).to_i
      if as.count(asuniq[1]) == (n / 3) && as.count(asuniq[0]) == (n / 3) && as.count(asuniq[2]) == (n / 3)
        bool = "Yes"
      end
    end
  end
end
puts bool

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

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

int main()
{
	int n,c,k;
	cin >> n >> c >> k;
	vector<int> t(n);
	FOR(i,0,n)cin >> t[i];
	sort(ALL(t));
	int ans = 0;
	int busTime = -INF;
	int busPassenger = 0;
	FOR(i,0,n){
		if(busTime < t[i] || t[i] + k < busTime || busPassenger >= c){
			ans++;
			busTime = t[i] + k;
			busPassenger = 1;
			//cout << busTime << "\n";
		}else{
			busPassenger++;
		}
	}
	ANS(ans);
	return 0;
}


Measured memory_bytes: 640
import sys 
sys.setrecursionlimit(10**6)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,u,v = map(int,readline().split())
AB = [[] for _ in range(N+1)]
for _ in range(N-1):
    a,b = map(int,readline().split())
    AB[a].append(b)
    AB[b].append(a)
    
tdist = [0]*(N+1)
adist = [0]*(N+1)

def tdfs(x,pre):
    for to in AB[x]: 
        if to == pre:
            continue
        tdist[to] = tdist[x]+1
        tdfs(to,x)

def adfs(x,pre):
    for to in AB[x]: 
        if to == pre:
            continue
        adist[to] = adist[x]+1
        adfs(to,x)

tdfs(u,-1)
adfs(v,-1)

ans = 0
for i in range(1,N+1):
    if tdist[i] < adist[i]:
        k = adist[i] - tdist[i]
        ans = max(ans,tdist[i] + k-1)
print(ans)


Measured memory_bytes: 102044
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;
    if(x-r>=0 && x+r <=W && y-r>=0 && y+r<=H) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin >> s;
    if (s == "ABC") cout << "ARC";
    else cout << "ABC";
    cout << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

    if( a % b == 0 ) return b;
    return gcd( b, a % b );
}


int main(){
  int a,b;
  while(scanf("%d%d",&a,&b) != EOF){
    int g=gcd(a,b);
    printf("%d %d\n",g,a/g*b);
  }

  return 0;
}



Measured memory_bytes: 2712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define s second
#define f first
long long const mod = 1000000007; 
#define inf 1000000000000000000
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod)+mod)%mod;}
inline ll mul(ll a, ll b){ return (((a%mod)*(b%mod))%mod+mod)%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

ll power(ll x,ll y,ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2, m) % m;
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
}

ll modInv(ll x)
{
    return power(x,mod-2,mod)%mod;
}

struct st
{
    ll s,e,ind;
};
bool compare(st s1,st s2)
{
    if(s1.s==s2.s)
        return s1.e<s2.e;
    return s1.s<s2.s;
}

bool operator<(const st& t1, const st& t2) 
{ 
    return (t1.ind < t2.ind); 
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll n,m;
    cin>>n>>m;
    ll a[n];
    ld s=0;
    for(int i=0;i<n;i++)
        cin>>a[i],s=s+a[i];
    ll c=0;
    for(int i=0;i<n;i++)
    {
        ld x=1/ld((4*m));
        ld y=a[i]/s;
        if(y>=x)
            c++;
    }

    if(c>=m)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int mul(int a, int b, int sum){
    int ans;
    ans = a * b;
    ans = sum + ans;

    return ans;
}
int main(void){
    int a, b, c, x, i, j, k;
    int sum=0, cnt=0;

    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    scanf("%d", &x);

    if(a>0){
        for(i=0; i<=a; i++){
            if(b>0){
                for(j=0; j<=b; j++){
                    for(k=0; k<=c; k++){
                        sum = mul(i, 500, sum);
                        sum = mul(j, 100, sum);
                        sum = mul(k, 50, sum);

                        if(sum == x){
                            cnt++;
                        }
                        sum = 0;
                    }
                }
            }else{
                for(j=0; j<=c; j++){
                    sum = mul(i, 500, sum);
                    sum = mul(j, 50, sum);

                    if(sum == x){
                        cnt++;
                    }
                    sum = 0;    
                        
                }
                
            }
        }
    }else{
        if(b>0){
            for(i=0; i<=b; i++){
                for(j=0; j<=c; j++){
                    sum = mul(i, 100, sum);
                    sum = mul(j, 50, sum);

                    if(sum == x){
                        cnt++;
                    }
                    sum = 0;    
                }
            }
        }else{
            for(i=0; i<=c; i++){
                sum = mul(i, 50, sum);

                if(sum == x){
                    cnt++;
                }
                sum = 0;
            }
        }
    }

    printf("%d\n", cnt);

    return 0;
}

Measured memory_bytes: 128
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val x = sc.nextLong()
    val t = sc.nextLong()
    println(problem072a(x, t))
}

fun problem072a(x: Long, t: Long): Long {
    return Math.max(x - t, 0)
}

Measured memory_bytes: 29460
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  fspcnt = 0;
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t x,y;
  cin >> x >> y;
  if(x % y == 0){
    cout << -1 << endl;
  }else{
    cout << (y-1)*x << endl;
  }
}

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

int main(){
  if(df) printf("*debug mode*\n");
  string s; cin >>s;
  int a=s.size(); a-=2;
  if(*(s.begin())==*(s.end()-1)) a--;
  
  printf("%s\n",a%2?"First":"Second");
}

/// confirm df==0 ///

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

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


Measured memory_bytes: 3104
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#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) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<int,int>
#define V vector<ll>
#define M map<int,int>
#define S set<int>
#define L list<int>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){
  CIN(n,m);
  ll ans = LINF;
  REP(ttt,2){
    if(ttt)swap(n,m);

    //縦(or横)の三分割
    int i1=n/3;
    int i2=(n-i1)/2;
    int i3=n-i1-i2;
    int maxi=max({i1,i2,i3});int mini=min({i1,i2,i3});
    if(mini)ans=min(ans,1LL*(maxi-mini)*m);
  
    //縦or横に全探索して長い方を2で割る
    REP(i,n){
      ll j1 = 1LL*i*m;
      ll j2 = 1LL*(n-i)*(m/2);
      ll j3 = 1LL*n*m-j1-j2;
      ll maxi=max({j1,j2,j3});ll mini=min({j1,j2,j3});
      if(mini)ans=min(ans,maxi-mini);
    }
  }
  COUT(ans);

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int a,b,t,w;
bool flag;
void lian(int x,int y){
	int m=y;
	while(m!=0){
	    w++;
	    m/=10;
	}
}
void ping(int z){
	for(int i=1;i*i<=z;i++){
		if(i*i==z) flag=1;
	}
}
int main(){
	cin>>a>>b;
	lian(a,b);
	t=pow(10,w)*a+b;
	ping(t);
	if(flag) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
// B - Trick or Treat
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	int N,K; cin>>N>>K;
	vector<int> ok(N, 0); // ok=1, ng=0
	int ans = N;
	rep(i, K){
		int d; cin>>d;
		rep(j, d){
			int a; cin>>a;
			if(ok[a-1] == 0) ans--;
			ok[a-1] = 1;
		}
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 3624
H, W = map(int, input().split())
field = [input() for _ in range(H)]
drawable = True
for i in range(H):
    for j in range(W):
        if field[i][j] == ".":
            continue
        for di, dj in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            ni, nj = i + di, j + dj
            if 0 <= ni < H and 0 <= nj < W and field[ni][nj] == "#":
                break
        else:
            drawable = False
print("Yes") if drawable else print("No")



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define NIL -1
typedef long long ll;
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll MOD = 1000000007;


int main() {
    int N, K;
    cin >> N >> K;
    int res = 0;
    while(N) {
        N /= K;
        ++res;
    }    
    cout << res << endl;
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
using namespace std;
long long MOD = 1e9 + 7;

vector<vector<bool>> M;
int W, H,N;

int main() {
	cin >> W >> H >> N;
	M.resize(W + 1, vector<bool>(H + 1, false));
	for (int n = 0; n < N; n++) {
		int x, y, a;
		cin >> x >> y >> a;
		if (a == 1) {
			for (int xx = 1; xx <= x; xx++) {
				for (int yy = 1; yy <= H; yy++)M[xx][yy] = true;
			}
		}
		else if (a == 2) {
			for (int xx = x+1; xx <= W; xx++) {
				for (int yy = 1; yy <= H; yy++)M[xx][yy] = true;
			}
		}
		else if (a == 3) {
			for (int yy = 1; yy <= y; yy++) {
				for (int xx = 1; xx <= W; xx++)M[xx][yy] = true;
			}
		}
		else {
			for (int yy = y+1; yy <= H; yy++) {
				for (int xx = 1; xx <= W; xx++)M[xx][yy] = true;
			}
		}
	}
	int counter = 0;
	for (int xx = 1; xx <= W; xx++) {
		for (int yy = 1; yy <= H; yy++) {
			if (!M[xx][yy])counter++;
		}
	}
	cout << counter << endl;
	return 0;
}


Measured memory_bytes: 256