akhauriyash/Code-Regression huggingface dataset:
import kotlin.math.abs

fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main() {
    val n = readLine()?.toInt() ?: return
    val a = longList()
    val b = longList()
    val max = b.sum() - a.sum()
    if (max < 0L) {
        println("No")
        return
    }
    var ac = 0L
    var bc = 0L
    repeat(n) {
        val aa = a[it]
        val bb = b[it]
        val diff = abs(aa - bb)
        if (aa >= bb) {
            bc += diff
        } else {
            ac += diff / 2 + diff % 2
        }
    }
    if (ac <= max && bc <= max) {
        println("Yes")
    } else {
        println("No")
    }
}


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

int main(){
	double x, h, ans;
	while (cin >> x >> h) {
		if (x == 0 && h == 0) {
			break;
		}
		ans = x*(x+2.0*sqrt(h*h+0.25*x*x));
		cout << setprecision(20);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 0
N = int(input())
D = []
cont_count = 0

for _ in range(N):
  d1, d2 = map(int, input().split())
  if d1 == d2:
    cont_count += 1
    if cont_count == 3:
      print('Yes')
      exit()
  else:
    cont_count = 0

print('No')

Measured memory_bytes: 9172
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#define re register
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(arr) memset(arr, 0, sizeof(arr))
const int inf = 0x3f3f3f3f;
string s,t,ch[101];
map<string,int> b;
char minn;
int l,num,k,flag,o;
int main() {
	cin>>s;
	cin>>k;
	l=s.length();
	minn='{';
	for(re int i=0;i<l-5;i++){
		if(s[i]<minn){
			minn=s[i];
			o=i;
		}
	}
	ch[0]=" ";
	for(re int i=o; i<l; i++) {
		for(re int j=i; j<min(i+k,l); j++) {
			t+=s[j];
			if(b[t]==1) continue;
			b[t]=1;
			if(num!=0) {
				if(num<k) {
					for(re int h=num; h>=0; h--) {
						if(t>ch[h]) {
							ch[h+1]=t; break;
						}
						else {
							ch[h+1]=ch[h];
						}		
					}
				num++;
				} else {
					for(re int h=num; h>=0; h--) {
						if(t>ch[h]) {
							ch[h+1]=t;
							flag=h;
							break;
						} else {
							ch[h+1]=ch[h];
						}
					}
					if(flag==num) {
						flag=0;
						break;
					}
				}
			} else
				ch[++num]=t;
		}
		t="";
	}
	cout<<ch[k];
}

Measured memory_bytes: 768
use proconio::input;
fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
        d: i64,
        e: i64,
    }
    let numbers = vec![b - a, c - a, d - a, e - a];
    let zero: Option<usize> = numbers.iter().enumerate().find_map(|(index, number)| find_zero(*number, index, a));
    if zero.is_none() { println!("{}", b - 1) }
    else {
        match zero.unwrap() {
             0 => println!("{}", a + 1),
             1 => println!("{}", a + 2),
             2 => println!("{}", a + 3),
             3 => println!("{}", a + 4),
             _ => println!("?")
        }
    }
}

fn find_zero(n: i64, index: usize, diff: i64) -> Option<usize> {
    if n + diff == 0 { Some(index) }
    else { None }
}

Measured memory_bytes: 2152
#include <bits/stdc++.h>
using namespace std;
vector <int> card;



int main(){
    int n;
    int rez = 0;
    int a;
    int semn = 1;
    cin >> n;
    for ( int i = 1 ; i <= n ; i ++){
        cin >> a;
        card.push_back(a);
    }
    sort(card.begin(),card.end());
    for ( int i = card.size()-1 ; i >= 0 ; i --){
        rez += card[i]*semn;
        semn = semn * -1 ;
    }
    cout << rez;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - Garden
            var line = ReadLine();
            int a = line[0];
            int b = line[1];

            Console.WriteLine((a - 1) * (b - 1));
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine().TrimEnd();
            var array = line.Split(' ');
            var numbers = new List<int>();

            foreach (var s in array)
            {
                int num = int.Parse(s);
                numbers.Add(num);
            }

            return numbers;
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int ans = 0;
  for (int i=0;i<S.length();i++){
    if (i%2==0 && S[i]=='L'){
      ans=1;
      break;
    }
    if (i%2==1 && S[i]=='R'){
      ans=1;
      break;
    }
  }
  if (ans==1) cout << "No";
  else cout << "Yes";
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
  int n;cin >> n;
  int cnt = 0;
  for(int i = 1; i < n+1; i++){
    for(int j = 1; j < n+1; j++){
      if(i%2 == 0 && j%2 != 0 && i != j){
		  cnt++;
	  }
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
n = int(input())
cp = [0,0]
t1 = 0

for i in range(n):
    t,x,y = map(int,input().split())
    l = abs(x-cp[0])+abs(y-cp[1])
    s = t - t1 - l
    if s < 0 or s % 2 == 1:
        print('No')
        break
    cp = [x,y]
    t1 = t
else:
    print('Yes')

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

int main()
{
	int N,K;

	cin >> N >> K;
	int ans=0;
	for(int i=0;i<N;i++)
	{
		int h;
		cin >> h;
		if(h>=K)
			ans++;
	}

	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int A,B;
	scanf("%d %d",&A,&B);
	int c,d,e;
	c = A+B;
	d = A*B;
	e = A-B;
	if(c>=d && c>=e) printf("%d",c);
	else if(d >= c && d >= e) printf("%d",d);
	else if(e >= c && e >= d) printf("%d",e);
	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define X first
#define Y second
 
using namespace std;
typedef long long llint;
 
const int maxn = 1e6+10;
const int maxm = 1e6+10;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 20;
const int off = 1 << logo;
const int treesiz = off << 1;

int n;
int a[maxn];
int bio[maxm + 20];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", a+i);

	for (int i = 0; i < n; i++) bio[a[i]]++;

	bool flag = true;
	for (int i = 2; i < maxm; i++) {
		int cnt = 0;
		for (int j = i; j < maxm; j += i)
			cnt += bio[j];
		if (cnt > 1) {
			flag = false;
			break;
		}
	}
	if (flag) {
		printf("pairwise coprime");
		return 0;
	}

	flag = true;
	for (int i = 2; i < maxm; i++) {
		int cnt = 0;
		for (int j = i; j < maxm; j += i) 
			cnt += bio[j];
		if (cnt == n) {
			flag = false;
			break;
		}
	}

	if (flag) {
		printf("setwise coprime");
	} else printf("not coprime");
	return 0;
}

Measured memory_bytes: 11532
#include <stdio.h>

int main(void){
  int a[3][3];
  int n;
  int b;
  int i, j, k;

  for(i=0; i<3; i++)
    for(j=0; j<3; j++)
      scanf("%d", &a[i][j]);

  scanf("%d", &n);

  for(k=0; k<n; k++){
    scanf("%d", &b);
    for(i=0; i<3; i++)
      for(j=0; j<3; j++)
	if(a[i][j] == b){
	  a[i][j] = 0;
	  if(a[i][0] + a[i][1] + a[i][2] == 0 || a[0][j] + a[1][j] + a[2][j] == 0){
	    puts("Yes");
	    return 0;
	  }
	}
  }

  if(a[0][0] + a[1][1] + a[2][2] == 0 || a[0][2] + a[1][1] + a[2][0] == 0){
    puts("Yes");
    return 0;
  }

  puts("No");
  return 0;
}


Measured memory_bytes: 128
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect


def main():
    H, W = map(int, input().split())
    A = [list(input()) for _ in range(H)]

    checked = [[False] * W for _ in range(H)]
    ans = 0

    que = []
    for h in range(H):
        for w in range(W):
            if A[h][w] == '#' and not checked[h][w]:
                que.append((h, w))
                checked[h][w] = True
    while que:
        next_que = []
        while que:
            h, w = que.pop()
            dx4 = [0, 0, 1, -1]
            dy4 = [1, -1, 0, 0]

            for dx, dy in zip(dx4, dy4):
                next_h = h + dy
                next_w = w + dx
                if 0 <= next_h < H and 0 <= next_w < W and A[next_h][next_w] == '.' and not checked[next_h][next_w]:
                    A[next_h][next_w] = '#'
                    checked[h][w] = True
                    next_que.append((next_h, next_w))
        que = next_que
        if que:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 142768
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
// #define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pi pair<int,int>
#define pii pair< int, pi >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
using namespace std::chrono;

string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
const int N=3005;
ll fact[N];
ll invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}
void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){
  return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod;
}
void solve(){
  int s;
  cin>>s;
  pre();
  ll ans=0;
  rep(i,1,s/3+1){
    int rem=s-i*3;
    ans=(ans+nCr(rem+i-1,i-1))%mod;
  }
  cout<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3692
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, usize1) => {
        read_value!($next, usize) - 1
    };

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

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        s: usize
    }
    let x = 1000000000;
    let y = (s - 1) / x + 1;
    let z = x * y - s;
    println!("0 0 {} {} 1 {}", x, z, y);
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

#define MAX 2000000
#define INFTY (1 << 30)

int H, A[MAX + 1];

void maxHeapify(int i) {
  int left, right, largest;
  left = 2 * i;
  right = 2 * i + 1;

  if (left <= H && A[left] > A[i]) {
    largest = left;
  } else {
    largest = i;
  }

  if (right <= H && A[right] > A[largest]) {
    largest = right;
  }

  if (largest != i) {
    swap(A[i], A[largest]);
    maxHeapify(largest);
  }
}

int extract() {
  if (H < 1) {
    return -INFTY;
  }
  int maxv = A[1];
  A[1] = A[H--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(int i, int key) {
  if (key < A[i]) {
    return;
  }
  A[i] = key;
  while (i > 1 && A[i / 2] < A[i]) {
    swap(A[i], A[i / 2]);
    i = i / 2;
  }
}

void insert(int key) {
  H++;
  A[H] = -INFTY;
  increaseKey(H, key);
}

int main() {
  string com;
  int key;

  while (1) {
    cin >> com;
    if (com == "end") {
      break;
    } else if (com == "insert") {
      cin >> key;
      insert(key);
    } else {
      cout << extract() << endl;
    }
  }

  return 0;
}


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

int main() {
  int i;
  int ans=0;
  char x;
  char y[] = "CODEFESTIVAL2016";
  for(i=0;i<=15;i++) {
    cin >> x;
    if(x!=y[i]) ans+=1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define MOD 1000000007
#include <cstring>
using namespace std;
const int MAXN = 2005,L=2001;
int f[MAXN*2][MAXN*2],n,a[200005],b[200005],inv[MAXN*4];
inline void add(int &x,int a)
{
	x+=a;
	if(x>=MOD)x-=MOD;
}
int fac[8005];
inline int ksm(int x,int k)
{
	int ret=1;
	while(k){
		if(k&1)ret=(long long)ret*x%MOD;
		x=(long long)x*x%MOD;
		k>>=1;
	}
	return ret;
}
inline void init()
{
	fac[0]=1;
	for(int i=1;i<=8000;++i)
		fac[i]=(long long)fac[i-1]*i%MOD;
	inv[8000]=ksm(fac[8000],MOD-2);
	inv[0]=1;
	for(int i=7999;i;--i)
		inv[i]=(long long)inv[i+1]*(i+1)%MOD;
}
inline int C(int n,int m)
{
	return (long long)fac[m]*inv[m-n]%MOD*inv[n]%MOD;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d%d",a+i,b+i);
		++f[L-a[i]][L-b[i]];
	}
	for(int i=1;i<=4003;++i)
		for(int j=1;j<=4003;++j){
			add(f[i][j],(f[i][j-1]+f[i-1][j])%MOD);
			if(f[i][j]>=MOD)f[i][j]-=MOD;
		}
	int ans=0,del=0;
	init();	
	for(int i=1;i<=n;++i)
		add(ans,f[L+a[i]][L+b[i]]),add(del,C(a[i]*2,a[i]*2+b[i]*2));
	ans=(ans-del+MOD)%MOD;
	printf("%d\n",(long long)ans*ksm(2,MOD-2)%MOD);
	return 0;
}


Measured memory_bytes: 64640
class Unionfind
  attr_accessor(:par, :size)

  def initialize(n)
    @par = Array.new(n+1)
    (n+1).times do |i|
      @par[i] = i
    end
    @size = Array.new(n+1,1)
  end

  def root(x)
    while @par[x] != x
      x = @par[@par[x]]
      @par[x] = @par[@par[x]]
    end
    x
  end

  def unite(x,y)
    rx = root(x)
    ry = root(y)
    if rx != ry
      @size[ry] += size(rx)
      @par[rx] = ry
    end
  end

  def same(x,y)
    return root(x)==root(y)
  end

  def size(x)
    if @par[x] == x
      @size[x]
    else
      size(root(par[x]))
    end
  end

end
n,m = gets.chomp.split(" ").map(&:to_i)
a, b = m.times.map{gets.split.map(&:to_i)}.transpose
tree = Unionfind.new(n)
m.times do |i|
  tree.unite(a[i],b[i])
end
hash = Hash.new(0)
n.times do |i|
  hash[tree.root(i+1)] = 1
end
puts hash.length-1

Measured memory_bytes: 24616
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
constexpr int R=5e6+69, INF=2e9+6969;

int x;

int main()
{
	scanf("%d", &x);
	for(int i=1;i<=360;++i)
	{
		if((x*i)%360==0) 
		{
			printf("%d\n", i);
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3744
// 2012/11/19 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int p1, p2, p3, j1, j2;
	cin >> p1;
	cin >> p2;
	cin >> p3;
	cin >> j1;
	cin >> j2;

	int p = p1;
	if(p>p2){
		p = p2;
	}
	if(p>p3){
		p = p3;
	}

	int j = j1;
	if(j>j2){
		j = j2;
	}

	cout << p+j-50 << '\n';

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;
const int N=200010;
int tt,tim;
bool w[N];
vector <int> q[N];
int fa[N],dep[N],dis[N],head[N],to[N*2],nxt[N*2],a[N],b[N],dfn[N],ed[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
inline void dfs(int x,int f) {
    fa[x]=f,dep[x]=dep[f]+1,dfn[x]=++tim;
    for(int i=head[x];i;i=nxt[i])
	if(to[i]!=f) dfs(to[i],x);
    ed[x]=tim;
}
inline void solve(int x,int f) {
    dis[x]=dis[f]+1;
    if(dis[x]>=dep[x]) return;
    w[x]=1;
    for(int i=0;i<q[x].size();i++)
	if(q[x][i]!=f) solve(q[x][i],x);
}
inline bool check(int x,int y) {
    if(dep[x]<dep[y]) swap(x,y);
    if(dfn[y]<=dfn[x]&&dfn[x]<=ed[y]) return dep[x]-dep[y]>2;
    return fa[x]!=fa[y];
}
int main() {
    int n,A,B,ans=0;
    cin>>n>>A>>B;
    for(int i=1;i<n;i++) {
	int x=a[i]=gi(),y=b[i]=gi();
	q[x].push_back(y),q[y].push_back(x);
    }
    for(int i=1;i<n;i++) {
	int x=gi(),y=gi();
	to[++tt]=y,nxt[tt]=head[x],head[x]=tt;
	to[++tt]=x,nxt[tt]=head[y],head[y]=tt;
    }
    dfs(B,0),solve(A,0);
    for(int i=1;i<n;i++)
	if(check(a[i],b[i])&&(w[a[i]]||w[b[i]])) return puts("-1"),0;
    for(int i=1;i<=n;i++)
	if(w[i]) ans=max(ans,dep[i]*2-2);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 25856
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		int tmp = 0;
		String answer = "";

		for (int i = 0; i < 3; i++) {
			tmp = Integer.parseInt(n.substring(i, i+1));
			if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			}
		}
		System.out.println(answer);
	}
}


Measured memory_bytes: 21844
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import math

input = sys.stdin.readline

def main():
    N, D = map(int, input().split())
    X = [list(map(int, input().split())) for _ in range(N)]

    n = 0
    for i in range(len(X)):
        for j in range(i+1, len(X)):
            s = 0
            for k in range(D):
                s += (X[i][k] - X[j][k]) ** 2
            if math.sqrt(s).is_integer():
                n += 1
    print(n)

main()


Measured memory_bytes: 38512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,k;
	cin>>n>>k;
	vector<int> v;
	for(int i=0,x;i<n;++i)
		cin>>x,v.push_back(x);
	sort(v.begin(),v.end());
	int ans = 0;
	for(int i=0;i<k;++i)
		ans += v[i]	;
	cout<<ans;
	return 0;
}

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

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
    // 入力
    int N,A,B;
    cin >> N >> A >> B;
    int sum = 0;

    for (int i = 1; i <= N; i++){
      int n = findSumOfDigits(i);
      if(n >= A && n <=B){
        sum += i;
      }
    }

    cout << sum << endl;

    }


Measured memory_bytes: 3152
a, b, k = map(int,raw_input().split())
if (b - a + 1) / 2 >= k:
    for i in range(a, a + k):
        print i
    for i in range(b - k + 1, b + 1):
        print i
else:
    for i in range(a, b + 1):
        print i

Measured memory_bytes: 2568
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
int h[100];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> h[i];
	}
	int ans = 0;
	while (1) {
		int pos = -1;
		for (int i = 0; i < N; i++) {
			if (h[i] > 0) {
				pos = i;
				break;
			}
		}
		if (pos == -1) break;
		for (int i = 0; pos + i < N; i++) {
			if (h[pos + i] == 0) break;
			h[pos + i]--;
		}
		ans++;
	}
	cout << ans << endl;
}

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

int main(){
 string s1, s2;
 cin >> s1 >> s2;
 if (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0]){
  cout << "YES" << endl;
 }else{
  cout << "NO" << endl;
 }
 return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	int sum = 0;
	for (int i = 0; i < N; ++i) {
		sum += A[i] - 1;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,i,b;
    cin>>a>>b;
    if(a==b)
       {for(i=1;i<=a;i++)
        printf("%d",a);}
    else if(a<b)
    {for(i=1;i<=b;i++)
        printf("%d",a);}
        else if (b<a)
        {
            for(i=1;i<=a;i++)
                printf("%d",b);
        }

}


Measured memory_bytes: 256
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

a = []
for _ in range(5):
    a.append(ni())
k = ni()

print("Yay!" if a[-1] - a[0] <= k else ":(")

Measured memory_bytes: 3064
#include <iostream>

using namespace std;


int main(void){
  int T_HP, T_ATK, A_HP,A_ATK;
  cin >> T_HP >> T_ATK >> A_HP >> A_ATK;

  int A_down = A_HP/T_ATK + ((A_HP%T_ATK == 0)?(0):(1));
  int T_down = T_HP/A_ATK + ((T_HP%A_ATK == 0)?(0):(1));

  if(T_down >= A_down){
    cout << "Yes" << endl;
  }else {
      cout << "No" << endl;
  }

  return 0;
}




Measured memory_bytes: 3084
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, A, B = map(int, readline().split())
A = A - B
H = np.array([int(readline()) for _ in range(N)], dtype=np.int64)


def C(T):
    h = H-B*T
    h = h[h > 0]
    bomb = (h + A - 1) // A
    return bomb.sum() <= T


left = 0
right = 10 ** 18
while right - left > 1:
    mid = (right + left) // 2
    if C(mid):
        right = mid
    else:
        left = mid

ans = right
print(ans)


Measured memory_bytes: 17864
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int K; cin >> K;
    int n = S.length();
    rep(i, n - 1) {
        if(S[i] == 'a') continue;
        int k = 'z' - S[i] + 1;
        if(k <= K) {S[i] = 'a'; K -= k;}
    }
    int c = S[n - 1] - 'a';
    c = (c + K) % 26;
    S[n - 1] = c + 'a';
    cout << S << endl;


    return 0;
}


Measured memory_bytes: 592
a=[True]*(10**5+1)
for i in range(2,int(10**2.5)+1):
    if a[i]:
        for j in range(i+i,10**5+1,i):
            a[j]=False
s=[0]*(10**5+1)
c=0
for i in range(3,10**5+1):
    if a[i] and a[(i+1)//2]:
        c+=1
    s[i]=c
for i in range(int(input())):
    l,r=map(int,input().split())
    print(s[r]-s[l-1])

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

#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

const int mod = 1000000007;
struct mint
{
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const
    {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const
    {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const
    {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const
    {
        return pow(mod - 2);
    }
    mint &operator/=(const mint a)
    {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const
    {
        mint res(*this);
        return res /= a;
    }
};

struct combination
{
    vector<mint> fact, ifact;
    combination(int n) : fact(n + 1), ifact(n + 1)
    {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i)
            fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i)
            ifact[i - 1] = ifact[i] * i;
    }
    mint operator()(int n, int k)
    {
        if (k < 0 || k > n)
            return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(15);

    mint x, y;
    cin >> x.x >> y.x;
    if (x.x < y.x)
        swap(x, y);
    if (x.x > 2 * y.x || (x + y).x % 3 != 0)
    {
        cout << 0 << endl;
        return 0;
    }
    mint s = (x + y) / 3;
    mint t = x - y;
    mint k = (s - t) / 2;

    combination cm(s.x);

    mint ans = cm(s.x, k.x);
    cout << ans.x << endl;

    return 0;
}

Measured memory_bytes: 10624
#include <cstdio>
typedef long long ll;
const ll p = 1000000007;
ll f[1000005][2][2];

int main()
{
	int n;
	scanf("%d", &n);
	f[1][0][0] = 8, f[1][0][1] = f[1][1][0] = 1, f[1][1][1] = 0;
	for (int i = 2; i <= n; i++)
	{
		f[i][0][0] = f[i-1][0][0]*8%p;
		f[i][1][0] = (f[i-1][0][0]+f[i-1][1][0]*9)%p;
		f[i][0][1] = (f[i-1][0][0]+f[i-1][0][1]*9)%p;
		f[i][1][1] = (f[i-1][1][0]+f[i-1][0][1]+f[i-1][1][1]*10)%p;
	}
	printf("%lld\n", f[n][1][1]%p);
}


Measured memory_bytes: 32956
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc149/abc149_a.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  string s, t;
  cin >> s >> t;

  cout << t << s << endl;
}

Measured memory_bytes: 256
# coding: utf-8
from math import ceil
def prime_factorization(N):
    # 辞書型で素因数分解を返す
    pf = {}
    for i in range(2, int(N**0.5) + 1):
        while N % i == 0:
            if i not in pf.keys():
                pf[i] = 1
            else:
                pf[i] += 1
            N //= i
    if N > 1:
        pf[N] = 1
    return pf
N = int(input())
# N = 2**8
pf = prime_factorization(N)
# print(pf)
ans = 0
for k in pf.keys():
    idx = 1
    v = 0
    while pf[k] >= v + idx:
        ans += 1
        v += idx
        idx += 1
print(ans)

Measured memory_bytes: 63600
#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>
#include<numeric>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const ll INF = 1e18+1;


/*
組み合わせ直接計算は無理なので意地でもするな

ncr = (n-1)c(r) + (n-1)c(r-1)
また、nを固定したときncrは、rがnの半分までなら増加する


より、ncr > (n-1)c(r)

あるajを固定したとして、comb(ai,aj)はaiが最大の時最大
あるaiを固定したとして、comb(ai,aj)はaj=ai/2に最も近い時最大


ajを除いたaiの最大値は累積最大値配列の保持によって求められる

nの線形


各aiについて、ai/2に最も近いajを二部探索で探し、

ncrとmckについて


*/


int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    /*
    vector<ll> S(n+2,0),T(n+2,0);
    for (int i = 1; i <= n; i++) {
        S[i] = max(S[i-1],a[i-1]);
    }
    for (int i = n; i >= 1; i--) {
        T[i] = max(T[i+1],a[i-1]);
    }*/

    ll M = 0, idx = -1;
    for (int i = 0; i < n; i++) {
        if (a[i] > M) {
            idx = i; M = a[i];
        }
    }
    a.erase(a.begin()+idx);
    sort(a.begin(),a.end());

    auto itr = lower_bound(a.begin(),a.end(),M/2);
    auto itr2 = a.begin();
    if (itr != a.begin()) itr2 = itr-1;

    if (abs(*itr-M/2) <= abs(*itr2-M/2)) {
        cout << M << " " << *itr << endl;
    } else {
        cout << M << " " << *itr2 << endl;
    }







}



Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication13
{

    //ONLINE JUDGE (ITP1_8_C)

    class Program
    {
        static void Main(string[] args)
        {

            string alphabet = "abcdefghijklmnopqrstuvwxyz";
            int[] countAlphabet = new int[alphabet.Length];

            while (true)
            {
                string str = Console.ReadLine();

                if (str == null || str.Length == 0)
                {
                    break;
                }

                string st = str.ToLower();
                    
                    for (int j = 0; j < st.Length; ++j)
                    {
                        int index = alphabet.IndexOf(st[j]);
                        
                        if (index == -1)
                        {
                            continue;
                        }
                        ++countAlphabet[index];
                       
                    }            
                
            }
            for (int i = 0; i < countAlphabet.Length; ++i)
            {
                Console.WriteLine("{0} : {1}", alphabet[i], countAlphabet[i]);
            } 
        }
    }
}

Measured memory_bytes: 5636
#include <bits/stdc++.h>
using namespace std;
#define N_PRIME 1000000007
#define ll int64_t

void solve(){
    string s;
    getline(cin,s);
    if( s==".")exit(0);
    stack<int> t;
    
    
    for(int i = 0 ; i < s.size() ; i++ ){
        if( s[i] == '(' ){
            t.push(0);
        }else if( s[i] == '[' ){
            t.push(1);
        }else if( s[i] == ')' ){
            if( t.size() == 0 || t.top() != 0 ){
                cout << "no" << endl;
                return ;
            }else{
                t.pop();
            }
        }else if( s[i] == ']' ){
            if( t.size() == 0 || t.top() != 1 ){
                cout << "no" << endl;
                return ;
            }else{
                t.pop();
            }
        }
    }
    
    if( t.size() > 0 ){
        cout << "no" << endl;
    }else{
        cout << "yes"<<endl;
    }
    return ;
}
int main(void){
    while(true)solve();
    return 0;
}

Measured memory_bytes: 3208
from sys import stdin
import math
input = stdin.readline


def solve():
    N = int(input().rstrip())
    vec =list(map(int, input().split())) 
    ANS = 0
    for v in vec:
        while v%2 == 0:
            v /=2;
            ANS += 1;

    print(ANS)
    

if __name__ == '__main__':
    solve()


Measured memory_bytes: 40432
/*
   ~~~~~~~~~~~~~~~~~~~
   \  |\/| | |\ | |  /
   /  |  | | |/ |_|  \
   ~~~~~~~~~~~~~~~~~~~
*/
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string.h>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<iterator>
#define pf push_front
#define lb lower_bound
#define up upper_bound
#define mp make_pair
#define sp setprecision
#define ll long long
using namespace std;
int main()
{	
	ll x,y;
	cin>>x>>y;
	if(y>4*x || y<2*x || y%2!=0) cout<<"No\n";
	else {
		y=y-2*x;
		ll k=0;
		while(y>0){
			if(y==1) {k=1;break;}
			y=y-2;
		}
		if(k==1) cout<<"No\n";
		else cout<<"Yes\n";
	}
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <tuple>
#include <bitset>
#include <random>
#define REP(i,n) for(int i=0;i<n;i++)
#define INF 100000000000007
using namespace std;
using pii=pair<int,int>;

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int sum=0;
    REP(i,n){
        cin>>a.at(i);
        sum=sum^a.at(i);
    }
    REP(i,n){
        int ans=sum^a.at(i);
        cout<<ans;
        if(i<n-1){
            cout<<' ';
        }
    }


    return 0;
}

Measured memory_bytes: 3548
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('- {} -> {}'.format(name, val), file=sys.stderr)
            return None

def main(N, H):
    """
    一番右の数字は低くする義理がない
    逆から見る？
    """
    for hidx in range(N):
        if hidx == 0:
            continue
        
        if H[N-1-hidx] > H[N-1-hidx+1]:
            H[N-1-hidx] -= 1
            if H[N-1-hidx] > H[N-1-hidx+1]:
                return 'No'
    else:
        for hidx in range(N-1):
            if H[hidx] > H[hidx+1]:
                return 'No'
        else:
            return 'Yes'



    #  for hidx in range(N-1):
    #      #  print(H)
    #      if H[hidx] > H[hidx+1]:
    #          # 左のもののほうが高い場合
    #          H[hidx] -= 1
    #          if H[hidx] > H[hidx+1]:
    #              # それでもまだ高い場合
    #              return 'No'
    #  else:
    #      for hidx in range(N-1):
    #          if H[hidx] > H[hidx+1]:
    #              return 'No'
    #      else:
    #          return 'Yes'


if __name__ == '__main__':
    if 'LOCAL' in os.environ:
        # ローカル実行時のみ通る処理
        # テストしたい入力を入れておく
        input_values = [
                """
                """.strip(),
                """
                """.strip()
                ]
        for input_value in input_values:
            input_value = input_value.split('\n')
            #  N = int(input_value[0])
            #  A = list(map(int, input_value[1].split()))
            ans = main(N, A)
            expected_value = int(input_value[2])
            assert ans == expected_value, 'failed: ans: {ans}, exp: {exp}'.format(ans=ans, exp=expected_value)
    else:
        N = _I()
        H = LI()
        print(main(N, H))




Measured memory_bytes: 85740
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

template <typename T>
void print(const vector<T> &v) {
    for (auto e : v) cout << e << ' ';
    cout << endl;
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int N, T, A; cin >> N >> T >> A;

    int ans = 0;
    double d = 1000;
    for (int i = 1; i <= N; i++) {
        int h; cin >> h;
        double t = T - 0.006 * h;
        if (abs(t - A) < d) {
            ans = i;
            d = abs(t - A);
        }
    }

    cout << ans << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3632
#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;

struct Flow {
    explicit Flow(int n) {
        mVertices.resize(n);
        mDir.assign(n, 0);
        mIter.assign(n, 0);
    }

    void addEdge(int from, int to, long long int cap) {
        mVertices[from].edge.emplace_back(Edge{to, cap, static_cast<int>(mVertices[to].edge.size())});
        mVertices[to].edge.emplace_back(Edge{from, 0, static_cast<int>(mVertices[from].edge.size())});
    }

    long long int maxFlow(int s, int t) {
        long long int retValue = 0;
        while (true) {
            bfs(s);
            if (mDir[t] == MAX_VALUE)
                break;
            fill(mIter.begin(), mIter.end(), 0);
            long long int flow = 0;
            while ((flow = dfs(s, t, INF_VALUE)) > 0)
                retValue += flow;
        }
        return retValue;
    }

    void bfs(int s) {
        fill(mDir.begin(), mDir.end(), MAX_VALUE);
        queue<int> q;
        q.push(s);
        mDir[s] = 0;
        while (!q.empty()) {
            int t = q.front();
            q.pop();
            int cost = mDir[t] + 1;
            for (const auto &e:mVertices[t].edge) {
                if (mDir[e.to] <= cost || e.capacity <= 0)
                    continue;
                mDir[e.to] = cost;
                q.push(e.to);
            }
        }
    }

    long long int dfs(int s, int t, long long int f) {
        if (s == t)
            return f;
        for (int &i = mIter[s]; i < mVertices[s].edge.size(); ++i) {
            Edge &e = mVertices[s].edge[i];
            if (e.capacity <= 0 || mDir[s] >= mDir[e.to])
                continue;
            long long int d = dfs(e.to, t, std::min(f, e.capacity));
            if (d > 0) {
                e.capacity -= d;
                mVertices[e.to].edge[e.rev].capacity += d;
                return d;
            }
        }
        return 0;
    }

    struct Edge {
        int to;
        long long int capacity;
        int rev;
    };
    struct Vertex {
        vector<Edge> edge;
    };
    vector<Vertex> mVertices;
    vector<int> mDir;
    vector<int> mIter;

    const int MAX_VALUE = 1e9;
    long long int INF_VALUE = (long long int) 1e15;
};

pll A[105], B[105];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> A[i].first >> A[i].second;
    }
    REP(i, N) {
        cin >> B[i].first >> B[i].second;
    }
    Flow flow(2 * N + 2);
    REP(i, N) {
        REP(j, N) {
            if (A[i].first < B[j].first && A[i].second < B[j].second)
                flow.addEdge(i + 1, N + 1 + j, 1);
        }
    }
    REP(i, N) {
        flow.addEdge(0, i + 1, 1);
        flow.addEdge(N + 1 + i, 2 * N + 1, 1);
    }

    cout << flow.maxFlow(0, 2 * N + 1) << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
   public static void main(String[] args){
     Scanner scanner = new Scanner(System.in);
     int a = scanner.nextInt();
     int b = scanner.nextInt();
     if (a <b){
        System.out.println("a < b");
      }

      if (a>b){
        System.out.println("a > b");
      }
      if (a== b){
        System.out.println("a == b");
      }  
   }   
}

Measured memory_bytes: 26080
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=join(sort(collect(chomp(readline()))))
    l=length(s)
    ans="yes"
    for i in 2:l
        if s[i]==s[i-1]
            ans="no"
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 172020
#include <iostream>
#include <cstring>
#include <cstdio>

#define M 1046527
#define L 14
#define ll long long


using namespace std;

char H[M][L];

int getChar(char ch) {
    if (ch == 'A') return 1;
    else if (ch == 'C') return 2;
    else if (ch == 'G') return 3;
    else if (ch == 'T') return 4;
    else return 0;
}

long long getKey(char str[]) {
    ll sum = 0;
    ll p = 1;
    for (ll i = 0; i < strlen(str); ++i) {
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key) {
    return key % M;
}

int h2(int key) {
    return 1 + (key % (M - 1));
}

int find(char str[]) {
    ll key, h;
    key = getKey(str);
    for (ll i = 0;; ++i) {
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0) return 0;
    }
    return 0;
}

int insert(char str[]) {
    ll key;
    ll h;
    key = getKey(str);
    for (ll i = 0;; ++i) {
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0) {
            strcpy(H[h], str);
            return 0;
        }
    }
    return 0;
}

int main() {
    int n, h;
    char str[L], com[9];
    for (int i = 0; i < M; ++i) H[i][0] = '\0';
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%s %s", com, str);

        if (com[0] == 'i') insert(str);
        else {
            if (find(str)) printf("yes\n");
            else printf("no\n");
        }
    }
    return 0;
}



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

int main(void){
    // Your code here!
    vector<int> a;
    int mi = 10;
    int ind;
    int su=0;
    int la;
    for(int i=0;i<5;i++){
        int n;
        cin >> n;
        if(n%10==0){
            a.push_back(n);
        }else{
            if(mi>n%10){
            mi = n%10;
            ind = i;
            la = n;
            }
            a.push_back((n/10+1)*10);
        }
    }
    for(int i=0;i<5;i++){
        if(i==ind){
            su += la;
        }else{
            su+=a[i];
        }
    }
    cout << su << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 3e5 + 9, M = 5e3 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const ll inf = 1e18;


int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  priority_queue<ll> q;
  ll n, m, a;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    q.push(a);
  }
  while(m--) {
    ll it = q.top();
    q.pop();
    it /= 2;
    q.push(it);
  }
  ll ans = 0;
  while(!q.empty()) {
    ans += q.top();
    q.pop();
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 1400
#include<iostream>
#include<numeric>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main(){ 
	int a,b,c; 
	cin>>a>>b>>c;
	if(c>=a&&b>=c){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type Entry struct{ key, value int }
type List []Entry

func (l List) Len() int           { return len(l) }
func (l List) Swap(i, j int)      { l[i], l[j] = l[j], l[i] }
func (l List) Less(i, j int) bool { return l[i].value > l[j].value }

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

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	om := make(map[int]int)
	em := make(map[int]int)
	var x int
	for i := 0; i < n/2; i++ {
		sc.Scan()
		x, _ = strconv.Atoi(sc.Text())
		om[x]++
		sc.Scan()
		x, _ = strconv.Atoi(sc.Text())
		em[x]++
	}

	var ol List = make([]Entry, len(om))
	index := 0
	for k, v := range om {
		ol[index].key, ol[index].value = k, v
		index++
	}
	sort.Sort(ol)

	var el List = make([]Entry, len(em))
	index = 0
	for k, v := range em {
		el[index].key, el[index].value = k, v
		index++
	}
	sort.Sort(el)

	if ol[0].key != el[0].key {
		fmt.Println(n - ol[0].value - el[0].value)
		return
	}

	if len(ol) == 1 {
		ol = append(ol, Entry{-1, 0})
	}
	if len(el) == 1 {
		el = append(el, Entry{-1, 0})
	}
	if v1, v2 := n-ol[0].value-el[1].value, n-ol[1].value-el[0].value; v1 < v2 {
		fmt.Println(v1)
	} else {
		fmt.Println(v2)
	}
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
bool is_prime(int x){
	if(x <= 1) return false;
	for(int i = 2; i * i <= x; i++) if(x % i == 0) return false;
	return true;
}
int gcd(int a, int b){
	while(b){
		a %= b;
		swap(a, b);
	}
	return a;
}
int main(){
	int n; cin >> n;
	vector<int> a(n + 1);
	for(int i = n; i >= 0; i--) cin >> a[i];
	vector<int> chk;
	for(int i = 2; i <= n; i++) if(is_prime(i)) chk.push_back(i);
	int G = 0;
	for(int i = n; i >= 0; i--) if(abs(a[i])) G = gcd(abs(a[i]), G);
	for(int i = 1; i*i <= G; i++){
		if(G % i == 0){
			if(is_prime(i)) chk.push_back(i);
			if(is_prime(G/i) && i != G/i) chk.push_back(G/i);
		}
	}
	sort(chk.begin(), chk.end());
	chk.erase(unique(chk.begin(), chk.end()), chk.end());
	for(int ch : chk){
		if(ch > n){
			int i;
			for(i = n; i >= 0; i--) if(a[i] % ch) break;	
			if(i == -1) cout << ch << endl;
		} else {
			vector<int> b = a; int len = n;
			for(int i = len; i >= 0; i--){
				b[i] %= ch;
				b[i] += ch;
				b[i] %= ch;
			}
			while(len >= ch){
				if(b[len] == 0){
					len--;
					continue;
				}
				b[len - ch + 1] += b[len];
				b[len - ch + 1] %= ch;
				len--;
			}
			for(; len >= 0; len--) if(b[len] % ch) break;
			if(len == -1) cout << ch << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 384
import sys
import heapq
import math


def input():
    return sys.stdin.readline().rstrip()


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

    l = "A"
    s = set()

    for i in range(N):

        w = input()
        if w[0] != l and i!=0:
            print("No")
            exit()
        if w in s:
            print("No")
            exit()
        l = w[-1]
        s.add(w)

    print("Yes")


if __name__ == "__main__":
    main()


Measured memory_bytes: 9200
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int A, B, K;
    cin >> A >> B >> K;
    if (B - A + 1 < 2 * K)
    {
        for (int i = A; i <= B; i++)
        {
            cout << i << endl;
        }
    }
    else
    {
        for (int i = A; i < A + K; i++)
        {
            cout << i << endl;
        }
        for (int i = B - K + 1; i <= B; i++)
        {
            cout << i << endl;
        }
    }
}

Measured memory_bytes: 256