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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct SegmentTree {
  vector<Pi> data;
  int n, sz;
  SegmentTree(const vint& a) {
    n = a.size();
    sz = 1; while(sz < n) sz <<= 1;
    data.resize(2*sz-1, Pi(inf, inf));
    rep(i, n) data[i+sz-1] = Pi(a[i], i);
    for(int i = sz-2; i >= 0; --i) data[i] = min(data[2*i+1], data[2*i+2]);
  }
  Pi query(int a, int b, int k, int l, int r) {
    if(r <= a || b <= l) return Pi(inf, inf);
    if(a <= l && r <= b) return data[k];
    Pi vl = query(a, b, 2*k+1, l, (l+r)/2);
    Pi vr = query(a, b, 2*k+2, (l+r)/2, r);
    return min(vl, vr);
  }
  Pi query(int a, int b) {
    return query(a, b, 0, 0, sz);
  }
};

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

  int n;
  cin >> n;
  vint even, odd;
  rep(i, n) {
    int a;
    cin >> a;
    int b = inf;
    if(i&1) swap(a, b);
    even.push_back(a);
    odd.push_back(b);
  }

  SegmentTree eseg(even), oseg(odd);
  /*
  priority_queue<Tapris, vector<Tapris>, greater<Tapris> > que;
  function<void(int, int, int, bool)> dfs = [&](int l, int r, int d, bool ok) {
    if(l+1 >= r) return;
    //cout<<d<<" "<<l<<" "<<r<<endl;
    Pi p = (ok ? eseg : oseg).query(l, r);
    Pi q = (ok ? oseg : eseg).query(p.second, r);
    que.emplace(d, p.first, q.first);
    dfs(l, p.second, d+1, ok);
    dfs(p.second+1, q.second, d+1, !ok);
    dfs(q.second+1, r, d+1, ok);
  };
  dfs(0, n, 0, true);

  vint ans;
  while(!que.empty()) {
    Tapris p = que.top(); que.pop();
    int a, b, c;
    tie(a, b, c) = p;
    ans.push_back(b);
    ans.push_back(c);
  }
  rep(i, ans.size()) cout << ans[i] << " \n"[i==(int)ans.size()-1];
  */

  priority_queue<Tapris, vector<Tapris>, greater<Tapris> > que;
  que.emplace(eseg.query(0, n).first, 0, n);
  vint ans;
  while(!que.empty()) {
    Tapris tap = que.top(); que.pop();
    int vl, l, r;
    tie(vl, l, r) = tap;
    Pi p = (l%2 ? oseg : eseg).query(l, r);
    Pi q = (l%2 ? eseg : oseg).query(p.second, r);
    ans.push_back(p.first);
    ans.push_back(q.first);
    int nl = p.second;
    int nr = q.second;
    if(l+1 < nl) que.emplace((l%2 ? oseg : eseg).query(l, nl).first, l, nl);
    if(nl+1+1 < nr) que.emplace(((nl+1)%2 ? oseg : eseg).query(nl+1, nr).first, nl+1, nr);
    if(nr+1+1 < r) que.emplace(((nr+1)%2 ? oseg : eseg).query(nr+1, r).first, nr+1, r);
  }
  rep(i, n) cout << ans[i] << " \n"[i==n-1];

  return 0;
}


Measured memory_bytes: 25828
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REPR(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define FOR(i, x, n) for (int i = x; i < (int)(n); ++i)
#define ALL(n) begin(n), end(n)
#define ll long long
#define INF 1e9
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    REP(i, n) cin >> p.at(i);

    sort(p.begin(), p.end());
    int sum = 0;
    REP(i, k) sum = sum + p.at(i);
    cout << sum << endl;
    return 0;
}

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

int main()
{
  string s;
  int cnt = 0;
  int i;
  cin >> s;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == 'x')
      cnt++;
  }
  if (cnt > 7)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main() {
    int tax8,tax10;
    int a,b;

    scanf("%d %d",&tax8,&tax10);

    for(int i = 1; i <= 10000; ++i){
        a = i * 0.08;
        b = i * 0.1;
        if(tax8 == a && tax10 == b){
            printf("%d",i);
            return 0;
        }
    }
    printf("-1");
    return 0;
}

int A(){
    char S[3];
    scanf("%s",&S);
    if(S[0] != S[1] || S[0] != S[2] || S[1] != S[2]){
        printf("Yes");
    }
    else{
        printf("No");
    }
    return 0;
}

int B(){
    long long int  N;
    long long int RED,BLUE;
    long long int count;

    scanf("%lld %lld %lld",&N,&RED,&BLUE);
    count = N /(RED+BLUE) ;
    if(N % (RED +BLUE) >=RED){
        printf("%lld",count*RED +RED);
    }
    else{
        printf("%lld",count*RED + (N%(RED +BLUE)) );
    }
    return 0;
}

Measured memory_bytes: 128
import math

n = int(input())

#Euler関数の性質
#1:pが素数のときEuler(p**k)=p**k-p**(k-1)
#2:gcd(m,n)=1のときEuler(mn)=Euler(m)*Euler(n)
def Euler(n):
    if n == 1 or n == 2:
        return 1
    else:
        a,b = 1,0
        for i in range(2,int(math.sqrt(n))+1):
            if n % i == 0:
                a = i #このときaが常に素数
                while n % a == 0:
                    n //= a
                    b += 1
                break
        if a == 1: #このときはnが素数
            return n-1
        else:
            return (a**b-a**(b-1))*Euler(n)

print(Euler(n))



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

#define  vt            vector
#define  db            long double
#define  int           long long
#define  pb            push_back
#define  inf           (int)1e20
#define  mxn           (int)2e5+5
#define  pii           pair<int,int>
#define  pq            priority_queue

#define  si(x)         (int)x.size()
#define  all(x)        x.begin(),x.end()
#define  mem(a,x)      memset(a,x,sizeof(a))
#define  forr(i,n)     for(int i=0;i<n;i++)

#define deb(x)   cout<<"> "<<#x<<" : "<<x<<endl
#define pnr(a)   for(auto x:a){cout<<x<<" ";}cout<<endl;
#define pnr2(a)  for(auto x:a){cout<<x.first<<" "<<x.second<<endl;}

int mainx()
{
	int n , k , x , y;
	cin >> n >> k >> x >> y;
	int ans = 0;
	if (n <= k)
		ans = x * n;
	else
	{
		ans = k * x + (n - k) * y;
	}
	cout << ans << endl;
	return 0;
}


inline void include() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt","w",stdout);
#endif
}
int32_t main() {
	
	ios::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
	//cout << fixed << setprecision(20);

	int tt = 1;
	//cin>>tt;
	for (int t = 1 ; t <= tt ; t++ )
	{
		mainx();
	}
	return 0 ;
}


Measured memory_bytes: 3628
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int n,a[100005];
    int k=0;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    for(int i=0; i<n;)
    {
        if(a[i]==a[i+1])
        {
            i+=2;
        }
        else
        {
            k++;
            i++;
        }
    }
    printf("%d\n",k);
    return 0;
}

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

int lift[60][200000];

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  ll n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> lift[0][i];
    lift[0][i]--;
  }
  for (int l = 1; l < 60; l++) {
    for (int i = 0; i < n; i++) {
      lift[l][i] = lift[l-1][lift[l-1][i]];
    }
  }
  int p = 0;
  for (int l = 0; l < 60; l++) {
    if (k>>l&1)
      p = lift[l][p];
  }
  cout << p+1 << endl;
}


Measured memory_bytes: 50516
from sys import stdin

def main():
    n,m = [int(x) for x in stdin.readline().split()]
    cards = [int(x) for x in stdin.readline().split()]
    cards.sort()

    bcs = [tuple(map(int,x.split())) for x in stdin.readlines()]
    bcs.sort(key=lambda x:x[1], reverse=True)

    ans = 0
    minIndex = 0
    isFinished = False

    for b,c in bcs:

        for _ in range(b):
            if minIndex < n and cards[minIndex] < c:
                ans += c
                minIndex += 1
            else:
                isFinished = True
                break
        
        if isFinished:
            break

    if minIndex < n:
        ans += sum(cards[minIndex:])

    print(ans)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 28384
#include<iostream>
using namespace std;
int main(){
    while(1){
    int a,b;
    char op;
    cin >>a >>op >>b;
    
    if (op == '+'){
        cout << a+b << endl;
    }else if (op == '-'){
        cout << a-b << endl;
    }else if (op == '*'){
        cout<< a*b <<endl;
        
    }else if (op == '/'){
        cout<< a/b <<endl;
        
    }else if (op == '?'){
        break;
    }
    
    }return 0;
}



Measured memory_bytes: 3112
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
i_plus_A = Counter([i + A[i] for i in range(N)])
i_minus_A = [i - A[i] for i in range(N)]
i_minus_A = [x for x in i_minus_A if x > 0]
print(sum(i_plus_A[x] for x in i_minus_A))

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

bool map[8][8];

char Solve(int x,int y){

  if(x!=7 && map[y][x+1]==1 && y!=7 && map[y+1][x]==1 && map[y+1][x+1]==1)
    return 'A';

  else if(y<=4&&map[y+1][x]==1&&map[y+2][x]==1&&map[y+3][x]==1)
    return 'B';

  else if(x<=4&&map[y][x+1]==1&&map[y][x+2]==1&&map[y][x+3]==1)
    return 'C';

  else if(x>0&&y<=5&&map[y+1][x]==1&&map[y+1][x-1]==1&&map[y+2][x-1]==1)
    return 'D';

  else if(y<7&&x<=5&&map[y][x+1]==1&&map[y+1][x+1]==1&&map[y+1][x+2]==1)
    return 'E';

  else if(x<7&&y<=5&&map[y+1][x]==1&&map[y+1][x+1]==1&&map[y+2][x+1]==1)
    return 'F';

  else
    return 'G';

}

int main(){

  char c;

  while(cin>>c){

    map[0][0]=c-'0';

    for(int i=1; i<8; i++){cin>>c;map[0][i]=c-'0';}
    for(int i=1; i<8; i++)for(int j=0; j<8; j++){cin>>c;map[i][j]=c-'0';}

    int i,j;
    for(i=0; i<8; i++){
      for(j=0; j<8; j++){
        if(map[i][j]==true)goto BREAK;
      }
    }
    BREAK:;

  //  for(int m=0;m<8;m++){for(int n=0;n<8;n++)cout<<map[m][n];cout<<endl;}

    cout << Solve(j,i) << endl;

  //  getchar();

  }


  return 0;

}

Measured memory_bytes: 1132
from operator import itemgetter
import collections
import math
import sys
import itertools
N,M = map(int,input().split())
nums = []
for i in range(M):
    P,Y = map(int,input().split())
    nums.append([P,Y,i])
nums.sort(key=itemgetter(1))
counter = collections.defaultdict(int)
anss= []
for i in nums:
    counter[i[0]]+=1
    ans = str(i[0]).zfill(6)+str(counter[i[0]]).zfill(6)
    anss.append([ans,i[2]])
anss.sort(key=itemgetter(1))
for ans in anss:
    print(ans[0])

Measured memory_bytes: 48660
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
    ll n;
    cin>>n;
    ll i,j;
    ll p[n];
    for(i=0;i<n;i++)cin>>p[i];
    ll mini=INF;
    for(i=1;i<101;i++)
    {
        ll tans=0;
        for(j=0;j<n;j++)
        { 
           tans+=(i-p[j])*(i-p[j]);
        }
        mini=min(mini,tans);
    }
    cout<<mini<<"\n";
}


int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


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


return 0;
}

Measured memory_bytes: 3628
import sys

l = [list(map(int, input().split())) for _ in range(3)]
a = [0] * 3
b = [0] * 3


def dfs(a, b, i):
    if i > 2:
        for j in range(3):
            for k in range(3):
                if j != k:
                    if a[j] + b[k] != l[j][k]:
                        return
        print("Yes")
        sys.exit()
    for a[i] in range(l[i][i] + 1):
        b[i] = l[i][i] - a[i]
        dfs(a, b, i + 1)

dfs(a, b, 0)
print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <string>
using namespace std;


int main()
{
	int arr[3];
	for (int i = 0; i < 3; i++) {
		cin >> arr[i];
	}

	int go = 0, nana = 0;
	for (int i = 0; i < 3; i++) {
		if (arr[i] == 5) {
			go++;
		}
		if (arr[i] == 7) {
			nana++;
		}
	}

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

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)    for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define rrep(i, n)   for(int i=(n-1); i>=0; --i)
#define all(v)       v.begin(), v.end()
#define rall(v)      v.rbegin(), v.rend()
#define int          long long
template<typename T>
using vv  = vector<vector<T>>;
using vi  = vector<int>;
using vvi = vector<vector<int>>;
using P   = pair<int, int>;
using ll  = long long;
constexpr ll INF = 1LL << 60;

signed main(){

    int n;
    cin >> n;
    map<int, int> mp;
    vector<int> a(n);
    int sum = 0;
    rep(i, n){
        cin >> a[i];
        sum += a[i];
        mp[a[i]]++;
       // con[a[i]] = true;
    }

    int q;
    cin >> q;
    rep(i, q){
        int b, c;
        cin >> b >> c;
        sum -= b * mp[b];
        sum -= c * mp[c];
        mp[c] += mp[b];
        sum += c * mp[c];
        mp[b] = 0;
        cout << sum << endl;
    }

    return 0;
}



Measured memory_bytes: 9884
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <map>
#include <functional>
using namespace std;
int main() {
	int n,a = 0,b = 0;
	cin >> n ;
	vector<int> c(n);
	for (int i = 0; i < n;i++) {
		cin >> c[i];
	}
	sort(c.begin(), c.end(), greater<int>());
	for (int i = 0; i < n; i++) {
		if (i %2==0) {
			a += c[i];
		}
		else {
			b += c[i];
		}
	}
	
	cout << a-b << endl;

	
	return 0;
}

Measured memory_bytes: 256
S = input()
even_0,even_1 =0,0
odd_0 ,odd_1 = 0,0

for i,s in enumerate(S):
    if (i+1)%2==0:
        if s == "0":
            even_0 += 1
        elif s == "1":
            even_1 += 1
    else:
        if s == "0":
            odd_0 += 1
        elif s == "1":
            odd_1 += 1

print(min([odd_1+even_0,odd_0+even_1]))


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

int main()
{
    string S, T;
    cin >> S >> T;
    int A, B;
    cin >> A >> B;
    string U;
    cin >> U;
    if (S == U)
        A--;
    else
        B--;
    cout << A << " " << B << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace B
{
  class Program
  {
    static void Main(string[] args)
    {
      int c = int.Parse(Console.ReadLine());
      string[] input = Console.ReadLine().Split(' ');
      double bunbo = 0.0;
      for (int i = 0; i < c; i++)
      {
        bunbo += 1.0 / double.Parse(input[i]);
      }
      Console.WriteLine((double)1 / bunbo);
    }
  }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n);i++)

using namespace std;

const int  MOD = 1e9+7;

int main(){
        int n,m;
        cin>>n>>m;

        vector<int> a(m);
        rep(i,m)cin>>a[i];

        vector<int> dp(n+1,-1);
        dp[0] = dp[1] = 1;
        rep(i,m){
            dp[a[i]]=0;
        }

        for(int i = 2;i<n+1;i++){
            if(dp[i] == -1){
                dp[i]=dp[i-1]+dp[i-2];
                dp[i]%=MOD;
            }
        }

        cout<<dp[n];
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
   int sum_of_digit(int n){
      int sum=0;
      while(n>0){
       	sum += n%10;
  		n /= 10;
  	  }
	  return sum;
	}
int main(void){ 
  long long n;
  cin >> n;
  if(n%sum_of_digit(n)==0){
  	cout << "Yes";
  }else{
  	cout << "No";
  }
return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		while(true){
			String[] line = sc.nextLine().split(" ");
			int m = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
		//finish	
			if(m==-1 && f==-1 && r==-1){
				break;
			}
			int sum = m+f;
		//out
			if(m==-1 || f==-1){
				System.out.println("F");
			}else if(sum>=80){
				System.out.println("A");
			}else if(sum>=65 && sum<80){
				System.out.println("B");
			}else if(sum>=50 && sum<65){
				System.out.println("C");
			}else if(sum>=30 && sum<50){
				if(r>=50){
					System.out.println("C");
				}else{
					System.out.println("D");
				}
			}else if(sum<30){
				System.out.println("F");
			}
		}
	}
}

Measured memory_bytes: 26196
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;

// allPrimes[] stores all prime numbers less
// than or equal to n.
vector<ull> allPrimes;
ull m=1000000000+7;
// Fills above vector allPrimes[] for a given n
void sieve(int n)
{
    // Create a boolean array "prime[0..n]" and
    // initialize all entries it as true. A value
    // in prime[i] will finally be false if i is
    // not a prime, else true.
    vector<bool> prime(n+1, true);

    // Loop to update prime[]
    for (int p=2; p*p<=n; p++)
    {
        // If prime[p] is not changed, then it
        // is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }

    // Store primes in the vector allPrimes
    for (int p=2; p<=n; p++)
        if (prime[p])
            allPrimes.push_back(p);
}

// Function to find all result of factorial number
ull factorialDivisors(ull n)
{
    sieve(n);  // create sieve

    // Initialize result
    ull result = 1;

    // find exponents of all primes which divides n
    // and less than n
    for (int i=0; i < allPrimes.size(); i++)
    {
        // Current divisor
        ull p = allPrimes[i];

        // Find the highest power (stored in exp)'
        // of allPrimes[i] that divides n using
        // Legendre's formula.
        ull exp = 0;
        while (p <= n)
        {
            exp = exp + (n/p);
            p = p*allPrimes[i];
        }

        // Multiply exponents of all primes less
        // than n
        result = (result*(exp+1))%m;
    }

    // return total divisors
    return result;
}

// Driver program to run the cases
int main()
{
    int n;
    cin>>n;
    cout << factorialDivisors(n);
    return 0;
}


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

using namespace std;

int main() {
    long n;
    cin >> n;
    if (n < 10) {
        cout << n << endl;
        return 0;
    } else if (n < 100) {
        cout << 9 << endl;
        return 0;
    } else if (n < 1000) {
        cout << 9 + (n - 99) << endl;
        return 0;
    } else if (n < 10000) {
        cout << 9 + (999-99) << endl;
        return 0;
    } else if (n < 100000){
        cout << 9 + (999-99) + (n - 9999)<< endl;
        return 0;
    } else {
        cout << 9 + (999-99) + (99999-9999) << endl;
    }
	return 0;
}

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

typedef long long ll;
using namespace std;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) cin >> h[i];
    sort(h.begin(), h.end(), greater<>());

    ll sum = 0;
    for (int i = k; i < n; ++i) {
        sum += h[i];
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 1152
#include <stdio.h>
#include <string.h>

int main() {
  char a[201], b[201];
  int n, m, i, j, l;

  while(1) {
    scanf("%s", a);
    if (strcmp(a, "-") == 0)  break;
    l = strlen(a);
    scanf("%d", &m);
    for (i = 0; i < m; i++) {
      scanf("%d", &n);
      for (j = 0; j < l - n; j++) {
        b[j] = a[j + n];
      }
      for (j = 0; j < n; j++) {
        b[l - n + j] = a[j];
      }
      b[l] = '\0';
      strcpy(a, b);
    }
    printf("%s\n", a);
  }

  return 0;
}



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

using namespace std;
typedef long long ll;

int mod=1e9+7;
const int N=4e6+5;
int k[10];
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  k[a]++,k[b]++,k[c]++;
  if(k[5]==2&&k[7]==1) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 384
// atcoder.cpp : Defines the entry point for the console application.
//


#include <iostream>
#include <vector>
using namespace std;
int main()
{
	long long ans{ 0 };
	int N;
	cin >> N;
	while (N--)
	{
		long long t;
		cin >> t;
		while (t % 2 == 0)
		{
			t /= 2;
			ans++;
		}

	}
	cout << ans;
	
	return 0;

}

Measured memory_bytes: 256
def search(l, n):
    left = 0
    right = len(l)
    m = (left + right) // 2

    # while right - left > 1:
    while left < right:
        if n == l[m]:
            return True
        elif n < l[m]:
            right = m
        elif n > l[m]:
            left = m + 1
        else:
            raise Exception()

        m = (left + right) // 2


n = int(input())
s = [int(i) for i in input().split()]
q = int(input())
t = [int(i) for i in input().split()]

ans = 0
for ti in t:
    if search(s, ti):
        ans += 1

print(ans)



Measured memory_bytes: 16896
n, l = map(int, input().split())
# 味
apple_tastes = [(l+i-1) for i in range(1, n+1)]

n_diff_abs = []
for a in apple_tastes:
    # 差分の絶対値を格納
    n_diff_abs.append(abs(sum(apple_tastes) - (sum(apple_tastes)-a)))

# 一番小さい値のindexを取得
diff_abs_min_index = n_diff_abs.index(min(n_diff_abs))
print(sum(apple_tastes) - apple_tastes[diff_abs_min_index])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, maxP = 0, sum = 0;
    cin >> n;
    int l[n];
    for (int i = 0; i < n; i++) {
        cin >> l[i];
        sum += l[i];
        if (l[maxP] < l[i]) {
            maxP = i;
        }
    }
    cout << (l[maxP] < sum - l[maxP] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
//prototype
int main(void);

int main(void){

  int mid_test, fin_test, retest, total_score;

  while(1){
    scanf("%d %d %d", &mid_test, &fin_test, &retest);

    //exit condition
    if (mid_test == -1 && fin_test == -1 && retest == -1) {
      break;
    }

    //Add up the score
    total_score = mid_test + fin_test;

    //evaluate grades
    if (mid_test == -1 || fin_test == -1 || total_score < 30) {
      printf("F\n");
    }else if(total_score < 80 && total_score >= 65){
      printf("B\n");
    }else if(total_score < 65 && total_score >= 50){
      printf("C\n");
    }else if(total_score < 50 && total_score >= 30){
      if (retest >= 50) {
        printf("C\n");
      }else{
        printf("D\n");
      }
    }else{
      printf("A\n");
    }
  }

  return 0;
}



Measured memory_bytes: 2040
#include <bits/stdc++.h>
#define ll long long
#define vll vector<long long>
#define vi vector<int>
#define wh(t) while(t--)
#define fi(n) for(long long i = 0; i < n; i++)
#define fj(n) for(long long j = 0; j < n; j++)
#define fu(i,s,e) for(ll i = s; i <=e; i++)
#define fd(i,s,e) for(ll i = s; i >=e; i--)
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define sll stack<ll>
#define qll queue<ll>
using namespace std;
const ll M = 1e9+7;
//const ll M = 998244353;

ll pmp(ll x,ll n){
	ll a = 1;
	while(n > 0){
		if(n & 1) a = (a * x)%M;
		x = (x * x) % M;
		n = n>>1;
	}
	return a;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t;
	t = 1;
	// cin >> t;
	wh(t){
		ll n,m;
		cin >> n >> m;
		vi h(n);
		fi(n)
			cin >> h[i];
		vi r[n];
		fi(m){
			ll x,y;
			cin >> x >> y;
			r[x-1].pb(y-1);
			r[y-1].pb(x-1);
		}
		ll count = 0;
		fi(n){
			// cout << h[i] << ' ';
			bool flag = true;
			fj(r[i].size()){
				// cout << h[r[i][j]]
				if(h[i] <= h[r[i][j]])
					flag = false;
			}
			count+=flag;
		}
		cout << count;
	}
	return 0;
}

Measured memory_bytes: 8768
#include <bits/stdc++.h>
using namespace std;
#include <boost/range/irange.hpp>
using namespace boost;

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

    int N,M,R;
    cin >> N >> M >> R;

    int D[N][N];
    for( int i : irange(0, N) )
    {
        for( int j : irange(0, N) )
        {
            if(i == j) D[i][j] = 0;
            else D[i][j] = 1e9;
        }
    }

    vector<int> rs(R);
    for( int& r : rs )
    {
        cin >> r;
        r--;
    }
    sort(rs.begin(), rs.end());

    for( int i : irange(0, M) )
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        D[a][b] = c;
        D[b][a] = c;
    }

    for( int i : irange(0, N) )
    {
        for( int j : irange(0, N) )
        {
            for( int k : irange(0, N) )
            {
                D[j][k] = min(D[j][k], D[j][i] + D[i][k]);
            }
        }
    }

    int mini = 1e9;
    do{
        int s, cost = 0;
        for( int i : irange(0, R) )
        {
            if(i)
            {
                cost += D[s][rs[i]];
                s = rs[i];
            }
            else s = rs[i];
        }
        mini = min(mini, cost);
    }while(next_permutation(rs.begin(), rs.end()));

    cout << mini << endl;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <bits/stdc++.h>
#include <ctime>

#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL)
#define TT int test_cases; cin >> test_cases; while(test_cases--)
#define TT1 int test_cases=1; while(test_cases--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
 
using namespace std;
typedef long long int ll;

 
int main() {
    
    FAST;
    TT1{
         
        int x;cin>>x;
        if(x>=30) cout<<"Yes"<<"\n";
        else cout<<"No"<<"\n";
        
    }
}

Measured memory_bytes: 3636
import numpy as np
N = int(input())
A = [int(x) for x in input().split()]

ans = 1
c=0

A.sort()

for x in A:
    ans = ans * x
    if ans == 0:
        print(0)
        c=1
        break
    elif ans > 10**(18):
        print(-1)
        c=1
        break

if c==0:
    print(ans)


Measured memory_bytes: 40088
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

int main(){
    // read in integer 
    vector<int> b(9, 0);
    vector<int> c;

    // int a_1, a_2, a_3 = 0;
    // while (cin >> a_1 >> a_2 >> a_3){
    //     // process pair (a,b)
    //     b[a_1], b[a_2], b[a_3] = 0;
    // }
    int a;
    REP(i, 9){
        cin >> a;
        c.push_back(a);
    }
    int n;
    // int a_11, a_12, a_13, a_11, a_12, a_23, a_11, a_12, a_33;
    // cin >> a_11 >> a_12 >> a_13;
    // cin >> a_21 >> a_22 >> a_23;
    // cin >> a_31 >> a_32 >> a_33;

    cin >> n;


    int j;
    int k;
    REP(i, n){
        cin >> k;
        REP(j, 9){
            if (c[j] == k){
                b[j] = 1;
            }
        }
    }

    REP(i, 3){
        if (b[3*i] == 1 && b[3*i+1] == 1 && b[3*i+2] == 1){
            cout << "Yes" << endl;
            return 0;
        }
        if (b[i] == 1 && b[3+i] == 1 && b[6+i] == 1){
            cout << "Yes" << endl;
            return 0;
        } 
        if (b[0] == 1 && b[4] == 1 && b[8] == 1){
            cout << "Yes" << endl;
            return 0;
        } 
        if (b[2] == 1 && b[4] == 1 && b[6] == 1){
            cout << "Yes" << endl;
            return 0;
        } 
    }
    cout << "No"<< endl;
}

Measured memory_bytes: 256
import java.io.*;

public class Main{
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String W = br.readLine().toLowerCase();
        int cnt = 0;

        while(true){
            String[] T = br.readLine().split(" ");
            if(T[0].equals("END_OF_TEXT")){
                break;
            }

            for(int i = 0; i < T.length; i++){
                if(T[i].toLowerCase().equals(W)){
                    cnt++;
                }
            }
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 24252
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <deque>
#include <unistd.h>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;
double eps = 1e-11;

struct edge {
    int to, cost;
};

int V;
vector<edge> G[1000000];
ll d[1000000];

void BFS01(int n) {
    fill(d, d + V, llmax);
    deque<int> que;
    d[n] = 0;
    que.push_front(n);
    while (que.size() > 0) {
        int base = que.front();
        que.pop_front();
        int s = G[base].size();
        for (int i = 0; i < s; i++) {
            edge e = G[base][i];
            if (e.cost == 1) {
                if (d[e.to] > d[base] + 1) {
                    d[e.to] = d[base] + 1;
                    que.push_back(e.to);
                }
            } else if (e.cost == 0) {
                if (d[e.to] > d[base]) {
                    d[e.to] = d[base];
                    que.push_front(e.to);
                }
            }
        }
    }
}

int main() {
    ll K;
    cin >> K;
    V = K;
    for (int i = 0; i < K; i++) {
        edge e;
        e.to = (i * 10) % K;
        e.cost = 0;
        G[i].push_back(e);
        edge e2;
        e2.to = (i + 1) % K;
        e2.cost = 1;
        G[i].push_back(e2);
    }
    BFS01(1);
    ll ans = d[0] + 1;
    cout << ans << endl;
}


Measured memory_bytes: 29440
#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

map<pii,int> M;
int main() {
    int i;
    int N;
    long double d;
    scanf("%d",&N);
    for (i = 0; i < N; i++) {
        scanf("%Lf",&d);
        LLI x = round(d*1e9)+1e-9;
        int c2 = 0,c5 = 0;
        while ((x % 2) == 0) x /= 2,c2++;
        while ((x % 5) == 0) x /= 5,c5++;
        M[mp(c2,c5)]++;
    }
    LLI ans = 0;
    for (auto it = M.begin(); it != M.end(); it++) {
        for (auto it2 = it; it2 != M.end(); it2++) {
            if (it == it2) {
                if ((2*it->first.first >= 18) && (2*it->first.second >= 18))
                    ans += (LLI) it->second*(it->second-1)/2;
            }
            else if ((it->first.first+it2->first.first >= 18) && (it->first.second+it2->first.second >= 18))
                ans += (LLI) it->second*it2->second;
        }
    }
    printf("%lld\n",ans);

    return 0;
}



Measured memory_bytes: 3888
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;


int main() {
	ios::sync_with_stdio(false);
	cin >> N >> K;
	long long int num[100000] = {};
	for (int i = 0; i < N; i++) cin >> num[i];
	sort(num, num + N);
	if (num[N - 1] < K) {
		cout << "IMPOSSIBLE\n";
		return 0;
	}
	long long int box = num[0];
	for (int i = 0; i < N; i++) {
		long long int a, b;
		a = box;
		b = num[i];
		while (1) {
			if (a < b)swap(a, b);
			if (a%b) {
				a = a%b;
			}
			else {
				box = b;
				break;
			}
		}
	}
	if (K%box) {
		cout << "IMPOSSIBLE\n";
		return 0;
	}
	cout << "POSSIBLE\n";
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
	int data[10];
	int dai1,dai2,wk;
	int i,j;
	for(i=0;i<10;i++){
		scanf("%d",&data[i]);
	}
	for(i=0;i<9;i++){
		for(j=i+1;j<10;j++){
			if(data[i]<data[j]){
				wk=data[i];
				data[i]=data[j];
				data[j]=wk;
			}
		}
	}
	dai1=data[0]+data[1]+data[2];
	for(j=0;j<10;j++){
		scanf("%d",&data[j]);
	}
	for(j=0;j<9;j++){
		for(i=j+1;i<10;i++){
			if(data[j]<data[i]){
				wk=data[j];
				data[j]=data[i];
				data[i]=wk;
			}
		}
	}
	dai2=data[0]+data[1]+data[2];
	printf("%d %d\n",dai1,dai2);
	return 0;
}


Measured memory_bytes: 2056
#include <iostream>                                             
#include <cmath>                                                
using namespace std;                                            
                                                                
bool isprime(int x) {                                           
  if (x==2) {                                                   
    return true;                                                
  }                                                             
  if (x<2 || x%2==0) {                                          
    return false;                                               
  }                                                             
  int i = 3;                                                    
  while (i<=sqrt(x)) {                                          
    if (x%i==0) {                                               
      return false;                                             
    }                                                           
    i = i+2;                                                    
  }                                                             
  return true;                                                  
}                                                               
                                                                
int main(void) {                                                
  int n;                                                        
  cin >> n;                                                     
  int x, ans=0;                                                 
  for (int i=0; i<n; i++) {                                     
    cin >> x;                                                   
    if (isprime(x)) {                                           
      ans++;                                                    
    }                                                           
  }                                                             
  cout << ans << endl;                                          
  return 0;                                                     
}                                                               
                                             

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//コンビネーション
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
//素因数分解
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

//切り上げの割り算は(a + b - 1) / bでできる
//時間を意識しろ
//コードテストちゃんとして
//画面とにらめっこするな書け
//WA出すたびにABCは五億円払え
//わからない問題はとばせ
//躊躇なくぐぐれ

//ここから
int main(){
    string S;
    cin>>S;
    ll Ans=0;
    vl l(S.size()+1,0);
    vl r(S.size()+1,0);
    for(ll i=1;i<=S.size();i++){
        if(S.at(i-1)=='<'){
            l.at(i)=l.at(i-1)+1;
        }
    }
    for(ll i=S.size()-1;i>=0;i--){
        if(S.at(i)=='>'){
            r.at(i)=r.at(i+1)+1;
        }
    }
    rep(i,S.size()+1){
        Ans+=max(l.at(i),r.at(i));
    }
    cout<<Ans<<endl;
}



Measured memory_bytes: 8708
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = len(a)
a_sum = 0
b_sum = 0
for i in range(b):
    if i % 2 == 0:
        a_sum = a_sum + a.pop(0)
    else:
        b_sum = b_sum + a.pop(0)
print(a_sum-b_sum)

Measured memory_bytes: 9088
import numpy as np
import copy

d=int(input())
c=np.array(list(map(int,input().split())))
curc=copy.deepcopy(c)
s=[]
ans=[]
score=0
for i in range(d):
    s=np.array(list(map(int,input().split())))
    curc+=c
    s1=s+(curc)*(d-i)
    #print(s1)
    x=np.argmax(s1)
    ans.append(x+1)
    curc[x]=0
    score+=s[x]
    for j in range(26):
        score-=curc[j]



#print(score)
for i in range(d):
    print(ans[i])

Measured memory_bytes: 27304
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#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 long double ld;
typedef complex<ld> Point;
const ld eps = 1e-3;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;

int n;
vector<int> G[1 << 17];
bool exi[1 << 17];

bool used[1 << 17];
int root;
string c;
bool maketree(int id) {
	used[id] = true;
	bool res = false;
	rep(i, G[id].size()) {
		int to = G[id][i];
		if (used[to])continue;
		if (maketree(to))res = true;
	}
	if (c[id] == 'W')res = true;
	if (!res)exi[id] = false;
	return res;
}
int deg[1 << 17];
int ans = 0;
void calcdeg(int id) {
	if (!exi[id])return;
	rep(j, G[id].size()) {
		int to = G[id][j];
		if (!exi[to])continue;
		deg[id]++;
	}
	ans += 2 + ((c[id] == 'W') ^ (deg[id] % 2));
}
void all_calcdeg() {
	rep(i, n)calcdeg(i);
}
int d[1 << 17];
int mostfar(int s) {
	fill(used, used + n, false);
	queue<int> q; used[s] = true; q.push(s);
	int res = s;
	d[s] = (c[s]=='W')^(deg[s]%2);
	while (!q.empty()) {
		int x = q.front(); q.pop();
		rep(i,G[x].size()) {
			int to = G[x][i];
			if (used[to])continue;
			if (!exi[to])continue;
			used[to] = true; q.push(to);
			d[to] = d[x] + ((c[to] == 'W')^(deg[to]%2));
		}
	}
	int ma = 0;
	rep(j, n) {
		if (ma < d[j]) {
			ma = d[j]; res = j;
		}
	}
	return res;
}

int main() {
	int num = 0;
	cin >> n; fill(exi, exi + n, true);
	rep(i, n - 1) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	cin >> c;
	root = -1;
	rep(i, n) {
		if (c[i] == 'W') {
			root = i; num++;
		}
	}
	if (root < 0) {
		cout << 0 << endl; return 0;
	}
	else if (num == 1) {
		cout << 1 << endl; return 0;
	}
	maketree(root);
	all_calcdeg(); ans -= 2;
	int l = mostfar(root), r = mostfar(l); l = mostfar(r);
	//cout << l << " " << r << endl;
	//rep(i, n)cout << d[i] << endl;
	cout << ans-2*d[l] << endl;
	//stop
	return 0;
}


Measured memory_bytes: 12288
import math

N=int(input())

inputs=input().split(" ")
X=[]

mini=100
maxi=0


for i in inputs:
    i=int(i)
    X.append(i)

    if int(i)<mini:
        mini=i

    if int(i)>maxi:
        maxi=i

minpowersum=math.pow(10,9)
for P in range(mini,maxi+1):

    powersum=0
    for j in range(N):
        powersum+=math.pow((X[j]-P),2)

    if powersum<minpowersum:
        minpowersum=powersum


print(int(minpowersum))



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

int main(){  
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> a(n);
  bool one = false;
  rep(i,n) {
    a[i] = s[i] - '1';
    if(a[i] == 1) one = true;
  }
  if(!one) {
    rep(i,n) a[i] /= 2;
  }
  int m = 0;
  rep(i,n) {
    if(n-1 == (i | (n-1-i))) m += a[i]; 
  }
  if(one && (m % 2)) cout << 1 << endl;
  else if(one && !(m % 2)) cout << 0 << endl;
  else if(!one && (m % 2)) cout << 2 << endl;
  else cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 5252
#include <iostream>
#include <vector>
#include <string>
#include <sstream>

using namespace std;

class dataset{

	string g;
	int y, m, d;

public:
	dataset(){
		setAll("", 0, 0, 0);
	}

	void setAll(const string &gengou, const int year, const int month, const int day){
		g = gengou;
		y = year;
		m = month;
		d = day;
	}
	void setG(const string &gengou){ g = gengou; }
	void setY(const int &year){ y = year; }


	int getY() const { return y; }
	int getM() const { return m; }

	string getAsString() const{
		stringstream ss;
		ss << g << " " << y << " " << m << " " << d;
		return ss.str();
	}

};


int main()
{
	//input data
	vector<string> input_data;
	while(true){
		string line = "";
		getline(cin, line);
		if(line == "#"){ break; }
		input_data.push_back(line);
	}

	// edit input
	const size_t num_input = input_data.size();
	vector<dataset> input_dataset(num_input);

	for(size_t i = 0; i < num_input; i++){

		stringstream ss(input_data[i]);
	    string buf;
		vector<string> temp;
		while(getline(ss, buf, ' ')){
		    temp.push_back(buf);
	    }

		input_dataset[i].setAll(temp[0], stoi(temp[1]),stoi(temp[2]),stoi(temp[3]));
	}

	//process
	for(auto &v: input_dataset){
		const int y = v.getY();
		const int m = v.getM();
		if(y >= 32){ 
			v.setG("?"); 
			v.setY(y - 30);
		}
		else if(y >= 31 && m >= 5){ 
			v.setG("?"); 
			v.setY(y - 30);
		}
	}

	//output
	for(auto &v: input_dataset){
		cout << v.getAsString() << endl;
	}


	//end
    return 0;
}




Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
int main() {
  ios::sync_with_stdio(false);
  char x;
  cin>>x;
  if(x>='A'&&x<='Z')cout<<'A';
  else cout<<'a';
 	return 0;
}

Measured memory_bytes: 3612
(x1, y1, x2, y2) = map(int, input().split())
x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)
x4 = x1 - (y2 - y1)
y4 = y1 + (x2 - x1)

print(x3, y3, x4, y4)


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

typedef long long lint;
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const lint inv = MOD - 2;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

int main(){
    int n;
    cin >> n;
    if(n == 1){
        cout << "Hello World" << endl;
    }else{
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		int n = Integer.parseInt(sc.next());
		//		//int k = Integer.parseInt(sc.next());
		//		int[] x = new int[n];
		//
		//		for (int i = 0; i < n; i++) {
		//			x[i] = Integer.parseInt(sc.next());
		//		}

		double e = 1 - (double) (n / 2) / n;

		System.out.println(e);
		sc.close();
	}
}

Measured memory_bytes: 21844
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using i64 = int64_t;

int N, a[101010];

int main() {
    cin >> N;
    for (int j = 0; j < N; ++j) {
        cin >> a[j];
    }

    int b[101010];
    fill(b, b+101010, 0);
    for (int j = 0; j < N; ++j) {
        if (a[j] > 0) {
            b[a[j]-1]++;
        }
        b[a[j]]++;
        b[a[j]+1]++;
    }

    int ans = 0;
    for (int j = 0; j < 101010; ++j) {
        ans =max(ans, b[j]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(void){

    long long a, b, c, k, sum = 0;
    cin >> a >> b >> c >> k ;

    sum += min(a, k);
    sum -= max((long long)0, k - a - b);
    
    cout << sum << endl;    
}


Measured memory_bytes: 3624
# -*- coding:utf-8 -*-
import math

def solve():
    H, W = list(map(int, input().split()))

    if H==1 or W==1:
        print(1)
        return

    odd = math.ceil(H/2)
    even = H//2

    ans = odd*math.ceil(W/2) + even*(W//2)
    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 3060