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

int N;

int main() {
    cin >> N;
    
    int ans;
    for (int i = N; i >= 1; i--) {
        if ((int)sqrt(i) * (int)sqrt(i) == i) {
            ans = i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

#define MAX 7368791

using namespace std;


int main()
{
    int m, n;
    bool flag[MAX];
    while (cin >> m >> n, m)
    {
        for(int i = 0; i < MAX; i++){
            flag[i] = false;
        }
        for(int i = m;; i++){
            if(!flag[i]){
                if(n == 0){
                    cout << i << endl;
                    break;
                }else{
                    n--;
                    for(int j = i; j <= MAX ;j += i){
                        flag[j] = true;
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 10256
#include<stdio.h>
#include<vector>
using namespace std;

const int V_MAX = 10000;

int main() {
	int v, e;
	int table[V_MAX] = { 0 };
	vector<int> edge[V_MAX];
	vector<int> ans;

	scanf("%d %d", &v, &e);

	for (int i = 0; i < e; i++) {
		int s, t;
		scanf("%d %d", &s, &t);
		edge[s].push_back(t);
		table[t]++;
	}
	
	for (int i = 0; i < v; i++) {
		if (table[i] == 0) {
			ans.push_back(i);
		}
	}

	for (int i = 0; i < ans.size();i++) {
		vector<int> e = edge[ans[i]];
		for (int j = 0; j < e.size(); j++) {
			if (--(table[e[j]]) == 0) {
				ans.push_back(e[j]);
			}
		}
	}

	for (vector<int>::iterator it = ans.begin(); it != ans.end(); it++) {
		printf("%d\n", *it);
	}
	
	return 0;
}

Measured memory_bytes: 3344
import java.util.Scanner

fun main(args: Array<String>){
  val scn = Scanner(System.`in`) //Scannerのインスタンスを作成
  
  val a: Int = scn.nextInt()
  val b: Int = scn.nextInt()
  var result: Int = -1

  for(i in 10000 downTo 1) {
    val c = floor(i * 0.08)
    val d = floor(i * 0.10)
    if (a == c && b == d) result = i
  }
  println(result)
}

fun floor(num: Double) : Int {
  val a = num * 100
  val b = a % 100
  val c = (a - b) / 100
  return c.toInt()
}


Measured memory_bytes: 31260
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}

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

int main(void) {
  string s;
  string t;
  cin>>s>>t;
  int c=0;
  for(int i=0; i<3; i++) {
    if(s[i]==t[i])
      c++;
  }
  std::cout << c << std::endl;
  return 0;
}



Measured memory_bytes: 760
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>

using namespace std;
static const int MAX = 100010;

int read(){
    char ch = getchar();
    int f = 1, x = 0;
    while(ch-'0' < 0 || ch-'0' > 9){if (ch == '-') f = -1; ch = getchar();}
    while(ch-'0' >= 0 && ch-'0' <= 9){x = x*10 + ch-'0'; ch = getchar();}

    return f * x;
}

int n, l, t;
int pos[MAX];

int main(){
    n = read(); l = read(); t = read();
    
    int tmp = 0;
    for (int i = 0; i < n; i++){
        int x = read(), w = read();
        if (w == 1){
            pos[i] = (x + t) % l;
            tmp += (x + t) / l;
        }else{
            pos[i] = (x - t) % l;
            tmp += (x - t) /l;
            if (pos[i] < 0){
                pos[i] += l;
                tmp--;
            }
        }
    }

    tmp = ((tmp % n) + n) % n;
    sort(pos, pos + n);

    for (int i = tmp; i < n; i++) cout << pos[i] << endl;
    for (int i = 0; i < tmp; i++) cout << pos[i] << endl;

    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n,z,w;
  cin >> n >> z >> w;
  vec a(n);
  for(ll i=0;i<n;i++) {
    cin >> a[i];
  }
  if(n==1) {
    cout << abs(a[n-1]-w) << endl;
    return 0;
  }
  cout << max(abs(a[n-1]-w),abs(a[n-1]-a[n-2])) << endl;
}

Measured memory_bytes: 256
import sys

N=int(input())
sys.setrecursionlimit(27000)

cnt=0
def func(n:int,x:str):
    global cnt
    cnt_3=x.count('3')
    cnt_5=x.count('5')
    cnt_7=x.count('7')
    if n<len(x):
        return 0
    if int(x)<=N and cnt_3>0 and cnt_5>0 and cnt_7>0:
        cnt+=1
    func(n,x+'3')
    func(n,x+'5')
    func(n,x+'7')

func(len(str(N)),'3')
func(len(str(N)),'5')
func(len(str(N)),'7')
print(cnt)

Measured memory_bytes: 9168
#include<bits/stdc++.h> 
using namespace std;
int main(){
	int n,a[200005];
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int ok=1;
	for(int i=1;i<n;i++){
		if(a[i]==a[i-1]){
			ok=0;
			break;
		}
	}
	if(ok)cout<<"YES\n"<<endl;
	else cout<<"NO\n"<<endl;
	return 0;
}



Measured memory_bytes: 1024
n, m = gets.split.map(&:to_i)

$visited = Array.new(n+1,false)
$graph = Array.new(n+1){Array.new(n+1, false)}


edge = []

0.upto(m-1) do |i|
  edge[i] = gets.split.map(&:to_i)
end

#隣接行列
0.upto(m-1) do |i|
  $graph[edge[i][0]][edge[i][1]] = $graph[edge[i][1]][edge[i][0]] = true
end


#深さ優先探索
def dfs(v)
  $visited[v] = true
  $graph[v].each_with_index do |b, i|
    dfs(i)  if !$visited[i] & b && i!= 0
  end
  return
end

ans = 0

0.upto(m-1) do |i|
  $visited = Array.new(n+1,false)
  $visited[0] = true
  $graph[edge[i][0]][edge[i][1]] = $graph[edge[i][1]][edge[i][0]] = false
  dfs(1)
  if $visited.include?(false)
    ans += 1
  end
  $graph[edge[i][0]][edge[i][1]] = $graph[edge[i][1]][edge[i][0]] = true
end

puts ans


Measured memory_bytes: 3836
#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 repn(i, n) for(int i = 1; i <= (int)(n); i++)
#define reprn(i, n) for(int i = ((int)(n)); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define LARGE_PRIME_NUM 1000000007
using ll = long long;

#include <iostream>
#include <array>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <numeric>
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	int l = 0;
	int r = n + 1;
	int ll, rr;
	rep(i, m) {
		cin >> ll >> rr;
		l = max(l, ll);
		r = min(r, rr);
	}
	if (l <= r) {
		cout << r - l + 1 << endl;
	} else {
		cout << 0 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define N 100000

int main(){
  int i,j;
  int li[N],near[N];
  int num1,num2;
  int cnt=0;

  scanf("%d",&num1);
  for(i=0;i<num1;i++) scanf("%d",&li[i]);

  scanf("%d",&num2);
  
  for(i=0;i<num2;i++) {
    scanf("%d",&near[i]);
    //search
    j = 0;
    li[num1] = near[i];
    while (li[j] != near[i]){
      if(j == num1) break;
      j++;
    }
    if(j < num1) cnt++;
  }  

  /*
    i = 0;
    while(i != num1){
    j = 0;
    while(j != num2){
    if(li[i] == near[j]) cnt++;
    j++;
    }
    i++;
    }
  */
  printf("%d\n",cnt);
  
  return 0;
}
  
    



Measured memory_bytes: 2740
#include<stdio.h>

  void QSort(long long int x[ ],long long int left, long long int  right)
{
    long long int i, j;
    long long int pivot;

    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */

    pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

    while (1) {                    /* 無限ループ */

        while (x[i] < pivot)       /* pivot より大きい値が */
            i++;                   /* 出るまで i を増加させる */

        while (pivot < x[j])       /* pivot より小さい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */

        Swap(x, i, j);             /* x[i] と x[j]を交換 */
        i++;                       /* 次のデータ */
        j--;
    }
    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}

  /* 配列の要素を交換する */
void Swap(long long int x[ ], long long int i, long long int j)
{
    long long int temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

int main(){
  long long int a,s[200001],i,n,cnt=0,sum=0,j;
  scanf("%ld",&n);
  s[0]=0;
  for(i=0;i<n;i++){
    scanf("%ld",&a);
    s[i+1]=s[i]+a;
    if(s[i+1]==0) sum++;
  }
  QSort(s, 1, n);
  for(i=1;i<n;i++){
    cnt=0;

    for(j=i+1;j<n+1;j++){
      if(s[i]==s[j]) cnt++;
      else break;
    }
    i+=cnt;
    sum+=cnt*(cnt+1)/2;

  }
  printf("%ld\n",sum);
}

Measured memory_bytes: 1664
#include <iostream>
using namespace std;
int main(void){
    // 
    
    int d;
    
    cin>>d;
    
   if(d==25){
       cout<<"Christmas"<<endl;
   }
        
   else if(d==24){
        cout<<"Christmas Eve"<<endl;
    }
    
    else if(d==23){
        cout<<"Christmas Eve Eve"<<endl;
    }
    
    else{
        cout<<"Christmas Eve Eve Eve"<<endl;
    }
    
    return 0;
    
    
}


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

int main(){
int N;
cin >> N;

vector<long long> A(N), B(N), C(N);
for(int i = 0; i < N; i++){ 
      cin >> A.at(i);
}

for(int i = 0; i < N; i++){ 
      cin >> B.at(i);
}

for(int i = 0; i < N; i++){ 
      cin >> C.at(i);
}

sort(A.begin(), A.end());
sort(C.begin(), C.end());

// long long a_cnt = 0, b_cnt = 0;
long long ans = 0;
for(int i = 0; i < N; i++){ 
        long long a = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
        long long b = N - (upper_bound(C.begin(), C.end(), B[i]) - C.begin());
      ans += a * b;
}


cout << ans << endl;

}

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

int main(){
	long long N, M;
	cin >> N >> M;
	vector<pair<long long, long long>> A(N);
	for(long long i = 0; i < N; i++){
		cin >> A.at(i).first >> A.at(i).second;
	}
	
	sort(A.begin(), A.end());
	
	long long price = 0;//かかった金額
	long long Juice = 0;//買った本数
	
	for(long long i = 0; i < N; i++){
		if(Juice + A.at(i).second < M){
			Juice += A.at(i).second;
			price += A.at(i).first * A.at(i).second;
		} else {
			while(Juice < M){
				price += A.at(i).first;
				Juice++;
			}
		}
	}
	
	cout << price << endl;
}

Measured memory_bytes: 1792
// Etavioxy
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#define il inline
#define ll long long
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in" ,"r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch;int f=1;
	while(!isdigit(ch=getchar()))f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar()))x=(x*10)+(ch^'0');
	return f*x;
}

int main(){
	ll n,a,b;
	scanf("%lld%lld%lld",&n,&a,&b);
	if( ((a-b)&1)==0 ){
		printf("%lld\n",abs(a-b)/2);
	}else{
		if( a>b ) swap(a,b);
		if( a-1 > n-b ){
			a=n+1-a;
			b=n+1-b;
		}
		printf("%lld\n",(b-a-1)/2+a);
	}
	return 0;
}


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

int main() {
    int k=0,i;
    string s;
    cin>>s;
    for(i=0;i<s.size();i++)
    {
        if(s[i]=='o')
        k++;
    }
    if(15-s.size()+k>=8)
    cout<<"YES"<<endl;
    else
    cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <climits>

using namespace std;

int main(){
    int n, l; cin >> n >> l;
    int sum=n*(n+1)/2+l*n-n;
    int diff=INT_MAX;
    int ans=0;
    for(int i=1; i<=n; ++i){
        int x=sum-(l+i-1);
        if(abs(x-sum)<diff){
            diff=abs(x-sum);
            ans=x;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
	int N;
	cin >> N;

	vector<int> A(N);
	rep(i, N) cin >> A.at(i);
	sort(A.begin(), A.end());
	reverse(A.begin(), A.end());

	int Ans = 0;
	rep(i, N) {
		if (i%2 == 0){
			Ans += A.at(i);
		}else{
			Ans -= A.at(i);
		}

	}
	printf("%d\n", Ans);
	return 0;
}

Measured memory_bytes: 256
#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 <fstream>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long ll;
#define REP(i, N) for (int i = 0; i < (int)N; i++)

struct edge { int to, cost; };
struct node {
  int id, distance;
  node(int id, int distance) {
    this->id = id;
    this->distance = distance;
  }
  bool operator <(const node &theOther) const { return distance < theOther.distance; }
  bool operator >(const node &theOther) const { return distance > theOther.distance; }
};
int prim(vector<vector<edge>> G) {
  int total = 0;
  int V = G.size();
  bool used[V];
  priority_queue<node, vector<node>, greater<node> > que;

  que.push(node(0, 0));
  for(int i = 0; i < V; i++) used[i] = false;

  while(!que.empty()) {
    node n = que.top(); que.pop();
    if(used[n.id]) continue;
    used[n.id] = true;
    total += n.distance;
    for(edge e : G[n.id]) {
      if(!used[e.to]) que.push(node(e.to, e.cost));
    }
  }
  return total;
}

int main () {
  int V, E;
  cin >> V >> E;
  vector<vector<edge>> G(V);
  for(int i = 0; i < E; i++){
    int s, t, w;
    cin >> s >> t >> w;
    G[s].push_back(edge {t, w});
    G[t].push_back(edge {s, w});
  }
  cout << prim(G) << endl;
  return 0;
}

Measured memory_bytes: 6672
<?php
# D - Megalomania

fscanf(STDIN, "%d", $N);

$work_array = [];
for ( $i = 0; $i < $N; $i++ ) {
    $array = explode(' ', fgets(STDIN));
    $work_array[] = [intval($array[0]), intval($array[1])]; 
}

foreach($work_array as $key => $val){
	$sort_key[$key]=$val[1];
}

array_multisort($sort_key, SORT_ASC, $work_array);

$time = 0;
foreach($work_array as $key => $val){
    $time += $val[0];
    if ($time > $val[1]) {
        echo 'No' . PHP_EOL;
        exit;
    }
}
echo 'Yes' . PHP_EOL;


Measured memory_bytes: 115564
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a,sum;
  sum=0;
  vector<int> num_a;
  cin>>a;
  for(int i=0;i<a-1;i++){
    int tmp;
    cin>>tmp;
    num_a.push_back(tmp);

  }
  for(int i=0;i<a-2;i++){
    sum+= min(num_a[i],num_a[i+1]);
  }
  sum+=num_a[0];
  sum+=num_a[a-2];
  cout<<sum<<endl;
}




Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        n: usize,
        xs: [i32; n],
    }

    let mut xs = xs;
    xs.sort();
    xs.reverse();
    let mut xs_iter = xs.into_iter().enumerate();
    let mut alice = 0;
    let mut bob = 0;
    while let &Some((idx, x)) = &xs_iter.next() {
        if idx % 2 == 0 {
            alice += x;
        } else {
            bob += x;
        }
    }
    println!("{}", alice - bob);
}


Measured memory_bytes: 4352
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int H = sc.nextInt();
	int M = sc.nextInt();
	int result = (N-H+1)*(N-M+1);
	System.out.println(result);
    }

}

Measured memory_bytes: 23252
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
using namespace std;

double x01,y01,x02,y02;

int main(){
    cin>>x01>>y01>>x02>>y02;
    double distance=sqrt((x01-x02)*(x01-x02)+(y01-y02)*(y01-y02));
    printf("%.5lf\n",distance);
    return 0;
}



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

int main(void){
	int s,w;

	scanf("%d %d",&s,&w);
	if(w>=s){
		printf("unsafe");
	}else{
		printf("safe");
	}
	return 0;
}

Measured memory_bytes: 1736
// :)
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <sstream>
#include <stack>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <vector>

typedef long long LL;

using namespace std;

std::random_device rd_device;
std::mt19937 rng(rd_device());

int main() {
    ios::sync_with_stdio(false);
    cin.exceptions(ios_base::failbit);
    cin.tie(NULL);
    cout.tie(NULL);
    cout.precision(10);
    cout<<fixed;
    
    LL N;
    vector<LL> s(5);
    cin>>N;
    for (int i=0;i<5;i++) {
        cin>>s[i];
        if (i > 0 && s[i] > s[i-1]) s[i] = s[i-1];
    }
    LL ma = 0;
    for (int i=0;i<5;i++) {
        LL delay = N % s[i] == 0? N / s[i] : N / s[i] + 1;
        delay += i;
        ma = max(ma, delay);
    }

    cout<<ma<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
  int n, d; cin >> n >> d;
  int cnt = 1, ans = 0;
  while (cnt<=n) 
  {
    ans++;
    cnt += (2*d + 1);
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	ll X;
	cin >> X;
	
	ll ma = 1;
	for(ll i=2;i<=X;i++){
		ll v = i;
		while(v * i <= X) v *= i;
		if(v != i) ma = max(ma, v);
	}
	
	cout << ma << endl;
	
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String a;
        a = scanner.next();
        if (a.contains("7")) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

}

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

int main() {
    int n;
    cin >> n;
    deque<int> deq;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (n % 2 == 0) {
            if (i % 2 == 0) deq.push_back(a);
            else deq.push_front(a);
        } else {
            if (i % 2 == 0) deq.push_front(a);
            else deq.push_back(a);
        }

    }
    for (int i = 0; i < n; i++)
        cout << deq[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 2944
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> n;
	vector<ll>	a(n+1);
	for(i=1;i<=n;i++) cin >> a[i];
	for(i=1;i<=n;i++) {
		if ((i%2==1)&&(a[i]%2==1)) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
fn main(){
    let m: u64 = 1000000007;
    
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).expect("failed to read");
    let vt: Vec<char> = buf.trim().chars().collect();

    buf.clear();
    std::io::stdin().read_line(&mut buf).expect("failed to read");
    let vb: Vec<char> = buf.trim().chars().collect();
    let vbl = vb.len();
    
    let mut vcnt: Vec<u64> = vec![0; vbl];

    for i in 0 .. vt.len() {
        for j in (0 .. vbl).rev() {
            if vt[i] == vb[j] {
                if j == 0 {
                    vcnt[j] = (vcnt[j] + 1) % m;
                } else {
                    vcnt[j] = (vcnt[j] + vcnt[j-1]) % m;
                }
            }
        }
    }

    println!("{}", vcnt[vbl-1]);
}



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

typedef long long ll;

const ll MAKS = 1e18;

ll n;
ll cek(ll x, ll p){
	ll ret = 0ll;
	while(x > 0){
		ret += x/p;
		x/=p;
	}
	return ret;
}

ll cari(ll x){
	ll ret = 1ll;
	while(ret%x != 0){
		if(ret == MAKS) return -1;
		ret*=10ll;
	}
	return ret;
}

int main(){
	scanf("%lld",&n);
	if(n&1){
		printf("0\n");
		return 0;
	}
	ll ans = 0ll;
	ll tmp = 10;
	while(tmp <= n){
		ans += n/tmp;
//		cout << "NAMBAH " << n/tmp << endl;;
//		if(tmp > 10){
//			ll buang = cari(tmp);
////			if(buang != -1) ans -= n/buang;
//			printf("%20lld buang %20lld\n",tmp,buang);
//			cout << "NGURANG " << n/buang << endl;
//		}
		tmp*=5ll;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,x,n) for(ll i=x;i<n;i++) 
#define sort(v) sort(v.begin(),v.end());
const ll mod = 1E9+7;

int main()
{
  ll a,b,c;
  cin>>a>>b>>c;
  swap(a,b);
  swap(a,c);
  cout<<a<<" "<<b<<" "<<c;
}

Measured memory_bytes: 3604
n,d = map(int,input().split())
count = 0
a = [0]*n
b = [0]*n
for i in range(n):
    a[i], b[i] = map(int, input().split())
for i in range(n):
  x = (a[i]**2 + b[i]**2)**(1/2)
  if x <= d:
    count += 1
  else:
    pass    
print(count)

Measured memory_bytes: 24700
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(c) c.begin(),c.end()
#define PB push_back

using namespace std;
typedef long long ll;

int main()
{
  string s;
  cin >> s;
  int K;
  cin >> K;
  vector<string> v;
  REP(i, s.size()) {
    for (int j = 1; j <= 5; j++) {
      if (i + j <= s.size()) {
        string tmp = s.substr(i, j);
        bool flag = true;
        for (int i = 0; i < v.size(); i++) {
          if (tmp == v[i]) {
            flag = false;
            break;
          }
        }
        if (flag) v.PB(tmp);
      }
    }
  }
  sort(ALL(v));
  cout << v[K - 1] << endl;

  return 0;
}

Measured memory_bytes: 1024
n,m = map(int,input().split())
a_L = list(map(int,input().split()))
s = sum(a_L)

counter = 0
for i in range(n):
    if float(a_L[i]) >= s/(4*m):
        counter += 1
if counter >= m:
    print("Yes")
else:
    print("No")

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

using namespace std;

#define ipair pair<int,int>
#define rep(I,N) for(int I=0; I<N; I++)
#define rrep(I,N) for(int I=N; I>=0; I--)
#define repj(i,j,n) for(int i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
    int N, M;
    cin >> N >> M;

    int p[100000];

    UnionFind tree(N);

    rep(i, N) {
      cin >> p[i];
      p[i]--;
    }

    for(int i = 0; i < M; i++) {
      int  x, y;
      cin >> x >> y;
      tree.unite(x-1, y-1); // xの木とyの木を併合する
    }

    int cnt=0;
    rep(i, N) {
      if(tree.same(p[i], i)){
        cnt++;
      }
    }

    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 1024
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int[] A = new int[N];
        int[] B = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.i();
            B[i] = in.i();
        }

        long ans = 0;
        for (int i = N - 1; i >= 0; i--) {
            long a = A[i] + ans;
            if (A[i] % B[i] > 0) {
                long d = (1 + (a - 1) / B[i]) * B[i];
                ans += d - a;
            }
        }

        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 36252
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            String line = sc.nextLine();

            for(int i=0; i<line.length(); i++){
                char ch =line.charAt(i);
                if(Character.isLowerCase(ch)) {
                    System.out.print(Character.toUpperCase(ch));
                }else{
                    System.out.print(Character.toLowerCase(ch));
                    }
                }
            System.out.println();
            }
        }
    }


Measured memory_bytes: 26676
//package _0139;



import java.util.*;

import java.lang.*;

import java.math.*;



public class Main {

	Scanner sc = new Scanner(System.in);



	boolean isA(String snake) throws Exception {

		if (snake.startsWith(">'")) {

			if (snake.endsWith("~")) {

				String mid = snake.substring(2, snake.length() - 1);

				if (mid.length() >= 3) {

					String[] spl = mid.split("#", 2);

					if (spl[0].equals(spl[1])) {

						for (int i = 0; i < spl[0].length(); i++) {

							if ('=' != spl[0].charAt(i)) {

								return false;

							}

						}

						return true;

					}

				}

			}

		}

		return false;

	}



	boolean isB(String snake) throws Exception {

		if (snake.startsWith(">^")) {

			if (snake.endsWith("~~")) {

				String mid = snake.substring(2, snake.length() - 2);

				if (mid.length() >= 2) {

					while (mid.startsWith("Q=")) {

						mid = mid.substring(2);

					}

					if (mid.equals("")) {

						return true;

					}

				}

			}

		}

		return false;

	}



	/*

	 * >'======#======~ >^Q=Q=Q=Q=Q=Q=Q=Q=Q=~~

	 */

	String getAns(String snake) {

		String ret = "NA";

		if (snake.startsWith(">'")) {

			try {

				if (isA(snake))

					ret = "A";

			} catch (Exception e) {



			}

		} else if (snake.startsWith(">^")) {

			try {

				if (isB(snake))

					ret = "B";

			} catch (Exception e) {



			}

		}

		return ret;

	}



	void run() {

		int n = sc.nextInt();

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

			System.out.println(getAns(sc.next()));

		}

	}



	public static void main(String[] args) {

		Main m = new Main();

		m.run();

	}

}

Measured memory_bytes: 12000
use std::io;

fn main() {
    let (n, m) = {
        let i = read::<usize>();
        (i[0], i[1])
    };

    let mut ab = Vec::new();
    for _ in 0..m {
        let (a, b) = {
            let i = read::<usize>();
            (i[0], i[1])
        };
        ab.push((a, b));
    }

    ab.sort_by_key(|x| x.1);

    let mut ans = 0;
    let mut bnd = 0;

    for (a, b) in ab {
        if a >= bnd {
            ans += 1;
            bnd = ::std::cmp::max(bnd, b);
        }
    }

    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 6396
N = int(input())
ABs = []
for i in range(N):
  A, B = map(int, input().split())
  ABs.append((A, B))
ABs.sort(key=lambda AB: sum(AB), reverse=True)
r = sum([AB[0] for AB in ABs[0::2]])-sum([AB[1] for AB in ABs[1::2]])
print(r)


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

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

    int r = 0;
    if(n%2 != 0)
    {
        cout << n * 2 << endl;
        return 0;
    }
    else
    {
        cout << n << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    sort(arr,arr+n,greater<int>());
    ll sum=0;
    for(int i=k;i<n;i++){
        sum+=arr[i];
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 1792
local a, b, x = io.read("*n", "*n", "*n")
local height = x / a / a--高さ
local diff = b - height--口までの高さ
if height >= diff then
	local diag = math.sqrt(a*a + diff*diff*4)
	print(math.deg(math.atan((diff * 2) / a)))
else
	local bottom = a * height * 2 / b
	print(math.deg(math.atan(b / bottom)))
end

Measured memory_bytes: 256
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << "\n"; }

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

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


#line 2 "tmp.cpp"

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

  int n;
  cin >> n;
  vector<string> s(n);
  REP(i, n) { cin >> s[i]; }

  // 愚直解
  int ans = 0;
  REP(diff, n) {
    int a = 0;
    int b = a + diff;
    bool ok = true;
    REP(i, n) {
      REP(j, n) {
        if (s[(i + a) % n][(j + b) % n] != s[(j + a) % n][(i + b) % n])
          ok = false;
      }
    }
    if (ok)
      ans += n;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define endl "\n";
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define double long double
const int mod = 1e9 + 7;

int32_t main()
{	
	fastio;
    
    int n, m; cin >> n >> m;
    vector<int> h(n+1);
    for(int i=1; i<=n; i++){
    	cin >> h[i];
    }

    unordered_map<int,vector<int>> mp;
    for(int i=0; i<m; i++){
    	int a, b; cin >> a >> b;
    	mp[a].push_back(b);
    	mp[b].push_back(a);
    }

    vector<int> v(n+1,0);
    int ans = 0;
    for(int i=1; i<=n; i++) {
    	bool flag = true;
    	for(auto e: mp[i]){
    		if(h[e] >= h[i]){
    			flag = false;
    		}
    	}
    	if(flag){
    		//cout << i << " ";
    		ans++;
    	}
    }
    //cout << endl;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 14000
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long
#define INF INT_MAX
#define mod 1000000007
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll pw(ll a, ll b) {
    if (b == 0) return 1;
    ll t = pw(a, b / 2);
    if (b % 2 == 0) return (t * t)%mod;
    else return ((t * t)%mod * a)%mod;
}
int main()
{
	int a,b;cin>>a>>b;
	if(a*b==2)cout<<3;
	else if(a*b==6)cout<<1;
	else cout<<2;
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

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

const int mod = 1000000007;

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

ll choose(ll n, ll k) {
  ll x = 1, y = 1;
  rep(i, k) {
    x *= (n - i) % mod;
    x %= mod;
    y *= (i + 1) % mod;
    y %= mod;
  }

  ll invy = modpow(y, mod - 2);
  return x * invy % mod;
}

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

  ll ans = modpow(2, n) - 1;

  ans -= choose(n, a);
  ans = (ans + mod) % mod;
  ans -= choose(n, b);
  ans = (ans + mod) % mod;
  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	lint N;
	cin >> N;
	vector<lint>A(N);
	vector<lint>B(N);
	rep(i, N) {
		cin >> A[i] >> B[i];
	}
	lint sumA = 0;
	lint sumB = 0;
	rep(i, N) {
		sumA += A[i];
		sumB += B[i];
	}
	priority_queue<lint>Q;
	rep(i, N) {
		Q.push(A[i] + B[i]);
	}
	lint ans = sumB * (-1);
	rep(i, N) {
		if (i % 2 == 0) {
			ans += Q.top();
			Q.pop();
		}
		else {
			Q.pop();
		}
	}
	cout << ans << enld;
}

Measured memory_bytes: 2936
#include <bits/stdc++.h>
#define ll long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;
vector <vector<int>> vs;
void rec(int pos, int &bound, vector<int> &cur){
    if(pos == bound){
        vs.push_back(cur);
        return;
    }
    for(int i = 0; i < 10; ++i){
        cur.push_back(i);
        rec(pos + 1,bound,cur);
        cur.pop_back();
    }
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef DEBUG
			assert(freopen("inp", "r", stdin));
			assert(freopen("out", "w",stdout));
	#else
			#define cerr if(false)cerr
	#endif
    int n;
    cin >> n;
    ll ans = 0;
    int cntn = log10(n) - 1;
    for(int i = 1; i <= cntn; ++i){
        vector <int> cur;
        rec(0,i,cur);
    }
    //for(auto i : vs){
        //for(auto g : i)
            //cout << g;
        //cout << '\n';
    //}
    map <int,ll> mp;
    for(int i = 1; i <= n; ++i){
        int ls =0,j = i;
        ll tmp = 0;
        while(j){
            ls =  j % 10;
            j /= 10;
        }
        if(i % 10 == 0)
            continue;
        if(mp.find({(i%10)*10+ls}) != mp.end()){
            ans += mp[{(i%10)*10+ls}]; 
            continue;
        }
        ll nw;
        if(i % 10 == ls){
            nw = ls;
            if(nw <= n){
                ++tmp;
            }
        }
        nw = (i % 10) * 10 + ls; 
        if(nw <= n){
            ++tmp;
        }
        for(auto z : vs){
            nw = i%10;
            for(auto g : z){
                nw *= 10;
                nw += g;
            }
            nw *= 10;
            nw += ls;
            if(nw <= n){
                ++tmp;
            }
        }
        if(mp.find({(i%10)*10+ls}) == mp.end()){
            mp[{(i%10)*10+ls}] = tmp; 
        }
        ans += tmp;
    }
    cout << ans << '\n';
            //cout << i << " " << nw << '\n';
   cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC 
    << " sec" << endl;
}

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

int main(){
	int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a==0)cout<<1;
    if(b==0)cout<<2;
    if(c==0)cout<<3;
    if(d==0)cout<<4;
    if(e==0)cout<<5;
    return 0;
}

Measured memory_bytes: 3600
from collections import Counter
n = int(input())
lis = []
li = []
ans = 0
for i in range(n):lis.append(str(input()))
m = int(input())
for i in range(m):li.append(str(input()))
for i in range(n):
    cou = lis.count(lis[i])-li.count(lis[i])
    ans = max(ans,cou)
print(ans)

Measured memory_bytes: 3444
#include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int n;cin>>n;
      vector<int >v(n,0);
      for(int i=0,a;i<n;i++){cin>>a;v[a-1]=i+1;}
      for(int i=0;i<n;i++){cout<<v[i]<<' ';}
    
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <stdio.h>
#define fin freopen("input", "r", stdin)
#define wt(x) cerr << #x << ": " << x << " ";
#define whatis(x) cerr << #x << ": " << x << endl;
#define whatis2(x, y) wt(x); wt(y); cout << endl;
#define whatis3(x, y, z) wt(x); wt(y); wt(z); cout << endl;
#define whatis4(x, y, z, a) wt(x); wt(y); wt(z); wt(a); cout << endl;
 
using namespace std;
using ll = long long;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
 
    // cout << "HELOOOOOOOOOOOOOOOOOOOOOOOOOOOOO" << endl;
    ll n, b, r;
    cin >> n >> b >> r;
    ll ans = (n / (b + r)) * b;
    ans += min((n % (b+r)), b); 
 
    cout << ans << endl;
    
 
 
    return 0;
}

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

int main(){
  int n,m;
  cin>>n>>m;
  int cnt=0;
  int l,r;
  l=1; r=n/2-n/2%2;
  int memo=r;
  while(l<r){
    if(cnt>=m) break;
    cout<<l<<' '<<r<<endl;
    cnt++;
    l++; r--;
  }
  l=memo+1; r=n;
  if((r-l+1)%2==0) r--;
  while(l<r){
    if(cnt>=m) break;
    cout<<l<<' '<<r<<endl;
    cnt++;
    l++; r--;
  }
  return 0;
}


Measured memory_bytes: 3592
import math

def main():
    N = int(input())

    a = list(map(int, input().split(' ')))
    b = list(map(int, input().split(' ')))

    man_count = 0

    for i in range(N):
        if a[i] < b[i]:
            da = math.ceil((b[i] - a[i])/2)
            a[i] += 2*da
            man_count += da

        if a[i] > b[i]:
            db = a[i] - b[i]
            b[i] += db
            man_count -= db

    if man_count >= 0:
        print('Yes')
    else:
        print('No')


main()


Measured memory_bytes: 4596
from functools import reduce
from fractions import gcd

N = int(input())
T = list(int(input()) for _ in range(N))

def lcm_base(x, y):
    return (x*y)//gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(T))


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

slist,s0list,s1list=[],[],[]
for i in range(N):
  s=int(input())
  slist.append(s)
  if s%10==0:
    s0list.append(s)
  else:
    s1list.append(s)
#print(slist,s0list,s1list)

if sum(slist)%10!=0:
  print(sum(slist))
elif len(s1list)==0:
  print(0)
else:
  s1list.sort()
  print(sum(slist)-s1list[0])

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

long gcd(long a, long b){
    if(b == 0){
        return a;
    }else{
        if(a < b){
            swap(a, b);
        }
        gcd(b, a%b);
    }
}

int main(){
    long a, b = 0;
     
    while(cin >> a >> b){
        long tmp = gcd(a, b);
        
        cout << tmp << " " << a*b/tmp << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2988
import math
r,g,b,n = map(int, input().split())

cnt = 0
s = 0
for i in range(math.ceil(n/r)+1):
  for j in range(math.ceil(n/g)+1):
    s = r*i+g*j
    if s > n:
      break
    if (n-s)%b == 0:
      cnt += 1
print (cnt)

Measured memory_bytes: 9188
import java.util.Scanner;

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

        for(int i=k-1;i>0;i--){
            int c=x-i;
            System.out.print(" "+ c);
        }
        for(int i=0;i<k;i++){
            int c=x+i;
            System.out.print(" "+ c);
        }
        System.out.println();
    }
}


Measured memory_bytes: 21844
import sys

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


def main():
    N, M, *XYZ = map(int, read().split())

    def score(s_X, s_Y, s_Z):
        P = [0] * N
        for i, (x, y, z) in enumerate(zip(*[iter(XYZ)] * 3)):
            P[i] = s_X * x + s_Y * y + s_Z * z

        P.sort(reverse=True)
        return sum(P[:M])

    ans = -INF
    for s_X in (-1, 1):
        for s_Y in (-1, 1):
            for s_Z in (-1, 1):
                res = score(s_X, s_Y, s_Z)
                if ans < res:
                    ans = res

    print(ans)

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9300
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
/*
         ########     ########   ########   #########   ##       #######   ##       #######
         #      #     #      #   #      #       #       # #      #     #   # #      #     #
         #      #     #      #   #      #       #       #  #     #     #   #  #     #     #
         ########     #      #   #      #       #       #   #    #     #   #   #    #     #
         ###          #      #   #      #       #       #    #   #######   #    #   #######
         #  #         #      #   #      #       #       #   #    #     #   #   #    #     #
         #   #        #      #   #      #       #       #  #     #     #   #  #     #     #
         #    #       #      #   #      #       #       # #      #     #   # #      #     #
         #     #      ########   ########       #       ##       #     #   ##       #     #     
*/

#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define bitcount __builtin_popcount //count no's of ones in a set bit
#define prq priority_queue
#define mp make_pair
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define debug(a)          \
    cerr << #a << ": ";   \
    for (auto i : a)      \
        cerr << i << " "; \
    cerr << '\n';
#define trace(a) cerr << #a << ": " << a << "\n"
#define print(ar, n)            \
    for (int u = 0; u < n; u++) \
    {                           \
        cout << ar[u] << " ";   \
    }                           \
    cout << endl;
#define int long long
#define M 1000000007
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
signed main()
{
    rootdada;
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //  //   freopen("output.txt", "w", stdout);
    //  //  freopen("error.txt", "w", stderr);
    // #endif
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    rep(i, l, r + 1) if (i % d == 0)
        ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3648
def main():
    X, K, D = map( int, input().split())
    if X < 0:
        X = -X
    c = min(X//D, K)
    X -= c*D
    K -= c
    if K%2 == 0:
        print(X)
    else:
        print(D-X)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 9164
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define EPS 1e-14
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) FOR(i, 0, n)
#define PI 2*acos(0.0)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(x) cout<<#x <<": "<< x << "\n"
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; }
const int VX[] = { 0, 1, 0, -1 };
const int VY[] = { 1, 0, -1, 0 };
const long MOD = 1000000007;

int main()
{
	//	--- I/O 高速化 ---
	cin.tie(0);
	ios::sync_with_stdio(false);
	// --- ここまで ---

	string S, tmp1, tmp2;
	cin >> S;


	int half = S.length() / 2;
	for (int i = 1; i <= half; i++)
	{
		tmp1 = S.substr(0, half - i);
		tmp2 = S.substr(half - i, half - i);
		if (tmp1 == tmp2)
		{
			cout << tmp1.length() * 2 << endl;
			return 0;
		}
	}


	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			int n = sc.nextInt();
			int t = sc.nextInt();
			int e = sc.nextInt();
			int[] x = new int[n];
			for(int i=0;i<n;i++){
				x[i] = sc.nextInt();
			}
			
			boolean flag = true;
			for(int i=0;i<n;i++){
				for(int j=t-e;j<=t+e;j++){
					if(j%x[i]==0){
						System.out.println(i+1);
						flag = false;
						j = t+e+1;
						i = n;
					}
				}
			}
			if(flag==true) System.out.println("-1");
		}
	}	
}

Measured memory_bytes: 18304