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

using namespace std;
using ll = long long;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount

int a[1000010];
void init(int s){
    a[0] = s;
    for (int i = 1; i < 1000001; i++)
    {
        if(a[i-1]%2==0){
            a[i] = a[i - 1] / 2;
        }else{
            a[i] = 3*a[i - 1] + 1;
        }
    }
}

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

    if(s==1||s==2){
        cout << 4 << endl;
        return 0;
    }

    init(s);

    int res;
    bool flg = false;

    for (int i = 0; i < 1000010; i++) {
        if(a[i]==4){
            if(!flg)
                flg = true;
            else{
                cout << i + 1 << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 4096
#include<stdio.h>

int main(){
	int a,b,c,p=0,q=0;

	while(scanf("%d,",&a)!=EOF){
			scanf("%d,%d",&b,&c);
			if(a==b)p++;
			else if(a*a+b*b==c*c)q++;
	}
	printf("%d\n%d\n",q,p);

	return 0;
}

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

using namespace std;

int a[512][512];

int getSum(int h1, int w1, int h2, int w2)
{
    return (a[h2][w2] - (h1 ? a[h1 - 1][w2] : 0) - (w1 ? a[h2][w1 - 1] : 0) + (h1 && w1 ? a[h1 - 1][w1 - 1] : 0));
}

int main()
{
    int n;
    
    scanf("%d", &n);
    
    int ans = -1001;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            scanf("%d", &a[i][j]);
            ans = max(ans, a[i][j]);
            if (i) a[i][j] += a[i - 1][j];
            if (j) a[i][j] += a[i][j - 1];
            if (i && j) a[i][j] -= a[i - 1][j - 1];
        }
    }
    
    for (int h1 = 0; h1 < n; h1++){
        for (int h2 = h1; h2 < n; h2++){
            int pmax = 0;
            for (int w = 0; w < n; w++){
                int tmp = getSum(h1, w, h2, w);
                ans = max(ans, tmp + pmax);
                pmax = max(pmax + getSum(h1, w, h1, w) + (h2 != h1 ? getSum(h2, w, h2, w) : 0), tmp);
            }
        }
    }
    
    printf("%d\n", ans);
    
    return (0);
}

Measured memory_bytes: 1792
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    n = I()
    a = LI()
    r = 0
    t = inf
    k = -1
    for c in a:
        if t >= c:
            k += 1
        else:
            if r < k:
                r = k
            k = 0
        t = c
    if r < k:
        r = k

    return r


print(main())



Measured memory_bytes: 16396
#[derive(Default)]
//NOTE
//declare variables to reduce the number of parameters for dp and dfs etc.
struct Solver {}

impl Solver {
    fn solve(&mut self) {
        let stdin = std::io::stdin();
        let mut scn = Scanner {
            stdin: stdin.lock(),
        };
        let n: usize = scn.read();
        let a: Vec<usize> = scn.vec(n);
        let x = a.iter().fold(0usize, |result, x| result ^ x);
        a.iter().for_each(|y| {
            print!("{} ", x ^ y);
        });
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| {
            let mut solver = Solver::default();
            solver.solve()
        })
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

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


Measured memory_bytes: 4084
def kaibun(s):
    l = len(s)
    # print(l)
    for i in range(l//2):
        # print(s[i],s[l-i-1])
        if s[i] != s[l-i-1]:
            return False
    return True

s = input()
N = len(s)

# print(kaibun(s))

if kaibun(s) and kaibun(s[:(N-1)//2]) and kaibun(s[(N+3)//2-1:]):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long a[100010],ans[100010];
long long n,now,sum,res;
signed main(){
	cin>>n;
	for(int i=0;i<=n;++i){
		cin>>a[i];
		sum+=a[i];
	}
	ans[0]=1;
	int t=n+1;
	for(int i=0;i<=n;i++){
		if(sum-now<ans[i]){
			t=i;
			break;
		}
		now+=a[i];
		ans[i+1]=(ans[i]-a[i])*2;
		if(ans[i+1]<0){
			puts("-1");
			return 0;
		}
	}
	sum=0;
	for(int i=n;i>=t;--i){
		sum+=a[i],ans[i]=sum;
	}
	for(int i=0;i<=n;++i){
		res+=ans[i];
	}
	cout<<res;
	return 0;
}

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

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

  int64_t cntR= 0;
  int64_t cntG= 0;
  int64_t cntB= 0;
  for(int i=0; i<N; i++){
    if(S.at(i)=='R'){ cntR++; }
    if(S.at(i)=='G'){ cntG++; }
    if(S.at(i)=='B'){ cntB++; }
  }

  int64_t ans= cntR* cntG* cntB;
  for(int i=0; i<N; i++){
    for(int j=i+1; j+(j-i)<N; j++){
      int k= j+(j-i);
      if(S.at(i)!=S.at(j) && S.at(j)!=S.at(k) && S.at(k)!=S.at(i)){ ans--; }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3632
object Main extends App {
  val n = scala.io.StdIn.readLine.toInt
  val list = List.fill(n)(scala.io.StdIn.readLine)
  for(i <- 0 until n) {
    val nlist = list(i).split(" ").map(_.toInt).sorted
    if(nlist(0)*nlist(0) + nlist(1)*nlist(1) == nlist(2)*nlist(2)) println("YES")
    else println("NO")
  }
}

Measured memory_bytes: 45428
#include<bits/stdc++.h>
using namespace std;
int a[300001],b[300001]={0},c[300001]={0};
int u=0;
int n;
int k;
int judge(int q,int k)
{
	int l=1,r=n,mid,ans;
	while(l<=r)
	{
		mid=(l+r)/2;
		if(b[mid]<q&&(mid==n||b[mid+1]>=q))
		{
			ans=mid;
			break;
		}
		else if(b[mid]<q) l=mid+1;
		else r=mid-1;
	}
	if((n-ans)*q+c[ans]>=k*q) return 1;
	else return 0;
}
int main(){
	cin>>n;
	int m=-1;
	for(int i=1;i<=n;++i)
	{
		int x;
		cin>>x;
		b[x]++;
	}
	sort(b+1,b+n+1);
	for(int i=1;i<=n;++i)
	{
		c[i]=c[i-1]+b[i];
	}
	int q=n;
	for(int i=1;i<=n;++i)
	{
		while(!judge(q,i))
		{
			q--;
		}
		cout<<q<<endl;
	}
	return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int64_t X,Y;

  cin >> X >> Y ;

  int64_t ans=1;

  while(X*2<=Y){
    X*=2;
    ans++;
  }

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

Measured memory_bytes: 256
N = int(input())
words = [input() for _ in range(N)]
a = words[0]
if len(set(words)) != N:
  print("No")
  exit()
for i in range(1, N):
  b = words[i]
  if a[-1] != b[0]:
    print("No")
    exit()
  else:
    a = b

print("Yes")
 

Measured memory_bytes: 3060
import bisect

N = int(input())

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A.sort()
C.sort()

ans = 0

#中央を固定する
for bi in B:
    #biより小さいものをAから絞り込む
    ai = bisect.bisect_left(A,bi)
    #biより大きいものをCから絞り込む
    ci = len(C) - bisect.bisect_right(C,bi)

    ans += ai * ci

print(ans)


Measured memory_bytes: 105596
package main

import "fmt"

var N, K int
var d, a int

func main() {
	fmt.Scan(&N, &K)
	as := make(map[int]int)
	for i:=1; i<=N; i++ {
		as[i] = 0
	}
	for i := 0; i < K; i++ {
		fmt.Scan(&d)
		for j := 0; j < d; j++ {
			fmt.Scan(&a)
			as[a]++
		}
	}
	ans := 0
	for _, v := range as {
		if v == 0 {
			ans++}
		}
		fmt.Println(ans)
}


Measured memory_bytes: 2340
N= int(input())
a = N//4 + 1
b= N//7+1
f = False
for i in range(0,a+1):
  if f:
    break
  for j in range(0,b+1):
    if N == 4*i+7*j:
      print('Yes')
      f = True
      break

if not f:
  print('No')
    


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

using ll = long long;
using pii = pair<ll, ll>;

constexpr ll INF = 1e18;

int main() {
    ll N, M, W, T;
    cin >> N >> M >> W >> T;
    map<string, int> idx;
    vector<ll> w(M), p(M);
    for(int i=0; i<M; ++i) {
        string s;
        cin >> s >> w[i] >> p[i];
        idx[s] = i;
    }

    vector<vector<pii>> value(N);
    vector<ll> x(N), y(N);
    for(int i=0; i<N; ++i) {
        int L;
        cin >> L >> x[i] >> y[i];
        for(int j=0; j<L; ++j) {
            string R;
            ll Q;
            cin >> R >> Q;
            int id = idx[R];
            value[i].emplace_back(w[id], p[id] - Q);
        }
    }

    vector<pii> cand;
    for(int S=0; S<1<<N; ++S) {
        vector<pii> used;
        vector<pii> pos;
        for(int i=0; i<N; ++i) {
            if((S >> i) & 1) {
                for(auto& p : value[i]) {
                    used.push_back(p);
                }
                pos.emplace_back(x[i], y[i]);
            }
        }
        ll d = INF;
        sort(pos.begin(), pos.end());
        do {
            ll t = 0;
            pii now = make_pair(0, 0);
            for(int i=0; i<pos.size(); ++i) {
                t += abs(now.first - pos[i].first) + abs(now.second - pos[i].second);
                now = pos[i];
            }
            t += abs(now.first) + abs(now.second);
            d = min(d, t);
        } while(next_permutation(pos.begin(), pos.end()));
        vector<ll> dp2(W+1, -1);
        dp2[0] = 0;
        ll max_v = 0;
        for(int i=0; i<used.size(); ++i) {
            ll w = used[i].first;
            ll v = used[i].second;
            for(int j=0; j+w<=W; ++j) {
                if(dp2[j] == -1) {
                    continue;
                }
                dp2[j+w] = max(dp2[j+w], dp2[j] + v);
                max_v = max(max_v, dp2[j+w]);
            }
        }
        if(d <= T) {
            cand.emplace_back(d, max_v);
        }
    }
    vector<ll> dp(T+1, -1);
    dp[0] = 0;
    for(int i=0; i<cand.size(); ++i) {
        ll t = cand[i].first;
        for(int j=0; j+t<=T; ++j) {
            if(dp[j] == -1) {
                continue;
            }
            dp[j+t] = max(dp[j+t], dp[j] + cand[i].second);
        }
    }
    cout << *max_element(dp.begin(), dp.end()) << endl;
}


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


int main() {
	long long A, B, K;

	cin >> A >> B >> K;

	if (A - K < 0) {
		K -= A;
		cout << 0 << " ";
		if (B - K < 0)cout << 0;
		else cout << B - K;
	}
	else {
		cout << A - K << " ";
		cout << B;
	}
	

}


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

#define int long long
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; }

signed main(){
	double r;
	cin >> r;

	printf("%.12lf\n", 2 * M_PI * r);

	return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int A = 0;
  vector<int> v(N);
  for (int i = 0; i < N; i++){
    cin >> v.at(i);
  }
  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      if (v.at(j) == -1){
        continue;
      }
      if (v.at(i) == v.at(j)){
        v.at(j) = -1;
        A++;
      }
    }
  }
  cout << N - A<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
int sBCum[101010], tBCum[101010];

int main(){
    
    // 1. 入力情報.
    char S[101010], T[101010];
    int Q;
    scanf("%s %s %d", S, T, &Q);
    
    // 2. 文字列S, T の それぞれについて, 'B' の 累積和 を 計算.
    int sl = strlen(S);
    int tl = strlen(T);
    rep(i, sl) sBCum[i + 1] = sBCum[i] + (S[i] == 'B');
    rep(i, tl) tBCum[i + 1] = tBCum[i] + (T[i] == 'B');
    
    // 3. クエリ回答.
    // 各部分文字列について, 'B' の 個数を, 3で割った余りが同じか否かを見る.
    rep(i, Q){
        int a, b, c, d;
        scanf("%d %d %d %d", &a, &b, &c, &d);
        
        // 3-1. S の 部分文字列.
        // S の 部分列について, 'B' の 個数.
        int sB = sBCum[b] - sBCum[a - 1];
        // 'A' を 'BB' に 変換したものも加算.
        sB += 2 * (b - a + 1 - sB);
        // 3で割った余り.
        sB %= 3;
        
        // 3-2. T の 部分文字列.
        // T の 部分列について, 'B' の 個数.
        int tB = tBCum[d] - tBCum[c - 1];
        // 'A' を 'BB' に 変換したものも加算.
        tB += 2 * (d - c + 1 - tB);
        // 3で割った余り.
        tB %= 3;
        
        // 3-3. 判定.
        bool ok = (sB == tB);
        printf("%s\n", ok ? "YES" : "NO");
    }
    return 0;
    
}

Measured memory_bytes: 4728
#!/usr/bin/env python3
import math

def main():
    Q = int(input())
    A = []
    B = []
    for i in range(Q):
        na = list(map(int, input().split()))
        A.append(na[0])
        B.append(na[1])

    for i in range(Q):
        a, b = A[i], B[i]

        if a == b:
            print(a * 2 - 2)
            continue

        c = a * b
        d = int(math.sqrt(c))
        if d * (d + 1) < c:
            print(d * 2 - 1)
        elif d ** 2 == c:
            print(d * 2 - 3)
        else:
            print(d * 2 - 2)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main() {
	long long a, b, c;
	cin >> a >> b >> c;
	if (a % 2 + b % 2 + c % 2 < 3)cout << 0 << endl;
	else {
		long long min = a*b;
		if (min > b*c)min = b * c;
		if (min > a*c)min = a * c;
		cout << min << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int d[100][100];

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,e; cin>>n>>e;
	For(i,0,n-1) For(j,0,n-1){
		if(i==j) d[i][j]=0;
		else d[i][j]=INF;
	}
	int s,t,w;
	vector<pair<pii,int>> ve;
	For(i,0,e-1){
		cin>>s>>t>>w;
		s--; t--;
		d[s][t]=min(d[s][t],w);
		d[t][s]=min(d[t][s],w);
		ve.push_back({{s,t},w});
	}
	For(k,0,n-1) For(i,0,n-1) For(j,0,n-1)
		d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	int ans=0;
	for(auto &i:ve){
		s=i.F.F; t=i.F.S; w=i.S;
		if(d[s][t]<w) ans++;
	}
	cout<<ans<<'\n';
	return 0;
}





























Measured memory_bytes: 384
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int cnt = 0;

		for (int i = 1; i <= n; i++) {
			int p = sc.nextInt();
			if (p != i)
				cnt++;
		}

		System.out.println(cnt <= 2 ? "YES" : "NO");

		sc.close();
	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <deque>

int main(){
  int N;
  scanf("%d", &N);
  std::vector<std::vector<int > > dp(5, std::vector<int > (N+4, 0));
  for (int i=0; i<=N; i++){
    dp[1][i] = i;
  }
  std::vector<int > power6;
  std::vector<int > power9;
  int counter = 0;
  int multiple = 6;
  while(true){
    power6.push_back(multiple);
    counter++;
    multiple *= 6;
    if (multiple>N){
      break;
    }
  }
  counter = 0;
  multiple = 9;
  while(true){
    power9.push_back(multiple);
    counter++;
    multiple *= 9;
    if (multiple>N){
      break;
    }
  }
  //printf("0000000\n");
  counter = 0;
  while(counter<=N){
    int index = 0;
    dp[2][counter] = dp[1][counter];
    while(index<power6.size() && counter>=power6[index]){
      dp[2][counter] = std::min(dp[2][counter], dp[2][counter-power6[index]]+1);
      index++;
    }
    counter++;
  }

  counter = 0;
  while(counter<=N){
    int index = 0;
    dp[3][counter] = dp[2][counter];
    while(index<power9.size() && counter>=power9[index]){
      dp[3][counter] = std::min(dp[3][counter], dp[3][counter-power9[index]]+1);
      index++;
    }
    counter++;
  }

  printf("%d\n", dp[3][N]);
  return 0;
}


Measured memory_bytes: 2560
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

long long int num[51] = {};
long long int patnum[51] = {};

long long int solve(int n, long long int x)
{
	if(x == 0) return 0;
	if(n == 0) return 1;
	if(x <= num[n - 1] + 1) return solve(n - 1, x - 1);
	else return patnum[n - 1] + solve(n - 1, x - num[n - 1] - 2) + 1;
}


int main()
{
	int n;
	long long int x;
	cin >> n >> x;

	num[0] = 1;
	patnum[0] = 1;
	for(int i = 1; i <= n; i++){
		num[i] = 2 * num[i - 1] + 3;
		patnum[i] = 2 * patnum[i - 1] + 1;
	}

	cout << solve(n, x) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    int n;
    cin>>n;
    bool flag=false;
    while(n>0){
        if(n%10==7)
            flag=true;
        n/=10;
    }
    if(flag){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    solve();
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
#include<unordered_map>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind
#define rt (a); return (a); 
#define Pint pair<int,int>
#define Pll pair<ll,ll>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}
int n,q;
hei(ll) seg, lazy;

void aaa(int k) {
	if (lazy[k] == 0)return ;
	if (k < n - 1) {
		lazy[k * 2 + 1] += lazy[k];
		lazy[k * 2 + 2] += lazy[k];
	}
	seg[k] += lazy[k];
	lazy[k] = 0;
}

void update(int a, int b, ll x,int k,int l,int r) {
	aaa(k);
	if (a<=l && b>=r) {
		lazy[k] += x;
		aaa(k);
	}
	else if(a<r&&l<b){
		update(a, b, x, k * 2 + 1, l, (l + r) / 2);
		update(a, b, x, k * 2 + 2, (l + r) / 2, r);
		seg[k] = seg[k * 2 + 1]+seg[k * 2 + 2];
	}
}

ll query(int a,int b,int k,int l,int r){
	aaa(k);
	if (l >= b || r <= a)return 0;
	if (a <=l  && b >= r) {
		return seg[k];
	}
	ll v1 = query(a, b, k*2+1, l, (l + r) / 2);
	ll v2 = query(a, b, k*2+2, (l + r) / 2, r);
	return v1 + v2;
}

int main() {
	int n;
	string s;
	cin >> n >> s;
	ll ans = 1;
	map<char, llint> z;
	rep(i, 0, n)z[s[i]]++;
	for (auto x : z) {
		ans *= (x.second + 1);
		ans %= mod;
	}
	ans=(ans - 1 + mod) % mod;
	cout << ans << endl;
	return 0;
}

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

int main() {
    priority_queue<long long> pq;
    int N, M, a;
    cin >> N >> M;
    for (int i = 0; i < N; i++) {
        cin >> a;
        pq.push(a);
    }
    for (int i = 0; i < M; i++) {
        long long t = pq.top();
        pq.pop();
        pq.push(t / 2);
    }
    long long sum = 0;
    while (!pq.empty()) {
        sum += pq.top();
        pq.pop();
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1400
#include <stdio.h>
int main(void){
    // Your code here!
   int a,b;
    while(scanf("%d %d",&a,&b)!=EOF){
        int m = a, n = b;
        int r = m % n;
        while(r != 0){
            m = n;
            n = r;
            r = m % n;
        }
        
        int gcd = n;
        int lcm = a / n * b;
        printf("%d %d\n",gcd,lcm);
        
    }
}



Measured memory_bytes: 2032
/**********************************************

1.
2.炭田高輝
3.sumita.takaki@gmail.com

last updated: 2013-07-10@12:02

 **********************************************/
#include<iostream>
#include<algorithm>
#include<sstream>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
using namespace std;

int main (void){
        

        while(1){
                int minute=0;
                int total=0;


                for(int i=0; i<4; i++){
                        cin >> minute;
                        total = total + minute;                        
                }

                if(minute == NULL)break;

                int x = total/60;
                int y = total%60;

                cout << x << endl;
                cout << y << endl;

        }


}

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

  
int main()
{
       
	   int i,j,n,m;
     
    	cin>>n;
    	vector<ll>ara(n);
    	ll X=0,x=0,ans=INT_MAX;
    	
	 for(i=0;i<n;i++)
     {
     	cin>>ara[i];
     	X+=ara[i];
	 }
	 
	 for(i=0;i<n;i++)
	 {
	 	x+=ara[i];
	 	if(i+1<n)ans=min(ans,abs(X-2*x));
	 	 
	 }
	 
	 cout<<ans<<endl;
	 
    return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s; cin>>s;
	if(s.size()%2==1)s.pop_back();
	for(int i=s.size()-2;i>=2;i-=2){
		bool yes=true;
		for(int j=0,k=i/2;j<i/2;++j,++k){
			if(s.at(j)!=s.at(k))yes=false;
		}
		if(yes){
			cout<<i<<"\n"s;
			break;
		}
	}
}

Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var d = int.Parse(Console.ReadLine());
            var c = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            var s = new List<List<int>>();
            for (int i = 0; i < d; i++)
            {
                s.Add(Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList());
            }

            int[] last = new int[26];
            int res = 0;
            for (int i = 0; i < d; i++)
            {
                var t = int.Parse(Console.ReadLine());
                res += s[i][t - 1];
                last[t - 1] = i + 1;

                for (int j = 0; j < 26; j++)
                {
                    res -= (((i+1) - last[j]) * c[j]);
                }
                Console.WriteLine(res);
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28892
while True:
  m, f, r = map(int, input().split())
  g=m+f
  if m == -1 and f == -1 and r == -1:
    break
  if m == -1 or f == -1 or g<30:
    print("F")
  elif g >= 80:
    print("A")
  elif g >= 65:
    print("B")
  elif g >= 50:
    print("C")
  elif g >= 30:
    if r>=50:
      print("C")
    else:
      print("D")


Measured memory_bytes: 5592
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n; cin >> n;
    vector<ll> h(n);
    REP(i, n) cin >> h[i];
    
    REP(i, n) {

        if (i == 0) {
            h[i]--;
        } else {
            if (h[i-1] < h[i]) {
                h[i]--;
            } else if (h[i-1] > h[i]) {
                cout << "No" << endl;
                return 0;
            }
        }

    }

    cout << "Yes" << endl;
    return 0;
    
}

Measured memory_bytes: 1024
#include <stdio.h>
int main(){
  int x;
  int i;
  int flag=0;
  scanf("%d",&x);
  
  while(1){
    for(i=2;i<x;i++){
      	if(x%i==0){
          flag=1;
          break;
        }
    }
    if(flag==1){
      x++;
      flag=0;
    } else {
      break;
    }
  }
  printf("%d",x);
}


Measured memory_bytes: 128
A = []
for _ in range(3):
    temp = [int(s) for s in input().split()]
    A += temp
# print(A)

N = int(input())
# print(N)

b_list = [int(input()) for _ in range(N)]
# print(b_list)

R = [False] * 9
for i, n in enumerate(A):
    R[i] = n in b_list


def check_bingo(table, check_index):
    for i in check_index:
        if not table[i]:
            return False
    return True

def check_table(table):
    check_list = [
        [0, 1, 2],
        [3, 4, 5],
        [6, 7, 8],
        [0, 3, 6],
        [1, 4, 7],
        [2, 5, 8],
        [0, 4, 8],
        [2, 4, 6],
    ]

    for check_index in check_list:
        if check_bingo(table, check_index):
            return True
    return False


result = "Yes" if check_table(R) else "No"
print(result)


Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
  int n;
  int i, j;
  int is_prime[1000000];
  int cnt;

  for (i = 0; i < 1000000; i++){
    is_prime[i] = 1;
  }

  is_prime[0] = 0;
  is_prime[1] = 0;

  for (i = 0; i * i < 1000000; i++){
    if (is_prime[i] == 1){
      for (j = i + i; j < 1000000; j += i){
        is_prime[j] = 0;
      }
    }
  }

  while (scanf("%d", &n)){
    if (n == 0){
      break;
    }

    cnt = 0;

    for (i = 0; i <= n / 2; i++){
      if ((is_prime[i] == 1) && (is_prime[n - i] == 1)) {
        cnt++;
      }
    }

    printf("%d\n", cnt);
  }

  return (0);
}

Measured memory_bytes: 6484
n = gets.chomp.to_i
hash = {}
n.times do
	s = gets.chomp
	hash[s] = hash.has_key?(s) ? hash[s] + 1 : 1
end
max = hash.to_a.transpose[1].max
puts hash.to_a.select{|hh| hh[1] == max}.sort{|a,b| a[0] <=> b[0]}.transpose()[0]

#.sort{|a,b| a[0] <=> b[0]}

Measured memory_bytes: 49088
(n, m) = map(int, input().split())
s = []
for _ in range(m):
    s.append(list(map(int, input().split()))[1:])
p = list(map(int, input().split()))


def make_mask(n, switch_indices):
    ans = [0 for _ in range(n)]
    for index in switch_indices:
        ans[index-1] = 1
    ans_int = 0
    for i in range(n):
        if ans[i] == 1:
            ans_int += 2 ** i
    return ans_int


masks = []
for s_i in s:
    masks.append(make_mask(n, s_i))


c = 0
for i in range(2 ** n):
    state = str(bin(i))
    is_all_on = True
    for j in range(m):
        result = i & masks[j]
        if p[j] != str(bin(result)).count("1") % 2:
            is_all_on = False
            break
    if not is_all_on:
        continue
    c += 1
print(c)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int fa[N],siz[N],n,m,x[N],y[N];
long long ans[N],sum=0;
int getf(int x)
{
	return x==fa[x]?x:fa[x]=getf(fa[x]);
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
	{
		scanf("%d%d",&x[i],&y[i]);
	 } 
	 for (int i=1;i<=n;i++) fa[i]=i,siz[i]=1;
	 sum=(long long)n*(n-1)/2;
	 for (int i=m;i>=1;i--)
	 {
	 	ans[i]=sum;
	 	int t1=getf(x[i]),t2=getf(y[i]);
	 	if (t1!=t2) {
	 		sum-=(long long)siz[t1]*siz[t2];
	 		fa[t1]=t2;
	 		siz[t2]+=siz[t1];
		 }
		//ans[i]=sum;
	 }
	 for (int i=1;i<=m;i++) printf("%lld\n",ans[i]);
	 return 0;
 } 

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

int main() {
    // 制約見て！！！デカかったらlong longにすること！
    int n;
    cin >> n;
    vector<int> a1(n);
    vector<int> a2(n);
    rep(i, n) cin >> a1[i];
    rep(i, n) cin >> a2[i];
    int ans = 0, current = 0;
    rep(i, n) {
        current = 0;
        rep(j, i + 1) current += a1[j];
        for(int k = i; k < n; k++)
            current += a2[k];

        ans = max(ans, current);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

#define fastio                              ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
#define read                                freopen("input.txt", "r", stdin);
#define write                               freopen("output.txt", "w", stdout);
#define nl                                  '\n'
#define LCM(a,b)                            (a / __gcd(a,b) ) *b
#define GCD(a,b)                            __gcd(a,b)

#define ll                                  long long
#define vi                                  vector<int>
#define pb                                  push_back
#define vpii                                vector<pair<int, int>>
#define mp                                  make_pair
#define ff                                  first
#define ss                                  second
#define all(v)                              v.begin(), v.end()
#define rsort(v)                            sort(v.rbegin(), v.rend())

using namespace std;

const double pi = 2*acos(0.0);

int main() {
    fastio;
    int n; cin >> n;
    if(n&1) n++;
    cout << n/2;

}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/05  Problem: ABC 095 A / Link: http://abc095.contest.atcoder.jp/tasks/abc095_a  ----- */


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

	string s; cin >> s;
	LL ans = 7;
	for (auto c : s) {
		if (c == 'o')ans++;
	}
	ans *= 100;
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){

  int i,a,min,max;


  int b[10000];


  long long sum;


  sum = 0;


  min = 1000000;


  max = -1000000;


  scanf("%d",&a);


  for(i=0;i<a;i++){


    scanf("%d",&b[i]);


      if(b[i] < min){


        min = b[i];


        }


      if(b[i] > max){


        max = b[i];


        }


      sum = sum + b[i];


  }


  printf("%d %d %lld\n",min,max,sum);


return 0;


}

Measured memory_bytes: 640
#include<iostream>
#include<string>

using namespace std;

int main(){
	string str1,str2;
	
	while(cin>>str1>>str2 && str1!="0" &&str2!="0"){
		int h=0,b=0;
		for(int i=0;i<str1.size();i++){
			int tmp=str2.find(str1[i]);
			if(tmp==i)h++;
			else if(tmp!=string::npos)b++;
		}
		cout<<h<<" "<<b<<endl;
	}
}

Measured memory_bytes: 1184
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (ll i = m; i < n; ++i)
#define FORR(i, m, n) for (ll i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
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; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<int> x(n),b(n);
    vector<pair<int,int>> p(n);
    REP(i,n){
        cin >> x[i];
        p[i]={x[i],i};
    }
    sort(ALL(p));
    REP(i,n){
        if(i<n/2){
            b[p[i].second]=p[n/2].first;
        }
        else{
            b[p[i].second]=p[n/2-1].first;
        }
    }
    REP(i,n){
        cout << b[i] << endl;
    }
}

Measured memory_bytes: 6368
S = input()

ky = 'keyence'

lky = len(ky)
#for i in range(lky):
    # print(keyence[:i] + keyence[-(lky-i):])

tf = [all({S[:i] == ky[:i], S[-(lky-i):] == ky[-(lky-i):]}) for i in range(lky)]
    
if any(tf):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
using lint = long long;

int mod;

struct mint {
	int val;
	mint() { val = 0; }
	mint(const lint& v) {
		val = (-mod <= v && v < mod) ? v : v % mod;
		if (val < 0) val += mod;
	}

	friend ostream& operator<<(ostream& os, const mint& a) { return os << a.val; }
	friend bool operator==(const mint& a, const mint& b) { return a.val == b.val; }
	friend bool operator!=(const mint& a, const mint& b) { return !(a == b); }
	friend bool operator<(const mint& a, const mint& b) { return a.val < b.val; }

	mint operator-() const { return mint(-val); }
	mint& operator+=(const mint& m) { if ((val += m.val) >= mod) val -= mod; return *this; }
	mint& operator-=(const mint& m) { if ((val -= m.val) < 0) val += mod; return *this; }
	mint& operator*=(const mint& m) { val = (lint)val*m.val%mod; return *this; }
	friend mint ipow(mint a, lint p) {
		mint ans = 1; for (; p; p /= 2, a *= a) if (p&1) ans *= a;
		return ans;
	}
	friend mint inv(const mint& a) { assert(a.val); return ipow(a, mod - 2); }
	mint& operator/=(const mint& m) { return (*this) *= inv(m); }

	friend mint operator+(mint a, const mint& b) { return a += b; }
	friend mint operator-(mint a, const mint& b) { return a -= b; }
	friend mint operator*(mint a, const mint& b) { return a *= b; }
	friend mint operator/(mint a, const mint& b) { return a /= b; }
	operator int64_t() const {return val; }
};

mint ez(int n, int k){
	vector<mint> dp(n + 2);
	dp[0] = mint(1);
	for(int i=1; i<=n+1; i++){
		for(int j=1; j<=k+1 && j<=i; j++){
			dp[i] += dp[i - j];
		}
	}
	return dp[n + 1];
}

vector<int> v;
int dp[155][155][155], n, k;

mint f(int pos, int l, int r){
	if(r >= k + 2) return mint(0);
	if(pos == sz(v)) return mint(1);
	if(~dp[pos][l][r]) return dp[pos][l][r];
	mint ret = f(pos + 1, 0, 0);
	if(v[pos] & 1){
		ret += f(pos + 1, l + 1, 0);
	}
	if(v[pos] & 2){
		ret += f(pos + 1, 0, r ? (r + 1) : 0);
	}
	if(v[pos] == 3){
		ret += f(pos + 1, l + 1, max(l + 2, r + 1));
	}
	return dp[pos][l][r] = (lint)ret;
}

int main(){
	cin >> n >> k >> mod;
	if(k % 2 == 0){
		cout << ez((n + 1) / 2, k / 2) * ez(n / 2, k / 2) << endl;
		return 0;
	}
	memset(dp, -1, sizeof(dp));
	for(int i=1; i<=n+n; i+=2){
		if(i - k > n) break;
		int msk = 0;
		if(i <= n) msk |= 1;
		if(i - k >= 1) msk |= 2;
		v.push_back(msk);
	}
	cout << f(0, 0, 0) << endl;
}



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

int main(){
	string a,b;cin>>a>>b;
	int d=stoi(a+b);
	puts((int)sqrt(d)*(int)sqrt(d)==d?"Yes":"No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
#include <iomanip>
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; }
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
constexpr int MOD = 1000000007;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}


ll modpow(ll a,ll p){
    if(p==0) return 1;
    if(p%2==0){
        ll halfp = p/2;
        ll half = modpow(a,halfp);
        return half * half % MOD;
    }else{
        return a * modpow(a,p-1) % MOD;
    }
}

ll calcComb(ll a,ll b){
    if (b > a-b){
        return calcComb(a,a-b);
    }
    ll ansMul = 1;
    ll ansDiv = 1;
    REP(i,b){
        ansMul *= (a - i);
        ansDiv *= (i + 1);
        ansMul %= MOD;
        ansDiv %= MOD;
    }
    ll ans = ansMul * modpow(ansDiv,MOD-2) ;
    ans %= MOD;
    return ans;
}

int main ()
{
    ll N;cin>>N;
    ll sum = 0;
    for (ll i = 1; i * i< N ; i++)
    {
        if(N%i==0){
            ll tmp = N/i-1;
            if(N/tmp == i){
            sum += N/i-1;
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}

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

typedef struct {
    double x;
    double y;
}P;

void koch(int,P,P);

int main(){
    P p1,p2;
    int n;
    
    p1.x=0.0;
    p1.y=0.0;
    p2.x=100.0;
    p2.y=0.0;
    
    scanf("%d",&n);
    
    printf("%.8f %.8f\n",p1.x,p1.y);
    
    koch(n,p1,p2);
    
    printf("%.8f %.8f\n",p2.x,p2.y);
    
    return 0;
    
}

void koch(int d,P a,P b){
    P s,t,u;
    double rad;
    
    if(d==0) return;
    
    s.x=(2*a.x+b.x)/3.0;
    s.y=(2*a.y+b.y)/3.0;
    t.x=(a.x+2*b.x)/3.0;
    t.y=(a.y+2*b.y)/3.0;
    
    rad=60.0*M_PI/180.0;
    u.x=(t.x-s.x)*cos(rad)-(t.y-s.y)*sin(rad)+s.x;
    u.y=(t.x-s.x)*sin(rad)+(t.y-s.y)*cos(rad)+s.y;
    
    koch(d-1,a,s);
    printf("%.8f %.8f\n",s.x,s.y);
    koch(d-1,s,u);
    printf("%.8f %.8f\n",u.x,u.y);
    koch(d-1,u,t);
    printf("%.8f %.8f\n",t.x,t.y);
    koch(d-1,t,b);
    
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
#define mo 1000000007
#define M 100000
long long ksm(long long a,int k) {
    long long s=1;
    while(k)
	{
	    if(k&1) s=s*a%mo;
	    a=a*a%mo;
	    k>>=1;
	}
    return s;
}
int n,m;
#define lowbit(x) (x&-x)
int s[20],a[20],ct[M+5];
long long ans,jc[M+5],nc[M+5],f[20][M+5];
int main()
{
    //freopen("1.in","r",stdin);
    cin>>n>>m;
    s[0]=1;
    for(int i=1;i<=n;i++) s[i]=s[i-1]<<1;
    for(int i=1;i<s[n];i++) ct[i]=ct[i-lowbit(i)]+1;
    for(int i=1;i<=m;i++) cin>>a[i];
    jc[0]=1;
    for(int i=1;i<=s[n];i++) jc[i]=jc[i-1]*i%mo;
    nc[s[n]]=ksm(jc[s[n]],mo-2);
    for(int i=s[n]-1;i>=0;i--) nc[i]=nc[i+1]*(i+1)%mo;
    f[m+1][0]=1;
    for(int i=m;i>=1;i--)
	for(int j=0;j<s[n];j++)
	    {
		f[i][j]=(f[i][j]+f[i+1][j])%mo;
		int res=s[n]-1-j;
		for(int k=1;k<=n;k++)
		    {
			if(j&s[k-1]) continue ;
			f[i][j|s[k-1]]=(f[i][j|s[k-1]]+jc[res-a[i]+1]*nc[res-a[i]-s[k-1]+2]%mo*s[k-1]%mo*f[i+1][j]%mo)%mo;
		    }
	    }
    for(int i=0;i<s[n];i++) ans=((ans+(ct[i]&1?-1:1)*f[1][i]*jc[s[n]-1-i]%mo)%mo+mo)%mo;
    ans=ans*s[n]%mo;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 16384
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans[ohara], a, b, c, d[ohara], tmp, m, h, w, x, y, sum, k, q;
struct edge {
  ll to, cost;
};
vector<edge> g[1000000];

void dijkstra(ll s) {
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> que;
  fill(d, d + n, LINF);
  d[s] = 0;
  que.push(pair<ll, ll>(0LL, s));
  while (!que.empty()) {
    pair<ll, ll> p = que.top();
    que.pop();
    ll v = p.second;
    if (d[v] < p.first) continue;
    rep(i, Size(g[v])) {
      edge e = g[v][i];
      if (d[e.to] > d[v] + e.cost) {
        d[e.to] = d[v] + e.cost;
        que.push(pair<ll, ll>(d[e.to], e.to));
      }
    }
  }
}

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

  cin >> n >> x >> y;
  x--;
  y--;
  rep(i, n) {
    g[i].p_b({i + 1, 1LL});
    g[i + 1].p_b({i, 1LL});
  }
  g[x].p_b({y, 1LL});
  g[y].p_b({x, 1LL});
  rep(i, n) {
    dijkstra(i);
    rep(j, n) { ans[d[j]]++; }
  }
  rrep(i, 1, n) Cout(ans[i] / 2);
  return 0;
}

Measured memory_bytes: 27008
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
	FIO;
	int a, b, c; cin >> a >> b >> c;
	swap(a, b);
	swap(a, c);

	cout << a << ' ' << b << ' ' << c << '\n';
	return 0;
}

Measured memory_bytes: 256
def s(a,i,b,c):
	return  b==sorted(b) and c==sorted(c) if i==10 else s(a,i+1,b+[a[i]],c) or s(a,i+1,b,c+[a[i]])
	
for roop in range(int(raw_input())):
	print "YES" if s(map(int,raw_input().split()),0,[],[]) else "NO"

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

int main(){
    ios_base::sync_with_stdio(false);
    int n,x,t;
    cin>>n>>x>>t;
    int sm = n/x;
    if((n%x)!=0){
        sm++;
    }  
    cout<<sm*t;
    return 0;
}
                                                                               
                       

Measured memory_bytes: 3596