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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 998244353
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li n, m, k;

li fact_mod[200100];

inline void init() {
    fact_mod[0] = 1;
    fact_mod[1] = 1;
    repp(i, 2, 200100) {
        fact_mod[i] = (fact_mod[i - 1] * i) % MOD;
    }
}

inline li gcd(li a, li b) {
    return b != 0 ? gcd(b, a % b) : a;
}
// a x + b y = gcd(a, b)
inline li extgcd(li a, li b, li &x, li &y) {
    li g = a; x = 1; y = 0;
    if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
    return g;
}

inline li invMod(li a) {
    li x, y;
    if (extgcd(a, MOD, x, y) == 1) return (x + MOD) % MOD;
    else                         return 0; // unsolvable
}

inline li combi(li n, li k) {
    return (((fact_mod[n] * invMod(fact_mod[k])) % MOD) * invMod(fact_mod[n - k])) % MOD;
}

int main() {
    init();
    cin >> n >> m >> k;
    li res = 0;
    li tmp = m;
    rep(i, n) {
        if (i >= n - 1 - k) {
            res = (res + tmp * combi(n - 1, i) % MOD) % MOD;
        }
        tmp = (tmp * (m - 1)) % MOD;
    }
    cout << res << endl;


    return 0;
}

Measured memory_bytes: 5204
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		pr.println(n / 3);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21844
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let mut sc = Scanner::new();
    let s = sc.next_chars();
    let l = s.len();
    let log = 1e10f64.log2().floor() as usize;

    let mut doubling = Vec::with_capacity(log);

    {
        let mut v = vec![U_INF; l];
        for j in 0..l {
            if s[j] == 'R' {
                v[j] = j + 1;
            } else {
                v[j] = j - 1;
            }
        }
        doubling.push(v);
    }

    for i in 0..log {
        let mut v = vec![U_INF; l];
        for j in 0..l {
            v[j] = doubling[i][doubling[i][j]];
        }
        doubling.push(v);
    }

    let mut now = (0..l).collect_vec();
    for i in 0..=log {
        if (10000000000usize & 1 << i) != 0 {
            let mut v = vec![U_INF; l];
            for j in 0..l {
                v[j] = doubling[i][j];
            }
            now = v;
        }
    }

    let mut ans = vec![0; l];
    for n in now {
        ans[n] += 1;
    }

    println!("{}", ans.into_iter().join(" "));
}

pub struct Scanner {
    buf: std::collections::VecDeque<String>,
}

impl Scanner {
    pub fn new() -> Self {
        Self {
            buf: std::collections::VecDeque::new(),
        }
    }

    fn scan_line(&mut self) {
        let mut flag = 0;
        while self.buf.is_empty() {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            let mut iter = s.split_whitespace().peekable();
            if iter.peek().is_none() {
                if flag >= 5 {
                    panic!("There is no input!");
                }
                flag += 1;
                continue;
            }

            for si in iter {
                self.buf.push_back(si.to_string());
            }
        }
    }

    pub fn next<T: std::str::FromStr>(&mut self) -> T {
        self.scan_line();
        self.buf
            .pop_front()
            .unwrap()
            .parse()
            .unwrap_or_else(|_| panic!("Couldn't parse!"))
    }

    pub fn next_usize(&mut self) -> usize {
        self.next()
    }

    pub fn next_isize(&mut self) -> isize {
        self.next()
    }

    pub fn next_chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect()
    }

    pub fn next_string(&mut self) -> String {
        self.next()
    }

    pub fn next_char(&mut self) -> char {
        self.next()
    }

    pub fn next_float(&mut self) -> f64 {
        self.next()
    }
}


Measured memory_bytes: 30976
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getc (map $ wrds toInt) >>= mapM_ print

solve :: [[Int]] -> [Int]
solve = map f
  where
    f [v,d] = let (x:xs) = take v fibs in g [] [x] xs
      where
        g rs us vs
          | null vs = length rs + 1
          | null nus = g (us : rs) [head vs] (tail vs)
          | otherwise = g rs (nus ++ us) (vs \\ nus)
          where
            nus = nub [j |i <- us, j <- vs, abs (i - j) < d]

fibs :: [Int]
fibs = 2:3:zipWith (\x y -> (x+y) `mod` 1001) fibs (tail fibs)

toInt :: String -> Int
toInt = read

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getc :: ([String] -> a) -> IO a
getc f = f . lines <$> getContents

Measured memory_bytes: 5476
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    string s; cin >> s;
    int n = s.size();
    vector<int> index[26];
    rep(i,n) index[s[i] - 'a'].push_back(i);
    rep(i,26){
        if((int)index[i].size() <= 1) continue;
        rep(j,(int)index[i].size()-1){
            if(index[i][j+1] - index[i][j] <= 2){
                cout << index[i][j]+1 << " " << index[i][j+1]+1 << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1" << endl;
    return 0;
}


Measured memory_bytes: 1148
N = int(input())
W = list(map(int, input().split()))

mi_n = 100000
index = 0
for i in range(1,N):
    S1 = sum(W[0 : i])
    S2 = sum(W[i: N])
    if abs(S1 - S2) <= mi_n:
        mi_n = abs(S1 - S2)

print(mi_n)

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

#define PB push_back
#define ld long double
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) (x).begin(), (x).end()
#define ios ios_base::sync_with_stdio(0);
#define ll long long
#define open(name) \
freopen(name".in", "r", stdin); \
freopen (name".out", "w", stdout);

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};

const int N = 2e5 + 7;;
const int INF = 2e9 + 7;
const int logg = 20;
const double PI = 3.14;

using namespace std;

void solve() {
    int n, sum;
    cin >> n >> sum;
    ll m[n + 7], p[n + 7], dp[n + 7][sum + 7];
    for (int i = 1; i <= n; i ++) cin >> m[i] >> p[i];
    for (int i = 0; i <= n; i ++) {
        for (int j = 0; j <= sum; j ++) dp[i][j] = 0;
    }
    for (int i = 1; i <= n; i ++) {
        for (int j = 1; j <= sum; j ++) {
            dp[i][j] = dp[i - 1][j];
            if (j >= m[i]) {
                dp[i][j] = max(dp[i][j], dp[i - 1][j - m[i]] + p[i]);
            }
        }
    }
    cout << dp[n][sum];
}

int main() {
    ios;
    solve();
}


Measured memory_bytes: 82368
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
#define pii pair<ll,ll>
#define pi pair<int ,int> 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i,a,n) for(int i=a;i>=n;i-- )
#define F first
#define S second
int main() {
     map<string,ll>mp;
     int n;
     cin>>n;ll ans=0;
     REP(i,0,n)
     {
         string s;int t;
         cin>>s;cin>>t;
         ans+=t;
         mp[s]=ans;
     }
     string x;
     cin>>x;
    ll te=mp[x];
    cout<<ans-te;

   
   
	return 0;
}

Measured memory_bytes: 256
from itertools import product
n=input()
deg=len(n)
n=int(n)
d=['3','5','7']
d1=['3','5']
d2=['5','7']
d3=['3','7']
cnt=0
if deg<2:
     print(0)
else:
     for i in range(3,deg+1):
          d_=list(product(d,repeat=i))
          d1_=list(product(d1,repeat=i))
          d2_=list(product(d2,repeat=i))
          d3_=list(product(d3,repeat=i))
          d_=[x for x in d_ if x not in d1_]
          d_=[x for x in d_ if x not in d2_]
          d_=[x for x in d_ if x not in d3_]
          for x in d_:
               x=list(x)
               a=int(''.join(x))
               if a<=n:
                    cnt+=1
               else:
                    break
     print(cnt)

Measured memory_bytes: 7040
/**
 *    author:  FromDihPout
 *    created: 2020-05-16   
**/

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

template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    vector<int> ans(n, -1);
    for (int i = 0; i < m; i++) {
        int s, c;
        cin >> s >> c;
        s--;
        if (n > 1 && s == 0 && c == 0) {
            cout << -1 << '\n';
            return 0;
        }
        if (ans[s] != -1 && ans[s] != c) {
            cout << -1 << '\n';
            return 0;
        }
        ans[s] = c;
    }
    
    for (int i = 0; i < n; i++) {
        if (i == 0 && n > 1 && ans[i] == -1) cout << 1;
        else if (ans[i] == -1) cout << 0;
        else cout << ans[i];
    }
    cout << '\n';
    return 0;
}

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

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

    int ans = 0;
    for (int i = 0; i <= N - 3; ++i){
        if( S[i] == 'A' and S[i+1] == 'B' and S[i+2]=='C'){
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def gcd(a,b):
	return a if b==0 else gcd(b,a%b)
	
while 1:
	a1,m1,a2,m2,a3,m3=map(int,raw_input().split())
	if a1==0:break
	x=y=z=1
	x=a1*x%m1
	y=a2*y%m2
	z=a3*z%m3
	cx=cy=cz=1
	while 1:
		if x!=1:
			x=a1*x%m1
			cx+=1
		if y!=1:
			y=a2*y%m2
			cy+=1
		if z!=1:
			z=a3*z%m3
			cz+=1
		if (x,y,z)==(1,1,1):
			break
	lcd=cx*cy/gcd(cx,cy)
	lcd=lcd*cz/gcd(lcd,cz)
	print lcd

Measured memory_bytes: 4240
//逆

#include<iostream>
#include<algorithm>
#include<bitset>

#include<cmath>
#include<cstring>
#include<climits>

#include<vector>
#include<set>
#include<map>
#include<unordered_set>
//#include<unordered_map>
#include<tr1/unordered_map>

#include<fstream>
#include<chrono>

using namespace std;
using namespace std::tr1;
using namespace std::chrono;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef vector<int> v32;
typedef vector<ll> v64;

const ll MOD7 = 1e9 + 7;
const ll MOD9 = 1e9 + 9;
const ll INF  = 1LL << 57LL;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ITER iterator
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define ones __builtin_popcount
#define DANGER std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

ll dp[101][100001];

int main()
{
    // DANGER;
    ofstream out("output.txt");

    // ll t;
    // cin>>t;

    auto start = high_resolution_clock::now();

    ll n, W;
    cin>>n>>W;
    ll w[n], v[n];
    rep(i,0,n-1) cin>>w[i]>>v[i];

    mem( dp,1 );
    ll stored = dp[0][0];
    dp[0][0] = 0, dp[0][v[0]] = w[0];

    rep(i,0,n-2)
    {
        rep(j,0,100000)
        {
            if( dp[i][j]==-1 )
            continue;
            dp[i+1][j] = min( dp[i+1][j],dp[i][j] );
            ll J = j+v[i+1];
            // if( J<=W )
            dp[i+1][J] = min( dp[i+1][J],dp[i][j]+w[i+1] );
        }
    }

    ll ans = 0;
    // rep(i,0,W) ans = max( ans,dp[n-1][i] );
    brep(i,100000,0)
    {
        if( dp[n-1][i]<=W && dp[n-1][i]!=stored )
        {
            ans = i;
            break;
        }
    }
    cout<<ans<<"\n";

    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<milliseconds>(stop - start); 
    // cout << "Time taken by function: " << duration.count() << " milliseconds" << endl;
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define fi first
#define se second
 
const ll MOD = 1000000007;
const string RGB = "RGB"; 

int main() {
   int n; scanf("%d", &n);
   vector<int> d(n);
   for (auto& i : d)
      scanf("%d", &i);
   sort(d.begin(), d.end());
   printf("%d", d[(n + 1) / 2] - d[(n - 1) / 2]);
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 61)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



string s;
void solve(){
	cin >> s;
	if(s[0] <= 'Z') cout << 'A' << endl;
	else cout << 'a' << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3632
// https://atcoder.jp/contests/abc173/tasks/abc173_d
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>

using namespace std;
#define lli long long int
#define numberofdigits(x) floor(log10(x)) + 1

int main()
{
    lli n,a[200005],s=0,cnt=0,i;
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    s=a[n];
    cnt=1;
    i=n-1;
    while(cnt<n-1)
    {
        s+=2*a[i];
        i--;
        cnt+=2;
    }
    if(n&1 && n>2) s-=a[i+1];
    cout<<s-a[0]<<"\n";
    return 0;
}

Measured memory_bytes: 5184
#include<iostream>
#include<cstdio>
using namespace std;
int n,k,d,x,a,pan[101],count=0;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++)
	{
		scanf("%d",&a);
		for(int j=1;j<=a;j++)
		{
			scanf("%d",&x);
			if(pan[x]==0)
				pan[x]=1;
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(pan[i]==0) count++;
	}
	printf("%d",count);
	return 0;
} 

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define repa(i, a, b) for (auto i = (a); i <= (b); i++)
#define repd(i, a, b) for (auto i = (a); i >= (b); i--)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define zero(a)  memset((a), 0, sizeof (a))
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back

constexpr auto inf = numeric_limits<int>().max() - 1;
constexpr auto llinf = numeric_limits<ll>().max() - 1LL;

template<typename ForwardIterator>
void dump(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << *it << " ";
	}
	cout << endl;
}

template<typename ForwardIterator>
void dump_map(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << (*it).first << ":" << (*it).second << " ";
	}
	cout << endl;
}
template<typename T>
void debug(initializer_list<T> list) {
  for (auto el : list) {
    cout << el << " ";
  }
  cout << endl;
}

void solve() {
	int n, m;
	ll k;
	cin >> n >> m >> k;
	vector<int> a(n), b(m);
	rep(i, n) cin >> a[i];
	rep(i, m) cin >> b[i];
	vector<ll> apref(n + 1), bpref(m + 1);
	repa(i, 1, n) apref[i] = apref[i - 1] + ll(a[i - 1]);
	repa(i, 1, m) bpref[i] = bpref[i - 1] + ll(b[i - 1]);
	auto mxm = 0, st = m;
	repa(i, 0, n) {
		auto left = k - apref[i];
		if (left < 0 || st < 0) break;
		while (st >= 0) {
			if (bpref[st] <= left) break;
			st--;
		}
		mxm = max(mxm, i + st);
	}
	cout << mxm;
	cout << "\n";
}

#define REPEAT 0
#define CASE 0

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#if REPEAT
		int t;
		cin >> t;
		repa(i, 1, t) {
			#ifdef CASE
				cout << "Case #" << i << ": ";
			#endif
			solve();
		}
	#else
		solve();
	#endif
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int pre=-999;
  rep(i,n) {
    if(pre <= a[i]-1) {
      pre=a[i]-1;
    } else if(pre <= a[i]) {
      pre=a[i];
    } else {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}


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

#define pb emplace_back
#define fi first
#define se second
#define m_p make_pair
#define vi vector<int>
#define pi pair<int, int>
#define mem(a,b) memset(a,b,sizeof(a))
#define el cout<<endl
#define sz(a) (int)a.size()
const int mod = (int)1e9+7;
typedef long long int ll;

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N = (int)1e5+5;
priority_queue<int> pq;
vi v[N];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		v[a].pb(b);
		// trace(a,b);
	}	
	int ans=0;
	for(int i=1;i<=m;i++){
		for(auto q:v[i]){
			pq.push(q);
		}
		if(!pq.empty()){
			ans += pq.top();
			pq.pop();
		}
	}
	cout<<ans;el;
}

ll power(ll a,ll b, ll md=mod){
	ll r=1;
	while(b){
		if(b%2) 
			r=(r*a)%md;
		a=(a*a)%md;
		b>>=1;
	}
	return r;
}

Measured memory_bytes: 8908
import std.stdio;
import std.string;
import std.conv;
import std.bigint;

void main()
{
  auto n = readln().chomp().to!int();
  
  foreach (i; 0..n) {
  	BigInt sum = readln.chomp().to!BigInt();
  	sum += readln.chomp().to!BigInt();
  	if (sum.to!string().length > 80) {
  		"overflow".writeln();
  	} else {
  		sum.writeln();
  	}
  }
}

Measured memory_bytes: 1140
def solve():
  N = int(input())
  V = list(map(int, input().split()))
  ans = 0
  V.sort(reverse=True)
  for i in range(N-1):
    ans += V[i]/pow(2,i+1)
  ans += V[-1]/pow(2,N-1)
  return ans
print(solve())

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define ll long long
#define pii pair <int , int>
#define psi pair <string , int >
#define pll pair <ll , ll>
#define pi 3.14159265358979323846
using namespace std;
int main()
{
    ll m , n , ag = 0  ,x ;
    cin >> n >> m;
    for(int i = 0 ; i < m ; i++)
    {
        cin >> x;
        ag += x;
    }
    if(ag <= n) cout << n - ag << endl;
    else cout << -1 << endl;
    ///code here
    return 0;
}


Measured memory_bytes: 3636
n = int(input())

for i in range(1, n+1):
    if i%3 == 0:
        print(" %d"%(i), end = "")
        continue
    elif i%10 == 3:
        print(" %d" % (i), end="")
        continue
    else:
        x = i
        while x > 0:
            x //= 10
            if x%10 == 3:
                print(" %d"%(i), end="")
                break

print()


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

const int MOD = (int)1e9+7;

int main(){
	int N,D;
	cin >> N >> D;
	vector<vector<int>> X(N,vector<int>(D));
	for(int i=0;i<N;i++){
		for(int j=0;j<D;j++){
			cin >> X.at(i).at(j);
		}
	}

	int ans=0;
	
	for(int i=0;i<N;i++){
		for(int j=i+1;j<N;j++){
			int sum=0;
			for(int k=0;k<D;k++){
				int xx=X.at(i).at(k)-X.at(j).at(k);
				xx=xx*xx;
				sum+=xx;
			}
			for(int k=0;k<=400;k++){
				if(k*k==sum)	ans++;
			}
		}
	}
	cout << ans << endl;

	return 0;
}


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

long n, m;
long a[100000];
long c[100000];

int bits(long n) {
  int cnt = 0;
  while (!(n & 1)) {
    n >>= 1;
    ++cnt;
  }
  return cnt;
}

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

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

int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    c[i] = bits(a[i]);
  }
 
  for (int i = 0; i < n; ++i) {
    if (c[i] != c[0]) {
      cout << 0 << endl;
      return 0;
    }
  }
  for (int i = 0; i < n; ++i) {
    a[i] >>= c[0];
  }
  
  long g = 1;
  for (int i = 0; i < n; ++i) {
    g = lcm(g, a[i]);
    if (g >= 2e9) {
      cout << 0 << endl;
      return 0;
    }
  }
  g <<= (c[0] - 1);
  
  cerr << g << endl;
  cout << (m / g + 1) / 2 << endl;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

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

    }

    if(n == 1) {
        cout << v[0] << endl;
        return 0;

    }

    bool f = false;
    int s = 0;
    while(!f) {
        bool ff = true;
        for(int i = 0; i < n; ++i) {
            if(i + 1 < n && v[i] <= 0 && v[i + 1] > 0) ++s;
            else if(i == 0 && v[i] > 0) ++s;
            --v[i];
            if(v[i] > 0) ff = false;

        }
        f = ff;
    }
    cout << s << endl;
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 998244353;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

int main(void) {

  ll n;
  cin >> n;

  ll ans = 0;
  for (ll i = 1; i <= n; i++) {
    if (i % 3 != 0 && i % 5 != 0) ans += i;
  }
  cout << ans << endl;
}


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

using namespace std;

char a[30];
int i, j, n, flag;

int main()
{
	while(~scanf("%s",a))
	{
		flag = 0;
		n = strlen(a);
		getchar();
		for(i = 0; i < n - 1; i++)
			for(j = i + 1; j < n; j++)
			{
				if(a[i] == a[j]) flag++;
			}
		if(flag) cout << "no" << endl;
		else cout << "yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int m,d,sum=0;
	cin>>m>>d;
	for(int i=1;i<=m;i++)
	{
		for(int j=10;j<=d;j++)
		{
			int d1=j/10,d2=j%10;
			if(d1*d2==i && d1>=2 &&d2>=2)
			sum++;
		}
	}
	cout<<sum;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    char x,y,z;
    cin >> x >> y>> z;
    if(x=='A' && y=='A' && z=='A'){
        cout<<"No";
    }
    else{
        
    
    if(x=='B' && y=='B' && z=='B'){
        cout<<"No";
    }
    else {
        cout<<"Yes";
    
             }
    }
    return 0;
}

Measured memory_bytes: 256
from scipy.sparse import*;f=lambda*z:map(int,raw_input().split());d=lambda s:csgraph.dijkstra(csr_matrix(([1]*len(a),(a,b)),[n+1]*2),0,s);n,=f();a,b=zip(*map(f,[0]*~-n));g=d(1);h=d(n);print['Snuke','Fennec'][sum(g[i]>h[i]for i in range(n+1))*2<n]

Measured memory_bytes: 37732
extern crate proconio;
use proconio::input;

fn main() {
    input! {
        h: usize,
        w: usize,
        n: usize,
        ijv: [(usize, usize, i64); n],
    }
    let mut a = vec![vec![0; w]; h];
    for (i, j, v) in ijv {
        a[i - 1][j - 1] = v;
    }
    let mut dp = vec![vec![0; 4]; w];
    let mut ans = 0;
    for i in 0..h {
        let mut next = vec![vec![0; 4]; w];
        for j in 0..w {
            for k in 0..=3 {
                // println!("{} {} {}", i, j, k);
                if j + 1 < w {
                    dp[j + 1][k] = std::cmp::max(dp[j + 1][k], dp[j][k]);
                    if a[i][j] > 0 && k < 3 {
                        dp[j + 1][k + 1] = std::cmp::max(dp[j + 1][k + 1], dp[j][k] + a[i][j]);
                    }
                }
                next[j][0] = std::cmp::max(next[j][0], dp[j][k]);
                if a[i][j] > 0 && k < 3 {
                    next[j][0] = std::cmp::max(next[j][0], dp[j][k] + a[i][j]);
                }
                ans = std::cmp::max(ans, dp[j][k]);
                ans = std::cmp::max(ans, next[j][0]);
            }
        }
        for k in 0..=2 {
            //            ans = std::cmp::max(ans, dp[w - 1][k] + a[i][w - 1]);
        }
        dp = next;
    }
    println!("{}", ans);
}

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

#define fi first
#define se second
#define long long long
typedef pair<int,int> ii;

int n;
long A[200003];

int main()
{
	// freopen("input.in", "r", stdin);

	scanf("%d", &n);
	long sum = 0;
	for(int i = 0; i < n; i++)
	{
		scanf("%d", &A[i]);
		sum += A[i];
	}

	long ans = 1e18, pref = 0;;
	for(int i = 0; i < n; i++)
	{
		pref += A[i];
		ans = min(ans, abs(2*pref-sum));
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
bool cmp(const pair<ll,ll>& A,const pair<ll,ll>& B)
{
    return A.first < B.first;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vector< pair<ll,ll> >v;
    for(int i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        v.push_back({x,y});
    }
    sort(v.begin(),v.end(),cmp);
    ll sum=0;
    for(auto x: v){
        if(x.second>m){
            sum+=(x.first*m);
            break;
        }
        else{
            sum+=(x.first*x.second);
            m-=x.second;
        }
    }
    cout<<sum<<endl;
}


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

const int MAX = 5100000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

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

int main() {
    // 前処理
    COMinit();
    int k;cin>>k;
    string s;cin>>s;
    int n=s.size();
    vector<long long> a(n+k+1,1),b(n+k+1,1);
    for(int i=0;i<n+k;++i){
        a[i+1]=a[i]*25;
        a[i+1]%=MOD;
        b[i+1]=b[i]*26;
        b[i+1]%=MOD;
    }
    long long ans=0;
    for(int i=0;i<=k;++i){
        ans+=COM(n+i-1,n-1)*a[i]%MOD*b[k-i];
        ans%=MOD;
    }
    // 計算例
    cout << ans << endl;
}


Measured memory_bytes: 155088
use proconio::input;

fn main() {
    input! {
        x: usize,
        n: usize,
        mut p: [usize; n],
    }

    solve(x, &mut p);
}

fn solve(x: usize, p: &mut [usize]) {
    p.sort();

    match p.binary_search(&x) {
        Err(_) => {
            println!("{}", x);
            return;
        }
        Ok(_) => {}
    }
    let mut min = 0;
    let mut max = 100;
    for i in 0..102 {
        if i < x {
            match p.binary_search(&i) {
                Ok(_) => continue,
                Err(_) => min = i,
            }
        }
        if i > x {
            match p.binary_search(&i) {
                Ok(_) => continue,
                Err(_) => {
                    max = i;
                    break;
                }
            }
        }
    }
    if x - min <= max - x {
        println!("{}", min);
    } else {
        println!("{}", max);
    }
}


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

typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define ARR(array) for(int i=0;i<array.size();i++)
#define all(in) in.begin(),in.end()
#define ALL(in,K) (in),(in)+(K)

#define INF 1e18
#define MOD 1000000007
#define SIZE 10005
#define PI 	3.14159265358979323846

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a, b)*b; } //最小公倍数

ll input(){
ll a;
  cin >> a;
  return a;
}

vi sub(vector<bool> fin,ll n) {
  vi ret;
  REP(i,n) {
    if(fin.at(i))continue;
    vector<bool> cp = fin;
    cp.at(i) = true;
    vi result = sub(cp,n);
    ret.insert(ret.end(),result.begin(),result.end());
  }
  return ret;
}

int main() {
  char a,b;
  cin >> a >> b;
  if(a==b)cout << "=" << endl;
  if(a<b)cout << "<" << endl;
  if(a>b)cout << ">" << endl;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll = long long;
using R = long double;
const R EPS = 1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max(x, 0.0L));}

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

// Problem Specific Parameter:

using T = bitset<2000010>;

int a[2010];
T dp;

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

	rep(i, n) cin >> a[i];

	int asum = 0;
	rep(i, n) asum += a[i];

	dp.set(0);
	rep(i, n) dp |= (dp << a[i]);

	int ans = 0;
	rrep(i, asum / 2 + 1) {
		if (dp[i] == 1) {
			ans = asum - i;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
    string S;
    cin >> S;
    
    vector<bool> l(200);
    for(int i = 0; i < S.size(); i++) {
        int k = S.at(i);
        l.at(k) = true;
    }
    
    string ans = "";
    for(int i = 97; i <= 122; i++) {
        if(!l.at(i)) {
            ans +=  i;
            break;
        }
    }
    if(ans=="") ans += "None";
    cout << ans << endl;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
};

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
};

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    double ar1 = b * a;
    double ar2 = x / a;
    if (ar2 * 2 >= ar1) {
        double ta = ar1 - ar2;
        double y = 2 * ta / a;
        double ans = (atan2(y, a) / 2/ M_PI) * (double) 360;
        printf("%.10f\n", ans);
        return 0;
    } else {
        double y = ar2 * (double) 2 / b;
        double ans = (atan2(b, y) / 2/ M_PI) * (double) 360;
        printf("%.10f\n", ans);
        return 0;
    }
};


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<climits>
#include<cstring>
using namespace std;
#define MAXN 100
int n;
int G,T[MAXN+5],c[MAXN+5];
int cnt,vis[MAXN+5],ans=1000000000;
void dfs(int x,int G,int step)
{
    for(int i=n;i>=1;i--)
    if(!vis[i])
    {
        int M=T[i]*100*i+c[i];
        if(G>M)vis[i]=1,dfs(x+1,G-M,step+T[i]),vis[i]=0;
        else
        {
            int p=(G+i*100-1)/(i*100);
            ans=min(ans,step+min(p,T[i]));
        }
    }
}
int main()
{
    scanf("%d%d",&n,&G);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&T[i],&c[i]);
    }
    dfs(1,G,0);
    printf("%d",ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n; cin >> n;
    int ans = (n + 1.07)/1.08;
    if (floor(ans * 1.08) != n) {
        cout << ":(" << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}

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

signed main(){
    cin>>N;
    map<long,long> m;
    while(N--){
        int a;cin>>a;m[a]++;
    }
    typedef pair<long,long> P;
    vector<P> l;
    for(auto p:m)l.push_back(p);
    for(int i=0;i<l.size();i++){
        ans += l[i].second*(l[i].second-1)*(l[i].second-2)/6;
        for(int j=0;j<i;j++){
            if(l[j].first * 2 > l[i].first)ans += l[i].second*l[j].second*(l[j].second-1)/2;
            ans += l[j].second*l[i].second*(l[i].second-1)/2;
            for(int k=0;k<j;k++){
                if(l[j].first+l[k].first<=l[i].first)continue;
                else ans+=l[i].second*l[j].second*l[k].second;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

string s;
int n;

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

	stack<char> st;

	for (int i = 0;i < n;i++) {
		if (s[i] == '(') {
			st.push('(');
		}
		else {
			if (st.empty()) {
				st.push(')');
				continue;
			}

			if (st.top() == '(') {
				st.pop();
			}
			else {
				st.push(')');
			}
		}
	}

	int l = 0;
	int r = 0;

	while (!st.empty()) {
		if (st.top() == '(') l++;
		else r++;
		st.pop();
	}

	string res = "";

	for (int i = 0;i < r;i++) res += '(';
	res += s;
	for (int i = 0;i < l;i++) res += ')';

	cout << res << endl;

	return 0;
}


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

int Harshad(int a){
    int har=0;
    int divi=1;
    while(divi<a)divi*=10;
    while(a){
        har+=a/divi;
        a%=divi;
        divi/=10;
    }
    return har;
}
int main(void){
    int n;
    scanf("%d",&n);
    int har=Harshad(n);
    if(n%har==0)printf("Yes\n");
    else printf("No\n");
}

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


#define ll long long
#define pb push_back
#define mp make_pair
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, a, b) for(int i = (a); i > (b); --i)

typedef pair <int,int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <ll> vl;

const int mod = 1e9+7;
const int inf = 2e18+5;


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

  ll n;
  cin>>n;
  int abc[n][3];
  int dp[n][3];
  memset(dp,-1,sizeof(dp));

  loop(i,0,n)
    cin>>abc[i][0]>>abc[i][1]>>abc[i][2];
  loop(i,0,3)
    dp[0][i]=abc[0][i];

  //loop(i,0,n-1){
   // loop(j,0,3){
     //     dp[i+1][(j+1)%3]=max(dp[i+1][(j+1)%3] , dp[i][j]+abc[i+1][(j+1)%3]);
       //   dp[i+1][(j+2)%3]=max(dp[i+1][(j+2)%3] , dp[i][j]+abc[i+1][(j+2)%3]);
    //}
  //}
  int idx;
  loop(i,0,n-1){
    
    dp[i+1][0] = max(dp[i][1] , dp[i][2]) + abc[i+1][0];
    dp[i+1][1] = max(dp[i][2] , dp[i][0]) + abc[i+1][1];
    dp[i+1][2] = max(dp[i][0] , dp[i][1]) + abc[i+1][2];
  }

  cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

#define INF 1e9
#define LLINF 1e18
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;


int main() {
    int n;
    int sum = 0;
    cin >> n;
    vector<int> s(n);
    vector<bool> ten(n, false);
    rep(i, n) {
        cin >> s.at(i);
        sum += s.at(i);
    }
    sort(s.begin(), s.end());
    rep(i, n) {
        if (s.at(i) % 10 == 0) {
            ten.at(i) = true;
        }
    }
    if (sum % 10 != 0) {
        cout << sum << endl;
        return 0;
    }
    else {
        rep(i, n) {
            if(!ten.at(i)){
                sum -= s.at(i);
                cout << sum << endl;
                return 0;
            }
        }
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
n = gets.chomp.to_i
count = 0
n.times.map {
    gets.chomp.split(" ").map(&:to_i)
}.each { |(d1, d2)|
    if d1 == d2
        count += 1
    else
        count = 0
    end
    if count >= 3
        puts "Yes"
        exit
    end
}
puts "No"


Measured memory_bytes: 14280
import java.util.*;

public class Main {
    private static int[] lengths;
    private static int INF = 10000000;
    private static int A;
    private static int B;
    private static int C;
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        A = sc.nextInt();
        B = sc.nextInt();
        C = sc.nextInt();
        lengths = new int[n];
        for (int i = 0; i < n; i++) {
            lengths[i] = sc.nextInt();
        }
        
        System.out.println(dfs(0, 0, 0, 0));
    }
    
    public static int dfs(int cur, int a, int b, int c) {
        int ret0, ret1, ret2, ret3;
        
        if (cur == lengths.length) {
            if (a == 0 || b == 0 || c == 0) return INF;
            
            return Math.abs(a - A) + Math.abs(b - B) + Math.abs(c - C) - 30;
        }
        
        ret0 = dfs(cur + 1, a, b, c);
        ret1 = dfs(cur + 1, a + lengths[cur], b, c) + 10;
        ret2 = dfs(cur + 1, a, b + lengths[cur], c) + 10;
        ret3 = dfs(cur + 1, a, b, c + lengths[cur]) + 10;
        
        return Math.min(Math.min(ret0, ret1), Math.min(ret2, ret3));
    }
}

Measured memory_bytes: 21844
a, b, c, d = map(int, input().split())
x = sorted([a, b])
y = sorted([c, b])

if (max(a, c) - min(a, c)) <= d:
    print("Yes")
elif (x[-1] - x[0]) <= d and (y[-1] - y[0]) <= d:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
from collections import Counter


def main():
    # 「混ぜてソートする」の練習がてら解き直す．
    card_num, operation = map(int, input().split())
    card = Counter(list(map(int, input().split())))
    for _ in range(operation):
        target_cards, after_change = map(int, input().split())
        if after_change in card:
            card[after_change] += target_cards
        else:
            card[after_change] = target_cards
    card = sorted(dict(card).items(), key=lambda x: x[0], reverse=True)
    answer = 0
    for c, n in card:
        answer += c * min(card_num, n)
        card_num -= n
        if card_num <= 0:
            break
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 54944
#include <bits/stdc++.h>
using namespace std;
using ii = pair<int,int>;
using ll = long long;

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  string s; cin >> s;
  int sum = 0;
  for (char c : s) {
    sum += (c-'0');
  }
  cout << (sum%9?"No":"Yes") << '\n';
  return 0;
}


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

const int N = 100006;

int a[N];

int main ()
{
    int n;
    scanf("%d",&n);
    for (int i=1;n>=i;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a+1,a+n+1);
    long long ans=0;
    vector<int> cans;
    for (int i=n;i>=1;i--)
    {
        if (a[i] == a[i-1])
        {
            cans.push_back(a[i]);
            --i;
        }
    }
    if (cans.size() >= 2)
    {
        cout << cans[0] * 1LL * cans[1] << endl;
    }
    else cout << 0 <<endl;
}


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

using namespace std;

int main()
{
	char s[11];
	scanf("%s",s);

	int tmp=2,min=1000;
	while(s[tmp]!='\0'){
		int n;
		n=100*(s[tmp-2]-'0')+10*(s[tmp-1]-'0')+(s[tmp]-'0');
		if(abs(n-753)<min) min=abs(n-753);
		tmp++;
	}

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

	return 0;
}


Measured memory_bytes: 128