akhauriyash/Code-Regression huggingface dataset:
//It doesn't matter as long as you rise to the top - Katsuki Bakugo
#include<bits/stdc++.h>
using namespace std;
     
     
#define Fast_as_duck ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back 
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define rev(i,st,n) for(int i = st; i >= n ; i--)
#define ss second
#define ff first
#define ll long long 

typedef pair <int , int> pii;

const int N = 1e5 + 10 , mod =  1000000007;

void solve(){

    string str; cin >> str;

    int n = str.size();

    ll sum = 0;

    forn(i,0,n){
        sum += (str[i] - '0');
    }

    if(sum % 9 == 0){
        cout << "Yes\n";
    }else cout << "No\n";
    


    
    

    
    
        


}

int main(){
    Fast_as_duck;

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
*/
    int t = 1; 
    
    // cin >> t;
    

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




    return 0;
}
      
       


Measured memory_bytes: 3724
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 1000005
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PA;
typedef priority_queue<ll> PQ;
typedef pair<double, double> doup;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef map<ll, ll> Map;

int main(void) {
    string n;
    cin >> n;
    for(ll i=0; i<3; i++) {
        if(n[i]=='1') {
            cout << '9';
        }else if(n[i]=='9') {
            cout << '1';
        }else {
            cout << n[i];
        }
    }
    cout << endl;
    
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
char p[110];
int main() {
	int i, c = 0;
	scanf("%s", p);
	for (i = 0; p[i]; i++)if (p[i] == 'x')c++;
	if (c >= 8)puts("NO");
	else puts("YES");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int n;
long long a[300010];
int main() {
  cin >> n;
  for (int i = 0; i < n*3; i++) cin >> a[i];
  sort(a,a+n*3);
  reverse(a,a+n*3);
  long long S = 0;
  for (int i = 0; i < n*2; i+=2) {
    S += a[i+1];
  }
  cout << S << endl;
}

/*　【提出前に確認すること】
・コンパイルできるか
・テストケース試したか
・オーバーフローあるか
*/

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int input, str_size, total = 0;
  char splitted_num;
  string str_num;
 
  cin >> input;
  // ここにプログラムを追記
  str_num = to_string(input);
  str_size = str_num.size();

  for (int i = 0; i < str_size; i++) {
    splitted_num = str_num[i];
    total += (int)(splitted_num - '0');
  }
  if (input % total == 0) { cout << "Yes" << endl; } 
  else { cout << "No" << endl; } 
}

Measured memory_bytes: 256
#include<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(itr,data) for(__typeof((data).begin()) itr=(data).begin();itr!=(data).end();++itr)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long UInt64;
typedef long long Int64;

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

using namespace std;

typedef pair<int ,int > P;

int n,m;

int sum(vector<int> vec) {
    int res=0;
    rep(i,vec.size()) res+=vec[i];

    return res;
}

void solve() {
    P ans = mp(INF,INF);
    vector<int> taro,hanako;
    rep(i,n) {
        int a;cin>>a;
        taro.pb(a);
    }
    rep(i,m) {
        int a;cin>>a;
        hanako.pb(a);
    }
    rep(i,n) rep(j,m) {
        swap(taro[i],hanako[j]);
        if(sum(taro)==sum(hanako)) {
            if(ans.fr+ans.sc>taro[i]+hanako[j]) {
                ans = mp(taro[i],hanako[j]);
            }
        }
        swap(taro[i],hanako[j]);

    }
    if(ans.fr==INF&&ans.sc==INF) cout<<"-1"<<endl;
    else cout<<ans.sc<<" " <<ans.fr<<endl;

    return;

}


int main() {
    while(cin>>n>>m){

        if(!(n+m)) return 0;
        solve();

    }
    return 0;
}

Measured memory_bytes: 1224
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int A,B,X;
	scan(A>>B>>X);
	if(X>=A&&X<=A+B) prin("YES");
	else prin("NO");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>

typedef long long ll;
using namespace std;

int main()
{
    int N, M, C, cnt, ans = 0, a;
    cin >> N >> M >> C;

    vector <int> b(M, 0);

    for (int i = 0; i < M; i++) {
        cin >> b[i];
    }

    for (int i = 0; i < N; i++) {
        cnt = 0;
        for (int i = 0; i < M; i++) {
            cin >> a;
            cnt += a*b[i];
        }
        if (cnt + C > 0) ans++;
    }

    cout << ans << endl;

    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto 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; }

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

    int n, a, b;
    cin >> n >> a >> b;
    cout << ((b - a) % 2 ? "Borys" : "Alice") << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<iomanip>

#define pi 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342

using namespace std;

int main(){
    double r,  res;

    cin >> r;

    res = 2 * pi * r;

    cout << fixed << setprecision(20) <<res << endl;

    return 0;
}


Measured memory_bytes: 3764
#include<iostream>
using namespace std;
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (d >= c - a && d >= a - c)
		cout << "Yes" << endl;
	else if(d >= c - b && d >= b - c && d >= b - a && d >= a - b)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

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

    string s; cin >> s;

    ll len = s.size();

    string ans = "";

    rep(i, len){
        ans.append("x");
    }

    cout << ans << endl;

    return 0;
}

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N + 2];


void solve()
{
	cin >> n;
	cout << n + n*n + n*n*n << endl;

}

int32_t main()
{
	ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

	int test = 1;
	// cin >> test;
	while (test--)solve();


}





Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000011
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
 
int main(){
 char pp[4];
  rep(i, 4){
    cin>>pp[i];}
  
  sort(pp, pp+4);
  if(pp[0]==pp[1]&&pp[1]!=pp[2]&&pp[2]==pp[3]){
    cout<<"Yes"<<endl;}
  else{
    cout<<"No"<<endl;}
  
 
 
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

#define MP make_pair
#define MT make_tuple
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

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

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

	string S;
	cin >> S;
	int n = S.length();
	string A[] = {"eraser", "erase", "dreamer", "dream"};
	int i = 0, pre = 0;
	while(i < n){
		REP(j, 4){
			int m = A[j].length();
			bool ok = true;
			REP(k, m){
				if(S[n - 1 - i - k] != A[j][m - 1 - k]){
					ok = false;
					break;
				}
			}
			if(ok){
				i += m;
			}
		}
		if(pre == i){
			cout << "NO" << endl;;
			return 0;
		}
		pre = i;
	}

	cout << "YES" << endl;

	return 0;
}


Measured memory_bytes: 512
#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++)
using namespace std;

signed main(void)
{
	int n; cin >> n;
	int c[n - 1], s[n - 1], f[n - 1];
	rep(i, n - 1) cin >> c[i] >> s[i] >> f[i];

	int now, next, x;
	rep(i, n)
	{
		x = 0;
		now = 0;
		FOR(j, i, n - 1)
		{
			next = s[j];
			while (now > next)
				next += f[j];
			now = next + c[j];
			x = now;
		}
		cout << x << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,k,cnt=0;
    cin>>n>>k;
    while(n/k!=0){
        n=n/k;
        cnt++;
    }
    cout<<cnt+1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<cstdlib>

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi>  vvi;

const int INF=(1<<31)-1;

template<class T> struct Interval{
	T a,b;
	Interval(){}
	Interval(T A,T B):a(A),b(B){}
};

int h,w,a[1000000];

template<class T>
class RMQ{
	int n;
	T *a;

	T query(const Interval<int> &I,const Interval<int> &J,int u){
		if(J.b<=I.a || I.b<=J.a) return INF;
		if(I.a<=J.a && J.b<=I.b) return a[u];

		int m=(J.a+J.b)/2;
		T tl=query(I,Interval<int>(J.a,m),2*u+1);
		T tr=query(I,Interval<int>(m,J.b),2*u+2);
		return tl<tr?tl:tr;
	}

public:
	RMQ(){}

	RMQ(int k,int b):n(1){
		int N;
		if(!b) N=w;
		else   N=h;

		while(n<N) n<<=1;
		a=(T *)malloc((2*n-1)*sizeof(T));
		rep(i,2*n-1) a[i]=0;

		if(!b) rep(i,N) a[n+i-1]=::a[k*w+i];
		else   rep(i,N) a[n+i-1]=::a[i*w+k];

		for(int i=n-2;i>=0;i--) a[i]=min(a[2*i+1],a[2*i+2]);
	}

	T query(int a,int b){
		return query(Interval<int>(a,b),Interval<int>(0,n),0);
	}
};

int main(){
	for(int q;scanf("%d%d%d",&h,&w,&q),h||w||q;){
		rep(i,h) rep(j,w) scanf("%d",a+(i*w+j));

		RMQ<int> *rmq1=(RMQ<int> *)malloc(h*sizeof(RMQ<int>));
		RMQ<int> *rmq2=(RMQ<int> *)malloc(w*sizeof(RMQ<int>));
		rep(i,h) rmq1[i]=RMQ<int>(i,0);
		rep(j,w) rmq2[j]=RMQ<int>(j,1);

		rep(_,q){
			int t,l,b,r; scanf("%d%d%d%d",&t,&l,&b,&r); b++; r++;

			int ans=INF;
			if(b-t<r-l) for(int i=t;i<b;i++) ans=min(ans,rmq1[i].query(l,r));
			else        for(int j=l;j<r;j++) ans=min(ans,rmq2[j].query(t,b));
			printf("%d\n",ans);
		}

		free(rmq1);
		free(rmq2);
	}

	return 0;
}

Measured memory_bytes: 35000
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        String[] dic = new String[H];
        for(int i=0;i<H;i++) dic[i]=sc.next();
        long ans = 0;
        for(int i=0;i<W-1;i++){
            char[] a = new char[H],b = new char[H];
            for(int j=0;j<H;j++){
                a[j]=dic[j].charAt(i);
                b[j]=dic[j].charAt(i+1);
            }
            ans += help(a,b);
        }
        System.out.println(ans);
    }
    static long help(char[] a, char[] b){
        int n = a.length;
        long[][] rec= new long[n+1][n+1];
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++) rec[i][j] = rec[i-1][j-1]+(a[i-1]==b[j-1]?1:0);
        }
        long[][] dp = new long[n+1][n+1];
        for(int i=n-1;i>=0;i--) dp[i][n] = dp[i+1][n]+rec[i+1][n];
        for(int j=n-1;j>=0;j--) dp[n][j] = dp[n][j+1]+rec[n][j+1];
        for(int i=n-1;i>=0;i--){
            for(int j=n-1;j>=0;j--){
                long m1 = dp[i+1][j]+rec[i+1][j];
                long m2 = dp[i][j+1]+rec[i][j+1];
                dp[i][j] = Math.min(m1,m2);
            }
        }
        return dp[0][0];
    }
}


Measured memory_bytes: 155732
N = int(input())
blue = {}
for _ in range(N):
  s = input()
  if s in blue.keys():
    blue[s] += 1
  else:
    blue[s] = 1

M = int(input())
red = {}
for _ in range(M):
  t = input()
  if t in red.keys():
    red[t] += 1
  else:
    red[t] = 1
    
cnt = 0
for i in blue.keys():
  if i in red.keys():
    cnt = max(cnt, blue[i] - red[i])
  else:
    cnt = max(cnt, blue[i])
    
print(cnt)

Measured memory_bytes: 9108
N,A,B,C,D=map(int,input().split())
if N%A:
    X=(N//A+1)*B
else:
    X=(N//A)*B
if N%C:
    Y=(N//C+1)*D
else:
    Y=(N//C)*D
if X<Y:
    print(X)
else:
    print(Y)



Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define F first
#define S second
//cout<<fixed<<setprecision(11);
const string nl="\n";
const ll MOD=1e9+7;
const ll ARR_MAX = 1e5+1;
const ll VAL_MAX = 1e5+1;
const ll INF=1e14;

void solve(){
    int n;cin>>n;
    int a[n];
    vector<pii> test[n];
    for(int i=0;i<n;i++){
    	cin>>a[i];
    	// test[i].resize(a[i]);
    	for(int j=0;j<a[i];j++){
    		int u,v;cin>>u>>v;
    		u--;
    		test[i].pb({u,v});
    	}
    }
    int mx=0;
    for(int mask=0;mask<(1<<n);mask++){
    	bool f=1;
    	for(int j=0;j<n;j++){
    		if(mask & 1<<j){
    			for(int i=0;i<test[j].size();i++){
    				if(test[j][i].S && (mask & 1<<test[j][i].F)){
    					continue;
    				}
    				if(test[j][i].S==0 && !(mask & 1<<test[j][i].F)){
    					continue;
    				}
    				f=0;
    				break;
    			}
    			if(f==0){
    				break;
    			}
    		}
    	}
    	if(f){
    		int cnt=0;
    		for(int j=0;j<n;j++){
    			if(mask & 1<<j){
    				cnt++;
    			}
    		}
    		mx=max(mx,cnt);
    	}
    }
    cout<<mx;
}

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

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

#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)


int main()
{

    lint n,size,ans=0;
    cin >> n;
    vector<lint> a(n),b;
    REP(i, n) { cin >> a[i]; }
    b = a;
    sort(a.begin(), a.end());
    a.erase(std::unique(a.begin(), a.end()), a.end());
    size = a.size();
    sort(a.begin(), a.end());

    lint n_count[3];

    if (size>3){
        {
            cout << "No"
                 << "\n";
        }
        return 0;
    }

    FOR(i, 0, size)
    {
        n_count[i] = std::count(b.begin(), b.end(), a[i]);
    }

    if (size == 2)
    {
        if (n_count[1] == 2*n / 3 && a[0] == 0)
        {
            cout << "Yes"
                 << "\n";
        }
        else
        {
            cout << "No"
                 << "\n";
        }
        return 0;
    }
    if (size == 1)
    {
        if (a[0] ==0)
        {
            cout << "Yes"
                 << "\n";
        }
        else
        {
            cout << "No"
                 << "\n";
        }
        return 0;
    }

    if (size == 3)
    {
        int tmp;
        tmp = a[0] ^ a[1] ^ a[2];
        if (n_count[0] == n_count[1] && n_count[2] == n_count[1]&&tmp==0)
        {
            cout << "Yes"
                 << "\n";
        }
        else
        {
            cout << "No"
                 << "\n";
        }
        return 0;
    }
    return 0;
}

Measured memory_bytes: 1792
D, G = map(int, input().split())
Q = []
for i in range(D):
    p, c = map(int, input().split())
    Q.append([p, c])

def solve(G, i):
    if i < 0:
        return 10**9
    
    n = min(G//(100*(i+1)), Q[i][0])
    
    p = 100 * (i+1) * n
    if n == Q[i][0]:
        p += Q[i][1]
    
    if p < G:
        ans = n + solve(G-p, i-1)
    else:
        ans = n
    return min(ans, solve(G, i-1))

print(solve(G, D-1))


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

int main()
{
     int A,B,y,count=1;
     cin>>A;
     cin>>B;
     if(B==1)
     {
         y=0;
     }
     else
     {
         while(B-(A)>=(A-1))
         {
            count+=1;
            B=(B-(A-1));
         }
         if((B-A)>0)
         {
             count++;
         }
         y=count;
     }

     cout<<y;

     return 0;
}
     



Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>                                                                             

double dis(int T, double h, int Ta){
  return pow(Ta - (T - h*0.006), 2);
}

int main(){
  int i, n, t, ta, k;
  k = 0;
  double min = dis(50, pow(10, 5), 50);
  scanf("%d", &n);
  scanf("%d %d", &t, &ta);
  double h[n];
  for(i = 0; i < n; i++){
    scanf("%lf", &h[i]);
    h[i] = dis(t, h[i], ta);
    if(h[i] < min){
      min = h[i];
      k = i;
    }
  }
  printf("%d\n", k + 1);

  return 0;
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 30 21:21:32 2019

@author: Yamazaki Kenichi
"""

N = int(input())
s = input()

r = s.count('R')
b = s.count('B')

if r>b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
fun main(args: Array<String>){
    val s = readLine()
    val num = s?.toInt()

    var sum: Long = 0
    for(i in 1..num!!){
        if(i % 3 != 0 && i % 5 != 0){
            sum += i
        }
    }
    println(sum)
}

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

#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(int i=1; i<= (int)n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,l,r) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define ri(n) scanf("%d",&n)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<char,int> pci;
typedef tuple<int, int, int> tiii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

const ll INF = LONG_LONG_MAX;
const int MAXN = 21;
const int mod = 1e9+ 7;

int can[MAXN][MAXN];
ll dp[MAXN][int(1<<MAXN)];
int allmask;

int n;

ll go(int idx, int mask){
    if(idx == n) return (mask == allmask);
    ll &r = dp[idx][mask];
    if(r!=-1) return r;
    r= 0;
    for(int i=0; i<n; ++i){ // i es mujeres, idx es hombres
        if(!((1<<i)&mask) && can[idx][i]){
            r+= go(idx+1, mask|(1<<i));
            r%=mod;
        }
    }
    return r;
}

int main(){
    ri(n);
    memset(dp, -1, sizeof dp);
    forn(i,n){
        forn(j,n){
            ri(can[i][j]);
        }
    }
    allmask = (1<<n)-1;
    printf("%lld\n",go(0,0));

}


Measured memory_bytes: 344320
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

using namespace std;

const long long INF = 1LL << 60;

//各桁の和を出力
long long Sum(long long n) {
  long long m = 0;
  while (n) {
    m += n % 10;
    n /= 10;
  }
  return m;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void Comuse() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

#define comuse Comuse()
// nCk(comuseを使え)
long long combi(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// pCk(comuseを使え)
long long perm(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] % MOD) % MOD;
}

//最小公倍数(aとbの)
long long lcm(long long a, long long b) {
  long long n;
  n = a / __gcd(a, b) * b;
  return n;
}

// auto A = div(n)
vector<long long> div(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

//(aのn乗をmodで割ったあまり)
long long modpow(long long a, long long n, long long mod) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = ans * a % mod;
    }

    a = a * a % mod;

    n >>= 1;
  }

  return ans;
}

void solve();

const int MAX_N = 131072;
// segment tree
int NN;
int seg[MAX_N * 2 - 1];
void seguse() {
  for (int i = 0; i < 2 * NN - 1; i++) {
    seg[i] = INT_MAX;
  }
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;
  solve();
}

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

string S;
string A,B;
void solve() {
  cin >> S;
  for(int i = 0; i < S.size(); i++){
    if(S[i] != S[S.size() - 1 - i]){
      cout << "No" << endl;
      return;
    }
  }
  for(int i = 0; i < S.size() / 2; i++){
    A.push_back(S[i]);
    B.push_back(S[S.size()/2 - 1 - i]);
  }
  if(A == B){
    cout << "Yes" <<endl;
  } else{
    cout << "No" <<endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>

using namespace std;
string st;
int main()
{
	cin>>st;
	cout<<st[0]<<st[1]<<st[2]<<st[3]<<' '<<st[4]<<st[5]<<st[6]<<st[7]<<st[8]<<st[9]<<st[10]<<st[11]<<endl;
	return 0;
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, q;
	string s;
	cin >> n >> s >> q;
	int B = 1;
	while(B < n) {
		B *= 2;
	}
	vector<int> tree(2*B);
	for(int i = 0; i < n; i++) {
		tree[i+B] = 1<<(s[i]-'a');
	}
	
	for(int i = B-1; i > 0; i--) {
		tree[i] = tree[2*i] | tree[2*i+1];
	}
	
	for(int rep = 0; rep < q; rep++) {
		int type;
		cin >> type;
		if(type == 1) {
			int i;
			char c;
			cin >> i >> c;
			i--;
			i += B;
			tree[i] = 1<<(c-'a');
			for(i /= 2; i > 0; i /= 2) {
				tree[i] = tree[2*i] | tree[2*i+1];
			}
		} else {
			int ans = 0;
			
			int L, R;
			cin >> L >> R;
			L += B - 1, R += B - 1;
			while(L <= R) {
				if(L % 2 == 1) ans |= tree[L++];
				if(R % 2 == 0) ans |= tree[R--];
				
				L /= 2, R /= 2;
			}
			
			cout << __builtin_popcount(ans) << '\n';
		}
	}
}


Measured memory_bytes: 5020
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const ll P = 998244353;
int N;
const int Nmax = 300;
int A[Nmax];

int main(){
	cin >> N;
	for(int i=0; i<N; i++) cin >> A[i];
	int S = 0;
	for(int i=0; i<N; i++) S += A[i];

	vector<vector<ll> > dp(N+1, vector<ll>(S+1));
	for(int i=0; i<=N; i++) dp[i][0] = 1;
	for(int i=0; i<N; i++){
		for(int j=0; j<=S; j++){
			dp[i+1][j] = 2*dp[i][j];
			if(j>=A[i]) dp[i+1][j] += dp[i][j-A[i]];
			dp[i+1][j] %= P;
		}
	}
	vector<vector<ll> > dp1(N+1, vector<ll>(S+1));
	for(int i=0; i<=N; i++) dp1[i][0] = 1;
	for(int i=0; i<N; i++){
		for(int j=0; j<=S; j++){
			dp1[i+1][j] = dp1[i][j];
			if(j>=A[i]) dp1[i+1][j] += dp1[i][j-A[i]];
			dp1[i+1][j] %= P;
		}
	}
	//for(int j=0; j<=N; j++) for(int i=0; i<=S; i++) cout << dp[j][i] << (i==S?'\n':' ');
	//for(int j=0; j<=N; j++) for(int i=0; i<=S; i++) cout << dp1[j][i] << (i==S?'\n':' ');

	ll ans = 1;
	for(int i=0; i<N; i++) ans = 3*ans%P;
	ll x = 0;
	for(int i=(S+1)/2; i<=S; i++) x += dp[N][i];
	if(S%2==0) x = (x-dp1[N][S/2]+P)%P;
	//cout << x << " " << dp1[N][S/2] << endl;
	ans = (ans - 3*x%P + P) % P;
	cout << ans << endl;

	return 0;
}


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

long long GCD(long long a, long long b){
	if(a % b == 0){
		return b;
	} else {
		return GCD(b, a % b);
	}
}

long long LCM(long long a, long long b){
	long long C = GCD(a, b);
	long long A = a / C;
	long long B = b / C;
	return A * B * C;
}

int main(){
	int N;
	scanf("%d", &N);
	vector<long long> T(N);
	for(int i = 0; i < N; i++)cin >> T[i];
	
	long long ans;
	if(N == 1)ans = T[0];
	else{
		sort(T.begin(), T.end());
		ans = LCM(T[0], T[1]);
		for(int i = 2; i < N; i++)ans = LCM(ans, T[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define getchar gc
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
#define he(a,b) a>b?mp(a.first,max(a.second,b.first)):mp(b.first,max(b.second,a.first));
PI a[1<<18|3];
int ans[1<<18|3];
int main(){
	int n=read();
	for(int i=0;i<(1<<n);i++)a[i]=mp(read(),0);
	for(int i=0;i<n;i++){
		for(int j=0;j<(1<<n);j++)if(j>>i&1){
			a[j]=he(a[j],a[j^(1<<i)]);
		}
	}
	for(int i=1;i<(1<<n);i++){ans[i]=max(ans[i-1],a[i].first+a[i].second); writeln(ans[i]);}
}


Measured memory_bytes: 6272
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;
double x[100], y[100], z[100], r[100];
int n,m,t;
double MX = 1 << 20, mn;
double mp[100][100];
double sumcor;
int p[100];
double d[100];
int visited[100];

// distance i, j
double compute(int i, int j) {
  double ret;

  ret = sqrt( (x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]) + (z[i] - z[j])*(z[i] - z[j]) ) - (r[i] + r[j]);

  if (ret < 0) ret = 0;

  return ret;
}

int main() {
  double res = 0;

  while(1) {
    cin >> n;
    if (n == 0) break;

    for(int i=0; i < n; i++) {
      cin >> x[i]; cin >> y[i]; cin >> z[i]; cin >> r[i];
    }

    // init p, d, visited, map, res
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
	mp[i][j] = MX;
      }
      p[i] = -1;
      d[i] = MX;
      visited[i] = 0;
    }
    res = 0;

    // distance between 2 cells
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
	if (i == j){
	  mp[i][j] = 0;
	} else {
	  mp[i][j] = compute(i, j);
	}
      }
    }
    
    d[0] = 0;
    t = 0;
    while(1){
      mn = MX;
      // Renew target
      for (int i = 0; i < n; i++) {
	if (d[i] < mn && visited[i] == 0) {
	  mn = d[i];
	  t  = i;
	}
      }

      if ( mn == MX ) break;

      visited[t] = 1;
      res += d[t];
      //if (p[t] != -1) res += mp[t][p[t]];
      //printf("res: %.3f\n", res);

      //
      for(int v = 0; v < n; v++){
	if(mp[t][v] < d[v] && visited[v] == 0){
	  d[v] = mp[t][v];
	  p[v] = t;
	}
      }
    }
    printf("%.3f\n", res);
  }

  return 0;
}

Measured memory_bytes: 1324
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int gcd(int a, int b)
{
  if (a%b==0){
    return(b);
  }
  else{
    return(gcd(b,a%b));
  }
}



int a,b,k;
vector<int> v(100);
int main(){
  cin >> a >> b >> k;
  rep(i,min(a,b)){
    if(a % (i+1) == 0 && b %(i+1) == 0) v.push_back(i+1);
  }
  sort(v.begin(), v.end(),greater<int>());
  cout << v[k-1] << endl;
  
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int count = 0;

    for(int i = 0; i < N; i++){
      int a = sc.nextInt();
      while(true){
      if(a % 2 == 0){
        a = a / 2;
        count = count + 1;
      }else{
        break;
      }
    }
  }

   System.out.println(count);
  }
}

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


#define NUM 21


int H,W,CAP,num_resident;
int diff_row[4] = {-1,0,0,1},diff_col[4] = {0,-1,1,0};
int height[NUM][NUM],pool;
bool exist[NUM][NUM],visited[NUM][NUM],Area_FLG;
set<int> SET;

bool rangeCheck(int row,int col){
	if(row >= 0 && row <= H-1 && col >= 0 && col <= W-1)return true;
	else{
		return false;
	}
}

void searchArea(int row,int col,int base_height){

	visited[row][col] = true;
	pool += base_height-height[row][col];

	if(row == 0 || row == H-1 || col == 0 || col == W-1 || exist[row][col] == true){
		Area_FLG = false;
	}
	int next_row,next_col;
	for(int i = 0; i < 4; i++){
		next_row = row+diff_row[i];
		next_col = col+diff_col[i];
		if(rangeCheck(next_row,next_col) == false || visited[next_row][next_col] == true ||
				height[next_row][next_col] >= base_height)continue;

		searchArea(next_row,next_col,base_height);
	}
}

bool is_ok(int base_height){

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++)visited[row][col] = false;
	}
	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			if(visited[row][col] == true || height[row][col] >= base_height)continue;

			pool = 0;
			Area_FLG = true;

			searchArea(row,col,base_height);

			if(Area_FLG == true && pool >= CAP){
				return true;
			}
		}
	}
	return false;
}

void func(){

	SET.clear();

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			scanf("%d",&height[row][col]);
			SET.insert(height[row][col]);
		}
	}
	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++)exist[row][col] = false;
	}

	int tmp_row,tmp_col;
	for(int loop = 0; loop < num_resident; loop++){
		scanf("%d %d",&tmp_row,&tmp_col);
		tmp_row--;
		tmp_col--;
		exist[tmp_row][tmp_col] = true;
	}

	int tmp_height;
	for(auto it = SET.begin(); it != SET.end(); it++) {

		tmp_height = *it;

		if(is_ok(tmp_height)){
			printf("Yes\n");
			return;
		}
	}

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			if(exist[row][col])continue;

			height[row][col]++;
			if(is_ok(height[row][col])){
				printf("Yes\n");
				return;
			}
			height[row][col]--;
		}
	}
	printf("No\n");
}

int main(){

	while(true){
		scanf("%d %d %d %d",&H,&W,&CAP,&num_resident);
		if(H == 0 && W == 0 && CAP == 0 && num_resident == 0)break;

		func();
	}

	return 0;
}



Measured memory_bytes: 3152
#include <stdio.h>

int main(void){

  int W,H,w,h;
  int a = 0;
  
  scanf("%d%d\n",&H,&W);
  scanf("%d%d\n",&h,&w);
  
  a = (H-h)*(W-w);
  
  printf("%d",a);
  return 0;
  
}

Measured memory_bytes: 128
#include <string>
#include <vector>
#include <cmath>
#include <list>
#include <set>
#include <algorithm>
#include <map>
#include <iostream>

using namespace std;


int main()
{
	int N;

	cin >> N;

	int count = 0;

	for(int i = N-1; i > N / 2; i--)
	{
		int sub = N - i;
		if(sub != i)
		{
			count++;
		}
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<set>
#include<vector>
#include<cmath>
#include<complex>
#include<string>
#include<algorithm>

using namespace std;

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;

int main(void){
  string n;
	cin >> n;
	rep(i,3){
		if(n[i] == n[i+1]){
			cout << "Bad" << endl;
			return 0;
		}
	}
	cout << "Good" << endl;

  return 0;
}


Measured memory_bytes: 256
x, y, _a, _b, _c = gets.split.map(&:to_i)
p = gets.split.map(&:to_i).sort_by(&:-@).take(x)
q = gets.split.map(&:to_i).sort_by(&:-@).take(y)
r = gets.split.map(&:to_i)

puts p.concat(q, r).sort_by(&:-@).take(x + y).sum

Measured memory_bytes: 38232
#D-Not Divisible
#pdf見た
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
maxi = a[-1]
boo = [True]*(maxi+1)

for i in range(n):
    k = a[i]
    if not boo[k]:
        continue
    if i != n-1 and k == a[i+1]:
        boo[k] = False
    for j in range(2,maxi//k+1):
        boo[k*j] = False
    
count = 0
for k in a:
    if boo[k] == True:
        count += 1

print(count)

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

int main(){
	int r;
	cin >> r;
	if(r < 1200){
		cout << "ABC" << endl;
	}else if(r < 2800){
		cout << "ARC" << endl;
	}else{
		cout << "AGC" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        int maxPlayers = 0;
        
        Scanner sc = new Scanner(System.in);
        Map<Integer, Integer> playersInfo = new HashMap<>();
        int count = sc.nextInt();
        
        for(int i = 0; i < count; i++){
            playersInfo.put(sc.nextInt(), sc.nextInt());
        }

        int maxKey = Collections.max(playersInfo.keySet());
        int minValue = playersInfo.get(maxKey);
        
        if(minValue > 0){
            maxPlayers += minValue;
        }
        maxPlayers += maxKey;
        
        System.out.println(maxPlayers);
    }
    
}


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

const int maxn=30;
char s[maxn];
char org[]="CODEFESTIVAL2016";

int main(){
    while(~scanf("%s", s)){
        int ans=0, len=strlen(org);
        for(int i=0;i<len;i++){
            if(org[i]!=s[i])ans++;
        }
        printf("%d\n", ans);
    }

}



Measured memory_bytes: 256
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second 
#define ull unsigned long long  
#define pii pair<int, int>
#define piii pair<int,pii>
#define beg begin
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define int ll
using ll = long long;
const int N = 3*1e5 +5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#endif


void solve()
{
	int n ;
	cin >> n ;
	vector<int> a(n);
	int res = 0 , sum = 0 ; 
	for(auto &x : a) cin >> x , sum += x;
		int ans = inf ;
	for(auto x : a){
		ans = min(ans , abs(sum - 2*res));
		res += x ;
		ans = min(ans , abs(sum - 2*res));
	}
	cout << ans ;
}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        //cout << endl ;
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int h,w,i,o,sign=1,start;
    for(;start=0,scanf("%d %d",&h,&w),h+w;puts(""))
        for(i=0;i<h;i++,start=1-start,puts(""))
            for(sign=start,o=0;o<w;o++,sign=1-sign)
                printf("%c",sign==0?'#':'.');
    return 0;
}

Measured memory_bytes: 588
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

class Stability
{
 public:
  void solve( int n, string bsa[], string ssa[] );
  void bubblesort( int n, string a[]);
  void selectionsort( int n, string a[]);
};

void Stability::solve( int n, string bsa[], string ssa[] )
{
  bool stability_check = true;
  
  bubblesort( n, bsa );
  selectionsort( n, ssa );
  
  cout << bsa[0];
  for( int i = 1; i < n; i++ )
    {
      cout << " " << bsa[i];
    }
  cout << endl;
  cout << "Stable" << endl;

  cout << ssa[0];
  for( int i = 1; i < n; i++ )
    {
      cout << " " << ssa[i];
    }
  cout << endl;

  for( int i = 0; i < n; i++ )
    {
      if( bsa[i] != ssa[i] )
        stability_check = false;
    }

  if( stability_check )
    cout << "Stable" << endl;
  else
    cout << "Not stable" << endl;
}

void Stability::bubblesort( int n, string a[] )
{
  for( int i = 0; i < n; i++ )
    {
      for( int j = n - 1; j > i; j-- )
        {
          if( a[j][1] < a[j-1][1] )
            {
              swap( a[j], a[j-1] );
            }
        }
    }
}

void Stability::selectionsort( int n, string a[] )
{
  int mini;
  
  for( int i = 0; i < n; i++ )
    {
      mini = i;
      for( int j = i; j < n; j++ )
        {
          if( a[j][1] < a[mini][1] )
            mini = j;
        }
      swap(a[i], a[mini]);
    }
}

int main( void )
{
  int n;
  string bsa[36];
  string ssa[36];

  Stability *st = new Stability();

  cin >> n;
  for( int i = 0; i < n; i++ )
    {
      cin >> bsa[i];
      ssa[i] = bsa[i];
    }

  st -> solve( n, bsa, ssa );

  delete st;

  return 0;
}

Measured memory_bytes: 1208
fun main(args: Array<String>) {
  val S = readString()
  val N = S.length

  fun f(s: String): Boolean {
    return s == s.reversed()
  }

  if (f(S) && f(S.substring(0, (N - 1) / 2)) && f(S.substring((N + 2) / 2))) {
    println("Yes")
  } else {
    println("No")
  }

}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }
fun readLong() = readString().toLong()
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 33768
N = int(input())
l = [0]*(10**5+1)
A = [j for j in map(int, input().split())]
for i in A:
    l[i] += 1

Q = int(input())

BC = []
ans = sum(A)

for i in range(Q):
    B, C = map(int, input().split())
    BC.append([B, C])
for i in BC:
    B = i[0]
    C = i[1]
    ans += l[B]*(C-B)
    l[C] += l[B]
    l[B] = 0
    print(ans)

# print(N)
# print(A)
# print(Q)
# print(BC)


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

using namespace std;

int main() {
  int N; cin >> N;
  int nAC = 0, nWA = 0, nTLE = 0, nRE = 0;
  for (int i = 0; i < N; i++) {
    string result; cin >> result;
    if (result == "AC") {
      nAC++;
    } else if (result == "WA") {
      nWA++;
    } else if (result == "TLE") {
      nTLE++;
    } else {
      nRE++;
    }
  }
  cout << "AC x " << nAC << endl;
  cout << "WA x " << nWA << endl;
  cout << "TLE x " << nTLE << endl;
  cout << "RE x " << nRE << endl;
  return 0;
}

Measured memory_bytes: 3628
s = input()
n1 = int(s[:2])
n2 = int(s[2:])
if 1 <= n1 <= 12 and 1 <= n2 <= 12:
  print("AMBIGUOUS")
elif (n1 > 12 or n1 == 0) and 1 <= n2 <= 12:
  print("YYMM")
elif (n2 > 12 or n2 == 0) and 1 <= n1 <= 12:
  print("MMYY")
else:
  print("NA")


Measured memory_bytes: 8980
use std::io::BufRead;

fn main() {
    let handle = std::io::stdin();
    let mut buf = String::new();
    handle.lock().read_line(&mut buf).ok();
    let mut v1: Vec<usize> = buf.split_whitespace()
        .map(|a| a.parse::<usize>().ok().unwrap()).collect();
    v1.sort();
    let max = v1.pop().unwrap();
    println!("{}", max * 10 + v1[0] + v1[1]);
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;


int main() {
    u32 n;
    cin >> n;
    vector<int> v(n);
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        sum += v[i];
    }
    int ans1 = INF;
    for (int x = -100; x <= 100; ++x) {
        int ans = 0;
        for (int i = 0; i < n; ++i) {
            ans += (v[i] - x) * (v[i] - x);
        }
        ans1 = min(ans, ans1);
    }
    cout << ans1 << "\n";
    return 0;
}


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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

vector<PII> g[100010];
signed main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, m, s, t;
  cin >> n >> m >> s >> t;
  s--, t--;
  REP(i, m) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    a--, b--, c--;
    g[a].PB({b, d});
    g[b].PB({a, d});
    g[a].PB({c, d});
    g[c].PB({a, d});
    g[b].PB({c, d});
    g[c].PB({b, d});
  }

  VI d(n);
  auto dijkstra = [&](int s) {
    d.assign(n, LLINF);
    d[s] = 0;
    priority_queue<PII, vector<PII>, greater<PII>> que;
    que.push(PII{d[s], s});

    while(que.size()) {
      PII p = que.top(); que.pop();
      int v = p.second;
      if(d[v] < p.first) continue;
      for(PII &e: g[v]) {
        if(d[e.first] > d[v] + e.second) {
          d[e.first] = d[v] + e.second;
          que.push(PII{d[e.first], e.first});
        }
      }
    }
  };
  dijkstra(s);
  cout << d[t] << endl;

  return 0;
}



Measured memory_bytes: 23664
#AtCorder Beginner Context 086 C Traveling
import sys

n = int(input())
t = []
x = []
y = []

t.append(0)
x.append(0)
y.append(0)

for i in range(n):
    a, b, c = map(int,input().split())
    t.append(a)
    x.append(b)
    y.append(c)
    
for i in range(n):
    if t[i+1]-t[i] < (x[i+1] + y[i+1]) -(x[i] + y[i]) or (t[i+1]-t[i]-((x[i+1] + y[i+1]) -(x[i] + y[i])))%2 == 1:
        print("No")
        sys.exit()

print("Yes")




Measured memory_bytes: 11736
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h1, s1 , h2, s2;
	cin >> h1 >> s1 >> h2 >> s2;
	for(int i =1 ; ;i++)
	{
		if(h1<=0 || h2<=0)
		{
			break;
		}
		if(i%2==1)
		{
			h2-=s1;
		}
		else
		{
			h1-=s2;
		}
	}
	if(h2<=0)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
}


Measured memory_bytes: 3632
s = input()
abc = [chr(i) for i in range(ord('a'), ord('z')+1)]

if len(s) == 26:
  for i in range(24, -1, -1):
    cand = list(s[i+1:])
    cand.sort()
    for c in cand:
      if ord(c) > ord(s[i]):
        print(s[:i] + c)
        exit()
  print(-1)
else:
  for l in abc:
    if l not in s:
      print(s + l)
      exit()

Measured memory_bytes: 3064