akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef vector<int>vi;
typedef pair<int,int>pi;
typedef vector<pi>vpi;
typedef vector<vi>vvi;
#define double long double
#define pow powl
#define sqrt sqrtl
#define cbrt cbrtl
#define floor floorl
#define ceil ceill
#define pb push_back
#define ep emplace_back
#define PB pop_back
#define pf push_front
#define ef emplace_front
#define PF pop_front
#define mp make_pair
#define ub(a,b) upper_bound(all(a),b)-a.begin()
#define lb(a,b) lower_bound(all(a),b)-a.begin()
#define bs(a,b) binary_search(all(a),b)
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) FOR(i,0,n-1) cin>>a[i]
#define in1(a,n) FOR(i,1,n) cin>>a[i]
#define ff first
#define ss second
#define out(a,n) FOR(i,0,n-1) cout<<a[i]<<" ";cout<<endl;
#define out1(a,n) FOR(i,1,n) cout<<a[i]<<" ";cout<<endl;
#define clr(a) a.clear()
#define pow2(a) (1LL<<a)
#define all(a) a.begin(),a.end()
#define all1(a) a.begin()+1,a.end()
#define rall(a) a.rbegin(),a.rend()
#define rall1(a) a.rbegin(),a.rend()
#define sz(a) ((int)a.size())
#define FOR(i,a,b) for(auto i=a;i<=b;i++)
#define NFOR(i,a,b) for(auto i=a;i>=b;i--)
const int mod=1e9+7;

inline int add(int a,int b){return (a%mod + b%mod)%mod;}
inline int sub(int a ,int b){return (a%mod - b%mod + mod)%mod;}
inline int mul(int a,int b){return (a%mod * b%mod)%mod;}
inline int power(int a,int b,int MOD){int res=1;while(b){if(b&1){res*=a;res%=MOD;}a=a*a;a%=MOD;b>>=1;}return res;}

#define trace(x) cout<<#x<<" :: "<<x<<endl;
#define trace2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define trace3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define trace4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
clock_t time_p = clock();
void time()
{
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (double)(time_p)/CLOCKS_PER_SEC <<endl;
}
signed main()
{
     SPEED;
     string s;
     cin>>s;
     string res;
     for(auto x:s)
     {
     	  if(x=='0')
     	  	res+='0';
     	  else if(x=='1')
     	  	res+='1';
     	  else if(!res.empty())
     	  	res.pop_back();
     }
     cout<<res<<endl;
     time();
     return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl;}
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;

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

    vector<pair<LL,LL>> AB;
    rep(i, N) {
        LL A, B;
        cin >> A >> B;

        AB.push_back(make_pair(B, A));
    }
    sort(ALL(AB));

    LL t = 0;
    rep(i, N) {
        t += AB[i].second;
        if(t > AB[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 6256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,cnt=0;
  cin>>a>>b>>c;
  if(a%2!=b%2&&a%2!=c%2){ 
    b++;c++;cnt++;
  }else if(a%2!=b%2&&b%2!=c%2){ 
    a++;c++;cnt++;
  }else if(a%2!=c%2&&b%2!=c%2){ 
    a++;b++;cnt++;
  }
  cnt+=(max({a,b,c})-a)/2;
  cnt+=(max({a,b,c})-b)/2;
  cnt+=(max({a,b,c})-c)/2;
  cout<<cnt<<endl;
  return 0;
}

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

ll gcd(ll a, ll b) {
    return b?gcd(b, a%b):a;
}

int main()
{
    int k;
    cin >> k;
    int ans = 0;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                ans += gcd(a, gcd(b, c));
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
S = input()
if 1 <= int(S[:2]) <= 12 and 1 <= int(S[2:]) <= 12:
    print("AMBIGUOUS")
elif 1 <= int(S[2:]) <= 12:
    print("YYMM")
elif 1 <= int(S[:2]) <= 12:
    print("MMYY")
else:
    print("NA")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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 long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  char a,b;cin>>a>>b;
  bool tog=a=='D';
  if(tog^(b=='H')){
    cout<<'H'<<endl;
  }
  else {
    cout<<'D'<<endl;
  }

  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define all(v) (v).begin(),v.end()
#define fi first
#define se second
const ll inf=(1e18);
bool dp[200000];
int main(){
int n,k;
cin>>n>>k;
vector<int> a(n);
for(int i=0;i<n;i++)cin>>a[i];
sort(all(a));
for(int i=0;i<=k;i++){
  for(int j=0;j<n;j++){
      if(i>=a[j]) dp[i]|=!dp[i-a[j]];
  }
}
if(dp[k])cout<<"First"<<endl;
else cout<<"Second"<<endl;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
int cnt[10]={0,2,5,5,4,5,6,3,7,6};
int n,m;
bool yes[10];
int x;
int wei[10010];
int ans[10010];
int dp[10010];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>x;
		yes[x]=true;
	}
	memset(ans,-1,sizeof(ans));
	ans[0]=0;
	for(int i=1;i<=n;i++){
		for(int j=9;j>=1;j--){
			if(yes[j]&&cnt[j]<=i&&ans[i-cnt[j]]!=-1)
			{
				if(wei[i]<wei[i-cnt[j]]+1)
				{
					wei[i]=wei[i-cnt[j]]+1;
					ans[i]=j;
					dp[i]=i-cnt[j];
				}
			}
		}
	}
	for(int i=n;i!=0;i=dp[i])
		if(i!=0)
			cout<<ans[i];
	cout<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <array>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
#define vint vector<int>

int main() {
    int a, b;
    cin >> a >> b;
    if (a + b >= 10){
        cout << "error" << endl;
    }else{
        cout << a + b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<map>
#include<set>
#include<fstream>
#include<sstream>
#include<queue>
#include<iterator>
#include<stack>

using namespace std;

#define st first
#define nd second
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REV(a) reverse(a.begin(),a.end())
#define SORT(a) sort(a.begin(),a.end())
#define inf (int)1e9
#define linf (long long)1e18

typedef long long ll;
typedef short int si;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;



int main() {
		int n,ans=0;
		cin>>n;
		FOR(i,0,n){
				int a,b;
				cin>>a>>b;
				ans+=b-a+1;
		}
		cout<<ans<<endl;







		return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int A = Integer.parseInt(sc.next());
        long[][][] dp = new long[51][51][3010];
        int[] x = new int[50];

        for (int i = 0; i < N; i++) {
            x[i] = sc.nextInt();
        }

        dp[0][0][0] = 1;
        for (int i = 0; i < N; i++) for (int j = 0; j < i+1; j++) for (int k = 0; k < 2501; k++) {
            // 選ぶ
            dp[i+1][j][k] += dp[i][j][k];
            // 選ばない
            dp[i+1][j+1][k+x[i]] += dp[i][j][k];
        }

        long ans = 0;
        for (int i = 1; i < N+1; i++) {
            ans+=dp[N][i][i*A];
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 78336
#include <iostream>
using namespace std;
//B - Great Ocean View
int main(void){
    int n;
    std::cin >> n;
    int maxH=0;
    int cnt=0;
    for (int i = 0; i < n; i++) {
        int h;
        std::cin >> h;
        if(maxH<=h){
            maxH=h;
            cnt++;
        }
    }
    std::cout << cnt << std::endl;
    
}


Measured memory_bytes: 256
N=int(input())
S=input()
r,g,b = S.count('R'),S.count('G'),S.count('B')
total = r*g*b

count = 0
for d in range(1,N):
  for i in range(N-2*d):
    if S[i]!=S[i+d] and S[i+d]!=S[i+2*d] and S[i+2*d] != S[i]:
      count+=1

print(total-count)
      

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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);
#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    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...);
    }
#else
    #define debug(...)
#endif


int main()
{

    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    LL a , b , n;
    cin >> a >> b >> n;

    LL ans = b - 1;
    ans = min(ans,n);

    LL V = floor((double)(ans * a)/b) - a * floor(ans/(double)b);
    cout << V << "\n";
    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string wd1, wd2;
    int cnt = 0;
    cin >> wd1;
    
    while (cin>>wd2, wd2!="END_OF_TEXT"){
        for(int i=0; i<wd1.size();i++){
            wd1[i] = tolower(wd1[i]);
        }
        
        
        for(int j=0; j<wd2.size();j++){
            wd2[j] = tolower(wd2[j]);
        }
        if(wd1==wd2){
            cnt++;
        }
    }
    cout << cnt << endl;
    
}



Measured memory_bytes: 3136
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
int main(){
    int n,a;
    cin >> n >> a;
    if(n%500 <= a){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N, K; cin >> N >> K;
    vector<double> p(N);
    rep(i, N) cin >> p[i];

    // 累積和
    vector<double> s(N+1, 0); // s[0] = 0 になる
    for (int i = 0; i < N; ++i) s[i+1] = s[i] + p[i];

    double res=0;
    rep(i, N-K+1){
        res = max(res, s[i+K]-s[i]);
    }

    cout << (res+K)/2 << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

int main() {

    int N;
    cin >> N;
    int L[101];
    int Max = 0, goukei = 0;
    for (int i = 0; i < N; i++) {
        cin >> L[i];
        Max = max(Max, L[i]);
        goukei += L[i];
    }
    if(Max * 2 < goukei){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define debug(x) std::cerr<<#x<<":"<<(x)<<std::endl;
#define INIT ios::sync_with_stdio(false);cin.tie(0);

signed main() {
  INIT;
  int n,k;cin>>n>>k;
  int ans = 0;
  for(int i=0;i<n;++i) {
    int p;cin>>p;
    if(p>=k) ++ans;
  }
  cout<<ans <<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<bits/stdc++.h>
using namespace std;
int main() 
{ 
char a[4];
for(int i=0;i<4;i++)
{
cin>>a[i];
}

if (a[1] != a[2])
{
    cout<<"No";
}
else {
    if (a[0] == a[1] or a[3] == a[1])
    {
        cout<<"Yes";
    }
    else
        cout<<"No";
}

return 0;  
}

Measured memory_bytes: 3612
def gcd(x, y):
    if x%y == 0:
        return y
    return gcd(y, x%y)

def main():
    K = int(input())
    ans = 0
    for i in range(1, K+1):
        for j in range(1, K+1):
            for k in range(1, K+1):
                ans += gcd(gcd(i, j), k)
    print(ans)
main()

Measured memory_bytes: 79044
#include<cstdio>
#include<cstring>
const int N=1005,dir[4][2]={{0,1},{0,-1},{1,0},{-1,0}};
int n,m,he,ta,q[N*N][2],dis[N][N];char s[N][N];bool vis[N][N];
int get(int x,int y){return x*N+y;}
int main(){
	memset(dis,63,sizeof(dis));
	memset(vis,1,sizeof(vis));
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)scanf("%s",s[i]+1);
	for(int i=1;i<=n;++i)for(int j=1;j<=m;++j)if(s[i][j]=='#')q[++ta][0]=i,q[ta][1]=j,dis[i][j]=0;else vis[i][j]=0;
	while(he!=ta){
		int x=q[++he][0],y=q[he][1];
		for(int i=0;i<4;++i){
			int nx=x+dir[i][0],ny=y+dir[i][1];
			if(!vis[nx][ny]){
				vis[nx][ny]=1;
				dis[nx][ny]=dis[x][y]+1;
				q[++ta][0]=nx,q[ta][1]=ny;
			}
		}
	}
	printf("%d\n",dis[q[ta][0]][q[ta][1]]);
	return 0;
}

Measured memory_bytes: 13952
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)

#define endl "\n"
#define pb push_back
#define elif else if
#define cout_db cout << fixed

#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	int n, a[100000], four = 0, two = 0, one = 0;
	cin >> n;
	REP(i, n){
		cin >> a[i];
		if(a[i] % 4 == 0) four++;
		elif(a[i] % 2 == 0) two++;
		else one++;
	}

	if(four >= one) cout << "Yes" << endl;
	elif(one <= 2 and four >= one) cout << "Yes" << endl;
	elif(n % 2 == 1 and one == n/2 + 1 and four == n/2 ) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

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

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define PI (3.141592653589793238462643383279502884197169399375105820974944)
#define MP make_pair
#define n1 first
#define n2 second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDB pair<db,db>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define VS vector<string>
#define SZ(x) ((int)x.size())

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const db eps = 0.00000000001;
const int INF = 1000000007;
const ll LINF = 1000000000000000555;
const int N = 550555;
const int L = 21;
const int M = 2155;

void solve() {
    int x;
    cin >> x;

    VI v;
    for (int i = 1; i*i <= x; i++){
        if (x % i != 0) continue;
        v.PB(i);
        if (i*i != x) v.PB(x/i);
    }
    sort(v.begin(), v.end());

    for (ll k : v){
        for (ll a = 0; a*a*a*a <= x/k; a++){
            ll b = a-k;
            if (a*a*a*a*a - b*b*b*b*b == x){
                cout << a << ' ' << b << endl;
                return;
            }
        }
    }

}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3656
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <map>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

struct UF {
  vector<int> data;
  int nDistinct;
  UF() {}
  UF(int n) : data(n, -1), nDistinct(n) {}
  void init(int n) { data.assign(n, -1); nDistinct = n; }
  int size(void) const { return nDistinct; }
  int rootOf(int a) { return data[a] >= 0 ? data[a] = rootOf(data[a]) : a; }
  int count(int a) { return -data[rootOf(a)]; }
  bool isSameGroup(int a, int b) { return rootOf(a) == rootOf(b); }
  bool unify(int a, int b) {
    int ra = rootOf(a), rb = rootOf(b);
    if(ra == rb) return false;
    if(data[ra] < data[rb]) swap(ra, rb);
    data[rb] += data[ra]; data[ra] = rb; --nDistinct;
    return true;
  }
};

map<pair<int,int>, int> table;

int main(void) {
  int nNode;
  int nRoad1, nRoad2;
  scanf("%d%d%d", &nNode, &nRoad1, &nRoad2);
  UF uf1(nNode);
  REP(i, nRoad1) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a;
    --b;
    uf1.unify(a, b);
  }
  UF uf2(nNode);
  REP(i, nRoad2) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a;
    --b;
    uf2.unify(a, b);
  }
  REP(i, nNode) {
    table[make_pair(uf1.rootOf(i), uf2.rootOf(i))]++;
  }
  REP(i, nNode) {
    printf("%d%c", table[make_pair(uf1.rootOf(i), uf2.rootOf(i))], i == nNode-1 ? '\n' : ' ');
  }
  return 0;
}


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

bool incCheck(char c, vector<char> v) {
	for (auto e : v) {
		if (c == e) {
			return true;
		}
	}
	return false;
}

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

	string s;
	


	while (cin >> s and s != "#") {
		bool isLeft = false;
		int cnt = 0;
		isLeft = incCheck(s[0], left);

		for (int i = 1; i < s.size(); ++i) {
			if (isLeft) {
				if (!incCheck(s[i], left)) {
					cnt++;
					isLeft = false;
				}
			}
			else {
				if (incCheck(s[i], left)) {
					cnt++;
					isLeft = true;
				}
			}
		}
		cout << cnt << endl;
	}
}	



Measured memory_bytes: 3176
fun main(args: Array<String>) {
    while(true)
    {
        var list = readLine()!!.split(" ").map(String::toDouble)
        var a = list[0] * list[0] * Math.PI
        var b = list[0] * 2.toDouble() * Math.PI

        print("%f %f".format(a,b))
        return
    }
}


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


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

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



int main() {

	int n;
	cin >> n;
	int a = 0, b = 0;
	int c = 0, d = 0;
	int e = 0;

	int ans = 0;
	REP(i, n) {
		string s;
		cin >> s;
		REP(j, s.size() - 1) {
			if (s.substr(j, 2) == "AB") {
				ans++;
				j++;
			}
		}

		if (s[0] == 'B'&&s[s.size() - 1] == 'A')e++;
		else if (s[s.size() - 1] == 'A')a++;
		else if (s[0] == 'B')b++;
	}


	//cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << endl;

	ans += max(0, e - 1);

	if (e > 0 && a == b) {
		if (a > 0) {
			cout << ans + a + 1 << endl;
		}
		else cout << ans+a << endl;
		return 0;
	}
	else {
		if (e == 0)cout << ans + min(a, b) << endl;
		else cout << ans + min(a, b) + 1 << endl;

		return 0;
	}


}


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

int main(){
  int a, b , c;
  cin >> a >> b >> c;
  if(a<b&&b<c) cout << "Yes" << endl;
  else cout << "No" << endl;
}



Measured memory_bytes: 3080
#coding:utf-8
from copy import deepcopy

n = int(input())
c = ["white" for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
S = []
class DFS:
    def __init__(self, key, color="white",nex=None):
        self.color = color
        self.nex = nex
        self.key = key

objList = [DFS(i+1) for i in range(n)]
for i in range(n):
    data = list(map(int,input().split()))
    times = data[1]
    obj = objList[i]
    for j in range(times):
        index = data[2+j] - 1
        nextobj = DFS(index+1)
        obj.nex = nextobj
        obj = obj.nex


time = 1
def check(first,time):
    obj = objList[first]
    c[first] = "gray"
    d[first] = time
    f[first] = time
    S.append(first+1)
    
    while S != []:
        index = S[-1] - 1
        u = objList[index]
        v = u.nex
    
        if v != None:
            objList[index] = v
            if c[v.key - 1] == "white":
                index = v.key - 1
                v = objList[index]
                c[v.key-1] = "gray"
                time += 1
                d[index] = time
                S.append(v.key)

           
                
        else:
            S.pop()
            c[u.key-1] = "black"
            time += 1
            f[index] = time
    return time


for i in range(n):
    if f[i] == 0:
        time = check(i,time) + 1
        

k = 1
for i,j in zip(d,f):
    print(k,i,j)
    k += 1


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

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define INF ((ll)1e9+7)
#define c(a) cout<<a<<"\n";
using namespace std;
const int N = 100005;

int n, a, b, c;
int l[8];
int dfs(int i, int A, int B, int C);
int main() {
	speed;

	cin >> n >> a >> b >> c;
	rep(i, n) {
		cin >> l[i];
	}
	c(dfs(0, 0, 0, 0));
	return 0; 
}
int dfs(int i, int A, int B, int C) {
	if (i == n) {
		if (A != 0 && B != 0 && C != 0) {
			return  abs(A - a) + abs(B - b) + abs(C - c) - 30;
		}
		else {
			return INF;
		}
	}
	int res1 = dfs(i + 1, A, B, C);
	int res2 = dfs(i + 1, A + l[i], B, C) + 10;
	int res3 = dfs(i + 1, A, B + l[i], C) + 10;
	int res4 = dfs(i + 1, A, B, C + l[i]) + 10;
	return min({ res1,res2,res3,res4 });
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int N = 100005;

LL pow_mod(LL x, LL n) {
    LL res = 1;
    while (n) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
LL f[N];
int main() {
    int n, m;
    cin >> n >> m;
    LL ans = 0;
    for (int i = m; i >= 1; i--) {
        f[i] = pow_mod(m / i, n);
        for (int j = i + i; j <= m; j += i) {
            f[i] -= f[j];
        }
        f[i] = (f[i] % mod + mod) % mod;
        ans += f[i] * i % mod;
    }
    cout << ans % mod << endl;
    return 0;
}


Measured memory_bytes: 4412
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<cstdlib>
#define cmax(a,b) (a<(b)?a=(b),1:0)
#define cmin(a,b) (a>(b)?a=(b),1:0)
#define dmin(a,b) ((a)<(b)?(a):(b))
#define dmax(a,b) ((a)>(b)?(a):(b))
#define regsiter register
#define CL fclose(stdin),fclose(stdout)
namespace io
{
	int F()
	{
		int n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
	long long G()
	{
		long long n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
}
bool chka(long long a,long long b,int min)
{
	if(a>=b)return b*min>=a;
		else return (a+1)*min>=b;
}
bool chkb(long long a,long long b,int min)
{
	if(a>=b)return (b+1)*min>=a;
		else return a*min>=b;
}
void q(int a,int b,int c,int d,int min)
{
	if(a==0)for(register int i=c;i<=d;++i)putchar('B');
		else if(b==0)for(register int i=c;i<=d;++i)putchar('A');
				else
				{
					int ca,cb;
					int ans=0;
					for(register int l=(a+b)/(b+1),r=dmin(min,a),mid=l+r>>1;l<=r;mid=l+r>>1)
						if(chka(a-mid,b,min))ans=mid,l=mid+1;
							else r=mid-1;
					ca=ans;
					ans=1;
					if(a==ca)cb=b;
						else
							for(register int l=1,r=(b)/(a-ca+1),mid=l+r>>1;l<=r;mid=l+r>>1)
								if(chkb(a-ca,b-mid,min))ans=mid,r=mid-1;
									else l=mid+1;
					cb=ans;
					if(ca==0||ca>1&&cb>1)ans=1;
						else for(register int l=1,r=dmin(b/cb,ca==0?0x7fffffff:a/ca),mid=l+r>>1;l<=r;mid=l+r>>1)
								if(chkb(a-mid*ca,b-mid*cb,min))ans=mid,l=mid+1;
									else r=mid-1;
					if(c<=(ca+cb)*ans)for(register int i=c;i<=(ca+cb)*ans&&i<=d;++i)putchar(i%(ca+cb)<=ca&&i%(ca+cb)?'A':'B');
					if(d>(ca+cb)*ans)q(a-ans*ca,b-ans*cb,dmax(c-(ca+cb)*ans,1),d-(ca+cb)*ans,min);
					/*if(chk(a-1,b-1,min))
					{
						
						ca=ans,cb=1;
					}
					else
					{
						int ans=0;
						for(register int l=2,r=b,mid=l+r>>1;l<=r;mid=l+r>>1)
							if(chk(a-1,b-mid,min))ans=mid,r=mid-1;
								else l=mid+1;
					}*/
				}
	
}
void qu(int a,int b,int c,int d)
{
	int min,t;
	if(a>=b)min=a/(b+1),t=a%(b+1);
		else min=b/(a+1),t=b%(a+1);
	if(t)++min;
	q(a,b,c,d,min);
	//int k=((long long)a*min-b)/((long long)min*min-1);
	//if(c<=k*(min+1))for(register int i=c;i<=d&&i<=k*(min+1);++i)putchar(i%(min+1)?'A':'B');
	//if(d>k*(min+1))qu(a-k*min,b-k,dmax(1,c-k*(min+1)),d-k*(min+1));
}
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int q=io::F();
	while(q--)
	{
		int a=io::F(),b=io::F(),c=io::F(),d=io::F();
		//if(b==1)fprintf(stderr,"%d %d\n",a,b);
		qu(a,b,c,d);
		puts("");
	}
	return 0;
}




Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

ll n, k, com, a, b, c, d[100];
vector<P> v[100];
ll INF = 1e15;

ll dijkstra(ll x, ll y) {
  priority_queue<P, vector<P>, greater<P>> que;
  for (ll i = 0; i < n; i++) d[i] = INF;
  que.push(P(0, x));
  while (!que.empty()) {
    P p = que.top(); que.pop();
    ll from = p.second, cost = p.first;
    if (from == y) return cost;
    if (d[from] <= cost) continue;
    d[from] = cost;
    for (ll i = 0; i < v[from].size(); i++) {
      P q = v[from][i];
      ll to = q.second, c2 = cost + q.first;
      if (d[to] > c2) que.push(P(c2, to));
    }
  }
  return -1;
}

int main() {
  while (scanf("%lld%lld", &n, &k), n) {
    for (ll i = 0; i < k; i++) {
      scanf("%lld", &com);
      if (com == 0) {
        scanf("%lld%lld", &a, &b); a--; b--;
        printf("%lld\n", dijkstra(a, b));
      } else {
        scanf("%lld%lld%lld", &a, &b, &c); a--; b--;
        v[a].push_back(P(c, b));
        v[b].push_back(P(c, a));
      }
    }
    for (ll i = 0; i < n; i++) v[i].clear();
  }
}



Measured memory_bytes: 2848
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>

using namespace std;


int main(){
   int a,b,c,x,y;
   cin>>a>>b>>c>>x>>y;
   int ans=0;
   if(a+b<=2*c){
      ans=a*x+b*y;
   }
   else{
      if(x>=y){
         if(a<=c*2){
            ans=c*2*y+a*(x-y);
         }
         else{
            ans=c*2*x;
         }
      }
      else{
         if(b<=c*2){
            ans=c*2*x+b*(y-x);
         }
         else{
            ans=c*2*y;
         }
      }
   }
   cout<<ans<<endl;
}

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

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

#define mp make_pair
#define pb push_back
#define pt(i) printf("%lld\n",(ll)i)
#define mp make_pair
#define ff first
#define ss second
#define pi acos(-1.0)

ll in() { ll a;scanf("%lld",&a); return a;}
db din(){ db a;scanf("%lf",&a); return a; }
ll bigmod(ll b, ll p,ll md){if(p==0) return 1;if(p%2==1){ return ((b%md)*bigmod(b,p-1,md))%md;} else {ll y=bigmod(b,p/2,md);return (y*y)%md;}}
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b);}

long long getRandom(long long a,long long b){
    long long ret = (long long)rand()*(long long)rand();
    ret %= (b - a + 1);
    ret += a;
    return ret;
}

ll dp[105][100005],n,w,wi[105],vvi[105];

ll solve(ll pos,ll wei)
{
	if(wei>w)
		return -1*INT_MAX;
	if(pos==n)
		return 0;
	if(dp[pos][wei]!=-1)
		return dp[pos][wei];
	return dp[pos][wei]=max(vvi[pos]+solve(pos+1,wei+wi[pos]),solve(pos+1,wei));
}

int main()
{
//	freopen("in.c","r",stdin);
//	freopen("out.c","w",stdout);
	n=in(),w=in();
	for(int i=0;i<n;i++)
		wi[i]=in(),vvi[i]=in();
	memset(dp,-1,sizeof dp);
	pt(solve(0,0));
}

Measured memory_bytes: 82304
a = list(map(int, input().split()))
if a[0] % (a[1] + a[2]) == 0:
  print((a[0] // (a[1] + a[2])) * a[1])
elif a[0] % (a[1] + a[2]) <= a[1]:
  print((a[0] // (a[1] + a[2])) * a[1] + a[0] % (a[1] + a[2]))
else:
  print((a[0] // (a[1] + a[2])) * a[1] + a[1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
const int M=1e9+7;
using namespace std;
int fact(int n)
{
	long long x=1;
	for(int i=1;i<=n;i++)
	x=(x*i)%M;
	return x;
}
int main()
{
	int d,m;
	long long ans;
	cin>>d>>m;
	if(d>m)
	swap(d,m);
	if(m==d)
	ans=(2LL*fact(d)*fact(m))%M;
	else if(m==d+1)
	ans=(1LL*fact(m)*fact(d))%M;
	else
	ans=0;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
eval'N,A,B,C,*L='+`dd`.split*?,;p (1..4**N).map{|s|x=0,0,m=0,-1e9;L.map{|l|(x[s&3]+=l)>l&&m+=10;s/=4};x&[0]!=[]?1e9:m+(x[0]-A).abs+(x[1]-B).abs+(x[2]-C).abs}.min

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int t, n;
string s, S[10] = {"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};

signed main() {
	cin >> t;
	rep(T,t) {
		cin >> s;
		n = s.size();
		string res;
		char c;
		int l = -1;
		rep(i,n) {
			if (s[i]=='0' && l!=-1) res.pb(c), l = -1;
			else if (s[i]!='0') {
				if (l==-1) l = 0, c = S[s[i]-'0'][0];
				else l++, l %= S[s[i]-'0'].size(), c = S[s[i]-'0'][l];
			}
		}
		cout << res << ln;
	}
}


Measured memory_bytes: 3228
n = int(input())
A = [0] + [int(num) for num in input().split()] + [0]

cost = 0
for j in range(n+1):
  cost += abs(A[j] - A[j+1])

for i in range(1, n+1):
  print(cost - abs(A[i] - A[i-1]) - abs(A[i+1] - A[i]) + abs(A[i+1] -A[i-1]))
  

Measured memory_bytes: 64748
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

a, b, k = ril()
if k <= a:
    print(a - k, b)
else:
    print(0, max(0, b - k + a))

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

int main() {
  int n, m; cin >> n >> m;
  map<int, int> mp;
  bool ok=1;
  for (int i = 0; i < m; i++) {
    int pos, tmp; cin >> pos >> tmp;
    if (mp.find(pos) != mp.end() && mp[pos] != tmp) ok=0;
    if (pos == 1 && tmp == 0 && n != 1)
      ok = 0;
    mp[pos] = tmp;
  }
  if (!ok) cout << -1;
  else {
    for (int i = 1; i <= n; i++)
      cout << (mp.find(i) != mp.end() ? mp[i] : i == 1 && n != 1 ? 1 : 0);
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007
using namespace std;
using ll = long long;
int main() {
	string s;	cin >> s;
	if (s.size() == 2) {
		cout << s << endl;
		return 0;
	}
	cout << s[2] << s[1] << s[0] << endl;
}

Measured memory_bytes: 764
#set
n = gets.chomp.to_i
s = gets.chomp.split("")
s_length = s.length

answer = 'No'


#main
if s_length.odd? then
  print ("#{answer}\n")
  exit
else
  0.upto(s_length / 2 - 1) do |i|
    if s[i] != s[s_length / 2 + i] then
      print ("#{answer}\n")
      exit
    end
  end
  answer ='Yes'
  print ("#{answer}\n")
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N;
  vector<string> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  cin >> M;
  vector<string> B(M);
  for (int i = 0; i < M; i++) {
    cin >> B.at(i);
  }
  vector<int> ans(N, 0);
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      if(A.at(i) == A.at(j)) {
        ans.at(i)++;
      }
    }
    for(int k = 0; k < M; k++) {
      if(A.at(i) == B.at(k)) {
        ans.at(i)--;
      }
    }
  }
  sort (ans.begin(),ans.end());
  cout << max(0, ans.at(N-1)) << endl;
}

Measured memory_bytes: 256
#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define FOR(i, a, b, s)     for(ll i = (a); ((s)>0 ? i<(b) : i>(b)); i += (s))
#define FOR1(b)             FOR(i, 0, b, 1)
#define FOR2(i, b)          FOR(i, 0, b, 1)
#define FOR3(i, a, b)       FOR(i, a, b, (a) <= (b) ? 1 :-1)
#define FOR4(i, a, b, s)    FOR(i, a, b, s)
#define GET5(a, b, c, d, e, ...) e
#define FORC(...)           GET5(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)
#define loop(...)           FORC(__VA_ARGS__)(__VA_ARGS__)
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename... T> 
inline void inp(T&... args) {
    ((cin>>args), ...);
}
// scan vector
template <typename T> 
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

ll XOR(ll a,ll b)
{
    a--;
    a = max(a,0ll);
    ll a1[] = {a,1,a+1,0};
    ll a2[] = {b,1,b+1,0};
    
    ll xr1 = a1[a%4];
    ll xr2 = a2[b%4];
    return(xr1 xor xr2);
}

void solve(int &T)
{
    ll a, b;
    cin>>a>>b;
    cout<<XOR(a,b);
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    for(int i=1; i<=t; i++)
    {
        cerr<<"Case #"<<i<<"\n";
        solve(i);
    }
    return 0;
}

Measured memory_bytes: 3660
#include <cstdio>
#include <utility>
#include <cctype>
#include <vector>
#include <algorithm>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;for(char c;c=gcu(),c!=' '&&c!='\n'&&c!=EOF;)s+=c;return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
	_HT _OUT(H &&h, T... t){out(h);out(t...);}
	template <typename... T> _OUTL(T... t){out(t...);outl();}
	struct range{
		int e,b=0,s=1;range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
		struct it{int v,s; it(int _v,int _s):v(_v),s(_s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
			it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

using T = pair<int, int>;

int main() {
	vector<T> t;
	times(i, 2)
		times(j, in)
			t.push_back(T{in, in});
	sort(begin(t), end(t));
	t.erase(unique(begin(t), end(t)), end(t));
	for (T &i: t)
		printf("%s%d:%02d", &i == &t[0] ? "" : " ", i.first, i.second);
	outl();
}


Measured memory_bytes: 2700
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int pizzaA = sc.nextInt();
        int pizzaB = sc.nextInt();
        int pizzaH = sc.nextInt();
        
        int Aneed = sc.nextInt();
        int Bneed = sc.nextInt();
        
        int ans = Integer.MAX_VALUE;
        for(int h=0;h<=Math.max(Aneed,Bneed);h++){
        	//2*h: the num of h&h pizza
        	int a = Math.max(0,Aneed-h);
        	int b = Math.max(0,Bneed-h);
        	
        	ans = Math.min(ans, pizzaA*a+pizzaB*b+pizzaH*2*h);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
use std::env;
use std::io::*;
use std::str::*;
use std::mem;
use std::collections::HashMap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn read_char() -> char {
    let c = read::<String>();
    let c = c.chars().collect::<Vec<char>>();
    c[0]
}
fn read_String_Vec() -> Vec<char> {
    let S = read::<String>();
    S.chars().collect::<Vec<char>>()
}

fn vecchar_to_String(Vs: Vec<char>) -> String {
    let mut S = String::new();
    for i in 0..Vs.len() {
        S.push(Vs[i]);
    }
    S
}

/*
A : 65
Z : 90
a : 97
z : 122
*/

/*
let N = read::<i32>();
let S = read::<String>();
let S = read_String_Vec();
let C = read_char();
*/

/*
 .to_string() : * -> String
 &*S          : String -> &str
*/

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let K = read::<i32>();
    let S = read::<i32>();
    let mut count = 0;
    for x in (0..K+1) {
        for y in (0..K+1) {
            let z = S - x - y;
            if 0 <= z && z <= K {
                count += 1;
            }
        }
    }

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


Measured memory_bytes: 4352
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

bool islow(char c) {
  return c >= 'a' && c <= 'z';
}

int main() {
  string S;
  cin >> S;
  if (S[0] != 'A') {
    cout << "WA" << endl;
    return 0;
  }
  bool flag = false;
  int pos;
  for (int i = 2; i < S.size() - 1; i++) {
    if (S[i] == 'C') {
      pos = i;
      flag = true;
    }
  }
  if (!flag) {
    cout << "WA" << endl;
    return 0;
  }
  for (int i = 0; i < S.size(); i++) {
    if (i == 0 || i == pos) continue;
    if (!islow(S[i])) {
      cout << "WA" << endl;
      return 0;
    }
  }
  cout << "AC" << endl;
  return 0;
}

Measured memory_bytes: 256