akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      //取得
      int A = sc.nextInt();
      int B = sc.nextInt();
      int C = sc.nextInt();
      int D = sc.nextInt();
      int i = 1;
      //どちらかが体力なくなるまで対戦
      //奇数回は高橋の攻撃
      while(A>0 && C>0){
        if(i%2==1){
          C-=B;
        }else{
          A-=D;
        }
        i++;
      }
      //高モンの体力は？
      if(A>0){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
}

Measured memory_bytes: 35760
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
typedef long long ll;
#define mod 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

ll dp[101][4][4][4];

int main() {
  int N; cin >> N;
  dp[0][3][3][3] = 1;
  int A = 0, C = 1, G = 2, T = 3;
  rep(i, 0, N) rep(j, 0, 4) rep(k, 0, 4) rep(l, 0, 4) rep(m, 0, 4) {
    if(dp[i][j][k][l] == 0) continue;
    if(k == A && l == G && m == C) continue;
    if(k == A && l == C && m == G) continue;
    if(k == G && l == A && m == C) continue;
    if(j == A && l == G && m == C) continue;
    if(j == A && k == G && m == C) continue;
    dp[i + 1][k][l][m] += dp[i][j][k][l];
    dp[i + 1][k][l][m] %= mod;
  }
  ll ans = 0;
  rep(j, 0, 4) rep(k, 0, 4) rep(l, 0, 4) {
    ans += dp[N][j][k][l];
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
abc = []
for i in range(N):
    abc.append(tuple(map(int, input().split())))

dp = [[0] * 3 for _ in range(N + 1)]

for i in range(N):
    a, b, c = abc[i]
    dp[i + 1][0] += max(dp[i][1] + a, dp[i][2] + a)
    dp[i + 1][1] += max(dp[i][0] + b, dp[i][2] + b)
    dp[i + 1][2] += max(dp[i][0] + c, dp[i][1] + c)


print(max(dp[N]))


Measured memory_bytes: 40236
#include <bits/stdc++.h>
#include <experimental/iterator>

/* snippet: useful macros and functions */
#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<class T> T rng(const T &a, const T &b){ return a < b ? b - a : a - b; }
template<class T> void th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

/* debug */
auto debug = std::experimental::make_ostream_joiner(std::cout, " ");

/* snippet: modint library */
template<class T, int MOD>
class Modint{
	T val;
public:
	Modint(T val = 0) : val(val % MOD + (val > 0 ? 0 : MOD)) {}
	operator T(){ return val; }
	Modint &operator+=(const Modint &a){ val += a.val; if(val >= MOD) val -= MOD; return *this; }
	Modint &operator-=(const Modint &a){ val -= a.val; if(val < 0) val += MOD; return *this; }
	Modint &operator*=(const Modint &a){ val = val * a.val % MOD; return *this; }
	void inverse(){T x[2]={MOD,val},a[2]={0,1};int i;for(i=0;x[!i];i^=1){a[i]-=x[i]/x[!i]*a[!i];x[i]=x[i]%x[!i];}if(!i)a[i]+= MOD;val=a[i];}
	Modint &operator/=(Modint a){ a.inverse(); return *this *= a; }
	friend Modint modpow(Modint a, int n){ Modint ret(1); while(n){ if(n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
	friend Modint operator+(Modint a, const Modint &b){ return a += b; }
	friend Modint operator-(Modint a, const Modint &b){ return a -= b; }
	friend Modint operator*(Modint a, const Modint &b){ return a *= b; }
	friend Modint operator/(Modint a, const Modint &b){ return a /= b; }
	friend std::ostream &operator<<(std::ostream &os, const Modint &a){ return os << a.val; }
};

/* snippet: using declarations */
using Int = long long;
using std::cout;
using std::cin;
using std::endl;
using Mint = Modint<long long, 998244353>;

Int n, m, k;

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

	Mint a = Mint(1), b = Mint(1), c = Mint(m);

	Mint ans;

	for(Int i = 0; i < n; ++i){
		// cout << a * b * c << endl;
		if(i >= n - k - 1) ans += a * b * c;

		a *= Mint(n - i - 1);
		a /= Mint(i + 1);

		b *= Mint(m - 1);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair < int , pair < int , int > > mp;

#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
 
const ll N = 123456;
const ll mod = 1e9 + 7;
const ld eps = 1e-6;
const ld pi = 3.1415926535;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    cout << fixed << setprecision(12);

    int a , b;

    cin >> a >> b;

    int cnt = 0;

    rep(i , 0 , 1000) {
    	if(a * i - (i - 1) >= b) {
    		cout << i << endl;
    		return 0;
    	}
    } 

    cout << 1000 << endl;

    return 0;
}


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

int main(){
  string s;
  while(cin >> s){
    int IOI=0, JOI=0;
    for(int i = 0 ; i < s.size() ; i++){
      if(s.substr(i, 3) == "IOI") IOI++;
      if(s.substr(i, 3) == "JOI") JOI++;
    }
    cout << JOI << endl << IOI << endl;
  }
  return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define pb                  push_back
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define mk(arr,n,type)      type *arr=new type[n];
#define dbg(x) cerr << #x << " is " << x << endl;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
clock_t beg = clock();
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
const double pi = 3.1415926535897932384626433;
void FILE_IO(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}

void JH(){
    int d=0,e=0,f=0,g=0,p=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    int n,x,t;cin>>n>>x>>t;
    d=ceil(n*1.0/x);
    cout<<d*t;

}

int32_t main()
{
    FILE_IO();FAST_IO;int t=1;
    // cin>>t;
    while(t--){JH();}cerr<<fixed<<setprecision(3)<<(double)(clock()-beg)/1000<<"s ";
}

Measured memory_bytes: 3792
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll d[100100];

int main() {
	ll n,h;
	cin>>n>>h;
	clr(d,0);
	ll mx = 0;
	rep(i,0,n){
		ll a,b;
		cin>>a>>b;
		mx = max(mx,a);
		d[i] = b;
	}
	sort(d,d+n);
	per(i,0,n){
		d[i]+=d[i+1];
	}
	ll ans = 1000000000;
	rep(i,0,n+1){
		ll h1 = h-d[i];
		ll c1 = n-i;
		if(h1<=0){
			ans = min(ans,c1);
		}
		else{
			ll c2 = h1/mx;
			if(h1%mx!=0)c2++;
			ans = min(ans,c1+c2);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
#define N 100000
using namespace std;

int main(){
  int n, m, x, y ,tmp, xM = -100, ym = 100;
  cin >> n >> m >> x >> y;
  rep(i, 0, n){
    cin >> tmp;
    xM = (xM<=tmp ? tmp:xM);
  }rep(i, 0, m){
    cin >> tmp;
    ym = (ym>=tmp ? tmp:ym);
  }
  tmp = ym - xM;
  if(tmp>0&&(xM>x && ym<y)) cout << "No War" << endl;
  else  cout << "War" << endl;
  return 0;
}


Measured memory_bytes: 256
def create_divisors(n):
  divisors=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      divisors.append(i)
      if i!=n//i:
        divisors.append(n//i)
  divisors.sort(reverse=True)
  return divisors

from math import floor
n,m=map(int,input().split())
n_max=floor(m/n)
d=create_divisors(m)
for di in d:
  if di<=n_max:
    print(di)
    exit(0)

Measured memory_bytes: 3064
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;

const int Mod = 1e9 + 7;

typedef vector<long long> row;
typedef vector<row> matrix;

void print(const matrix& a) {
  for(int i = 0 ; i < a.size() ; i++) {
    for(int j = 0 ; j < a[0].size() ; j++)
      cout << a[i][j] << " ";
    cout << endl;
  }
}
matrix zero(int n, int m) {
  return matrix(n, row(m, 0));
}
matrix identity(int n) {
  matrix I = zero(n, n);
  for(int i = 0 ; i < n ; i++)
    I[i][i] = 1;
  return I;
}
long long matrix_trace(const matrix& a) {
  long long ret = 0;
  for(int i = 0 ; i < (int)a.size() ; i++)
    ret += a[i][i];
  return ret;
}
matrix rotate(const matrix& a) {
  matrix r = zero(a[0].size(), a.size());
  for(int i = 0 ; i < (int)a.size() ; i++)
    for(int j = 0 ; j < (int)a[0].size() ; j++) {
      r[j][a.size() - 1 - i] = a[i][j];
    }
  return r;
}
matrix reflect(const matrix &a) {
  matrix r = zero(a.size(), a[0].size());
  for(int i = 0 ; i < (int)a.size() ; i++)
    for(int j = 0 ; j < (int)a[0].size() ; j++)
      r[i][a[0].size() - 1 - j] = r[i][j];
  return r; 
}
matrix add(const matrix& a, const matrix& b) {
  matrix r = zero(a.size(), a[0].size());
  for(int i = 0 ; i < (int)a.size() ; i++)
    for(int j = 0 ; j < (int)a[0].size() ; j++)
      r[i][j] = a[i][j] + b[i][j], r[i][j] %= Mod;
  return r;
}
matrix multiply(const matrix& a, const matrix& b) {
  matrix r = zero(a.size(), b[0].size());
  for(int i = 0 ; i < (int)a.size() ; i++)
    for(int j = 0 ; j < (int)b[0].size() ; j++)
      for(int k = 0 ; k < (int) a[0].size() ; k++)
        r[i][j] += a[i][k] * b[k][j], r[i][j] %= Mod;
  return r;
}
matrix pow(const matrix& a, long long p) {
  if(!p) return identity(a.size());
  if(p & 1) return multiply(a, pow(a, p - 1));
  return pow(multiply(a, a), p >> 1);
}



int main()
{
  int n;
  cin >> n;
  long long k;
  cin >> k;
  matrix a(n, row(n));
  for(int i = 0 ; i < n ; i++)
    for(int j = 0 ; j < n ; j++)
      cin >> a[i][j];
  auto b = pow(a, k);
  long long ans = 0;
  for(int i = 0 ; i < n ; i++)
    for(int j = 0 ; j < n ; j++)
      ans += b[i][j], ans %= Mod;
  cout << ans << endl;
  return 0;
}


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

int main(void) {
    int cnt = 0;
    std::string S;
    std::string T;

    std::cin >> S;
    std::cin >> T;

    for (int i = 0; i < 3; i++) {
        if (S[i] == T[i]) {
            cnt++;
        }
    }

    std::cout << cnt << std::endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
using namespace std;
typedef pair<int, int> P;
typedef long long LL;

#define _CRT_SECURE_NO_WARNINGS
int N;
bool f[100010] = {};
bool s[100010] = {};
int num[100010] = {};
int main() {
	num[0] = 0;
	num[1] = 0;
	num[3] = 1;

	int now=3;
	while (now<99999) {
		for (int i = now*3; i <= 100000;i+=now*2) {
			f[i] = true;
		}
		for (now+=2; now <= 100000; now+=2) {
			if (!f[now]) {
				break;
			}
		}
	}
	for (int i = 5; i < 100000;i+=2) {
		if (!f[i]) {
			if (((i + 1)/2) % 2 == 1) {
				if (!f[(i+1)/2]) {
					s[i] = true;
				}
			}
		}
	}
	for (int i = 5; i < 100000;i+=2) {
		if (s[i]) {
			num[i] = num[i - 2] + 1;
		}
		else {
			num[i] = num[i - 2];
		}
	}

	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		int a, b;
		scanf("%d %d", &a, &b);
		if (a==1) {
			printf("%d\n", num[b]);
		}
		else {
			printf("%d\n", num[b] - num[a - 2]);
		}
	}
	return 0;
}

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

int main()
{
  int N, Y;
  cin >> N >> Y;
  
  for(int i = 0; i <= N; ++i)
  {
    for(int j = 0; j <= N - i; ++j)
    {
      if(10000 * i + 5000 * j + 1000 * (N - i - j) == Y)
      {
        cout << i << ' ' << j << ' ' << N - i - j << endl;
        return 0;
      }
    }
  }
  
  cout << -1 << ' ' << -1 << ' ' << -1 << endl;
  return 0;
}    

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
using ll = long long;
 
int main() {
  int n, m, k; cin >> n >> m >> k;
  vector<ll> a(n+1), b(m);
  rep(i, n){
   cin >> a[i+1];
   a[i+1] += a[i];
  }
  rep(i, m){
   cin >> b[i];
   if(i >= 1) b[i] += b[i-1]; 
  }
 
  ll ans = 0;
  rep(i, n+1){
    ll rem = k - a[i];
    if(rem < 0) break;
    auto iter_b = upper_bound(b.begin(), b.end(), rem);
    ll b_read = iter_b - b.begin();
    ll r = i + b_read;
    ans = max(ans, r);
  }
  
  cout << ans << endl;  
  return 0;
}

Measured memory_bytes: 6424
n,k,q=map(int,input().split())
a =list([0] * q)
for ii in range(q):
    a[ii] = int(input())

point =	list([k-q] * n)
for jj in a:
    point[jj-1] += 1

for kk in range(n):
    if point[kk] > 0:
        print("Yes")
    else :
        print("No")


Measured memory_bytes: 10464
from collections import defaultdict
N, W = [int(i) for i in input().split()]
Things = [[int(i) for i in input().split()] for j in range(N)]

dp = defaultdict(int)
dp[0] = 0
for w, v in Things:
    for nw, nv in list(dp.items()):
        if nw + w <= W:
            dp[nw + w] = max(dp[nw + w], nv + v)
print(max(dp.values()))

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

int main() {
  int x; cin >> x;
  string ans = "No";
  if (x >= 30) ans = "Yes";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
//Indomie, Mie dari Indonesia
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long LL;
#define fi first
#define se second
#define mp make_pair
#define gc getchar
#define pb push_back
struct pq{
	int weight;
	pii pos;
	pq(int _weight,pii _pos){
		weight=_weight;
		pos=_pos;
	}
	pq(){
	}
	friend bool operator<(pq a,pq b){
		return a.weight>b.weight;
	}
};
const int tb[]={0,1,0,-1};
const int tk[]={1,0,-1,0};
int baris,kolom,k,jarak[805][805],ans;
char petas[805][805];
priority_queue <pq> cari;
bool masuk(int bar,int kol){
	return (1<=bar&&bar<=baris&&1<=kol&&kol<=kolom);
}
bool pinggir(int bar,int kol){
	return (bar==1||bar==baris||kol==1||kol==kolom);
}
bool masuk(pii pos){
	return masuk(pos.fi,pos.se);
}
bool pinggir(pii pos){
	return pinggir(pos.fi,pos.se);
}
int main()
{
	scanf("%d%d%d",&baris,&kolom,&k);
	for(int i=1;i<=baris;i++)
	{
		scanf("\n");
		for(int j=1;j<=kolom;j++)
		{
			scanf("%c",&petas[i][j]);
			if(petas[i][j]=='S')
			{
				jarak[i][j]=0;
				cari.push(pq(jarak[i][j],mp(i,j)));
				petas[i][j]='.';
			}
			else
				jarak[i][j]=baris*kolom*2;
		}
	}
	while(!cari.empty()){
		pq depan=cari.top();
		cari.pop();
		pii pos=depan.pos;
		if(jarak[pos.fi][pos.se]!=depan.weight)
			continue;
		if(pinggir(pos))
		{
			ans=(depan.weight+k-1)/k;
			break;
		}
		for(int ulang=0;ulang<4;ulang++)
		{
			pii nextpos=pos;
			nextpos.fi+=tb[ulang];
			nextpos.se+=tk[ulang];
			if(!masuk(nextpos))
				continue;
			int biaya;
			biaya=depan.weight+1;
			if(petas[nextpos.fi][nextpos.se]=='#')
				biaya=max(biaya,k+1);
			if(biaya<jarak[nextpos.fi][nextpos.se])
			{
				jarak[nextpos.fi][nextpos.se]=biaya;
				cari.push(pq(biaya,nextpos));
			}
		}
	}
	cout<<ans<<endl;
}

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

using namespace std;
#define sz(a) int(a.size())
#define ll  long long
#define mod int(1e9+7)
#define endl '\n'
#define ENGZ ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);cin.tie(0) , cout.tie(0) ;
#define pi (acos(-1))
#define S second
#define F first
ll fp(ll n , ll p )
{
    if(p==0)
        return 1;
    if(p==1)
        return n ;
    ll res = fp(n,p/2) ;
    res=((res)*(res)) ;
    if(p%2)
        res=(res*n) ;
    return res ;
}

int main()
{
    ENGZ;
    string s ;
    cin>> s ;
    int a ,b , c;
    int ans = 0 ;
    a = b = c = 0 ;
    s = "."+s;
    for(int i=1 ; i<sz(s) ; i++)
    {
        if(s[i] != s[a])
        {
            a = i ;
            ans ++ ;
        }
        else if(i < sz(s)-1)
        {
            ans++ ;
            i++ ;
            a = 0;
        }
        else
        {
            break;
        }
    }

    cout<<ans <<endl ;

    return 0;
}


Measured memory_bytes: 788
/*
Created by Rishu Sahu @ covid 20-20
*/
/*
*****************************************************************
*/

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

#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define pai pair<int,int>
#define pal pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,a,b) for(int i=a;i<=b;i++)
#define ff first 
#define ss second
#define sz(x) (int)x.size()
#define vi vector<int>
#define vl vector<ll>
#define mpl map<ll,ll>
#define mpi map<int,int>
#define pb push_back
#define all(x) x.begin(),x.end()

const int mod = 1e9+7;
const ll INF = INT_MAX;
const int mxm = 500000;

int n,w;
int wei[mxm],pro[mxm];
ll sum=0;
ll dp[100][100000];

ll make(int i,int val){
    if(val<=0)
    return 0;
    if(i==n)
    return INF;
    if(dp[i][val]!=-1)
    return dp[i][val];
    return dp[i][val]=min(make(i+1,val-pro[i])+wei[i],make(i+1,val));
}

void solve(){
    cin>>n>>w;
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++){
        cin>>wei[i]>>pro[i];
        sum+=pro[i];
    }

    for(ll i=sum;i>=0;i--){
        if(make(0,i)<=w){
            cout<<i<<endl;
            break;
        }
    }
    
}

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

Measured memory_bytes: 81724
#include "bits/stdc++.h"
using namespace std;

int main() {

	string s;
	cin >> s;

	set<char> a;

	for (int i = 0;i < s.size();i++)
		a.insert(s.at(i));

	vector<char> c = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };

	char b = ' ';
	for (int i = 0;i < 26;i++) {
		if (a.end() != a.find(c.at(i)));

		else {
			b = c.at(i);
			break;
		}
	}
	if (b != ' ')
		cout << b;

	else
		cout << "None";
}


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


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


    long long sumOfGCD=0;
    int p;

    for(int i=1; i<=n; i++) {
        for(int j=1; j<=n; j++) {
            for(int k=1; k<=n; k++) {
                p= __gcd(j,k);
                sumOfGCD=sumOfGCD+ __gcd(i,p);

            }

        }

    }
    cout<<sumOfGCD<<endl;



    return 0;
}




Measured memory_bytes: 3672
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

vector<pint> road;

int main() {
	int n,m;
	while(true){
		road.clear();
		cin>>n>>m;
		if(n==0&&m==0)break;
		int i;
		for(i=0;i<n;i++){
			int d,p;
			cin>>d>>p;
			road.push_back(mp(p,d));
		}
		sort(road.begin(),road.end(),greater<pint>());
		int res=0;
		for(i=0;i<n;i++){
			if(m>=road[i].second){
				m-=road[i].second;
			}else if(m>0){
				res+=road[i].first*(road[i].second-m);
				m=0;
			}else{
				res+=road[i].first*road[i].second;
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 1116
#include <stdio.h>
typedef unsigned long long ll;

ll cal(ll h)
{
    //printf("%lld\n", h);
    if (h == 1)
        return 1;
    return 2 * cal(h / 2) + 1;
}

int main(void)
{
    ll h;
    ll ans = 0;

    scanf("%lld", &h);
    printf("%lld\n", cal(h));

    return 0;
}

Measured memory_bytes: 128
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> N >> M;
	vector<long long int>y(N);
	vector<long long int>x(N);
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
	}
	long long int ans = LLONG_MAX;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			for (int k = 0; k < N; k++) {
				for (int l = k + 1; l < N; l++) {
					int box = 0;
					long long int left = min(x[i], x[j]);
					long long int right = max(x[i], x[j]);
					long long int down = min(y[k], y[l]);
					long long int up = max(y[k], y[l]);
					for (int m = 0; m < N; m++) {
						if (x[m] >= left&&x[m] <= right&&y[m] >= down&&y[m] <= up) {
							box++;
						}
					}
					if (box >= M) {
						ans = min(ans, (right - left)*(up - down));
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := NewScanner(os.Stdin)
	n, _ := sc.NextInt()
	a, b := make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		a[i], _ = sc.NextInt()
		b[i], _ = sc.NextInt()
	}
	ans := solve(n, a, b)
	fmt.Println(ans)
}

func solve(n int, a []int, b []int) int {
	sort.Ints(a)
	sort.Ints(b)
	if n%2 == 0 {
		m1 := b[n/2-1] - a[n/2-1] + 1
		m2 := b[n/2] - a[n/2] + 1
		return m1 + m2 - 1
	}
	return b[n/2] - a[n/2] + 1
}

// Scanner is a wrapper of bufio.Scanner which is customized for competitive programing.
type Scanner struct {
	bufio.Scanner
}

// NewScanner is a constructor for Scanner.
func NewScanner(r io.Reader) *Scanner {
	sc := Scanner{*bufio.NewScanner(r)}
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
	return &sc
}

// NextInt reads a integer from io stream.
func (sc *Scanner) NextInt() (int, error) {
	if !sc.Scan() {
		return -1, errors.New("failed to scan")
	}
	return strconv.Atoi(sc.Text())
}


Measured memory_bytes: 8364
#include <bits/stdc++.h>
#define ll long long int
#define mod_ceil(a, b) (a % b) ? a / b + 1 : a / b
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll k;
    string s;
    cin >> k >> s;
    for (int i = 0; i < s.length(); i++)
    {
        if (k == 0)
        {
            cout << "...";
            break;
        }
        cout << s[i];
        k--;
    }
    cout << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#include<algorithm>
int main() {
	int N,A,B;
	cin >> N;
	vector<int>Sum(N);
	long long ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> A >> B;
		Sum[i] = A + B;
		ans -= B;
	}
	sort(Sum.begin(),Sum.end(), greater<int>());
	for (int i = 0; i < N; i+=2) {
		ans += Sum[i];
	}
	cout << ans << endl;
}


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

class UnionFind{
    public:
    //親の番号を格納する。親だった場合は-(その集合のサイズ)
    vector<int> parent;

    UnionFind(int N){
        parent = vector<int>(N,-1);
    }

    int root(int A){
        if(parent[A] < 0) return A;
        return parent[A]=root(parent[A]);
    }

    int size(int A){
        return -parent[root(A)];
    }

    bool unite(int A, int B) {
        A = root(A), B = root(B);
        if(A == B) return false; 

        if(size(A) < size(B)) swap(A,B);
        parent[A] += parent[B];
        parent[B] = A;
        return true;
    }

    bool same(int A, int B){
        return root(A)==root(B);
    } 
};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    
    ll n,m;
    cin>>n>>m;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    UnionFind uni(n);
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        uni.unite(x,y);
    }
    vector<array<ll,2>> v;
    for(int i=0;i<n;i++){
        if(i==uni.root(i)) v.push_back({uni.size(i),i});
    }
    sort(v.begin(),v.end(),greater<array<ll,2>>());
    map<int,int> mp;
    for(int i=0;i<v.size();i++){
        mp[v[i][1]]=i;
    }
    priority_queue<ll,vector<ll>,greater<ll>> pq[v.size()];
    for(int i=0;i<n;i++){
        pq[mp[uni.root(i)]].push(a[i]);
    }
    ll ans = 0;
    for(int i=1;i<v.size();i++){
        if(pq[0].empty()){
            cout << "Impossible\n";
            return 0;
        }
        ans += pq[0].top() + pq[i].top();
        pq[0].pop();
        pq[i].pop();
        while(pq[i].size()){
            pq[0].push(pq[i].top());
            pq[i].pop();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 14832
use std::io;

fn main() {
    let v = input();

    let sum: i64 = v.iter().sum();
    let max = v.iter().max().unwrap();
    let min = v.iter().min().unwrap();

    println!("{} {} {}", min, max, sum);
}

fn input() -> Vec<i64> {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");

    let n: i32 = s.trim().parse().unwrap();
    
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    
    let mut v: Vec<i64> = vec![];
    for _ in 0..n {
        v.push(iter.next().unwrap().parse().unwrap());
    }

    v
}



Measured memory_bytes: 5040
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder.Contests.ABC159
{
    /// <summary>
    /// 
    /// </summary>
    static class B
    {
        static void Main(string[] args)
        {
            var s = Next();

            if(!IsPalindrome(s))
            {
                Console.WriteLine("No");
                return;
            }

            if (!IsPalindrome(s.Substring(0, s.Length / 2)))
            {
                Console.WriteLine("No");
                return;
            }

            Console.WriteLine("Yes");
        }

        static bool IsPalindrome(string s)
        {
            var l = s.Length;
            if (l == 1)
            {
                return true;
            }

            for (int i = 0; i < s.Length / 2; i++)
            {
                if (s[i] != s[s.Length - 1 - i])
                {
                    return false;
                }
            }
            return true;
        }


        #region Console
        static int _index = 0;
        static string[] _buffer;

        static string Next()
        {
            if (_buffer == null || _index >= _buffer.Length)
            {
                _buffer = Console.ReadLine().Split();
                _index = 0;
            }

            return _buffer[_index++];
        }
        static int NextInt()
        {
            return int.Parse(Next());
        }
        static long NextLong()
        {
            return long.Parse(Next());
        }
        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        static int[] ReadIntArray(int n)
        {
            var a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadInt();
            }
            return a;
        }
        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        static long[] ReadLongArray(int n)
        {
            var a = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadLong();
            }
            return a;
        }
        static List<T> ReadObjects<T>(int n, Func<int[], T> creator)
        {
            var l = new List<T>(n);

            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                l.Add(creator(a));
            }

            return l;
        }

        static int[,] ReadMatrix(int n, int m)
        {
            var r = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                for (int j = 0; j < m; j++)
                {
                    r[i, j] = a[j];
                }
            }
            return r;
        }
        #endregion
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
typedef vector<string>vi;
int main()
{
    int n,l;
    cin>>n>>l;
    vi v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    for(auto s:v){
        cout<<s;
    }
    return 0;
}


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

int n,a[105];

int main()
{
    cin>>n;
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(sum%10!=0)
        cout<<sum;
    else
    {
        int minn=1e9;
        for(int i=1;i<=n;i++)
            if(a[i]%10!=0)
                minn=min(minn,a[i]);
        if(minn==1e9)
            cout<<0;
        else
            cout<<sum-minn;
    }
}


Measured memory_bytes: 256
n,k = map(int,input().split())	
li = list(map(int,input().split()))
li.sort(reverse=True)

if k==0:
    print(sum(li))
    exit()

if k>=n:
    print("0")
    exit()

for i in range(k):
    li[i]=0

print(sum(li))

Measured memory_bytes: 26024
N = int(input())
count = 0
for i in range(1,N+1):
    yaku = 0
    if i%2 == 1:
        for j in range(1,i+1):
            if i%j == 0:
                yaku += 1
        if yaku == 8:
            count += 1
print(count)

Measured memory_bytes: 63672
N, K = map(int, input().split())

min = K*(K-1)/2
max = K*(2*N-K+1)/2


sum=0
for k in range(K,N+2):
    min = k*(k-1)/2
    max = k*(2*N-k+1)/2

    sum+=(int(max-min+1))
print(sum%(10**9+7))


Measured memory_bytes: 9148
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF ((1LL<<61) + (1<<29))
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
ll my_gcd(ll a, ll b) { return b ? my_gcd(b, a%b) : a; };
void _INPUT_IMPL_() {};
template <class T, class... Args> void _INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; _INPUT_IMPL_(args...); }
void _OUTPUT_IMPL_() {};
template <class T, class... Args> void _OUTPUT_IMPL_(T dest, Args... args) { cout << dest << (sizeof...(Args) ? " " : ""); _OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; _INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define unique_v(v) v.erase(std::unique(v.begin(), v.end()), v.end()) //必ずソート後に実行
#define out(...) (_OUTPUT_IMPL_(__VA_ARGS__), std::cout<<std::endl)
#define set_fix(x) ((std::cerr<<std::fixed<<std::setprecision(x)),(std::cout<<std::fixed<<std::setprecision(x)))
//小さい方に寄る
#define space_op(x, y, a, b, c) ([](auto x_, auto y_, auto a_, auto b_, auto c_){if(x_<y_)return a_;if(x_>y_)return c_;return b_;}(x,y,a,b,c))
#define space_out(x, y, a, b, c) out(space_op(x, y, a, b, c))

// ^^^ Template ^^^ //


int main() {
	in(ll, N, X);
	in_v(ll, m, N);
	X -= std::accumulate(m.begin(), m.end(), 0);
	out(N + X / (*std::min_element(m.begin(), m.end())));
	return 0;
}


Measured memory_bytes: 384
package main

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

// Scan Standard Input
var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	N, _ := strconv.Atoi(nextLine())
	A := strings.Split(nextLine(), " ")

	r, count := selectionSort(A, N)
	fmt.Println(strings.Join(r, " "))
	fmt.Println(count)
}

func selectionSort(A []string, N int) ([]string, int) {
	tmpSeq := make([]int, len(A))
	count := 0
	for i, v := range A {
		n, _ := strconv.Atoi(v)
		tmpSeq[i] = n
	}

	for i := 0; i < N; i++ {
		minj := i
		for j := i; j < N; j++ {
			if tmpSeq[j] < tmpSeq[minj] {
				minj = j
			}
		}

		// changed value i
		if i != minj {
			count++
		}

		tmp := tmpSeq[i]
		tmpSeq[i] = tmpSeq[minj]
		tmpSeq[minj] = tmp
	}

	result := make([]string, len(A))
	for i, v := range tmpSeq {
		result[i] = strconv.Itoa(v)
	}
	return result, count
}



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

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define REP(i, n) for(LL i = 0; i < n; ++i)
#define FOR(i, a, n) for(LL i = a; i < n; ++i)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

//#define int long long

/*************** using variables ***************/
int n, m;
vector<int> c, x;
LL dp[20005][256];
/**********************************************/

signed main(){
    while(cin >> n >> m, n != 0 || m != 0){
        c.resize(m);
        x.resize(n);
        REP(i, m) cin >> c[i];
        REP(i, n) cin >> x[i];

        REP(i, 20005) REP(j, 256) dp[i][j] = INF;
        dp[0][128] = 0;
        FOR(i, 1, n+1){
            for(int j = 0; j <= 255; j++){
                bool flag = false;
                if(j == 0){
                    REP(k, m){
                        for(int z = 0 - c[k]; z >= 0; z--){
                            if(dp[i-1][z] != INF){
                                dp[i][0] = min(dp[i][0], dp[i-1][z] + (LL)pow(abs(x[i-1] - (0)), 2));
                            }
                        }
                    }
                }else if(j == 255){
                    REP(k, m){
                        for(int z = 255 - c[k]; z <= 255; z++){
                            if(dp[i-1][z] != INF){
                                dp[i][255] = min(dp[i][255], dp[i-1][z] + (LL)pow(abs(x[i-1] - (255)), 2));
                            }
                        }
                    }
                }else{
                    REP(k, m) flag |= dp[i-1][j-c[k]] != INF;
                    if(flag){
                        REP(k, m){
                            if(j-c[k] >= 0 && j-c[k] <= 255 && dp[i-1][j-c[k]] != INF){
                                dp[i][j] = min(dp[i][j], dp[i-1][j-c[k]] + (LL)pow(abs(x[i-1] - j), 2));
                                //cout << i << " " << dp[i][j] << " " << x[i-1] << " " << j-c[k] << endl;
                            }
                        }
                    }
                }
            }
        }

        LL ans = INF;
        for(int i = 0; i <= 255; i++) ans = min(ans, dp[n][i]);
        cout << ans << endl;
    }

}



Measured memory_bytes: 43208
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cstdio>
using namespace std;
static inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int pow(long x, int n, int m){
    long ret = 1;
    while (n > 0) {
        if (n & 1) ret *= x, ret %= m;
        x *= x, x %= m;
        n >>= 1; 
    }
    return ret % m;
}

int euler_phi(int n) {
   int ret = n;
   for(int i = 2; i * i <= n; ++i){
       if(n % i == 0) {
           ret -= ret / i;
           while(n % i == 0) n /= i;
       }
   }
   if(n > 1) ret -= ret / n;
   return ret;
}

int main()
{
    int K = 0, c = getchar();
    while(c > 47 && c < 58){
        K = K * 10 + c - 48;
        c = getchar();
    }

    K /= gcd(K, 7);
    if(K == 1){
        putchar('1');
        return 0;
    }

    K *= 9;

    if(gcd(K, 10) != 1) {
        putchar('-');
        putchar('1');
        return 0;
    }

    int res = euler_phi(K);

    int ans = 1000000;
    int now = 10;
    for(int i = 1; i * i <= res; ++i){
        if(res % i == 0) {
            if(now == 1){
                printf("%d\n", i);
                return 0;
            }
            int tmp = res / i;
            if(pow(10, tmp, K) == 1) if(tmp < ans) ans = tmp;
        }
        now *= 10, now %= K;
    }

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

    return 0;
}

Measured memory_bytes: 1596
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX



 
void solve()
{
    int a,b;
    cin >> a >> b;
    if(b>=a)
        cout << "unsafe" << endl;
    else
        cout << "safe" << endl;
}


signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

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

int n, q;

const long long inf = (1ll << 31) - 1;
const int max_n = (1 << 17);

long long seg[max_n * 2 - 1];
long long lazy[max_n * 2 - 1];

void init()
{
  int _n = n;

  n = 1;
  while (n < _n) n *= 2;

  fill(seg, seg + 2 * n - 1, inf);
  fill(lazy, lazy + 2 * n - 1, inf + 1);
}

void update(int a, int b, int x, int k = 0, int l = 0, int r = n)
{
  if (a <= l && r <= b){
    lazy[k] = x;
    return;
  }
  if (r <= a || b <= l){
    return;
  }

  if (lazy[k] != inf + 1) {
    lazy[k * 2 + 1] = lazy[k * 2 + 2] = lazy[k];
  }
  lazy[k] = inf + 1;
  update(a, b, x, k * 2 + 1, l, (l + r) / 2);
  update(a, b, x, k * 2 + 2, (l + r) / 2, r);
}

void find(int a, int b, int k = 0, int l = 0, int r = n)
{
  if (a <= l && r <= b){
    if (lazy[k] != inf + 1){
      seg[k] = lazy[k];
    }
    lazy[k] = inf + 1;
    return;
  }
  else if (r <= a || b <= l){
    return;
  }
  else {
    if (lazy[k] != inf + 1){
      lazy[k * 2 + 1] = lazy[k * 2 + 2] = lazy[k];
      lazy[k] = inf + 1;
    }
    find(a, b, k * 2 + 1, l, (l + r) / 2);
    find(a, b, k * 2 + 2, (l + r) / 2, r);
  }
}

int main()
{
  cin >> n >> q;
  init();
  for (int i = 0; i < q; i++){
    int f;
    cin >> f;

    if (f == 0){
      int s, t, x;

      cin >> s >> t >> x;
      update(s, t + 1, x);
      /*
      for (int i = 0; i < n * 2 - 1; i++){
        cout << lazy[i] << " ";
      }
      puts("");
      */
    } else {
      int i;

      cin >> i;
      find(i, i + 1);

      /*
      for (int i = 0; i < n * 2 - 1; i++){
        cout << seg[i] << " ";
      }
      puts("");
      */
      cout << seg[i + n - 1] << endl;
    }
  }
}

Measured memory_bytes: 7184
N=int(input())
A=[]

kore=0
A=list(map(int,input().split()))
ma=A[0]
ans=0
for i in range(1,N):
    if(A[i]<=ma):
        ans=ans+ma-A[i]
       # print(ans)

    else:
        ma=A[i]

print(ans)




Measured memory_bytes: 32216
#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 chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))

int n, m;
vector<int> v[50];
map<int, pii> mp;
bool visited[50];
int c;
void dfs(int i, int now) {
    visited[now] = 1;
    c++;
    rep(j, SZ(v[now])) {
        int nxt = v[now][j];
        if (visited[nxt]) continue;
        if (now == mp[i].F && nxt == mp[i].S) continue;
        else if (now == mp[i].S && nxt == mp[i].F) continue;
        dfs(i, v[now][j]);
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    rep(i, m) { int a, b; cin >> a >> b; a--; b--; v[a].eb(b); v[b].eb(a); mp[i] = {a, b}; }
    int ans = 0;
    rep(i, m) {
        fill_n(visited, n, 0);
        dfs(i, 0);
        if (c != n) ans++;
        c = 0;
    }
    out(ans);
}


Measured memory_bytes: 256
N, M = list(map(int, input().split()))
a = []

for i in range(M):
    a.append(map(str, input().split()))

p_sum = 0
s_sum = 0

s_dict = {}
p_dict = {}
for k in range(M):
    ps = list(a[k])

    if (ps[0] in p_dict) == True:
        if p_dict[ps[0]] == True:
            continue
    if ps[1] == "WA":  
        if (ps[0] in s_dict) == True:
            s_dict[ps[0]] += 1
        else:
            s_dict[ps[0]] = 1
    else:
        p_dict[ps[0]] = True
        p_sum += 1
        if (ps[0] in s_dict) == True:
            s_sum += s_dict[ps[0]]
        pre_s_sum = 0

print(str(p_sum) + " " + str(s_sum))

Measured memory_bytes: 58180
#include<iostream>

using namespace std;

int main(){
  string a;
  cin >> a;
  int flag = 0;
  int count = 0;
  //cout  << a[0] << endl;
  for(int i = 0 ; i < a.length() ; i++){
    //cout << "hi" << endl;
    if(i == 0){
      if (a[0] == 'A') flag = 1;
      else {
        flag = 0;
        break;
      }
    }
    else if(i >= 2  && i < a.length() -1 && a[i] == 'C') {
      count++;
    }
    else if(islower(a[i])) continue;
    else{
      flag = 0;
      break;
    }
  }
  if(flag && count == 1) cout << "AC" << endl;
  else cout << "WA" << endl;
}

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

#define f(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define int long long
using namespace std;
#define mod 1000000007

signed main(){
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL); cout.tie(NULL);
  
  int n;cin>>n;
  int arr[n];
  map<int,int>map1;
  set<int>set1;
  vector<int>arr1;
  for(int i=0;i<n;i++){
      cin>>arr[i];
      map1[arr[i]]++;
  }
  for(int i=0;i<n;i++){
      set1.insert(arr[i]);
  }
  for(auto itr=set1.begin();itr!=set1.end();itr++){
      arr1.pb(*itr);
  }
   int count = 0,count1=0;;
    for (int i = 0; i < arr1.size(); i++) { 
        for (int j = i + 1; j < arr1.size(); j++) {
            for (int k = j + 1; k < arr1.size(); k++)
                if ( 
                    arr1[i] + arr1[j] > arr1[k] 
                    && arr1[i] + arr1[k] > arr1[j] 
                    && arr1[k] + arr1[j] > arr1[i])
                        count+=map1[arr1[i]]*map1[arr1[j]]*map1[arr1[k]];
                    
        } 
    }
    cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  lint n, m, k; cin >> n >> m >> k;
  vector<lint> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<lint> b(m);
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }

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

  for (int i = 1; i < m; i++) {
    b[i] += b[i - 1];
  }

  lint ans = 0;

  for (int i = -1; i < n; i++) {
    if (i == -1) {
      lint tmp = i + 1;
      lint rest = k;

      int ok = 0;
      int ng = m + 1;
      while (ng - ok > 1) {
        int mid = (ng + ok) / 2;
        bool flag;
        if (mid == 0) {
          flag = true;
        } else {
          flag = (rest >= b[mid - 1]);
        }

        if (flag) {
          ok = mid;
        } else {
          ng = mid;
        }
      }

      tmp += ok;
      ans = max(ans, tmp);
      continue;
    }

    if (a[i] > k) {
      break;
    }

    lint tmp = i + 1;
    lint rest = k - a[i];

    int ok = 0;
    int ng = m + 1;
    while (ng - ok > 1) {
      int mid = (ng + ok) / 2;
      bool flag;
      if (mid == 0) {
        flag = true;
      } else {
        flag = (rest >= b[mid - 1]);
      }

      if (flag) {
        ok = mid;
      } else {
        ng = mid;
      }
    }

    tmp += ok;
    ans = max(ans, tmp);
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6424
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s,t;
    cin>>s>>t;
    int cnt=0;
    for(int i=0;i<(int)s.length();i++)
        if(s[i]!=t[i]) cnt++;
    cout<<cnt<<'\n';
    return 0;
}


Measured memory_bytes: 3808