akhauriyash/Code-Regression huggingface dataset:
import Control.Applicative
main = do
  nums <- map (read :: String -> Int) . words . head . tail . lines <$> getContents
  let [min_, max_, sum_] = map show [foldl min 1000001 nums, foldl max (-1000001) nums, sum nums]
  putStrLn $ min_ ++ " " ++ max_ ++ " " ++ sum_

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

using namespace std;

int main() {
    long long int n, a, b;
    cin>>a>>b>>n;
    if(n>=(b-1))
    printf("%lld", ((a*b-a)/b));
    else
    printf("%lld", (a*n)/b);
    
    
    
    return 0;
}

Measured memory_bytes: 3760
import heapq

n, m, s, t = map(int, input().split())

root1 = []
for i in range(n):
    root1.append({})
root2 = []
for i in range(n):
    root2.append({})
   
for i in range(m):
    u, v, a, b = map(int, input().split())
    root1[u - 1][v] = a
    root1[v - 1][u] = a
    root2[u - 1][v] = b
    root2[v - 1][u] = b

def min_cost(root, start): # 経路の端点を１つ指定して任意の点への最小コストを計算
    S = [[0, start]]
    heapq.heapify(S)
    D = [float("inf")] * n
    D[start - 1] = 0
    while len(S) > 0:
        cost, site = heapq.heappop(S)
        if D[site - 1] < cost:
            continue
        for site2, cost2 in root[site - 1].items():
            if D[site2 - 1] > cost + cost2:
                D[site2 - 1] = cost + cost2
                heapq.heappush(S, [cost + cost2, site2])
    return D

jpy = min_cost(root1, s) # 円で両替地点まで移動する最小コスト
snuke = min_cost(root2, t) # 両替地点からスヌークで移動する最小コスト
cost = [jpy[i] + snuke[i] for i in range(n)] # 両替地点についてループ

minimum_cost = []
temp_min = cost[n - 1]
for i in reversed(range(n)):
    temp_min = min(temp_min, cost[i])
    minimum_cost.append(temp_min)

for i in reversed(range(n)):
    print(10 ** 15 - minimum_cost[i])

Measured memory_bytes: 94532
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9L+7;
int n;
vector<vector<ll>> inp;
vector<vector<vector<ll>>> dp;

int main()
{

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    #ifndef ONLINE_JUDGE
    freopen("inp.txt", "r", stdin);freopen("outp.txt", "w", stdout);
    #endif
    
    int t=1;
    //cin>>t;
    while(t--)
    {
        /*inp.assign(r+2,vector<ll> (c+2,0));
        dp.assign(r+2,vector<vector<ll>> (c+2,vector<ll> (4,-1)));
        */
        ll x,k,d;
        cin>>x>>k>>d;

        x = abs(x);

        if(k< x/d) cout<< x - k*d<<endl;
        else
        {
            ll ans1 = x%d;
            ll ans2 = abs(ans1 - d);
            k -= x/d;

            if(k%2 == 0)
            {
                cout<<ans1<<endl;
            }
            else
            {
                cout<<ans2<<endl;
            }
            
        }
        

    }
    
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    int k, t;
    cin >> k >> t;
    priority_queue<P> pq;
    rep(i,t) {
        Int x;
        cin >> x;
        pq.push(P{x, i});
    }
    int ans = 0;
    Int pre_type = -1;
    P banned = {-1, -1};
    while (pq.size()) {
        P tp = pq.top();
        pq.pop();
        if (banned.first != -1) {
            pq.push(banned);
        }
        Int cake_cnt = tp.first;
        Int cake_type = tp.second;
        if (pre_type == cake_type) ans++;
        cake_cnt--;
        pre_type = cake_type;
        if (cake_cnt > 0) {
            if (pq.empty()) pq.push(P{cake_cnt, cake_type});
            else banned = P{cake_cnt, cake_type};
        }
        else {
            banned = P{-1, -1};
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
fun main (args:Array<String>) {
    val money = readLine()!!.toInt()
    var happy = 0
    val aaa = money / 500
    val bbb = aaa*500
    if(aaa >= 1) {
        happy += aaa * 1000
//        println(happy)
    }
    if((money - bbb) / 5 >= 1){
        happy += 5 * ((money - bbb) / 5)
//        println(happy)
    }
    print(happy)
}

Measured memory_bytes: 34616
#include<iostream>
#include<algorithm>
using namespace std;
int n;
string s;
int sum[1<<17];
int sumR[1<<17];
main()
{
	cin>>n>>s;
	for(int i=0;i<n;i++)sum[i+1]=sum[i]+(s[i]=='>');
	for(int i=0;i<n;i++)sumR[i+1]=sumR[i]+(s[n-i-1]=='<');
	int ans=0;
	for(int i=0;i<n;i++)
	{
		int L=sum[i];
		int R=(n-i-1)-(sum[n]-sum[i+1]);
		int now;
		if(s[i]=='>')
		{
			if(L>=R)
			{
				int pos=lower_bound(sum,sum+n+1,L-R+1)-sum-1;
				now=n-pos;
			}
			else
			{
				int pos=lower_bound(sumR,sumR+n+1,R-L)-sumR-1;
				now=n-pos;
			}
		}
		else
		{
			if(L<=R)
			{
				int pos=lower_bound(sumR,sumR+n+1,R-L+1)-sumR-1;
				now=n-pos;
			}
			else
			{
				int pos=lower_bound(sum,sum+n+1,L-R)-sum-1;
				now=n-pos;
			}
		}
		ans=max(ans,now);
	}
	cout<<ans<<endl;
}



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

int main() {
	string a;
	while (cin >> a) {
		
		if (a.length() % 2 == 1) { cout << "NA" << endl; continue; }
		string t = "";
		bool p =true;
		for (int b = 0; b < a.length(); b += 2) {
			if (a[b] > '6' || a[b]<'1' || a[b + 1]>'5' || a[b + 1] < '1') { cout << "NA" << endl; p = false; break; }
			int s = (a[b] - 49) * 5 + (a[b + 1] - 49) + 97;
			if (s < 123)t += (char)s;
			else {
				switch (s) {
				case 123:t += '.'; break;
				case 124:t += '?'; break;
				case 125:t += '!'; break;
				case 126:t += ' '; break;
				}
			}
		}
		if (p)cout << t << endl;
	}
}

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

typedef long long ll;


int n;

ll func(vector<ll> a, int fugo)
{
    ll ans = 0;
    ll offset = 0; //蓄積する修正量
    for (int i = 0; i < n; i++)
    {
        if (i % 2 == fugo){
            if (a[i] <= offset){
                ans += offset - (a[i] - 1);
                offset = a[i] - 1; 
            }
        } else {
            if (a[i] >= offset){
                ans += (a[i] + 1) - offset;
                offset = a[i] + 1;
            }
        }
        //printf("[%d]", offset);
    }
    //printf("%d ",ans);
    return ans;
}


int main()
{
    cin >> n;
    vector<ll> a;

    ll sum_tmp = 0;
    for (int i = 0; i < n; i++)
    {
        int tmp; cin >> tmp;
        sum_tmp += tmp;
        a.push_back(sum_tmp);
    }
    ll ans = min(func(a, 0), func(a, 1));
    
    cout << ans << endl;

}



Measured memory_bytes: 2676
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1LL << 60;
constexpr int INF = 3000000007;
const double INFD = 1e100;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 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;
}
// ----------------------------------------------------------------------------

int main(){
  ll N,M,V,P;
  cin >> N >> M >> V >> P;
  vector<ll> A(N);
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  sort(A.rbegin(),A.rend());
  ll ok=P,ng=N;
  while(ok<ng){
    ll m=(ok+ng+1)/2;
    ll sum=0;
    for(int i=0; i<N; i++){
      if(i<P-1 || i>=m-1){
        sum += M;
      }else{
        if(A[i] > A[m-1]+M){
          sum = -1;
          break;
        }
        sum += A[m-1] + M - A[i];
      }
    }
    if(sum >= M*V){
      ok = m;
    }else{
      ng = m-1;
    }
  }
  cout << ok << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
  int i,j=0;
  char str1[11];
  char str2[11];
  
  scanf("%s",str1);
  for(i=0;str1[i]!='\0';i++){
    if(str1[i]=='0'){
      str2[j++]='0';
    }else if(str1[i]=='1'){
      str2[j++]='1';
    }else if(j!=0){
      j--;
    }
  }
  str2[j]='\0';
  for(i=0;str2[i]!='\0';i++)printf("%c",str2[i]);
}


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

int main(){
    int n, k;
    cin >> n >> k;
    int a[n];
    int cnt[n] = {0};
    rep(i, n){
        cin >> a[i];
        cnt[a[i]-1]++;
    }

    sort(cnt, cnt+n, greater<int>());
    int sum = 0;
    for(int i=k; i<n;i++){
        sum += cnt[i];
    }
    cout << sum << endl;
    return 0;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector <long long> h(n);
    rep(i,n) cin >> h[i];

    vector <bool> good(n,true);

    rep(i,m){
        int a , b;
        cin >> a >> b;
        long long ha = h[a-1], hb = h[b-1];
        if(ha > hb){
            good[b-1] = false;
        }
        if(ha < hb){
            good[a-1] = false;
        }
        if(ha == hb){
            good[a-1] = false;
            good[b-1] = false;
        }
    }

    int ans = 0;
    rep(i,n){
        if(good[i]){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3996
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main 
{
	static class C implements Comparator<Rec>
	{

		@Override
		public int compare(Rec arg0, Rec arg1) 
		{
			int a = arg0.w * arg0.w + arg0.h * arg0.h;
			int b = arg1.w * arg1.w + arg1.h * arg1.h;
			
			if(a - b != 0)return a-b;
//			return (a-b)*1000 + (arg0.h - arg1.h);
			
			return arg0.h - arg1.h;
		}
		
	}
	
	static class Rec
	{
		int h = 0;
		int w = 0;
		
		public Rec(int h0, int w0)
		{
			h = h0;
			w = w0;
		}
	}

	public static void main(String[] args) 
	{
		Rec[] a = new Rec[125250];
		int z = 0;
		
		for(int h = 1; h <= 501; h++)
		{
			for(int w = h+1; w <= 501; w++)
			{
				a[z] = new Rec(h,w);
				z++;
			}
		}
		
//		System.out.println(z);
		
		C c = new C();
		
		Scanner sc = new Scanner(System.in);
		
		Arrays.sort(a, c);

		
		while(true)
		{
			int h = sc.nextInt();
			int w = sc.nextInt();
			
			if(h == 0 && w == 0)return;
			
			for(int i = 0; i < 125250; i++)
			{
				if(a[i].w == w && a[i].h == h)
				{
					System.out.println(a[i+1].h + " " + a[i+1].w);
					break;
				}
			}
		}
		

	}

}



Measured memory_bytes: 36280
#include <iostream>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
 
#define vi vector<int>
#define p pair<int, int>
#define REP(i, n) for(int i = 0;i < n; i++)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define BR cout << endl;
#define INF  2000000000
 
int a[6], sum = 0;
 
int main(){
    char a, b, c, d;
    cin >> a >> b >> c >> d;
    if((a == b && b == c) || b == c && c == d){
        Yes
    }else{
        No
    }
    return 0;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
	tmp = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
  var getResult = input => {
    var a = parseInt(input[0])
    var b = parseInt(input[1])

    var count = 0

    var check = input =>{
      var str = input.toString()
      var str1 = str.slice(Math.floor(str.length/2))
      var str2 = str.slice(0,Math.floor(str.length/2)+1).split("").reverse().join("")
      if(str1 == str2)
        return true
      else {
        return false
      }
    }

    for(var i = a;i <= b;i++){
      if(check(i))
        count++;
    }

    console.log(count)

  }


  getResult(tmp)
	//出力

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 13452
#include<stdio.h>

#define NUMBER 100


void print_array(int array[],int num)
{
	int i;
	
	for(i = 0; i < num - 1; i++){
		
		printf("%d ", array[i]);
	}
	printf("%d\n", array[i]);
	
}
	
void insertSort(int array[],int num)
{
	int i, v, j;
	for(i = 1; i <= num - 1; i++){
		print_array(array, num);
		v = array[i];
		j = i - 1;
		while(j >= 0 && array[j] > v){
			array[j + 1] = array[j];
			j--;
			
		}
		array[j + 1] = v;
	
    }
}

int main(void)
{
	int i, num;
	int array[NUMBER];

	scanf("%d", &num);
	
	for(i = 0; i < num; i++)
	{
		scanf("%d", &array[i]);
	}
	
	insertSort(array , num);
	
	print_array(array , num);
	
	
	return 0;
}


Measured memory_bytes: 2052
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int n,m,par[1005]={},ans=0,a,b;
int find(int x) {
  if(par[x]==x) {
    return x;
  }
  return par[x]=find(par[x]);
}
bool same(int x,int y) {
  return par[x]==par[y];
}
void unit(int x,int y) {
  x=find(x),y=find(y);
  if(x!=y) {
    par[x]=y;
  }
}
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for(int i=1; i<=1000; i++) {
    par[i]=i;
  }
  for(int i=0; i<m; i++) {
    cin >> a >> b;
    unit(a,b);
  }
  map<int,int> ma;
  for(int i=1; i<=n; i++) {
    ma[find(i)]++;
  }
  for(auto p:ma) {
    if(p.second==1) {
      ans++;
    }
    else {
      ans--;
    }
  }
  cout << abs(ans) << "\n";
}


Measured memory_bytes: 3192
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

ll n, h, a, d, s;
struct E{
	ll h, a, d, s, t;
};
bool cmp(const E &a, const E &b){
	ll da = a.a - d, db = b.a - d;
	return a.t * db < b.t * da;
}

int main(){
	cin >> n >> h >> a >> d >> s;
	vector<E> es;
	rep(i, n){
		E e;
		cin >> e.h >> e.a >> e.d >> e.s;
		ll k = a - e.d;
		if(e.a <= d) continue;
		if(k <= 0){
			cout << -1 << endl;
			return 0;
		}
		else{
			e.t = (e.h + k - 1) / k; 
			es.pb(e);
		}
	}
	sort(all(es), cmp);
	ll ans = 0, turn = 0;
	rep(i, es.size()){
		turn += es[i].t;
		ans += (es[i].a - d) * (turn - (s > es[i].s));
		if(ans >= h){
			cout << -1 << endl;
			return 0;
		}
	}
	cout << ans << endl;
	return 0;
}

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


int hist[10];

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double a;
		cin>>a;
		if(a<165.0){
			hist[0]++;
		}else if(a<170.0){
			hist[1]++;
		}else if(a<175.0){
			hist[2]++;
		}else if(a<180.0){
			hist[3]++;
		}else if(a<185.0){
			hist[4]++;
		}else hist[5]++;
	}
	for(int i=0;i<6;i++){
		cout<<i+1<<':';
		for(int j=0;j<hist[i];j++)cout<<'*';
		cout<<endl;
	}
	return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }

using namespace std;

int main(int argc, char** argv) 
{
#ifdef HOME
	if(IsDebuggerPresent())
	{
		freopen("../in.txt", "rb", stdin);
		freopen("../out.txt", "wb", stdout);
	}
#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout << fixed;
	int N;
	string S;
	cin >> N >> S;
	while (S.size() && S.back() == '#')
	{
		S.pop_back();
	}
	reverse(all(S));
	while (S.size() && S.back() == '.')
	{
		S.pop_back();
	}
	reverse(all(S));
	vector<int> v1(S.size()), v2(S.size()), w1(S.size()), w2(S.size());
	int ctr = 0, ctr2 = 0, res = 1e9;
	forn(i, S.size())
	{
		if (S[i] == '#')
			++ctr;
		else if (S[i] == '.')
			++ctr2;
		v1[i] = ctr;
		v2[i] = ctr2;
	}
	res = min<int>(ctr, S.size() - ctr);
	ctr = 0;
	ford(i, S.size())
	{
		res = min<int>(res, ctr + v1[i]);
		if (S[i] == '.')
			++ctr;
	}
	cout << res << endl;
	return 0;
}


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

ans=0
sset=set()
for i in range(1,N):
    sset.clear()
    num=0
    s1=S[:i]
    s2=S[i:]
    for j in range(i):
        sset.add(s1[j])
    for c in list(sset):
        if c in s2:
            num+=1
    if ans<num:
        ans=num

print(ans)

    

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

namespace B_ABC168
{
    class MainClass
    {

        static int[] k;

        public static void Main(string[] args)
        {
            // s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            k = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            string s = ReadLine();
            if (s.Length>k[0]){
                s = s.Substring(0,k[0]);
                s+="...";


            }
            WriteLine(s);
        }
    }
}


Measured memory_bytes: 28024
#include <cstdio>

int main(){
    int a[3];
    for(int i = 0; i < 3; i++){
        scanf("%d",&a[i]);
    }
    int v;
    for(int i = 0; i < 3; i++){
        for(int j = i + 1; j < 3; j++){
            if(a[i] < a[j]){
                v = a[i];
                a[i] = a[j];
                a[j] = v;
            }
        }
    }

    printf("%d\n",a[0] * 10 + a[1] + a[2]);

    return 0;
}

Measured memory_bytes: 256
import collections
n = int(input())
d = list(map(int, input().split()))
fl = False
if d[0] != 0:
  fl = True
  print(0)
else:
  del d[0]
  c = collections.Counter(d)
  ll = len(c)
  ans = 1
  for i in range(1, ll+1):
    if c[i] == 0:
      print(0)
      fl = True
      break
    else:
      if i != 1:
        ans *= c[i-1]**c[i]

if not fl:
  print(ans%998244353)

Measured memory_bytes: 19936
n = gets.to_i
a = gets.split.map(&:to_i)
b = []
0.upto(n - 1) do |i|
  if i.odd?
    b.push(a[i])
  else
    b.unshift(a[i])
  end
end
b.reverse! if n.even?
puts b.join(' ')

Measured memory_bytes: 27492
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long 
#define ii pair<int,int>
#define iii pair<int,ii>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define pw(x) (1<<(x))
#define inf 1000000005
#define MOD 1000000007 
#define N 150005
#define M 1000003
#define LOG 20
#define KOK 250
#define EPS 0.0000001
using namespace std;

vector<int> g;
vector<vector<int>> v;

void dfs(int node,int ata) {

	for(int i:v[node]) {

		if(i==ata) continue ;

		dfs(i,node);

		g[node]^=(g[i]+1);

	}

}

int main() {

	int n;

	scanf("%d",&n);

	g=vector<int>(n+1,0);
	v=vector<vector<int>>(n+1);

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

		int x,y;

		scanf("%d %d",&x,&y);

		v[x].pb(y);
		v[y].pb(x);

	}

	dfs(1,0);

	printf(g[1]?"Alice":"Bob");

}

Measured memory_bytes: 12288
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    X, Y, Z, K = map(int, readline().split())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))
    C = list(map(int, readline().split()))

    AB = []
    for a in A:
        for b in B:
            AB.append(a + b)

    AB.sort(reverse=True)
    AB = AB[:K]

    ABC = []
    for ab in AB:
        for c in C:
            ABC.append(ab + c)

    ABC.sort(reverse=True)

    print('\n'.join(map(str, ABC[:K])))

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 218396
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
    }
    println!(
        "{}",
        if s == "Sunny" {
            "Cloudy"
        } else if s == "Cloudy" {
            "Rainy"
        } else {
            "Sunny"
        }
    );
}


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

void call(int n){
	for(int i=1;i<=n;i++){
		int x=i;
		if(x%3==0){
			cout<<" "<<i;
			continue;
		}
		for(;x;x/=10){
			if(x%10==3){
				cout<<" "<<i;
				x=0;
			}
		}
	}
}

int main(){
	int n;
	cin>>n;
	call(n);
	cout<<endl;
	return 0;
}



Measured memory_bytes: 3100
#include <iostream>

using namespace std;

int main()
{
    int a, b, c;
    int fi = 0, se = 0;

    cin >> a >> b >> c;

    if (a == 5) fi++;
    if (b == 5) fi++;
    if (c == 5) fi++;

    if (a == 7) se++;
    if (b == 7) se++;
    if (c == 7) se++;

    if (fi == 2 && se == 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,Q;
int A[3030];
ll mo=1000000007;

ll P[3030][3030];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>Q;
	FOR(i,N) cin>>A[i];
	FOR(i,N) FOR(j,N) P[i][j]=A[i]>A[j];
	
	FOR(j,Q) {
		cin>>x>>y;
		x--,y--;
		FOR(i,N) {
			if(i!=x && i!=y) {
				P[i][x]=P[i][y]=(P[i][x]+P[i][y])*((mo+1)/2)%mo;
				P[x][i]=P[y][i]=(P[x][i]+P[y][i])*((mo+1)/2)%mo;
			}
		}
		P[x][y]=P[y][x]=(P[x][y]+P[y][x])*((mo+1)/2)%mo;
	}
	
	ll ret=0;
	FOR(i,N) FOR(j,i) ret+=P[j][i];
	ret%=mo;
	FOR(i,Q) ret=ret*2%mo;
	
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 71936
N=int(input())
A=list(map(int,input().split()))
mod=10**9+7

S=[sum(A)]
for i in range(N):
    S.append(S[-1]-A[i])

ans=0
for i in range(N):
    ans+=A[i]*(S[i]-A[i])
    ans%=mod
print(ans)

Measured memory_bytes: 31440
# -*- coding: utf-8 -*-
# 整数の入力
X = int(input())
# スペース区切りの整数の入力
#a, b = map(int, input().split())
# 文字列の入力
#s = input()
a = int(input())
b = int(input())
ans= (X-a)%b

# 出力
print (ans)

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

int solve(int a, int b) {

  int d = b - a;
  int h = 0;
  for(int i=1;i<=d-1;i++) {
    h +=i;
  }

  return h - a;
}

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

  cout << solve(a, b);
}

Measured memory_bytes: 3628
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

H,W = inpl()

lines = defaultdict(set)

for i in range(10):
	li = inpl()
	for j,c in enumerate(li):
		lines[j].add((i,c))

def search (s,w_0): #s->t
	global weight
	global q
	for line in list(lines[s]):
		t = line[0]
		w = w_0 + line[1]
		if weight[t] > w:
			heapq.heappush(q, [w,t])
			weight[t] = w

s = 1
weight = [INF]*10
weight[s] = 0
q = [[0,s]]
heapq.heapify(q)
while q:
	w,n = heapq.heappop(q)
	search(n,w)

ans = 0
for i in range(H):
	li = inpl()
	for l in li:
		if l == -1:
			continue
		else:
			ans += weight[l]

print(ans)


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


int main()
{
int A,B,C,D;
cin >> A >> B >> C >> D;
int x = (A+B) - (C+D);
if(x > 0) puts("Left");
else if(x < 0) puts("Right");
else puts("Balanced");

return 0;
}

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

// PfsMap : 素因数分解し、マップを作成
func PfsMap(n int) map[int]int {
	pfs := make(map[int]int)
	for n%2 == 0 {
		pfs[2] = pfs[2] + 1
		n = n / 2
	}

	for i := 3; i*i <= n; i = i + 2 {
		for n%i == 0 {
			pfs[i] = pfs[i] + 1
			n = n / i
		}
	}

	if n > 2 {
		pfs[n] = pfs[n] + 1
	}

	return pfs
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

const mod = 1000000007

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()

	p := make(map[int]int)
	for i := N; i > 1; i-- {
		pfs := PfsMap(i)
		for i, v := range pfs {
			p[i] += v
		}
	}

	ans := 1
	for _, v := range p {
		ans = (ans * (v + 1)) % mod
	}
	out(ans)
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m,k=0;
  cin>>n>>m;
  for(int i=0;i<max(m,n);++i)
  {
    k=k+min(m,n)*pow(10,i);
  }
  cout<<k;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>


int my_abs(int a) {
	return a < 0 ? -a : a;
}


int main() {


	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);
	int N; std::cin >> N;
	std::vector<int> H(N); for (int i = 0; i < H.size(); i++)std::cin >> H.at(i);
	bool flag = true;//見れる
	int ans = 1;
	
	for (int i = 1; i < H.size(); i++) {
		for (int j = 0; j < i; j++) {
			if (H.at(j) > H.at(i)) {
				flag = false;
				break;
			}
			else {
				flag = true;
			}
		}
		if (flag)ans++;
	}

	std::cout << ans;

	return 0;


}

Measured memory_bytes: 256
n = int(input())
l = []
c = 0
d = 0
for _ in range(n):
    a,b = map(int,input().split())
    l.append([b,a])
l = sorted(l)


for i in range(0,n):
    if l[i][0] < d + l[i][1]:
        c = 1
        break
    else:
        d = d+ l[i][1]
        continue
if c == 0:
    print('Yes')
else:
    print('No')

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

int main() {
  int N;
  double T,A;
  cin >> N >> T >> A;
  vector<double> H(N);
  for(int i=0; i<N; i++){
    cin >> H.at(i);
    H.at(i)=T-H.at(i)*0.006-A;
    H.at(i)=max(H.at(i),-H.at(i));
  }
  int i=1,j=1;
  double k=H.at(0);
  for(; i<N; i++){
    if(k>H.at(i)){
      k=H.at(i);
      j=i+1;
    }
  }
  cout << j << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>

#define for0(i, N)    for (int i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (int i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (int i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (int i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (int i = (x); i <  (N); ++i)
#define forl(i, n, x, a) for (int i = (x), a = 0; a < (n);  \
                              i = (i + 1) % (n), ++a)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;


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

    int N, K;

    cin >> N >> K;

    bool b[(int)1e5];

    for0(i, N){
        char c;
        cin >> c;
        b[i] = (c == 'R');
    }

    int const M = N - 1;

    int result = 0;

    for0(i, N - 1){
        if((b[i] && b[i + 1]) || (!b[i] && !b[i + 1])) ++result;
    }
    result += K * 2;

    cout << min(result, M);

    return 0;
}


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

def main():
    N = int(input())
    H = map(int,input().split())
    Hc = 10 ** 9 + 1
    count = -1
    answer = 0
    for Hi in H:
        if Hc >= Hi:
            count += 1
        else:
            answer = max(count, answer)
            count = 0
        Hc = Hi
    answer = max(count, answer)
    print(answer)

if __name__ == "__main__":
    main()


Measured memory_bytes: 11132
n=int(input())
a,b=map(int,input().split())
l=[abb for abb in range(a, b+1)]
kl=[]
for am in l:
    if am%n==0:
        kl.append(am)
if len(kl)>0:
    print("OK")
else:
    print("NG")

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

int main() {
    int n, k, v[55];

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

    int ans = 0;
    for (int a = 0; a <= k; a++) {
        for (int b = 0; b <= k && a + b <= k; b++) {
            int cur_ans = 0, rem_k = 0;
            vector<int> neg;

            if (a + b >= n) {
                for (int i = 0; i < n; i++) {
                    cur_ans += v[i];
                    if (v[i] < 0) {
                        neg.emplace_back(v[i]);
                    }
                }

                rem_k = k - n;
            } else {
                for (int i = 0; i < a; i++) {
                    cur_ans += v[i];
                    if (v[i] < 0) {
                        neg.emplace_back(v[i]);
                    }
                }
                for (int i = 0; i < b; i++) {
                    cur_ans += v[n - i - 1];
                    if (v[n - i - 1] < 0) {
                        neg.emplace_back(v[n - i - 1]);
                    }
                }

                rem_k = k - a - b;
            }

            sort(neg.begin(), neg.end());
            for (int i : neg) {
                if (rem_k <= 0) {
                    break;
                }

                cur_ans -= i;
                rem_k--;
            }

            ans = max(ans, cur_ans);
        }
    }

    cout << ans << endl;

    return 0;
}


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

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

#define int             long long
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define endl             '\n'
#define pb              push_back
#define all(x)          x.begin(),x.end()
#define ff              first
#define ss              second
int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int string_to_int(string s){int ans = 0;int p=1;for(int i=s.size()-1;i>=0;i--){ans += (s[i]-'0')*p;p *= 10;}return ans;}

//DEBUGGING-LINES
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 debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

void t_c_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
/*#ifndef ONLINE_JUDGE
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif*/

	int x; cin >> x;
	if(x>=400 and x<=599) cout << 8;
	if(x>=600 and x<=799) cout << 7;
	if(x>=800 and x<=999) cout << 6;
	if(x>=1000 and x<=1199) cout << 5;
	if(x>=1200 and x<=1399) cout << 4;
	if(x>=1400 and x<=1599) cout << 3;
	if(x>=1600 and x<=1799) cout << 2;
	if(x>=1800 and x<=1999) cout << 1;
}

int32_t main()
{
	t_c_c();
	return 0;
}


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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
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;}

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

int H,W,D;
int T[20][20];
int G[20][20][20][20];

inline void get(int &y,int &x){
    char c;
    scanf(" %c-%lld",&c,&x);
    x--;y=c-'a';
}

bool visited[20][20][111][4];


void solve(){
    cin>>D;
    memset(T,-1,sizeof(T));
    int n;cin>>n;
    while(n--){
        int y,x;
        get(y,x);
        int t;scanf("%lld",&t);
        T[y][x]=t;
    }
    fill_n(***G,20*20*20*20,D);
    cin>>n;
    while(n--){
        int y,x,yy,xx;
        get(y,x);get(yy,xx);
        G[y][x][yy][xx]=G[yy][xx][y][x]=INF;
    }
    cin>>n;
    while(n--){
        int y,yy,x,xx,t;
        get(y,x);get(yy,xx);scanf("%lld",&t);
        G[y][x][yy][xx]=G[yy][xx][y][x]=D+t;
    }

    int sy,sx,gy,gx;
    get(sy,sx);get(gy,gx);

    memset(visited,0,sizeof(visited));
    visited[sy][sx][0][1]=true;
    queue<tuple<int,int,int,int>>que;
    que.push(make_tuple(sy,sx,0,1));
    while(que.size()){
        int y,x,t,pre_d;
        tie(y,x,t,pre_d)=que.front();
        que.pop();

        rep(d,4){
            if((d+2)%4==pre_d)continue;
            int ny=y+dy[d],nx=x+dx[d];
            if(ny<0||ny>=H||nx<0||nx>=W)continue;
            int nt=t+G[y][x][ny][nx];
            if(nt>100)continue;
            if(T[ny][nx]!=-1&&(nt%(2*T[ny][nx])>=T[ny][nx])!=d%2)continue;
            if(visited[ny][nx][nt][d])continue;
            visited[ny][nx][nt][d]=true;
            que.push(make_tuple(ny,nx,nt,d));
        }
    }

    rep(t,101)rep(d,4)if(visited[gy][gx][t][d]){
        cout<<t<<endl;
        return;
    }

    /*
    rep(i,H){rep(j,W){
        int a=101;
        rep(t,101)rep(d,4)if(visited[i][j][t][d])chmin(a,t);
        if(a==101)cout<<-1<<" ";
        else cout<<a<<" ";
    }cout<<endl;}
    */
}

signed main(){
    while(cin>>H>>W,W||H)solve();
    return 0;
}

Measured memory_bytes: 4584
#include <iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<array>
#include<functional>
#include<iomanip>
#include<ios>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)

typedef int value_type; /* ソートするキーの型 */

value_type med3(value_type x, value_type y, value_type z)
/* x, y, z の中間値を返す */
{
    if (x < y)
        if (y < z) return y; else if (z < x) return x; else return z; else
        if (z < y) return y; else if (x < z) return x; else return z;
}

void quicksort(value_type a[], int left, int right,value_type index[])
/* クイックソート
 * a     : ソートする配列 
 * left  : ソートするデータの開始位置
 * right : ソートするデータの終了位置
 * index: index配列
 */
{
    if (left < right) {
        int i = left, j = right;
        value_type tmp, pivot = med3(a[i], a[i + (j - i) / 2], a[j]); /* (i+j)/2ではオーバーフローしてしまう */
        while (1) { /* a[] を pivot 以上と以下の集まりに分割する */
            while (a[i] < pivot) i++; /* a[i] >= pivot となる位置を検索 */
            while (pivot < a[j]) j--; /* a[j] <= pivot となる位置を検索 */
            if (i >= j) break;
            tmp = a[i]; a[i] = a[j]; a[j] = tmp; /* a[i],a[j] を交換 */
            tmp = index[i]; index[i] = index[j]; index[j] = tmp;
            i++; j--;
        }
        quicksort(a, left, i - 1,index);  /* 分割した左を再帰的にソート */
        quicksort(a, j + 1, right,index); /* 分割した右を再帰的にソート */
    }
}


int dfs(int n,int N){
    if (n>N){
        return 0;
    }
    

    int ret;
    
    return ret;
}
int main(){
    string A,B;
    cin >>A >>B;

    string ans;

    
    
    if(A[0]==B[2] && A[1]==B[1] && A[2]==B[0]){
        ans="YES";
    }else{
        ans="NO";
    }

    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 256
using System;

public class Class1
{
    static void Main(string[] args)
    {
        var Class1 = new Class1();
    }

	public Class1()
	{
        string S = Console.ReadLine();
        int ChangeCount = 0;
        Color Recent = judge(S[0]);
        for (int i = 1; i < S.Length; i++)
        {
            if (Recent != judge(S[i])) ChangeCount++;
            Recent = judge(S[i]);
        }

        Console.WriteLine(ChangeCount);

	}

    public Color judge(char c)
    {
        if (c == 'B') return Color.black;
        else return Color.white;
    }

    
}

public enum Color
{
    black,white
}


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

using namespace std;

const long long DAYS = 5e15;

int main(int argc, char* argv[])
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  string S;
  cin >> S;

  long long K;
  cin >> K;

  char res = '1';
  int N = S.size();
  if (K < N) N = K;
  for (int i = 0; i < N; ++i)
  {
    if (S[i] != '1')
    {
      res = S[i];
      break;
    }
  }

  cout << res << "\n";

  return 0;
}


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




int main()
{
	string a,b;
	cin>>a>>b;
	a+=b;
	stringstream ss;
	ss<<a;
	int num;
	ss>>num;
	for(int i=1; i<=320; i++)
	{
		if(i*i==num)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";



	return 0;
}


Measured memory_bytes: 384
from fractions import gcd

n, k = map(int, raw_input().strip().split())
a = map(int, raw_input().strip().split())

S = sum(a)

div = []
for d in xrange(1, int(S ** 0.5) + 1):
    if S % d == 0:
        div.append(d)
        if d * d != S:
            div.append(S // d)

g = 0
for i in xrange(n):
    g = gcd(g, a[i])

ans = g
for d in div:
    if d < g: continue
    
    X = 0
    liz = []
    for i in xrange(n):
        x = a[i] % d
        if (x != 0): y = d - x
        else: y = 0
        
        X += y
        liz.append(y)
    liz.sort()

    q = X // d
    op = 0
    for i in xrange(len(liz) - 1, len(liz) - q - 1, -1):
        liz[i] -= d
        assert(liz[i] < 0)
        op += abs(liz[i])

    if op <= k:
        ans = max(ans, d)

print ans
    


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

int main() {
  string a, b; cin>>a>>b;
  int x = a.size() - b.size();
  if (x>0||(x==0)&&(a>b)) cout<<"GREATER"<<endl;
  else if (x<0||(x==0)&&(a<b))cout<<"LESS"<<endl;
  else cout<<"EQUAL"<<endl;
}


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

int main(){
	ll N,M,V,P;
	cin >> N >> M >> V >> P;
	vector<ll> A(N);
	for(auto &x:A) cin >> x;
	sort(A.begin(), A.end());

	ll ok = N-1, ng = -1;
	while(ok-ng>1){
		ll mid = (ok+ng)/2;
		auto B = A;
		ll rest = V*M-M;
		B[mid] += M;
		ll morebig = 0;
		for(int i=N-1;i>=0;i--){
			if(i==mid || rest<=0)continue;
			if(morebig < P-1){
				morebig++;
				B[i] += M;
				rest -= M;
			}else{
				if( B[mid]-B[i] > 0 ){
					ll add = min(M,B[mid]-B[i]);
					B[i] += add;
					rest -= add;
				}
			}
		}
		ll cheak = B[mid];
		sort(B.begin(), B.end());
		if(B[N-P]<=cheak && rest<=0){
			ok = mid;
		}else{
			ng = mid;
		}
	}

	cout << N-ok << endl;
}

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

#define MAX 2000

using namespace std;

int n,q;
int n_lst[MAX],q_lst[MAX];
static int ans_lst[MAX][MAX];


bool bf(int idx,int x){
    if(x == 0) return true;
    if(idx < n){
        return bf(idx+1,x) || bf(idx+1,x-n_lst[idx]);
    }
    return false;
}

int m_bf(int idx,int x){
    //1:false,2:true

    //定義済み？
    if(ans_lst[idx][x] > 0) return ans_lst[idx][x];


    if(x == 0) ans_lst[idx][x] = 2;
    else if(idx < n){
        if(m_bf(idx+1,x-n_lst[idx]) == 2)
            ans_lst[idx][x] = 2;
        else if(m_bf(idx+1,x) == 2)
            ans_lst[idx][x] = 2;
    }
    else
        ans_lst[idx][x] = 1;

    return ans_lst[idx][x];

}

int main(){
    cin >> n;
    for(int i=0;i<n;i++) cin >> n_lst[i];
    cin >> q;
    for(int i=0;i<q;i++) cin >> q_lst[i];

    for(int i=0;i<q;i++){
        if(m_bf(0,q_lst[i]) == 2)
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
}



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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/



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

	vector<int> l(n+2);
	for(int i = 1, i_len = (int)n; i <= i_len; ++i) cin >> l[i];
	
	int d = 0;
	int cnt = 1;
	for(int i = 1, i_len = (int)n; i <= i_len; ++i){
		d += l[i];

		if(d > x)break;
				++cnt;
	}
	
if(n == 1 && l[1] < x)
cout << 2 << endl;
else
	cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
x,y = map(int,input().split())
A = list(map(int,input().split()))
B = sorted(A,reverse=True)
K = sum(A)
ct = 0 
for i in range(1,1+y):
    if B[i-1]*4*y < K:
        ct +=1

if ct == 0:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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; }
//#define int long long

void solve() {
	int n; string s; cin >> n >> s;
    if(n % 2 == 1) {
        cout << "No" << endl;
        return;
    }
    string t = s.substr(0, n / 2), u = s.substr(n / 2, n / 2);
    if(t == u) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 256