akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;

const int INF = 1e9;

int go(string s, char c) {
	int w = 0,ct=0;
	for(int i = 0; i < s.size(); ++i) {
		if(s[i] != c) ++w;
		if(s[i] == c) ++ct;
		if(i+1 < s.size() && s[i+1]==c)
			s[i] = c;
	}
	if(ct==0) return INF;
	s.pop_back();
	// cout << s << endl;
	if(w==0) return 0;
		return 1+go(s,c);
}

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	string s;
	cin >> s;
	int k = INF;
	for(char c = 'a'; c <= 'z'; ++c) {
		// cout << c << " : " << go(s,c) << endl;
		k = min(k,go(s,c));
		// cout << "---\n";
	}
	cout << k << "\n";
	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 A = sc.nextInt();
        int B = sc.nextInt();
        if (B % A == 0) {
            System.out.println(A + B);
        } else {
            System.out.println(B - A);
        }
        sc.close();
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
using namespace std::chrono; 
#define ll long long
#define fo(i,v,e) for(v=i;v<e;v++)
#define rfo(i,v,e) for(v=i;v>e;v--)
#define pb(x) push_back(x)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fi first 
#define se second
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vl vector<ll>
#define sz(x) (int)x.size()
#define ull unsigned long long
#define vvi vector<vi>
#define vvl vector<vl>
#define vpi vector<pii>
#define vpl vector<pll>
ll mod = 1000000007;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x);
#else
#define deb(x...)
#endif
#define PI 3.14159265358979323846
void init()
{
}

void solve()
{
    ll n,m,i,j,x,y;cin>>n>>m;
    vvl adj(n,vl());
    vector<bool>vis(n,false);
    vl parent(n,-1);
    queue<ll>q;q.push(0);
    fo(0,i,m)
    {
        cin>>x>>y;x--;y--;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    vis[0] = true;
    while(!q.empty())
    {
        ll temp = q.front();
        q.pop();
        for(auto x:adj[temp])
        {
            if(x!=parent[temp] and !vis[x])
            {
                parent[x] = temp;
                vis[x] = true;
                q.push(x);
            }
        }
    }
    fo(0,i,n)
    {
        if(!vis[i])
        {
            cout<<"No"<<endl;return;
        }
    }
    cout<<"Yes"<<endl;
    fo(1,i,n)
    {
        cout<<parent[i]+1<<endl;
    }
}
int main()
{
    init();
    #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    #endif
    auto start = high_resolution_clock::now(); 
    int T = 1;
    // cin>>T;
    while(T--)
    {
        solve();
    }
    auto stop = high_resolution_clock::now(); 
    auto duration = duration_cast<milliseconds>(stop - start); 
    #ifndef ONLINE_JUDGE
    // cout << "time taken : "<<duration.count()<<" ms" << endl;
     #endif
}


Measured memory_bytes: 12912
use std::io::Read;


fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut it = buf.split_whitespace();
    let x: i32 = it.next().unwrap().parse().unwrap();
    
    let mut ans = 1;
    for b in 2..x {
        let mut p = 2;
        loop {
            let tmp = b.pow(p);
            if tmp>x {
                break;
            }
            ans = std::cmp::max(ans, b.pow(p));
            p += 1;
        }
    }


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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int n;
  cin>>n;
  if(n<1200){
    cout<<"ABC"<<endl;
  }
  else if(n<2800){
    cout<<"ARC"<<endl;
  }
  else{
    cout<<"AGC"<<endl;
  }
}


Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	h,w,n = readline() |> split |> parseMap
	e = Tuple{Int,Int}[(0,9) for i in 1:n]
	for i in 1:n
		a,b = readline() |> split |> parseMap
		e[i] = (a,b)
	end
	s = Set(e)
	ans = zeros(Int,9)
	for i in 1:n
		for j in 0:2
			for k in 0:2
				c = 0
				sx = e[i][1]-j
				sy = e[i][2]-k
				if 1<=sx<=h-2 && 1<=sy<=w-2
					for p in 0:2
						for q in 0:2
							if (sx+p,sy+q) in s
								c += 1
							end
						end
					end
					ans[c] += 1
				end
			end
		end
	end
	for i in 1:9
		ans[i]=div(ans[i],i)
	end
	println((h-2)*(w-2)-sum(ans))
	for i in 1:9
		println(ans[i])
	end
end

main()

Measured memory_bytes: 161868
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define TRUE 1
#define FALSE 0
int isprime(int);

int main(){
  int i,n,count=0,*data;
  scanf("%d",&n);
  data=(int *)malloc(n*sizeof(data));
  for(i=0;i<n;i++){
    scanf("%d",&data[i]);
  }
  
  for(i=0;i<n;i++){
    if(isprime(data[i])==TRUE){
      count++;
    }
  }
  printf("%d\n",count);
  return 0;
}

int isprime(int x){
  int i=3;
  if(x==2){
    return TRUE;
  }

  if(x<2||(x%2==0)){
    return FALSE;
  }

  while(i<=sqrt(x)){
    if(x%i==0){
      return FALSE;
    }
    i=i+2;
  }
  return TRUE;
}



Measured memory_bytes: 2140
#include<cstdio>
#include<algorithm>
using namespace std;
inline int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
    while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+c-'0';c=getchar();}
    return x*f;
}
int p[12],c[12],d,g,ans=1e9;
bool vis[12];
void find(){
	int sum=0,anss=0;
	for(int i=1;i<=d;i++){
		if(vis[i]){
			sum+=p[i]*i*100+c[i];
			anss+=p[i];
		}
	}
	if(sum>=g){
		if(anss<ans){
			ans=anss;	
		}
		return;
	}
	for(int i=d;i>=1;i--){
		if(vis[i]) continue;
		int tmp=p[i];
		while(tmp>1){
			sum+=100*i;
			anss++;
			if(sum>=g){
				if(anss<ans){
					ans=anss;
				}
				return;
			}
			tmp--;
		}
	}
}
void dfs(int t){
	if(t==d+1){
		find();
		return;
	}
	vis[t]=1,dfs(t+1);
	vis[t]=0,dfs(t+1);
}
int main(){
	int i;
	d=read();
	g=read();
	for(i=1;i<=d;i++){
		p[i]=read();
		c[i]=read();
	}
	dfs(1);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());;
        var A = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        var now = A[0];
        var ans = 0L;

        for (int i = 1; i < N; i++)
        {
            if (A[i] < now)
                ans += now - A[i];
            else
                now = A[i];
        }

        WriteLine(ans);
    }
}


Measured memory_bytes: 46864
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

const ll INF = 1LL<<60;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m, l;
    cin >> n >> m >> l;
    vvll d(n, vll(n, INF));
    rep(i, n) d[i][i] = 0;
    rep(i, m) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        d[a][b] = c;
        d[b][a] = c;
    }
    rep(k, n) rep(i, n) rep(j, n) chmin(d[i][j], d[i][k] + d[k][j]);

    vvll e(n, vll(n, INF));
    rep(i, n) {
        rep(j, n) {
            if (d[i][j] <= l) e[i][j] = 1;
            if (i == j) e[i][j] = 0;
        }
    }
    rep(k, n) rep(i, n) rep(j, n) chmin(e[i][j], e[i][k] + e[k][j]);

    int q;
    cin >> q;
    while (q--) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        cout << (e[s][t] >= INF ? -1 : e[s][t] - 1) << endl;
    }
}

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

int main() {
    int A, B, C; cin >> A >> B >> C;
    if(A == B && A != C) cout << "Yes\n";
    else if(A == C && A != B) cout << "Yes\n";
    else if(B == C && A != B) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int n; cin>>n;
	int m=0;
	int ans=0;
	rep(i,0,n){
		int a; cin>>a;
		if(m<=a)ans++;
		chmax(m,a);
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3636
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
//#define int long long
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,pii> piii;
typedef pair<ll,ll> pll;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

ll d[512][512],INF=5e15,d2[512][512], dx[]={1,0,-1,0},dy[]={0,1,0,-1},dd[512][512];

main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  //  cout<<sizeof(ll)<<endl;
  int i,j,k,n,m,sx,sy,gx,gy;
  cin>>m>>n;
  vector<string> mp(n);
  rep(i,n)
    cin>>mp[i];
  fill(d[0],d[0]+512*512,INF);
  fill(d2[0],d2[0]+512*512,INF);
  queue<pii> que,que2;
  rep(i,n)rep(j,m){
    if(mp[i][j]=='s'){
      sx=j;
      sy=i;
    }else if(mp[i][j]=='g'){
      gx=j;
      gy=i;
      que.push(pii(j,i));
      d[i][j]=0;
    }else if(mp[i][j]=='*'){
      que2.push(pii(j,i));
      d2[i][j]=0;
    }
  }
  while(!que.empty()){
    pii p=que.front();que.pop();
    rep(i,4){
      int x=p.X+dx[i],y=p.Y+dy[i];
      if(mp[y][x]!='#' && mp[y][x]!='*' && d[y][x]>d[p.Y][p.X]+1){
	d[y][x]=d[p.Y][p.X]+1;
	que.push(pii(x,y));
      }
    }
  }
  while(!que2.empty()){
    pii p=que2.front();que2.pop();
    rep(i,4){
      int x=p.X+dx[i],y=p.Y+dy[i];
      if(mp[y][x]!='#' && d2[y][x]>d2[p.Y][p.X]+1){
	d2[y][x]=d2[p.Y][p.X]+1;
	que2.push(pii(x,y));
      }
    }
  }
  //  rep(i,n){rep(j,m)cout<<d[i][j]<<",";cout<<endl;}cout<<endl;
  //  rep(i,n){rep(j,m)cout<<d2[i][j]<<",";cout<<endl;}
  priority_queue<piii> q;
  ll a=0,b=0,nn=0;
  rep(i,n)rep(j,m){
    if(mp[i][j]!='#' && mp[i][j]!='*' && mp[i][j]!='g'){
      q.push(piii(d[i][j]-d2[i][j],pii(j,i)));
      b+=d[i][j];
      nn++;
    }
  }
  //    cout<<b<<","<<nn<<":"<<1.*b/(nn-a)<<endl;
  //cout<<d[sy][sx]*(1-dd[sy][sx])+(d2[sy][sx]+1.*b/(nn-a))*dd[sy][sx]<<endl;
  while(!q.empty()){
    piii tmp=q.top();q.pop();
    if(nn-a==1)break;
    if(tmp.X<1.*(b)/(nn-a))
      break;
    //cout<<tmp.Y<<tmp.X+d2[tmp.Y.Y][tmp.Y.X]<<"->";
    pii p=tmp.Y;
    b-=tmp.X;
    ++a;
    dd[p.Y][p.X]=1;
    //    cout<<1.*b/(nn-1)+d2[tmp.Y.Y][tmp.Y.X]<<endl;
    //cout<<a<<","<<b<<endl;
  }
  cout<<d[sy][sx]*(1-dd[sy][sx])+(d2[sy][sx]+1.*b/(nn-a))*dd[sy][sx]<<endl;
  return 0;
}

Measured memory_bytes: 11500
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
int a[n];
int sum=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
}
sort(a,a+n);
ll k=sum/(4*m);
if(sum%(4*m)!=0)
{
k++;
}
for(int i=n-1;i>=0;i--)
{
if(a[i]>=k)
{
m--;
}
else
{
break;
}
}
cout<<((m>0) ? "No" : "Yes");
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
//#include <intrin.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf 2000000000
#define MOD (ll)1e15
#define __builtin_popcount(x) __popcnt(x)

using namespace std;

typedef long long ll;
typedef pair<int, int> pr;
typedef pair<pair<int, int>, int> tup;

inline void solve()
{
	char a;
	cin >> a;
	cout << (char)(++a);
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.io.*;
public class Main{
	public static void main(String [] args){
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in),1200);
		String work = "";
		String input = "";
		
		try{
			input = r.readLine();
			while(input != null){
				work += input;
				input = r.readLine();
			}
		}catch(Exception e){
			System.out.println(e);
		}
		work = work.toLowerCase();
		int code;
		int count[] = new int[26];
		for(int i = 0; i < work.length(); i++){
			code = ((int)work.charAt(i)) - 97;
			if(!(0 <= code && code <= 25)){
				continue;
			}
			count[code]++;
		}
		for(int i = 0; i < count.length; i++){
			
			System.out.printf("%c : %d\n",i+97,count[i]);
		}
	}
}

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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

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

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

const lli MOD = 1000000007LL;

lli modpow(lli a, lli n){
    lli res = 1;

    for(lli ai = a; n; n>>=1){
        if(1&n) res = (res*ai)%MOD;
        ai=(ai*ai)%MOD;
    }
    return res;
}

lli inv(lli n){
    return modpow(n, MOD-2);
}

lli modperm(lli n, lli k){
    lli res = 1;
    rep(i, k){
        res = (res*(n-i))%MOD;
    }
    return res;
}

lli modcomb(lli n, lli k){
    return (modperm(n, k)*inv(modperm(k, k)))%MOD;
}

lli posmod(lli n){
    lli res = n;
    res %= MOD;
    if(res < 0) res += MOD;
    return res;
}
lli x, c, res;
double r;

int main(void){
    cin >> x;
    c = 100;
    r = 1.01;
    res = 0;
    while(c < x){
        c = c*r;
        res++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<set>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<cctype>
using namespace std;

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

typedef long long ll;

string s;

void solve(){
  int n = s.length();
  int ans = 0;

  for(int i=0;i<=(n-1)/2;i++){
    if(s[i] == 'w' && s[n-i-1] != 'w' ||
       s[i] == 'i' && s[n-i-1] != 'i' || 
       s[i] == '(' && s[n-i-1] != ')' ||
       s[i] == ')' && s[n-i-1] != '('){
      ans++;
    }
  }

  cout<<ans<<endl;
}

int main(){
  while(cin>>s){
    solve();
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 n;
  cin >> n;
  vector<i64> ans(n);
  for (i64 i = 0; i < n; i++)
  {
    i64 a;
    cin >> a;
    ans[a - 1] = i + 1;
  }
  for (i64 i = 0; i < n; i++)
    cout << ans[i] << (i + 1 == n ? "\n" : " ");
  return 0;
}


Measured memory_bytes: 1536
#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	int h,hm=0,i,ans=0;
	for(i=1;i<=n;i++){
		cin >> h;
		if(h>=hm){
			ans++;
			hm = h;
		}
	}
	cout << ans << endl;
	return 0;
}

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

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

    long long cnt = 0;
    for (int i = 0; i < N; i++) {
        if (a[i] < b[i]) {
            cnt += (b[i] - a[i]) / 2;
        } else {
            cnt -= a[i] - b[i];
        }
    }
    cout << (cnt >= 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,i;
    double x,ans,y;
    string u;
    cin >> N;
    x=0;
    ans=0;
    y=0;
    for (i=0;i<N;i++){
        cin >> x >> u;
        if (u=="JPY") ans+=x;
        else {
            y=x*380000.0;
            ans+=y;
        }
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int L,R,min = 2019;
	scanf("%d%d",&L,&R);
	if((R-L)>=2019){
		printf("0\n");
		return 0;
	}
	L%=2019;
	R%=2019;
	if(L>=R){
		R += 2019;
	}
	for(int i=L; i<R; i++){
		for(int j=i+1; j<=R; j++){
			if((i*j)%2019 <= min){
				min = (i*j)%2019;
			}
			if(min == 0){
				printf("0\n");
				return 0;
			}
		}
	}
	printf("%d\n",min);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <iomanip>

using namespace std;

int main(void){
    int n;
    cin >> n;
    double out = 0;
    for(int i = 0; i < n ; i++){
        double x;
        string u;
        cin >> x >> u ;
        if(u == "JPY"){
            out += x;
        }else{
            out = out + x*(380000.0);
        }

    }
        cout << setprecision(7) << out << endl;
}

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

//諸機能
#pragma region MACRO 
#define putans(x)  cerr << "answer: " ; cout << (x) << endl
#define dputans(x) cerr << "answer: "; cout << setprecision(10) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define substr(s,i,l) string((s), (i), (l))
#define tos(x) (to_string((x)))
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define put ifs >>
#else //いい感じにやる
#define put cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#ifndef _DEBUG
#define dbg1 {}
#define dbg2 {}
#define dbg3 {}
#define dbgArray {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(1e9)
#pragma endregion

set<string> sss;

int f(string s){
	dbg(s);
	if (sss.find(s) != sss.end())return 0;
	if (s.size() == 1) {
		sss.insert(s);
		return stoi(s);
	}
	int sum = stoi(s);
	sss.insert(s);
	REP(i,1, s.size()) {
		string s1 = substr(s,0,i);
		string s2 = substr(s,i ,s.size() - i);
		sum += f(s1) + f(s2);
	}
	return sum;
}

int main() {
	string s; put s;
	int c = s.size() - 1;
	int n = 1 << c;
	ll sum = 0;
	rep(i, n) {
		dbg(i);
		string sm = substr(s,0,1);
		int k = 1 << c - 1;
		for (int j = 1 ; j < c + 1 ;  j++) {
			dbg(j);
			dbg(i & k);
			if ((i & k) == 0) {
				sm += substr(s, j, 1);
			}
			else {
				sum += stoll(sm);
				sm = substr(s,j,1);
			}
			dbg(sm);
			k /= 2;
		}
		if (sm != "") {
			sum += stoll(sm);
			sm = "";
		}
	}
	putans(sum);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
   int N,D,i,j,X,s=0,A[100];
   scanf("%d%d%d",&N,&D,&X);
   for(i=0;i<N;i++){
      scanf("%d",&A[i]);
      
      }
   for(i=0;i<N;i++){
      for(j=1;j<=D;j+=A[i]){
     	s++;
   }}
   printf("%d\n",s+X);
   return 0;
}


Measured memory_bytes: 128
// :'(((((((((((((
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define M 1000000007LL
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define mp make_pair
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pii pair<ll,ll> 
#define mod 1000000007LL
#define MAXN 300002
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
vector<string>v;
ll dp[3002][3003];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll i; 
    dp[0][1]=(s[0]=='>');
    dp[0][2]=1;          
    for(i=1;i<sz(s);i++){
      for(ll j=1;j<=i+2;j++){
        dp[i][j]=dp[i][j-1];
        if(s[i]=='<') 
          dp[i][j]=(dp[i][j]+dp[i-1][j-1])%mod;
        else
          dp[i][j]=(((dp[i][j]+dp[i-1][i+1])%mod-dp[i-1][j-1])%mod+mod)%mod;
      }
    }
    cout<<dp[sz(s)-1][sz(s)+1];
    return 0;
}

Measured memory_bytes: 68992
#include<bits/stdc++.h>
using namespace std;
int a[200005];
long long sum1;
int main()
{
	int n;cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum1=sum1^a[i];
	}
	for(int i=1;i<=n;i++)
	{
		cout<<(sum1^a[i])<<' ';
	}
}

Measured memory_bytes: 4316
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include<iostream>
#include<cmath>
#include<math.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
const double PI=M_PI;
signed main(){
    ll n,m;cin>>n>>m;
    vector<ll>sz(n,1);
    vector<ll>now(n);
    now[0]=1;
    rep(i,m){
        ll x,y;cin>>x>>y;
        x--;y--;
        if(now[x]>0){
            now[y]=sz[y]+1;
            now[x]--;
        }
        sz[x]--;
        sz[y]++;
        if(now[y]>0){
            now[y]=sz[y];
        }
    }
    ll ans=0;
    rep(i,n){
        if(now[i]>0)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
// header {{{
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <utility>
#include <string>
#include <sstream>
#include <queue>
#include <map>
#include <list>
#include <stack>
#include <tuple>
#include <cstdio>
#include <cmath>
using namespace std;

#define ALPHABET    26
#define EPS         (1e-10)
#define EQ(a, b)    (abs((a)-(b)) < EPS)
#define INF         1000000005

typedef long long ll;
typedef unsigned long long ull;
// }}}

int main() {
    string words[] = {"dreamer", "dream", "eraser", "erase"};

    string s;cin >> s;

    int n = s.size();
    vector<bool> dp(n+1, false);
    dp[0] = true;

    for(int i=0;i<n;i++){
        if(dp[i]){
            for(auto w : words){
                if(i+w.size() < n+1){
                    if(s.compare(i, w.size(), w) == 0){
                        dp[i+w.size()] = true;
                    }
                }
            }
        }
    }

    cout << (dp[n] ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
int main(){
   double a,b,c,d;
   cin>>a>>b>>c>>d;
   if(ceil(c/b)<=ceil(a/d))cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
}


Measured memory_bytes: 3712
while True:
        H, W = map(int, input().split())
 
        if H == 0 | W == 0:
                break
 
        countW, countH = 0, 0
 
        while True:
                if countH == H:
                        break
                while True:
                        if countW == W:
                                print('\n',end='')
                                countW = 0
                                break
                        print('#',end='')
                        countW += 1
                countH += 1
        print()

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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll a, b, k;
  cin >> a >> b >> k;

  for (int i = a; i <= min(b, a + k - 1); i++) {
    cout << i << "\n";
  }
  for (int i = max(b - k + 1, a + k); i <= b; i++) {
    cout << i << "\n";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string o,e;
    cin>>o>>e;
    int n,m;
    n=o.size();
    m=e.size();
    for(int i=0;i<m;i++){
      cout<<o[i]<<e[i];
    }
    if(n-m==1){
      cout<<o[n-1];
    }
  return 0;
}


Measured memory_bytes: 256
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [A, B, C] = input[0].map(Number);

  return Math.max(A, B, C) * 9 + A + B + C;
};

console.log(main(read()));


Measured memory_bytes: 29656
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

int dy[4] = {-1,0,1,0};
int dx[4] = {0,-1,0,1};
int w,h;
int a[31][31];
int c[4];
int dis[31][31][4];

int new_dir(int com, int dir) {
  if (com == 0) return dir;
  if (com == 1) return (dir+3)%4;
  if (com == 2) return (dir+2)%4;
  if (com == 3) return (dir+1)%4;
  return -1;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  while (cin >> w >> h, w) {
    REP(i,h) REP(j,w) cin >> a[i][j];
    REP(i,4) cin >> c[i];
    MINF(dis);
    dis[0][0][3] = 0;
    using P = tuple<int,int,int,int>;
    priority_queue<P,vector<P>,greater<P>> que;
    que.emplace(0,0,0,3);
    while (!que.empty()) {
      int dd,y,x,dir;
      tie(dd,y,x,dir) = que.top(); que.pop();
      if (dis[y][x][dir] < dd) continue;
      int ndir = new_dir(a[y][x],dir);
      if (ndir >= 0) {
        int ny = y+dy[ndir];
        int nx = x+dx[ndir];
        if (IN(ny,0,h-1) && IN(nx,0,w-1)) {
          if (CHMIN(dis[ny][nx][ndir],dis[y][x][dir])) {
            que.emplace(dis[ny][nx][ndir],ny,nx,ndir);
          }
        }
      } else {
        if (y == h-1 && x == w-1) break;
      }
      for (int i = 0; i < 4; i++) if (i != a[y][x]) {
        int ndir = new_dir(i,dir);
        int ny = y+dy[ndir];
        int nx = x+dx[ndir];
        if (IN(ny,0,h-1) && IN(nx,0,w-1)) {
          if (CHMIN(dis[ny][nx][ndir],dis[y][x][dir]+c[i])) {
            que.emplace(dis[ny][nx][ndir],ny,nx,ndir);
          }
        }
      }
    }
    int ans = INF;
    REP(i,4) CHMIN(ans,dis[h-1][w-1][i]);
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3292
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int sum=0;
        int max=0;
        for(int a=0;a<N;a++){
            int price = sc.nextInt();
            if(max<price) max = price;
            sum+=price;
        }
        sum = sum-(max/2);
        System.out.println(sum);
    }
}


Measured memory_bytes: 22356
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

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

	vector<int> A(N);

	for (int &a : A) {
		cin >> a;
	}
	
	int a_max, a_min,idx_max,idx_min;

	idx_max = idx_min = 0;
	a_max = a_min = A[0];
	for (int i = 1; i < N; i++) {
		if (a_max < A[i]) {
			idx_max = i;
			a_max = A[i];
		}
		if (a_min > A[i]) {
			idx_min = i;
			a_min = A[i];
		}
	}

	if (a_max == a_min) {
		cout << 0 << endl;
	}
	else {
		cout << 2*N - 2 << endl;
		if (abs(a_max) >= abs(a_min)) {
			for (int i = 0; i < N; i++)
			{
				if (i != idx_max) {
					cout << idx_max + 1 << " " << i+ 1 << endl;
				}
			}
			for (int i = 1; i < N; i++) {
				cout << i << " " << i + 1 << endl;
			}
		}
		else {
			for (int i = 0; i < N; i++)
			{
				if (i != idx_min) {
					cout << idx_min + 1 << " " << i + 1 << endl;
				}
			}
			for (int i = N; i > 1; i--) {
				cout << i << " " << i - 1 << endl;
			}
		}
	}


	return 0;
}

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

int main()
{
    int h, w;
    cin >> h >> w;
    char c[200];
    rep(i, h)
    {
        scanf("%s", c);
        printf("%s\n%s\n", c, c);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
#define INF 1<<30

int main()
{
    string S;
    cin >> S;
    int L = S.size();
    REP(i,L)cout << "x";
    cout << endl;
    return 0;
}

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

#define SIZE 1000

using namespace std;

double mean(int, double []);
double stdDev(int, double []);

int main(void){
	int n;
	double point[SIZE], stdD;
	while (cin >> n) {
		if (n == 0) break;
		for (int i = 0; i < n; i++) {
			cin >> point[i];
		}
		stdD = stdDev(n, point);
		cout << fixed << setprecision(8);
		cout << stdD << "\n";
	}

	return 0;
}

double mean(int n, double p[]) {
	double sum =0.0;
	for (int i = 0; i < n; i++) {
		sum += p[i];
	}
	return sum / (double)n;
}

double stdDev(int n, double p[]) {
	double mean_ = mean(n, p);
	double stdD = 0.0;
	for (int i = 0; i < n; i++) {
		stdD += pow(p[i] - mean_, 2);
	}
	return sqrt(stdD / (double)n);
}

Measured memory_bytes: 3264
n = int(input())
x_str = input().split()
xs = [int(c) for c in x_str]

center = (len(xs) - 1)//2

c_xs = xs[:]
c_xs.sort()

if c_xs[center] == c_xs[center+1]:
    for x in xs:
        print(c_xs[center])
else:
    for x in xs:
        if x <= c_xs[center]:
            print(c_xs[center+1])
        else:
            print(c_xs[center])


Measured memory_bytes: 29496
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, K, A):
    for i in range(K, N):
        print('Yes' if A[i] > A[i - K] else 'No')

if __name__ == '__main__':
    input = sys.stdin.readline
    N, K = map(int, input().split())
    *A, = map(int, input().split())
    main(N, K, A)


Measured memory_bytes: 105252
//#include"cpp_kyopro.h"
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include<stdio.h>

using namespace std;

int main(void){
	int n; cin >> n;
	cout << n * n * n;
	return 0;
}



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

int main(){
  stack<int> a;
  int n;

  while(cin >> n){
    if(n != 0){
      a.push(n);
    }
    else if(a.size() == 0){
      int div = 9 / 10;
      cout << 10 / div << endl;
    }
    else{
      cout << a.top() << endl;
      a.pop();
    }
  }
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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 const INF = 1001001001;


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

int N;
cin >> N;
string S;
cin >> S;

vi W(N,0),E(N,0);
rep(i,N) {
    if(S[i] == 'E') E[i] = 1;
    else W[i] = 1;
}

vi Ws(N+1,0),Es(N+1,0);
rep(i,N) {
    Ws[i+1] = Ws[i] + W[i];
    Es[i+1] = Es[i] + E[i];
}

int ans = INF;
rep(i,N) {
    int cur = Ws[i] + Es[N] - Es[i+1];
    ans = min(ans, cur);
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 5396
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <string.h>
#include <vector>
#include <deque>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

typedef int64_t int64;
typedef int64_t ll;

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

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

using namespace std;


class D {
	int n;
	vector<int> a;

public:
	D()
	{
		cin >> n;

		a.resize(n);
		REP(i, n)
			cin >> a[i];

	}

	void solve()
	{
		ll ans{ 0 };
		int right{ 1 };
		ll sum{ a[0] };

		for (int left{ 0 }; left < n; left++)
		{
			while (right < n && !(a[right] & sum))
			{
				sum += a[right];
				++right;
			}

			ans += ((ll)right - left);
			sum -= a[left];
		}

		cout << ans << endl;

	}
};


int main()
{
	D solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define MAXN 200005
#define REP(temp, init_val, end_val) for (int temp = init_val; temp <= end_val; ++temp)
#define REPR(temp, init_val, end_val) for (int temp = init_val; temp >= end_val; --temp)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> intpair;
int read(){
    int f = 1, x = 0;
    char c = getchar();
    while (c < '0' || c > '9'){if(c == '-') f = -f; c = getchar();}
    while (c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar();
    return f * x; 
}
inline int lowbit(int x){
    return x & (-x);
}
inline int modadd(int x, int y){
    return (x + y >= MOD ? x + y - MOD: x + y);
}
inline int sgn(int x){
    return (x < 0 ? -1: (x > 0 ? 1: 0));
}
template<typename T>
T gcd(T a, T b){
    return (!b) ? a: gcd(b, a % b);
}
int poww(int a, int b){
    int res = 1;
    while (b > 0){
        if (b & 1) res = 1ll * res * a % MOD;
        a = 1ll * a * a % MOD, b >>= 1;
    }
    return res;
}
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
const int ddx[] = {-1, -1, -1, 0, 0, 1, 1, 1}, ddy[] = {-1, 0, 1, -1, 1, -1, 0, 1};

/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/

ll a, b, c, d;
void init(){
    a = read(), b = read(), c = read(), d = read();
}
void solve(){
    ll ans = LLONG_MIN;
    ans = max(ans, a * c);
    ans = max(ans, a * d);
    ans = max(ans, b * c);
    ans = max(ans, b * d);
    printf("%lld\n", ans);
}
int main(){
    int T = 1;
    while (T--){
        init();
        solve();
    }
    return 0;
}

Measured memory_bytes: 3760
#include <iostream>
using namespace std;
int main(void){
    
    //変数の宣言
    int x, y;
    
    //繰り返し処理をするときは「　for文　」を使う
    for(int i=1; i<=10000; i++){
        //各Caseの値を入力
        cin >> x >> y;
        
        //if文を使用してxの値とyの値が「 0 」なら終了の条件を考える
        if(x == 0 && y == 0){
            break;  
        }
        
        //else if： ifを満たしてない・成立してない条件下で条件を考える 
        else if(x > y){
            swap(x, y);
        }
        
        //答えを出力する
        cout << x << " " << y << endl;
    }
    
    return 0;
    
}




/****************************************複数の条件式****************************************************
 
 
かつ・AND　➡　&&  ➡　　両方の条件が成立するときのみ成立の所へ行ける
またわ・OR　➡　||　➡　片方の条件が成立する　又は　　両方の条件が成立する　ときは成立の場所へ行ける
         
     
*********************************************************************************************************/




/****************************************　breakとは　***************************************************


☆繰り返し処理を終了・出処理から出たいときに使用

    
*********************************************************************************************************/



/****************************************　swapとは　***************************************************


☆s数字を入れ替える
    swap(a,b) ➡　a と  b の　値を入れ替える　
    
    
*********************************************************************************************************/














Measured memory_bytes: 3084
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <fstream>
#include <list>
#include <iomanip>
#include <numeric>
using namespace std;
#define ll long long
#define ull unsigned long long
#define db double
#define REP(i, lim) for(int i=0;i<lim;++i)
#define REPP(i, lim) for(int i=1;i<=lim;++i)
#define DEC(i, lim) for(int i=lim;i>=1;--i)
#define FOR(i,l,r)  for(int i=l;i<r;++i)
#define deBug cout<<"==================================="<<endl;
#define clr(s) memset(s, 0, sizeof(s))
#define lowclr(s) memset(s, -1, sizeof(s))
const int MAXN = 1000055;
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
const db eps = 1e-9;

inline int sgn(db x) { return x<-eps ? -1 : x>eps; }
inline db sqr(db x) { return x*x; }

#define cross(p1, p2, p3) ((p2.x-p1.x)*(p3.y-p1.y)-(p3.x-p1.x)*(p2.y-p1.y))
#define crossOp(p1, p2, p3) sgn(cross(p1, p2, p3))

struct P {
    // information
    P() {}
    P(db _x, db _y) : x(_x), y(_y) {}
    db x, y;
    // operation
    P operator + (P p)   const{ return P(x+p.x, y+p.y); }
    P operator - (P p)   const{ return P(x-p.x, y-p.y); }
    P operator * (db d)  const{ return P(x*d, y*d); }
    P operator / (db d)  const{ return P(x/d, y/d); }
    db dot(P p) { return x * p.x + y * p.y; } // 点积
    db det(P p) { return x * p.y - y + p.x; } // 叉积
    // other
    void input() { scanf("%lf%lf", &x, &y); }
    void print() { printf("(%lf, %lf)\n", x, y); }
    db dis(P p) { return sqrt(sqr(x-p.x) + sqr(y-p.y)); }
    db dis2(P p) { return sqr(dis(p)); }
    db abs() { return sqrt(x*x + y*y); }
    db abs2(){ return x*x + y*y; }
};

P getProj(P a, P b, P p) { return a + (b-a) * ( (b-a).dot(p-a) / a.dis2(b) );}
P getReflect(P a, P b, P p) { return getProj(a, b, p) * 2 - p; }

bool chkLL(P p1, P p2, P q1, P q2) {
    db a1 = cross(q1, q2, p1), a2 = -cross(q1, q2, p2);
    return sgn(a1+a2) != 0;
}
P getLL(P p1, P p2, P q1, P q2) {
    db a1 = cross(q1, q2, p1), a2 = -cross(q1, q2, p2);
    return (p1 * a2 + p2 * a1) / (a1 + a2);
}
bool intersect(db l1, db r1, db l2, db r2) {
    if(l1>r1) swap(l1, r1); if(l2>r2) swap(l2, r2);
    return !( sgn(r1-l2) == -1 || sgn(r2-l1) == -1 );
}
bool chkSS(P p1, P p2, P q1, P q2) {
    return intersect(p1.x, p2.x, q1.x, q2.x) && intersect(p1.y, p2.y, q1.y, q2.y) &&
    crossOp(p1, p2, q1) * crossOp(p1, p2, q2) <= 0 &&
    crossOp(q1, q2, p1) * crossOp(q1, q2, p2) <=0;
}
bool chkSS_strict(P p1, P p2, P q1, P q2) {
    return crossOp(p1, p2, q2) * crossOp(p1, p2, q2) < 0 &&
           crossOp(q1, q2, p1) * crossOp(q1, q2, p2) < 0;
}


int main()
{
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
//    std::ios::sync_with_stdio(false); cin.tie(0);

    int T;
    scanf("%d", &T);
    while(T--)
    {
        P p1, p2, q1, q2;
        p1.input(); p2.input(), q1.input(); q2.input();

        cout<<chkSS(p1, p2, q1, q2)<<endl;

    }
    return 0;
}


Measured memory_bytes: 3300
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        while(true){
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H == 0 && W == 0) break;

            for(int j=0; j<H; j++){
                for(int i=0; i<W; i++) System.out.print("#");
                System.out.println("");
            }
            System.out.println("");
        }
    }
}


Measured memory_bytes: 34592
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define INF 0x3f3f3f3f
#define MOD 1000000007
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	long long N;
	long long takahashi=1,aoki=1,n;
	int T,A;
	cin>>N;
	for(int i=0;i<N;i++){
		long long tempT,tempA;
		cin>>T>>A;
		if(!(takahashi%T))
			tempT=takahashi/T;
		else
			tempT=takahashi/T+1;
		if(!(aoki%A))
			tempA=aoki/A;
		else
			tempA=aoki/A+1;
		n=max(tempT,tempA);
		takahashi=n*T;
		aoki=n*A;
	}
	cout<<takahashi+aoki<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  ll cnt = 0,tmp = n;
  while(1){
    cnt += n%10;
    n/=10;
    if(n==0) break;
  }
  // cout<<cnt<<endl;
  if(tmp % cnt == 0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;


}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

signed main(){
	int n, k;
	cin >> n >> k;

	vector<int> a(n);
	cin >> a;

	int x = 0;
	for (int i = 60; i >= 0; i--) {
		int cnt = 0;
		for(auto a_i : a){
			cnt += (a_i >> i) bitand 1;
		}
		if(n - cnt > cnt and x + (1LL << i) <= k){
			x += 1LL << i;
		}
	}

	int ans = 0;
	for (auto& a_i : a) {
		ans += a_i xor x;
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024