akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5;

template<class T> bool ckmin(T& a, const T& b) {
    return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; }

mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template <typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template <typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template <class X, class Y>
std::ostream & operator << (std::ostream & os, std::pair <X, Y> const& p) {
    return os << p.first << " " << p.second;
}

template <class Ch, class Tr, class Container>
std::basic_ostream <Ch, Tr> & operator << (std::basic_ostream <Ch, Tr>& os, Container const& x) {
    bool first = true;
    for(auto& y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class ASimpleCalculator {
public:
	void solve(std::istream& in, std::ostream& out) {
        int x, y;
        in >> x >> y;
        int res = INT_MAX;
        FOR(i, 0, 2) {
            FOR(j, 0, 2) {
                int x2 = x * (i ? -1 : 1), y2 = y * (j ? -1 : 1);
                if (x2 <= y2) {
                    ckmin(res, y2 - x2 + i + j);
                }
            }
        }
        out << res << '\n';
	}

	void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
	ASimpleCalculator solver;
    solver.setup();
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3576
// 入力マクロ
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
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)*}
    };
}
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, 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")
    };
}


use std::cmp::{min, max};
fn main () {
    input! {
        h: usize, w: usize,
        board: [chars; h]
    }

    let mut dp = vec![vec![0; w]; h];
    dp[0][0] = if board[0][0] == '#' { 1 } else { 0 };
    for i in 1..h {
        dp[i][0] = dp[i-1][0] + if board[i][0] != board[i-1][0] { 1 } else { 0 };
    }
    for j in 1..w {
        dp[0][j] = dp[0][j-1] + if board[0][j] != board[0][j-1] { 1 } else { 0 };
    }

    for sum in 1..(h+w-1) {
        for i in 1..sum {
            let j = sum - i;
            if i >= h || j >= w { continue; }
            dp[i][j] = checked(&dp, &board, i, j);
        }
    }

    let ans = dp[h-1][w-1];
    println!("{}", if ans % 2 == 0 { ans / 2 } else { ans / 2 + 1 });
}

fn checked(d: &[Vec<usize>], b: &[Vec<char>], i: usize, j: usize) -> usize {
    min(d[i][j-1] + if b[i][j-1] == b[i][j] { 0 } else { 1 }, d[i-1][j] + if b[i-1][j] == b[i][j] { 0 } else { 1 })
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
  }
  int top() {
    return s[0];
  }
};
int main(){
  Dice d;
  for(int i=0;i<6;i++) cin >> d.s[i];
  string s;cin >> s;
  for(int i=0;i<s.size();i++) d.roll(s[i]);
  cout << d.top() << endl;
  return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int n;
    cin >> n;
    vector<pii> v(n);
    rep(i, n) {
        cin >> v[i].fi;
        v[i].se = i;
    }
    sort(all(v));
    vector<int> ans(n);
    rep(i, n) {
        if(i < n/2) {
            ans[v[i].se] =  v[n/2].fi;
        }
        else {
            ans[v[i].se] =  v[n/2-1].fi;
        }
    }
    rep(i, n) cout << ans[i] << endl;
    return 0;
}

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

int main(){
    int S;
    int h, m, s;
    cin >> S;
    h = S / 3600;
    m = (S - h * 3600) / 60;
    s = (S - h * 3600) % 60;
    cout << h << ':' << m << ':' << s << endl;
    return 0;
}


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

int main(){
    int n;
    int T_point=0;
    int H_point=0;

    string T_card,H_card;
    
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>T_card>>H_card;
        if(T_card==H_card){
            T_point +=1;
            H_point +=1;
        }else if(T_card<H_card){
            H_point +=3;
        }else{
            T_point +=3;
        }
    }
    cout<<T_point<<' '<<H_point<<'\n';
}


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

#define FOR(i, s, e) for (int (i) = (s); (i) < (e); (i)++)

int main() {
    int A, B; cin >> A >> B;
    int sum = 0;
    if(A > B+ 1) {
        sum = A + A - 1;
    }
    if(A == B + 1) {
        sum =A + B;
    }
    if(A == B) {
        sum =2 * A ;
    }
    if(B==A + 1) {
        sum = B+A;
    }
    if(B>A+1) {
        sum = B + B -1;
    }

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

}

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

int main()
{
    vector<int> v(5);
    rep (i, 5)
        cin >> v[i];

    int ans = 644;
    do
    {
        int sum = 0;
        rep (i, 4)
        {
            if (v[i] % 10)
                sum += (v[i] + 10) - (v[i] % 10);
            else
                sum += v[i];
        }
        ans = min(sum + v[4], ans);
    } while (next_permutation(v.begin(), v.end()));

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

Measured memory_bytes: 256
import java.util.*;
 
class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    String n = (String)sc.nextLine();
    
    int sum = 0;
    for(int i = 0; i < n.length();i++){
      sum += Character.getNumericValue(n.charAt(i));
    }

    if(sum % 9 == 0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 41224
import Data.List
import Data.Ord

main = print . solve . tuplify . map read . drop 1 . words =<< getContents

tuplify [] = []
tuplify (x:y:xs) = (x,y):tuplify xs

solve :: [(Int,Int)] -> Int
solve = (\(f,s) -> f+s) . maximumBy (comparing fst)


Measured memory_bytes: 73340
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end
@r = 10**9+7
n = inp[0]
a = inp
ans = 1
dp = na(3,0)
a.each do |d|
  f = false
  ans *= dp.count(d)
  ans %= @r
  id = dp.index(d)
  unless(id )
    p 0
    exit
  end
  dp[id]+=1
end
p ans

Measured memory_bytes: 9260
n = int(input())
A = []
proofs = []
for i in range(n):
    A.append(int(input()))
    proof = [tuple(map(int, input().split())) for _ in range(A[i])]
    proofs.append(proof)

def check_amb(true_men, proofs):
    for true_man in true_men:
        proof = proofs[true_man]
        for x, y in proof:
            if (x-1 in true_men) and (y == 0):
                return True
            if (x-1 not in true_men) and (y == 1):
                return True
    return False


max_pat = 0
for i in range(1 << n):
    true_men = []
    for j in range(n):
        if ((i >> j) & 1) == 1:
            true_men.append(j)
    is_amb = check_amb(true_men, proofs)
    if is_amb is False:
        max_pat = max(len(true_men), max_pat)

print(max_pat)






Measured memory_bytes: 3064
use std::collections::*;

#[allow(dead_code)]
fn read_line(n: usize) -> String {
    let mut ss = String::new();
    for _i in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        ss.push_str(&s);
    }
    ss
}

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

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn calc(n: i32, cur: i32, s: i32, sum: i32, used: &mut BTreeSet<i32>, useds: &mut BTreeSet<BTreeSet<i32>>) {
    if s < sum {
        return;
    }
    if n == cur {
        if s == sum {
            useds.insert(used.clone());
        }
        return;
    }
    for i in cur..10 {
        if used.get(&i).is_some() {
            continue;
        }
        let mut new_used = used.clone();
        new_used.insert(i);
        calc(n, cur + 1, s, sum + i, &mut new_used, useds);
    }
}

fn sub() -> bool {
    parse!{
        read_line(1) =>
        n: i32,
        s: i32,
    }
    if n == 0 && s == 0 {
        return false;
    }
    let mut used = BTreeSet::new();
    let mut useds = BTreeSet::new();
    calc(n, 0, s, 0, &mut used, &mut useds);
    println!("{}", useds.len());
    return true;
}

fn main()
{
    while sub() {
    }
}


Measured memory_bytes: 5060
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void)
{
	int A[100], N;
	int i = 0, j = 0, v = 0;
	cin >> N;
	for (i = 0; i < N; i++) { cin >> A[i]; }
	for (i = 0; i < N; i++) {
		v = A[i];
		j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		for (j = 0; j < N; j++) {
			if (j != 0) { printf(" "); }
			cout << A[j];
			if(j == N - 1) { printf("\n"); }
		}
	}
}

Measured memory_bytes: 1164
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    ll n = 100;
    ll x;
    cin >> x;
    ll ans = 0;
    while(n < x){
        n = n / 100 * 101 + (n % 100) * 101 / 100;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T>
using vec = vector<T>;

#define FOR(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()

int main(){
  int n,m;
  cin >>n >>m;
  vec<int> a(m),b(m);
  REP(i,m) cin >>a[i] >>b[i];

  vec<int> ac(n+1,0),bc(n+1,0);
  REP(i,m){
    ++ac[a[i]];
    ++bc[b[i]];
  }

  FOR(i,1,n+1){
    cout <<ac[i]+bc[i] <<endl;
  }
}


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


int main() {
	
	int n;
	cin >> n;
	multiset<string>a;
	set<string>b;
	for(int i=0; i<n; i++){
		string c;
		cin >> c;
		a.insert(c);
		b.insert(c);
	}
	int s = b.size();
	vector<pair<int,string>> p(s);
	
	int j=0;
	for(auto i : b){
		p.at(j).first = a.count(i);
		p.at(j).second = i;
		j++;
	}
	sort(p.begin(), p.end());
	reverse(p.begin(), p.end());
	
	j=0;
	for(int i=0; i<s; i++){
		if(p.at(i).first==p.at(0).first){
			j++;
		}
		else break;
	}
	for (int i=j-1; i>=0; i--){
		cout << p.at(i).second << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 35004
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc  = new Scanner(System.in);
    int r = sc.nextInt();
    int g = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    while(g<=r && k>0){
      g=g*2;
      k--;
    }
    while(k>0 && b<=g){
      b=b*2;
      k--;
    }
   // System.out.println(g);
   // System.out.println(b);
    if(g<=r || b<=g){
      System.out.println("No");
    }
    else{
      System.out.println("Yes");
    }
  }
}

Measured memory_bytes: 35616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,m;
	cin>>n>>m;
	int s[6];
	int c[6];
	int s1[6];
	int num[5];
	memset(num,-1,sizeof(num));
	for(int i=1;i<=m;i++)
	{
		cin>>s[i]>>c[i];
		s1[i]=s[i];
	}
	int f=0;//标记 
	if(n>=2)
	{
		for(int i=1;i<=m;i++)
	{
		if(s[i]==1&&c[i]==0)
		f=1;
	}//前导0不行 
	 }
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(s[i]==s[j])
			{
				if(c[i]!=c[j])
				f=1;
			}
		}
	}//对同一个位置赋两个不同的值不行 
	if(f==1)
	{
		cout<<-1<<endl;//不行 
	}
	else//否则 
	{
		for(int i=1;i<=m;i++)
		{
			num[s1[i]]=c[i];//将num的第s个位置赋为c 
		}
		for(int i=1;i<=n;i++)
		{
			if(num[i]==-1)
			{
				if(i!=1||n==1)
				{
					num[i]=0;
				}
				else
				{
					num[i]=1;
				}
			}
		}
		for(int i=1;i<=n;i++)
		{
			printf("%d",num[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 256
n,m = gets.chomp.split(" ").map(&:to_i)
edge = m.times.map{gets.chomp.split(" ").map(&:to_i)}
score = Array.new(n,-10**12)
score[0] = 0

n.times do |e|
	edge.each do |i, j, k|
		if score[i-1] + k > score[j-1]
			score[j-1] = score[i-1] + k
			if e == n-1 && j == n
				puts "inf"
				exit
			end
		end
	end
end
puts score[-1]

Measured memory_bytes: 2172
#include <iostream>
using namespace std;
int main() {
  int n,m,a[19],b[19],ok,sum,c;
  ok=0;
  cin>>n>>m>>c;
 for(int i=0;i<m;i++){
    cin>>b[i];
  }
  for(int j=0;j<n;j++){
  sum=0;
    for(int i=0;i<m;i++){
      cin>>a[i];
      a[i]=a[i]*b[i];
      sum+=a[i];
    }
    sum=sum+c;
    if(sum>0) ok++;
  }
  cout<<ok<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 2005
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

int pow10[200005];

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

    string str;

    cin>>str;

    vector<int> cnt(2020, 0);
    int n = str.size();
    cnt[0] = 1;


    pow10[0] = 1;
    for(int i = 1; i <= n; i++) {
        pow10[i] = (pow10[i-1] * 10) % 2019;
    }
    
    int ans = 0, rem = 0;
    for(int i = 0; i < n; i++) {
        rem = (rem * 10 + (str[i]-'0')) % 2019;
        int temp = (rem * pow10[n-i-1]) % 2019;
        ans += cnt[temp];
        cnt[temp]++;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 4528
S = list(input())
S1 = int(S[0] + S[1])
S2 = int(S[2] + S[3])
if 0 < S1 < 13:
    if 0 < S2 < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < S2 < 13:
        print("YYMM")
    else:
        print("NA")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
string s;
int main(){
  
  ll i,j,k,n,m,t;
  cin>>n;
  vector<string>v;
  for(i=0;i<n;i++){
    cin>>s;
    sort(s.begin(),s.end());
    v.push_back(s);
  }
  sort(v.begin(),v.end());
  ll ans=0, cid=0;
  for(i=1;i<n;i++){
    if(v[i]==v[i-1]){
      ans+=(i-cid); 
    }
    else {
      cid=i; 
    }
  }
  cout<<ans<<"\n";
}

Measured memory_bytes: 5748
# Q2
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
from functools import lru_cache

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = S()
total = 0
for c in N:
    total += int(c)

if total % 9 == 0:
    print("Yes")
else:
    print("No")

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

ll N;
vector<ll> A;
vector<vector<ll>> dp;

ll f(ll l, ll r, bool taro) {
    if (dp[l][r] != INF) {
        return dp[l][r];
    }
    if (abs(l - r) == 0) {
        return dp[l][r] =  0;
    } else if (abs(l - r) == 1) {
        if (taro) {
            return dp[l][r] =  A[l];
        } else {
            return dp[l][r] =  -A[l];
        }
    }
    ll res = 0;
    if (taro) {
        res = max(f(l + 1, r, false) + A[l], f(l, r - 1, false) + A[r - 1]);
    } else {
        res = min(f(l + 1, r, true) - A[l], f(l, r - 1, true) - A[r - 1]);
    }
    return dp[l][r] = res;
}

void solve() {
    cin >> N;
    A.resize(N);
    rep(i, N) cin >> A[i];
    dp.assign(N, vector<ll>(N + 1, INF));
    cout << f(0, N, true) << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 73916
import java.util.*;
public class Main {
	public static void main(String[] args)  {
		Scanner scan =new Scanner(System.in);
		int t,old_t=0,x,y,old_x=0,old_y=0;
		int n=Integer.parseInt(scan.nextLine());
		boolean ans =true;
		int d,tmp;
		for (int i = 0;i < n; ++i){
			t=Integer.parseInt(scan.next());
			x=Integer.parseInt(scan.next());
			y=Integer.parseInt(scan.next());scan.nextLine();
			d=Math.abs(x-old_x)+Math.abs(y-old_y);
			old_x=x;old_y=y;
			tmp=t;
			t=Math.abs(old_t-t);
			old_t=tmp;
			if (t>=d){
				if (!((t-d)%2==0)){
					ans=false;
				}
			}else{
				ans = false;
			}

		}

		System.out.print(ans?"Yes":"No");

	}
}
//end


Measured memory_bytes: 144820
import sys
import math

a, b, c, x, y = map(int, input().split())

# kingaku = 0
# for i in range(x+1):
#     for j in range(y+1):
#         maisu = []
#         maisu = [x-i, y-j]
#         ab_maisu = max(maisu) * 2
        
#         if i==0 and j==0:
#             kingaku = (a*i) + (b*j) + (c*ab_maisu)
#         else:
#             if kingaku > (a*i) + (b*j) + (c*ab_maisu):
#                 kingaku = (a*i) + (b*j) + (c*ab_maisu)

# print("{}".format(kingaku))

ab_maisu = 0
if x >= y:
    ab_maisu = x * 2
else:
    ab_maisu = y * 2

kingaku = 0
for i in range(0, ab_maisu+2, 2):
    a_maisu = x - (math.ceil(i/2))
    b_maisu = y - (math.ceil(i/2))

    if a_maisu < 0:
        a_maisu = 0
    if b_maisu < 0:
        b_maisu = 0

    if i == 0:
        kingaku = (a*a_maisu) + (b*b_maisu) + (c*i)
    else:
        if kingaku > (a*a_maisu) + (b*b_maisu) + (c*i):
            kingaku = (a*a_maisu) + (b*b_maisu) + (c*i)

print("{}".format(kingaku))      


Measured memory_bytes: 3064
s = list(input())
odd_s = ["R", "U", "D"]
even_s = ["L", "U", "D"]

ans = "Yes"

for i in range(len(s)):
  if i % 2 == 0:
    if s[i] not in odd_s:
      ans = "No"
  
  if i % 2 == 1:
    if s[i] not in even_s:
      ans = "No"

print(ans)
   

Measured memory_bytes: 38384
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<ll, int> mp;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	vector<int> d(10);
	for (int i = 1; i <= 4; i++) d[i] = 0;
	for (int i = 0; i < 6; i++) {
		int x;
		cin >> x;
		d[x]++;
	}
	if (d[1] <= 2 && d[2] <= 2 && d[3] <= 2 && d[4] <= 2) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int a[300];


int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    bool ch = false;
    forn (i, n) {
        cin >> a[i];
        if (a[i] % 2 != 0) {
            ch = true;
        }
    }
    int ans = 0;
    while (!ch) {
        ans++;
        forn (i, n) {
            a[i]/=2;
            if (a[i] % 2 != 0) {
                ch = true;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int Inf = 1e9;
int main()
{
	int N;
	cin >> N;
	vector<int> A(N);
	for(int i = 0; i < N; i++) cin >> A[i];
	sort(A.begin(), A.end());
	if(A[1] == 1)
	{
		cout << "1"<< endl;
		return 0;
	}
	
	for(int num = A[1]; num >= 1; num--)
	{
		int cnt = 0;
		for(int i = 0; i < N; i++)
		{
			if(A[i] % num != 0)
			{
				cnt++;
				if(cnt > 1) break;
			}
		}
		if(cnt <= 1)
		{
			cout << num << endl;
			return 0;
		}
	}
	cout << "1"<< endl;
	return 0;
}


Measured memory_bytes: 640
n = int(input())
As = [list(map(int, input().split())) for _ in range(n)]

import copy
d = copy.deepcopy(As)
for i in range(n):
    for k in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j], d[i][k]+d[k][j])
cnt = 0
routes = set()
for i in range(n):
    for j in range(i+1,n):
        routes.add(i*n+j)


for i in range(n):
    for k in range(n):
        for j in range(n):
            x = (i-j)*(j-k)*(k-i)
            # かぶりを消す
            if d[i][j] == d[i][k]+d[k][j] and x != 0:
                try:
                    routes.remove(i*n+j)
                except:
                    pass
cnt = 0
for r in routes:
    i,j = divmod(r,n)
    cnt += d[i][j]

if As != d:
    print(-1)
else:
    print(cnt)

Measured memory_bytes: 83104
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int 	     	  long long   // [9,223,372,036,854,775,807 to -9.....808] 19 digits
#define pb                push_back 
#define all(x)            (x).begin(),(x).end()
#define mp                make_pair
#define vi                vector<int> 
#define vpi               vector<pair<int,int>>
#define mii               map<int,int>
#define x                 first
#define y                 second 
#define mem(a,x)          memset(a,x,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define sz(x)             (int)((x).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order()  // order_of_key

//const int32_t hellhsh = 444440583533; const double pi=2*acos(0.0); 
const int32_t mod = 1e9+7;
const int32_t maxn=3e3+5;
int inf=1e18;

int n;
int a[maxn];
int dp[maxn][maxn];

// m[{l,r}]=max(a[l]-go(l+1,r),a[r]-go(l,r-1));

void solve(){
    cin>>n;
    rep(i,0,n) cin>>a[i];
    rep(i,0,n) dp[i][i]=a[i];

    for(int i=n-2;i>=0;i--){
        for(int j=i+1;j<n;j++){
            dp[i][j]=max(a[i]-dp[i+1][j],a[j]-dp[i][j-1]);
        }
    }
    cout<<dp[0][n-1];
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tc=1,k=1;                                                                                                                  
    //cin>>tc;
    while(tc--){
        //cout<<"Case #"<<k++<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 49724
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#define maxn 1000005
using namespace std;
int a[maxn],b[maxn];
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	long long n,h;
	cin>>n>>h;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	sort(a,a+n);
	sort(b,b+n,cmp);
	long long max_1=a[n-1];
	long long tmp=0;
	for(int i=0;i<n;i++)
	{
		if(b[i]>max_1){
			h-=b[i];
			tmp++;
			if(h<=0){
				cout<<tmp<<endl;
				return 0;
			}
		}
	}
	tmp+=(h+max_1-1)/max_1;
	cout<<tmp<<endl;
	return 0;
}

Measured memory_bytes: 4736
data = [int(input()) for _ in range(5)]
time = 0
r = []
for d in data:
    time += d
    if d % 10 == 0:
        r.append(0)
    else:
        r.append(10 - d % 10)
r.sort()
time += sum(r[:-1])
print(time)


Measured memory_bytes: 3060
open Printf open Scanf
open Array

let print_array f a = Array.iter (fun v -> printf "%s " @@ f v) a; print_newline ()

let () =
  scanf " %d" @@ fun n ->
  let a = init n (fun _ -> scanf " %d" @@ fun v -> v)
  in
  let dpp = make (n+1) 0           in
  let dpn = make (n+1) (-1 lsl 60) in
  for i=1 to n-1 do
    dpp.(i) <- max
      (dpp.(i-1) + a.(i-1))
      (dpn.(i-1) - a.(i-1));
    dpn.(i) <- max
      (dpp.(i-1) - a.(i-1))
      (dpn.(i-1) + a.(i-1));
  done;
  dpp.(n) <- dpp.(n-1) + a.(n-1);
  dpn.(n) <- dpn.(n-1) - a.(n-1);
  (* print_array string_of_int dpp;
  print_array string_of_int dpn; *)
  print_int @@ max dpp.(n) dpn.(n)



Measured memory_bytes: 6400
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    cin>>a>>b>>c;
    
   if(a>b){swap(a,b);}
   if(b>c){swap(b,c);}
   if(a>b){swap(a,b);}
   
   cout<<a<<" "<<b<<" "<<c<<endl;
    
    return 0;
    
}



Measured memory_bytes: 3084
loop{
  break if(n=gets.to_i)==0
  puts n.times.map{gets.split.map(&:to_i)}.sort_by{|a|a[1]}.reduce([[0,0]]){|a,b|a<<[a[-1][0]+b[0],b[1]]}.any?{|a|a[0]>a[1]}?"No":"Yes"
}

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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(ll i = 0; i <= (ll)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define repN_1(i, n) for(int i = 0; i < (int)(n - 1); i++)
#define repM(i, n) for(int i = (int)(n - 1); i >= 0; i--)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	ll n, ans;
	ans = 0;

	cin >> n;

	rep(i, n)
	{
		if (i % 3 == 0)
			continue;
		else if (i % 5 == 0)
			continue;
		else
			ans += i;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
#include <iostream>

int main() {
  int A, B;
  std::cin >> A >> B;

  if ( A == B ) {
    std::cout << "Draw" << std::endl;
  } else if ( A == 1 || B == 1 ) {
    if ( A == 1 ) {
      std::cout << "Alice" << std::endl;
    } else {
      std::cout << "Bob" << std::endl;
    }
  } else {
    if ( A > B ) {
      std::cout << "Alice" << std::endl;
    } else {
      std::cout << "Bob" << std::endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

using namespace std;

typedef long long ll;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>pb_ds;

#define IN freopen("in.txt","r",stdin)
#define OUT freopen("out.txt","w",stdout)
#define pi pair<int,int>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define mod 1000000007
#define pai acos(-1)
#define N 100005

ll ar[N],dp[N];

int main ()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int n;cin>>n;
   for(int i=1;i<=n;i++) cin>>ar[i];
   dp[n]=0;
   for(int i=n-1;i>=1;i--){
      dp[i]=min(dp[i+1]+abs(ar[i]-ar[i+1]),(i+2<=n)?dp[i+2]+abs(ar[i]-ar[i+2]):INT_MAX);
   }
   cout<<dp[1]<<"\n";
   return 0;
}



Measured memory_bytes: 5116
from collections import deque
n=int(input())
a=list(map(int,input().split()))
ans=deque()
for i in range(n):
    if i%2!=n%2:
        ans.appendleft(a[i])
    else:
        ans.append(a[i])
for i in ans:
    print(i,end=" ")


Measured memory_bytes: 25412
#include <cstdio>
#include <algorithm>
using namespace std;

#define D_ARRAY_SIZE 10

// ???????????????????????°??????????????????????????\??????????????????
int insertionSort(int *x, int n, int distance){
    // ????´???°??????????????????????????°???????????????
    if(n <= distance) return 0;

    int count = 0;
    for(int i=distance ; i<n ; i++){
        int j, target = x[i];
        for(j=i-distance ; j>=0 ; j-=distance){
            // ?°???????????????????????????????????????????
            if(x[j] > target){
                x[j+distance] = x[j];
                count++;
            }
            else break;
        }
        x[j+distance] = target;
    }
    return count;
}

// ?????§????????????
int shellSort(int *x, int *distance, int n){
    int count = 0;
    for(int i=0 ; i<D_ARRAY_SIZE ; i++){
        if(n > distance[i]){
            count += insertionSort(x, n, distance[i]);
        }
    }
    return count;
}

// ???????????????????´??????????????????????
void generateDistance(int *distance){
    int h = 1;
    for(int i=D_ARRAY_SIZE-1 ; i>=0 ; i--){
        distance[i] = h;
        h = 3 * h + 1;
    }
}

int main(int argc, char const *argv[]) {
    int distance[D_ARRAY_SIZE];
    int x[1000000], n, count;

    // ????´???°??¨??°????????\???
    scanf("%d", &n);
    for(int i=0 ; i<n ; i++){
        scanf("%d", &x[i]);
    }

    // ?????????????????????
    generateDistance(distance);

    count = shellSort(x, distance, n);
    for(int i=0 ; i<D_ARRAY_SIZE ; i++){
        if(n > distance[i]){
            printf("%d\n", D_ARRAY_SIZE-i);
            for(int j=i ; j<D_ARRAY_SIZE ; j++){
                printf("%d", distance[j]);
                if(j != D_ARRAY_SIZE-1) printf(" ");
                else printf("\n");
            }
            break;
        }
        // ??\?????°??????????´????1??????????????¨???...
        else if(i == D_ARRAY_SIZE-1) printf("1\n1\n");
    }
    printf("%d\n", count);
    for(int i=0 ; i<n ; i++){
        printf("%d\n", x[i]);
    }

    return 0;
}

Measured memory_bytes: 6608
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;

int n,m,ans=0,tmp[200005];
struct Student{
	int l,r;
	bool operator<(const Student &b)const{
		return l!=b.l?l<b.l:r>b.r;
	}
}s[200005];
priority_queue<int,vector<int>,greater<int> > q;

int main(){
//	freopen("data.in","r",stdin);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&s[i].l,&s[i].r);
	sort(s+1,s+n+1);
	int h=1,t=m;
	for(int i=1;i<=n;i++){
		q.push(s[i].r);
		if(h<=t&&h<=s[i].l)h++;
		else{
			tmp[++tmp[0]]=q.top();
			q.pop();
		}
	}
	sort(tmp+1,tmp+tmp[0]+1);
	for(int i=tmp[0];i>=1;i--){
		if(h<=t&&tmp[i]<=t)t--;
		else ans++;
	}
	printf("%d",ans);
}

Measured memory_bytes: 3192
import java.util.*;
import static java.lang.Math.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        int ans = 0;
        for (int i = 0; i < n; i=i+2) {
            if (a[i] % 2 == 1) ans++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35620
/**
    AUTHOR:Jun_SH
    TIME:2019/6/16
    PROBLEM:ABC130_b
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll l[105];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,x;
    cin>>n>>x;
    ll sum=0;
    ll ans=0;
    ll tmp;
    l[0]=0;
    for(ll i=1;i<=n;++i){
        cin>>tmp;
        l[i]=l[i-1]+tmp;
        if(l[i]<=x)
            ans++;
    }
    cout<<ans+1<<endl;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int a,b;
    cin>>a>>b;
    double ans=-1.0;
    for(double i=0.0;i<=1000.0;i +=1.0){
        int A=(int)(i*0.08);
        int B=(int)(i*0.1);
        if(A==a && B==b){ ans =i;break;}
    }
    int as=ans;
    cout<<as<<endl;
}

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

int main() {
    int k, x;
    cin >> k >> x;
    vector<int> a;
    for(int i = x-k+1; i < x+k; ++i){
        if(i<-1000000) continue;
        if(i>1000000) continue;
        a.push_back(i);
    }
    rep(i,a.size()) {
        printf("%d ", a[i]);
    } 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define re register
#define inc(i,j,k) for(re int i=j;i<=k;i++)
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define edge(u) for(re int i=head[u];i;i=e[i].nxt)
using namespace std;
const int mod=1e9+7;
const int N=205;
inline int read(){
	int x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	while('0'<=ch&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x;
}
int n,m,k,head[N],cnt,low[N],dfn[N],tot,sz[N],ez[N],id[N],num;
ll ans=1,c[N][N],base[N];
stack<pair<int,int> > z;
struct edge{
	int to,nxt;
}e[N<<1];
void add(int a,int b){
	e[++cnt].to=b;
	e[cnt].nxt=head[a];
	head[a]=cnt;
}
ll qp(ll x,ll k){
	ll res=1;
	while(k){
		if(k&1) res=res*x%mod;
		k>>=1,x=x*x%mod;
	}
	return res;
}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void tarjan(int u,int f){
	dfn[u]=low[u]=++tot;
	edge(u){
		int v=e[i].to;
		if(v==f) continue;
		if(!dfn[v]){
			z.push(mp(u,v));
			tarjan(v,u);
			low[u]=min(low[u],low[v]);
			if(dfn[u]<=low[v]){
				int x,y;++num;
				do{
					ez[num]++;
					x=z.top().fi,y=z.top().se;z.pop();
					if(id[x]!=num) id[x]=num,sz[num]++;
					if(id[y]!=num) id[y]=num,sz[num]++;
				}while(x!=u||y!=v);
			}
		}
		else if(dfn[v]<dfn[u]) z.push(mp(u,v)),low[u]=min(low[u],dfn[v]);
	}
}
ll get(int x){
	ll res=0;
	inc(i,1,x) (res+=base[gcd(i,x)])%=mod;
	return res*qp(x,mod-2)%mod;
}
int main(){
	n=read(),m=read(),k=read();base[0]=1;
	inc(i,0,m+k){
		c[i][0]=1;
		inc(j,1,i) c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
	}
	inc(i,1,m){
		base[i]=base[i-1]*k%mod;
		int a=read(),b=read();
		add(a,b),add(b,a);
	}
	inc(i,1,n) if(!dfn[i]) tarjan(i,0);
	inc(i,1,num){
		if(ez[i]==1) ans=ans*k%mod;
		else if(ez[i]>sz[i]) ans=ans*c[ez[i]+k-1][k-1]%mod;
		else if(ez[i]==sz[i])ans=ans*get(ez[i])%mod;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int N;
        cin >> N;
        for (int i = 0; i <= N; ++i) {
//            Int n = i * 108 / 100;
            Int n = static_cast<Int>(floor(i * 1.08));
            if (n == N) {
                cout << i << endl;
                return;
            }
        }
        cout << ":(" << endl;
    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		LinkedList<Integer> list1, list2;

		while ((line = br.readLine()) != null) {
			if (!line.contains(" ")) {
				continue;
			}
			Integer[] balls = new Integer[11];
			list1 = new LinkedList<Integer>();
			list2 = new LinkedList<Integer>();

			list1.add(0);// ダミーのボール(値比較用)
			list2.add(0);// ダミーのボール(値比較用)

			//
			for (int i = 0; i < 10; i++) {
				balls[i] = Integer.valueOf((line.split(" ")[i]));
			}

			list1.add(balls[0]);// 最初のボールは無条件で落とす
			for (int i = 1; i < 10; i++) {
				int ball = balls[i];
				if (ball < list1.getLast() && ball < list2.getLast()) {
					// 落とせる筒がない
					System.out.println("NO");
					break;
				} else if (ball > list1.getLast() && ball > list2.getLast()) {
					// 値の差が小さい方に落とす
					if (ball - list1.getLast() < ball - list2.getLast()) {
						list1.add(ball);
					} else {
						list2.add(ball);
					}
				} else {
					// 落とせる方に落とす
					if (ball > list1.getLast()) {
						list1.add(ball);
					} else if (ball > list2.getLast()) {
						list2.add(ball);
					}
				}
				// 全てのボールを落とせたら
				if (i == 9) {
					System.out.println("YES");
				}
			}
		}
	}
}

Measured memory_bytes: 19124
import java.util.*;

public class Main {

    public static int maxa (int[] array) {
        int max_val = array[0];
        for (int i = 1; i < array.length; i++) {
            max_val = Math.max(max_val, array[i]);
        }

        return max_val;
    }

    public static int mina (int[] array) {
        int min_val = array[0];
        for (int i = 1; i < array.length; i++) {
            min_val = Math.min(min_val, array[i]);
        }

        return min_val;
    }

    public static int linearSearch (int key, int[] array) {
        int index = -1;
        for (int i = 0; i < array.length; i++) {
            if (key == array[i]) {
                index = i;
                break;
            }
        }

        return index;
    }

    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }

        int flag;
        if (a[0] >= 0) {
            flag = 0;
        } else {
            flag = 1;
        }
        for (int i = 1; i < a.length; i++) {
            if ((a[i] < 0 && flag == 0) || (a[i] > 0 && flag == 1)) {
                flag = 2;
                break;
            }
        }

        switch (flag) {
            case 0:
                System.out.println(n - 1);
                for (int i = 0; i < a.length - 1; i++) {
                    a[i + 1] += a[i];
                    System.out.println((i + 1) + " " + (i + 2));
                }
                break;
            case 1:
                System.out.println(n - 1);
                for (int i = a.length - 1; i > 0; i--) {
                    a[i - 1] += a[i];
                    System.out.println((i+1) + " " + i);
                }
                break;
            case 2:
                boolean add_f = true;
                int max = maxa(a);
                int min = mina(a);
                int max_index = linearSearch(max, a) + 1;
                int min_index = linearSearch(min, a) + 1;

                if (Math.abs(max) < Math.abs(min)) {
                    add_f = false;
                }

                System.out.println(2 * n - 1);

                if (add_f == true) {
                    for (int i = 0; i < a.length; i++) {
                        a[i] += max;
                        System.out.println(max_index + " " + (i + 1));
                    }
                    for (int i = 0; i < a.length - 1; i++) {
                        a[i + 1] += a[i];
                        System.out.println((i + 1) + " " + (i + 2));
                    }
                } else {
                    for (int i = 0; i < a.length; i++) {
                        a[i] += min;
                        System.out.println(min_index + " " + (i + 1));
                    }
                    for (int i = a.length - 1; i > 0; i--) {
                        a[i - 1] += a[i];
                        System.out.println((i+1) + " " + i);
                    }
                }
        }
    }
}


Measured memory_bytes: 23764
#include <stdio.h>
 
int main(){
 
int a, b;
 
scanf("%d %d",&a, &b);

 
if(a > b){
 
printf("a > b\n");
 
}
 
 
else if(a < b){
 
printf("a < b\n");
 
}
 
 
else {
 
printf("a == b\n");
 
}
 
return 0;
 
}

Measured memory_bytes: 580
n = int(input())
a = sorted(list(map(int, input().split())))
a_sum = [a[0]]
for i in range(1, n):
	a_sum.append(a_sum[-1] + a[i])

max_ng = -1
for i in range(n - 1):
	if a_sum[i] * 2 < a[i + 1]:
		max_ng = i

print(n - max_ng - 1)

Measured memory_bytes: 14320
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;

int n;
int rythm[8][1024],len[8];

int toi(char c)
{
	if(isdigit(c))return c-'0';
	return c-'A'+10;
}
char toa(int a)
{
	if(a<10)return '0'+a;
	return 'A'+a-10;
}
int minimize(int *r,int l)
{
	int mxi=1;
	for(int i=2;i<=l;i++)if(l%i==0)
	{
		bool fail=0;
		rep(j,l)if(j%i&&r[j]){fail=1;break;}
		
		if(!fail)mxi=i;
	}
	rep(i,l/mxi)r[i]=r[i*mxi];
	return l/mxi;
}

int main()
{
	int cs; cin>>cs;
	while(cs--)
	{
		cin>>n;
		rep(i,n)
		{
			char c[2100]; cin>>c;
			for(int j=0;c[j];j+=2)rythm[i][j/2]=toi(c[j])*16+toi(c[j+1]);
			len[i]=minimize(rythm[i],strlen(c)/2);
		}
		int ans[1024]={0},anslen=1;
		rep(i,n)
		{
			int g=__gcd(anslen,len[i]);
			anslen*=len[i]/g;
			if(anslen>1024)
			{
				cout<<"Too complex."<<endl; goto END;
			}
		}
		rep(i,n)rep(j,len[i])ans[j*anslen/len[i]]|=rythm[i][j];
		rep(i,anslen)cout<<toa(ans[i]/16)<<toa(ans[i]%16);
		cout<<endl;
		
		END:;
	}
	return 0;
}

Measured memory_bytes: 900
N = int(input())
L = list(map(int, input().split()))

diff = 0
maxNum = 0
maxDiffArray = []
for i in range(len(L)):
    diffArray = []
    for j in range(len(L)):
        if i != j:
            diff = abs(L[i] - L[j])
            diffArray.append(diff)
    maxDiffArray.append(max(diffArray))
print(max(maxDiffArray))


Measured memory_bytes: 3060
import java.io.*;
import java.util.*;
public class Main
{
    public static void main(String argv[])
    {
        int N,K,i;
        try
        {
            BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
            String[] nk=bf.readLine().split(" ");
            N=Integer.parseInt(nk[0]);
            K=Integer.parseInt(nk[1]);
            String[] da=bf.readLine().split(" ");

            System.out.println(solve(da,K));

        }
        catch(IOException e)
        {
            System.out.println(e);
            System.exit(0);
        }
    }
    private static int solve(String[] d,int X)
    {
        int c=0,i;
        for(i=0;i<d.length;i++)
        {
            c+=Integer.parseInt(d[i]);
            if(c>X)
                break;
        }
        return 1+i;
    }
}


Measured memory_bytes: 22740