akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace _5_C
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x[0] == 0 && x[1] == 0)
                {
                    break;
                }
                for (int i = 0; i < x[0]; i++)
                {
                    for (int I = 0; I < x[1]; I++)
                    {
                        if ((I+i) % 2 == 0)
                        {
                            Console.Write("#");
                        }
                        else
                        {
                            Console.Write(".");
                        }
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 9252
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS std::cin.tie(0),std::ios::sync_with_stdio(false)

namespace idaten{

using namespace std;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using P = std::pair<int64_t, int64_t>;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
    if (v.empty())return out;
    constexpr bool is_vector_v = is_vector<T>::value;
    if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
    else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
    return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


void solve(){
    IOS;
    ll n,a,b;
    cin >> n >> a >> b;
    ll res = 0;
    res += n/(a+b)*a;
    res += min(a,n%(a+b));
    put(res);
}
} // namespace idaten

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int X,happy;happy = 0;
    cin >> X;
    while(X >= 500){
        X -=500;
        happy += 1000;
    }
    while(X >=5){
        X -=5;
        happy += 5;
    }
    cout << happy << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int r = 1e5 + 1;
int a[r], dp[r], n, k;
int solve(int idx){
    if (idx >= n - 1)
        return 0;
    if (dp[idx] != -1)
        return dp[idx];
    int ret = INT_MAX;
    for (int i = 1; i <= k; i++)
        if (idx + i < n)
            ret = min(ret, abs(a[idx] - a[idx + i]) + solve(i + idx));
    return dp[idx] = ret;
}
int main(){
    memset(dp, -1, sizeof dp);
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> a[i];
     cout << solve(0) << '\n';
    return 0;
}


Measured memory_bytes: 5760
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;



int main(void)
{
	//変数の宣言
	int n,m;
	int h,w;
	int a,b;
	int c[20][20];
	int A[210][210];
	char s[100010];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int temp3=0;
	int vec[100010];
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;
	char dummy;
	char stemp[100010];
	
	//データの読み込み


	scanf("%d %d",&h,&w);
//	scanf_s("%d %d",&h,&w);

//	scanf("%s",&s);
//	scanf_s("%s",&s,100010);


	for(i=0;i<10;i++){
		for(j=0;j<10;j++){
			scanf("%d",&c[i][j]);
//			scanf_s("%d",&c[i][j]);
		}
	}

	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			scanf("%d",&A[i][j]);
//			scanf_s("%d",&A[i][j]);
		}
	}


/*	for(i=0;i<3;i++){
//		scanf("%s",&s);
		scanf_s("%s",&s[i],100010);
	}*/


	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

//	clock_t start=clock();


	for(i=0;i<10;i++){
		for(j=0;j<10;j++){
			for(k=0;k<10;k++){
				for(l=0;l<10;l++){
					c[j][k]=min(c[j][k],c[j][l]+c[l][k]);
				}
			}
		}
	}


	for(i=0;i<15;i++){
		vec[i]=0;
	}

	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(A[i][j]!=-1){
				vec[A[i][j]]++;
			}
		}
	}
	
	for(i=0;i<10;i++){
		if(i==1) continue;
		ans=ans+vec[i]*c[i][1];
	}


//	clock_t end=clock();

	//	printf("計算部分終了\n");

	//出力
	
	printf("%d",ans);

//	printf("time=%lf",(double)(end-start)/CLOCKS_PER_SEC);
	//	printf("結果の出力終了\n");

	return 0;
}



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

using namespace std;

bool digit(int n){
  bool res = false;
  while(n > 0){
    res = !res;
    n /= 10;
  }
  return res;
}

int main(){
  int N;
  cin >> N;
  int cnt = 0;
  for(int i = 1; i <= N; i++){
    if(digit(i)) cnt++; 
  }
  cout << cnt << endl;
}


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

int main()
{
   int n;
   cin>>n;
   int a[n+5];
   for(int i=1;i<=n;i++)
   cin>>a[i];
   int sum=0;
   for(int i=1;i<=n;i++)
   {
       for(int j=i+1;j<=n;j++)
       {
           sum+=(a[i]*a[j]);
       }
   }
   cout<<sum<<endl;
   return 0;
}

Measured memory_bytes: 256
#line 1 "test/ALDS1_1_B.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/1/ALDS1_1_B"

#line 1 "macro/macros.hpp"



/*
@title Macro
@category template
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;

template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

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

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;

const double PI = acos(-1.0);

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";


#line 1 "math/gcd.hpp"


/*
@title 最大公約数(Greatest Common Divisor)
*/
template<typename T>
T gcd(T a,T b){
    if(b == 0) return a;
    return gcd(b, a%b);
}
template<typename T,typename U>
T lcm(T a,T b){return a/gcd(a,b)*b;}

#line 5 "test/ALDS1_1_B.test.cpp"

int main(){
    int a, b;
    cin >> a >> b;
    cout << gcd(a, b) << endl;
}



Measured memory_bytes: 3216
N,M=map(int,input().split())
ans=[-1]*N
sc=[list(map(int,input().split())) for i in range(M)]
cnt=0
for i in range(M):
    if ans[sc[i][0]-1]==-1:
        ans[sc[i][0]-1]=sc[i][1]
    else:
        if ans[sc[i][0]-1]!=sc[i][1]:
            cnt+=1
if cnt>0:
    print(-1)
elif ans[0]==0 and N!=1:
    print(-1)
else:
    s=''
    for i in range(N):
        if N!=1:
            if ans[0]==-1:
                ans[0]=1
            if ans[i]==-1 and i!=0:
                ans[i]=0
        else:
            if ans[0]==-1:
                ans[0]=0
        s+=str(ans[i])
    print(int(s))

Measured memory_bytes: 3192
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int d = s.nextInt();

		int i = 0;
		int j = 0;
		int k = 0;
		int sum = 0;//それぞれの距離の二乗
		int judgeSum = 0;//距離が整数なものの合計
		int[][] x = new int[n][d];
		for (i = 0; i < n; i++) {
			for (j = 0; j < d; j++) {//x
				x[i][j] = s.nextInt();
			}
			if (i != 0) {
				for (k = 0; k < i; k++) {//
					sum = 0;
					if (i != k) {
						//各要素を二乗して足す
						for (int m = 0; m < d; m++) {
							int sa = x[i][m] - x[k][m];
							int jijou = sa * sa;
							sum += jijou;
						}
					}
					double dSqrt= Math.sqrt(sum);
					if(dSqrt == (int)dSqrt) {
					judgeSum += 1;
					}
				}

			}
		}

		System.out.println(judgeSum);

	}

}


Measured memory_bytes: 23764
//
//  main.cpp
//  D
//
//  Created by Vadim Zakharenko on 29/07/2017.
//  Copyright © 2017 Vadim Zakharenko. All rights reserved.
//

#include <iostream>
#include <memory.h>

using namespace std;

long long a[111];

int main(int argc, const char * argv[]) {
    long long k, n = 50;
    cin >> k;
    long long l = k / n + n - 1;
    for (int i = 1; i <= n; i++) {
        a[i] = l;
    }
    for (int iter = 1; iter <= k % n; iter++) {
        long long mn = 1e18;
        int j = 0;
        for (int i = 1; i <= n; i++)
            if (a[i] < mn) {
                mn = a[i];
                j = i;
            }
        a[j] += n;
        for (int i = 1; i <= n; i++)
            if (i != j) {
                a[i]--;
            }
    }
    cout << n << "\n";
    for (int i = 1; i <= n; i++) {
        cout << a[i] << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<long long> factorial;
long long fact(long long n){
	if(factorial[n]==-1) factorial[n]=n*fact(n-1);
	return factorial[n];
}
long long binom(long long n, long long r){
    return fact(n)/fact(r)/fact(n-r);
}
int main(){
	int n, m, q;
	cin >> n >> m >> q; 
	vector<int> a(q), b(q), c(q), d(q);
	for(int i=0; i<q; ++i) cin >> a[i] >> b[i] >> c[i] >> d[i];
	
	vector<int> B(n+m,0);
	for(int i=1; i<=n; ++i) B[i]=1;
	
	factorial.assign(n+m,-1);
	factorial[0]=1;
	int ans=0;
	long long t=binom(n+m-1,n);
	for(long long j=0; j<t; ++j){
		int cnt=1;
		vector<int> A(n+1,0);
		for(int i=0; i<n+m; ++i){
			if(B[i]==0){
				++A[cnt];
			}else{
				if(cnt==n) break;
				A[cnt+1]=A[cnt];
				++cnt;
			}
		}
		
		int tmp=0;
		for(int i=0; i<q; ++i){
			if(A[b[i]]-A[a[i]]==c[i]) tmp+=d[i];
		}
		ans=max(ans,tmp);
		next_permutation(B.begin()+1,B.end());
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 3604
import sys
from collections import deque, defaultdict
import copy
import bisect
#sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import combinations, permutations

import sys
def input():
	return sys.stdin.readline().strip()

N = int(input())
ans = 0
d = defaultdict(int)
for i in range(N):
	di = int(input())
	if d[di] == 0:
		ans += 1
		d[di] += 1
print(ans)

Measured memory_bytes: 38384
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::iter::FromIterator;
use std::collections::HashSet;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let a = scan.read::<i64>();
    let b = scan.read::<i64>();
    let ad = divisors(a).into_iter().collect::<HashSet<_>>();
    let bd = divisors(b).into_iter().collect::<HashSet<_>>();
    let cd = &ad & &bd;
    let mut cdv = cd.into_iter().collect::<Vec<_>>();
    cdv.sort();
    let mut ret = vec![];
    'outer: for &c in &cdv {
        for &r in &ret {
            if r != 1 && c % r == 0 {
                continue 'outer;
            }
        }
        ret.push(c);
    }
    println!("{}", ret.len());
}

#[allow(dead_code)]
fn divisors(n: i64) -> Vec<i64> {
    let mut ret = vec![];
    for i in (1..).take_while(|i| i * i <= n) {
        if n % i == 0 {
            ret.push(i);
            if i != n / i {
                ret.push(n / i);
            }
        }
    }
    ret
}


// region template
#[allow(dead_code)]
fn iu(i: i64) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> i64 { i as i64 }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 4352
// Created by AboAbdoMC
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long

using namespace std;
using namespace __gnu_pbds;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const int OO = 1e9+7;
const int MOD = 1e9+7;
const int N = 1e5+7;



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    cout << (n*(n-1))/2 << '\n';
    return 0;
}

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

struct RSQ{
  int n=(1<<22),data[(1<<23)];
  RSQ(){
    memset(data,0,sizeof(data));
  }
  // 0 index
  void add(int i,int v){
    i++;
    while(i<=n){
      data[i]+=v;
      i+=i&-i;
    }
  }
  int sum(int i){
    int res=0;
    while(i>0){
      res+=data[i];
      i-=i&-i;
    }
    return res;
  }
  //[a,b) 0indexed
  int sum(int x,int y){
    return sum(y)-sum(x);
  }
  //K番目に小さい値
  int K_number(int k){
    int l = 0,r = (1<<1)+1;
    while( l < r ) {
      int mid = (l+r) / 2;
      if( sum( 1 , mid+1 ) >= k ) r = mid;
      else l = mid+1;
    }
    return l;
  }
  //K番目に大きい値
  int K_L_number(int k){
    int p=sum(1,(1<<18));
    return K_number(p-k+1);
  }
};

main(){
	int n,k,ans=0;
	cin>>n>>k;
	int a[n],b[n+1]={};
	vector<int>c(n+1,0);
	r(i,n)cin>>a[i],a[i]-=k;
	r(i,n)b[i+1]+=b[i]+a[i];
	r(i,n+1)c[i]=b[i];
	sort(c.begin(),c.end());
	RSQ R;
	for(int i=0;i<=n;i++){
		int x = distance(c.begin(),lower_bound(c.begin(), c.end(), b[i]));
		//cout<<x<<endl;
		ans += R.sum(x+1);
		//cout<<x<<endl;
		if(x<0)return 0;
		R.add(x,(int)1);
		//cout<<x<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 70528
import java.util.*;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer N = Integer.parseInt(scanner.next());

        Map<String, Integer> map = new HashMap<String, Integer>();
        Integer max = 0;
        for (int i = 0; i < N; i++) {
            String key = scanner.next();
            Integer count = map.get(key);
            Integer val = (count == null) ? 1 : count + 1;
            map.put(key, val);
            max = Math.max(max, val);
        }


        List<String> moji = new ArrayList<>();
        for (String key : map.keySet()) {
            if((int)map.get(key) == (int)max) {
                moji.add(key);
            }
        }
        moji.stream().sorted().collect(Collectors.toList()).forEach(System.out::println);
    }
}

Measured memory_bytes: 87380
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const ll N = 1e5 + 5, MOD = 1e9+7;

ll n,m;
ll l,r;
vector < pair<ll,ll> > v1,v2;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>n>>m;

    for( ll i=1; i<=m; i++ ){
        cin>>l>>r;
        v1.pb({l,r});
        v2.pb({r,l});
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());

    cout<<max(0LL,v2[0].first-v1[m-1].first+1)<<endl;
    return 0;
}




Measured memory_bytes: 3564
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	int N;
	cin >> N;

	__int128 kotae = 1;

	int zero = 0;
	int yabai = 0;
	rep(i, N) {
		ll a;
		cin >> a;

		kotae = kotae * a;

		if (kotae > ll(1e18)) {
		
			yabai = 1;
		}
		if (a == 0) {
			zero = 1;
		}
	}

	if (zero) co(0);
	else if (yabai) {
		co(-1);
	}
	else co(ll(kotae));


	Would you please return 0;
}

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

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

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

  ll res = -1;
  ll sum = 0;
  rep(i, m) sum += a[i];
  if (sum <= n) {
    res = n - sum;
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3636
import java.util.*;

public class Main{
	static String str;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int data = sc.nextInt();
		
		for(int i=0; i<data; i++){
			str = sc.next();
			System.out.println(DFS(0, str.length()-1));
		}
	}

	static int DFS(int left, int right){
		left++;
		if(str.charAt(left)>='0'&&str.charAt(left)<='9'){
			return Get_num(left);
		}

		int[] phase = new int[3333];
		int count = 0;
		int balance = 0;

		for(int i=left; i<right; i++){
			if(str.charAt(i)=='['){
				balance++;
			}else if(str.charAt(i)==']'){
				balance--;
				if(balance==0){
					phase[count++] = DFS(left, i);
					left = i + 1;
				}
			}
		}

		Arrays.sort(phase, 0, count);
		int sum = 0;

		for(int i=0; i<count/2+1; i++){
			sum += phase[i];
		}

		return sum;
	}

	static int Get_num(int n){
		int temp = str.charAt(n) - '0';
		while(str.charAt(n+1)>='0'&&str.charAt(n+1)<='9'){
			temp = 10*temp + (str.charAt(++n) - '0');
		}
		return temp/2+1;
	}
}

Measured memory_bytes: 66520
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
using namespace std;

ll n,ady[20][20],a,x,y,ans,var,cuantos;
bool ok;
set< ll > tipo[20];

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;
    for(ll i=0; i<n; i++){
        cin >> a;
        for(ll j=0; j<a; j++){
            cin >> x >> y;
            x--;
            ady[i][x] = 1+y;
        }
    }

    for(ll mask=0; mask<(1LL<<n); mask++){

        for(ll i=0; i<n; i++) tipo[i].clear();
        cuantos = 0;

        for(ll i=0; i<n; i++){
            var = mask&(1LL<<i);
            if( !var ){
                tipo[i].insert( 1 );
                continue;
            }
            tipo[i].insert( 2 );
            cuantos++;
            for(ll j=0; j<n; j++){
                if( !ady[i][j] ) continue;
                tipo[ j ].insert( ady[i][j] );
            }
        }

        ok = true;
        for(ll i=0; i<n; i++) if( tipo[i].size() > 1 ) ok = false;

        if( ok ) ans = max( ans , cuantos );
    }

    cout << ans;

    return 0;
}


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

int main(void){
        char S[4];
        int date;

        scanf("%s",S);

        date = atoi(S);

//      printf("%d, %d", date/100, date%100);

        if(date/100 <= 12 && date%100 <= 12 && date/100 != 0 && date%100 != 0){
                printf("AMBIGUOUS");
        }
        else if(date%100 != 0 && date%100 <= 12){
                printf("YYMM");
        }
        else if(date/100 != 0 && date/100 <= 12){
                printf("MMYY");
        }
        else{
                printf("NA");
        }
}

Measured memory_bytes: 128
n = int(input())
ans = 1
ans1 = 1
ans2 = 1
mod = 1000000007
for i in range(n):
	ans = (ans*10)%mod
	ans2 = (ans2*8)%mod
	ans1 = (ans1*9)%mod
ans = (ans - ans1 + mod)%mod
ans = (ans - ans1 + mod)%mod
ans = (ans + ans2)%mod
print(ans)


Measured memory_bytes: 9100
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	LL n, k; cin >> n >> k;
	vector<LL> v(n);

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

	vector<LL> u;
	u = v;
	reverse(u.begin(), u.end());
	
	
	LL ans = 0;
	for (int l = 0; l < k+1; l++) {
		for (int r = 0; r < k+1; r++) {
			if (l + r > k)continue;
			if (l + r > n)continue;


			LL tmp = 0;

			priority_queue<LL> que;

			if (l > 0) {
				for (int x = 0; x < l; x++) {
					tmp += v[x];

					if (v[x] < 0) {
						que.push(abs(v[x]));
					}
				}
			}

			if (r > 0) {
				for (int x = 0; x < r; x++) {
					tmp += u[x];

					if (u[x] < 0) {
						que.push(abs(u[x]));
					}
				}
			}


			int w = k - (l + r);

			for (int x = 0; x < w; x++) {
				if (!que.empty()) {
					tmp+=que.top();
					que.pop();
				}
			}
			

			ans = max(ans, tmp);
		}
	}
	
	cout << ans << endl;
	

	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<tuple>
#define LL long long
#define TT std::tuple<int,int,int>
int N, MA, MB;
int dp[2][4010][4010];
std::vector<TT> med;
int INF = 100000000;
int ans = INF;
int main() {
	std::cin >> N >> MA >> MB;
	for (int i = 0; i < N; i++) {
		int a, b, c;
		std::cin >> a >> b >> c;
		med.push_back(TT{ a,b,c });
	}
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j <= 4000; j++) {
			for (int k = 0; k <= 4000; k++) {
				if (j == 0 && k == 0)continue;
				dp[i][j][k] = INF;
			}
		}
	}
	for (int i = 1; i <= N; i++) {
		int a, b, c;
		std::tie(a, b, c) = med[i - 1];
		for (int j = 1; j <= 4000; j++) {
			for (int k = 1; k <= 4000; k++) {
				dp[i%2][j][k] = dp[(i - 1)%2][j][k];
				if (j - a >= 0 && k - b >= 0) {
					dp[i%2][j][k] = std::min(dp[i%2][j][k], dp[(i - 1)%2][j - a][k - b] + c);
				}
			}
		}
	}
	int D = 1;
	while (MA*D <= 4000 && MB*D <= 4000) {
		ans = std::min(ans, dp[N%2][MA*D][MB*D]);
		D++;
	}
	if (ans == INF)ans = -1;
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 125696
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int mod = 1e+9 + 7;

//マクロ
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main()
{
  int n;
  cin >> n;
  map<ll, ll> mp;
  vector<ll> v;
  ll sum = 0;
  rep(i, n)
  {
    ll k;
    cin >> k;
    mp[k]++;
    v.push_back(k);
  }
  for (auto x : mp)
  {
    if (x.second < 2)
    {
      continue;
    }
    sum += x.second * (x.second - 1) / 2;
  }
  rep(i, n)
  {
    ll ans = sum - (mp[v[i]] - 1);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 12912
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007

using namespace std;

int dfs(vector<int> g[],int dp[], int x) {
	
	if(dp[x] != -1) {
		return dp[x];
	}
	
	int temp = 0;
	for(auto it:g[x]) {
		temp = max(temp,dfs(g,dp,it)+1);
	}
	
	dp[x] = temp;
	return temp;
}

int longest_path(vector<int> g[],int n) {
	
	int dp[n];
	for(int i=0;i<n;i++) {
		dp[i] = -1;
	}
	
	for(int i=0;i<n;i++) {
		if(dp[i] == -1) {
			dfs(g,dp,i);
		}
	}
	
	int ans=0;
	for(int i=0;i<n;i++) {
		ans = max(ans,dp[i]);
	}
	
	return ans;
}

void input() {
	int n,m;
	cin>>n>>m;
	
	vector<int> g[n];
	
	for(int i=0;i<m;i++) {
		int x,y;	
		cin>>x>>y;
		
		x -= 1;
		y -= 1;
		
		g[x].push_back(y);
	}
	
	int ans = longest_path(g,n);
	
	cout<<ans;
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	input();
	
	return 0;
}


Measured memory_bytes: 12088
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000010

bool check(vector<long long> &a,long long mid){
	long long cnt = 0;
	long long N = a.size();
	for(int i=0;i<a.size();i++){
		long long t = a[i] + mid - (N-1);
		if(t>0)cnt += (t+N)/(N+1);
	}
	if(cnt>mid)return false;
	else return true;
}

int main(){
	
	long long N;
	cin>>N;
	
	vector<long long> a(N);
	for(int i=0;i<N;i++)cin>>a[i];
	
	long long ok = Inf/50 + 1;
	long long ng = -1;
	
	while(ok-ng>1){
		long long mid = (ok+ng)/2;
		bool f = false;
		for(int i=0;i<50;i++){
			if(check(a,mid*50+i)){
				ok = mid;
				f=true;
				break;
			}
		}
		if(!f)ng = mid;
	}
	
	for(int i=0;i<50;i++){
		if(check(a,ok*50+i)){
			cout<<ok*50+i<<endl;
			return 0;
		}
	}
	
	//cout<<ok<<endl;
			
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){

	int n, a, b;
	char s[100001];
	int c = 0;
	int d = 0;

	scanf("%d %d %d", &n, &a, &b);


	scanf("%s", s);

	for(int i = 0; i < n; i++){
		if(s[i] == 'a'){
			if(c < a + b){
				c++;
				printf("Yes\n");
			}
			else
				printf("No\n");

		}

		if(s[i] == 'b'){
			d++;
			if(c < a + b && d <= b){
				c++;
				printf("Yes\n");
			}
			else
				printf("No\n");

		}

		if(s[i] == 'c'){
			printf("No\n");

		}
	}

	return 0;


}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,c=0,i;
  	string str;
  	cin >> n;
  	cin >> str;
  	if(n%2!=0)	cout << "No" << endl;
  	else
    {
    	for(i=0;i<n/2;i++)
        {
          if(str[i]==str[(n/2)+i])
            c++;
        }
      	if(c==n/2)	cout << "Yes" << endl;
      	else cout << "No" << endl;
    }
  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()
const int maxn = 6010;
const int mod = 998244353;


int fac[maxn];
map <int,int> mp;


int expo(int x, int exp) {
	int res = 1, base = x;
	while (exp) {
		if (exp & 1) res = (res * base) % mod;
		base = (base*base) % mod;
		exp >>= 1;
	}
	return res;
}

int inv(int x) {
	if (mp.find(x) != mp.end()) return mp[x];
	else return mp[x] = expo(x,mod-2);
}


int choose(int N, int k) {
	return fac[N] * inv(fac[k]*fac[N - k] % mod) % mod;
}

int K,n;

int32_t main() {
	//FAST
	cin >> K >> n;
	fac[0] = 1;
	for (int i =1; i<maxn;i++) fac[i] = fac[i-1] * i % mod;
	
	for (int i = 2;i <= 2 * K; i++) {
		int ans = 0;
		int pairs = i/2 - max(1ll, i - K) + 1;
		
		for (int x = 0; x <= pairs; x++) {
			if (n < x * 2) break;
			int v = choose(n - x*2 + K -1, n - x * 2) * choose(pairs,x) % mod;
			if (x % 2 == 0) ans = (ans + v) % mod; 
			else ans = (ans - v + mod) % mod;
			//cout << i << " " << x << " " << v << " " << ans << "\n";
		}
		cout << ans << "\n";
	}
}









Measured memory_bytes: 16000
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void)
{	
	int n, k;
	cin >> n >> k;
	vector<int>x(n);
	rep(i, n) {
		cin >> x[i];
	}
	int ans = INF;
	rep(i, n - k + 1) {
		int l = x[i];
		int r = x[i + k-1];
		ans = min({ ans,abs(l) + abs(l - r),abs(r) + abs(l - r) });
	}
	print(ans);
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

vector<int> divisor(int n) {
    vector<int> ret;
    for (int 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;
}

int main(){
    int n; cin >> n;
    vector<int> lis(n);
    map<int, int> mp;
    int ans = 0;
    REP(i, 0, n){cin >> lis[i]; mp[lis[i]]++;}
    if(mp[1] == 1){
        cout << 1 << endl;
        return 0;
    }else if(mp[1] > 1){
        cout << 0 << endl;
        return 0;
    }
    REP(i, 0, n){
        vector<int> r = divisor(lis[i]);
        int f = 1;
        if(mp[lis[i]] != 1){
            f = 0;
            continue;
        }
        REP(l, 0, r.size()){
            if(r[l] == lis[i]){
                continue;
            }
            if(mp[r[l]] >= 1){
                f = 0;
                break;
            }
        }
        ans += f;
    }
    cout << ans << endl;
}

Measured memory_bytes: 32728
import java.util.Scanner

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = sc.next().map { it }
    val separate = s.partition { it == 'R' }
    if (separate.first.size > separate.second.size) {
        println("Yes")
    } else {
        println("No")
    }
}

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

using namespace std;

int main(){
	long long c,i,n,l = 0,r = 0,a = 0,ans = 0,x[100010],v[100010];
	cin >> n >> c;
	x[0] = 0; x[n+1] = c;
	for(i=1;i<=n;i++){
		cin >> x[i] >> v[i];
		l += v[i];
	}
	ans = l-2*x[n];
	for(i=n;i>=1;i--){
		l -= v[i];
		r += v[i];
		a = max(a,r-c+x[i]);
		ans = max(ans,a+l-2*x[i-1]);
	}
	
	a = 0;
	ans = max(ans,r-2*(c-x[1]));
	for(i=1;i<=n;i++){
		r -= v[i];
		l += v[i];
		a = max(a,l-x[i]);
		ans = max(ans,a+r-2*(c-x[i+1]));
	}
	cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  rep(i, N) { cin >> d.at(i); }
  sort(d.begin(), d.end());

  int before = d.at(0);
  int cnt = 1;
  rep_s(i, 1, N) {
    if (before != d.at(i)) {
      before = d.at(i);
      cnt++;
    }
  }

  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define ll long long
int main(){
  ll N;
  cin>>N;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];
  ll M=0;
  rep(i,N){
    if(A[i]<0) M++;
    A[i]=abs(A[i]);
  }
  sort(all(A));
  ll sum=0;
  rep(i,N) sum+=A[i];
  if(M%2) cout<<sum-A[0]-A[0]<<endl;
  else cout<<sum<<endl;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	var m int
	fmt.Scan(&n)
	fmt.Scan(&m)

	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&nums[i])
	}
	sort.Ints(nums)

	var b, c int
	bcs := make(map[int]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&b)
		fmt.Scan(&c)

		bcs[c] += b
	}
	// fmt.Println(bcs)

	cs := make([]int, m)
	for k := range bcs {
		cs = append(cs, k)
	}
	sort.Sort(sort.Reverse(sort.IntSlice(cs)))

	// fmt.Println(cs)

	idx := 0
LOOP:
	for _, cval := range cs {
		for j := 0; j < bcs[cval]; j++ {
			if idx == n {
				break LOOP
			}

			if nums[idx] < cval {
				nums[idx] = cval
				idx++
			} else {
				break LOOP
			}

		}
	}

	// fmt.Println(nums)

	sum := 0
	for i := 0; i < n; i++ {
		sum += nums[i]
	}

	fmt.Println(sum)
}


Measured memory_bytes: 13824
/*
                    Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include <bits/stdc++.h>
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
            
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
        int result=1;
        while(n>0)
        {   if(n % 2 ==1)
            result=(result * x) % M;
            x=(x*x)% M;
            n=n/2;
        }
    return result % M;
    }     
signed main()
{   jaldi
    int n,count=1,s=0;
    cin>>n;
    if(n<=1)
    cout<<1;
    else
    {   n/=2;
        while(1)
        {   if(n==1)
            {   s++;
                count+=pow(2,s);
                break;
            } 
            s++;
            count+=pow(2,s);
            n/=2;
        }
        cout<<count;
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python

from collections import deque
import itertools as ite
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N = input()
H = map(int, raw_input().split())

pre = -1
f1 = f2 = True
for num in H:
    if pre < num:
        f1 = f2 = True
    elif pre == num:
        pass
    elif pre == num + 1 and f1:
        f1 = False
        f2 = True
    else:
        print "No"
        exit()
    pre = num
print "Yes"

Measured memory_bytes: 11580
N, M = list(map(int, input().split()))
V = [list(map(int, input().split())) for _ in range(N)]
V.sort()
res = 0
cnt = 0
for i in range(N):
    res += V[i][0] * V[i][1]
    cnt += V[i][1]
    if cnt > M:
        res -= V[i][0] * (cnt - M)
        break
print(res)


Measured memory_bytes: 27444
#include <iostream>
#include <utility>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <map>
#include <fstream>
#include <bitset>
#include <stack>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<ll> vec;


int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int x, y; cin >> x >> y;
	cout << x + y / 2;


	return 0;

}

Measured memory_bytes: 768
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
/********************************************************************************************************************************/
/* main *************************************************************************************************************************/
/********************************************************************************************************************************/
int DEBUG = 0;										/* デバッグプリント 提出時は0 */
int main()
{
	int		i=1,x[10001];
	
	do {
		scanf("%d", &x[i]);
	} while(x[i++]!=0);

	for(i=1;x[i]!=0;i++) {
		printf("Case %d: %d\n",i,x[i]);
	}
	return 0;
}



Measured memory_bytes: 1980
import itertools

n = int(input())
a = []
for _ in range(n):
    b = list(map(str,input()))
    a.append(b)

ans = [0]*5

for i in range(n):
    tmp = a[i][0]
    if tmp == "M":
        ans[0] += 1
    elif tmp == "A":
        ans[1] += 1
    elif tmp == "R":
        ans[2] += 1
    elif tmp == "C":
        ans[3] += 1
    elif tmp == "H":
        ans[4] += 1
    else:
        continue

cnt = 0
for l in itertools.combinations(ans,3):
    cnt += l[0]*l[1]*l[2]

print(cnt)

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

#define db(x) cout<<x<<'\n'
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define repi(i,n) for(int i=0;i<(n);++i)
//#define repA(i,a,n) for(int i=a;i<=(n);++i)
//#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define ll long long int
#define endl '\n'
#define lld long long double
#define vi vector<int> 
#define vl vector<ll> 
#define vb vector<bool> 
#define vvi vector<vector<int>  >
#define err(t) cout<<"Error : "<<t<<endl;
#define all(v) v.begin(),v.end()
#define mp make_pair
#define M 100000
#define MD 1000000007 //998244353
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= (b); i++)
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define vec(a) vector<a >
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
//template <typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll binpow(ll a,ll b){	if(a==0) return 0; if(b==0) return 1;ll ans=1;while(b>0){if(b&1) ans=ans*a; a=a*a; b=b>>1;}	return ans;}


int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	// int n;cin>>n;
	// string s;cin>>s;
	bool z=false;
	ll n;cin>>n; vl a(n); repi(i,n) {cin>>a[i];if(a[i]==0) z=true;}
	if(z){
		cout<<0<<endl;
	}
	else{
	__int128 p=1,q=1000000000000000000;ll ans=1;
	for(int i=0;i<n;++i){
		p*=a[i];
		if(p>q) {ans=-1;break;}
	}
	if(ans==-1) ; else ans=p;
	db(ans); 
	}
	/*
	int test1;cin>>test1;while(test1--){ 
		
	 }
	 //*/
return 0;
}



Measured memory_bytes: 3992
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 998244353;
constexpr ll modsize = 0;
vector<ll> fac(modsize);
vector<ll> inv(modsize);
vector<ll> facinv(modsize);

void modcalc() {
	if (modsize == 0) abort();
	fac[0] = 1; fac[1] = 1; inv[1] = 1;
	facinv[0] = 1; facinv[1] = 1;
	for (ll i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modinv(ll a) {
	if (a == 0) abort();
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0 || n == 0 && k > 0) return 0;
	if (n == 0 && k == 0) return 1;
	return fac[n + k - 1] * facinv[k] % mod * facinv[n - 1] % mod;
}

int mat_rank(vector<vector<int>> mat) {
	int n = mat.size();
	int m = mat[0].size();
	int st = 0;
	rep(j, m) {
		int idx = -1;
		for (int i = st; i < n; i++) {
			if (mat[i][j]) {
				if (idx == -1) {
					idx = i;
					continue;
				}
				rep(k, m) {
					mat[i][k] ^= mat[idx][k];
				}
			}
		}
		for (int i = st - 1; i >= 0; i--) {
			if (mat[i][j]) {
				if (idx == -1) continue;
				rep(k, m) {
					mat[i][k] ^= mat[idx][k];
				}
			}
		}
		if (idx != -1) {
			rep(k, m) {
				swap(mat[idx][k], mat[st][k]);
			}
			st++;
		}
	}
	return st;
}

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

	int n, m;
	cin >> n >> m;
	vector<vector<int>> a(n, vector<int>(m));
	rep(i, n) rep(j, m) cin >> a[i][j];
	int r = mat_rank(a);
	cout << modpow(2, n + m - r - 1)*(modpow(2, r) - 1) % mod << '\n';
}


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

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int n;
string s;

string solve(string start){
    string res = start;
    REP1(i, n-1){
        if(s[i] == 'o'){
            if(res[i] == 'S') res += (res[i-1] == 'S' ? 'S' : 'W');
            if(res[i] == 'W') res += (res[i-1] == 'S' ? 'W' : 'S');
        }else{
            if(res[i] == 'W') res += (res[i-1] == 'S' ? 'S' : 'W');
            if(res[i] == 'S') res += (res[i-1] == 'S' ? 'W' : 'S');
        }
    }

    bool check = true;
    REP1(i, n-1){
        if(res[i] == 'S'){
            if(s[i] == 'o') check &= res[i-1] == res[i+1];
            if(s[i] == 'x') check &= res[i-1] != res[i+1];
        }else{
            if(s[i] == 'o') check &= res[i-1] != res[i+1];
            if(s[i] == 'x') check &= res[i-1] == res[i+1];
        }
    }

    if(res[0] == 'S'){
        if(s[0] == 'o') check &= res[n-1] == res[1];
        if(s[0] == 'x') check &= res[n-1] != res[1];
    }else{
        if(s[0] == 'o') check &= res[n-1] != res[1];
        if(s[0] == 'x') check &= res[n-1] == res[1];
    }

    if(res[n-1] == 'S'){
        if(s[n-1] == 'o') check &= res[n-2] == res[0];
        if(s[n-1] == 'x') check &= res[n-2] != res[0];
    }else{
        if(s[n-1] == 'o') check &= res[n-2] != res[0];
        if(s[n-1] == 'x') check &= res[n-2] == res[0];
    }

    if(check) return res;
    return "";
}

int main(){
    cin >> n >> s;

    string ans;
    ans = solve("SS");
    if(ans != ""){
        cout <<ans << endl;
        return 0;
    }

    ans = solve("SW");
    if(ans != ""){
        cout <<ans << endl;
        return 0;
    }

    ans = solve("WS");
    if(ans != ""){
        cout <<ans << endl;
        return 0;
    }

    ans = solve("WW");
    if(ans != ""){
        cout <<ans << endl;
        return 0;
    }


    cout << -1 << endl;
}


Measured memory_bytes: 776