akhauriyash/Code-Regression huggingface dataset:
/*
    JAI JAGANNATH!
*/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<lli,lli>
#define vi              vector<lli>
#define mii             map<lli,lli>
#define pqb             priority_queue<lli>
#define pqs             priority_queue<lli,vi,greater<lli> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            lli x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update> pbds;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

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

}
void solve() {
	lli n;
	cin >> n;
	vector <lli> v(n);
	map <lli, lli> cnt;
	lli ret = 0;
	for (lli i = 0; i < n; i++) {
		cin >> v[i];
		ret += v[i];
		cnt[v[i]]++;
	}
	lli q;
	cin >> q;
	lli x, y;
	while (q--) {
		cin >> x >> y;
		if (x != y) {
			ret -= (x * cnt[x]);
			ret += (y * cnt[x]);
			cnt[y] += cnt[x];
			cnt[x] = 0;
		}
		cout << ret << endl;
	}
}
int main()
{
	ss();
	solve();
	return 0;
}

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

using namespace std;
long long int dp[1002][1002];
int h,w;
string s[1002];
long long  mod=1000000007;

long long int maxpaths(int i,int j)
{
	if(dp[i][j]!=-1)
		return dp[i][j];
	if(i==h-1 && j==w-1)
	{
		dp[i][j]=1;
	}
	else if(i==h-1)
	{
		if(s[i][j+1]=='.')
			dp[i][j]=maxpaths(i,j+1)%mod;
		else
			dp[i][j]=0;
	}
	else if(j==w-1)
	{
		if(s[i+1][j]=='.')
		{
			dp[i][j]=maxpaths(i+1,j)%mod;
		}
		else
		{
			dp[i][j]=0;
		}
	}
	else
	{
		long long int a=0;
		if(s[i+1][j]=='.')
			a=a%mod+maxpaths(i+1,j)%mod;
		a=a%mod;
		if(s[i][j+1]=='.')
			a=a%mod+maxpaths(i,j+1)%mod;
		a=a%mod;
		dp[i][j]=a;
	}
	dp[i][j]=dp[i][j]%mod;
	return dp[i][j];
}
int main()
{
	cin>>h>>w;
	for (int i = 0; i < h; ++i)
	{
		cin>>s[i];
	}
	for (int i = 0; i < 1002; ++i)
	{
		for (int j = 0;j < 1002; ++j)
		{
			dp[i][j]=-1;
		}	
	}
	cout<<maxpaths(0,0)%mod<<'\n';


}

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

using namespace std;

typedef long long ll;

int main()
{
    int a, b;
    cin>>a>>b;
    for(int i=0; i<max(a,b); i++)
    {
        if(a<=b)
        {
            cout<<a;
        }
        else if(b<=a)
        {
            cout<<b;
        }
    }
    return 0;
}


Measured memory_bytes: 256
s = int(input())
a_list = [s]
prev_num = 1
for i in range(1,1000001):
    n = a_list[i-1]
    if n%2 == 0:
        a_list.append(n//2)
    else:
        a_list.append(3*n+1)
    if prev_num == len(set(a_list)):
        print(i+1)
        break
    else:
        prev_num = len(set(a_list))

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

int main(){
	int D, N;
	cin >> D >> N;
	
	int i;
	long long int B=1;
	for(i=0; i<D; i++){
		B *= 100;
	}
	
	if(N==100)
		B *= 101;
	else
		B *= N;

		cout << B << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(void)
{
    int n;
    int i;

    cin >> n;
    for(i = 1; i <= 9; i ++)
        if(!(n % i) && n / i <= 9)
            break;
    cout << (i > 9 ? "No" : "Yes") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll dp[3001][3001], A[3000];
int main() {
    init();
    ll N;
    cin >> N;
    vc<ll> A(N);
    rep(i, N) cin >> A[i];

    repe(i,1,N+1){
        rep(j,N-i+1){
            dp[j][j + i] = max(A[j + i - 1] - dp[j][j + i - 1], A[j] - dp[j + 1][j + i]);
        }
    }

    cout << dp[0][N] << endl;

}

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

int main(){
    int n,k;
    cin>>n>>k;
    int t[n];
    for (int i = 0; i < n; ++i) {
        cin>>t[i];
    }
    sort(t,t+n);
    int ans=1000000000;
    for (int j = 0; j < n-k+1; ++j) {
        ans=min(ans,t[j+k-1]-t[j]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
/*
读题不规范，爆零两行泪。
数据不清空，爆零两行泪。
多测不读完，爆零两行泪。
边界不特判，爆零两行泪。
贪心不证明，爆零两行泪。
D P 顺序错，爆零两行泪。
大小少等号，爆零两行泪。
变量不统一，爆零两行泪。
越界不判断，爆零两行泪。
调试不注释，爆零两行泪。
溢出不 l l，爆零两行泪。
*/
#include<bits/stdc++.h>
using namespace std;
const int N=10,S=50;
int n,m,s;
int a[S+1],b[S+1],c[S+1],d[S+1];
int lis[N+1];
int ans;
void dfs(int x=1,int now=1){
	if(x==n+1){
		int res=0;
		for(int i=1;i<=s;i++)if(lis[b[i]]-lis[a[i]]==c[i])res+=d[i];
		ans=max(ans,res);
		return;
	}
	lis[x]=now;
	for(int i=now;i<=m;i++)dfs(x+1,i);
}
int main(){
	cin>>n>>m>>s;
	for(int i=1;i<=s;i++)cin>>a[i]>>b[i]>>c[i]>>d[i];
	dfs();
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
//type
typedef long long ll;
#define pii pair<int, int>;
#define vi vector<int>;
//x * y * 1.0 can cause overflow
//constant
#define inf (int)(1e9+7)
#define mod (ll)(1e9+7)
#define eps 1e-10
//omission
#define eb emplace_back
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define all(v) v.begin(), v.end()
//manip
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end(), v.end());
#define ceil(a, b) a / b + !!(a % b)
template<class T> T power(T a, T b)
{return b ? power(a * a % inf, b / 2) * (b % 2 ? a : 1) % inf : 1;}
#define LB(v, x) (int)(lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (int)(upper_bound(v.begin(), v.end(), x) - v.begin())
//loop
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep3(i, st, n) for (int i = st; i < n; ++i)
//algorithm
//double pointer, l start, how many adds, can be 0 -> init r = l, sum = 0
//bfs, not x, y, i, j
//not !(i % 2), i % 2 == 0


bool zero(string a) {
    if (a[0] == '0' && SZ(a) >= 2) return 0;
    return 1;
}

int main() {
    //cast caution
    //look constraints always
    cin.tie(0); ios::sync_with_stdio(false);
    
    
    string s; cin >> s;
    int ans = 0;
    rep(i, (1 << SZ(s))) {
        int cnt = 0;
        vector<int> v;
        rep(j, SZ(s)) if (i & (1 << j)) {cnt++; v.eb(j);}
        if (cnt != 3) continue;
        string a = s.substr(0, v[0]);
        string b = s.substr(v[0], v[1] - v[0]);
        string c = s.substr(v[1], v[2] - v[1]);
        string d = s.substr(v[2]); //v[2]以降
        if (SZ(a) == 0 || SZ(b) == 0 || SZ(c) == 0 || SZ(d) == 0) continue;
        if (stoi(a) > 255 || stoi(b) > 255 || stoi(c) > 255 || stoi(d) > 255) continue;
        if (zero(a) == 0 || zero(b) == 0 || zero(c) == 0 || zero(d) == 0) continue;
        
        //cout << a << " " << b << " " << c << " " << d << endl;
        ans++;
    }
    cout << ans << endl;
    
    
    
    
}




Measured memory_bytes: 3228
#include <iostream>

int main() {
  std::string s;
  std::cin >> s;
  long long g = 0;
  long long p = 0;
  for (const auto &i : s) {
    if (i == 'g') {
      ++g;
    } else {
      ++p;
    }
  }
  std::cout << (g-p) / 2;
  return 0;
}

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

#----------
A,B,C = input().rstrip().split()
#----------
temp_list=[]
temp_list += [int(A) + int(B+C)]
temp_list += [int(A) + int(C+B)]
temp_list += [int(B) + int(A+C)]
temp_list += [int(B) + int(C+A)]
temp_list += [int(C) + int(A+B)]
temp_list += [int(C) + int(B+A)]

print(max(temp_list))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll> >
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define prll(a)                 cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,cur)               lower_bound(all(v),cur)-v.begin()
#define ub(v,cur)               upper_bound(all(v),cur)-v.begin()
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
long long pows(long long a, long long b) {
  long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll powm(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD){return powm(a,m-2,m);}
int main()
{
fastIO
ll n,m,i,j,k,x,y,z,t,e,f,p,q,g,l,r,o,w,h,count1=0,prod=1,a,b,c,d,index,x1,x2,y1,y2,diff,ans=0,sum=0,sum1=0,sum2=0,flag=0,flag1=0,flag2=0;
string s,s1,s2;
cin>>s;
for(i=0;i<s.size();i++)
{
  sum+=s[i]-'0';
}
if(sum%9==0)
{
  cout<<"Yes";
}
else{
  cout<<"No";
}
}


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

int main(){
    
    string s;
    cin >> s;
    int ans = 0;
    char c = '0';
    for(int i=0; i<(int)s.size(); i++){
        ans += (int)s[i] - (int)c;
       
    }
    if(ans%9 == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3728
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	if a < c && c < b {
		fmt.Println("Yes")
	} else if b < c && c < a {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

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

using namespace std;

void solve(ll N, ll M, vector<ll> a, vector<ll> b, vector<ll> c, vector<ll> d){
	rep(i, N) {
        ll min = 1000000000;
        ll l = 0;
        int ans = 0;
		rep(j, M) {
            l = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if (min > l) {
                min = l;
                ans = j;
            }
		}
        cout << ans + 1 << endl;
	}
	
}

int main(){
    // 提出時は削除 //////////////////////////////
//	FILE* fp_in = freopen("/Users/kokinakamura/git/ToolsForAtCoder/workspace/abc057/B/in_B_3.txt", "r", stdin);
    ////////////////////////////////////////////

	ll M;
	ll N;
	scanf("%lld",&N);
	vector<ll> b(N-1+1);
	vector<ll> a(N-1+1);
	scanf("%lld",&M);
	vector<ll> d(M-1+1);
	vector<ll> c(M-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&a[i]);
		scanf("%lld",&b[i]);
	}
	for(int i = 0 ; i <= M-1 ; i++){
		scanf("%lld",&c[i]);
		scanf("%lld",&d[i]);
	}
	solve(N, M, a, b, c, d);

    // 提出時は削除 //////////////////////////////
//    fclose(fp_in);
    ////////////////////////////////////////////
	return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

int DigitSum (int n) {
  int res = 0;
  while(n >= 10) {
    res += n%10;
    n /= 10;
  }
  res += n;
  return res;
}

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

    int N, A, B; cin >> N >> A >> B;
    int res = 0;
    rep(i, 1, N+1) {
      int digitSum = DigitSum(i);
      if (A <= digitSum and digitSum <= B) res += i;
    }
  
    cout << res << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#define maxn 100005
using namespace std;
int a[maxn];
int vis[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    int ans=0;
    for(int i=1;i<=n;i++)
     {
         scanf("%d",&a[i]);
         if(!vis[a[i]])
         {ans++;
             vis[a[i]]=1;
     }
     }
     if(ans%2==0)
        printf("%d\n",ans-1);
     else
        printf("%d\n",ans);


     return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<algorithm>
using namespace std;
#define eps 1e-7
#define maxi 50000005
typedef long long ll;
int n,k,avc;
int main()
{
     cin>>n;
     if(n==1) cout<<1<<endl;
     else {
     ll sum=0;
     ll a=2,b=1;
     for(int i=2;i<=n;i++)
     {
         sum=a+b;
         a=b,b=sum;
     }
     cout<<sum<<endl;
          }
     return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

int main()
{
  string s;
  cin>>s;
  int cnt=0;
  for (int i = 0; i < s.size(); ++i)
  {
    if(s[i]=='1') cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

////////// Union-Find木 //////////

struct UnionFind{
  vector<int> par,siz;						//par[i]:iの親の番号
  UnionFind(int N):par(N),siz(N,1ll){		//最初は全てが根であるとして初期化
    for(int i=0; i<N; i++) par[i]=i;
  }
  
  int root(int x){						//データxが属する木の根
    if(par[x]==x) return x;
    return par[x]=root(par[x]);
  }
  
  void unite(int x,int y){				//xとyの木を併合
    int rx=root(x);
    int ry=root(y);
    if(rx==ry) return;
    if(siz[rx]<siz[ry]) swap(rx,ry);
    siz[rx]+=siz[ry];
    par[ry]=rx;
  }
  
  bool same(int x,int y){				//x,yが属する木が同じならtrueを返す
    int rx=root(x);
    int ry=root(y);
    return rx==ry;
  }
  
  int size(int x){
    return siz[root(x)];
  }
};

//////////////////////////////////////////////////

int main(){
  ll N,M,K;
  cin>>N>>M>>K;
  UnionFind UF(N);
  vector<set<ll>> BAD(N);
  REP(i,M){
    ll a,b;
    cin>>a>>b;
    a--,b--;
    BAD[a].insert(b);
    BAD[b].insert(a);
    UF.unite(a,b);
  }
  REP(i,K){
    ll c,d;
    cin>>c>>d;
    c--,d--;
    if(!UF.same(c,d)) continue;
    BAD[c].insert(d);
    BAD[d].insert(c);
  }
  REP(i,N){
    cout<<UF.size(i)-1-BAD[i].size()<<" ";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 27488
n=int(input())
st=list(input())
f=set()
s=set()
t=set()
for x in map(int,st):
	for y in s:
		t.add(10*y+x)
	for y in f:
		s.add(10*y+x)
	f.add(x)
print(len(t))

Measured memory_bytes: 43244
#include <climits>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  ll h, w;
  cin >> h >> w;
  vector<vector<char>> graph(h + 2, vector<char>(w + 2, '*'));
  for (int i = 1; i <= h; ++i)
    for (int j = 1; j <= w; ++j)
      cin >> graph[i][j];

  vector<vector<ll>> cost(h + 2, vector<ll>(w + 2, INT_MAX));
  cost[1][1] = graph[1][1] == '#';

  queue<pair<ll, ll>> que;
  que.push(make_pair(1, 1));

  while (not que.empty()) {
    auto cur = que.front();
    que.pop();
    ll h0 = cur.first;
    ll w0 = cur.second;

    for (int i = 0; i < 2; ++i) {
      ll h1 = h0 + (i == 0 ? 1 : 0);
      ll w1 = w0 + (i == 1 ? 1 : 0);

      if (graph[h0][w0] == '.' && graph[h1][w1] == '#') {
        if (cost[h0][w0] + 1 < cost[h1][w1]) {
          cost[h1][w1] = cost[h0][w0] + 1;
          que.push(make_pair(h1, w1));
        }
      } else if (graph[h1][w1] != '*') {
        if (cost[h0][w0] < cost[h1][w1]) {
          cost[h1][w1] = cost[h0][w0];
          que.push(make_pair(h1, w1));
        }
      }
    }
  }

  cout << cost[h][w] << endl;
}


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

int main(){
  vector<int>e(4);
  for(int i=0; i<4; i++)cin >> e[i];
  sort(e.begin(), e.end());
  if(e[0]==e[1] && e[2]==e[3])cout << "yes\n";
  else cout << "no\n";
  return 0;
}


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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)
#define fi first
#define se second

using ll = long long;
using v_int = std::vector<int>;
using v2_int = std::vector<v_int>;
using v_ll = std::vector<ll>;
using v2_ll = std::vector<v_ll>;
using v_string = std::vector<std::string>;
using v_bool = std::vector<bool>;
using v2_bool = std::vector<v_bool>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using mii = std::map<int, int>;
using mll = std::map<ll, ll>;

const double PI = 3.1415926535897932;
const int INF = 2*(int)1e9;
const ll LINF = (ll)1e18;
const ll MOD = 1000000007;
//const int dc[4] = {1, -1, 0,  0};
//const int dr[4] = {0,  0, 1, -1};
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

using namespace std; 

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p)
{
    return o << "{" << p.first << "," << p.second << "}";
}

template<typename T> inline
istream& operator>>(istream &is, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) {
        is >> v[i]; 
    }
    return is;
}

template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) { 
        os << v[i];
        if(i != len-1) { os << ","; } 
    } 
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }

template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    string s;
    cin >> s;
    int n = s.size();

    int i = 0;
    int a = 0;
    ll ans = 0;
    while(i < n) {
        if(s[i] == 'A') {
            a++;
            i++;
        } else if(s[i] == 'B') {
            if(i + 1 < n) {
                if(s.substr(i, 2) == "BC") {
                    ans += a;
                    i += 2;
                } else if(s.substr(i, 2) == "BA") {
                    a = 1;
                    i += 2;
                } else {
                    i++;
                    a = 0;
                }
            } else {
                i++;
            }
        } else {
            a = 0;
            i++;
        }
    }
    cout << ans << endl;
    return 0;
}

/*atcoder*/


Measured memory_bytes: 3724
use proconio::input;
// ABC086C - Traveling
// https://atcoder.jp/contests/abs/fasks/arc089_a

fn main() {
    input! {
        h: usize,
        w: usize,
        k: usize,
        mut plan: [String; h],  // Vec<(i32, i32, i32)>
    }

    let mut result = 0;
    for i in 0..2i64.pow(h as u32) {
        for j in 0..2i64.pow(w as u32) {
            let mut count = 0;
            for (indexa, l) in plan.iter().enumerate() {
                for (indexb, m) in l.chars().enumerate() {
                    if m == '#'
                        && (i & 2i64.pow(indexa as u32) == 0)
                        && (j & 2i64.pow(indexb as u32) == 0)
                    {
                        count += 1;
                    }
                }
            }

            if count == k {
                result += 1;
            }
        }
    }

    println!("{}", result);
}


Measured memory_bytes: 2192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int n;
    cin >> n;
    ll ans = 0LL;
    rep(i, n+1) {
        if(i % 5 != 0 && i % 3 != 0) ans += i;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3636
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: usize = s.next().unwrap().parse().unwrap();
	let k: usize = s.next().unwrap().parse().unwrap();
	let a: Vec<u32> = s.map(|a| a.parse().unwrap()).collect();
	let mut a: Vec<_> = (0..n).flat_map(|i| a[i..].iter().scan(0u64, |s, &a|{ *s += a as u64; Some(*s) })).collect();
	a.sort();
	let msb = 63 - a.last().unwrap().leading_zeros();
	let mut ans = 0;
	let mut g: Vec<_> = (0..a.len()).collect();
	for bit in (0..msb + 1).rev() {
		let index: Vec<_> = g.iter().filter(|&&i| a[i] & (1 << bit) != 0).map(|&i| i).collect();
		if index.len() >= k {
			g = index;
			ans |= 1u64 << bit;
		}
	}
	println!("{}", ans);
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int minp = n+1,ans = 0,last_minp = 0; 
    for(int i=0;i<n;i++){
        int p; cin >> p;
        minp = min(minp,p);
        if(last_minp != minp){
            ans++;
        }
        last_minp = minp;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
const int N = 1e5 + 5;
pair <int,int> a[N];
int n;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n ; i++)
	{
		cin >> a[i].fi;
		a[i].se = i;
	}

	int ans = 0;
	sort(a + 1, a + 1 + n);
	for(int i = 1; i <= n; i++)
	{
		if( (a[i].se + i) % 2 == 1)
			ans++;
	}

	cout << ans/2;
}

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

int main(){
    int N,T,min,ans,c,t;
    bool flag=false;
    cin >> N >> T;
    for(int i=0;i<N;i++){
        cin >> c >> t;
        if(t<=T){
            if(!flag){
                flag=true;
                ans=c;
            } else {
                if(c<ans){
                    ans=c;
                }
            }
        }
    }
    if(flag){
        cout << ans;
    } else {
        cout << "TLE";
    }
    return 0;
}


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

int main(void) {
	int W,H,x,y,r;
	cin >> W >> H >> x >> y >> r;

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



	return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    int A,B;cin>>A>>B;
    cout<<A*B-A-B+1<<endl;
    
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int H,W;
    while(1){
        cin>>H>>W;
        if (H==0 && W==0){
            break;
        }else{
            for (int h=1;h<=H;h++){
                if (h%2!=0){
                    for (int w1=1;w1<=W;w1++){
                        if(w1%2!=0){
                            cout<<"#";
                        }else if(w1%2==0){
                            cout<<".";
                        }
                    }cout<<endl;
                }else if(h%2==0){
                    for (int w2=1;w2<=W;w2++){
                        if(w2%2!=0){
                            cout<<".";
                        }else if(w2%2==0){
                            cout<<"#";
                        }
                    }cout<<endl;
                }
            }
        }cout<<endl;
    }return 0;
}


Measured memory_bytes: 3068
import java.util.Scanner;

class Main{
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);

    int input1 = scan.nextInt();

    Tree main = new Tree(-2147483648);

    for(int loopCount = 0; loopCount < input1; loopCount++) {
      char[] s = scan.next().toCharArray();
      if(s[0]=='i') main.insert(scan.nextInt());
      else if(s[0]=='f') System.out.println(main.find(scan.nextInt()));
      else if(s[0]=='p') {
        if(main.right != null) {
          main.right.printMiddle();
          System.out.println();
          main.right.printFirst();
          System.out.println();
        }
      }
    }
  }
}

class Tree{
  int key;
  Tree left,right;

  Tree(int _key) {
    this.key = _key;
  }

  void insert(int _num) {
    if(key<_num) {
      if(right == null) {
        right = new Tree(_num);
      }else {
        right.insert(_num);
      }
    }else if(key>_num) {
      if(left == null) {
        left = new Tree(_num);
      }else {
        left.insert(_num);
      }
    }
  }

  String find(int _num) {
    if(key == _num) return "yes";
    else {
      if(key > _num && left != null) return left.find(_num);
      if(key < _num && right != null) return right.find(_num);
      return "no";
    }
  }

  void printFirst() {
    System.out.print(" "+key);
    if(left!=null) left.printFirst();
    if(right!=null) right.printFirst();
  }

  void printMiddle() {
    if(left!=null) left.printMiddle();
    System.out.print(" "+key);
    if(right!=null) right.printMiddle();
  }
}

Measured memory_bytes: 218688
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
	vl v={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int n; cin>>n;
	--n;
	cout<<v[n]<<endl;
	return 0;
}

Measured memory_bytes: 3568
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
    int k;
    char s[100];
    int i;
    int slen;

    scanf("%d %s",&k,s);
    slen = strlen(s);

    if(slen<=k)  printf("%s",s);
    else {
        for(i=0;i<k;i++){
            printf("%c",s[i]);
        }
        printf("...");
    }

    return 0;
}

Measured memory_bytes: 1712
class UnionFindNode:
    def __init__(self, group_id, parent=None, value=None):
        self.group_id_ = group_id
        self.parent_ = parent
        self.value = value
        self.rank_ = 1
        self.member_num_ = 1

    def is_root(self):
        return not self.parent_

    def root(self):
        parent = self
        while not parent.is_root():
            parent = parent.parent_
            self.parent_ = parent
        return parent

    def find(self):
        root = self.root()
        return root.group_id_

    def rank(self):
        root = self.root()
        return root.rank_

    def unite(self, unite_node):
        root = self.root()
        unite_root = unite_node.root()

        if root.group_id_ != unite_root.group_id_:
            if root.rank() > unite_root.rank():
                n_root, child = root, unite_root
            else:
                n_root, child = unite_root, root
            child.parent_ = n_root
            n_root.rank_ = max(n_root.rank_, child.rank_ + 1)
            n_root.member_num_ = n_root.member_num_ + child.member_num_


N, M = map(int, input().split())
nodes = [UnionFindNode(i) for i in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    nodes[a-1].unite(nodes[b-1])
R = 0
for i in range(N):
    R = max(R, nodes[i].root().member_num_)
print(R)


Measured memory_bytes: 95892
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=998244353;
const int N=10000050;
int F[N],I[N],po2[N],po3[N];
int binom(int n, int k){ return (ll)F[n]*I[k]%mod*I[n-k]%mod;}
int main()
{
	int n;
	scanf("%i",&n);
	F[0]=1;for(int i=1;i<=n;i++) F[i]=(ll)F[i-1]*i%mod;
	I[0]=I[1]=1;for(int i=2;i<=n;i++) I[i]=mod-(ll)(mod/i)*I[mod%i]%mod;
	for(int i=1;i<=n;i++) I[i]=(ll)I[i]*I[i-1]%mod;
	po2[0]=po3[0]=1;for(int i=1;i<=n;i++) po2[i]=(ll)po2[i-1]*2%mod,po3[i]=(ll)po3[i-1]*3%mod;
	int ans=po3[n];
	for(int i=n/2+1;i<=n;i++)
	{
		int tmp=(ll)binom(n,i)*po2[n-i]%mod;
		ans-=tmp*2%mod;
		if(ans<0) ans+=mod;
	}
	printf("%i\n",ans);
	return 0;
}

Measured memory_bytes: 156544
#include <bits/stdc++.h>
using namespace std ;
typedef long long ll;
ll mod=1e9+7;

//RepeatSquare
ll RS(ll N ,ll P, ll M){
    if(P==0) return 1;
    else if(P%2==0){
        ll t=RS(N,P/2,M);
        return t*t%M;
    }
    else return N*RS(N,P-1,M)%mod;   
}
//combination
ll f[10010],inv[10010];

void init(){
    f[0]=inv[0]=1;
    for(int i=1;i<10010;i++){
        f[i]=f[i-1]*i%mod;
        inv[i]=RS(f[i],mod-2,mod);
    } 
}

ll comb(ll a,ll b){
    if(b>a) return 0;
    else return ((f[a]*inv[b]) % mod *inv[a-b])% mod;
}

int main(){
    init();
    ll N,K;cin>>N>>K;
    for(int i=1;i<=K;i++){
        ll t =(comb(K-1,i-1)%mod *comb(N-K+1,i) %mod)%mod;
        cout << t <<endl;
    } 
    //cout << f[2000] << endl;
}

Measured memory_bytes: 3760
#include <iostream>

using namespace std;

long long N;

int main(){
    cin >> N;
    long long c = N / 11;
    c *= 2;
    if(N%11==0){
        cout << c << endl;
        return 0;
    }
    if(N%11 <= 6){
        cout << c + 1 << endl;
        return 0;
    }
    cout << c + 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(shoki,i,n) for(int i=shoki; i<n; i++)
#define _GLIBCXX_DEBUG
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;

int exponential(int a,int b){
    int sum = 1;
    if(b!=0){
        rep(0,i,b){
            sum *= a;
        }
    }
    return sum;
}

int main(){
    int n,m;
    cin>>n>>m;
    if(m==0){
        if(n==1) cout << 0 << endl;
        else cout << pow(10,n-1) << endl;
    }else{

        vi s(m);
        vector<char> c(m);
        rep(0,i,m) cin>>s[i]>>c[i];
        int n0;
        if(n==1){
                n0=0;
            }else{
                n0=exponential(10,n-1);
            }
        int nend = exponential(10,n);
        int ans = -1;
        rep(n0,i,nend){
            bool issc = true;
            string str = to_string(i);
            rep(0,j,m){
                if(str[s[j]-1] != c[j]){
                    issc = false;
                }
            }
            if(issc){
                ans = i;
                break;
            }
        }

        cout << ans << endl;
    }

}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  int count = 0;
  for(int i = a; i <= b; i++){
    string tmp = to_string(i);
    if(tmp[0] == tmp[4] && tmp[1] == tmp[3]) count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Measured memory_bytes: 7776
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

int main()
{
    int N, A, B;
    cin >> N >> A >> B;
    cout << min(A, B) << " " << max(0, (A+B)-N) << endl;
    return 0;
}

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

using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//最終奥義 #define int long long
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; }
void put_double(double obj){printf("%.12f\n",obj);};
//lambda: [](int x, int y){return x<y;}

signed main(void){
    string s; cin >> s;
    int q; cin >> q;
    deque<char> ans;
    rfor(c,s) ans.push_back(c);
    int rev=0;
    rep(i,q){
        int t; cin >> t;
        if(t==1){
            rev^=1;
        }else{
            int f; cin >> f; f--;
            char c; cin >> c;
            if(rev==f){
                ans.push_front(c);
            }else{
                ans.push_back(c);
            }
        }
    }
    if(rev){
        reverse(all(ans));
    }

    rfor(c,ans){
        putchar(c);
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 896
N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()
if A.count(0) > 0:
  print(0)
else:
  f = 0
  ans = 1
  for i in range(N):
    ans *= A[i]
    if ans > 10**18:
      f += 1
      print(-1)
      break
  if f == 0:
    print(ans)


Measured memory_bytes: 21552
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    string s;
    cin >> s;
    bool ok = true;
    for(ll i = 0; i < s.size(); i++) {
        if(i % 2 == 0 && (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')) continue;
        else if(i % 2 == 1 && (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')) continue;
        else ok = false;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

vector<pair<int, int> > p;

void PF(int k) {
    int kc = k;
    for (int i = 2; i <= sqrt(k); i++) {
        if (kc % i == 0) {
            int tmp = 0;
            while (kc % i == 0) {
                kc /= i;
                tmp++;
            }
            p.emplace_back(i, tmp);
        }
    }
    if (kc != 1) p.emplace_back(kc, 1);
}

int main(void){
    int q;
    cin >> q;
    
    int h[100010] = {};
    h[0] = h[1] = 0;
    for (int i = 2; i <= 100000; i++) {
        p.clear();
        PF(i);
        int t = 1;
        //cout << i << endl;
        for (int j = 0; j < p.size(); j++) {
            t *= p[j].second + 1;
            //cout << p[j].first << " "  <<p[j].second << endl;
        }
        
        //cout << i << " " << t << endl;
        if (t >= 5) h[i] = h[i - 1] + 1;
        else h[i] = h[i - 1];
    }
    
    for (int query = 0; query < q; query++) {
        int n;
        cin >> n;
        
        cout << h[n] << endl;
    }
    
}



Measured memory_bytes: 3496
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl;
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ');
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
//cout << fixed << setprecision(10);

int main () {
  char c;
  cin >> c;
  cout << (char)(c+1) << endl;
  return 0;
}

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

int main(){
  int a,b,c,d,e,k;
  int ans=0;
  cin >> a >> b >> c >> d >> e >> k;
  if((b-a)<=k) ans+=1;
  if((c-a)<=k) ans+=1;
  if((d-a)<=k) ans+=1;
  if((e-a)<=k) ans+=1;
  
  if((c-b)<=k) ans+=1;
  if((d-b)<=k) ans+=1;
  if((e-b)<=k) ans+=1;
  
  if((d-c)<=k) ans+=1;
  if((e-c)<=k) ans+=1;
  
  if((e-d)<=k) ans+=1;
  
  if(ans==10){
    cout << "Yay!" << endl; 
  }
  else{
    cout << ":(" << endl;
  }
  return 0;
}

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

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

  for(int n = 0; n <= 10000; n++){
    int za = n * 8 / 100;
    int zb = n * 10 / 100;

    if( a == za && b == zb ){
      cout << n << endl;
      return 0;
    }
  }
  cout << "-1" << endl;

  return 0;
}

Measured memory_bytes: 256
////////////////////////////////////
//          ,.                    //
//         (_|,.                  //
//        ,' /, )_______   _      //
//     __j o``-'        `.'-)'    //
//    (")                 \'      //
//     `-j                |       //
//        `-._(           /       //
//           |_\  |--^.  /        //
//          /_]'|_| /_)_/         //
//             /_]'  /_]'         //
//                                //
//           PIGMEISTER™          //
//                                //
////////////////////////////////////

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

#define ll long long
#define ull unsigned long long
#define mod (ll)1000000007
#define sidha(i, x, n) for(ll i=(ll)(x);i<(ll)(n);i++)
#define ulta(i, x, n) for(ll i=(ll)(x);i>=(ll)(n);i--)
#define mii map<ll, ll>
#define vi vector<ll>
#define pii pair<ll, ll>
#define pb push_back
#define mp make_pair
#define modInv(x) powah(x, mod-2)
#define test ll t;cin>>t;while(t--)
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
ll powah(ll, ll);

int main()
{
    jaldi;
    
    ll n, a, flag = 0;
    cin >> n;
    sidha (i, 0, n) {
        cin >> a;
        if (a%2 == 0 && (a%3 && a%5))
            flag = 1;
    }
    if (flag) cout << "DENIED";
    else cout << "APPROVED";

    return 0;
}

ll powah(ll x, ll y) { 
    ll res = 1;
    x = x % mod;
    while (y > 0) { 
        if (y & 1) 
            res = (res*x) % mod; 
        y = y>>1;
        x = (x*x) % mod;   
    } 
    return res; 
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int x,y;

	while (1)
	{
		scanf("%d %d", &x,&y);
		if(x==0&&y==0) break;
		if(x<y)
		{
			printf("%d %d\n",x,y);
		}
		else
		{
			printf("%d %d\n",y,x);
		}
		
		
	}

	return 0;
}

Measured memory_bytes: 1028
from collections import defaultdict


s_box = defaultdict(int)
t_box = defaultdict(int)

N = int(input())
s = [str(input()) for i in range(N)]
M = int(input())
t = [str(input()) for j in range(M)]

for key in s:
    s_box[key] += 1
for key in t:
    t_box[key] += 1

ans = []

for k, v in t_box.items():
    s_box[k] -= v

for v in s_box.values():
    ans.append(v)

if max(ans) < 0:
    print(0)
else:
    print(max(ans))

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

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

int n;
const int maxn = 1e5 + 5;

int a[maxn];

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    int odd = 0, even = 0;
    for(int i = 1;i <= n;i++){
        cin >> a[i];
        if(a[i] & 1){
            odd++;
        }else{
            even++;
        }
    }
    even += odd / 2;
    odd = odd % 2;
    if(odd > 0 and even > 0){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
    return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

#define MAX 2000000

int H, A[MAX + 1];

void maxHeapify(int i) {
    int l, r, largest;
    l = 2 * i;
    r = 2 * i + 1;

    if (l <= H && A[l] > A[i])
        largest = l;
    else largest = i;
    if (r <= H && A[r] > A[largest])
        largest = r;

    if (largest != i) {
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int main() {
    cin >> H;
    for (int i = 1; i <= H; ++i) {
        cin >> A[i];
    }

    for (int i = H / 2; i >= 1; --i) {
        maxHeapify(i);
    }

    for (int i = 1; i <= H; ++i) {
        cout << " " << A[i];
    }
    cout << endl;

    return 0;
}

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

int np(int n,int a){
  int i,k;
  n++;
  if(n==2)return 2;
  if(n%2==0)n++;
  while(1){
    for(int i=n;;i+=2){
      k=0;
      for(int j=3;j*j<=i;j+=2){
	if(i%j==0){
	  k=1;
	  break;
	}
      }
      if(k==0)return i;
    }
  }
}


int main(){
  int a,now;
  cin>>a;
  cout<<a<<":";
  now=1;
  while(a!=1){
    now=np(now,a);
    if(now*now>a){
      cout<<" "<<a;
      break;
    }
    while(a%now==0){
      cout<<" "<<now;
      a/=now;
    }
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <unordered_set>
#include <numeric>
using namespace std;

#define ll long long


int main()
{
	int x, a;
	cin >> x >> a;

	if (x < a)
	{
		cout << 0 << endl;
	}
	else
	{
		cout << 10 << endl;
	}
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n; cin >> n;
    ll a, b; cin >> a >> b;
    vector<ll> h(n);
    for (int i = 0; i < n; i++) cin >> h[i];
    
    // k 回の攻撃ですべての魔物を倒せるか？
    auto ok = [&](ll k) {
        ll c = 0;
        for (int i = 0; i < n; i++) {
            ll rest = max(0LL, h[i] - k * b);
            c += (rest + a - b - 1) / (a - b);
        }
        return c <= k;
    };

    ll l = 0, r = 1e9 + 1;
    while (r - l > 1) {
        ll m = (l + r) / 2;
        if (ok(m)) r = m;
        else l = m;
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
int main () {
 	int A, B, x, k, l;
  scanf("%d %d %d", &x, &A, &B);
  k = fabs(A - x);
  l = fabs(B - x);
  if(k < l) puts("A");
  else puts("B");
  return 0;
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int tmp;
  
  tmp = A;
  A = B;
  B = tmp;
  
  tmp = A;
  A = C;
  C = tmp;
  
  cout << A << " " << B << " " << C << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int x;
    cin>>x;
    if(x)
    cout<<0;
    else
    cout<<1;    
	return 0;
}

Measured memory_bytes: 3636