akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
    int main(){
        string S;
        cin >> S;
        int size = S.size() - 2;
        vector<int> s(size);
            for(int i = 0; i < size; i++){
                //s.at(i) = "";
                s.at(i) = 100*int(S.at(i)-48) + 10*int(S.at(i+1)-48) + int(S.at(i+2)-48);
                //cout << s.at(i) << " ";
                //cout << s.at(i) << " ";
            }
                for(int j = 0; j < size + 2; j++){
                    
                }
            //for(int i = 0; i < S.size() - 2; i++){
            //    s.at(0) = S.at(i) + S.at(i+1) + S.at(i+2);
            //}
                    int min;
                    if(s.at(0) < 753){
                        //cout << 753 - s.at(0) << " ";
                        min = 753 - s.at(0);
                    }else{
                        //cout << s.at(0) - 753 << " ";
                        min = s.at(0) - 753;
                    }
                        for(int k = 0; k < size; k++){
                            if(s.at(k) < 753){
                                //cout << 753 - s.at(k) << " ";
                                    if(753 - s.at(k) < min){
                                        min = 753 - s.at(k);
                                    }
                            }else{
                                //cout << s.at(k) - 753 << " ";
                                    if(s.at(k) - 753 < min){
                                        min = s.at(k) - 753;
                                    }
                            }
                        }
            cout << min << endl;
    return 0;}


Measured memory_bytes: 256
N,W = map(int,input().split())
VW = [list(map(int,input().split())) for i in range(N)]
Val = [VW[i][0] for i in range(N)]
Wei = [VW[i][1] for i in range(N)]

dp = [[0 for j in range(W+1)] for i in range(N+1)]
#dp[i][j]:i番目までで重さがjまででの価値の最大値

for i in range(1,N+1):
    for j in range(1,W+1):
        if j - Wei[i-1] >= 0:
            dp[i][j] = max(dp[i-1][j],dp[i][j-Wei[i-1]]+Val[i-1])
        else:
            dp[i][j] = dp[i-1][j]

print(dp[N][W])



Measured memory_bytes: 16144
def myAnswer(s:list) -> str:
   ans = 0
   pre =s.pop(0)
   for i in s:
      if(pre == i):
         ans += 1
      pre = "1" if(pre == "0") else "0"
   return ans

def modelAnswer():
   tmp=1
def main():
   s = list(input())
   print(myAnswer(s))

if __name__ == '__main__':
   main()

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

int n;
string s;
int main(){
	cin >> n;
	cin >> s;
	int a = 0;
	int b = s.size()-1;
	int counter = 0;
	while(a <= b){
		if(s[a] == 'W' && s[b] == 'R'){ counter++;swap(s[a],s[b]);}
		else if(s[a] == 'W') b--;
		else if(s[b] == 'R') a++;
		else{
			a++;b--;
		}
	}
	cout << counter << "\n";
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define int ll
#define endl "\n"
#define all( x ) x.begin(), x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);

typedef unsigned long long ull;

const int inf = 1e11 + 5;
const long double PI = 3.141592653589793;

void solve(){
  int k;
  cin >> k;
  int ans = 0;
  for(int a = 1; a <= k; a++){
    for(int b = 1; b <=k; b++){
      for(int c = 1; c <=k; c++){
        ans += __gcd(a, __gcd(b, c));
      }
    }
  }
  cout << ans << endl;
  return;
}  
signed main(){
  fast;
  int t;
  t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
char s[1000005];
int f[1000005],g[1000005],len,cnt;
int main() {
    scanf("%d%s",&len,s+1);
    f[0]=cnt=0;    
    for (int i=1;i<=len;i++) {
	if (s[i]=='0') cnt=0;
	else cnt++;
	g[i]=cnt;
	f[i]=f[i-1];
	if (cnt==0) continue;
	if (i-cnt-1>0&&s[i-cnt-1]=='1') f[i]=max(f[i],f[i-cnt-2]+cnt);
	if (i>1&&s[i-1]=='0')
	    for (int j=1;j<=g[i-2];j++) f[i]=max(f[i],f[i-j-2]+j);
    }
    printf("%d\n",f[len]);
    return 0;
}


Measured memory_bytes: 8576
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

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

ll a[int(1e5)+5];

int main(){

    ll n,x;
    ll cnt=0;
    cin >> n >> x;
    for(ll i=0; i<n; i++) cin >> a[i];

    for(ll j=0; j<n-1; j++){
        if(a[j] + a[j+1] <= x) continue;
            ll tmp_sum = a[j] + a[j+1];
            cnt += tmp_sum - x;
            a[j+1] -= (tmp_sum - x);
            if(a[j+1] < 0) {
                a[j+1] = 0; //マイナスになられては困るので
            } //同様
    }

    cout << cnt << endl;
    
}

Measured memory_bytes: 1024
(* Vicfred
 * https://atcoder.jp/contests/abc142/tasks/abc142_b
 * implementation, simulation
 * *)
let n, k = Scanf.scanf "%d %d\n" @@ fun n k -> n, k
let cs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun h -> if h >= k then 1 else 0
let main = Printf.printf "%d\n" @@ Array.fold_left ( + ) 0 cs 



Measured memory_bytes: 6628
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N;
  cin >> N;
  
  int ans = 0;
  int M = 0;
  for (int i = 0; i < N; i++)
  {
    int p;
    cin >> p;
    ans += p;
    chmax(M, p);
  }
  ans -= M / 2;
  
  cout << ans << endl;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  
  // 0番目の人がリーダーだったときの方向転換する人数を計算
  int ans= 0;
  for(int i=1; i<N; i++){
    if( S.at(i)=='E' ){
      ans++;
    }
  }
  int tmp= ans;

  // リーダーをずらしていく
  for(int i=1; i<N; i++){
    if( S.at(i-1)=='W' ){ tmp++; }
    if( S.at(i)=='E' ){ tmp--; }

    if( ans > tmp ){
      ans= tmp;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 900
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)


typedef long long int ll;
typedef double D;      // ??§?¨?????????????double???long double?????????
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;


const int INF = (1<<30) - 1;
const D EPS = 1e-9;

#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

int c[100][100];

//g++ -std=c++0x -msse4.2 -O3
//#include <bits/stdc++.h>
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.precision(16);
    
    int N; cin >> N;
    for(int i=0; i<N; i++)
        for(int j=0; j<N; j++)
            cin >> c[i][j];
    
    ll ans = 0;
    for(int i=0; i<N; i++)
        for(int j=i+1; j<N; j++)
            ans += min(c[i][j], c[j][i]);
        
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1236
import java.util.*;
import java.io.*;
public class Main {
  public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int n = sc.nextInt();
   if (n>=30) {
     System.out.println("Yes");
   }
   else{
     System.out.println("No");
   }
  }
}


Measured memory_bytes: 35528
N = int(input())
H = [int(i) for i in input().split()]

res = "Yes"
is_down = False
for i in range(N-1):
  if H[i] >= H[i+1] + 2:
    res = "No"
    break
  elif H[i] == H[i+1] + 1:
    if is_down:
      res = "No"
      break
    else:
      is_down = True
  elif H[i] < H[i+1]:
    is_down = False

print(res)


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

int main(){
  int a,b;

  cin >> a >> b;

  if(a > b) {
    cout << "a > b" << endl;
  } else if (a == b) {
    cout << "a == b" << endl;
  } else {
    cout << "a < b" << endl;
  }

  return 0;
}

Measured memory_bytes: 3088
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>A(N); rep(i, 0, N) { cin >> A[i]; }

	double sum = 0;
	rep(i, 0, N) {
		sum += 1.0 / A[i];
	}

	cout << 1.0 / sum << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()



using namespace std;





int main() {
  int x,y,z;
  cin>>x>>y>>z;
  cout<<z<<" "<<x<<" "<<y<<endl;

  

  

  return 0;
}

Measured memory_bytes: 256
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

string S;
int ans;

signed main(){

    in(S);
    for(auto c:S){
        if(c=='2') ans++;
    }
    out(ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=100003,INF=1<<30;

int go[MAX][80];

int main(){
    
    int N;cin>>N;
    vector<ll> X(N),diff(N-1),to(N-1),ans(N);
    for(int i=0;i<N;i++) cin>>X[i];
    for(int i=0;i<N-1;i++) diff[i]=X[i+1]-X[i];
    
    ll M,K;cin>>M>>K;
    vector<int> A(M);
    for(int i=0;i<M;i++) cin>>A[i];
    
    iota(all(to),0);
    
    for(int i=0;i<M;i++){
        swap(to[A[i]-2],to[A[i]-1]);
    }
    
    for(int i=0;i<N-1;i++){
        go[i][0]=to[i];
    }
    
    for(int j=1;j<70;j++){
        for(int i=0;i<N-1;i++){
            go[i][j]=go[go[i][j-1]][j-1];
        }
    }
    
    ans[0]=X[0];
    
    for(int i=0;i<N-1;i++){
        int id=i;
        for(int j=0;j<63;j++){
            if(K&(1LL<<j)){
                id=go[id][j];
            }
        }
        ans[i+1]=ans[i]+diff[id];
    }
    
    for(ll a:ans) cout<<a<<endl;
    
}



Measured memory_bytes: 35968
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=input()
C=collections.Counter(n)
print(C["2"])

Measured memory_bytes: 38384
#include <bits/stdc++.h>
typedef long long ll;
#define  rep(i,a,b)for(long long i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
const ll INF=1000000000000LL;
const ll r197=1000000007;
typedef pair<int,int>P;
typedef pair<int,P>Pa;
bool Inframe(int a,int b,int c,int d,int h,int w){
	if(a+b>=0&&a+b<h&&c+d>=0&&c+d<w)return true;
	return false;
}

int n,k,p[200005],ans=0;
string str;
priority_queue<P ,vector<P>,greater<P> > que;
set<P> st;
bool a=0;
int main() {
	cin>>n;
	int h;
	for(int i=1;i<=n;++i){
		cin>>h;
		que.push(P(h,i));
	}
	for(int i=0;i<n-1;++i){
		P p=que.top();que.pop();
		cout<<p.second<<" ";
	}
	cout<<que.top().second<<endl;
	return 0;
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
int n, m, k, sums[15];
char a[15][1010];
int main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin>>n>>m>>k;
	for (int i=1; i<=n; i++){
		for (int j=1; j<=m; j++){
			cin>>a[i][j];
		}
	}
	int ans = 1e9;
	for (int mask=0; mask<=(1<<n)-1; mask++){
		vector<int> sect;
		sect.push_back(0);
		int anstemp = 0;
		for (int bit=0; bit<=n-1; bit++){
			if (mask & (1 << bit)){
				sect.push_back(bit + 1);
				anstemp++;
			}
		}
		for (int i=1; i<=n; i++){
			sums[i] = 0;
		}
		sect.push_back(n+1);
		for (int j=1, left=0; j<=m; j++){
			for (int t=1; t<sect.size(); t++){
				for (int i=sect[t-1]; i<=sect[t]-1; i++){
					if (a[i][j] == '1'){
						sums[t]++;
					}
				}
			}
			bool good1 = true;
			for (int t=1; t<sect.size(); t++){
				if (sums[t] > k){
					good1 = false;
					break;
				}
			}
			bool good2 = true;
			if (good1 == false){
				for (int jj=left; jj<j; jj++){
					for (int t=1; t<sect.size(); t++){
						for (int i=sect[t-1]; i<=sect[t]-1; i++){
							if (a[i][jj] == '1'){
								sums[t]--;
							}
						}
					}
				}
				for (int t=1; t<sect.size(); t++){
					if (sums[t] > k){
						good2 = false;
						break;
					}
				}
				left = j;
				anstemp++;
			}
			if (good2 == false){
				anstemp = 1e9;
				break;
			}
		}
		ans = min(ans, anstemp);
	}
	cout<<ans;
}

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL<<60;
const ll mod = 1000000007;		





int main() {

	ll n;
	cin >> n;

	VLL v(5);
	REP(i, 5)cin >> v[i];
	sort(ALL(v));

	ll ans = (n + v[0] - 1) / v[0] + 4;
	cout << ans << endl;

}


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

int F[102][102];
int xg,yg,ok;

void Maze(int X,int Y,int C){
	//cout << X<<Y<<F[X][Y]<<endl;
	if(F[X][Y]!=C)
		return;

	

	if(X==xg&&Y==yg){
		cout << "OK"<<endl;
		ok++;
	}

	F[X][Y]='.';

	Maze(X-1,Y  ,C);
	Maze(X  ,Y+1,C);
	Maze(X+1,Y  ,C);
	Maze(X  ,Y-1,C);
	
}



int main(){	
	while(1){
		ok=0;

		int w,h,xs,ys,n,c,d,x,y;

		cin >>w>>h;
		if(w==0&&h==0)
			return 0;

		cin >>xs>>ys;
		cin >>xg>>yg;
		cin >>n;


		for(int i=1; i<=w; i++)
			for(int j=1; j<=h; j++)
				F[j][i]=0;


		//for(int i=0; i<=101;i++){
			//F[0][i]=6;
			//F[i][0]=6;
		//}

		for(int i=1; i<=w;i++){
				F[w+1][i]=6;
				F[0][i]=6;
		}
		for(int i=1; i<=h;i++){
				F[i][h+1]=6;
				F[i][0]=6;
		}

		int N=0;
		while(N<n){
//cout <<N;
			cin >>c>>d>>x>>y;
//cout<<c<<d<<x<<y<<endl;
			if(d){
				for(int i=x; i<x+2; i++)
					for(int j=y; j<y+4; j++){
						F[i][j]=c;
//cout <<F[i][j];
				}
//cout <<endl;
			}else{
				for(int i=x; i<x+4; i++)
					for(int j=y; j<y+2; j++){
						F[i][j]=c;
//cout <<F[i][j];
					}
//cout <<endl;
			}
			N++;
		}

//for(int i=0; i<=101; i++){
	//for(int j=0; j<=101; j++){
		//cout <<F[j][i];
		//}
	//cout << endl;
//}
		
		Maze(xs,ys,F[xs][ys]);

		if(ok==0)
			cout <<"NG"<<endl;

	}

}

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

using namespace std;

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

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

    int h,w;
    char a[200][200];

    cin >> h >> w;
    
    rep(i,h + 2){
        rep(j, w + 2){
            a[i][j] = '#'; 
        }
    }

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

    rep(i,h + 2){
        rep(j, w + 2){
            cout << a[i][j]; 
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 99999999



int main(){
    int n,a,b,c;
    while(cin>>n&&n){
        vector<pii> v;
        rep(i,n){
            cin>>a>>b>>c;
            v.pb(pii(b,a ));
            v.pb(pii(c,-a));
        }
        sort(all(v));
        int sum=0;
        bool f=false;
        rep(i,v.size()){
            sum+=v[i].second;
            if(sum>150){
                f=true;
                break;
            }
        }
        if(f)cout<<"NG"<<endl;
        else cout<<"OK"<<endl;
    }
}

Measured memory_bytes: 1196
from collections import deque

s = input()
Q = int(input())

l = deque()
l.append(s)

rev = True
for i in range(Q):
    q = list(input().split())
    if q[0] == "1":
        rev = not rev
    else:
        if rev:
            if q[1] == "1":
                l.appendleft(q[2])
            else:
                l.append(q[2])
        else:
            if q[1] == "1":
                l.append(q[2])
            else:
                l.appendleft(q[2])

ans = ""    
for i in l:
    ans += i

if not rev:
    print(ans[::-1])
else:
    print(ans)

Measured memory_bytes: 11644
N = int(input())
L = []
for i in range(N):
  L.append(list(map(int,input().split())))
cnt = 0
for i in range(N):
  if L[N-i-1][0]%L[N-i-1][1] != 0:
    cnt += L[N-i-1][1]-(L[N-i-1][0]%L[N-i-1][1])
  else:
    None
  L[N-i-2][0] += cnt
print(cnt)

Measured memory_bytes: 31348
N=int(input())
word_list=[]
flag=0
for i in range(N):
    a=input()
    if a in word_list:
        flag=1
    word_list.append(a)
for i in range(N-1):
    if word_list[i][-1]!=word_list[i+1][0]:
        flag=1
        break
if flag==0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
def main():
    N,K = map(int,input().split())
    A = list(map(int, input().split()))

    num = [0 for _ in range(200000)]
    s = 0
    for A in A:
        num[A-1] += 1

    count = 0
    num.sort()
    for i in range(200000-K):
        count += num[i]
    return count

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 25436
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <cstdio>
using namespace std;
int n;
long long a[3001];
long long final;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{  scanf("%lld",&a[i]);
	   final+=a[i];
    }
    printf("%d",final-n);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
#include <algorithm>
#include <string>


using namespace std;
using ll = long long;
using ull = unsigned long long;


#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() {

	int n;
	vector<int> a;
	cin >> n;

	a.resize(n);

	rep(i, 0, n) {
		cin >> a.at(i);
	}

	int ans = 0;
	int next = 0;
	while (true) {
		int tmpnxt;
		tmpnxt = a[next];
		if (tmpnxt == 2) {
			ans += 1;
			break;
		}
		if (tmpnxt == -1) {
			ans = -1;
			break;
		}

		a[next] = -1;
		next = tmpnxt -1;
		ans += 1;
		
	}

	cout << ans << endl;

	return 0;
}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  int maxCount = 0;
  int ans;
  for (int i = 1; i <= n; i++) {
    int count = 0;
    int num = i;
    while(num % 2 == 0) {
      num /= 2;
      count++;
      if(num == 1) break;
    }
    
    if(count >= maxCount) {
      ans = i;
      maxCount = count;
    };
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define MOD 998244353 
#define INF 100000000
//#define MOD 922337203685419LL
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <functional>
#include <algorithm>
#include <iterator>
#include <cstdio>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <chrono>
#include <random>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n-1,-1)
#define ALL(obj) (obj).begin(), (obj).end()

int main() {
	ll n, d, a, x ,h;
	cin >> n >> d >> a;
	vector<pll> v;
	vll vv;
	REP(i, n) {
		cin >> x >> h;
		v.push_back(pll(x, (h+a-1)/a)); //round up
		vv.push_back(x);
	}
	sort(ALL(v));
	sort(ALL(vv));
	map<ll, ll> mp; // border of attack area : damage
	ll res = 0;
	ll dmg = 0;
	REP(i,n){
		if (mp.count(i)) dmg -= mp[i];
		if (v[i].second - dmg > 0) {
			res += v[i].second - dmg;
			ll index = upper_bound(ALL(vv), v[i].first + d * 2) - vv.begin();
			if(!mp.count(index)) mp[index] = v[i].second-dmg;
			else mp[index] += v[i].second-dmg;
			dmg += v[i].second - dmg;
		}
	}
	cout << res;
	return 0;
}

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

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

		try {
			InputStreamReader isr = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(isr);
			String buf = br.readLine();
			StringTokenizer st=new StringTokenizer(buf," ");
			int a = Integer.parseInt(st.nextToken());
			int b = Integer.parseInt(st.nextToken());

			if(a < b)
				System.out.println("a < b");
			else if(a > b)
				System.out.println("a > b");
			else if(a == b)
				System.out.println("a == b");

		} catch(IOException e) {
			System.err.println(e);
		}
	}
}

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

int main() {
    std::string input;
    std::cin >> input;

    if (input == "Sunny") {
        std::cout << "Cloudy" << std::endl;
    } else if (input == "Cloudy") {
        std::cout << "Rainy" << std::endl;
    } else if (input == "Rainy") {
        std::cout << "Sunny" << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,i,j=1,flag=0;
	int a[200001];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=1;i<=n;i++)
    {
        if(a[i]==j){j++;flag=1;}
    }
    if(flag==1)
    {printf("%d\n",n-j+1);}
    else {printf("-1");}
	return 0;
}


Measured memory_bytes: 896
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;

class program
{
    static public int mod = 1000000007;
    static void Main()
    {
        var nm = inta();
        int n = nm[0], m = nm[1];
        var a = inta();
        Array.Sort(a);
        Array.Reverse(a);
        int sa = a.Sum();
        int sam = (int)Ceiling((double)sa / (4 * m));
        Write(sam <= a[m - 1] ? "Yes" : "No");

    }

    static int pow(int a, int b) { string binary = Convert.ToString(b, 2); int bileng = binary.Length; long a_power = a; long value = 1; for (int i = bileng - 1; i >= 0; i--) { if (binary[i] == '1') { value = value * a_power % mod; } a_power = a_power * a_power % mod; } return (int)value; }
    static string rstr() { return ReadLine(); }
    static int rint() { return int.Parse(ReadLine()); }
    static long rlong() { return long.Parse(ReadLine()); }
    static string[] stra() { return ReadLine().Split(' '); }
    static char[] chara() { string[] a = stra(); string b = ""; for (int i = 0; i < a.Length; i++) { b += a[i]; } return b.ToCharArray(); }
    static int[] inta() { string[] read_str_array = ReadLine().Split(' '); int[] return_int_array = new int[read_str_array.Length]; for (int countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_int_array[countup_i] = int.Parse(read_str_array[countup_i]); } return return_int_array; }
    static long[] longa() { string[] read_str_array = ReadLine().Split(' '); long[] return_long_array = new long[read_str_array.Length]; for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_long_array[countup_i] = long.Parse(read_str_array[countup_i]); } return return_long_array; }
    static double[] doublea() { string[] read_str_array = ReadLine().Split(' '); double[] return_double_array = new double[read_str_array.Length]; for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_double_array[countup_i] = double.Parse(read_str_array[countup_i]); } return return_double_array; }
    static long GCD(long a, long b) { if (a < b) { long temp = a; a = b; b = temp; } if (a % b == 0) { return b; } else { long temp = b; b = a % b; a = temp; return GCD(a, b); } }
    static long LCM(long a, long b) { return a * b / GCD(a, b); }
    static void WriteArray2(int[,] a, int b, int c) { for (int i = 0; i < b; i++) { for (int j = 0; j < c; j++) { if (j != 0) Write(" "); Write(a[i, j]); } WriteLine(); } }
    static void WriteArray(int[] a, int b) { for (int i = 0; i < b; i++) { Write(" "); Write(a[i]); } WriteLine(); }
}


Measured memory_bytes: 27964
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>
#include <limits>
#include <iomanip>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

int main()
{
	int K;
	string S;
	cin >> K;
	cin >> S;

	if(K - (int)S.length() >= 0)
	{
		cout << S << endl;
	}
	else
	{
		cout << (S.substr(0, K) + "...") << endl;
	}

	return 0;
}

Measured memory_bytes: 3124
import java.util.Scanner;

public class Main {

	//計算に使う定数
	private static final int BILL10k = 10000;
	private static final int BILL5k  = 5000;
	private static final int BILL1k  = 1000;

	public static void main(String[] args) {

		// 処理対象個数の入力
		Scanner sc = new Scanner(System.in);
		int inputBillNum = sc.nextInt();
		int inputPay = sc.nextInt();

		// 札の枚数の組の初期値を代入
		int num10k = -1;
		int num5k = -1;
		int num1k = -1;

		for(int i = 0;i <= inputBillNum;i++) {
			for(int j = 0;i + j <= inputBillNum;j++) {
				if(i * BILL10k + j * BILL5k + (inputBillNum-(i+j)) * BILL1k == inputPay) {
					num10k = i;
					num5k = j;
					num1k = inputBillNum-(i+j);
					break;
				}else if(num10k * BILL10k + num5k * BILL5k + inputBillNum-(num10k+num5k) * BILL1k > inputPay){
					continue;
				}
			}
		}

		sc.close();

		// 出力
		System.out.println(num10k+" "+num5k+" "+num1k);

	}

}

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

int main(){
  string str;

  while(getline(cin,str)){
    char mp[3][3];
    int d = 0;

    for(int i = 0 ; i < 3 ; i++){
      for(int j = 0 ; j < 3 ; j++){
	mp[i][j] = str[d++];
      }
    }

    int flg = 0;
 
    for(int i = 0 ; i < 3 ; i++){
      int m = 0 , b = 0;
      for(int j = 0 ; j < 3 ; j++){
	if(mp[i][j]=='o') m++;
	else if(mp[i][j]=='x')b++;
      } 
      if(m==3){
	cout << 'o' << endl;
	flg = 1;
	break;
      }
      if(b==3){
	cout << 'x' << endl;
	flg = 1;
	break;
      }
    }
    if(flg) continue;

    for(int j = 0 ; j < 3 ; j++){
      int m = 0, b = 0;
      for(int i = 0 ; i < 3 ; i++){
	if(mp[i][j]=='o') m++;
	else if(mp[i][j]=='x') b++;   
      }
      if(m==3){
	cout << 'o' << endl;
	flg = 1;
	break;
      }
      if(b==3){
	cout << 'x' << endl;
	flg = 1;
	break;
      }
    }
    if(flg) continue;

    if(mp[1][1]=='o'){
      if((mp[0][0]==mp[1][1]&&mp[1][1]==mp[2][2])||
	 (mp[0][2]==mp[1][1]&&mp[1][1]==mp[2][0])){
	cout << 'o' << endl;
	flg = 1;
      }
    }
    if(mp[1][1]=='x'){
      if((mp[0][0]==mp[1][1]&&mp[1][1]==mp[2][2])||
	 (mp[0][2]==mp[1][1]&&mp[1][1]==mp[2][0])){
	cout << 'x' << endl;
	flg = 1;
      }
    }
    if(flg) continue;

    cout << 'd' << endl;
  }

  return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vll a(n),sum(n+1);
    rep(i,n) cin>>a[i];
    rep(i,n) sum[i+1]=sum[i]+a[i];
    ll ans=1e15;
    FOR(i,2,n-2){
        ll A[4];
        //A | B
        int l=0,r=i;
        while(r-l>1){
            ll c = (r+l)/2;
            if (sum[c]*2>=sum[i]) r = c;
            else l = c;
        }
        if (sum[r]*2-sum[i]<sum[i]-sum[l]*2){
            A[0] = sum[r]; A[1] = sum[i]-sum[r];
        }else{
            A[0] = sum[l]; A[1] = sum[i]-sum[l];
        }
        //C | D
        l=i, r=n;
        while(r-l>1){
            ll c = (r+l)/2;
            if ((sum[c]-sum[i])*2>=sum[n]-sum[i]) r = c;
            else l = c;
        }
        if ((sum[r]-sum[i])*2-(sum[n]-sum[i])<(sum[n]-sum[i])-(sum[l]-sum[i])*2){
            A[2] = sum[r]-sum[i]; A[3] = sum[n]-sum[r];
        }else{
            A[2] = sum[l]-sum[i]; A[3] = sum[n]-sum[l];
        }
        ll ma=0,mi=1e15;
        rep(i,4){
            chmax(ma,A[i]);
            chmin(mi,A[i]);
        }
        chmin(ans,ma-mi);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3456
#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;
    bool ans = false;
    for(int i = 0;i < 2;i++){
        if(s[i] != s[i+1]) ans = true;
    }
    if(ans) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm> 
#define gc getchar() 
#define pc putchar
#define LL long long
inline int read() { 
	int x = 0,f = 1; 
	char c = getchar(); 
	while(c < '0' || c > '9') c = gc; 
	while(c <= '9' && c >= '0') x = x * 10 + c - '0',c = getchar(); 
	return x * f; 
}
void print(int x) { 
	if(x < 0) { 
		pc('-'); 
		x = -x; 
	} 
	if(x >= 10) print(x / 10); 
	pc(x % 10 + '0'); 
} 
const int maxn = 2010; 

int n,m,q;
int a[maxn][maxn];
int b[maxn][maxn],c[maxn][maxn];
char s[2007]; 
inline int calc(int a[maxn][maxn],int x1,int y1,int x2,int y2) { 
    if(x1 > x2 || y1 > y2)  return 0; 
    return a[x2][y2] - a[x1 - 1][y2] - a[x2][y1 - 1] + a[x1 - 1][y1 - 1]; 
} 
int main() { 
	n = read(),m = read(),q = read(); 
    for(int i = 1;i <= n;++ i) { 
        scanf("%s",s + 1); 
		for(int j = 1;j <= m;++ j) 
            a[i][j] = s[j] - '0'; 
    }  
    for(int i = 2;i <= n;++ i) 
        for(int j = 1;j <= m;++ j) 
            b[i][j] = a[i][j] & a[i - 1][j]; 
    for(int i = 1;i <= n;++ i) 
        for(int j = 2;j <= m;++ j) 
            c[i][j] = a[i][j] & a[i][j - 1]; 
    for(int i = 1;i <= n;++ i) 
        for(int j = 1;j <= m;++ j) { 
            a[i][j] = a[i][j] + a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];  
            b[i][j] = b[i][j] + b[i - 1][j] + b[i][j - 1] - b[i - 1][j - 1]; 
            c[i][j] = c[i][j] + c[i - 1][j] + c[i][j - 1] - c[i - 1][j - 1]; 
    } 
    while(q -- ) { 
        int x1 = read(),y1 = read(),x2 = read(),y2 = read(); 
        print(calc(a,x1,y1,x2,y2) - calc(b,x1 + 1,y1,x2,y2) - calc(c,x1,y1 + 1,x2,y2)); 
        pc('\n'); 
    } 
    return 0; 
}

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

int main() {
    ll x, k, d;

    cin >> x >> k >> d;

    x = abs(x);

    if (x == 0) {
        if (k%2) {
            cout << d << endl;
        }
        else {
            cout << 0 << endl;
        }
        return 0;
    }


    if ((k-x/d) < 0) {
        cout << abs(x-(k*d)) << endl;
    }
    else if (x%d == 0) {
        if (k%2) {
            cout << 0 << endl;
        }
        else {
            cout << abs(x) << endl;
        }
    }
    else if ((k-x/d) % 2) {
        cout << abs(x%d-d) << endl;
    }
    else {
        cout << abs(x%d) << endl;
    }

    return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9+10;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  string s; cin>>s;
  stack<char> st;
  for(auto c: s){
    if(c=='B'){
      if(st.empty()) continue;
      st.pop();
    }else{
      st.push(c);
    }
  }
  
  string ans="";
  while(!st.empty()){
    ans+=st.top();
    st.pop();
  }
  reverse(all(ans));
  cout<<ans<<endl;
  
}

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

using namespace std;
using ll = int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using tpi = tuple<int, int, int>;

using vqi = vector<queue<int>>;
using vpi = vector<pii>;
using bs = bitset<60>;
using vbi = vector<bs>;

ll gcd(ll a, ll b) {
    if (a < b) {
        swap(a, b);
    }

    /* ユークリッドの互除法 */
    ll r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

constexpr int64_t __pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    if (p == 0) {
        return 1;
    }
    if (p % 2 == 0) {
        int64_t t = __pow_mod(n, p / 2, mod);
        return (t * t) % mod;
    }
    return (n * (__pow_mod(n, p - 1, mod) % mod)) % mod;
}

constexpr int64_t pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    int64_t res = __pow_mod(n, p, mod);
    if (res == 0) {
        res = mod;
    }
    return res;
}

void solve(long long H, long long A) {
    ll ans = 0;
    while (H > 0) {
        ans++;
        H -= A;
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
    long long H;
    std::cin >> H;
    long long A;
    std::cin >> A;
    solve(H, A);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        // if(t.length() != s.length() + 1) {
        // 	System.out.println("No");
        // 	return;
        // }
        for(int i = 0; i < s.length(); i++) {
        	if(s.charAt(i) != t.charAt(i)) {
        		System.out.println("No");
        		return;
        	}
        }
        System.out.println("Yes");
        return;
    }
}

Measured memory_bytes: 35564
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;

static class Program
{
	static IEnumerable<int[]> ReadInts(this TextReader reader, int count)
	{
		for (long i = 0; i < count; ++i)
			yield return reader.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
	}

	static IEnumerable<long[]> ReadLongs(this TextReader reader, long count)
	{
		for (long i = 0; i < count; ++i)
			yield return reader.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
	}
	
	public static void Main(string[] args)
	{
		var inputs = Console.In.ReadInts(1).First();
		var n = inputs[0];
		var m = inputs[1];
		
		var result = (n * (n-1) + m * (m - 1)) / 2;
		Console.WriteLine(result);
	}
}

Measured memory_bytes: 13396
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    S=input()
    N=len(S)
    f=0
    if S.count("hi") == N//2 and N%2==0:
        f=1 
    if f==1:
        print("Yes")
    else:
        print("No")

main()


Measured memory_bytes: 38384
#include <stdio.h>

void disp(int *a, int n) {
    for(int i=0; i<n; i++) {
        printf("%d", a[i]);
        if (i != n-1) putchar(' ');
        else puts("");
    }
}
void isort(int *a, int n) {
    int v, j;
    for (int i=1; i<n; i++) {
        disp(a, n);
        v = a[i];
        j = i - 1;
        while (j >= 0 && a[j] > v) {
            a[j+1] = a[j];
            j--;
            a[j+1] = v;
        }
    }
}

int main() {
    int n, a[100];
    scanf("%d", &n);
    for(int i=0; i<n; i++) scanf("%d", a+i);
    isort(a, n);
    disp(a, n);
}



Measured memory_bytes: 2120
#include <stdio.h>
#include <math.h>
 
int isprime(int);
 
main(){
 
  int n,res=0;
  int i;
  int A[10000];
   
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n;i++){
    if(isprime(A[i])==0) res++;
  }
 
 
  printf("%d\n",res);
 
  return 0;
}
 
 
 
int isprime(int x)
{
  int i;
 
  if(x==2) return 0;
 
  if(x<2 || x%2==0) return 1;
 
 
  i=3;
  while(i<=sqrt(x)){
    if(x%i==0) return 1;
    i+=2;
  }
  return 0;
 }

Measured memory_bytes: 2768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

int main() {
    string s;
    cin >> s;
    
    int ans = 0;
    rep3(i, 1, sz(s)) {
        if (s[i] != s[i - 1]) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 2005
#define INF 1000000005
#define INFLL 4000000000000000003
#define PI 3.1415926535897
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000005;
const int MOD = 1000000007;
int main(){
    int h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    OUT(60*(h2-h1)+(m2-m1)-k);
    return 0;
}


Measured memory_bytes: 3596
import std;
import core.bitop;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "x", long, "y");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);

void main()
{
    long n = lread();
    auto open = new long[](n);
    auto close = new long[](n);
    foreach (i; iota(n))
    {
        long a, b;
        scan(a, b);
        open[i] = a;
        close[i] = b;
    }
    open.sort();
    close.sort();
    if (n % 2)
        writeln(close[n / 2] - open[n / 2] + 1);
    else
        writeln((close[n / 2] + close[n / 2 - 1]) - (open[n / 2] + open[n / 2 - 1]) + 1);
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

Measured memory_bytes: 15084
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(m)]
graph = [[] for i in range(n+1)]
for a,b in ab:
  graph[a].append(b)
  graph[b].append(a)
stack = [(1,1)]
color = [0]*(n+1)
flg = 0
while stack:
  x,c = stack.pop()
  color[x] = c
  for y in graph[x]:
    if color[y] == 0:
      stack.append((y,3-c))
    elif color[y] == color[x]:
      flg = 1
      break
  else:
    continue
  break
if flg:
  print(n*(n-1)//2-m)
else:
  print(color.count(1)*color.count(2)-m)

Measured memory_bytes: 74972