akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        if (cin.nextint == 1)
        {
            WriteLine("Hello World");
        }
        else
        {
            WriteLine(cin.nextint + cin.nextint);
        }
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

int main(){
  string S;
  cin>>S;
  if(S.size()<4)
    cout<<"No"<<endl;
  else if(S.at(0)=='Y' && S.at(1)=='A' && S.at(2)=='K' && S.at(3)=='I')
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

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

int main(){
	ll n;
	cin>>n;
	ll ma1=-1e15,ma2=-1e15,mi1=1e15,mi2=1e15;
	for(int i=0;i<n;i++){
		ll a,b;
		cin>>a>>b;
		ma1=max(ma1,a+b);
		ma2=max(ma2,a-b);
		mi1=min(mi1,a+b);
		mi2=min(mi2,a-b);
	}
	cout<<max(ma1-mi1,ma2-mi2);
	return 0;
}


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

int main() {
    long long w, h, x, y;
    cin >> w >> h >> x >> y;
    int ans;
    if (x * 2 == w  && y * 2 == h) ans = 1;
    else ans = 0;
    cout << fixed << setprecision(10) << (double)(w * h / 2.0) << " " << ans << endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let (n, x) = i.read2::<usize, usize>();

    writeln!(o, "{}", solve(n, x)).unwrap();
}
fn solve(n: usize, x: usize) -> usize {
    fn eat(lvs: &[(usize, usize)], n: usize, x: &mut usize, r: &mut usize) {
        if *x == 0 {
            return;
        }
        if *x >= lvs[n].0 {
            *x -= lvs[n].0;
            *r += lvs[n].1;
            return;
        }
        if n == 0 {
            *x -= 1;
            *r += 1;
            return;
        }

        *x -= 1;
        if *x == 0 {
            return;
        }
        eat(lvs, n - 1, x, r);
        if *x == 0 {
            return;
        }
        *x -= 1;
        *r += 1;
        if *x == 0 {
            return;
        }
        eat(lvs, n - 1, x, r);
        if *x == 0 {
            return;
        }
        *x -= 1;
    }
    let mut lvs = Vec::new(); // (層数, パティ枚数)
    lvs.push((1, 1));
    for _ in 0..n + 1 {
        let l = lvs.iter().cloned().last().unwrap();
        lvs.push((l.0 * 2 + 3, l.1 * 2 + 1));
    }
    let mut r = 0;
    let mut x = x;
    eat(&lvs, n, &mut x, &mut r);
    r
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }
}


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

ll big(ll x)
{

    if(x==0) return 0;
    else if(x==1) return 1;

    ll p=(x/2);
    ll k=big(p);
    k=k+k+1;
    return k;
}

int main()
{

    ll b;
    cin>>b;
    cout<<big(b)<<endl;
}


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

void push(int);
int pop(void);

int stack[1000];
int stack_size = 0;

int main(){
  int a, b;
  char s[100];
  
  while(scanf("%s",&s[0]) != EOF){
    if(s[0] == '+'){
      b = pop();
      a = pop();
      push(a + b);
    }else if(s[0] == '-'){
      b = pop();
      a = pop();
      push(a - b);
    }else if(s[0] == '*'){
      b = pop();
      a = pop();
      push(a * b);
    }
    else{
      push(atoi(&s[0]));
    }
  }
  
  printf("%d\n",pop());
  
  return 0;
}

void push(int p){
  stack[stack_size++] = p;
}

int pop(void){
  return stack[--stack_size];
}




Measured memory_bytes: 2052
/*
	*	Created By: 'Present_Sir'
	*	Created On: Wednesday 05 August 2020 11:24:47 AM IST
*/

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)
#define int long long
using namespace std;


void solve(){
    int n,m;
    cin>>n>>m;
    vector<string> v(n);

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

    sort(v.begin(),v.end());
    for(int i=0; i<n; i++){
        cout<<v[i];
    }
    cout<<endl;
}

int32_t main(){
    IOS;
    //int t; cin>>t; while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3656
#include<bits/stdc++.h>
typedef long long i64;
const i64 inf=1ll<<55;
const int N=200007;
int n,q,as[N],bs[N];
void mins(i64&a,i64 b){if(a>b)a=b;}
struct F{
	i64 v0[N],v1[N],v2[N],a;
	void set(int x,i64 y){
		y-=a;
		if(v0[x]<=y)return;
		v0[x]=y;
		for(int w=x;w<=n;w+=w&-w)mins(v1[w],y-x);
		for(int w=x;w;w-=w&-w)mins(v2[w],y+x);
	}
	i64 get(int x){
		i64 s=inf;
		for(int w=x;w;w-=w&-w)mins(s,v1[w]+x);
		for(int w=x;w<=n;w+=w&-w)mins(s,v2[w]-x);
		return s+a;
	}
	i64 get(){
		i64 s=inf;
		for(int i=1;i<=n;++i)mins(s,v0[i]);
		return s+a;
	}
}A,B;
int abs(int x){return x>0?x:-x;}
int main(){
	scanf("%d%d%d%d",&n,&q,as,bs);
	for(int i=1,x;i<=q;++i)scanf("%d",&x),as[i]=bs[i]=x;
	A.a=B.a=inf;
	A.set(bs[0],0);
	B.set(as[0],0);
	for(int i=1;i<=q;++i){
		i64 u1=A.get(as[i]);
		i64 u2=B.get(bs[i]);
		A.a+=abs(as[i]-as[i-1]);
		B.a+=abs(bs[i]-bs[i-1]);
		A.set(bs[i-1],u2);
		B.set(as[i-1],u1);
	}
	printf("%lld\n",std::min(A.get(),B.get()));
	return 0;
}

Measured memory_bytes: 11136
#include<stdio.h>

int main(void){
	int a, b, sum, i, len;
	
	while(scanf("%d %d", &a, &b) != EOF){
		sum = a + b;
		for(len = 1; sum >= 10; len++){
			sum /= 10;
		}
		printf("%d\n", len);
	}
	return 0;
}

Measured memory_bytes: 596
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


class UnionFind():
    def __init__(self, N):
        self.N = N
        self.parents = [-1] * N

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

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


def main():
    N = int(readline())
    X = []
    Y = []

    for i in range(N):
        x, y = map(int, readline().split())
        X.append([x, i])
        Y.append([y, i])

    X.sort()
    Y.sort()
    L = []
    for i in range(N - 1):
        L.append([X[i][1], X[i + 1][1], X[i + 1][0] - X[i][0]])
        L.append([Y[i][1], Y[i + 1][1], Y[i + 1][0] - Y[i][0]])
    L.sort(key=lambda x: x[2])

    uf = UnionFind(N)
    ans = 0
    for s, t, w in L:
        if not uf.same(s, t):
            uf.union(s, t)
            ans += w
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 66164
#include <cstdio>
#include <algorithm>

typedef long long LL;
const int Mod = 1000000007;
const int MN = 1005;

inline int qPow(int b, LL e) {
	int a = 1;
	for (; e; e >>= 1, b = (LL)b * b % Mod)
		if (e & 1) a = (LL)a * b % Mod;
	return a;
}

int N, M, A, B, C; LL K;
char S[MN][MN];
int R[2][2], Q[2][2], tmp[2][2];

int main() {
	scanf("%d%d%lld", &N, &M, &K);
	if (!K) return puts("1"), 0;
	for (int i = 1; i <= N; ++i) {
		scanf("%s", S[i] + 1);
		for (int j = 1; j <= M; ++j)
			if (S[i][j] == '#') ++A;
	}
	int ok1 = 0, ok2 = 0;
	for (int i = 1; i <= N; ++i) if (S[i][1] == '#' && S[i][M] == '#') ++ok1;
	for (int j = 1; j <= M; ++j) if (S[1][j] == '#' && S[N][j] == '#') ++ok2;
	if (ok1 && ok2) return puts("1"), 0;
	if (!ok1 && !ok2) return printf("%d\n", qPow(A, K - 1)), 0;
	if (ok1) {
		C = ok1;
		for (int i = 1; i <= N; ++i)
			for (int j = 1; j < M; ++j)
				if (S[i][j] == '#' && S[i][j + 1] == '#') ++B;
	} else {
		C = ok2;
		for (int j = 1; j <= M; ++j)
			for (int i = 1; i < N; ++i)
				if (S[i][j] == '#' && S[i + 1][j] == '#') ++B;
	}
	Q[0][0] = A, Q[1][0] = B, Q[1][1] = C;
	R[0][0] = R[1][1] = 1;
	#define F(i) for (int i = 0; i < 2; ++i)
	--K;
	while (K) {
		if (K & 1) {
			F(i) F(j) tmp[i][j] = 0;
			F(i) F(j) F(k) tmp[i][k] = (tmp[i][k] + (LL)R[i][j] * Q[j][k]) % Mod;
			F(i) F(j) R[i][j] = tmp[i][j];
		}
		F(i) F(j) tmp[i][j] = 0;
		F(i) F(j) F(k) tmp[i][k] = (tmp[i][k] + (LL)Q[i][j] * Q[j][k]) % Mod;
		F(i) F(j) Q[i][j] = tmp[i][j];
		K >>= 1;
	}
	printf("%d\n", (R[0][0] - R[1][0] + Mod) % Mod);
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define pb push_back
#define pf push_front
#define Mid ((l+r)/2)
#define pi pair<int,int>
#define pii pair<int,pi>
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main()
{
    go;
    int n;
    cin>>n;
    n=n%10;
    if(n==3)
        cout<<"bon";
    else if(n==0||n==1||n==6||n==8)
        cout<<"pon";
    else
        cout<<"hon";
    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
int main()
{
   ll n;
  cin>>n;
  ll a[n];
  for(int i=0;i<n;i++)
     cin>>a[i];
  ll ans=0;
  ll st=1;
  for(int i=0;i<64;i++)
  {
    ll c1=0,c2=0;
    for(int j=0;j<n;j++)
    {
     if(a[j]&1)
       c2++;
      else
        c1++;
      a[j]/=2;
    }
    ans=(ans+((st%mod*(c1%mod*c2%mod)%mod)%mod)%mod)%mod;
    st=st*2;
    st%=mod;
  }
  cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reve(a) reverse(a.begin(), a.end())
typedef long long ll;
const ll MOD = 1e9+7;

int main(){
  double a, b, x;
  cin >> a >> b >> x;
  const double n=90.000000000000;
  const double PI=3.14159265358979323846;
  double a2 = a*a;
  double a3 = a2*a, ab=a2*b;
  double x1 = 2*(ab-x);
  double ab2 = a*b*b;
  a = a3/x1;
  //printf("%lf\n", a);
  //if(x==a*a*b) cout << 0.0000000000000 << endl;
  if(2*x>=ab) printf("%.10lf\n", n-atan(a)*180/PI);
  else printf("%.10lf\n", n-atan(2*x/ab2)*180/PI);
}

Measured memory_bytes: 384
local Nsw, Nli = io.read("n", "n")
local switches = {}
local onconds = {}
for i=1,Nli do
    local k = io.read("n")
    local swi = {}
    switches[i] = swi
    for j=1,k do
        swi[j] = io.read("n")
    end
end
for i=1,Nli do
    onconds[i] = io.read("n")
end
-- Cartesian product
local function carprod(seqs)
    return coroutine.wrap(function()
        if #seqs == 0 then
            coroutine.yield({})
            return
        end
        local s1 = seqs[1]
        for _,v in ipairs(s1) do
            for t in carprod({select(2, table.unpack(seqs))}) do
                coroutine.yield({v, table.unpack(t)})
            end
        end
    end)
end

local zo = {0,1}
local set = {}
for i=1,Nsw do
    set[i] = zo
end
local ans = 0
for ss in carprod(set) do -- 1024 times
    --print(table.concat(ss, ""))
    local all_on = true
    for i=1,Nli do -- 10 times
        local swi = switches[i]
        local sum = 0
        for k,v in ipairs(swi) do -- 10 times
            if ss[v] == 1 then
                sum = sum + 1
            end
        end
        if sum % 2 == onconds[i] then
        else
            all_on = false
            break
        end
    end
    if all_on then
        ans = ans + 1
    end
end
print(ans)

Measured memory_bytes: 752
#include<stdio.h>
#include<string.h>
int main()
{
  char s[5000];
  scanf("%s",s);
  int n=strlen(s);
  if(s[n-1]=='s')
  {
    printf("%s",s);
    printf("es");
  }else{
    printf("%s",s);
    printf("s");
  }
  return 0;
}

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

int main() {
    string s;
    cin >> s;
    if (s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loop2(num) for (lli j = 0 ; j < num ; j ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }
#define looppu(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . push_back (x) ;}
#define loopin(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . insert (x) ;}

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back ()
#define pof pop_front ()

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

signed main ()
{
    fastio
    ll n ; cin >> n ;
    (n < 11 ? (n % 7 == 0 || n % 4 == 0 ? Yes : No) : (n == 13 || n == 17 ? No : Yes)) ;
    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
n = gets.to_i
dish_numbers = gets.split(' ').map(&:to_i)
dish_satisfuctions = gets.split(' ').map(&:to_i)
plus_satisfuctions = gets.split(' ').map(&:to_i)

count = dish_satisfuctions.inject(:+)

(0..dish_numbers.length - 1).each do |index|
  if dish_numbers[index] + 1 == dish_numbers[index + 1]
    count += plus_satisfuctions[dish_numbers[index] - 1]
  end
end

puts count

Measured memory_bytes: 1788
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
a.sort()

li=[]

for i in range(n-1,-(n),-2):
    li.append(abs(i))

li.sort()

if a==li:
    print((2**(n//2))%mod)
else:
    print(0)

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

int main(void){
  int n;
  scanf("%d",&n);
  char s[n][11];
  for(int i = 0;i < n;i ++){
    scanf("%s",s[i]);
  }

  qsort(s,n,11,strcmp);
  int max = 0 , count = 0;
  
  for(int i = 0;i < n - 1;i ++){
    if(strcmp(s[i],s[i + 1]) == 0){
      count ++;
    }
    else{
      if(max < count){
        max = count;
        }
      	if(strcmp(s[i],s[i + 1]) == 0){
          count  = 1;
        }
        else{
          count = 0;
        }
      }
  }
  if(max < count){
	max = count;
  }
  count = 0;
  for(int i = 0;i < n;i ++){
    if(strcmp(s[i],s[i + 1]) == 0){
      count ++;
    }
    else{
      count = 0;
    }
    if(count == max){
      printf("%s\n",s[i]);
    }
  }

  return 0;
}


Measured memory_bytes: 4476
#!/usr/bin/node
// Generated by CoffeeScript 1.3.3 (minified manually)
(function() {
  var a=[],stdin;
  stdin=process.openStdin();
  stdin.setEncoding('utf8');

  stdin.on('data', function(input) {
    var x = input.split("\n");
    if(x.length > 2 || x[1] !== '')a = x;
    else a.push(x[0]);
  });

  stdin.on('end', function(z) {
    var b, i, j, m, n, r, y;
    n = parseInt(a.shift());
    for(i=0;i<n;i++){
      b = a[i].split(" ");
      for(j=0;j<b.length;j++)b[j]=parseInt(b[j]);
      y = b[0] - 1;
      m = b[1] - 1;
      r = 0;
      if (y % 3 !== 2) {
        r = Math.floor(m / 2);
      }
      console.log(196471 - y * 195 - Math.floor(y / 3) * 5 - m * 20 + r - b[2]);
    }
  });
}).call(this);

Measured memory_bytes: 8968
#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($( { splits.next().unwrap().parse::<$t>().unwrap() },)*)
    }}
}


#[allow(unused_macros)]
macro_rules! invec {
    ( $ t : ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s
                .trim()
                .split_whitespace()
                .map(|s| s.parse::<$t>().unwrap())
                .collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }};
}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (n,) = input!(usize);
    let mut a = invec!(u64);
    let mut b = invec!(u64);

    let original_total: u64 = a.iter().sum();

    if a[0] <= b[0] {
        b[0] -= a[0];
        a[0] = 0;
    } else {
        a[0] -= b[0];
        b[0] = 0;
    }

    for i in 1..n {
        if a[i] <= b[i - 1] {
            a[i] = 0;
            b[i - 1] -= a[i];
        } else {
            a[i] -= b[i - 1];
            b[i - 1] = 0;
        }

        if a[i] <= b[i] {
            b[i] -= a[i];
            a[i] = 0;
        } else {
            a[i] -= b[i];
            b[i] = 0;
        }
    }

    if a[n] <= b[n - 1] {
        a[n] = 0;
    } else {
        a[n] -= b[n - 1];
    }

    let last_total: u64 = a.iter().sum();

    println!("{}", original_total - last_total);
}

fn main() {
    solve();
}


Measured memory_bytes: 10492
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		
		int x = stdIn.nextInt();
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		
		if(abs(x-a) < abs(x-b))
		{
			System.out.println("A");
		}
		else
		{
			System.out.println("B");
		}
		
		

	}
	
	public static int abs(int x)
	{
		if(x >= 0)
		{
			return x;
		}
		else
		{
			return x * (-1);
		}
	}

}


Measured memory_bytes: 35700
n,m,x,y=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))

xl=max(X)
ys=min(Y)

for z in range(x+1,y+1):
	if xl<z<=ys:
		print("No War")
		break
else:
	print("War")

Measured memory_bytes: 3064
//Love and Freedom.
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long
#define inf 20021225
#define db double
using namespace std;
int read()
{
	int s=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return f*s;
}
int n,x,k;
int main()
{
	n=read(); x=read(); k=read();
	db bg=x,ed=x+(2.0*n-1)*k,ans=0.0;
	for(int i=(n<<1);i;i-=2)
	{
		ans+=(bg+ed)/2.0;
		bg+=(bg*2+k*5)/(1.0*i);
		ed+=(ed*2-k*5)/(1.0*i);
		if(i>2)	k=(ed-bg)/((i-2)*1.0-1.0);
	}
	printf("%.10lf\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



int main(){
	int n;
	cin >> n;
	int t[100005] = {};
	rep(i,0,n)cin >> t[i];
	int m;
	cin >> m;

	rep(i,0,m){
        int p,x;
        cin >> p >>x;
        ll ans = 0;
        rep(i,0,n){
            if(p == i+1){
                ans += x;
            }else{
                ans += t[i];
            }
        }
        P(ans);
	}
	
	return  0;
}

Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main()
{
	long long n,a;
	cin >> n >> a;
	n = n % 500;
	if(a >= n)
	    {
	    	cout << "Yes" << endl;
		}
		else
		    {
		    	cout << "No" << endl;
			}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
#include <bitset>
#include <string>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define all(x) (x).begin(),(x).end()
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));}

ll modpow(ll x, ll n) {
    if (n == 0) {
        return 1;
    } else if (n % 2 == 0) {
        ll h = modpow(x, n / 2);
        return h * h % MOD;
    } else {
        return x * modpow(x, n - 1) % MOD;
    }
}

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

int vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance(vec.begin(), itr);
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
    int N; cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    vector<int> f(N), l(N);
    f[0] = abs(A[0]), l[0] = abs(A[N-1]);
    reps(i,N-1){ // 累積和を計算
      f[i] = abs(A[i] - A[i-1]) + f[i-1];
      l[i] = abs(A[N-i-1] - A[N-i]) + l[i-1];
    }
    // rep(i,N)  cout << f[i] << ' ';
    // cout << endl;
    // rep(i,N)  cout << l[i] << ' ';
    // cout << endl;
    rep(i,N){
      if (i == 0) cout << l[N-2] + abs(A[1]) << endl;
      else if (i == N-1) cout << f[N-2] + abs(A[N-2]) << endl;
      else  cout << f[i-1] + l[N-2-i] + abs(A[i+1]-A[i-1]) << endl;
    }


    return 0;
}


Measured memory_bytes: 2432
// -*- mode:c++; coding:utf-8; indent-tabs-mode:nil; -*-
// ALDS1_5-A: Exhaustive Search

#include <cstdio>

static bool solve(const int m, const int as[], const unsigned int n) {
  if (m == 0) {
    return true;
  } else if (n == 0) {
    return false;
  } else {
    return solve(m-as[0], as+1, n-1) || solve(m, as+1, n-1);
  }
}

int main(void) {
  unsigned int n;
  std::scanf("%d", &n);
  int as[n];
  for (auto i = 0u; i < n; ++i) {
    std::scanf("%d", &as[i]);
  }

  unsigned int q;
  std::scanf("%d", &q);
  for (auto i = 0u; i < q; ++i) {
    int m;
    std::scanf("%d", &m);
    bool is_solved = solve(m, as, n);
    std::printf("%s\n", is_solved ? "yes" : "no");
  }

  return 0;
}
// end

Measured memory_bytes: 2608
#include<cstdio>
#include<queue>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<iostream>
using namespace std;
long long c[210000]={0},a[210000];
int  main()
{
	long long i,n,ans=0;
	scanf("%lld",&n);
	for(i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		c[a[i]]++;
	}
	for(i=1;i<=n;i++){
		ans+=c[i]*(c[i]-1)/2;
	}
	for(i=1;i<=n;i++){
		printf("%lld\n",ans-(c[a[i]]-1));
	}
}


Measured memory_bytes: 4736
// 2011/09/26 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==0)
			break;

		char A[26];
		for(int i=0; i<26; i++)
			A[i] = (char)('A'+i);
		char a[26];
		for(int i=0; i<26; i++)
			a[i] = (char)('a'+i);
		char N[10];
		for(int i=0; i<10; i++)
			N[i] = (char)('0'+i);

		for(int i=0; i<n; i++){
			char bef, aft;
			cin >> bef >> aft;
			if(bef>='A'&&bef<='Z')
				A[bef-'A'] = aft;
			else if(bef>='a'&&bef<='z')
				a[bef-'a'] = aft;
			else if(bef>='0'&&bef<='9')
				N[bef-'0'] = aft;
		}

		int m;
		cin >> m;

		for(int i=0; i<m; i++){
			char c;
			cin >> c;
			if(c>='A'&&c<='Z')
				cout << A[c-'A'];
			else if(c>='a'&&c<='z')
				cout << a[c-'a'];
			else if(c>='0'&&c<='9')
				cout << N[c-'0'];
		}

		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 852
using System;

namespace abc98_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int plus = 0;
            int minus = 0;
            int batu = 0;
            string[] array = Console.ReadLine().Split(' ');
            int[] answer = new int[3];
            int a = int.Parse(array[0]);
            int b = int.Parse(array[1]);
            plus = a + b;
            minus = a - b;
            batu = a * b;
            answer[0] = plus;
            answer[1] = minus;
            answer[2] = batu;

            Array.Sort(answer);
            Console.WriteLine(answer[2]);


        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) (a).begin(), (a).end()
#define pw(x) (1ll<<(x))
#define lb(x) ((x) & -(x))
#define endl "\n"
#define FI(x) freopen(#x".in","r",stdin)
#define FO(x) freopen(#x".out","w",stdout)
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
//typedef uniform_int_distribution<ll> RR;
const int P = 1e9 + 7;
//ll rnd(ll l, ll r) { mt19937 gen(rand()); RR dis(l, r); return dis(gen); }
int add(int a, int b) {if((a += b) >= P) a -= P; return a < 0 ? a + P : a;}
int mul(int a, int b) {return 1ll * a * b % P;}
int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----

const int N = 1e5 + 76;
int n;
ll a[N], b[N], ans;

int main() {
	//FI(a);
	ios::sync_with_stdio(0);
	cin.tie(0);
	//cout << setiosflags(ios::fixed);
	//cout << setprecision(2);
	cin >> n;
	rep(i, 1, n+1) cin >> a[i] >> b[i];
	per(i, 1, n+1) {
		a[i] += ans;
		ll t = b[i] - (a[i] % b[i]);
		if (t != b[i]) ans += t;
	} 
	cout << ans << endl;
	return 0; 
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int H, W, D;
    cin >> H >> W >> D;
    vector<vector<long long>> A(H, vector<long long>(W));
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++) {
            cin >> A[i][j];
            A[i][j]--;
        }
    }
    vector<int> x(H*W), y(H * W);
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            x[A[i][j]] = i;
            y[A[i][j]] = j;
        }
    }
    vector<long long> dp(H * W, -1);
    for(int i = 0; i < H * W; i++){
        if(dp[i] != -1) continue;
        if(i < D && dp[i] == -1) dp[i] = 0;
        else{
            dp[i] = dp[i - D] + abs(x[i] - x[i - D]) + abs(y[i]- y[i - D]);
        }
    }
    int Q;
    cin >> Q;
    for(int i = 0; i < Q; i++){
        int L, R;
        cin >> L >> R;
        L--;
        R--;
        cout << dp[R] - dp[L] << endl;
    }
}

Measured memory_bytes: 5296
use std::io::Read;

fn main() {
    let mut buf = String::new();

    // 標準入力から全部bufに読み込む
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let s: String = iter.next().unwrap().parse().unwrap();

    let numbers: Vec<i32> = s.chars().map(|x| x.to_digit(10).unwrap() as i32).collect();
    let mut patterns: Vec<Vec<i32>> = Vec::new();

    for i in 0..2usize.pow(3) {
        let mut row = numbers[1..].to_vec();
        for j in 0..i {
            // j桁右シフトして最初のbitが1かチェック
            if ((i >> j) & 1) == 1 {
                row[j] = -row[j];
            }
        }
        patterns.push(row);
    }

    for p in patterns {
        if p.iter().fold(0, |acc, num| acc + num) + numbers[0] == 7 {
            let formula = p
                .iter()
                .map(|&num| {
                    if num < 0 {
                        num.to_string()
                    } else {
                        format!("{}{}", "+", num.to_string())
                    }
                })
                .collect::<Vec<String>>()
                .join("");
            println!("{}{}=7", numbers[0], formula);
            return;
        }
    }
}


Measured memory_bytes: 4476
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
typedef long long int64;
 
 
struct Primal_Dual
{
  const int64 INF = 1LL << 59;
  typedef pair< int64, int > Pi;
 
  struct edge
  {
    int to, cap, cost, rev;
  };
  vector< vector< edge > > graph;
  vector< int64 > potential, min_cost, prevv, preve;
 
  Primal_Dual(int V) : graph(V) {}
 
  void add_edge(int from, int to, int cap, int cost)
  {
    graph[from].push_back((edge) {to, cap, cost, (int) graph[to].size()});
    graph[to].push_back((edge) {from, 0, -cost, (int) graph[from].size() - 1});
  }
 
  int64 min_cost_flow(int s, int t, int f)
  {
    int64 V = graph.size(), ret = 0;
    priority_queue< Pi, vector< Pi >, greater< Pi > > que;
    potential.assign(V, 0);
    preve.assign(V, -1);
    prevv.assign(V, -1);
 
    while(f > 0) {
      min_cost.assign(V, INF);
      que.push(Pi(0, s));
      min_cost[s] = 0;
 
      while(!que.empty()) {
        Pi p = que.top();
        que.pop();
        if(min_cost[p.second] < p.first) continue;
        for(int i = 0; i < graph[p.second].size(); i++) {
          edge &e = graph[p.second][i];
          int64 nextCost = min_cost[p.second] + e.cost + potential[p.second] - potential[e.to];
          if(e.cap > 0 && min_cost[e.to] > nextCost) {
            min_cost[e.to] = nextCost;
            prevv[e.to] = p.second, preve[e.to] = i;
            que.push(Pi(min_cost[e.to], e.to));
          }
        }
      }
      if(min_cost[t] == INF) return (114514);
      for(int v = 0; v < V; v++) potential[v] += min_cost[v];
      int addflow = f;
      for(int v = t; v != s; v = prevv[v]) {
        addflow = min(addflow, graph[prevv[v]][preve[v]].cap);
      }
      f -= addflow;
      ret += addflow * potential[t];
      for(int v = t; v != s; v = prevv[v]) {
        edge &e = graph[prevv[v]][preve[v]];
        e.cap -= addflow;
        graph[v][e.rev].cap += addflow;
      }
    }
    return ret;
  }
};
 
signed main()
{
  int H, W, A[200][200];
 
  cin >> H >> W;
  Primal_Dual flow(H * W * 2);
 
  auto cell = [&](int i, int j, bool in)
  {
    if(in) return (H * W + i * W + j);
    return (i * W + j);
  };
 
  const int mx = 1e6;
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      cin >> A[i][j];
      flow.add_edge(cell(i, j, false), cell(i, j, true), 1, mx - A[i][j]);
      flow.add_edge(cell(i, j, false), cell(i, j, true), 1, mx);
      if(i > 0) flow.add_edge(cell(i - 1, j, true), cell(i, j, false), 2, 0);
      if(j > 0) flow.add_edge(cell(i, j - 1, true), cell(i, j, false), 2, 0);
    }
  }
  cout << -(flow.min_cost_flow(cell(0, 0, false), cell(H - 1, W - 1, true), 2) - mx * (H + W - 1) * 2) << endl;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll res = 1 ^ 2 ^ 3;
	ll a, b;
	cin >> a >> b;
	res ^= a^b;
	cout << res << endl;

}



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

//public class Problem0003_IsItaRightTriangle {
public class Main {
	public static void main(String[] args) {
		try {
		//	Problem0003_IsItaRightTriangle test = new Problem0003_IsItaRightTriangle();
			Main test = new Main();
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			int number = Integer.parseInt(reader.readLine());
			int[] sides = new int[3];	//ÓÍ"side"çµ¢
			
			for(int i = 0; i < number; i++) {	//±±©ç{Ô
				String[] textArray = reader.readLine().split(" ");
				for(int j = 0; j < 3; j++) {
					sides[j] = Integer.parseInt(textArray[j]);
				}
				
				test.showAnswer(test.getMax(sides));
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	int[] getMax(int[] array) {
		int[] targetArray = array;
		
		int max = targetArray[0];	//}CiXÌêÍ0ðãü³êéÆss
		int maxPosition = 0;		//0ªúlÈÌÍ¾ç©
		for(int i = 1; i < targetArray.length; i++) {
			if(max < targetArray[i]) {
				max = targetArray[i];
				maxPosition = i;
			}
		}
		
		int temporary = targetArray[0];
		targetArray[0] = max;
		targetArray[maxPosition] = temporary;
		
		return targetArray;
	}
	//ÅålªêÔOÉ ézñÉÎµÄA¼pOp`©Ç¤©¦ðo·B
	void showAnswer(int[] array) {
		if(array.length != 3) {
			throw new IllegalArgumentException();	//OÌ½ß
		}
		if(array[0] * array[0] == array[1] * array[1] + array[2] * array[2]) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 10000
#include <stdio.h>
#include <algorithm>

using namespace std;

struct Item{
	int value,weight;
};

int main(){
	int N,W,ans = -1;
	scanf("%d %d",&N,&W);
	Item array[N];
	int table[W+1];
	for(int i=0; i < W+1; i++)table[i] = 0;

	for(int i=0;i<N;i++){
		scanf("%d %d",&array[i].value,&array[i].weight);
	}

	for(int i = 1; i <= W; i++){
		for(int k = 0; k < N; k++){
			if(i >= array[k].weight){
				table[i] = max(table[i],array[k].value + table[i-array[k].weight]);
				ans = max(table[i],ans);
			}
		}
	}

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 2744
#include <stdio.h>
//#include <string.h>

int main(void){
  
  int d;
  
  scanf("%d", &d);

  if(d==25) printf("Christmas");
  else if(d==24) printf("Christmas Eve");
  else if(d==23) printf("Christmas Eve Eve");
  else if(d==22) printf("Christmas Eve Eve Eve");

  return 0;
}

  

Measured memory_bytes: 1708
#include<stdio.h>  
int c[105][105],b[10050];  
int main ()  
{  
    int a,w;  
    while(scanf("%d %d",&a,&w)!=EOF)  
    {  
        int i,j,t,k=0;  
        scanf("%d",&t);  
        for(i=0;i<t;i++)  
            scanf("%d",&b[i]);  
        for(i=0;i<a;i++)  
        {  
            if(i%2==0)  
                for(j=0;j<w;j++)  
                {  
                    c[i][j]=k+1;  
                    b[k]--;  
                    if(b[k]==0)  
                        k++;  
                }  
            if(i%2==1)  
                for(j=w-1;j>=0;j--)  
                {  
                    c[i][j]=k+1;  
                    b[k]--;  
                    if(b[k]==0)  
                        k++;  
                }  
        }  
        for(i=0;i<a;i++)  
        {  
            for(j=0;j<w-1;j++)  
                printf("%d ",c[i][j]);  
            printf("%d\n",c[i][w-1]);  
        }  
    }  
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

def fibo(n, memo = {}):
   if n == 0 or n == 1:
      return 1
   elif n in memo:
      return memo[n]
   else:
      memo[n] = fibo(n - 1, memo) + fibo(n - 2, memo)
      return memo[n]

n = int(input())
print(fibo(n))



Measured memory_bytes: 5612
Num = int(input())
Num_Array = sorted(list(map(int,input().split())),reverse=True)
Alice,Bob = 0,0

for i in range(Num):

    if i % 2 == 0 :
        Alice += Num_Array[i]
    else:
        Bob   += Num_Array[i]

print(Alice - Bob)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<string>
 
using namespace std;
 
int main(void){
	
  int n;
  int flag = 0;
  cin >> n;
  for(int i = 0; i < 3; i++){
    if(n%10 == 7)flag++;
    n /= 10;
  }
  
  if(flag != 0)cout << "Yes";
  else cout << "No";
  
  return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    string S;
    cin >> S;
    REP(i, S.length() - 1)
    {
        if (S[i] == 'A' && S[i + 1] == 'C')
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    int n; cin>>n;
    vector <int> a(n); 
    vector <int> b(n); 
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];
    vector <int> kouho(n);
    int mae = -1;
    rep(i,n){
        if(mae <a[i]){
            //cout<<b[i]<<' '<<a[i]<<endl;
            if(b[i]<a[i]) {cout<<0<<endl; /*cout<<b[i]<<'!'<<a[i]<<endl;*/ return 0;}
            else kouho[i] = 1;
            mae = a[i];
        }else{
            kouho[i] = a[i];
        }
    }
    mae = -1;
    for(int i=n-1;i>=0;i--){
        
        if(mae < b[i]){
            
            if(a[i]<b[i]) {cout<<0<<endl; return 0;}
            else kouho[i] = 1;
            mae = b[i];
        }else{
            kouho[i] = min(kouho[i], b[i]);
        }
    }
    int ans = 1;
    rep(i,n){
        //cout<<kouho[i]<<endl;
        ans *= kouho[i];
        ans %= MOD;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2560
n = int(input())
t, a = map(int, input().split())
heights = map(int, input().split())

def av_temp(t, h):
    return t - (h*0.006)

print(sorted([(i, abs(a - av_temp(t, h))) for i, h in enumerate(heights)], key=lambda x: x[1])[0][0]+1)

Measured memory_bytes: 3188
N = int(input())
a = list(map(int,input().split()))

x=0

for i in range(0,N):
  if a[i]%2==0:
#    print(a[i])
#    print(a[i]%3)
#    print(a[i]%5)
    if a[i]%3!=0:
      if a[i]%5!=0:
#        print(a[i])
        x=1
if x==1:
  print("DENIED")
  exit()
print("APPROVED")

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

using namespace std;

const int vy[] = {-1, 1, 0, 0};
const int vx[] = {0, 0, -1, 1};
const string temp = "UDLR";

int main()
{
  vector< int > buff[13][1 << 12];
  for(int k = 0; k < 13; k++) {
    for(int i = 0; i < 1 << k; i++) {
      for(int j = 0; j < 1 << k; j++) {
        if(i & j) continue;
        buff[k][i].push_back(j);
      }
    }
  }

  int latte, malta, H, W, T, S, P;
  string A[100];
  int damage[256], B[1000], C[12];

  while(cin >> latte >> malta, latte) {
    cin >> H >> W;
    for(int i = 0; i < H; i++) cin >> A[i];
    cin >> T;
    for(int i = 0; i < T; i++) {
      char c;
      int d;
      cin >> c >> d;
      damage[c] = d;
    }
    cin >> S;
    int curr = 0;
    for(int i = 0; i < S; i++) {
      char c;
      int d;
      cin >> c >> d;
      int dir = (int) temp.find(c);
      while(d--) B[curr++] = dir;
    }
    cin >> P;
    for(int i = 0; i < P; i++) {
      cin >> C[i];
    }

    int yy = 0, xx = 0;

    vector< int > add(1 << P, 0);
    for(int i = 0; i < 1 << P; i++) {
      for(int j = 0; j < P; j++) {
        if((i >> j) & 1) add[i] += C[j];
      }
    }

    vector< int > dp(1 << P, -1);
    dp[0] = latte;
    for(int i = 0; i < curr; i++) {
      vector< int > nextdp(1 << P, -1);
      yy += vy[B[i]], xx += vx[B[i]];
      for(int j = 0; j < 1 << P; j++) {
        if(dp[j] == -1) continue;
        if(dp[j] - damage[A[yy][xx]] >= 1) {
          nextdp[j] = max(nextdp[j], dp[j] - damage[A[yy][xx]]);
          continue;
        }
        for(int k : buff[P][j]) {
          int get = min(malta, dp[j] + add[k]) - damage[A[yy][xx]];
          if(get >= 1) nextdp[j | k] = max(nextdp[j | k], get);
        }
      }
      dp.swap(nextdp);
    }
    bool beet = false;
    for(int k : dp) if(k >= 1) beet = true;
    if(beet) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

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

int main() {
  long long X;
  cin>>X;
  long long a=100;
  for(int i=0;i<100000;i++){
    a=a+a/100;
    if(a>=X){
      cout<<i+1<< endl;
      return 0;
    }
  }
  
}


Measured memory_bytes: 3572
#include<iostream>
#include<vector>
#include<string>
#include<istream>
using namespace std;
int main(){
	string a;
	getline(cin,a);
	for(int i = 0 ; i<a.size();i++){
		if((int)a[i]<=122 && (int)a[i]>=97){
			a[i] -= 32;
			}
		}
	for(int i = 0; i<a.size();i++) cout<<a[i];
	cout<<endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 1e5 + 100;
const ll inf = 2e18, mod = 1e9 + 7;

int n, a[maxn], b[maxn], p[maxn], q[maxn];

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

	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> p[i], p[i]--, q[p[i]] = i;
	for (int i = 0; i < n; i++)
		a[i] = 30000 * (i + 1);
	for (int i = 0; i < n; i++)
		b[i] = 30000 * (n - i) + q[i] + 1;
	for (int i = 0; i < n; i++)
		cout << a[i] << ' ';
	cout << endl;
	for (int i = 0; i < n; i++)
		cout << b[i] << ' ';
	cout << endl;
}



Measured memory_bytes: 1024
from collections import defaultdict

n = int(input())
a = list(map(int, input().split()))
dd = defaultdict(int)
total = 0
dd[0] += 1
for num in a:
    total += num
    dd[total] += 1
    
ans = 0
for i, j in dd.items():
    ans += j * (j - 1) // 2
print(ans)

Measured memory_bytes: 39288
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int N;
Int K;
vector<Int> A;
Int sum = 0;

vector<Int> enumerate_divisor(Int x) {
    vector<Int> d;

    for(Int y = 1;y*y <= x;y++) {
        if(x % y == 0) {
            d.push_back(y);
            if(y*y != x)
                d.push_back(x/y);
        }
    }

    sort(d.begin(),d.end());
    reverse(d.begin(),d.end());
    
    return d;
}

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

    for(int i = 0;i < N;i++) {
        Int a;
        cin>>a;
        A.push_back(a);
        sum += a;
    }
    
    for(auto d: enumerate_divisor(sum)) {
        vector<Int> R;
        
        for(auto a: A) {
            R.push_back(a % d);
        }

        sort(R.begin(),R.end());
        Int need = TEN(18);
        Int A = 0;
        Int B = 0;
        for(auto r: R)
            B += (d-r);

        for(int i = 0;i < N;i++) {
            A += R[i];
            B -= (d-R[i]);

            need = min(need,max(A,B));
        }

        if(need <= K) {
            cout<<d<<endl;

            return 0;
        }
    }

    return 0;
}


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

const int INF = 1001001001;

int main() {
	int n, x, y;
	cin >> n >> x >> y;
	x--; y--;
	vector<int> ans(n);
	for (int i = 0; i < n; i++) {
		vector<int> dist(n, INF); // distans from ith vertex
		queue<int> q;
		auto push = [&](int v, int d) {
			if (dist.at(v) != INF) return;
			dist.at(v) = d;
			q.push(v);
		};
		push(i, 0);
		while (!q.empty()) {
			int v = q.front(); q.pop();
			int d = dist.at(v);
			if (v - 1 >= 0) push(v - 1, d + 1);
			if (v + 1 < n) push(v + 1, d + 1);
			if (v == x) push(y, d + 1);
			if (v == y) push(x, d + 1);
		}
		for (int j = 0; j < n; j++) ans.at(dist.at(j))++;
	}
	for (int i = 1; i < n; i++) {
		cout << ans.at(i)/2 << endl;
	}
}


Measured memory_bytes: 256
import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int[] param = new int[n];
    
    
    for(int i=0 ; i<n ; i++){
      param[i] = sc.nextInt();
    }
    
    Arrays.sort(param);
    
    int max = param[n-1];
    int min = param[0];
    
    int abs = max-min;
    System.out.println(abs);
  }
}

Measured memory_bytes: 21844