akhauriyash/Code-Regression huggingface dataset:
#
import sys
import math
import numpy as np
import itertools

# いくつか入力
a, b = (int(i) for i in input().split())  

answer =0
for i in range(2):
    if a > b:
        answer += a
        a -= 1
    else:
        answer += b
        b -= 1

print(answer)



Measured memory_bytes: 21648
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner (System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		int[] c = new int[N];
		int[] t = new int[N];
		int p = 1001;
		for (int i = 0; i < N; i++) {
			c[i] = sc.nextInt();
			t[i] = sc.nextInt();
		}
		for (int i = 0; i < N; i++) {
			if ((t[i] <= T) && (c[i] < p)) {
				p = c[i];
			}
		}
		if (p == 1001) {
			System.out.println("TLE");
		}else{
			System.out.println(p);
		}
	}
}

Measured memory_bytes: 25172
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  int A, B, i;
  
  scanf("%d %d", &A, &B);
  for (i = 1; i <= 1000; i++)
  {
    if ((int)(i * 0.08) == A && (int)(i * 0.1) == B)
    {
      printf("%d\n", i);
      return 0;
    }
  }
  printf("%d\n", -1);
  
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define fastio  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD=1000000007;
#define PI acos(-1)
using namespace std;
int main(){
   double  n; cin >> n;
   vector<pair<int,int>> v;
   for(int i=0 ; i < n ; i++){
   	    int x,y; cin >> x >> y;
   	    v.push_back({x,y});
   }
   long double sum=0;
   for(int i=0 ; i < n ; i++){
   	for(int j = i+1 ; j < n ; j++){
   	    long double x = v[i].first-v[j].first;
   	    long double y = v[i].second-v[j].second;
   		  sum+= sqrt(x*x+y*y);
   	}
   }
   long double  ans =1;
   for(int i=1 ; i <= n-1 ; i++){
   	  ans = ans * i;
   }
   long double  final = (sum*2)/n;
   cout << fixed << setprecision(10) << final << endl;
}

Measured memory_bytes: 3804
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int i, num[10000];
    for(i = 0; i < 10000; i++){
        cin >> num[i];
        if(num[i] == 0) break;
    }
    for(i = 1; i <= 10000; i++){
        if(num[i-1] == 0) break;
        cout << "Case " << i <<": " << num[i-1] << endl;
    }
    return 0;
}



Measured memory_bytes: 3036
import math
a,b,x=map(int,input().split())
 
if a*b//2*a>=x:
  print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
  if a*b*b==x:
    print(0)
  else:
    print(90-math.degrees(math.atan(a/(2*b-2*x/a/a))))

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var nx = IO.RSInt;
            var x = IO.RSInt;

            var sub = new int[nx[0]];
            for (int i = 0; i < nx[0]; i++)
            {
                sub[i] = Abs(nx[1] - x[i]);
            }

            Array.Sort(sub);

            for (int i = 0; i < nx[0] - 1; i++)
            {
                sub[i + 1] = GCD(sub[i], sub[i + 1]);
            }

            WriteLine(sub.Last());
        }

        public static int GCD(int x, int y)
        {
            if (x < y) Swap(ref x, ref y);
            if (y == 0) return x;
            else return GCD(x % y, y);
        }

        public static void Swap(ref int x, ref int y)
        {
            int tmp = x;
            x = y;
            y = tmp;
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

int main() {
    ll h,w,a,b;
    std::cin >> h>>w>>a>>b;

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if( i<b ^ j<a ){
                std::cout << 1;
            }else{
                std::cout << 0;
            }
        }
        std::cout << std::endl;
    }
}


Measured memory_bytes: 1280
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long T = sc.nextLong();
		long t[] = new long[N+1];
		
		for(int i=1; i<=N; i++){
			t[i]=sc.nextLong();
		}
		
		long time=T;
		
		for(int i=2; i<=N; i++){
			if(t[i]-t[i-1]<=T){
				time = time + t[i]-t[i-1];
			}
			else time = time + T;
		}
		System.out.println(time);

	}
}

Measured memory_bytes: 64156
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD1 1000000007
#define MOD2 998244353
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ll t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(ll i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<ll,ll> pii;
ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
ll mpowe(ll n,ll m,ll MOD){if(m==0)return 1;ll t=mpowe(n,m/2,MOD);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;if(n==0) return -1;return logtwo(n/2)+1;}
ll m=1e9;
int main()
{
    fastio();
     
    double r;
    cin>>r;
    double c = 2*M_PI*r;
    cout<<c<<endl;
}

Measured memory_bytes: 3800
//***Little by little one travels far***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll int
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll a[102];
int main()
{
    ll n,x,s=0,c=1;
    cin>>n>>x;

    forn(i,n){
        cin>>a[i];
        s+=a[i];
        if(s<=x) c++;
    }
    cout<<c;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    string s;
    cin>>s;
    ll len=s.length();
    if(s[len-1]=='s') cout<<s+"es"<<"\n";
    else cout<<s+"s"<<"\n";
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=(a),ed=(b);i<=ed;++i)
#define DREP(i,a,b) for(int i=(a),ed=(b);i>=ed;--i)
typedef long long ll;
inline int read(){
    register int x=0,f=1;register char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();}
    while(isdigit(ch)){x=x*10+(ch^'0');ch=getchar();}
    return f?x:-x; 
}

const int N=5e5+10,inf=0x3f3f3f3f;
int n,k,a[N],b[N],ind[N];
vector<int> E[N];
priority_queue<int,vector<int>,greater<int> > q;

namespace SegmentTree{
#define ls(p) p<<1
#define rs(p) p<<1|1
    int tr[N<<2];
    inline void pushup(int p){tr[p]=min(tr[ls(p)],tr[rs(p)]);}
    inline void Build(int p,int l,int r){
        tr[p]=inf;if(l==r)return;
	int mid=(l+r)>>1;
	Build(ls(p),l,mid),Build(rs(p),mid+1,r);
    }
    inline void Insert(int p,int l,int r,int pos,int v){
	if(l==r){tr[p]=v;return;}
	int mid=(l+r)>>1;
	if(mid>=pos)Insert(ls(p),l,mid,pos,v);
	else Insert(rs(p),mid+1,r,pos,v);
	pushup(p);
    }
    inline int Query(int p,int l,int r,int L,int R){
	if(L>R)return inf;
	if(L<=l&&r<=R)return tr[p];
	int mid=(l+r)>>1,ans=inf;
	if(L<=mid)ans=min(ans,Query(ls(p),l,mid,L,R));
	if(mid<R)ans=min(ans,Query(rs(p),mid+1,r,L,R));
	return ans;
    }
}using namespace SegmentTree;

int main(){
    //freopen("in.in","r",stdin);
    n=read(),k=read();REP(i,1,n)a[i]=read(),b[a[i]]=i;
    Build(1,1,n);
    DREP(i,n,1){
	int p=Query(1,1,n,max(1,b[i]-k+1),b[i]-1);
	if(p^inf)E[b[i]].push_back(b[p]),++ind[b[p]];
	p=Query(1,1,n,b[i]+1,min(n,b[i]+k-1));
	if(p^inf)E[b[i]].push_back(b[p]),++ind[b[p]];
	Insert(1,1,n,b[i],i);
    }
    REP(i,1,n)if(!ind[i])q.push(i);
    int cnt=0;
    while(q.size()){
	int u=q.top();q.pop();
	a[u]=++cnt;
	for(int v:E[u])
	    if(!--ind[v])q.push(v);
    }
    REP(i,1,n-1)printf("%d\n",a[i]);
    printf("%d",a[n]);
    return 0;
}


Measured memory_bytes: 44544
// https://atcoder.jp/contests/abc057/tasks/abc057_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  ll n, m;
  vector<ll> a, b, c, d;

  cin >> n >> m;

  REP(i, n)
  {
    ll ai, bi;
    cin >> ai >> bi;
    a.push_back(ai);
    b.push_back(bi);
  }

  REP(i, m)
  {
    ll ci, di;
    cin >> ci >> di;
    c.push_back(ci);
    d.push_back(di);
  }

  REP(i, n)
  {
    ll xm = INF, im;
    REP(j, m)
    {
      ll x = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (x < xm)
      {
        xm = x;
        im = j;
      }
    }
    cout << im + 1 << '\n';
  }

  return 0;
}


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

typedef long long ll;


int main(){
  string s;
  cin >> s;
  int cb=0;
  ll ans=0;
  for(char c:s){
    if(c =='B')
      ++cb;
    else
      ans += cb;
  }
  cout << ans << endl;


}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
// cin.eof() 入力個数の問題
int main() {
int n;
cin>>n;
int number=0;
vector<int> ans;
int i=1;
while(1){
    number+=i;
    ans.push_back(i);
    i++;
    if(number>n) break;
}
for(int i:ans){
    if(i==number-n) continue;
    cout<<i<<endl;
}
    return 0;
}


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

int main() {
  int n, m; cin >> n >> m;
  long long sum = 0;
  for(int i = 0; i < m; i++){
    int a; cin >> a;
    sum += a;
  }
  if(n-sum >= 0){
    cout << n - sum;
  }else{
    cout << -1;
  }
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>                                                                          
using namespace std;
int main()
{
  int N,A,B;
  cin >> N >> A >> B;
  int sum=0;
  for(int i=0; i<=N; i++){
    if(i<10){
      if(i>=A && i<=B)
        sum+=i;
    }
    else if(i>=10 && i<=99){
      if(((i/10)+(i%10))>=A && ((i/10)+(i%10))<=B)
        sum+=i;
    }
    else if(i>=100 && i<=999){
      if(((i/100)+(i%100/10)+(i%100%10))>=A && ((i/100)+(i%100/10)+(i%100%10))<=B)
        sum+=i;
    }
    else if(i>=1000 && i<=9999){
      if(((i/1000)+(i%1000/100)+(i%1000%100/10)+(i%1000%100%10))>=A && ((i/1000)+(i%1000/100)+(i%1000%100/10)+(i%1000%100%10))<=B)
        sum+=i;
    }
    else if(i==10000){
      if((i/10000)>=A && (i/10000)<=B)
        sum+=i;
    }
  }
  cout << sum << endl;
}

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

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

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

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

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

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

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

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

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

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

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

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

fn main() {
    input! {
        n: usize,
    }
    let mut ans = 0.;
    let mut cnt_odd = (n / 2 + n % 2) as f64;
    println!("{}", cnt_odd / (n as f64));
}


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

int main() {
    int x;
    cin >> x;
    if (x < 600) {
        cout << 8 << endl;
    } else if (x < 800) {
        cout << 7 << endl;
    } else if (x < 1000) {
        cout << 6 << endl;
    } else if (x < 1200) {
        cout << 5 << endl;
    } else if (x < 1400) {
        cout << 4 << endl;
    } else if (x < 1600) {
        cout << 3 << endl;
    } else if (x < 1800) {
        cout << 2 << endl;
    } else {
        cout << 1 << endl;
    }
}

Measured memory_bytes: 3632
#include <stdio.h>
int main(){
  int s,r=1e9,n,a[100],i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&a[i]);
  for(i=-100;i<=100;i++){
    s=0;
    for(j=0;j<n;j++)s+=(a[j]-i)*(a[j]-i);
    if(r>s){
      r=s;
    }
  }
  printf("%d",r);
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
6 9
0 1 1
0 2 3
1 2 1
1 3 7
2 4 1
1 4 3
3 4 1
3 5 1
4 5 6

output:
5
"""

import sys
from operator import attrgetter


class Edge(object):
    __slots__ = ('source', 'target', 'weight')

    def __init__(self):
        self.weight = float('inf')
        self.source, self.target = None, None


class UnionFind(object):
    __slots__ = ('size', 'tree_height_rank_list', 'ancestor_list')

    def __init__(self, size):
        self.size = int(size)
        self.tree_height_rank_list = [0] * self.size
        self.ancestor_list = [i for i in range(self.size)]

    def _find(self, x):
        if x != self.ancestor_list[x]:
            self.ancestor_list[x] = self._find(self.ancestor_list[x])
        return self.ancestor_list[x]

    def same(self, x, y):
        return self._find(x) == self._find(y)

    def _link(self, x, y):
        if self.tree_height_rank_list[x] > self.tree_height_rank_list[y]:
            self.ancestor_list[y] = x
        else:
            self.ancestor_list[x] = y
            if self.tree_height_rank_list[x] == self.tree_height_rank_list[y]:
                self.tree_height_rank_list[y] += 1

    def union(self, x, y):
        self._link(self._find(x), self._find(y))


def generate_edge_table(v_table):
    for index, each in enumerate(v_table):
        source, target, weight = map(int, each)
        init_edge_table[index].source = source
        init_edge_table[index].target = target
        init_edge_table[index].weight = weight

    return init_edge_table


def graph_Kruskal():
    total_cost = 0
    # sort edge_table by edge's weight
    edge_table.sort(key=attrgetter('weight'))
    # MST--> E = V + 1
    union_find_case = UnionFind(size=vertices + 1)
    for edge in edge_table:
        if not union_find_case.same(edge.source, edge.target):
            total_cost += edge.weight
            union_find_case.union(edge.source, edge.target)

    return total_cost


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices, edges = map(int, _input[0].split())
    v_info = map(lambda x: x.split(), _input[1:])

    init_edge_table = [Edge() for _ in range(edges)]
    edge_table = generate_edge_table(v_info)
    print(graph_Kruskal())

Measured memory_bytes: 32740
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;

int main(){
    int a,b;
    cin >> a >> b;
    cout << (6 - a - b) << endl;

}

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

int main() {
	string A, B, C;
	cin >> A >> B >> C;
	
	if(A[A.size()-1] == B[0]  && B[B.size()-1] == C[0]) cout << "YES";
	else cout << "NO";
	
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
#define PIGRECO 3.141592653589793

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c> {i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
	~debug() { cerr << endl; }
	eni( != ) cerr << boolalpha << i; ris;
}
eni( == ) ris << range(begin(i), end(i));
}
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////
#define int long long

const int INF = 1e18;



int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n;
	cin >> n;

	vector<int>a(n + 1);

	for (int i = 1; i <= n; i++)cin >> a[i];

	vector<vector<int>>dp(n + 1, vector<int>(n + 1, INF));

	for (int l = n; l > 0; l--) {
		for (int r = l; r <= n; r++) {

			if (l == r) {
				dp[l][r] = 0;
				continue;
			}
			int sum = 0;

			for (int i = l; i <= r; i++) {
				sum += a[i];
			}

			for (int i = l; i <= r - 1; i++) {

				dp[l][r] = min(dp[l][r], dp[l][i] + dp[i + 1][r] + sum);



			}

		}
	}


	cout << dp[1][n] << endl;








}

Measured memory_bytes: 4516
S=raw_input()

if S=="SUN":
    print 7
elif S=="MON":
    print 6
elif S=="TUE":
    print 5
elif S=="WED":
    print 4
elif S=="THU":
    print 3
elif S=="FRI":
    print 2
elif S=="SAT":
    print 1


Measured memory_bytes: 27756
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int h, w, a[80][80], b[80][80];
bool bl[81][81][13000];

signed main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> b[i][j];
		}
	}
	for (int i = 0; i <= h; i++)bl[i][0][0] = true;
	for (int i = 0; i <= w; i++)bl[0][i][0] = true;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			int s = abs(a[i - 1][j - 1] - b[i - 1][j - 1]);
			if (i == 1 && j == 1)bl[i][j][s] = true;
			for (int k = 0; k <= 12900; k++) {
				int t = abs(s - k);
				int r = s + k;
				if ((1<i&&bl[i - 1][j][t]) || (1<i&&bl[i - 1][j][r] )|| (1<j&&bl[i][j - 1][t]) || (1<j&&bl[i][j - 1][r])) {
					bl[i][j][k] = true;
				}
			}
		}
	}
	for (int i = 0;; i++) {
		if (bl[h][w][i]) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 82432
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int D = sc.nextInt();
        int div = D*2 + 1;
        
        int ans = N / div;
        
        if(N % div != 0){
            ans ++;
        }
        
        
        
        System.out.println(ans);
        
    }
}


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

#define mp make_pair
#define fi first
#define se second
#define pb push_back

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

int n;
string ans[10] = {"pon","pon","hon","bon","hon","hon","pon","hon","pon","hon"};

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    int x = n % 10;
    cout << ans[x] << '\n';
    return 0;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void anss(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  bool judge = true;
  ll h,w;cin>>h>>w;
  vector<string> s(h);
  for(i=0;i<h;i++)cin>>s[i];
  ll bufl;
  ll bufr;
  ll x[h][w];
  ll y[h][w];
  for(i=0;i<w;i++){
    for(j=0;j<h;j++){
      if(s[j][i]=='.'){
        if(buf==0){
          buf++;
          bufl=j;
        }
        else buf++;
        if(j==h-1){
          for(o=bufl;o<h;o++){
            x[o][i]=buf;
          }
          buf=0;
        }
      }
      else{
        if(buf!=0){
          bufr=j;
          for(o=bufl;o<bufr;o++){
            x[o][i]=buf;
          }
          buf=0;
        }
      }
      //cout<<buf<<endl;
    }
  }

  ////////
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(s[i][j]=='.'){
        if(buf==0){
          buf++;
          bufl=j;
        }
        else buf++;
        if(j==w-1){
          for(o=bufl;o<w;o++){
            y[i][o]=buf;
          }
          buf=0;
        }
      }
      else{
        if(buf!=0){
          bufr=j;
          for(o=bufl;o<bufr;o++){
            y[i][o]=buf;
          }
          buf=0;
        }
      }

    }
  }

  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(s[i][j]=='.'){
        chmax(res,x[i][j]+y[i][j]);
        //cout<<x[i][j]<<" ";
      }
      //else cout<<"  ";
    }
    //cout<<endl;
  }

  cout<<res-1<<endl;
  
  return 0;
}

Measured memory_bytes: 66816
import sys

def main():
    input = sys.stdin.readline
    inf = 10**8 + 1
    N = int(input())
    const_x_max, right_max, left_max = -inf, -inf, -inf
    const_x_min, right_min, left_min = inf, inf, inf
    const_y_max, up_max, down_max = -inf, -inf, -inf
    const_y_min, up_min, down_min = inf, inf, inf
    for _ in range(N):
        x, y, d = map(str, input().strip().split())
        x, y = int(x), int(y)

        if d == 'R':
            right_max = max(right_max, x)
            right_min = min(right_min, x)
            const_y_max = max(const_y_max, y)
            const_y_min = min(const_y_min, y)
        elif d == 'L':
            left_max = max(left_max, x)
            left_min = min(left_min, x)
            const_y_max = max(const_y_max, y)
            const_y_min = min(const_y_min, y)
        elif d == 'U':
            const_x_max = max(const_x_max, x)
            const_x_min = min(const_x_min, x)
            up_max = max(up_max, y)
            up_min = min(up_min, y)
        else:
            const_x_max = max(const_x_max, x)
            const_x_min = min(const_x_min, x)
            down_max = max(down_max, y)
            down_min = min(down_min, y)

    inflections = set([0])
    # The time when the slope of max_x changes.
    # 1. from decrease to constant.
    inflections.add(max(0, left_max - const_x_max))
    # 2. from decrease to increase.
    inflections.add(max(0, (left_max - right_max)/2))
    # 3. from constant to increase.
    inflections.add(max(0, const_x_max - right_max))

    # The time when the slope of min_x changes.
    # 4. from increase to constatnt.
    inflections.add(max(0, const_x_min - right_min))
    # 5. from increase to decrease.
    inflections.add(max(0, (left_min - right_min)/2))
    # 6. from constant to decrease.
    inflections.add(max(0, left_min - const_x_min))

    # The time when the slope of max_y changes.
    # 7. from decrease to constant.
    inflections.add(max(0, down_max - const_y_max))
    # 8. from decrease to increase.
    inflections.add(max(0, (down_max - up_max)/2))
    # 9. from constant to increase.
    inflections.add(max(0, const_y_max - up_max))

    # The time when the slope of min_y changes.
    # 10. from increase to constatnt.
    inflections.add(max(0, const_y_min - up_min))
    # 11. from increase to decrease.
    inflections.add(max(0, (down_min - up_min)/2))
    # 12. from constant to decrease.
    inflections.add(max(0, down_min - const_y_min))


    def get_val(t):
        x0 = max(const_x_max, right_max + t, left_max - t)
        x1 = min(const_x_min, right_min + t, left_min - t)
        y0 = max(const_y_max, up_max + t, down_max - t)
        y1 = min(const_y_min, up_min + t, down_min - t)

        return (x0 - x1) * (y0 - y1)

    ans = 10**18
    for t in inflections:
        ans = min(ans, get_val(t))

    return ans


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


Measured memory_bytes: 3316
// ConsoleApplication1.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <memory>


int main()
{
	bool n = false, s = false, w = false, e = false;
	while(int c = std::cin.get())
	{
		if (c == EOF)break;
		switch (c)
		{
		case 'N':
			n = true;
			break;
		case 'S':
			s = true;
			break;
		case 'W':
			w = true;
			break;
		case 'E':
			e = true;
			break;
		}
	}

	if (n && s && !e && !w || n && s && e && w || !n && !s && e & w || !n && !s && !w && !e)
	{
		std::cout << "Yes";
	}
	else
	{
		std::cout << "No";
	}

    return 0;
}



Measured memory_bytes: 1016
import math
ans = []
def main(num):

    lim =int(math.ceil((-1 + math.sqrt(1 + 8 * num))/2))
    for i in range(lim,0,-1):
        if num - i >= 0:
            ans.append(i)
            num = num - i
    for j in ans:
        print(j)




if __name__ == '__main__':
    N = int(input())
    main(N)


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define rep(i, a, b) for (int i = a; i < b; i++)
#define revrep(i, a, b) for (int i = a; i >= b; i--)
#define pb push_back
int INF = 1e14;
int mod = 1e9 + 7;

int power(int x, unsigned int y)
{
    int temp;
    if (y == 0)
        return 1;
    temp = power(x, y / 2) % mod;
    if (y % 2 == 0)
        return (temp * temp) % mod;
    else
        return x * ((temp * temp) % mod) % mod;
}

signed main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    // cin >> t;
    t = 1;
    while (t--)
    {
        set<int> st;
        rep(i, 0, 102)
            st.insert(i);
        int n, x;
        cin >> x >> n;
        rep(i, 0, n)
        {
            int temp;
            cin >> temp;
            st.erase(temp);
        }
        auto key = st.lower_bound(x);
        if (key != st.begin())
        {
            int curr = *key;
            int prev = *(--key);
            if (abs(prev - x) > abs(curr - x))
                cout << curr << endl;
            else
                cout << prev << endl;
        }
        else
            cout << *key << endl;
    }

    return 0;
}


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

int main(){
    int n;
    cin>>n;
    vector<int> p(n);
    int ans=0;
    for(int i=0;i<n;i++) cin>>p[i];
    for(int i=0;i<n-1;i++){
        if(p[i]==i+1){
            swap(p[i],p[i+1]);
            ans++;
        } 
    }
    if(p[n-1]==n) ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 3720
#include<iostream>
#include<string>
using namespace std;
int main(){
	 int a,b,c;
	 cin>>a>>b>>c;
	 if(b-a==c-b){
	 	cout<<"YES"<<endl;
	 }
	 else {
	 	cout<<"NO"<<endl;
	 }
} 

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	static int answer=0;
	static String str[];

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int length = Integer.parseInt(br.readLine());
		str = br.readLine().split(" ");
		
		for(String num:str) {
			answer += Integer.parseInt(num);
		}
		
		answer -= length;

		System.out.println(answer);

	}

}


Measured memory_bytes: 21844
#include <algorithm>
#include <iostream>
int main() {
  int N, C, K;
  std::cin >> N >> C >> K;
  int t[1 << 20];
  for (int i = 0; i < N; ++i)
    std::cin >> t[i];

  std::sort(t, t + N);

  int count = 0, dt = 0;
  for (int i = 0; i < N; ++i) {
    int diff = t[i] - t[i - dt];
    ++dt;
    if (diff > K || dt > C) {
      ++count;
      dt = 1;
    }
  }
  ++count;

  std::cout << count << std::endl;
}


Measured memory_bytes: 2304
from collections import Counter
from math import factorial


N, A, B = map(int, input().split())
V = list(map(int, input().split()))
C = Counter(V)
keys = list(C.keys())
keys.sort(reverse=True)

if C[keys[0]] >= A:
    mean = keys[0]
    var = 0
    for i in range(A, min(B, C[keys[0]]) + 1):
        var += factorial(C[keys[0]]) // factorial(i) // factorial(C[keys[0]] - i)
else:
    cnt = 0
    total = 0
    var = 0
    for v in keys:
        if cnt + C[v] < A:
            cnt += C[v]
            total += v * C[v]
        else:
            total += v * (A - cnt)
            mean = total / A
            var += factorial(C[v]) // factorial((A - cnt)) // factorial(C[v] - (A - cnt))
            break

print(mean)
print(var)


Measured memory_bytes: 3316
use std::io;

fn main() {
    let mut input_line:String = String::new();
    io::stdin().read_line(&mut input_line).expect("err");

    let inputs: Vec<&str> = input_line.split_whitespace().collect();

    let answer = String::new();
    for i in 0..inputs.len() {
        let first_letter: String = inputs[i].chars().skip(0).take(1).collect();
        print!("{}", first_letter);
    }
}


Measured memory_bytes: 2036
#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(){
    string s;
    cin >> s;
    int ans = 0;
    rep(i, s.size() / 2){
        if(s[i] != s[s.size() - 1 - i]){
            ans++;
        }
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
from collections import deque
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,m = [int(i) for i in readline().split()]

if m%2: print(-1); exit()

#L = [0]*n

g = [[] for _ in range(n)]
for i in range(m):
    a,b = [int(i) for i in readline().split()]
    g[a-1].append((b-1,i))
    g[b-1].append((a-1,i))
#    L[a-1] += 1
#    L[b-1] += 1



used = [0]*m
usedp = [0]*n
def dfs(v):
    res = 0
    for (c,i) in g[v]:
        if used[i] == 1: continue
        used[i] = 1
        if usedp[c] == 1:
            res += 1
            print(v+1,c+1)
            continue
        usedp[c] = 1
        p =  dfs(c)
        if p%2 == 1:
            print(v+1,c+1)
        else:    
            print(c+1,v+1)
        res += p
    return res+1


for i in range(n):
    dfs(i)
#print(q)












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

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define mp make_pair

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

inline void scani(int& x){
	scanf("%d",&x);
}

//end of macro

const int N = 1e5 + 5;

int n;
int arr[N];
int cnta[N];
int cntb[N];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'

    cin>>n;
    REP(i,1,n)cin>>arr[i];
    REPP(i,1,n,2)cnta[arr[i]]++;
    REPP(i,2,n,2)cntb[arr[i]]++;

    int best = 0, secc = 1;
    if(cnta[best] < cnta[secc])swap(best, secc);
    REP(i,2,N-1){
        if(cnta[secc] < cnta[i])secc = i;
        if(cnta[best] < cnta[secc])swap(best, secc);
    }

    int ans = OO;
    REP(i,0,N-1){
        int takea = n/2-cnta[best];
        if(i == best){
            takea = n/2-cnta[secc];
        }
        ans = min(ans, n/2-cntb[i] + takea);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>
int *graph[200000];
int sizeGraph[200000] = {0};
int ans[200000] = {0};
void dfs(int v, int bv) {
	for (int i = 0; i < sizeGraph[v]; i++) {
		int nv = graph[v][i];
		if (bv != nv) {
			ans[nv] += ans[v];
			dfs(nv, v);
		}
	}
	return;
}
int main() {
	int n, q;
	scanf("%d%d", &n, &q);
	int a[200000], b[200000];
	for (int i = 0; i < n - 1; i++) {
		scanf("%d%d", &a[i], &b[i]);
		a[i]--;
		b[i]--;
		sizeGraph[a[i]]++;
		sizeGraph[b[i]]++;
	}
	for (int i = 0; i < n; i++) {
		graph[i] = (int *)malloc(sizeof(int) * (sizeGraph[i] + 1));
		if (graph[i] == NULL) {
			return -1;
		}
	}
	{
		int cnts[200000] = {0};
		for (int i = 0; i < n - 1; i++) {
			graph[a[i]][cnts[a[i]]] = b[i];
			cnts[a[i]]++;
			graph[b[i]][cnts[b[i]]] = a[i];
			cnts[b[i]]++;
		}
	}
	for (int i = 0; i < q; i++) {
		int p, x;
		scanf("%d%d", &p, &x);
		p--;
		ans[p] += x;
	}
	dfs(0, -1);
	for (int i = 0; i < n; i++) {
		printf("%d", ans[i]);
		printf(i == n - 1 ? "\n" : " ");
	}
	for (int i = 0; i < n; i++) {
		free(graph[i]);
	}
	return 0;
}

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

#define ll long long 

using namespace std;


int main() {

  string c;
  cin >> c;
  ll res = 0;
  for (int bit=0;bit < (1<<(c.size()-1));bit++) {
    string ans;
  	for(ll i = 0;i < c.size(); i++) {
      ans += c.at(i);
      if (!(bit & 1<<i)) {
        res += stol(ans);
      	ans = "";
      }
    }
  }
  cout << res << endl;

}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (10);   小数点以下１０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);

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

  cout << (a==c && c==b?"Yes":"No") <<endl;
  
}


Measured memory_bytes: 256
List =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n=int(input())
print(List[n-1])

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
int main(){
  int *a = malloc(sizeof(int)), *b = malloc(sizeof(int));
  char *op = malloc(sizeof(char));
  scanf("%d", a);
  scanf(" %c[^" "]", op);
  scanf("%d", b);
  if(*op == '+') printf("%d\n", *a + *b);
  if(*op == '-') printf("%d\n", *a - *b);
  free(a);
  free(b);
  free(op);
}

Measured memory_bytes: 128
N = int(input())
L = []
flag = True
k = str(N)
if (N == 10**(len(k)-1)):
  flag = True    
else:
  flag = False
if flag:
  print('10')
else:
  for i in range(len(k)):
    L.append(int(k[i]))
  print(sum(L))

Measured memory_bytes: 3060
let divisible n =
    let rec loop_i i =
        if i > 9 then false else
            if n mod i = 0 && n / i < 10 then true else loop_i (i + 1)
    in
    loop_i 1
;;
Scanf.sscanf (read_line ()) "%d" (fun n -> Printf.printf "%s\n" (if divisible n then "Yes" else "No"))

Measured memory_bytes: 384
//题意：n个人编号1-n站成一排，每个人左边的人数和右边的人数的差的绝对值为Ai，求可能的站的方案数的个数；n范围1e5
//方案数要取模1e9+7，没有这样的方案就输出0 
//思路： 看了一下样例，感觉找到了规律啊。
//如果n是奇数的话，那么一定有一个0（也就是站在中间），2,2,4,4,...,(n-1),(n-1)；
//满足的话方案数为2^(n-1)/2 
//如果n是偶数的话，那么一定有1,1,3,3,5,5,n-1,n-1,满足的话方案数为2^n/2
//不满足以上条件则为0； 
//WA了四个点 

#include <iostream>
#include <cmath>
using namespace std;
int mod=1e9+7;
typedef long long LL;
const int N=1e5+10;
int n, b[N];
int qmi(int a, int k,int p){
    int res=1;
    while(k){
        if(k&1) res=(LL)res*a%p;
        k>>=1;
        a=(LL)a*a%p;
    }
    return res;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		b[x]++;
	}
	
	if(n==1){
		if(b[1]!=0) cout<<0;
		else cout<<1;
		return 0;	
	} 
	
	if(n%2==0){
		bool is_ok=true;
		for(int i=0;i<=n-1;i++)
		{
			if(i%2==0)
			{
				if(b[i]!=0){
					is_ok=false;
					break;	
				}	
			}
			else{
				if(b[i]!=2){
					is_ok=false;
					break;	
				}
			} 
		}
		if(!is_ok) cout<<0;
		else cout<<qmi(2,n/2,mod);
	}else{
		bool is_ok=true;
		for(int i=0;i<=n-1;i++)
		{
			if(i==0){
				if(b[i]!=1){
					is_ok=false;
					break;
				}
			}
			else{
				if(i%2==0){
					if(b[i]!=2){
						is_ok=false;
						break;
					}
				}else{
					if(b[i]!=0){
						is_ok=false;
						break;
					}
				}
			}
		}
		if(!is_ok) cout<<0;
		else cout<<qmi(2,(n-1)/2,mod);
	}
	return 0;
}


Measured memory_bytes: 4020
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

const int N = 1e4 + 20 , MX = 18 * N , inf = 1e9 + 20 ;
int n , x[2 * N] , ord[2 * N] ;
vector <int> g[MX] , h[MX] ;

inline bool cmp (int i , int j) {
	return x[i] < x[j] ;
}

inline void add_edge (int u , int v) {
	g[u].push_back(v) ;
	h[v].push_back(u) ;
}	

inline void add_clause (int u , int v) {
	add_edge(u ^ 1 , v) ;
	add_edge(v ^ 1 , u) ;
}

inline int get_lower_bound (int i , int d) {
	int low = i , high = 2 * n ;

	while (high - low > 1) {
		int mid = (low + high) / 2 ;

		if (x[ord[mid]] - x[ord[i]] >= d) high = mid ;
		else low = mid ;
	}

	return high ;
}

inline int block_id (int b) { return 2 * n + 2 * b ; }

#define mid (s + e) >> 1
#define lc v << 1
#define rc lc | 1

void build (int v = 1 , int s = 0 , int e = 2 * n) {
	if (e - s == 1) {
		add_clause(block_id(v) ^ 1 , ord[s] ^ 1) ;
		return ;
	}

	add_clause(block_id(v) ^ 1 , block_id(lc)) ; 
	add_clause(block_id(v) ^ 1 , block_id(rc)) ; 

	build(lc , s , mid) ;
	build(rc , mid , e) ;
}

void find_edges (int val , int l , int r , int v = 1 , int s = 0 , int e = 2 * n) {
	if (r <= s || e <= l) return ;
	if (l <= s && e <= r) {
		add_clause(val ^ 1 , block_id(v)) ;
		return ;
	}

	find_edges(val , l , r , lc , s , mid) ;
	find_edges(val , l , r , rc , mid , e) ;
}

vector <int> tpl ;
bool vis[MX] ;
int comp[MX] ;

void dfs (int v) {
	vis[v] = 1 ;
	for (int u : g[v]) if (!vis[u]) dfs(u) ;
	tpl.push_back(v) ;
}

void sfd (int v , int C) {
	comp[v] = C ;
	for (int u : h[v]) if (!comp[u]) sfd(u , C) ;
}

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

	cin >> n ;
	for (int i = 0 ; i < n ; i ++) cin >> x[2 * i] >> x[2 * i + 1] ;

	iota(ord , ord + 2 * n , 0) ;
	sort(ord , ord + 2 * n , cmp) ;

	int m = MX ;

	int low = 0 , high = inf ;

	low = 0 , high = inf ;
	
	while (high - low > 1) {
		int d = (low + high) / 2 ;

		tpl.clear() ;
		for (int i = 0 ; i < m ; i ++) {
			g[i].clear() ;
			h[i].clear() ;
			comp[i] = 0 ;
			vis[i] = 0 ;
		}

		build() ;

		for (int i = 0 ; i < 2 * n ; i ++) {
			int id = get_lower_bound(i , d) ;
			find_edges(ord[i] , i + 1 , id) ;
		}

		for (int i = 0 ; i < m ; i ++)
			if (!vis[i]) dfs(i) ;
		
		reverse(tpl.begin() , tpl.end()) ;

		int C = 0 ;
		for (int x : tpl) 
			if (!comp[x]) sfd(x , ++C) ;

		bool ok = 1 ;
		for (int i = 0 ; i < m ; i ++)
			ok &= (comp[i] != comp[i ^ 1]) ;

		if (ok) low = d ;
		else high = d ;
	}

	cout << low << '\n' ;
}


Measured memory_bytes: 32760
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.12f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 1010101;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// mod.m での a の逆元 a^ { -1 } を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x /gcd(x, y) * y );
}

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

ll find(ll x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}


ll dx[8] = { 1,-1,0,0,1,1,-1,-1 };
ll dy[8] = { 0,0,1,-1,1,-1,1,-1 };
char c[2010][2010];
ll dp[101010][20];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, d;
	cin >> n >> d;
	ll ans = (n + 2 * d) / (2 * d + 1);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) 
#define X first
#define Y second 
#define nl '\n'
#define AC return 0
#define pb(a) push_back(a) 
#define mst(a,b) memset(a, b, sizeof a)
#define rep(i,n) for(int i = 0; (i)<(n); i++)
#define rep1(i,n) for(int i = 1; (i)<=(n); i++)
#define scd(a) scanf("%lld", &a)
#define scdd(a,b) scanf("%lld%lld", &a, &b)
#define scs(s) scanf("%s", s)
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const ll INF = (ll)0x3f3f3f3f3f3f3f, MAX = 9e18, MIN = -9e18;
const int N = 1e6+10, M = 2e6+10, mod = 1e9+7, inf = 0x3f3f3f;
ll a[N]; 


int main()
{
	IOS;
	double a, b, c;
	cin>>a>>b>>c;
	if(a/c <= b)
		puts("Yes");
	else
		puts("No");
	
	AC;
} 

Measured memory_bytes: 3732
#include<stdio.h>
int main(){
	double BMI[10000],wg,hi;
	int count,i=0,num[10000];
	
	while(scanf("%d,%lf,%lf",&num[i],&wg,&hi)!=EOF){
	BMI[i]=wg/(hi*hi);
	++i;
	}
	count=i;

	for(i=0;i<count;i++){
		if(BMI[i]>=25)printf("%d\n",num[i]);
	}
return 0;
}

Measured memory_bytes: 636
i=1
while true do
  s=STDIN.gets.split
  a=s[0].to_i
  b=s[1].to_i
  break if (a==0 && b==0)
  if a > b 
    w = a
    a = b
    b = w
  end
  puts sprintf("%d %d\n",a,b)
end  

Measured memory_bytes: 8680