akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
private static Scanner s;

public static void main(String[] args) {
	s = new Scanner(System.in);
	int a = s.nextInt();
	int[] b = new int[a];
	for(int i = 0;i < a;i++) {
		b[i] = s.nextInt();
	}

	int c = s.nextInt();
	int[] d = new int[c];
	for(int i = 0;i < c;i++) {
		d[i] = s.nextInt();
	}
	int count = 0;

	for(int i = 0;i < c;i++) {
	int l = 0,r = a,m;
	while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	}
	}
	System.out.println(count);
}
}



Measured memory_bytes: 79704
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) begin(x), end(x)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair <int,int> P;

int a[35][100005];

int main(){
  int n,c;
  cin>>n>>c;
  rep(i,n){
    int s,t,c;
    cin>>s>>t>>c;
    c--;
    if(a[c][s]<0){
      a[c][s]++;
      a[c][t]--;
    }
    else if(a[c][t]>0){
      a[c][t]--;
      a[c][s]++;
    }
    else{
      a[c][s]++;
      a[c][t]--;
    }
  }
  int rec=0,ans=0;
  rep(i,100005){
    int p=0,m=0;
    rep(j,c){
      if(a[j][i]==1) p++;
      if(a[j][i]==-1) m++;
    }
    rec+=p;
    chmax(ans,rec);
    rec-=m;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 15344
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

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

	if(a <= c && c <= b) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef int64_t lint;
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using lb = long double;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SI(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define debug(x) cerr << #x << ": " << x << "\n"//手動デバッグ
#define debugV(x) for(int i=0;i<((ll)(x).size());i++)cerr << #x <<"at:"<<i<< ": " << x[i] << "\n"//手動デバッグ 
#define YES(c) cout<<((c)?"YES\n":"NO\n"),0
#define Yes(c) cout<<((c)?"Yes\n":"No\n"),0
#define O(p) cout<<p<<"\n",0
#define OS(p) cout<<p<<" ",0
#define ON(p) cout<<p,0
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define endl "\n"//endlを置き換える
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定

const int dy[4]={1,0,-1,0};
const int dx[4]={0,1,0,-1};//^>v<

template<class T=int> T in(){
    T x;
    cin>>x;
    return (x);
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
//------------------------------------------------------------





//------------------------------------------------------------
int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
//------------------------------------------------------------
    int n=in();
    vector<P> p(n);
    rep(i,n){
        cin>>p[i].first;
        cin>>p[i].second;
    }
    bool ok=0;
    rep(i,n-2){
        if((p[i].first==p[i].second)&&(p[i+1].first==p[i+1].second)&&(p[i+2].first==p[i+2].second)){
            ok=1;
        }
    }
    
    if(ok){
        O("Yes");
    }else{
        O("No");
    }
    
    
    
    
    
//------------------------------------------------------------
	return 0;
}


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

int main() {
  int N;
  string res = "No";
  cin >> N;

  for (int i = 0; i < 30; i++) {
    for (int j = 0; j < 20; j++)
      if (4 * i + 7 * j == N)
        res = "Yes";
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int S,h,m,s;
    scanf("%d",&S);
    h = S/3600;
    s = (S%3600)%60;
    m = (S/60)%60;
    printf("%d:%d:%d\n",h,m,s);
return 0;
}

Measured memory_bytes: 2756
N, K = map(int, input().split())
d = [[]]
A = [[]]
have = {}
for i in range(1, K+1):
  d.append(int(input()))
  A.append(list(map(int, input().split())))
  for j in A[i]:
    have[j] = 1

print(N - len(have))

Measured memory_bytes: 9216
// C/C++ program to find minimum number of 
// flip to make binary string alternate 
#include <bits/stdc++.h> 
using namespace std; 

// Utility method to flip a character 
char flip(char ch) 
{ 
	return (ch == '0') ? '1' : '0'; 
} 

// Utility method to get minimum flips when 
// alternate string starts with expected char 
int getFlipWithStartingCharcter(string str, 
								char expected) 
{ 
	int flipCount = 0; 
	for (int i = 0; i < str.length(); i++) 
	{ 
		// if current character is not expected, 
		// increase flip count 
		if (str[i] != expected) 
			flipCount++; 

		// flip expected character each time 
		expected = flip(expected); 
	} 
	return flipCount; 
} 

// method return minimum flip to make binary 
// string alternate 
int minFlipToMakeStringAlternate(string str) 
{ 
	// return minimum of following two 
	// 1) flips when alternate strign starts with 0 
	// 2) flips when alternate strign starts with 1 
	return min(getFlipWithStartingCharcter(str, '0'), 
			getFlipWithStartingCharcter(str, '1')); 
} 

// Driver code to test above method 
int main() 
{ 
	string str ;
    cin >> str;
	cout << minFlipToMakeStringAlternate(str); 
	return 0; 
} 


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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a){cout<<((a)?"Yes":"No")<<endl;}
void YESNO(int a){cout<<((a)?"YES":"NO")<<endl;}
void AorB(int a,string b,string c){cout<<((a)?b:c)<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

vector< pair<ll,ll> > prime_factorize(ll n){
    vector<pair<ll, ll> > res;
    for (ll p = 2; p*p<=n; ++p){
        if(n%p != 0) continue;
        int num = 0;
        while(n%p == 0){
            ++num;
            n /= p;
        }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n,1));
    return res;
}

signed main(){start();
    int n,ans=0;
    cin>>n;
    map<int,int> fact;
    REP(i,1,n+1){
        vector<Pii> a=prime_factorize(i);
        REP(j,0,a.size()) fact[a[j].first]+=a[j].second;
    }
    Vi f;
    for(auto x : fact) f.pb(x.second);
    int c74=count_if(ALL(f),[](int x){return x>=74;});
    int c24=count_if(ALL(f),[](int x){return x>=24;});
    int c14=count_if(ALL(f),[](int x){return x>=14;});
    int c4=count_if(ALL(f),[](int x){return x>=4;});
    int c2=count_if(ALL(f),[](int x){return x>=2;});
    ans += c74;
    ans += c14*(c4-1);
    ans += c24*(c2-1);
    ans += c4*(c4-1)*(c2-2)/2;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int N;
    cin >> N;
    int A[N];
    rep(i, N) cin >> A[i];
    int sum1 = 0, sum2 = 0;
    ll ans = 0;
    int pos = 0;
    rep(i, N){
        if(i > 0) sum1 -= A[i-1], sum2 ^= A[i-1];
        while(pos < N && sum1+A[pos] == (sum2^A[pos])){
            sum1 += A[pos], sum2 ^= A[pos];
            pos++;
        }
        ans += pos-i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))



int main(){
	int N,M;
	while(cin>>N>>M,N+M){
		int ans = 0;
		int get = M/N;
		FOR(i,0,N){
			int mon;
			cin >> mon;
			ans += min(mon,get);
		}
		cout << ans << endl;
	}
}



Measured memory_bytes: 3092
n, k = map(int, input().split())
x = list(map(int, input().split()))

arr = []
for i in range(n-k+1):
    arr.append(min((abs(x[i])+abs(x[i]-x[i+k-1])), abs(x[i+k-1])+abs(x[i]-x[i+k-1])))

print(min(arr))


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

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

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

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

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

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

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

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

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

int main()
{
    cout << fixed << setprecision(15);
    string S;
    cin >> S;

    ll ans = 700;
    REP(i, 3){
        if(S[i] == 'o') ans+= 100;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
const int INF = 10000000;



int main(){
	int n;
	while(cin>>n && n > 0){
		vi v(n + 1, 0);
		rep(i, n + 1) cin>>v[i];

		for(int i = 0; i < n  + 1; i++){
			vi u;
			bool  f = false;
			for(int j = 0; j < n + 1; j++){
				if(i != j) u.pb(v[j]);
			}
			for(int j = 0; j < n - 2; j++){
				if(u[j] - u[j + 1] != u[j + 1] - u[j + 2]) break;
				if(j == n - 3){
					cout<<v[i]<<endl;
					f = true;
					break;
				}
			}
			if(f) break;
		}
	}
	
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int num_5 = 0,num_7 = 0;

	int table[3];
	for(int i = 0; i < 3; i++){

		scanf("%d",&table[i]);
		if(table[i] == 5){

			num_5++;
		}else if(table[i] == 7){

			num_7++;
		}
	}

	if(num_5 == 2 && num_7 == 1){

		printf("YES\n");

	}else{

		printf("NO\n");
	}

	return 0;
}


Measured memory_bytes: 256
//Author rahuliitkgp
/*A thing of beauty is a joy forever,
Its loveliness increases,
it will never pass into nothingness.*/
//Men at Work :)
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;

#define ff              first
#define ss              second
#define SZ(x)           ((int)(x).size())
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void cpp() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int main() {
    cpp();
    ll h, w;
    cin >> h >> w;
    vector<vector<ll> > grid(h, vector<ll>(w, 0));
    vector<vector<ll> > dp(h, vector<ll>(w, 0));
    for (ll i = 0; i < h; i++) {
        for (ll j = 0; j < w; j++) {
            char c;
            cin >> c;
            if (c == '.') grid[i][j] = 1;
        }
    }
    for (ll i = 0; i < w; i++) {
        if(grid[0][i]) dp[0][i] = 1;
        else break;
    }
    for (ll i = 0; i < h; i++) {
        if(grid[i][0]) dp[i][0] = 1;
        else break;
    }
    for (ll i = 1; i < h; i++ ) {
        for (ll j = 1; j < w; j++) {
            if (grid[i][j]) {
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1])%mod;
            }
        }
    }
    cout << dp[h - 1][w - 1] << endl;
    return 0;
}






Measured memory_bytes: 16000
#include<stdio.h>

int main(){
  int n, q, t, m, a[60][110], i, j, ans, cnt, tmp, ans_cnt; 

  while(scanf("%d%d", &n, &q), n){
    tmp=0;

    for(i=0; i<n; i++){
      for(j=0; j<110; j++){
	a[i][j]=0;
      }
    }
    
    for(i=0; i<n; i++){
      scanf("%d", &m);
      for(j=0; j<m; j++){
	scanf("%d", &t);
	a[i][t-1]=1;
	if(tmp<t){
	  tmp=t;
	}
      }
    }
       
    ans=0;
    ans_cnt=0;
    for(i=0; i<tmp; i++){
      cnt=0;
      for(j=0; j<n; j++){
	if(a[j][i]==1){
	  cnt++;
	}
      }
      if(cnt>=q && ans_cnt<cnt){
	ans=i+1;
	ans_cnt=cnt;
      }
      if(ans_cnt==n){
	break;
      }
    }

    printf("%d\n", ans);
    
  }
  
  return 0;
}

Measured memory_bytes: 1708
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef double db;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
ll ceil(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?(x+y-1)/y:-x/y;}
ll floor(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?x/y:-(x+y-1)/y;}
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){if(y==0)return 1;int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
int main() {
    int r; scanf("%d", &r);
    printf("%.2f\n", 2 * r * PI);
    return 0;
}

Measured memory_bytes: 3832
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

long long pow_pro(int N);

int main(){
    int N;
    cin >> N;
    long long c1 = 1;
    long long c2 = 2;
    long long c3 = 1;
    long long c;
    for(int i = 0; i < N; i++)c1 = c1 * 10 % MOD;
    for(int i = 0; i < N; i++)c2 = c2 * 9 % MOD;
    for(int i = 0; i < N; i++)c3 = c3 * 8 % MOD;    
    c = c1 - (c2 - c3);
    c %= MOD;
    c = (c + MOD)%MOD;

    cout << c << endl;
    return 0;
}


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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

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


int main(void){

	string s; cin >> s;		

	char a = s[0];
	FOR(i,1,4){
		if(a == s[i]){
			cout << "Bad" << endl;
			return 0;
		}else{
			a = s[i];
		}
	}

	cout << "Good" << endl;

	return 0;

}


Measured memory_bytes: 256
#include<stdio.h>

long long power(long long m, long long n) {
    if(n == 1)
    return m;
    else if(n % 2 == 0)
    return power(m * m % 1000000007, n/2);
    else
    return power(m * m % 1000000007, n/2) * m % 1000000007;
}
 
int main(void){
    long long m, n; 
    scanf("%lld %lld\n", &m, &n);
    printf("%lld\n", power(m,n));
    return 0;
}



Measured memory_bytes: 2108
using System;

namespace ALDS1_3_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] strs = Console.ReadLine().Split(' ');

            Stac elementaryData = new Stac();
            for (int i = 0; i < strs.Length; ++i)
            {
                if (strs[i] == "+")
                {
                    int x = elementaryData.pop();
                    int y = elementaryData.pop();
                    elementaryData.push(x + y);
                }
                else if(strs[i] == "-")
                {
                    int x = elementaryData.pop();
                    int y = elementaryData.pop();
                    elementaryData.push(y - x);
                }
                else if (strs[i] == "*")
                {
                    int x = elementaryData.pop();
                    int y = elementaryData.pop();
                    elementaryData.push(x * y);
                }
                else
                {
                    elementaryData.push(int.Parse(strs[i]));
                }
            }
            Console.WriteLine(elementaryData.pop());
//            Console.ReadLine();
        }

        class Stac
        {
            int[] S;
            int MAX = 200;

            public Stac()
            {
                S = new int[MAX];
                initialize();
            }

            int top;
            void initialize()
            {
                top = 0;
            }

            private bool isEmpty()
            {
                return top == 0;
            }

            private bool isFull()
            {
                return top >= MAX - 1;
            }

            public void push(int x)
            {
                if (isFull())
                {
                    Console.WriteLine("???????????????????????¨??????");
                    Console.ReadLine();
                }

                top++;
                S[top] = x;
            }

            public int pop()
            {
                if (isEmpty())
                {
                    Console.WriteLine("??¢????????????????????¨??????");
                    Console.ReadLine();
                    return 0;
                }
                top--;
                return S[top + 1];
            }
        }
    }
}

Measured memory_bytes: 17880
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), ios::sync_with_stdio(false)
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
main(){
    INCANT;
    int x, y, z, k;
    cin >> x >> y >> z >> k;
    int a[x], b[y], c[z];
    vector<int> t, r;
    rep(i, x) cin >> a[i]; sort(a, a + x, greater<int>());
    rep(i, y) cin >> b[i]; sort(b, b + y, greater<int>());
    rep(i, z) cin >> c[i]; sort(c, c + z, greater<int>());
    rep(i, x) rep(j, y) t.push_back(a[i] + b[j]);
    sort(t.begin(), t.end(), greater<int>());
    rep(i, min((int)t.size(), k)) rep(j, z) r.push_back(t[i] + c[j]);
    sort(r.begin(), r.end(), greater<int>());
    rep(i, k) cout << r[i] << '\n';
}

Measured memory_bytes: 43236
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    vector<vector<bool>> s(h, vector<bool>(w, false));
    rep(i, h){
        rep(j, w){
            char c;
            cin >> c;
            if(c == '#'){
                s[i][j] = true;
            }
        }
    }

    rep(i, h){
        rep(j, w){
            if(!s[i][j]){
                continue;
            }
            bool ok = false;
            if(i > 0 && s[i-1][j]){
                ok = true;
            }
            if(j > 0 && s[i][j-1]){
                ok = true;
            }
            if(i < h-1 && s[i+1][j]){
                ok = true;
            }
            if(j < w-1 && s[i][j+1]){
                ok = true;
            }
            if(!ok){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 888
import numpy as np
n, m = map(int, raw_input().split())
arr = np.zeros(n, dtype=int)

for i in range(m):
	a = map(int, raw_input().split())
	arr[a[0]-1] += 1
	arr[a[1]-1] += 1

for i in range(n):
	print arr[i]

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

int main() {
    ll t,ans=0,n=0,k,k1,k2,b,m,c;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    ll i=0,j=0,mon=1000;
    while(i<n){
        while(j<n-1 && a[j]<=a[j+1])
            j++;
        k = mon/a[i];
        mon += k*(a[j]-a[i]);
        i = j+1;
        j=i;
    }
    cout<<mon<<endl;
    return 0;
    while(t--){
        ll ans=0,c=0;
        cin>>n;
        //string s;
        //cin>>s;
        int a[n];
        for(int i=0;i<n;i++)
            cin>>a[i];

    }
    return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main()
{
    ll n,k;
    cin>>n>>k;
    if(n<k)
    {
        if(k%2==0 &&k/2<=n)
        {
            cout<<1<<endl;
        }
        else cout<<0<<endl;
    }
    else
    {
        ll ans=pow(n/k,3);
        if(k%2==0)
        {
            ll p = n - k/2;
            ans+= pow((p/k+1),3);
        }
        cout<<ans<<endl;
    }
    return 0;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N;
    cin >> N;
    vector<lint> A(N, 0);
    vector<lint> X(N, 0);
    rep(i, N - 1) {
        cin >> A[i];
        A[i]--;
        X[A[i]]++;
    }
    // dump(X);
    rep(i, N) { cout << X[i] << endl; }

    return 0;
}


Measured memory_bytes: 6368
#include <cstdio>
#include <iostream>
#include <cstdlib>
using namespace std;
int a[5],n;
char c,pre[4];

void print(){
	for(int i=1;i<4;i++){
		cout<<a[i]<<pre[i];
	}
	printf("%d=7",a[4]);
}

void dfs(int deep,int sum,int b){
	if(deep==4){
		if(sum==7){
		    print();
		    exit(0);
		}
		return;
	}
	for(int i=b+1;i<5;i++){
		pre[deep]='+';dfs(deep+1,sum+a[i],i);
		pre[deep]='-';dfs(deep+1,sum-a[i],i);
	}
}

int main(){
	for(int i=1;i<5;i++){
		c=getchar();
		a[i]=c-'0';
	}
	dfs(0,0,0);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define maxn 1000000
#define int long long
int n, Q, m;
int rec[maxn], len[maxn], ans[maxn]; 

int read()
{
	int x = 0, k = 1;
	char c; c = getchar();
	while(c < '0' || c > '9') { if(c == '-') k = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * k;
}

void Solve(int x, int t)
{
	if(!x) return;
	int pos = upper_bound(len + 1, len + 1 + m, x) - len - 1;
	if(!pos) { ans[1] += t; ans[x + 1] -= t; }
	else
	{
		rec[pos] += (x / len[pos]) * t; 
		Solve(x % len[pos], t);
	}
}

signed main()
{
	n = read(), Q = read(); len[++ m] = n;
	for(int i = 1; i <= Q; i ++)
	{
		int x = read();
		while(m && len[m] >= x) m --;
		len[++ m] = x;
	}
	rec[m] = 1;
	for(int i = m; i > 1; i --)
	{
		rec[i - 1] += rec[i] * (len[i] / len[i - 1]);
		Solve(len[i] % len[i - 1], rec[i]);
	}
	ans[1] += rec[1], ans[len[1] + 1] -= rec[1];
	for(int i = 1; i <= n; i ++)
	{
		ans[i] += ans[i - 1];
		printf("%lld ", ans[i]);
	}
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  int x = 0;
  int max = 0;
  rep(i,n){
    if(s[i] == 'I') x++;
    if(s[i] == 'D') x--;
    if(x>max) max = x;
  }
  
  cout << max << endl;
}

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


Measured memory_bytes: 2100
/**
 * @author ayaankhan98
 */
#include <bits/stdc++.h>

using namespace std;

#define INF ULLONG_MAX
#define FIO                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define setz(x) memset(x, 0, sizeof(x))
#define seto(x) memset(x, 1, sizeof(x))
#define PI 3.1415926535897932384626

#define logs(a)                                                                \
  {                                                                            \
    cout << #a << " : [";                                                      \
    for (auto &x : a)                                                          \
      cout << x << ", ";                                                       \
    cout << "]\n";                                                             \
  }

#define loga(a)                                                                \
  {                                                                            \
    cout << #a << " :\n[\n";                                                   \
    for (auto x : a)                                                           \
      cout << "  " << x.first << " : " << x.second << "\n";                    \
    cout << "]\n";                                                             \
  }

#define debug(...) (debugPrint(#__VA_ARGS__ " : ", __VA_ARGS__))
template <typename... Args>
void debugPrint(const char *label, Args &&... args) {
  cout << "\n[";
  auto l = [](auto &&arg) {
    std::cout << std::forward<decltype(arg)>(arg) << ", ";
  };
  std::cout << label;
  (l(std::forward<Args>(args)), ...);
  cout << "\b\b]\n";
}

auto ONLINE = []() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
};

void solve() {
  /// write your code here
  int d, s, t;
  cin >> d >> t >> s;
  d <= s * t ? cout << "Yes" : cout << "No";
}

int main() {
  FIO;
  ONLINE();
  int t = 1;
 // cin >> t;
  while (t--)
    solve();
  return 0;
}


Measured memory_bytes: 3608
// ref: https://img.atcoder.jp/abc118/editorial.pdf

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int64 gcd(int64 a, int64 b){
    do{
        int64 b_prev = b;
        b = a%b;
        a = b_prev;
    }while(b!=0);
    return a;
}

int main(){
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    
    uint N; cin >> N;
    
    int g;
    cin>>g;
    for(uint i=1; i<N; ++i){
        int a; cin>>a;
        g = gcd(g, a);
    }
    cout << g << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
typedef long long ll;

int main()
{
	ll A,B,N;
	scanf("%lld %lld %lld", &A,&B,&N);
	ll i = N;
	ll x;
	ll n;
	ll max = LLONG_MIN;
	ll sum;
	while (i >= N - 2)
	{
		sum = (A*i/B) - A * (i/B);
		if (sum >= max)
		{
			x = i;
			max = sum;
		}
		i--;
	}
	x = B - 1;
	if (N >= B - 1 && (A*x/B) - A * (x/B) > max)
		max = (A*x/B) - A * (x/B);
	printf("%lld\n", max);
	return (0);
}


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

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

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

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

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

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

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

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

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

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

    vector<ll> x(N);
    vector<ll> y(N);
    vector<char> c(N);

    REP(i, N){
        cin >> x[i] >> y[i] >> c[i];
        // cout << x[i] << " " << y[i] << endl;
    }

    // 色を全て黒に統一
    REP(i, N){
        if(c[i] == 'W'){
            x[i] = x[i] + K;
        }
    }

    // 2K*2Kのエリアに縮約
    REP(i, N){
        x[i] = x[i] % (2*K);
        y[i] = y[i] % (2*K);
        // cout << x[i] << " " << y[i] << endl;
    }

    vector<vector<ll>> A(2*K, vector<ll>(2*K, 0));
    REP(i, N){
        A[x[i]][y[i]]++;
    }

    // REP(i, 2*K){
    //     REP(j, 2*K){
    //         cout << A[i][j];
    //     }
    //     cout << endl;
    // }

    // 二次元累積和
    vector<vector<ll> > S(2*K+1, vector<ll>(2*K+1, 0));
    for (ll i = 0; i < 2*K; ++i){
        for (ll j = 0; j < 2*K; ++j){
            S[i+1][j+1] = S[i][j+1] + S[i+1][j] - S[i][j] + A[i][j];
        }
    }

    // REP(i, 2*K+1){
    //     REP(j, 2*K+1){
    //         cout << S[i][j];
    //     }
    //     cout << endl;
    // }

    // cout << S[2*K][2*K] << endl;
    ll ans = 0;
    for(ll i=0; i<=K; i++){
        for(ll j=0; j<=K; j++){
            ll temp = S[2*K][2*K] - S[i+K][2*K] - S[2*K][j+K] + S[i+K][j+K]
                      + S[i][2*K] + S[2*K][j] + S[i+K][j+K]
                      - 2*S[i][j+K] - 2*S[i+K][j] +2*S[i][j];
            ans = max(ans, temp);
            ans = max(ans, N-temp);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 64640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define Aint(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define f first
#define s second
const int MOD = 1e9+7;
const int INF = 1e9;
const int MAXN = 3000;

ll N,T,a,b,c,d,e,f;
ll A[MAXN];
string S;
vi V[MAXN];
ll D[MAXN];

queue<int> q;

int main(){
  cin>>N>>a>>b;
  for(int i=1;i<N;++i){
    V[i].pb(i+1);
    V[1+i].pb(i);
  }
  V[a].pb(b);
  V[b].pb(a);
  for (int i=1;i<=N;++i){
    memset(D,-1,sizeof(D));
    D[i]=0;
    q.push(i);
    while (SZ(q)){
      int t=q.front();q.pop();
      for (auto v:V[t])if (D[v]==-1){
        D[v] = D[t]+1;
        ++A[D[v]];
        q.push(v);
      }
    }
  }
  for (int i=1;i<N;++i)cout<<A[i]/2<<'\n';
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

long long power(long long a, long long b,long long m) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a %m;
        a = a * a %m;
        b >>= 1;
    }
    return res;
}


signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  


    int n;
    cin>>n;
    pair<int,int>p[n+1];
    for(int i=1;i<=n;i++)
        cin>>p[i].first>>p[i].second;
    int mm[n+1]={0};
    vector<pair<int,int> >v;
    for(int i=1;i<=n;i++)
    {
        v.push_back({p[i].first,i});
        v.push_back({p[i].second,i});
    }
    sort(v.begin(),v.end());
    int tot=0;
    bool flag=false;
    for(int i=0;i<n;i++)
    {
        mm[v[i].second]++;
        tot+=v[i].first;
        if(mm[v[i].second]>1)
            flag=true;
    }
    if(flag)
    {
        cout<<tot;
    }
    else
    {
        int x=0;
        int mn=1e17;
        for(int i=1;i<=n;i++)
            x+=p[i].first;
        mn=min(mn,x);
        x=0;
        for(int i=1;i<=n;i++)
            x+=p[i].second;
        mn=min(mn,x);
        for(int i=1;i<=n;i++)
        {
            tot+=max(p[i].first,p[i].second);
            if(v[n-1].second==i)
            {
                tot-=v[n-2].first;
                mn=min(mn,tot);
                tot+=v[n-2].first;
                tot-=max(p[i].first,p[i].second);
                continue;
            }
            tot-=v[n-1].first;
            mn=min(mn,tot);
            tot+=v[n-1].first;
            tot-=max(p[i].first,p[i].second);
        }
        cout<<mn;
    }
    


} 
    


Measured memory_bytes: 9724
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int T = scan.nextInt();
		int a = scan.nextInt();
		int[] h = new int[n];
		double[] t = new double[n];

		int ans = -1;
		for(int i=0; i<n; i++) {
			h[i] = scan.nextInt();
			t[i] = Math.abs((T - h[i]*0.006)-a);
			if(ans==-1) {
				ans=i;
			}else if(t[i]<t[ans]) {
				ans=i;
			}
		}
		System.out.println(ans+1);
	}
}

Measured memory_bytes: 22612
S = list(input())
for i in range(4):
    S[i] = int(S[i])

for i in range(2**3):
    a = S[0]
    for j in range(3):
        if (i >> j) & 1:
            a += S[j+1]
        else:
            a -= S[j+1]
    if a != 7:
        continue
    else:
        ans = str(S[0])
        for j in range(3):
            if (i >> j) & 1:
                ans += '+' + str(S[j+1])
            else:
                ans += '-' + str(S[j+1])
        print(ans + '=7')
        break



Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;

#define ran 1011
typedef long double D;

struct Circle {
	D x, y, r;
	Circle() { r=0; }
}c[ran];

int n;
bool in_q[ran];
int q[ran*ran], l, r;
D dist[ran];

D cache[ran][ran];

D sqr(D x) { return x*x; }

D calc(int c1, int c2) {
	if(cache[c1][c2]>-.5) return cache[c1][c2];
	return cache[c1][c2] = max((D)0., (D)sqrt(sqr(c[c1].x-c[c2].x) + sqr(c[c1].y-c[c2].y)) - c[c1].r-c[c2].r);
}

int main() {
	scanf("%Lf%Lf%Lf%Lf", &c[0].x, &c[0].y, &c[1].x, &c[1].y);
	
	scanf("%d", &n);
	n+=2;
	for(int i=2;i<n;i++) scanf("%Lf%Lf%Lf", &c[i].x, &c[i].y, &c[i].r);
	
	memset(in_q, false, sizeof in_q);
	for(int i=0;i<n;i++) {
		dist[i] = -1.;
		for(int j=0;j<n;j++) cache[i][j] = -1.;
	}
	dist[0] = 0;
	int l = 0, r = 0;
	q[r++] = 0; in_q[0] = true;
	while(l<r) {
		int cur = q[l++];
		D d = dist[cur];
		for(int i=1;i<n;i++) {
			int nxt = i;
			D nxt_d = d+calc(cur, nxt);
			if (dist[nxt] < 0 || dist[nxt] > nxt_d) {
				dist[nxt] = nxt_d;
				if (!in_q[nxt]) {
					q[r++] = nxt;
					in_q[nxt] = true;
				}
			}
		}
		in_q[cur] = false;
	}
	printf("%.12Lf\n", dist[1]);
	
	return 0;
}

Measured memory_bytes: 18688
fun main(args: Array<String>) {
    val N = readLine()?.toInt() ?: 0
    var prevTern = listOf(0, 0, 0)
    var eachTern = arrayListOf(prevTern)
    for (n in 0..N-1) {
        eachTern.add(readLine()!!.split(" ").map(String::toInt))
    }
    var result = "Yes"
    for (e in eachTern) {
        val timeDiff = e[0] - prevTern[0]
        val xDiff = Math.abs(e[1] - prevTern[1])
        val yDiff = Math.abs(e[2] - prevTern[2])
        if (timeDiff < (xDiff + yDiff)) {
            result = "No"
            break
        }
        prevTern = e
        if (timeDiff % 2 == 0 && (xDiff + yDiff) % 2 == 0) {
            result = "Yes"
            continue
        }
        if (timeDiff % 2 != 0 && (xDiff + yDiff) % 2 != 0) {
            result = "Yes"
            continue
        }
        result = "No"
        break
    }
    print(result)
}

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

N = int(input())
sN = [int(input()) for i in range(N)]

sN.sort()
sumS = sum(sN)

if sumS % 10 != 0:
    print(sumS)
    exit()
else:
    for i in range(N):
        if sN[i] % 10 != 0:
            sumS -= sN[i]
            print(sumS)
            exit()
    print(0)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
int x,y;
signed main(){
    cin>>x>>y;
    if(y>=x){
        if(x>=0||y<=0)cout<<y-x<<endl;
        else cout<<abs(abs(y)-abs(x))+1<<endl;
    }
    else if(x>=0&&y>=0){
        int ans=min(x+y+1,x-y+2);
        cout<<ans<<endl;
    }
    else if(x<=0&&y<=0){
        int ans=min(-x-y+1,x-y+2);
        cout<<ans<<endl;
    }
    else{
        cout<<abs(abs(y)-abs(x))+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>

#define ran 101101

char s[ran];
int len;

int f[ran][22];

struct modular_arithmetic{
	int mod;

	modular_arithmetic(){
		mod = 1000000007;
	}
	//No specific settings.
	int add(int x,int y){return (x+=y)<mod?x:x-mod;}
};
modular_arithmetic ma;

int main() {
	scanf("%s", s);
	len = strlen(s);
	
	memset(f, 0, sizeof f);
	f[len][0] = 1;
	int mul = 1;
	for(int i=len-1;i>=0;i--) {
		for(int j=0;j<13;j++) {
			if (!f[i+1][j]) continue;
			if(s[i]=='?') {
				for(int k=0;k<10;k++) {
					int nxt = (j+mul*k) % 13;
					f[i][nxt] = ma.add(f[i][nxt], f[i+1][j]);
				}
			} else {
				int nxt = (j+mul*(s[i]-'0')) % 13;
				f[i][nxt] = ma.add(f[i][nxt], f[i+1][j]);
			}
		}
		
		mul = mul*10%13;
	}
	printf("%d\n", f[0][5]);
	
	return 0;
}

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

using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }

class Solver {
  public:

    ll calc_s(ll s) {
        ll res = 0;
        while(s) {
            res += s % 10;
            s /= 10;
        }
        return res;
    }

    vector<ll> generate_list() {
        vector<pair<ll, double>> candidate, s;
        int num_post_fix = 0;
        set<ll> used;
        while(candidate.empty() or candidate.back().first <= 1e15) {
            repeat(i, 1, 999 + 1) {
                ll v = i; rep(foo, num_post_fix) v = v * 10 + 9;
                if(used.count(v)) continue;
                candidate.emplace_back(v, (double)v / calc_s(v));
                used.insert(v);
            }
            num_post_fix++;
        }
        sort(all(candidate));
        for(int i = candidate.size() - 2; i >= 0; i--) {
            set_min<double>(candidate[i].second, candidate[i + 1].second);
        }
        vector<ll> result;
        for(auto p : candidate) {
            if((double) p.first / calc_s(p.first) <= p.second) result.push_back(p.first);
        }
        return result;
    }

    bool solve() {
        int K; cin >> K;
        auto a = generate_list();
        rep(i, K) cout << a[i] << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


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

int main(){
    int N;
    cin >> N;
    N = N%10;
    if(N == 3) cout << "bon";
    else if(N == 0 || N == 1 || N == 6 || N == 8) cout << "pon";
    else cout << "hon";
    return 0;
}


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

using namespace std;

int main(void) {
  long long N, M;
  cin >> N >> M;

  long long count = 0;

  vector<int> A(M);
  for(int i=0; i<M; i++) {
    cin >> A.at(i);
    count += A.at(i);
  }

  if (count > N) { cout << -1 << endl; } else {
    cout << N - count << endl;
  }


  
}


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

int main(){
    int n, k, q; cin >> n >> k >> q;
    vector <long long> A(q);
    for (int i = 0; i < q; i ++){
        cin >> A.at(i);
    }

    vector <long long> point(n, k);

    for (auto a: A){
        point.at(a - 1) += 1;
    }

    for (auto person: point){
        person -= q;
        if (person < 1) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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 long long INF = 1LL << 60;

int main(){
  string sa; cin >> sa;
  string sb; cin >> sb;
  string sc; cin >> sc;

  int na = sa.size();
  int nb = sb.size();
  int nc = sc.size();
  int ia = 0;
  int ib = 0;
  int ic = 0;
  char c = 'a';
  while(1){
    if(c == 'a'){
      if(ia == na){
        cout << "A" << endl;
        return 0;
      }
      c = sa[ia++];
    }
    if(c == 'b'){
      if(ib == nb){
        cout << "B" << endl;
        return 0;
      }
      c = sb[ib++];
    }
    if(c == 'c'){
      if(ic == nc){
        cout << "C" << endl;
        return 0;
      }
      c = sc[ic++];
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

template<class T> inline bool chmin(T &a,T b){
    if (a>b){a=b; return true;}
    return false;
}
template<class T> inline bool chmax(T &a,T b){
    if (a<b){a=b; return true;}
    return false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b; cin >> a >> b;
    if (a%b) cout << a << endl;
    else cout << -1 << endl;
}

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

#define    ll    long long int

int main( )
{
    ll x, i, j, k, s = 0;
    cin >> x;
    s += ((x / 11) * 2);
    j = x % 11;
    if (j <= 6 && j > 0) {
        s++;
    }
    else if (j > 0) {
        s += 2;
    }
    cout << s << '\n';
    return 0;
}



Measured memory_bytes: 256
N = int(input())
music = []
for _ in range(N):
    s, t = map(str, input().split())
    music.append([s, t])
X = input()

flag = False
ans = 0
for s, t in music:
    if flag:
        ans += int(t)
    if s == X:
        flag = True
print(ans)


Measured memory_bytes: 3316