akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.PriorityQueue;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Obj[] arr = new Obj[n];
		PriorityQueue<Obj> que = new PriorityQueue<>();
		String[] sa = br.readLine().split(" ");
		String[] sb = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			Obj o = new Obj();
			o.i = i;
			o.a = Integer.parseInt(sa[i]);
			o.b = Integer.parseInt(sb[i]);
			arr[i] = o;
			que.add(o);
		}
		br.close();

		long ans = 0;
		while (!que.isEmpty()) {
			Obj o = que.poll();
			int sum = arr[(o.i - 1 + n) % n].b + arr[(o.i + 1) % n].b;
			if (o.a % sum == o.b % sum) {
				ans += (o.b - o.a) / sum;
				o.b = o.a;
			} else {
				int ng = o.b / sum + 1;
				int ok = 0;
				while (ng - ok > 1) {
					int mid = (ng + ok) / 2;
					if (o.a <= o.b - sum * mid) {
						ok = mid;
					} else {
						ng = mid;
					}
				}
				if (ok == 0) {
					System.out.println(-1);
					return;
				}
				ans += ok;
				o.b = o.b - sum * ok;
				que.add(o);
			}
		}
		System.out.println(ans);
	}

	static class Obj implements Comparable<Obj> {
		int i, a, b;

		@Override
		public int compareTo(Obj o) {
			return o.b - b;
		}
	}
}


Measured memory_bytes: 98588
V, E = map(int, input().split())
inf = float('inf')
graphs = [[inf for _ in range(V)] for _ in range(V)]


for i in range(E):
    s, t, d = map(int, input().split())
    graphs[s][t] = d
# print(graphs)


dps = [[inf for _ in range(V)] for _ in range(1 << V)]

dps[0][0] = 0

for S in range(1, 1 << V):
    for i in range(V):
        # 両方とも1のやつのみ残る。
        # 1100 と0100(1<<2)だったら0100になる。
        # 訪問済みであることがこれで確認できる。
        if S & (1 << i) == 0:
            continue
        prev_bit = S - (1 << i)
        for j in range(V):
            # print(S, prev_bit, i, j)
            dps[S][i] = min(dps[S][i], dps[prev_bit][j] + graphs[j][i])
# print(dps)
if dps[(1 << V) - 1][0] == inf:
    print(-1)
else:
    print(dps[(1 << V) - 1][0])



Measured memory_bytes: 20072
if __name__ == '__main__':
    n = int(input())
    a = list(input())
    b = list(input())
    c = list(input())
    count = 0
    for i in range(n):
        if a[i] == b[i] == c[i]:
            continue
        elif a[i] == b[i]:
            c[i] = a[i]
            count += 1
        elif a[i] == c[i]:
            b[i] = a[i]
            count += 1
        elif b[i] == c[i]:
            a[i] = b[i]
            count += 1
        else:
            b[i] = a[i]
            c[i] = a[i]
            count += 2
    print(count)

Measured memory_bytes: 3064
#include <stdio.h>

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

  scanf("%d", &n);
  s = 100000;

  for (i = 0; i < n; i++){
    s += s / 20;
    if(s % 1000){
      s = (s / 1000 * 1000) + 1000;
    }
  }

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

  return 0;

}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


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

int main() {

    ll n; cin >> n;
    auto a = divisor(n);

    ll ans1 = LONG_MAX;
    ll ans2 = LONG_MAX;
    rep(i, a.size()) {
        ll tmp = (n/a[i]) + a[i];
        if(ans1 > tmp) {
            ans1 = tmp;
            ans2 = a[i];
        }
    }


    ll ans = (ans2-1) + ((n/ans2)-1);

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 384
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
using namespace std;
using ll = long long;
using ld = long double;
ll mod = ll(1e9)+7;
ll inf = ll(5e18);
template<typename T1, typename T2> ll ceill(T1 a, T2 b){ return (a+b-1)/b; }
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) for (auto vvv : vv) cout << vvv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

using dbg::Debug;
Debug debug;

class AStationAndBus {
public:
	void solve(std::istream& in, std::ostream& out) {
	    string s;
	    in >> s;
	    set<char> ss;
	    for(int i=0; i<s.length(); i++){
	        ss.insert(s[i]);
	    }
	    ans(ss.size() == 2, out);
	}
};


int main() {
	AStationAndBus solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;
template <typename T> using vvec = vector<vector<T>>;

constexpr int64_t mpow(int64_t a, int64_t b, int64_t mod = 1000000007) {
    if (b <= 0) { return 1; } if (b == 1) { return a % mod; } if (b == 2) { return (a * a) % mod; }
    return (max(a * (b & 1), (int64_t)1) * mpow(mpow(a, b / 2, mod), 2, mod)) % mod;
}
constexpr int64_t mdiv(int64_t a, int64_t b, int64_t mod = 1000000007) {
    return (a * mpow(b, mod - 2, mod)) % mod;
}

int main() {
    int k, t; cin >> k >> t;
    priority_queue<array<int, 2>> que;
    for (int i = 0; i < t; ++i) {
        int a; cin >> a;
        que.push({ a, i });
    }

    int ans = 0, p = -1;
    for (int i = 0; i < k; ++i) {
        auto [n, t] = que.top(); que.pop();

        if (t == p && que.size() != 0) {
            auto [a, b] = que.top(); que.pop();
            --a;
            p = b;
            if (a != 0) que.push({ a, b });
        }
        else {
            --n;
            ans += t == p;
            p = t;
        }

        if (n != 0) que.push({ n, t });
    }

    cout << ans << endl;
}



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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;  typedef pair<ll,ll> pii;
typedef vector<int> VI; typedef vector<ll> VL;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, K;
	cin >>n >>K;
	vector<VI> xy(n, VI(2));
	rep(i ,n) cin>>xy[i][0] >>xy[i][1];
	
	VI ys(n);
	rep(i,n) ys[i] = xy[i][1];
	sort(all(ys));
	ys.erase(unique(all(ys)), ys.end());
	int yz=sz(ys);
	sort(all(xy));

	ll ans = (1LL<<62) + (1LL<<61);
	VI hk(n);
	rep(sy, yz) rep2(ey, sy, yz){
		hk.clear();
		rep(i, n){
			if(ys[sy] > xy[i][1] || xy[i][1] > ys[ey]) continue;
			hk.push_back(xy[i][0]);
			//dbg(ys[sy],ys[ey],xy[i][0]);
			if(sz(hk) >=K){
				ll w = (ll)(ys[ey] - ys[sy]) * (hk.back() - hk[sz(hk)-K]);
				ans = min(ans, w);
			}
		}
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct kouzou{
  char name[100];
  int t;
}K;

K Q[LEN];
int head,tail,n;

void enqueue(K x){
  Q[tail] = x;
  tail += 1;
  tail = tail % LEN;
}

K dequeue(){
  K x = Q[head];
  head += 1;
  head = head % LEN;
  return x;
}

int main(void){
  int min(int,int);
  int m = 0,a,i,q;
  K u;
  scanf("%d%d",&n,&q);
  for ( i = 1 ; i <= n ; i++ ){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head = 1;
  tail = n + 1;
  while ( head != tail ){
    u = dequeue();
    a = min(q,u.t);
    u.t -= a;
    m += a;
    if ( u.t > 0 ){
      enqueue(u);
    }
    else{
      printf("%s %d\n",u.name,m);
    }
  }
  return 0;
}

int min(int b, int c ){
  return b < c ? b:c;
}

Measured memory_bytes: 10756
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}



int main(){
    int n, q; cin >> n >> q;
    vector<list<int>> L(n);
    REP(i, q){
        int op; cin >> op;
        int d, x;
        if(!op){
            cin >> d >> x;
            L[d].PB(x);
        }else if(op == 1){
            cin >> d;
            bool first = true;
            for(auto a: L[d]){
                if(!first) cout << " ";
                else first = false;
                cout << a;
            }
            cout << "\n";
        }else{
            cin >> d >> x;
            L[x].splice(L[x].end(), move(L[d]));
        }
    }
    return 0;
}



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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int ans=0;
	for (int i = 105; i <= n; i+=2)
	{
		int now=i,memo[n]={},k=2;
		while (now>1)
		{
			while (now%k==0)
			{
				now/=k;
				++memo[k];
			}
			++k;
		}
		int cnt=1;
		for (int j = 0; j < n; ++j)
		{
			cnt*=memo[j]+1;
		}
		if (cnt==8)
		{
			++ans;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
                                                                                                
  
int main(void){
                                                                                                
   
    long long n, k, a, b, i;

    long long A[100010] = {0};

    long long s = 0;
   
      
    scanf("%lld %lld", &n, &k );

    for( i = 0 ; i < n ; i = i + 1 ){

         scanf("%lld %lld", &a, &b );

         A[a] += b;

         }
   

    for( i = 0 ; i < 100010 ; i = i + 1 ){

         s += A[i];

         if( s >= k ){

             printf("%lld\n", i );

             return 0;

             }

         }


    return 0;
                                                          
}

Measured memory_bytes: 896
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;
using ll = long long;
const int MM = 3005;
ll mod = 998244353, ans;
int n, a[MM], s;
ll dpl[MM], dpr[MM], psl[MM], psr[MM];

void addmod(ll &x, ll y){
    x += y;
    if(x >= mod)
        x -= mod;
}

void go(int l, int r){
    if(l == r){
        if(a[l] == s)
            addmod(ans, 1);
        return;
    }
    int m = (l+r)/2;
//    print(l, m, r);
    for(int j = 0; j < MM; j++)
        dpl[j] = psl[j] = dpr[j] = psr[j] = 0;
    dpl[0] = dpr[0] = 1;
    for(int i = m; i >= l; i--){
        for(int j = 3000; j >= 0; j--){
            if(j >= a[i]){
                addmod(dpl[j], dpl[j-a[i]]);
            }
            addmod(psl[j], dpl[j]);
        }
    }
    for(int i = m+1; i <= r; i++){
        for(int j = 3000; j >= 0; j--){
            if(j >= a[i]){
                addmod(dpr[j], dpr[j-a[i]]);
            }
            addmod(psr[j], dpr[j]);
        }
    }
    for(int i = 0; i <= s; i++){
//        print(i, s-i, psl[i], psr[s-i]);
        ans = (ans + psl[i]*psr[s-i]) % mod;
    }
    go(l, m);
    go(m+1, r);
}

int main(){
    scan(n, s);
    for(int i = 0; i < n; i++){
        scan(a[i]);
    }
    go(0, n-1);
    print(ans);
    
    return 0;
}

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

ll mod = 1e9 + 7;

ll modpow(ll a, ll n){ // a^n 
  ll res = 1;
  while(n > 0){
    if(n & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    n >>= 1;
  }
  return res;
}

ll inv(ll y){
  return modpow(y, mod-2);
}

ll nCr(ll n, ll r){
  ll x = 1, y = 1;
  REP(i, r){
    x = (x * (n - i)) % mod;
    y = (y * (i + 1)) % mod;
  }
  return (x * inv(y)) % mod;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, a, b; cin >> n >> a >> b;
  ll ans = modpow(2, n);
  ans = (ans - 1) % mod >= 0 ? (ans - 1) % mod : mod + (ans - 1) % mod;
  ans = (ans - nCr(n, a)) % mod >= 0 ? (ans - nCr(n, a)) % mod : mod + (ans - nCr(n, a)) % mod;
  ans = (ans - nCr(n, b)) % mod >= 0 ? (ans - nCr(n, b)) % mod : mod + (ans - nCr(n, b)) % mod;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
  
/*------------------------------------------------------------------*/
  
int main(){
    int a, b, c; cin >> a >> b >> c;
    cout << min(b / a, c) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Integer a = sc.nextInt();
		Integer b = sc.nextInt();
		Integer h = sc.nextInt();
		
		System.out.println((a + b) * h / 2);
	}
}


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

using namespace std;

int main(){
	#ifdef EVAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	const int MOD = 1000000007;
	int N, M;
	cin >> N >> M;
	vector <int> v(N);
	vector <bool> broken(N + 1,false);
	for(int i = 0,index; i < M; i++){
		cin >> index;
		broken[index] = true;
	}
	vector <int> dp(N + 1,0);
	if(!broken[1]){
		dp[1] = 1;
	}
	if(!broken[2]){
		dp[2]  = dp[1] + 1;
	}
	for(int i = 3; i <= N; i++){
		if(!broken[i - 1]){
			dp[i] = (dp[i] + dp[i - 1]) % MOD;
		}
		if(!broken[i - 2]){
			dp[i] = (dp[i] + dp[i - 2]) % MOD;
		}
	}
	cout << dp[N];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m=numeric_limits<T>::max()){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


int main() {
  int N; cin >>N;
  ll pa = 0;
  ll res = 0;
  rep(i, N){
    ll a; cin >>a;
    if (a == 0){
      pa = 0; continue;
    }
    res += (pa+a)/2;
    pa = (pa + a) % 2;
  }
  cout <<res <<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <array>
#include <list>
#include <string>
#include <algorithm>
#include <queue>
#include <numeric>
#include <random>
#include <iomanip>
#include <chrono>

using namespace std;


int main() {

	string s;
	cin >> s;

	for (const auto& c : s)
	{
		cout << "x";
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()

li_start = []
li_end = []
for ind,i in enumerate(S):
    if(i=='('):
        li_start.append(ind)
    else:
        if(len(li_start)>0):
            li_start.pop(-1)
        else:
            li_end.append(ind)
print('('*len(li_end)+S+')'*len(li_start))


Measured memory_bytes: 3064
console.log((args=>{
  let [S,T] = args.trim().split('\n');
  const SL = S.length, TL = T.length;
  if ( SL < TL ) return 'UNRESTORABLE';
  REST: for ( let i = SL - TL; i >= 0; i-- ) {
    for ( let j = 0; j < TL; j++ ) {
      if ( S[i+j] !== '?' && S[i+j] !== T[j] ) continue REST;
    }
    return (S.slice(0,i) + T + S.slice(i+TL)).replace(/\?/g,'a');
  }
  return 'UNRESTORABLE';
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 29604
#include <cstring>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;
typedef pair<int, int> ii;

const int INF = 1000000;

int main() {
    int N, e=0, w=0, i;
    int *psum, *ssum;

    string s;

    cin >> N;
    cin >> s;

    psum = new int[N];
    ssum = new int[N];

    memset(psum, 0, sizeof(int)*N);
    memset(ssum, 0, sizeof(int)*N);

    psum[0] = (s[0] == 'W') ? 1: 0;
    ssum[N-1] = (s[N-1] == 'E')? 1:0;

    for (i=1; i<N;i++) psum[i] += psum[i-1] + (s[i] == 'W'?1:0);
    for (i=N-2; i>=0;i--) ssum[i] += ssum[i+1] + (s[i] == 'E'?1:0);

    int min = INF;
    for (i=0;i<N;i++) {
        int left = 0, right = 0;
        if (i > 0) left = psum[i-1];
        if (i < N-1) right = ssum[i+1];
    
        if (min > left + right) {
            min = left + right;
        }

    }

    cout << min<< endl;
    return 0;
}

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

int H, W;
string S[50];

int main() {
    cin >> H >> W;
    rep(i, H) cin >> S[i];

    int ans[50][50];
    rep(i, H)rep(j, W) {
        if (S[i][j] == '#') {
            ans[i][j] = -1;
        } else {
            ans[i][j] = 0;
        }
    }

    // <- ↖︎ ↑ ↗️ -> 
    int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
    int dy[] = {0, 1, -1, 1, -1, 0, 1, -1};

    // 計算
    rep(i, H) {
        rep(j, W) {
            if (ans[i][j] == -1) {
                for (int k = 0; k < 8; k++) {
                    if (i + dy[k] >= 0 &&  i + dy[k] <= (H - 1) &&
                        j + dx[k] >= 0 && j + dx[k] <= (W - 1) && 
                        ans[i + dy[k]][j + dx[k]] != -1) {
                            ans[i + dy[k]][j + dx[k]]++;
                        }
                }
            }
        }
    }

    // 表示
    rep(i, H) {
        rep(j, W) {
            if (ans[i][j] == -1) {
                cout << '#';
            } else {
                cout << ans[i][j];
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int k,a[40],f;
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int x,y;
		cin>>x>>y;
		if(a[x]!=y&&a[x]||n>1&&x==1&&y==0)
		{
			f=1;
		}
		a[x]=y;
	}
	if(f)
	{
		cout<<-1;
		return 0;
	}
	int i=1;
    if(a[1]==0&&n>1)
     cout<<1,i++;
	for(;i<=n;i++)
	 cout<<a[i];
	  
}

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

int main() {
	string str;
	int n;
	cin >> str >> n;
	while (n--) {
		string opr;
		int first_i,last_i;
		cin >> opr >> first_i >> last_i;
		if (opr == "print") {
			cout << str.substr(first_i,last_i-first_i+1) << endl;
		} else if (opr == "replace") {
			string rep;
			cin >> rep;
			str.replace(first_i,last_i-first_i+1,rep);
		} else { // reverse
			reverse(str.begin()+first_i,str.begin()+last_i+1);
		}
	}
}

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

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

		String a = sc.next();

		if (a.equals("AAA") | a.equals("BBB")) {
			System.out.print("No");
		} else {
			System.out.print("Yes");
		}
	}

}


Measured memory_bytes: 21204
#include <cstdio>

typedef long long i64;

const int N = 200000 + 10;

int n, p[N];
i64 a[N], b[N];

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) a[i] = (i64)i * n, b[i] = (n - i + 1LL) * n;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    a[x] += i;
  }
  for (int i = 1; i <= n; ++i) printf("%lld ", a[i]);
  putchar('\n');
  for (int i = 1; i <= n; ++i) printf("%lld ", b[i]);
  putchar('\n');
  return 0;
}


Measured memory_bytes: 896
package main

import (
	"fmt"
)

func main() {
	var N, M int
	fmt.Scanf("%d %d", &N, &M)

	A := make([]int, N)
	var A_all int
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
		A_all = A_all + A[i]
	}

	var count int
	for i := 0; i < N; i++ {
		if A[i]*4*M >= A_all {
			count++
		}
	}

	if count >= M {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1840
mod=10**9+7

n,a,b=map(int,input().split())
res=pow(2,n,mod)
res=(res-1)%mod

ncb=1
for i in range(1,b+1):
	ncb*=(n-i+1)*pow(i,mod-2,mod)
	ncb%=mod
	if i==a:
		nca=ncb
		
print((res-nca-ncb)%mod)

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

using namespace std;

typedef long long ll;

ll l, r;
const int MOD = 1000000007;
bool seen[2][2][2][100];
int cache[2][2][2][100];
//vector<pair<ll, ll>> sols[2][2][2][100];

int dp(bool top, bool bottom, bool same, int bit) {
	if (bit < 0) {
		//if (!same) sols[top][bottom][same][(bit + 100)%100].emplace_back(0, 0);
		return !same;
	}
	if (seen[top][bottom][same][bit]) return cache[top][bottom][same][bit];
	seen[top][bottom][same][bit] = true;
	int &ans = cache[top][bottom][same][bit];
	//auto &v = sols[top][bottom][same][bit];
	ans = 0;

	const ll mask = 1ll<<bit;
	// try 1
	if (!top || (mask & r)) {
		ans += dp(top, bottom && (l & mask), false, bit-1);
		ans %= MOD;

		//for (auto p : sols[top][bottom && (l & mask)][0][(bit+99)%100])
		//	v.emplace_back(p.first | mask, p.second);
	}

	// try 0
	if (!bottom || !(mask & l)) {
		ans += dp(top && !(r & mask), bottom, same, bit-1);
		ans %= MOD;
		//for (auto p : sols[top && !(r & mask)][bottom][same][(bit+99)%100]) {
		//	v.emplace_back(p.first, p.second);
		//}

		if (!same && (!top || (mask & r))) {
			ans += dp(top, bottom, same, bit-1);
			//for (auto p : sols[top][bottom][same][(bit+99)%100]) {
			//	v.emplace_back(p.first, p.second);
			//}
		}
		ans %= MOD;
	}
	return ans;
}

int main() {
	cin >> l >> r;
	cout << dp(true, true, true, 62) << '\n';
	//for (auto p : sols[1][1][1][62]) {
	//	ll x = p.first, y = p.first + p.second, z = p.second;
	//	cout << x << ' ' << y << ' ' << z << '\n';
	//	assert(l <= x && x <= y && y <= r);
	//	assert((y % x) == (y ^ x));
	//}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdio.h>

#define WHITE 0
#define GRAY 1
#define BLACK 2


void dfs();
void visit(int);
int kill,A[101],time,T[101][2];
int me[101][101];
int main(){
  int baby,i,j,yasuna,sonya;
  scanf("%d",&kill);
  for(i=1;i<kill;i++)A[i]=WHITE;
  for(i=1;i<=kill;i++)for(j=0;j<=kill;j++)me[i][j]=0;

  for(i=0;i<kill;i++){
    scanf("%d%d",&yasuna,&sonya);
    for(j=0;j<sonya;j++){
      scanf("%d",&baby);
      me[yasuna][baby]=1;
    }
  }
  dfs(me);
  for(i=1;i<=kill;i++)printf("%d %d %d\n",i,T[i][0],T[i][1]);
}
void dfs(){
  int i;
  for(i=1;i<=kill;i++){
    if(A[i]==WHITE)visit(i);
  }
}
void visit(int u){
  int i,v;
  A[u]=GRAY;
  T[u][0]=++time;
  for(v=1;v<=kill;v++)if(me[u][v]==1)if(A[v]==WHITE)visit(v);
  A[u]=BLACK;
  T[u][1]=++time;
}



Measured memory_bytes: 2112
N = int(input())


lis = [[0,0,0]]

for i in range(N):

    a,b,c = map(int,input().split())

    lis.append( [ a + max( lis[-1][1] , lis[-1][2] ) , b + max( lis[-1][0] , lis[-1][2] ), c + max( lis[-1][0] , lis[-1][1] ) ] )

print (max (lis[-1]))

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using vec_b = vector<bool>;
using vec_str = vector<string>;
using graph = mat;
using edge = pair<ll,ll>;
using wgraph = vector<vector<edge>>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back


vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i*i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            ret.push_back(n/i);
        }
    }
    return ret;
}

ll func(ll x, ll y)
{
    return x*x*x*x + x*x*x*y + x*x*y*y + x*y*y*y + y*y*y*y;
}


int main()
{
    ll X;
    cin >> X;

    auto div = divisor(X);
    sort(ALL(div));
    bool f = false;
    FORR(d,div) {
        ll Y = d, Z = X / d;
        ll l = -200 - Y, r = 200 - Y;
        REP(i,l,r) {
            if(func(i+Y,i) == Z) {
                cout << i+Y << " " << i << endl;
                f = true;
                break;
            }
        }
        if(f) break;
    }


    return 0;
}

/*



*/

Measured memory_bytes: 3608
from sys import stdin
#from collections import deque
N,Q = [int(x) for x in stdin.readline().rstrip().split()]
ans = [0] * (N+1)
node = []
for _ in range(N-1):
    a,b = [int(x) for x in stdin.readline().rstrip().split()]
    node.append((a,b))
for _ in range(Q):
    p,x = [int(x) for x in stdin.readline().rstrip().split()]
    ans[p] += x
    
for i in sorted(node):
    a,b = i
    ans[b] += ans[a]

for j in ans[1:]:
    print(j,end=" ")

Measured memory_bytes: 82816
#include<bits/stdc++.h>
#define fi first
#define se second
#define show(x) cerr<<#x<<"="<<x<<"\n"
typedef long long ll;
using namespace std;
//const ll MOD=(ll)1e9+7;
//const ll inf=(ll)1e14;
const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
int n,m,h,w;
int a[90000];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout<<fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1=freopen("in","r",stdin);
  //stream2=freopen("out","w",stdout);
  if(stream1==NULL)return 0;
  //if(stream2==NULL)return 0;
#endif
  int n;
  while(cin>>n,n){
    for(int i=0;i<90000;i++)a[i]=0;
    for(int i=0;i<n;i++){
      string s,t;cin>>s>>t;
      int start=stoi(s.substr(0,2))*60*60;
      start+=stoi(s.substr(3,2))*60;
      start+=stoi(s.substr(6,2));
      int end=stoi(t.substr(0,2))*60*60;
      end+=stoi(t.substr(3,2))*60;
      end+=stoi(t.substr(6,2));
      a[start]++;
      a[end]--;
      //cerr<<"start="<<start<<" end="<<end<<endl;
    }
    for(int i=1;i<90000;i++)a[i]=a[i-1]+a[i];
    int ans=0;
    for(int i=0;i<90000;i++)ans=max(ans,a[i]);
    cout<<ans<<endl;
  }
#ifdef LOCAL_DEFINE
  cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}







Measured memory_bytes: 3488
#include<bits/stdc++.h>
using namespace std;
int main(){
  char E;
  cin>>E;
  if(E=='A'){
    cout<<'T'<<endl;
  }
  else if(E=='T'){
    cout<<'A'<<endl;
  }
  else if(E=='G'){
    cout<<'C'<<endl;
  }
  else{
    cout<<'G'<<endl;
  }
}

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

int debug = 1;


int main(){
    double x;
    ll y=0;
    double m=100;
    cin >>x;
    while(true){
        if(m >= x){
            break;
        }
        m*=1.01;
        m=floor(m);
        y++;
    }

    cout << y << endl;

    return 0;
}

Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}// char to int
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}//MAX
int lcm(ll a,ll b){return a*b/gcd(a,b);}//MIN
 string s;
int  main(){
int n,a,b;
cin >> n >> a >> b;
int chea = 0,cheb=0,chec=0;
for(int i=0;i<n;i++){
    int z;
    cin >> z;
    if(z<=a)chea++;
    else if(z<=b)cheb++;
    else chec++;
}

cout << min({chea,cheb,chec})<< endl;
}
 


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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
vector<LL> solve(vector<LL> a){
    priority_queue<LL,vector<LL>,greater<LL>> sub;
    priority_queue<LL> que;
    int N=a.size();
    int m=N/3;
    vector<LL> res(m+1);
    REP(i,m)sub.push(a[i]);
    LL sum=0;
    FOR(i,m,2*m+1){
        res[i-m]=sum;
        LL v=a[i];
        que.push(v);
        sum+=v;
        v=que.top();que.pop();
        sum-=v;
        sub.push(v);
        v=sub.top();sub.pop();
        que.push(v);
        sum+=v;
    }
    return res;
}
int main(){
    int m;
    cin>>m;
    int N=m*3;
    vector<LL> a(N);
    cin>>a;
    vector<LL> S(N+1,0);
    REP(i,N)S[i+1]=S[i]+a[i];
    auto L=solve(a);
    reverse(ALL(a));
    REP(i,N)a[i]*=-1;
    auto R=solve(a);
    reverse(ALL(R));
    for(auto &it:R)it*=-1;
    LL res=-1e17;
    REP(i,m+1){
        //cout<<L[i]<<" "<<R[i]<<endl;
        LL lsum=S[i+m]-L[i];
        LL rsum=S[N]-S[i+m]-R[i];
        chmax(res,lsum-rsum);
    }
    cout<<res<<endl;
    
    return 0;
}


Measured memory_bytes: 11452
s = input()
t = input()
flag = 0
if abs(len(t)-len(s)) == 1:
    for i in range(len(s)):
        if s[i] != t[i]:
            flag = 1
    if flag == 0:
        print('Yes')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 8972
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public int[] A, B;

        public void Run()
        {
            {
                N = Input.ReadInt();
                A = new int[N];
                B = new int[N];
                for (int i = 0; i < N; i++)
                {
                    var line = Input.ReadIntArray();
                    A[i] = line[0];
                    B[i] = line[1];
                }
            }

            long ret = 0;
            for (int i = N - 1; i >= 0; i--)
            {
                long a = A[i] + ret;
                long b = B[i];
                ret += (a % b == 0 ? 0 : b - (a % b));
            }

            Console.WriteLine(ret);

        }
    }

    // libs ----------


    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 18008
#include <algorithm>
#include <stdio.h>
#include <iostream>
#include <cstdlib>
using namespace std;


int main(){
    int N,M,X,Y,xc[100],yc[100];
    cin >> N >> M >> X >> Y;
    for(int i=0;i<N;i++){
        cin >> xc[i];
    }
    for(int i=0;i<M;i++){
        cin >> yc[i];
    }
    sort(xc,xc+N);
    sort(yc,yc+M);
    int XM = xc[N-1];
    int Ym = yc[0];
    if(XM<Ym && Ym>X && XM<Y){
        cout<< "No War" << endl;
    }else{
        cout << "War" << endl;
    }
    return 0;
}

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

using namespace std;

int main(){
	int n;
	while(cin >> n){
		bool flag = true;
		for(int i = 1; i <= 512; i *= 2){
			if(n & i){
				if(flag){
					cout << i;
					flag = false;
				}
				else cout << " " << i;
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}

#define PRINT_VECTOR_MAX 100
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)min(v.size(),PRINT_VECTOR_MAX); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)min(v.size(),PRINT_VECTOR_MAX); i++) {for (ll j = 0; j < (ll)min(v[i].size(),PRINT_VECTOR_MAX); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

void Main();
int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
	return 0;
}

void Main(){
	int n; cin >> n;
	ll m; ll t;
	cin >> m;
	Rep(n-1){
		cin >> t;
		m = lcm(m, t);
	}
	cout << m << endl;
}

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

int main(){
  int N;
  cin >> N;
  int B[N-1];
  rep(i, N-1){
    cin >> B[i];
  }
  int ans = B[0];
  rep(i, N-2){
    ans += min(B[i], B[i+1]);
  }
  ans += B[N-2];
  cout << ans << endl;
}


Measured memory_bytes: 3640
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#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>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=1050;
//ここまでテンプレ
int main(){
	string a,b;
	cin>>a>>b;
	a+=b;
	int A=atoi(a.c_str());
	for(int i=1;i<=1000;i++){
		if(i*i==A){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 4
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}

	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	m := getNextInt(scanner)
	if n%2 == 1 {
		for i := 0; i < m; i++ {
			fmt.Fprintln(writer, fmt.Sprintf("%d %d", i+1, n-i))
		}
		return
	}
	for i := 0; i < m; i++ {
		if i<<1 < m {
			fmt.Fprintln(writer, fmt.Sprintf("%d %d", i+1, n-i))
			continue

		}
		fmt.Fprintln(writer, fmt.Sprintf("%d %d", i+1, n-1-i))
	}
}


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

using namespace std;

int main(){
  long long X;
  cin >> X;
  
  long long Y = 100;
  int i = 0;
  while(Y < X){
    i++;
    Y *= 1.01;
  }
  
  cout << i << endl;
  
  return 0;
}

Measured memory_bytes: 3620
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

import collections
import itertools
import operator


class UnionFind:
    def __init__(self, x):
        class KeyDict(dict):
            def __missing__(self, key):
                self[key] = key
                return key

        self.parent = KeyDict()
        self.rank = collections.defaultdict(int)
        self.size = collections.defaultdict(lambda: 1)
        if x is not None:
            for elem in range(x+1):
                _, _, _ = self.parent[elem], self.rank[elem],self.size[elem]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if not self.are_same(x,y):
            xx = self.size[x]
            yy = self.size[y]
            if self.rank[x] < self.rank[y]:
                self.parent[x] = y
                self.size[y] += xx
            else:
                self.parent[y] = x
                self.size[x] += yy
        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1

    def Size(self,x):
        return self.size[self.find(x)]

    def are_same(self, x, y):
        '''print(x,y,self.find(x),self.find(y),self.find(x) == self.find(y))'''
        return self.find(x) == self.find(y)

    def grouper(self):
        roots = [(x, self.find(x_par)) for x, x_par in self.parent.items()]
        root = operator.itemgetter(1)
        for _, group in itertools.groupby(sorted(roots, key=root), root):
            yield [x for x, _ in group]

N,M = m()

uni = UnionFind(N-1)

for i in range(M):
    a,b = m()
    a-=1
    b-=1
    uni.unite(a,b)
ans = 0
data = list(uni.grouper())
for i in range(len(data)):
    ans = max(ans,len(data[i]))
print(ans)

Measured memory_bytes: 169444
#include <bits/stdc++.h>
using namespace std;
double n,a[10000+10]={};

int main(){
  while(cin >> n && n!=0){
    double sum=0,avg=0;
    for(int i=0;i<n;i++){
      cin >> a[i];
      sum+=a[i];
    }
    avg=sum/n;
    int ans=0;
    for(int i=0;i<n;i++){
      if(a[i]<=avg) ans++;
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3284
#include <iostream>
#include<algorithm>

using namespace std;
int a[200005],b[200005];
int cmp(int x,int y)
{
    return x>y;
}
int main()
{
    int N;
    cin>>N;
    for(int i=0; i<N; i++)
    {
        cin>>a[i];
        b[i]=a[i];
    }
    sort(b,b+N,cmp);
    for(int i=0; i<N; i++)
    {
        if(b[0]==a[i])
            cout<<b[1]<<endl;
        else
            cout<<b[0]<<endl;
    }
}


Measured memory_bytes: 3200
fn main() {
    let n = read::<usize>();
    let a = read_vec::<usize>();
    let mut b = vec![0; n];

    counting_sort(&a, &mut b, 10001 as usize);
    print_vec(&b);
}

pub fn counting_sort(a: &[usize], b: &mut [usize], k: usize) {
    let mut c = vec![0; k];

    // それぞれの係数がいくつあるかをCに記録
    for j in a {
        c[*j] += 1;
    }

    // それまでのCを足すことでそれまでに何個の係数があるかを示せるようになる
    for i in 1..k {
        c[i] += c[i - 1];
    }

    // BにCの情報をもとに値を入れていく
    for j in (0..a.len()).rev() {
        b[c[a[j]] - 1] = a[j];
        // 一つ減らすことでCの示すそれまでに何個係数があるかをずらす
        c[a[j]] -= 1;
    }
}

fn print_vec<T: std::fmt::Display>(v: &Vec<T>) {
    for a in &v[0..v.len() - 1] {
        print!("{} ", a);
    }
    println!("{}", v[v.len() - 1]);
}

/// 標準入力から一行を読み取り、指定の型に変換する関数
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line)
        .ok()
        .expect("Faild to read Vec");
    line.trim().split_whitespace()
        .map(|i| i.parse().ok().unwrap()).collect()
}


Measured memory_bytes: 36716