akhauriyash/Code-Regression huggingface dataset:
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

template<long long Mod>
struct mint{
    long long x;
    mint(long long x=0) :x((x% Mod+Mod)%Mod){}

    mint operator-() const { return mint(-x); }

    mint& operator+=(const mint a) {
        if((x += a.x) >= Mod) x -= Mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if((x += Mod-a.x) >= Mod) x -= Mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= Mod;
        return *this;
    }

    mint operator^(long long t) const {
        mint ret(1);
        mint a = *this;
        while(t){
            if(t&1){
                ret *= a;
            }
            a *= a;
            t >>= 1;
        }
        return ret;
    }
    mint inv() const { return *this ^ (Mod-2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }

    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint operator/(const mint a) const { return mint(*this) /= a; }

    friend istream& operator>>(istream& is, mint& a) { return is >> a.x; }
    friend ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
};

template<typename T>
struct Combination{
private:
    int N;
    vector<T> f, i;
public:
    void init(int n){
        N = n;
        f.resize(N+1); f[0] = T(1);
        for(int j=1; j<=N; j++){
            f[j] = f[j-1] * T(j);
        }
        i.resize(N+1); i[N] = T(1) / f[N];
        for(int j=N-1; j>=0; j--){
            i[j] = i[j+1] * T(j+1);
        }
    }
    T fact(int n){
        return f[n];
    }
    T P(int n, int r){
        return f[n] * i[n-r];
    }
    T C(int n, int r){
        return f[n] * i[r] * i[n-r];
    }
};

int N;
mint<MOD> A, B, C;
Combination<mint<MOD>> comb;

signed main(){
    cin >> N >> A >> B >> C;
    comb.init(max(2*N, 200));
    
    A /= 100;
    B /= 100;
    C /= 100;

    mint<MOD> ans = 0;
    rep(i, N){
        ans += (A^N)*(B^i) / ((-C+1)^(N+i+1)) / comb.fact(N-1) / comb.fact(i) * (((-C+1)*(N+i)*comb.fact(N+i-1)) + (C*comb.fact(N+i)));
        ans += (B^N)*(A^i) / ((-C+1)^(N+i+1)) / comb.fact(N-1) / comb.fact(i) * (((-C+1)*(N+i)*comb.fact(N+i-1)) + (C*comb.fact(N+i)));
    }
    cout << ans << endl;
}

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

/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compiles and gets accepted.
 *  ___  __     _______    _______      
 * |\  \|\  \  |\  ___ \  |\  ___ \     
 * \ \  \/  /|_\ \   __/| \ \   __/|    
 *  \ \   ___  \\ \  \_|/__\ \  \_|/__  
 *   \ \  \\ \  \\ \  \_|\ \\ \  \_|\ \ 
 *    \ \__\\ \__\\ \_______\\ \_______\
 *     \|__| \|__| \|_______| \|_______|
 */
const long long mod = 1000000007;

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

	string s;
	cin>>s;
	if(s.find("AC") != s.npos) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


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

#define pb push_back

int N,a;
int d[100005];

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> d[i];
  }
  sort(d, d+N);

  if (d[N/2] == d[N/2 - 1])
    cout << 0 << endl;
  else
    cout << d[N/2] - d[N/2 - 1] << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define INT long long int
#define oo 9999987654321ll
using namespace std;
INT n, m, w[1010], p[1010], dp[1010][1<<12];
INT f(INT x, INT y)
{
    if( x == m ) return (y == (1<<n)-1?0:oo);
    if( ~dp[x][y] ) return dp[x][y];
    INT &ret = dp[x][y] = oo;
    return ret = min( f(x+1, y), f(x+1, y|p[x])+w[x] );
}
int main()
{
    ios::sync_with_stdio(false);
    memset(dp, -1, sizeof(dp));
    cin>>n>>m;
    for(int i = 0, j, k ; i < m ; i++ )
    {
        cin>>w[i]>>k;
        for(int j = 0, v ; j < k ; j++ )
        {
            cin>>v;
            p[i]|=(1<<(v-1));
        }
    }
    INT ans = f(0, 0);
    cout<<(ans==oo?-1:ans)<<endl;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

#define BIT_MAX 15

int main(){

    int N, M;
    cin >> N >> M;
    vector<int> L(M);
    vector<int> R(M);

    rep(i,M){
        cin >> L[i];
        cin >> R[i];
    }

    int L_max = *max_element(L.begin(),L.end());
    int R_min = *min_element(R.begin(),R.end());

    cout << max(0,R_min-L_max+1) << endl;

    
}

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

int main() {
  int A, B;
  std::cin >> A >> B;
  
  int ans = 0;
  for (int x = A; x <= B; x++){
    if (x/10000 == x%10 and (x/1000)%10 == (x/10)%10){
      ans += 1;
    }
  }
  std::cout << ans << std::endl;
}


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

const int MOD = 1000000007;

int main(){
    // あとで消す
    //std::ifstream in("cin3.txt");
    //std::cin.rdbuf(in.rdbuf());

    long long N,M,c_2,c_1,c_0;

    cin >> N ;
    cin >> M ;

    if(N==1){
        cout << 1 << endl;
        return 0;
    }

    int read_count = 0;

    c_2 = 1;
    int next;
    cin >> next;
    read_count++;
    if(next==1){
        c_1 = 0;
        cin >> next;
        read_count++;
    }else{
        c_1 = 1;
    }

    int step = 2;

    //cout << next << endl;

    while(step<N){
        if(step==next){
            c_0 = 0;
            if(read_count<M){
                cin >> next;
                //cout << "read!!" << endl;
                read_count++;
            }
        }else{
            c_0 = (c_2+c_1)%MOD;
        }
        c_2 = c_1;
        c_1 = c_0;
        step++;
    }

    cout << (c_2+c_1)%MOD << endl;
    //cout << step << endl;
    //cout << read_count << endl;

    return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  cout << 6 - A- B <<endl;
  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int D;
  cin >> D;
  
  if(D == 25) {
    cout << "Christmas" << endl;
  } else if (D == 24) {
    cout << "Christmas Eve" << endl;
  } else if(D == 23) {
    cout << "Christmas Eve Eve" << endl;
  } else if (D == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  }
  return 0;
}

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

class Program {
    static void Main() {
        var dictionary = new Dictionary<string, List<int>>();

        for (string line; (line = Console.ReadLine()) != null;) {
            var l = line.Split(' ');
            var word = l[0];
            var page = int.Parse(l[1]);

            if (dictionary.ContainsKey(word)) {
                dictionary[word].Add(page);
            }
            else {
                dictionary[word] = new List<int> { page };
            }
        }

        foreach (var item in dictionary.OrderBy(kv => kv.Key)) {
            Console.WriteLine(item.Key);
            item.Value.Sort();
            Console.WriteLine(string.Join(" ", item.Value.ConvertAll(v => v.ToString()).ToArray()));
        }
    }
}

Measured memory_bytes: 10584
#include <stdio.h>

int main()
{
    int a,b,total;
    char o[3];
    scanf("%d %s %d", &a, o, &b);
    if ( o[0] == '+')
        total = a + b;
    else
        total = a - b;
    printf("%d", total);
    
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };

int x,a,b;

signed main(){
    cin>>x>>a>>b;
    if(abs(a-x)<abs(b-x))cout<<'A'<<endl;
    else cout<<'B'<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
#include <ctype.h>

#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define hell        1000000007
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.000000001
#define all(a)      (a).begin(),(a).end()
const long long INF = (long long) 1e7+1;
const long long mod = (long long) 998244353;

using namespace std;
void solve();

void fastIO() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}

int main(){
   fastIO();
    solve();
}
//void sieve();
ll pw(ll k,ll x);
ll gcd(ll x,ll y);


/*class CompareDist
{
public:
    bool operator()(pair<ll,int> a,pair<ll,int> b) {
        if(a.F!=b.F)
        return a.F<b.F;
        else
        return a.S>b.S;
    }
};*/


void solve(){

  int test;
  //cin>>test;
  test=1;
  while(test--){
    int n;
    cin>>n;
    cout<<n*n;
  }
}

/*bool issafe(int x,int y){
  return (x>=0 && y>=0 && x<n && y<m);
}*/

///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

ll gcd(ll x,ll y){
  if(x==0)
  return y;
  else
  return gcd(y%x,x);
}


ll pw(ll k,ll x){
  if(x==0)
  return 1;
  if(x&1)
  return ((pw(k,x-1)%hell)*k%hell)%hell;
  else
  return ((pw(k,x/2)%hell)*(pw(k,x/2)%hell))%hell;
}

/*void sieve(){

  for(int i=2;i<=1000000;i++){
    if(prime[i]==true){
      for(int j=i*i;j<=1000000;j+=i)
      prime[j]=false;
    }
  }

}*/


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

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    use std::collections::BinaryHeap;
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let m: usize = sc.cin();
    let mut xs: BinaryHeap<u64> = (0..n).map(|_| sc.cin()).collect();
    for _ in 0..m {
        let a = xs.pop().unwrap();
        xs.push(a / 2);
    }
    put!(xs.iter().sum::<u64>());
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


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

int main(){
	int n,a;
	string s;
	cin >> n;
	vector<pair<string,pair<int,int>>> v;
	for (int i = 0; i < n; ++i){
		cin >> s >> a;
		v.push_back({s,{-a,i+1}});
	}
	sort(v.begin(), v.end());
	for(auto x:v){
		cout << x.second.second << endl;
	}
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
a = list(map(int, input().split()))

c = Counter(a)
x = sorted(c.keys())

# aに4種類以上異なる値が存在する場合、No
ans = (
    'Yes' if (
        len(x) == 3 and x[0] ^ x[1] == x[2] and
        c[x[0]] == c[x[1]] == c[x[2]] or
        len(x) == 2 and x[0] == 0 and c[x[1]] == 2 * c[0] or
        len(x) == 1 and x[0] == 0
    ) else
    'No'
)

print(ans)


Measured memory_bytes: 14468
N=int(input())
kyoku=list(input().split() for i in range(N))
X=input()
time = 0
sousuu= 0
for i in range(N):
    sousuu += int(kyoku[i][1])

    if kyoku[i][0]==X:
        for j in range(i+1):
            time += int(kyoku[j][1])
print(sousuu-time)

Measured memory_bytes: 3064
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
#include <map> // pair
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;

using namespace std;
using ll = long long;
typedef pair <ll, ll > pll;

int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n, m, K;
	ll memo[10004] = {};
	ll memo2[10004] = {};
	string s;
	string s1, s2;
	//IntStack yStack;
	//charStack Stack;
	//vector<pair<int, int> > pairs(a);
	cin >> a;
	cin >> b;
	if (a>=(b-1)*2+1)
	{
		cout << "YES" << endl;

	}
	else
	{
		cout << "NO" << endl;

	}
	//cout << ans << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

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

#define ui unsigned int
#define ll long long
#define ul unsigned ll
#define ld long double

#define pi pair <int, int>
#define fi first
#define se second
#define mp make_pair

#define ls (p << 1)
#define rs (ls | 1)
#define md ((t[p].l + t[p].r) >> 1)

#define vi vector <int>
#define pb push_back
#define pq priority_queue

#define dbg(x) cerr << #x" = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)

#define fl(x) freopen(x".in", "r", stdin), freopen(x".out", "w", stdout)

using namespace std;

namespace io {
	const int SI = 1 << 21 | 1;
	char IB[SI], *IS, *IT, OB[SI], *OS = OB, *OT = OS + SI - 1, c, ch[100];
	int f, t;
	#define gc() (IS == IT ? (IT = (IS = IB) + fread(IB, 1, SI, stdin), IS == IT ? EOF : *IS++) : *IS++)
	inline void flush() {
		fwrite(OB, 1, OS - OB, stdout), OS = OB;
	}
	inline void pc(char x) {
		*OS++ = x;
		if (OS == OT) flush();
	}

	template <class I>
	inline void rd(I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + (c & 15), c = gc());
		x *= f;
	}
	template <class I>
	inline void rd(I &x, I &y) {
		rd(x), rd(y);
	}
	template <class I>
	inline void rd(I &x, I &y, I &z) {
		rd(x), rd(y), rd(z);
	}
	template <class I>
	inline void rda(I *a, int n) {
		for (int i = 1; i <= n; i++) rd(a[i]);
	}
	inline void rdc(char &c) {
		for (c = gc(); c < 33 || c > 126; c = gc());
	}
	inline void rds(char *s, int &n) {
		for (c = gc(); c < 33 || c > 126; c = gc());
		for (n = 0; c >= 33 && c <= 126; s[++n] = c, c = gc());
		s[n+1] = '\0';
	}
	inline void rds(string &s) {
		for (c = gc(); c < 33 || c > 126; c = gc());
		for (s.clear(); c >= 33 && c <= 126; s.pb(c), c = gc());
	}

	template <class I>
	inline void print(I x, char k = '\n') {
		if (!x) pc('0');
		if (x < 0) pc('-'), x = -x;
		while (x) ch[++t] = x % 10 + '0', x /= 10;
		while (t) pc(ch[t--]);
		pc(k);
	}
	template <class I>
	inline void print(I x, I y) {
		print(x, ' '), print(y);
	}
	template <class I>
	inline void print(I x, I y, I z) {
		print(x, ' '), print(y, ' '), print(z);
	}
	template <class I>
	inline void printa(I *a, int n) {
		for (int i = 1; i <= n; i++) print(a[i], " \n"[i==n]);
	}
	inline void printc(char c) {
		pc(c);
	}
	inline void prints(char *s, int n) {
		for (int i = 1; i <= n; i++) pc(s[i]);
		pc('\n');
	}
	inline void prints(string s) {
		int n = s.length();
		while (t < n) pc(s[t++]);
		pc('\n'), t = 0;
	}
	struct Flush {
		~Flush() {
			flush();
		}
	} flusher;
}
using io::rd;
using io::rda;
using io::rdc;
using io::rds;
using io::print;
using io::printa;
using io::printc;
using io::prints;

const int N = 2e5 + 7;
int n, d[N];
vi e[N];

void dfs(int x, int f) {
	for (int y : e[x])
		if (y != f) d[y] = d[x] + 1, dfs(y, x);
}

int main() {
	rd(n);
	for (int i = 1, x, y; i < n; i++)
		rd(x, y), e[x].pb(y), e[y].pb(x);
	d[1] = 1, dfs(1, 0);
	int rt = max_element(d + 1, d + n + 1) - d;
	d[rt] = 1, dfs(rt, 0);
	int ans = *max_element(d + 1, d + n + 1);
	prints(ans % 3 == 2 ? "Second" : "First");
	return 0;
}

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

int N;

int main() {
  cin >> N;
  for (int i = N / 1.08; i < (N + 1) / 1.08; ++i) {
    int tax_exc = i * 1.08;
    if (tax_exc == N) {
      cout << i << endl;
      exit(0);
    }
  }
  cout << ":(" << endl;
  
  return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
nextroom = [[] for _ in range(N)]
for _ in range(M):
  A, B = map(int, input().split())
  nextroom[A-1].append(B-1)
  nextroom[B-1].append(A-1)

sgn = [-1 for _ in range(N)]
sgn[0] = 0

depth = [float('inf') for _ in range(N)]
depth[0] = 0

now = [0]
nextvisit = []
for j in range(1, M+1):
  for n in now:
    for i in nextroom[n]: 
      if depth[i] > j:
        nextvisit.append(i)
        sgn[i] = n
        depth[i] = j
  now = [] + nextvisit
  nextvisit = []

if -1 in sgn:
  print('No')
else:
  print('Yes')
  for k in range(1, len(sgn)):
    print(sgn[k]+1)

Measured memory_bytes: 37552
//#include <iostream>
//#include<vector>
//#include<algorithm>
//#include<queue>
//#include<list>
//using namespace std;
//static const int MAX = 100000;
//static const int INFTY = (1 << 29);
//
//vector<int>G[MAX];
//list<int>out;
//bool V[MAX];
//int indeg[MAX];
//int N;
//
//
//void bfs(int s) {
//    queue<int> q;
//    q.push(s);
//    V[s] = true;
//    while (!q.empty()) {
//        int u = q.front(); q.pop();
//        out.push_back(u);
//        for (int i = 0; i < G[u].size(); i++) {
//            int v = G[u][i];
//            indeg[v]--;
//            if (indeg[v] == 0 && !V[v]) {
//                V[v] = true;
//                q.push(v);
//            }
//        }
//    }
//}
//    
//
//void tsort() {
//    for (int i = 0; i < N; i++) {
//        indeg[i] = 0;
//    }
//    for (int u = 0; u < N; u++) {
//        for (int i = 0; i < G[u].size(); i++) {
//            int v = G[u][i];
//            indeg[v]++;
//        }
//    }
//
//    for (int u = 0; u < N; u++)
//        if (indeg[u] == 0 && !V[u])bfs(u);
//
//    for (list<int>::iterator it = out.begin(); it != out.end(); it++) {
//        cout << *it << endl;
//    }
//}
//int main()
//{
//    int s, t, M;
//
//
//    cin >> N >> M;
//    for (int i = 0; i < N; i++)V[i] = false;
//
//    for (int i = 0; i < M; i++) {
//        cin >> s >> t;
//        G[s].push_back(t);
//    }
//
//    tsort();
//
//    return 0;
//
//}

//dfs ver
#include<iostream>
#include<vector>
#include<algorithm>
#include<list>
using namespace std;
static const int MAX = 100000;

vector<int> G[MAX];
list<int> out;
bool V[MAX];
int N;


void dfs(int u) {
	V[u] = true;
	for (int i = 0; i < G[u].size(); i++) {
		int v = G[u][i];
		if (!V[v])dfs(v);

	}
	out.push_front(u);

}

int main() {
	int s, t, M;

	cin >> N >> M;

	for (int i = 0; i < N; i++)V[i] = false;

	for (int i = 0; i < M; i++) {
		cin >> s >> t;
		G[s].push_back(t);
	}
	for (int i = 0; i < N; i++) {
		if (!V[i])dfs(i);
	}

	for (list<int>::iterator it = out.begin(); it != out.end(); it++) {
		cout << *it << endl;
	}
	return 0;
}




Measured memory_bytes: 6200
#include <cmath>
#include <cstdio>
#include <algorithm>
typedef long double ldouble;
static const int MAXN = 200003;
static const int MAXX = 1e8 + 6;
static const ldouble PI = acosl(-1.0);
static const int INF = 0x3fffffff;

int xs, ys, xt, yt;
int n;
std::pair<int, int> p[MAXN];

namespace sgt {
// Single value modification, range maximum query

static const int MAXN = ::MAXN * 35;
int sz;
struct node { int l, r, lch, rch; int max; } t[MAXN];

inline void rebuild(int L, int R) {
    sz = 1;
    t[0] = (struct node){ L, R, -1, -1, 0 };
}

inline void assure(int &idx, int L, int R) {
    if (idx == -1) {
        idx = sz++;
        t[idx] = (struct node){ L, R, -1, -1, 0 };
    }
}

int QL, QR, QV;

inline int query(int idx) {
    if (idx == -1) return 0;
    if (t[idx].l >= QL && t[idx].r <= QR) return t[idx].max;
    int ans = 0, M = (t[idx].l + t[idx].r) / 2;
    if (M >= QL) ans = std::max(ans, query(t[idx].lch));
    if (M + 1 <= QR) ans = std::max(ans, query(t[idx].rch));
    return ans;
}
inline int query(int L, int R) { if (L > R) return 0; QL = L, QR = R; return query(0); }

inline void modify(int idx) {
    if (t[idx].l == t[idx].r) { t[idx].max = std::max(t[idx].max, QV); return; }
    if ((t[idx].l + t[idx].r) / 2 >= QL) {
        assure(t[idx].lch, t[idx].l, (t[idx].l + t[idx].r) / 2);
        modify(t[idx].lch);
    } else {
        assure(t[idx].rch, (t[idx].l + t[idx].r) / 2 + 1, t[idx].r);
        modify(t[idx].rch);
    }
    t[idx].max = 0;
    if (t[idx].lch != -1) t[idx].max = std::max(t[idx].max, t[t[idx].lch].max);
    if (t[idx].rch != -1) t[idx].max = std::max(t[idx].max, t[t[idx].rch].max);
}
inline void modify(int P, int V) { QL = P, QV = V; modify(0); }

}

int main()
{
    scanf("%d%d%d%d", &xs, &ys, &xt, &yt);
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) scanf("%d%d", &p[i].first, &p[i].second);

    if (xs > xt) {
        xs = (int)1e8 - xs;
        xt = (int)1e8 - xt;
        for (int i = 0; i < n; ++i) p[i].first = (int)1e8 - p[i].first;
    }
    if (ys > yt) {
        ys = (int)1e8 - ys;
        yt = (int)1e8 - yt;
        for (int i = 0; i < n; ++i) p[i].second = (int)1e8 - p[i].second;
    }

    ldouble base = (ldouble)((yt - ys) + (xt - xs)) * 100;
    ldouble ans = 1e40;

    std::sort(p, p + n);
    sgt::rebuild(0, MAXX);
    for (int i = 0; i < n; ++i)
        if (p[i].first >= xs && p[i].first <= xt && p[i].second >= ys && p[i].second <= yt) {
            int s = sgt::query(0, p[i].second);
            sgt::modify(p[i].second, s + 1);
        }

    int s = sgt::query(0, MAXX);
    if (s == std::min(yt - ys + 1, xt - xs + 1)) {
        ans = std::min(ans, base + (PI * 5 - 20) * (s - 1) + (PI * 10 - 20));
    } else {
        ans = std::min(ans, base + (PI * 5 - 20) * s);
    }

    printf("%.15Lf\n", ans);
    return 0;
}


Measured memory_bytes: 44288
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int vis[25][25];
char s[25][25];
int x[4] = {0, 1, 0, -1};
int y[4] = {1, 0, -1, 0};
struct node { int x, y; } q[25 * 25];
int h, w;

int Solve(int a, int b, int c, int d) {
  if (s[a][b] == '#' || s[c][d] == '#') return 0;
  memset(vis, 0, sizeof(vis));
  vis[a][b] = 1;
  int head = 1, tail = 0;
  q[++tail] = (node){a, b};
  while (head <= tail) {
    node t = q[head++];
    for (RI i = 0; i < 4; ++i) {
      if (t.x + x[i] >= 1 && t.x + x[i] <= h && t.y + y[i] >= 1 && t.y + y[i] <= w)
        if (!vis[t.x + x[i]][t.y + y[i]] && s[t.x + x[i]][t.y + y[i]] != '#')
          vis[t.x + x[i]][t.y + y[i]] = vis[t.x][t.y] + 1, q[++tail] = (node){t.x + x[i], t.y + y[i]};
    }
  }
    return vis[c][d] - 1;
}

int main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  cin >> h >> w;
  for (RI i = 1; i <= h; ++i)
    cin >> (s[i] + 1);
  int ans = 0;
  for (RI i = 1; i <= h; ++i)
    for (RI j = 1; j <= w; ++j)
      for (RI k = 1; k <= h; ++k)
        for (RI l = 1; l <= w; ++l)
          ans = max(ans, Solve(i, j, k, l));
  printf("%d\n", ans);

  return 0;
}

// created by Daniel yuan


Measured memory_bytes: 256
//20
#include<iostream>
#include<queue>
#include<string>
#include<utility>
#include<vector>
#include<map>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    string a[10],b[10];
    for(int i=0;i<n;i++){
      cin>>a[i]>>b[i];
    }
    string s,g;
    cin>>s>>g;
    typedef pair<int,string> pis;
    queue<pis> que;
    que.push(make_pair(0,s));
    map<string,bool> mem;
    while(!que.empty()){
      pis c=que.front();
      if(c.second==g)break;
      que.pop();
      if(mem[c.second]++||c.second.size()>=g.size())continue;
      for(int i=0;i<n;i++){
	string ns=c.second;
	vector<int> rp;
	for(int j=0;j<ns.size();){
	  if(ns.substr(j,a[i].size())==a[i]){
	    rp.push_back(j);
	    j+=a[i].size();
	  }else{
	    j++;
	  }
	}
	for(int j=0;j<rp.size();j++){
	  ns=ns.substr(0,rp[j]+j*(b[i].size()-a[i].size()))+b[i]+ns.substr(rp[j]+j*(b[i].size()-a[i].size())+a[i].size());
	}
	que.push(make_pair(c.first+1,ns));
      }
    }
    cout<<(que.empty()?-1:que.front().first)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1544
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>
#include <vector>
#include <iomanip>

using namespace std;

int main(void) {
  string s;
  cin >> s;
  string c = "CODEFESTIVAL2016";
  int cnt = 0;
  for (int i = 0; i < c.size(); i++) {
    if (s[i] != c[i]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			}
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					System.out.printf("#");
				}
				System.out.printf("\n");
			}
			System.out.printf("\n");
		}
	}
}


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

int main()
{
	int money[17];
	int dp[301] = {1};
	
	for (int i = 0; i < 17; i++){
		money[i] = (i + 1) * (i + 1);
	}
	
	for (int i = 0; i < 17; i++){
		for (int j = 0; j <= 300 - money[i]; j++){
			dp[j + money[i]] += dp[j];
		}
	}
	
	int n;
	while (scanf("%d", &n), n){
		printf("%d\n", dp[n]);
	}
	
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    cout << 180*(n-2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
   int i,j,k;
    long int n,m,l,num;
    
    scanf("%ld",&n);
    scanf("%ld",&m);    
    scanf("%ld",&l); 


    long int A[n][m],B[m][l],C[n][l];
    
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%ld",&num);
            A[i][j] = num;

        }
    }
    
    for(j=0;j<m;j++){
        for(k=0;k<l;k++){
            scanf("%ld",&num);
            B[j][k] = num;

        }
    }
    
    for(i=0;i<n;i++){
        for(k=0;k<l;k++){
            C[i][k] = 0;
        }
    }
 
    
    for(i=0;i<n;i++){
        for(k=0;k<l;k++){
            for(j=0;j<m;j++){
                
                C[i][k] += A[i][j] * B[j][k];   
            }
            printf("%ld",C[i][k]); 
            if(k != l-1){
                printf(" ");
            }
        }
          printf("\n");
    }
    
	return 0;
}

Measured memory_bytes: 836
N = int(input())
A = list(map(int, input().split()))

useable = []
memo = {}

for a in A:
    try:
        memo[a] += 1
    except:
        memo[a] = 1
    if memo[a] == 2:
        useable.append(a)
        memo[a] = 0

# print(useable)

if len(useable) < 2:
    print(0)
else:
    useable.sort()
    print(useable[-1] * useable[-2])


Measured memory_bytes: 18088
N=input()
a=input().split()
sum_num=0
sum_num2=0
sum_num3=10000
ans=0
b=0
c=0
for i in range(int(N)):
    sum_num=sum_num+int(a[i])
#print(sum_num)

for i in range(int(N)):
    sum_num2=sum_num2+int(a[i])
    if abs(sum_num/2-sum_num2)<sum_num3:
        sum_num3=abs(sum_num/2-sum_num2)
        ans=i


for i in range(int(N)):
    if i<=ans:
        b=b+int(a[i])
    else:
        c=c+int(a[i])
print(abs(b-c))



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

#define all(x) (x).begin(),(x).end()

#define MOD 1000000007

using namespace std;

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

	for(int i=1; i<n; i++){
		v[i] = (v[i-1]+v[i])/2;
	}
	
	printf("%.12f\n",v[n-1]);
	
	return 0;
}

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

int main(){
  int n, w;
  cin >> n >> w;
  vi weight(n+1), value(n+1);
  rep(i,n) cin >> weight[i+1] >> value[i+1];
  vector<vector<ll>> dp(n+1, vector<ll>(w+1));
  for(int i=1; i<=n; i++){
    bool ok = true;
    for(int j=0; j<=w; j++){
      if(j-weight[i] >= 0) dp[i][j] = max(dp[i-1][j], dp[i-1][j-weight[i]] + value[i]);
      else dp[i][j] = dp[i-1][j];
    }
  }
  cout << dp[n][w] << endl;
}


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

int main()
{

int A,B;
cin >> A;
cin >> B;

    
if (1<=A && A<=9 && 1<=B && B<=9) {
cout << A*B <<endl; 
}

else{
cout <<-1 <<endl;
}
    
}

Measured memory_bytes: 256
n,C = map(int,input().split())
d = [[int(i) for i in input().split()] for _ in range(C)]
c = [[int(i)-1 for i in input().split()] for _ in range(n)]

cnt = [[0]*C for _ in range(3)]
for i in range(n):
    for j in range(n):
        for k in range(C):
            cnt[(i+j)%3][k] += d[c[i][j]][k]

ans = float("inf")
for i in range(C):
    for j in range(C):
        if i == j: continue
        for k in range(C):
            if i == k or j == k: continue
            ans = min(ans, cnt[0][i] + cnt[1][j] + cnt[2][k])
print(ans)

Measured memory_bytes: 45148
#include<bits/stdc++.h>
using namespace std ;
int main () {
  int a ,b , c;
  cin >> a >> b>> c;
  int ans = 0 ;
  for(int i = a ; i <= b ;i++) {
    if(c%i==0) ans++ ;
  }
  cout << ans << endl ;
}


Measured memory_bytes: 3100
#include<iostream>
#include <string>
#include <iomanip>
#include <vector>
#include <queue>
#include <math.h>
#include <algorithm>
#include <functional>

using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)



signed main()
{
	string s;
	cin >> s;
	bool n = false;
	REP(i, s.size()) {
		REP(j, s.size()) {
			if (s[i] == s[j] && i != j) {
				n = true;
			}
		}
	}
	if(n == false) cout << "yes" << endl;
	else cout <<"no" << endl;
}

Measured memory_bytes: 256
package main

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

// https://atcoder.jp/contests/abc177/editorial/88
// 累積和を用いて区間和を計算する

func main() {
	mod := int(1e9+7)
	var n int
	fmt.Scan(&n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	a := make([]int, n)
	sum := make([]int, n+1)

	for i := 0; i < n; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
		sum[i+1] = sum[i] + a[i]
	}


	ans := 0
	for i := 0; i < n; i++ {
		s := (sum[n] - sum[i+1]) % mod
		ans += a[i] * s
		ans %= mod
	}
	fmt.Println(ans)
}


Measured memory_bytes: 7608
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int N=2e5+10,mo=998244353;
int n,sum,tot,ans,f[N][3][3][2];
char s[N];
int read()
{
    int f=1,x=0; char c=getchar();
    while (c<'0'||c>'9'){ if (c=='-') f=-1; c=getchar(); }
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}
int main()
{
    scanf("%s",s+1),n=strlen(s+1);
    if (n<=3)
    {
        if (n==1) cout<<1; else if (n==2){ if (s[1]==s[2]) cout<<1; else cout<<2; }
        else
        {
            if (s[1]==s[2]||s[2]==s[3]){ if (s[1]==s[2] && s[2]==s[3]) cout<<1; else cout<<6; } else{ if (s[1]==s[3]) cout<<7; else cout<<3; } 
        }
        return 0;
    }
    for (int i=2;i<=n;i++) sum+=(s[i]==s[i-1]),tot+=s[i]-'a';
    (tot+=s[1]-'a')%=3,ans=!sum;
    if (sum==n-1){ cout<<1; return 0;}
    f[1][1][1][0]=f[1][2][2][0]=f[1][0][0][0]=1;
    for (int i=2;i<=n;i++) for (int j=0;j<=2;j++) for (int k=0;k<=2;k++) for (int p=0;p<=2;p++)
    {
    	int last=(j-k+3)%3;
        (f[i][j][k][1]+=f[i-1][last][p][1])%=mo;
        if (k==p) (f[i][j][k][1]+=f[i-1][last][p][0])%=mo; else (f[i][j][k][0]+=f[i-1][last][p][0])%=mo;
    }
    for (int i=0;i<=2;i++) (ans+=f[n][tot][i][1])%=mo;
    printf("%d\n",ans);
}

Measured memory_bytes: 14464
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repi(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
typedef long long ll;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  int n=s.length();
  rep(i,n){
    if(i%2==0&&s[i]=='L'){
      cout<<"No";
      return 0;
    }
    else if(i%2==1&&s[i]=='R'){
      cout<<"No";
      return 0;
    }
  }
  cout<<"Yes";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll inf=1e9+7;
ll a[2000];
ll b[2000];
int main()
{
    //freopen("input.txt","r",stdin);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    for(int i=0;i<n;i++) cin>>a[i]>>b[i];

    for(int i=1;i<n;i++)
    {
        if(a[i]<a[i-1]||b[i]<b[i-1])
        {
            ll t=max(ceil((long double)a[i-1]/a[i]),ceil((long double)b[i-1]/b[i]));
            a[i]*=t;
            b[i]*=t;
        }
    }
    cout<<1ll*a[n-1]+b[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}// char to int
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}//MAX
int lcm(ll a,ll b){return a*b/gcd(a,b);}//MIN
 
int  main(){
int n,d;
cin >> n >> d;
double  a [n][d];
for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
        cin >> a[i][j];
    }
}
int ans =0;
for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
        double che = 0.0;
        for(int k = 0;k<d;k++){
          che +=pow(abs(a[i][k]-a[j][k]),2);
        }
        che = pow(che,0.5);
        int z = che;
        if(z==che)ans++;
    }
}
cout << ans << endl;
}
 


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

#define pb push_back
#define ll long long int
#define mpi map<int, int>
#define vi vector<int>
#define si set<int>
#define pii pair<int, int>
#define vpi vector<pii>
#define vs vector<string>
#define pri priority_queue<int>
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define For(i, n) for (int i = 0; i < n; i++)
#define Ford(i, a, b) for (int i = a; i >= b; i--)
#define Rep(i, x, y) for (int i = x; i <= y; i++)
#define mem(a, b) memset(a, b, sizeof(a))
#define fastio                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

double tick()
{
    static clock_t oldt, newt = clock();
    double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC;
    oldt = newt;
    return diff;
}

int main()
{
    int n;
    cin >> n;
    int k = n % 10;
    if (k == 2 | k == 4 || k == 5 || k == 7 || k == 9)
        cout << "hon\n";
    else if (k == 0 | k == 1 || k == 6 || k == 8)
        cout << "pon\n";
    else
        cout << "bon\n";

    cerr << "execution time is: " << tick() << "\n";
}


Measured memory_bytes: 3788
class BIT:
  from operator import add, sub, mul, floordiv
  X_unit = 0
  X_f = add
  X_f_rev = sub

  def __init__(self, seq):
    N = len(seq)
    self.N = N
    self.X = seq[:]
    for i in range(self.N):
      j = i + ((i+1) & -(i+1))
      if j < self.N:
        self.X[j] = self.X_f(self.X[i], self.X[j])
  
  def set_val(self, i, x):
    while(i < self.N):
      self.X[i] = self.X_f(self.X[i], x)
      i += (i+1) & -(i+1)

  def cum_val(self, i):
    res = self.X_unit
    while(i > -1):
      res = self.X_f(res, self.X[i])
      i -= (i+1) & -(i+1)
    return res
  
  #区間[L, R)
  def fold(self, L, R):
    return self.X_f_rev(self.cum_val(R-1), self.cum_val(L-1))
  
  def bisect_left(self, w):
    if w > self.cum_val(self.N - 1):
      return self.N
    elif self.N == 2:
      return 1
    n = 2**((self.N - 1).bit_length() - 1)
    res = 0
    while(n):
      if res + n - 1 > self.N - 1:
        n //= 2
        continue
      if w <= self.X[res + n - 1]:
        n //= 2
      else:
        w -= self.X[res + n - 1]
        res += n
        n //= 2
    return res
  
  def bisect_right(self, w):
    if w >= self.cum_val(self.N - 1):
      return self.N
    elif self.N == 2:
      return 1
    n = 2**((self.N - 1).bit_length() - 1)
    res = 0
    while(n):
      if res + n - 1 > self.N - 1:
        n //= 2
        continue
      if w < self.X[res + n - 1]:
        n //= 2
      else:
        w -= self.X[res + n - 1]
        res += n
        n //= 2
    return res
  
  def lower_bound(self, w):
    ans = self.bisect_right(self.cum_val(w))
    if ans == self.N:
      return -1
    else:
      return ans
  
  def upper_bound(self, w):
    ans = self.bisect_left(self.cum_val(w-1))
    return ans

N = int(input())
S = list(input())

L = [BIT([0]*N) for _ in range(26)]

for i in range(N):
  L[ord(S[i])-97].set_val(i, 1)

Q = int(input())

for _ in range(Q):
  q, a, b = input().split()
  if q == "1":
    a = int(a)
    L[ord(S[a-1])-97].set_val(a-1, -1)
    L[ord(b)-97].set_val(a-1, 1)
    S[a-1] = b
  else:
    a, b = int(a), int(b)
    ans = 0
    for i in range(26):
      if L[i].fold(a-1, b) >= 1:
        ans += 1
    print(ans)

Measured memory_bytes: 226260
# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import math

def gcd(a, b):
    return math.gcd(a, b)

def lcm(a, b):
    return a * b / gcd(a, b)

class slist(list):
    def __init__(self, *args, **kw):
        list.__init__(self, *args, **kw)
        self.sort()

    def append(self, value):
        bisect.insort(self,value)

    def index_left(self, value):
        return bisect.bisect_left(self, value)


if __name__ == '__main__':
    n, x = map(int, input().split())
    L = list(map(int, input().split()))
    ans = 1
    d = 0
    for l in L:
        d += l
        if x < d:
            break
        ans += 1
    print(ans)


Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <vector>
#include <array>

using namespace std;

int main(int argc, const char * argv[])
{
    string S;
    
    cin >> S;
    
    int count = 0;
    int countmax = 0;
    
    for (int i = 0; i < (int)(S.length()); i++)
    {
        if (S[i] == 'A' || S[i] == 'T' || S[i] == 'C' || S[i] == 'G') {
            count++;
        }else{
            count = 0;
        }
        
        if (countmax < count) {
            countmax = count;
        }
    }
    
    cout << countmax << endl;
    
    return 0;
}


Measured memory_bytes: 256
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())), dtype = np.int64)
a = np.bitwise_xor.reduce(A)
for i in range(60):
    bit = 1<<i
    if bit & a:
        A^=(A&bit)
for k in range(60, -1, -1):
    bit = 1<<k
    one = (A&bit != 0)
    i = np.where(one & (A < (1<<(k+1))))[0]
    if len(i) == 0:
        continue
    i = i[0]
    x = A[i]
    A[one]^=x
    A[i] = x
b = np.bitwise_xor.reduce(A)
a^=b
print(a+b)

Measured memory_bytes: 24276
#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define FOR(i, n) for (int i = 0; i < n; i++)
ll ans = 0;
vector<ll> height(51);
vector<ll> p(51);
void bi_search(ll pos, ll level) {  // pos is 1-index
  //cerr << "pos:" << pos << "\tlevel:" << level << "\tans:" << ans << endl;
  if (level == 1) {
    ans += (pos > 1) + (pos > 2) + (pos > 3);
    return;
  }

  if (pos >= height[level - 1] + 2) ans++;
  if (pos >= height[level - 1] + 1) ans += p[level - 1];
  if (pos == height[level - 1] + 1 || pos == height[level - 1] + 2) {
    return;
  }

  if (pos > height[level - 1] + 2) {
    bi_search(pos - height[level - 1] - 2, level - 1);
  } else if (pos < height[level - 1] + 1)
    bi_search(pos - 1, level - 1);
}

int main() {
  ll n, x;
  cin >> n >> x;
  // ll a,b,c;
  // string s;
  FOR(i, n + 1) {
    height[i] = i ? 3 + 2 * height[i - 1] : 1;
    p[i] = i ? 1 + p[i - 1] * 2 : 1;
   // cerr << "height[" << i << "]:" << height[i];
   // cerr << "\tp[" << i << "]:" << p[i];
   // cerr << endl;
  }
  bi_search(x, n);
  //  cout << ((  )? "YES" : "NO) <<endl;
  //  cout << ((  )? "Yes" : "No) <<endl;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var sn = 0L;
            for (var i = N; 0 < i; i /= 10)
                sn += i % 10;
            if (0 == N % sn)
                WriteLine("Yes");
            else
                WriteLine("No");
        }
 
        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 27984
// D - AtCoder Express

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int t[100];
float v[100];
float L[40001];

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

	for (int i=0; i<N; i++) {
		cin >> t[i];
		t[i] *= 2;
	}

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

	for (int i=0; i<40001; i++) {
		L[i] = INF;
	}

	int tot = 0;
	for (int i=0; i<N; i++) {
		int k = tot;
		tot += t[i];
		while (k <= tot) {
			L[k] = min(L[k], v[i]);
			k++;
		}
	}

	L[0] = 0;
	L[tot] = 0;

	for (int k=1; k<=tot; k++) {
		L[k] = min(L[k], L[k-1] + 1);
	}

	for (int k=tot-1; k>=0; k--) {
		L[k] = min(L[k], L[k+1] + 1);
	}

	float ans = 0;
	for (int k=0; k<=tot - 1; k++) {
		if (L[k+1] == L[k] + 1) {
			ans += L[k] + 0.5;
		} else if (L[k+1] == L[k] - 1) {
			ans += L[k] - 0.5;
		} else {
			ans += L[k];
		}
	}

	ans /= 4;
	cout << fixed << setprecision(10);
	cout << ans << endl;

	// **** debug ****
	/*
	for (int k=0; k<=tot; k++) {
		cout << k << " " << L[k] << endl;
	}
	*/

	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9

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

    vector<ll>A(N);
    map<ll,ll>B;  //mapの前の要素で引っ張り出せる、後ろからは引っ張り出せない 

    for(int i=0;i<N;i++){
        cin >> A[i];
        B[A[i]]++;  // mapの後ろの要素(int)が1プラスされた
    }

    ll sum=0;
    for(auto x:B){  // autoを使えば勝手に型を決めてくれる
        sum += x.second * (x.second-1) / 2;     // for auto xを用いればxの一番目から最後まで計算してくれる
    }

    ll ans;
    for(int i=0;i<N;i++){
        ans = sum - B[A[i]]*(B[A[i]]-1)/2 + (B[A[i]]-1)*(B[A[i]]-2)/2;
        cout << ans << endl;
    }


    
}

Measured memory_bytes: 12160