akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

static const int MAX = 200000;

int main() {
  int n, R[MAX];
  
  cin >> n;
  for(int i = 0; i < n; i++) cin >> R[i];
  
  int maxv = -1000000000;
  int minv = R[0];

  for(int i = 1; i < n; i++) {
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }

  cout << maxv << endl;
}


Measured memory_bytes: 3872
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) begin(x), end(x)
using ll = long long;
using namespace std;

template <int32_t MOD>
struct mint {
    int32_t value;
    mint() = default;
    mint(int32_t value_) : value(value_) {}
    inline mint<MOD> operator + (mint<MOD> other) const { int32_t c = this->value + other.value; return mint<MOD>(c >= MOD ? c - MOD : c); }
    inline mint<MOD> operator - (mint<MOD> other) const { int32_t c = this->value - other.value; return mint<MOD>(c <    0 ? c + MOD : c); }
    inline mint<MOD> operator * (mint<MOD> other) const { int32_t c = (int64_t)this->value * other.value % MOD; return mint<MOD>(c < 0 ? c + MOD : c); }
    inline mint<MOD> & operator += (mint<MOD> other) { this->value += other.value; if (this->value >= MOD) this->value -= MOD; return *this; }
    inline mint<MOD> & operator -= (mint<MOD> other) { this->value -= other.value; if (this->value <    0) this->value += MOD; return *this; }
    inline mint<MOD> & operator *= (mint<MOD> other) { this->value = (int64_t)this->value * other.value % MOD; if (this->value < 0) this->value += MOD; return *this; }
    inline mint<MOD> operator - () const { return mint<MOD>(this->value ? MOD - this->value : 0); }
    mint<MOD> pow(uint64_t k) const {
        mint<MOD> x = *this, y = 1;
        for (; k; k >>= 1) {
            if (k & 1) y *= x;
            x *= x;
        }
        return y;
    }
    mint<MOD> inv() const { return pow(MOD - 2); }  // MOD must be a prime
    inline mint<MOD> operator /  (mint<MOD> other) const { return *this *  other.inv(); }
    inline mint<MOD> operator /= (mint<MOD> other)       { return *this *= other.inv(); }
};

template <int32_t MOD>
mint<MOD> fact(int n) {
    static vector<mint<MOD> > memo(1, 1);
    while (n >= memo.size()) {
        memo.push_back(memo.back() * mint<MOD>(memo.size()));
    }
    return memo[n];
}

constexpr int MOD = 1000003;

mint<MOD> solve(int x, int d, ll n) {
    if (d == 0) {
        return mint<MOD>(x).pow(n);
    } else if (d == 1) {
        assert (x < MOD);
        if (x == 0) {
            return 0;
        } else if (x + n - 1 >= MOD) {
            return 0;
        } else {
            return fact<MOD>(x + n - 1) / fact<MOD>(x - 1);
        }
    } else {
        return solve((mint<MOD>(x) / d).value, 1, n) * mint<MOD>(d).pow(n);
    }
}

int main() {
    int q; cin >> q;
    while (q --) {
        int x, d; ll n; cin >> x >> d >> n;
        cout << solve(x, d, n).value << endl;
    }
    return 0;
}


Measured memory_bytes: 6552
package main

import "fmt"

func main() {
	var N int
	fmt.Scanf("%d", &N)
	var s string
	fmt.Scanf("%s", &s)
	rCount := 0
	bCount := 0
	for _, c := range s {
		if string(c) == "R" {
			rCount = rCount + 1
		} else if string(c) == "B" {
			bCount = bCount + 1
		}
	}
	if rCount > bCount {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int frecuencias[26];

int main() {
    string palabra;
    cin>>palabra;
    bool rpta=1;
    for(int i=0;i<palabra.size();i++){
       frecuencias[palabra[i]-'a']++;
    }
    for(int i=0;i<26;i++){
       if(frecuencias[i]%2!=0){
          rpta=0; 
       }
    }
    if(rpta){
       cout<<"Yes"<<endl;
       
    }else{
       cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <iostream>
#include<cmath>
using namespace std;
struct Dice{
    int face[6];
    void roll(char c){
        if(c == 'N'){
            int tmp;
            tmp = face[0];
            face[0]=face[1];
            face[1]=face[5];
            face[5]=face[4];
            face[4]=tmp;
        }else if(c == 'E'){
            int tmp;
            tmp = face[0];
            face[0]=face[3];
            face[3]=face[5];
            face[5]=face[2];
            face[2]=tmp;
        }else if (c == 'S'){
            int tmp;
            tmp=face[0];
            face[0]=face[4];
            face[4]=face[5];
            face[5]=face[1];
            face[1]=tmp;

        }else if(c == 'W'){
            int tmp;
            tmp=face[0];
            face[0]=face[2];
            face[2]=face[5];
            face[5]=face[3];
            face[3]=tmp;
        }else if (c == 'R'){
            int tmp;
            tmp=face[1];
            face[1]=face[2];
            face[2]=face[4];
            face[4]=face[3];
            face[3]=tmp;
        }
    }
    int top(){
        return face[0];
    }
    int right(){
        return face[2];
    }
    int left(){
        return face[3];
    }
     int front(){
        return face[1];
    }
};

int main(){
    Dice d;
    for(int i=0;i<6; i++){
        cin >> d.face[i];  
    }
    int q;
    cin >> q;
    for(int i=0; i<q; i++){
        int a, b;
        cin >> a >> b;
        if(d.right()==a) d.roll('W');
        if(d.left()==a) d.roll('E');
        while (d.top()!= a) d.roll('N');
        while (d.front()!= b) d.roll('R');
        cout << d.right() << endl;

    }
    return 0;
}




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

int main(int argc, char const *argv[])
{
	string s;
	int w;
	cin>>s>>w;
	string ans;
	for (int i = 0; i < s.size(); i+=w)
	{
		ans.push_back(s[i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	 public static void main(String[] args){
		 Scanner sc = new Scanner(System.in);
		 int n = sc.nextInt();
		 int a = sc.nextInt();
		 int b = sc.nextInt();
		 System.out.println(Math.min(n * a, b));
	 }
}

Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,s[4];
cin>>a>>b>>c;
s[0]=a;
s[1]=b;
s[2]=c;
sort(s,s+3);
if((s[0]+s[1])==s[2]) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}


Measured memory_bytes: 3584
class UnionFind:
    def __init__(self,n):
        super().__init__()
        self.par = [-1]*n
        self.rank = [0]*n
        self.tsize = [1]*n
    
    def root(self,x):
        if self.par[x] == -1:
            return x 
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x_r = self.root(x)
        y_r = self.root(y)
        
        if self.rank[x_r]>self.rank[y_r]:
            self.par[y_r] = x_r

        elif self.rank[x_r]<self.rank[y_r]:
            self.par[x_r] = y_r

        elif x_r != y_r:
            self.par[y_r] = x_r
            self.rank[x_r] += 1

        if x_r != y_r:
            size = self.tsize[x_r]+self.tsize[y_r]
            self.tsize[x_r] = size
            self.tsize[y_r] = size

    def isSame(self,x,y):
        return self.root(x) == self.root(y)

    def size(self,x):
        return self.tsize[self.root(x)]
      
n,m = tuple(map(int,input().split()))

ll = []
uf = UnionFind(m)
for _ in range(n):
  k, *l = tuple(map(int,input().split()))
  for i in range(k-1):
    uf.unite(l[i]-1,l[i+1]-1)
  ll.append(l[0]-1)

for lang in ll:
  if not uf.isSame(lang,ll[-1]):
    print("NO")
    exit()
print("YES")


Measured memory_bytes: 77656
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_Cs
{
    public class Program
    {
        public static void Main()
        {
            var c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var m = c[0] * c[1];

            string ret = m % 2 == 0 ? "Even" : "Odd";

            Console.WriteLine($"{ret}");
        }
    }
}


Measured memory_bytes: 13268
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in=new Scanner(System.in);
		for(;;)
		{
			int a=in.nextInt();
			int L=in.nextInt();
			if((a|L)==0)
				return;
			LinkedList<String> LL=new LinkedList<String>();
			boolean judge=false;
			int ai=-1,aj=-1;
			LL.add(a+"");
			for(;;)
			{
				for(int j=0;j<LL.size();j++)
					for(int i=j+1;i<LL.size();i++)
					{
						if(LL.get(i).equals(LL.get(j)))
						{
							judge=true;
							ai=i;
							aj=j;
						}
					}
				if(judge)
					break;
				String max="";
				String min="";
				char ch[]=(a+"").toCharArray();
				Arrays.sort(ch);

				for(int k=0;k<ch.length;k++)
					min+=ch[k];
				while(min.length()<L)
					min="0"+min;
				StringBuilder sb=new StringBuilder(min);
				max=sb.reverse().toString();
				a=Integer.valueOf(max)-Integer.valueOf(min);
				LL.add(a+"");
			}
			System.out.println(aj+" "+LL.get(ai)+" "+(ai-aj));
		}
	}
}

Measured memory_bytes: 27900
#include <bits/stdc++.h>
using namespace std;
#define N 1010
int x[N],y[N],d[N];
bool flag[2];
int read(){
	int x=0,f=1;
	char ch=getchar();
	while (ch<'0' || ch>'9'){
		if (ch=='-') f=-1;
		ch=getchar();
	}
	while (ch>='0' && ch<='9'){
		x=x*10+ch-'0';ch=getchar();
	}
	return x*f;
}
signed main(){
	int n=read(),m=0;
	for (int i=1;i<=n;++i){
		x[i]=read(),y[i]=read();
		flag[(x[i]+y[i])&1]=1;
	}
	if (flag[0] && flag[1]){
		puts("-1");return 0;
	}
	if (flag[0]) d[++m]=1;
	for (int i=30;i>=0;--i) d[++m]=1<<i;
	cout<<m<<endl;
	for (int i=1;i<m;++i) printf("%d ",d[i]);
	printf("%d\n",d[m]);
	for (int i=1;i<=n;++i){
		for (int j=1;j<=m;++j){
			if (abs(x[i])>abs(y[i])){
				if (x[i]>0) x[i]-=d[j],putchar('R');
				else x[i]+=d[j],putchar('L');
			}else{
				if (y[i]>0) y[i]-=d[j],putchar('U');
				else y[i]+=d[j],putchar('D');
			}
		}
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
H = list(map(int,input().split()))
ma = H[0]-1
ans = "Yes"
for i in range(1,n):
    if H[i-1] < H[i]:
        H[i] += -1
    elif H[i] < H[i-1]:
        ans = "No"
        break
print(ans)



Measured memory_bytes: 14252
#![allow(unused_imports, dead_code, unused_variables, unused_mut)]
use std::cmp;
use std::mem::swap;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use permutohedron::LexicalPermutation;
use text_io::{read, scan};
use proconio::input;
const INF: i32 = std::i32::MAX;
const MOD: i32 = 1e9 as i32 + 7;

fn main() {
    input! {n: i32, a: [i64; n]};

    let mut a: Vec<i64> = a;

    let mut flg = false;

    let mut ans: i64 = 0;
    for i in 1..n as usize {
        if a[i - 1] > a[i] {
            ans += a[i - 1] - a[i];
            a[i] = a[i - 1];
        }
    }

    println!("{}", ans);

}

Measured memory_bytes: 5656
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int const L = 3e3 + 5;

int main() {
    int n;
    cin >> n;
    vector<int>l(n);
    for (int i = 0; i < n; ++i)
        cin >> l[i];
    sort(l.begin(), l.end());
    long long ans = 0;
    int low_bound[L];
    fill(low_bound, low_bound + L, -1);
    for (int i = 0; i < n; ++i) {
        low_bound[l[i]] = i;
    }

    for (int i = 0; i < L - 1; ++i)
        if (low_bound[i + 1] == -1)
            low_bound[i + 1] = low_bound[i];

    for (int i = 0; i + 2 < n; ++i) {
        for (int j = i + 1; j + 1 < n; ++j) {
            int k = low_bound[l[j] + l[i] - 1];
            if (k == -1 || j == k)
                continue;
            ans += max(0, k - j);
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/B-ColoringEasy.py
#
w, h, n = map(int, input().split())
dots = [[0] * w for i in range(h)]

for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        for i in range(len(dots)):
            for j in range(x):
                dots[i][j] = 1
    elif a == 2:
        for i in range(len(dots)):
            for j in range(x, w):
                dots[i][j] = 1
    elif a == 3:
        for i in range(y):
            dots[i] = [1]*w
    else:
        for i in range(y, h):
            dots[i] = [1]*w


cnt = 0
for i in range(h):
    cnt += dots[i].count(0)

print(cnt)


Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <iterator>
#include <cmath>
#include <iomanip>
#include <cassert>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	double N;
	cin >> N;
	N /= 3.0;
	N = pow(N, 3.0);
	cout << fixed << setprecision(8) << N;
}

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

using namespace std;

typedef long long int ll;
typedef pair<int,int> ii;

const int N = 1e5 + 5;

int n,m;
string s,t;

inline int gcd(int x,int y) {
  if (y == 0)
    return x;
  return gcd(y,x % y);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> n >> m >> s >> t;
  s = '%' + s;
  t = '%' + t;
  if (n < m) {
    swap(n,m);
    swap(s,t);
  }
  if (n % m != 0) {
    int flag = 1;
    ll ans = 1ll * n * m / gcd(n,m),x,y;
    x = ans / n;
    y = ans / m;
    // cout << x << " " << y << "\n";
    for (int i = 1 ; i <= ans / (x * y) ; i++)
      if (s[1 + (i - 1) * y] != t[1 + (i - 1) * x])
        flag = 0;
    if (flag)
      cout << ans << endl;
    else
      cout << "-1\n";
  }
  else {
    int flag = 1;
    for (int i = 1 ; i <= n ; i += n / m)
      if (s[i] != t[i / (n / m) + 1])
        flag  = 0;
    if (flag)
      cout << n << endl;
    else
      cout << "-1\n";
  }
}

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	int N;
	set<char> s;

	cin >> N;
	char in;
	for(int i = 0; i < N; i++){
		cin >> in;
		s.insert(in);
	}

	if(s.size() == 3)
		cout << "Three" << endl;
	else
		cout << "Four" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  unsigned long int H, W;
  cin >> H >> W;
  if (H == 1 || W == 1)
  {
    cout << 1 << endl;
  }
  else
  {
    cout << (H * W + 1) / 2 << endl;
  }
}

Measured memory_bytes: 256
<?php
    $N = intval(trim(fgets(STDIN)));
    
    for($i=1;$i<=$N;$i++){
        list($a,$b) = array_map('intval',explode(" ",trim(fgets(STDIN))));
        
        $info[$i] = [$b,$a]; 
    }
    //締め切り順に並べる
    asort($info);
    
    $sum=0;
    foreach($info as $value){
        $sum += $value[1];
        if($value[0]<$sum){
            // echo $sum."\n";
            echo "No";
            exit;
        }
    }
    echo "Yes";
    
    
    
    
    
    
    
    
    
?>

Measured memory_bytes: 101848
S=input()
ans = 1
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "L":
            ans = 0
            break
    else:
        if S[i] == "R":
            ans = 0
            break
if ans:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61884
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

L = [[0 for _ in range(w)] for _ in range(h)]
R = [[0 for _ in range(w)] for _ in range(h)]
D = [[0 for _ in range(w)] for _ in range(h)]
U = [[0 for _ in range(w)] for _ in range(h)]

for i in range(h):
    if s[i][0] == '.':
        L[i][0] = 1
    for j in range(1, w):
        if s[i][j] == '.':
            L[i][j] = L[i][j-1] + 1
    if s[i][w-1] == '.':
        R[i][w-1] = 1
    for j in range(w-2, -1, -1):
        if s[i][j] == '.':
            R[i][j] = R[i][j+1] + 1

for j in range(w):
    if s[0][j] == '.':
        U[0][j] = 1
    for i in range(1, h):
        if s[i][j] == '.':
            U[i][j] = U[i-1][j] + 1
    if s[h-1][j] == '.':
        D[h-1][j] = 1
    for i in range(h-2, -1, -1):
        if s[i][j] == '.':
            D[i][j] = D[i+1][j] + 1

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)

print(ans)

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

#define ll long long
#define pb push_back
#define N 1000000007
#define pll pair<ll,ll>
#define fill_nums(A,n) for(int i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(int i=0;i<m;i++) {int a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(int i=0;i<m;i++) {int a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}

int main() {
    
	ll n; cin>>n;
	vector<ll> A(n,0);

	fill_nums(A,n);
	vector<vector<pll>> dp(n, vector<pll>(n,{0,0}));

	for(int i=n-1;i>=0;i--) {
		for(int j=i;j<n;j++) {
			dp[i][j].first = max((i+1<n ? dp[i+1][j].second : 0) + A[i], (j-1>=0 ? dp[i][j-1].second : 0) + A[j]);
			if(i==n-1) dp[i][j].second=0;
			else dp[i][j].second = min((i+1<n ? dp[i+1][j].first : INT_MAX), (j-1>=0 ? dp[i][j-1].first : INT_MAX));
		}
	}

	cout<<dp[0][n-1].first-dp[0][n-1].second<<endl;

    return 0;
}




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

int main()
{
    long long k,a,d,p=0,l,m,b,i,j;
    cin>>k>>a>>b;
    l=a/k;
    m=b/k;
    for(i=l;i<=m+1;i++){
        d=i*k;
       // cout<<d<<endl;
        if(d>=a && d<=b){
            p=1;
            break;
        }
    }
    if(p==1)
        cout<<"OK"<<endl;
    else
        cout<<"NG"<<endl;
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int x = ri(), y = ri(), z = ri();
	int n = ri(), m = ri();
	int s = ri() - 1, t = ri() - 1;
	std::vector<int> hen[x + y + z + n + m];
	for (int i = 0; i < n; i++) {
		int a = ri() - 1;
		int b = ri() - 1 + x;
		int t = x + y + z + i;
		hen[t].push_back(a);
		hen[t].push_back(b);
		hen[a].push_back(t);
		hen[b].push_back(t);
	}
	for (int i = 0; i < m; i++) {
		int a = ri() - 1 + x;
		int b = ri() - 1 + x + y;
		int t = x + y + z + n + i;
		hen[t].push_back(a);
		hen[t].push_back(b);
		hen[a].push_back(t);
		hen[b].push_back(t);
	}
	std::vector<int> dist(x + y + z + n + m, 1000000000);
	std::queue<int> que;
	que.push(x + y + z + s);
	dist[x + y + z + s] = 0;
	while (que.size()) {
		int cur = que.front();
		que.pop();
		for (auto j : hen[cur]) {
			if (dist[j] > dist[cur] + 1) {
				dist[j] = dist[cur] + 1;
				que.push(j);
			}
		}
	}
	int res = dist[x + y + z + n + t];
	std::cout << (res == 1000000000 ? -1 : res / 2) << std::endl;
	return 0;
}




Measured memory_bytes: 29780
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>

using namespace std;


#include <math.h> 


int main() {

	int H, W, K;
	cin >> H >> W >> K;
	
	vector<vector<char>> matrix(H,vector<char>(W)), matrix2(H, vector<char>(W));

	int64_t result = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> matrix[i][j];
		}
	}

	for (int64_t i = 0; i < (1 << H + W); i++) {
		matrix2 = matrix;
		int black = 0;
		for (int64_t j = 0; j < H + W; j++) {
			if (1 & i >> j) {

				if (j < H) {
					for (int k = 0; k < W; k++) {
						matrix2[j][k] = 'R';
					}
				}
				else {
					for (int k = 0; k < H; k++) {
						matrix2[k][j-H] = 'R';
					}

				}

			}

		}

		for (int j = 0; j < H; j++) {
			for (int k = 0; k < W; k++) {
				if (matrix2[j][k] == '#') {
					black++;

				}
			}
		}
		if (black == K) {
			result++;
		}


	}
	cout << result++;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A;
  cin >> N >> A;
  
  if (500 > N && A >= N) {
    cout << "Yes" << endl;
  }
  
  else if (N % 500 <= A) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
  
}

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

ll h;

ll dfs(ll x)
{
	if(x == 1) return 1;
	else return 2ll * dfs(x / 2) + 1;
}

int main()
{
	
	std::ios::sync_with_stdio(false);cin.tie(0);
	cin >> h;
	cout << dfs(h) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int a, b;
    cin >> a >> b;
    cout << (a + b + 1) / 2 << endl;
    return 0;
}





Measured memory_bytes: 256
#include<iostream>
#include<string>
//#include<array>
#include<algorithm>
//#include<deque>
#include<vector>
//#include<utility>
//#include<set>
//#include<map>
//#include<list>

int main(void) {
	using namespace std;
	int N, A, B;
	cin >> N >> A >> B;
	A = A * N;
	if (A > B) {
		cout << B << endl;
	}else{
		cout << A << endl;
	}
}

Measured memory_bytes: 256
s = input()
q = int(input())
par = 0
pre = ""
pos = ""

for i in range(q):
  t = input().split()
  if t[0] == "1":
    par += 1
  elif (par + int(t[1]))%2 == 1:
    pre = t[2] + pre
  else:
    pos = pos + t[2]
    
ans = pre + s + pos

if par%2 == 0:
  print(ans)
else:
  print(ans[::-1])


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

using namespace std;
const int N = 6e3 + 3;
int M[N];
bool mark[N];
string dp[N];
vector <int> v[2];

int main() {
    int n; cin >> n;
    string s; cin >> s;
    for (int i = 0; i < 2 * n; i++) v[s[i] - 'a'].push_back(i);
    for (int i = 0; i < n; i++) M[v[0][i]] = v[1][i], M[v[1][i]] = v[0][i];
    for (int i = 2 * n - 1; i >= 0; i--) {
        if (s[i] == 'a' && M[i] > i) dp[i] = "ab" + dp[M[i] + 1];
        if (s[i] == 'b' && M[i] > i) {
            memset(mark, 0, sizeof mark);
            string res = "";
            int lst = M[i];
            mark[i] = mark[M[i]] = 1;
            for (int j = i; j <= lst; j++) {
                if (s[j] == 'b' && M[j] > j) mark[j] = mark[M[j]] = 1, lst = M[j];
                if (mark[j]) res += s[j];
            }
            dp[i] = res + dp[lst + 1];
        }
        dp[i] = max(dp[i], dp[i + 1]);
    }
    cout << dp[0] << "\n";
}


Measured memory_bytes: 20212
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

struct UnionFind{
	vector<int> par;
  	
  	UnionFind(int n): par(n,-1){}
  	void init(int n){ par.assign(n,-1);}
  	
  	int root(int x){
    	if(par[x]<0)return x;
      	else return par[x]=root(par[x]);
    }
  
  	bool issame(int x,int y){
    	return root(x)==root(y);    
    }
  
  	bool merge(int x,int y){
    	x = root(x);
      	y = root(y);
      	
      	if(x == y)return false;
      	if(par[x]>par[y])swap(x,y);
      	par[x] += par[y];
      	par[y]= x;
      	return true;

    }
    
    int size(int x){
    	return -par[root(x)];
    }

};

int main(){
	long long N, M; 
  	cin >> N >> M;
  	vector<int> A(M), B(M);
  	for(int i = 0; i < M ; ++i){
    	cin >> A[i] >> B[i], --A[i], --B[i];
    }
  	
  	UnionFind uf(N);
  	long long cur = N*(N-1)/2;
  	vector<long long> res;
  	for(int i=0; i<M;++i){
    	res.push_back(cur);
    	
    	int a = A[M-1-i], b = B[M-1-i];
      	if(uf.issame(a,b))continue;
      	
      	long long sa = uf.size(a), sb = uf.size(b);
      	cur -= sa*sb;
      	uf.merge(a,b);
    }
  	
	reverse(res.begin(),res.end());
  	for(int i = 0; i<res.size();++i)cout << res[i]<<endl;
}





Measured memory_bytes: 3444
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main()
{
	char s[101];
	char t[101];
	int N;
	int ans;
	
	std::cin >> N;
	std::cin >> s;
	std::cin >> t;
	
	ans = N*2;
	
	for(int i = 0; i < N; i++)
	{
		if(!strncmp(&s[i], t, N-i))
		{
			ans = N + i;
			break;
		}
	}

	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;

// int MOD = 998244353;
int MOD = 1000000007;

signed main(){
    
    ll n;
    cin >> n;
    ll ans = 0;
    vector<ll> v(n);
    vector<ll> c(n);
    rep(i,n)cin >> v[i];
    rep(i,n)cin >> c[i];
    rep(i,n){
        if(v[i]-c[i] > 0)ans += v[i]-c[i];
    }
    cout << ans << endl;
    
    
    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://jsc2019-qual.contest.atcoder.jp/tasks/jsc2019_qual_a
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc125.contest.atcoder.jp/tasks/abc125_a


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int a,b,ans = 0;
    cin >> a >> b;
    for(int i = a; i <= b; i++){
        if(i / 10000 == i % 10 and (i/1000) % 10 == (i/10)%10) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;

// int N = 7;
int N;

int main() {
    cin >> N;
    int ans = 0;
    int max_number = 1;
    for (int i = 1; i <= N; i++) {
        int tmp = 0;
        int target = i;
        while (target % 2 == 0) {
            target = target / 2;
            tmp++;
        }
        // cout << tmp << endl;
        if (ans < tmp) {
            ans = tmp;
            max_number = i;
        }
        // printf("%d %d %d\n", i, tmp, ans);
    }
    cout << max_number << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	long long int t1, t2;
	scanf("%lld %lld", &t1, &t2);
	long long int a1, a2;
	scanf("%lld %lld", &a1, &a2);
	long long int b1, b2;
	scanf("%lld %lld", &b1, &b2);
	if (a1 * t1 + a2 * t2 == b1 * t1 + b2 * t2)
	{
		printf("infinity\n");
		return 0;
	}
	if (a1 * t1 + a2 * t2 < b1 * t1 + b2 * t2)
	{
		a1 ^= b1;
		b1 ^= a1;
		a1 ^= b1;
		a2 ^= b2;
		b2 ^= a2;
		a2 ^= b2;
	}
	if (a1 > b1)
	{
		printf("0\n");
		return 0;
	}
	long long int d = a1 * t1 + a2 * t2 - b1 * t1 - b2 * t2;
	long long int ans = 1;
	ans += 2 * (((b1 - a1) * t1 - 1) / d);
	if ((b1 - a1) * t1 % d == 0)ans++;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
using namespace std;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int x,a,b;
	cin>>x>>a>>b;
	if(abs(x-a)<abs(x-b))cout<<"A"<<endl;
	else cout<<"B"<<endl;
	
	return 0;
}

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

#define CIN2(a,b) long long a,b;cin >> a >> b;
#define CIN3(a,b,c) long long a,b,c;cin >> a >> b >> c;
#define rep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)

int main(){
    CIN2(n,q)
    string s;cin >> s;
    vector<int> v;
    v.push_back(-1e6);
    bool ready = false;
    rep(i,n){
        switch (s[i])
        {
            case 'A':
                ready = true;
                break;
            case 'C':
                if(ready){v.push_back(i);}
                ready = false;
                break;
            default:
                ready = false;
                break;
        }
    }
    v.push_back(1e6);
    //rep(i,v.size()) cout << v[i] << endl;
    rep(i,q){
        int l,r;cin >> l >> r; 
        auto itr1 = lower_bound(v.begin(),v.end(),l);
        auto itr2 = lower_bound(itr1,v.end(),r);
        int ans = distance(v.begin(),itr2) - distance(v.begin(),itr1);
        
        cout << ans << endl;
    }

}



Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
int main() {
    string n;
  	cin>>n;
  	int sum = 0;
  	for(char ch:n){
      	sum+=ch-'0';
    }
	if(sum%9 == 0)cout<<"Yes";
    else cout<<"No";
  	return 0;
}

Measured memory_bytes: 3708
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}


int main(){
  ll a,b; cin >> a >> b;
  cout << a + b/2 << endl;
}

Measured memory_bytes: 256
/*やったぜ。　投稿者：変態糞土方 (8月16日（水）07時14分22秒)

昨日の8月15日にいつもの浮浪者のおっさん（60歳）と先日メールくれた汚れ好きの土方のにいちゃん

（45歳）とわし（53歳）の3人で県北にある川の土手の下で盛りあったぜ。

今日は明日が休みなんでコンビニで酒とつまみを買ってから滅多に人が来ない所なんで、

そこでしこたま酒を飲んでからやりはじめたんや。

3人でちんぽ舐めあいながら地下足袋だけになり持って来たいちぢく浣腸を3本ずつ入れあった。

しばらくしたら、けつの穴がひくひくして来るし、糞が出口を求めて腹の中でぐるぐるしている。

浮浪者のおっさんにけつの穴をなめさせながら、兄ちゃんのけつの穴を舐めてたら、

先に兄ちゃんがわしの口に糞をドバーっと出して来た。

それと同時におっさんもわしも糞を出したんや。もう顔中、糞まみれや、

3人で出した糞を手で掬いながらお互いの体にぬりあったり、

糞まみれのちんぽを舐めあって小便で浣腸したりした。ああ～～たまらねえぜ。

しばらくやりまくってから又浣腸をしあうともう気が狂う程気持ちええんじゃ。

浮浪者のおっさんのけつの穴にわしのちんぽを突うずるっ込んでやると

けつの穴が糞と小便でずるずるして気持ちが良い。

にいちゃんもおっさんの口にちんぽ突っ込んで腰をつかって居る。

糞まみれのおっさんのちんぽを掻きながら、思い切り射精したんや。

それからは、もうめちゃくちゃにおっさんと兄ちゃんの糞ちんぽを舐めあい、

糞を塗りあい、二回も男汁を出した。もう一度やりたいぜ。

やはり大勢で糞まみれになると最高やで。こんな、変態親父と糞あそびしないか。

ああ～～早く糞まみれになろうぜ。

岡山の県北であえる奴なら最高や。わしは163*90*53,おっさんは165*75*60、や

糞まみれでやりたいやつ、至急、メールくれや。

土方姿のまま浣腸して、糞だらけでやろうや。*/
#include "bits/stdc++.h"
#include <numeric>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define llMIN numeric_limits<long long>::min()
#define intMIN numeric_limits<int>::min()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
struct data{
  int loc;
  ll num;
};
//階乗
vl facs(1000000,-1);
ll Factrial(ll num){
  if(facs[num]!=-1){
    return facs[num];
  }
  if(num==1||num<=0){
    return 1;
  }else if(num<0){
    printf("ERROR_minus\n");
    return 0;
  }else{
    facs[num]=(num*Factrial(num-1))%d9_7;
    return facs[num];
  }
}


long long modinv(long long a, long long m) {//modの逆元
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
ll linercomb(ll n,ll k, ll mod){//n,kの線形時間で求める
  ll ans=Factrial(n);
  ans*=modinv(Factrial(n-k),mod);
  ans%=d9_7;
  ll k1=Factrial(k);
  k1%=mod;
  ans*=modinv(k1,mod);
  ans%=mod;
  return ans;
}
int main(void){
  ll n,k;
  cin>>n>>k;
  vl a(n);
  map<ll,int> nums;
  rep(i,n){
    cin>>a[i];
    nums.insert({a[i],0});
  }
  rep(i,n){
    nums[a[i]]++;
  }
  sort(a.begin(),a.end());
  ll minsum=0;
  rep(i,n){
    ll num=(n-i-1);
    //cout<<a.end()-upper_bound(a.begin(),a.end(),a[i])<<endl;
    nums[a[i]]++;
    if(num>=k-1){
      minsum+=linercomb(num,k-1,d9_7)*a[i];
    }
    minsum%=d9_7;
  }
  ll maxsum=0;
  for(auto i:nums){
    i.second=0;
  }
 // cout<<linercomb(5,2,d9_7)<<endl;
  rep(i,n){
    ll num=(i);
    nums[a[i]]++;
    if(num>=k-1){
      maxsum+=linercomb(num,k-1,d9_7)*a[i];
    }
    maxsum%=d9_7;
  }
  cout<<(2*d9_7+maxsum-minsum)%d9_7<<endl;
  return 0;
}


Measured memory_bytes: 17536
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a % b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }
// 桁和
LL Ketawa_s(string s) { LL a = 0; FOR(i, 0, s.length())a += s[i] - '0'; return a; }

//二項係数 nCk mod pを求める
const LL MAX = 510000, p = 998244353; LL fac[MAX], finv[MAX], inv[MAX];
/* 前処理 */void COM_init() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; FOR(i, 2, MAX) { fac[i] = fac[i - 1] * i % p; inv[i] = p - inv[p % i] * (p / i) % p; finv[i] = finv[i - 1] * inv[i] % p; } }
/* 主処理 */LL COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % p) % p; }

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

// -------------------------------------------------------------------------------

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	// この問題の解説はPDFだとよく分からないのでYouTubeを見たほうが良い。

	LL X;
	cin >> X;

	if (X == 7 || X == 5 || X == 3) {
		O("YES");
	}
	else {
		O("NO");
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)
#define MAX 101
#define INF (int)1e5

int path[MAX][MAX];

void solve(void){
    int n, m;
    cin >> n >> m;
    rep(n, i) rep(n, j) if(i != j) path[i][j] = INF; else path[i][j] = 0;
    int as[m], bs[m], cs[m];
    rep(m, i) {
        scanf("%d%d%d\n", &as[i], &bs[i], &cs[i]);
        as[i]--; bs[i]--;
        path[as[i]][bs[i]] = min(path[as[i]][bs[i]], cs[i]);
        path[bs[i]][as[i]] = min(path[bs[i]][as[i]], cs[i]);
    }
    //WF
    rep(n, k) rep(n, i) rep(n, j) path[i][j] = min(path[i][j], path[i][k]+path[k][j]);
    int ans = m;
    rep(m, k){
        bool flag = false;
        rep(n, i) if (path[i][as[k]] == path[i][bs[k]] + cs[k]) {
            flag = true; break;
        }
        if (flag) ans--;
    }
    cout << ans << '\n';
}

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


Measured memory_bytes: 256
N,M=map(int,input().split())
A=list(map(int,input().split()))
a=0
for i in A:
    a+=i
b=a/(4*M)
c=0
for n in range(0,N):
    if A[n]>=b:
        c+=1
if c>=M:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 9184
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <deque>
#include <complex>
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define REP(i,a) FOR(i,0,a)
#define X real() 
#define Y imag() 
using namespace std;
typedef complex<int> cli;
typedef vector<cli> vcl;
typedef vector<int> vi;
int num=0;
int ans=0;
int direct[40][4];
void search(int now,int reach){
	if(now==0){
		if(reach+1==2<<num)
			ans++;
		
		return;
	}
	REP(i,4){
		int next=direct[now][i];
		while((next!=-1) && (1<<next & (reach|1) )) next=direct[next][i];
		if(next!=-1)
			search(next,reach+(1<<next ));
		int bn=next;
		next=direct[now][i];
		while((next!=-1) && (1<<next & reach )) next=direct[next][i];
		if(next!=-1 && bn!=next)
			search(next,reach+(1<<next ));

	}
}
int main() {
	int m,n;
	while(cin >> m >> n && n){
	ans=0;
	num=0;
	vi edge[40];	
	int maps[11][11]={};
	REP(i,n)
		REP(j,m){
			cin >> maps[i][j];
			if(maps[i][j]==2){
				maps[i][j]=0;
			}
			else if(maps[i][j]){
				maps[i][j]=++num;
			}
			else 
				maps[i][j]=-1;
		}
	int nx,ny[11]={};
	REP(i,11)
		ny[i]=-1;
	REP(i,40)
		REP(j,4)
			direct[i][j]=-1;
	REP(i,n){
		nx=-1;
		REP(j,m){
			if(maps[i][j]>=0){
				if(nx>=0){
					edge[maps[i][j]].push_back(maps[i][nx]);
					edge[maps[i][nx]].push_back(maps[i][j]);
					direct[maps[i][j]][3]=maps[i][nx];
					direct[maps[i][nx]][0]=maps[i][j];
				}
				nx=j;
				if(ny[j]>=0){
					edge[maps[i][j]].push_back(maps[ny[j]][j]);
					edge[maps[ny[j]][j]].push_back(maps[i][j]);
					direct[maps[i][j]][1]=maps[ny[j]][j];
					direct[maps[ny[j]][j]][2]=maps[i][j];
					
				}
				ny[j]=i;
			}
				
		}
	}
	REP(i,edge[0].size())
		search(edge[0][i],1<<edge[0][i]);
		cout <<ans << endl;
	// your code goes here
	}
	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int a,b;
    int cnt=0;
    cin >> a >> b;
    int s =b;
    while(s>0){
        s = s/10;
        cnt++;
    }
    a *= pow(10,cnt);
    int d = a+b;
    
    bool hantei=false;
    rep(i,10000){
        if(d == i*i) hantei =true;
    }
    if(hantei) cout << "Yes"<<endl;
    else    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cmath>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	string s,w;
	cin>>s;
	int a,sum=0,mi=1000;
	for(int i=0;i<s.length()-2;i++){
		w=s.substr(i,3);
		a=stoi(w);
		mi=min(mi,abs(a-753));
	}
	cout<<mi<<endl;

	return 0;
}



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

int main(){
	int n,num;
	map<string,int> MAP;
	string tmp;
	for(cin>>n;n>0;n--){
		cin>>tmp>>num;
		while(tmp.size()<5)tmp=" "+tmp;
		MAP[tmp]+=num;
	}
	map<string, int>::iterator it = MAP.begin();
	while( it != MAP.end() ){
		tmp=(*it).first ;
		for(int i=0;i<5;i++)if(tmp[i]!=' ')cout<<tmp[i];
		cout <<" " << (*it).second << endl;
		++it;
	}
	
	
	return 0;
}


Measured memory_bytes: 1224
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    cout << (*max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end())) << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#include <bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    ll a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    vector<ll>s,t;
    for(int i = 0; i <= f; i++){
        for(int j = 0; 100*a*i+100*b*j <= f; j++){
            s.push_back(100*a*i+100*b*j);
        }
    }
    for(int i = 0; i <= f; i++){
        for(int j = 0; c*i+d*j <= f; j++){
            t.push_back(c*i+d*j);
        }
    }
    s.erase(s.begin());
    t.erase(t.begin());
    double k = 0;
    double res[2] = {};
    for(auto x:s){
        for(auto y:t){
            if(x+y>f)continue;
            double temp = (double)y/(x+y);
            if(temp <= (double)e/(100+e) and temp > k){
                k = temp;
                res[0] = x + y;
                res[1] = y;
            }
        }
    }
    if(res[0])cout << res[0] << " " << res[1] << endl;
    else cout << 100*a << " " << 0 << endl;
}

Measured memory_bytes: 2420
use std::io;

fn main() {
    loop {
        let mut line = String::new();
        io::stdin().read_line(&mut line).ok();
        let mut string = line.trim().to_string();

        if string == "-" { break }

        let mut line = String::new();
        io::stdin().read_line(&mut line).ok();
        let m = line.trim().parse::<usize>().unwrap();

        for _ in 0..m {
            let mut line = String::new();
            io::stdin().read_line(&mut line).ok();
            let h = line.trim().parse::<usize>().unwrap();
            let head = string.drain(..h).collect::<String>();
            string.push_str(&head);
        }
        println!("{}", string);
    }
}



Measured memory_bytes: 5040
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=100005;
//i_am_noob
int a,b,n,x;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> a >> b >> n;
	x=min(b-1,n);
	print1(a*x/b);
	return 0;
}

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

int main(){
    int N,M,C;
    cin >> N >> M >> C;
    
    vector<int> vec(M);
    
    for (int i = 0; i < M; i++) {
        cin >> vec.at(i);
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int k = 0;
        for (int j = 0; j < M; j++) {
            int l;
            cin >> l;
             k += l*vec.at(j);
        }
         if(k + C > 0) ++ans;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>

long long  INF=1000000000000000000;
long long mod=1000000007;

using namespace std;

long long change(int k,int N,long long s[],long long A[]){
    long long ans=0;
    
    for(int i=1;i<=N;i++){
        s[i]=s[i-1]+A[i-1];
        if(i%2==k){
            if(s[i]>0){
                ans+=s[i]+1;
                s[i]=-1;
            }
            else if(s[i]==0){
                ans++;
                s[i]=-1;
            }
        }
        else{
            if(s[i]<0){
                ans+=abs(s[i])+1;
                s[i]=1;
            }
            else if(s[i]==0){
                ans++;
                s[i]=1;
    
            }
        }
    }
    return ans;
}
int main(){
    int N;
    cin>>N;
    long long s1[100001];
    long long s2[100001];
    long long A[100001];
    s1[0]=0;
    s2[0]=0;
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    long long ans=0;
    
    

    ans=min(change(1,N,s1,A),change(0,N,s2,A));

    cout<<ans<<endl;
 return 0;
}

Measured memory_bytes: 2560
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
 
LL pos[2][100005];
 
void solve(LL id,LL num){
	LL sgn = 1,tmp = num;
	if(num < 0) sgn = -1,tmp = -num;
	for(LL i = 0;i <= 19;i ++){
		pos[id][i] = tmp % 3;
		tmp /= 3;
	}
	for(LL i = 0;i <= 19;i ++){
		if(pos[id][i] == 2 || pos[id][i] == -2){
			pos[id][i + 1] += pos[id][i] / 2;
			pos[id][i] = - pos[id][i] / 2;
		}
		else if(pos[id][i] == 3 || pos[id][i] == -3){
			pos[id][i + 1] += pos[id][i] / 3;
			pos[id][i] = 0;
		}
	}
	for(LL i = 0;i <= 19;i ++) pos[id][i] *= sgn;
}
 
char ch[45];
LL x[100005],y[100005],exs[2] = {0};
 
LL pwr(LL x,LL y){
	LL ret = 1;
	while(y --) ret *= x; return ret;
}
 
int main(){
	LL n;
	cin >> n;
	for(LL i = 1;i <= n;i ++){
		cin >> x[i] >> y[i];
		exs[(x[i] + y[i]) & 1] = 1;
	}
	if(exs[0] && exs[1]){ cout << -1 << endl; return 0; }
	if(exs[0]){
		cout << 40 << endl;
		for(LL i = 0;i <= 19;i ++) cout << pwr(3LL,i) << ' ' << pwr(3LL,i) << (i == 19 ? '\n' : ' ');
	}
	if(exs[1]){
		cout << 39 << endl;
		for(LL i = 0;i <= 18;i ++) cout << pwr(3LL,i) << ' ' << pwr(3LL,i) << ' ';
		cout << pwr(3LL,19) << endl;
	}
	
	for(LL i = 1;i <= n;i ++){
		solve(0,x[i]); solve(1,y[i]);
		for(LL j = 0;j <= 18;j ++){
			if(pos[0][j] == -2){ pos[0][j] = 1; pos[0][j + 1] --; }
			if(pos[1][j] == -2){ pos[1][j] = 1; pos[1][j + 1] --; }
			if(pos[0][j] == 2){ pos[0][j] = -1; pos[0][j + 1] ++; }
			if(pos[1][j] == 2){ pos[1][j] = -1; pos[1][j + 1] ++; }
			
			if(pos[0][j] && pos[1][j]){
				ch[j << 1] = (pos[0][j] == 1 ? 'R' : 'L');
				ch[(j << 1) + 1] = (pos[1][j] == 1 ? 'U' : 'D');
			}
			if(!pos[0][j] && !pos[1][j]){ ch[j << 1] = 'L'; ch[(j << 1) + 1] = 'R'; }
			if(pos[0][j] && !pos[1][j]){
				if(pos[0][j] == 1){ pos[0][j] = -2; pos[0][j + 1] ++; ch[j << 1] = ch[(j << 1) + 1] = 'L'; }
				if(pos[0][j] == -1){ pos[0][j] = 2; pos[0][j + 1] --; ch[j << 1] = ch[(j << 1) + 1] = 'R';  }
			}
			if(!pos[0][j] && pos[1][j]){
				if(pos[1][j] == 1){ pos[1][j] = -2; pos[1][j + 1] ++; ch[j << 1] = ch[(j << 1) + 1] = 'D'; }
				if(pos[1][j] == -1){ pos[1][j] = 2; pos[1][j + 1] --; ch[j << 1] = ch[(j << 1) + 1] = 'U';  }
			}
		}
		if(pos[0][19] && !pos[1][19]) ch[38] = (pos[0][19] == 1 ? 'R' : 'L');
		if(!pos[0][19] && pos[1][19]) ch[38] = (pos[1][19] == 1 ? 'U' : 'D');
		if(!pos[0][19] && !pos[1][19]) ch[38] = 'R',ch[39] = 'L';
		if(pos[0][19] && pos[1][19]) ch[38] = (pos[0][19] == 1 ? 'R' : 'L'),ch[39] = (pos[1][19] == 1 ? 'U' : 'D');;
		cout << ch << endl;
	}
	return 0;
}

Measured memory_bytes: 256
A = int(input())
ans_list = []
i = A
while i != 1:
    i = i//2
    ans_list.append(i)
B = len(ans_list)
a = 3
for i in range(1,B):
    a = a * 2 + 1
if A == 1:
    print(1)
else:
    print(a)

Measured memory_bytes: 3060