akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define MN 300
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n,K,mod,f[MN+5][MN+5],g[MN+5][MN+5],C[MN+5][MN+5];
int main()
{
    n=read();K=read();mod=read();
    for(int i=0;i<=n;++i) C[i][0]=1;
    for(int i=1;i<=n;++i) for(int j=1;j<=i;++j) C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
    for(int i=1;i<=n+1;++i) for(int j=0;j<=K;++j) f[0][j]=1,g[0][j]=K-j+1;
    for(int i=1;i<=n;++i)
    {
        for(int k=1;k<=i;++k) for(int v=0;v<=K;++v)
            f[i][v]=(f[i][v]+1LL*g[k-1][v+1]*f[i-k][v]%mod*C[i-1][k-1])%mod;
        for(int v=K;v;--v) g[i][v]=(g[i][v+1]+f[i][v])%mod;
    }
    printf("%d\n",f[n][0]);
	return 0;
}


Measured memory_bytes: 1280
N = gets.to_i

pys = []
2.times do
  pys << gets.split.map(&:to_i)
end

i = 0

result = 0

while i < N
	if pys[0][i] - pys[1][i] > 0
		result += pys[0][i] - pys[1][i]
	else
	end
	i += 1
end

puts result

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
const int INF = (int)2e9 + 1;
const long long LINF = (long long)9e18 + 1;

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

  int N;
  cin >> N;
  vector<pair<int, int>> location(N);
  for (auto &v : location) {
    int x, y;
    cin >> x >> y;
    v = make_pair(x, y);
  }
  long double sum = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      sum += 2 *
             sqrt(pow(location[i].first - location[j].first, 2) +
                  pow(location[i].second - location[j].second, 2)) /
             N;
    }
  }

  cout << sum << endl;

  return 0;
}


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

int main(){
	int d,g;
	cin >> d >> g;
	vector<int> p(d),c(d);
	for(int i=0; i<d; i++){
		cin >> p[i] >> c[i];
	}
	int ans = 1e9;
	for(int i=0; i<(1<<d); i++){
		int sub=0, point=0;
		for(int j=0; j<d; j++){
			if(i>>j & 1){
				point += p[j]*(j+1)*100 +c[j];
				sub += p[j];
			}
		}
		bool ng = false;
		if(point < g){
			for(int j=d-1; j>=0; j--){
				if(!(i>>j & 1)){
					int num = (g-point +(j+1)*100 -1)/((j+1)*100);
					if(num <= p[j]){
						sub += num;
					}else{
						ng = true;
					}
					break;
				}
			}
		}
		if(ng) continue;
		ans = min(ans, sub);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n;cin>>n;
    int arr[n];
    for (int i=0;i<n;i++)cin>>arr[i];
    int r[9]={0};
    for (int i=0;i<n;i++){
        if (arr[i]>=3200)arr[i]=3200;
        r[arr[i]/400]++;
    }int ans=0;
    for (int i=0;i<8;i++){
        if (r[i])ans++;
    }cout<<max(ans,1)<<' '<<ans+r[8];
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <map>
#include <queue>
#include <list>

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define INF 1e9
#define vint vector<int>

using namespace std;
typedef long long  ll;

const long long MOD = 1e9+7;

int main(){
    string n;
    cin >> n;
    REP(i, 0, 3){
        if(n[i] == '7'){
            p("Yes");
            return 0;
        }
    }

    p("No");
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
#define Mod 998244353
#define MOD 1000000007
using namespace std;
using lint = long long;
using vi = vector<lint>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<lint, lint>;

// cout << fixed << setprecision(12)

lint modpow(lint a, lint n, lint m = MOD){
  lint ans = 1;
  while(n>0){
    if(n%2==1) ans *= a; 
    ans %= m;
    a *= a; 
    a %= m;
    n /= 2;
  }
  return ans;
}

lint inv(lint a, lint m = MOD){
  return modpow(a, m-2, m);
}

///////////////////////////////////

int main(){
  string S; cin>>S;
  
  lint ans = 0;
  
  for(lint i=0; i<3; i++){
    if(S[i]=='R') ans++;
  }
  
  if(S=="RSR") ans = 1;
  
  cout << ans << endl;
}


Measured memory_bytes: 3624
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;


long long dp[51][5001];

int main() {

    int n, a;
    cin >> n >> a;
    vector<int> x(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }

    sort(x.begin(), x.end());
    for (int i = 0; i < n; i++) {
        x[i] -= a;
    }
    memset(dp, 0, sizeof(dp));
    dp[0][2500] = 1;
    for (int i = 1; i <= n; i++) {
        for (int k = 0; k < 5001; k++) {
            if (k - x[i - 1] >= 0 && k - x[i - 1] < 5001)
                for (int j = 0; j < i; j++)
                    dp[i][k] += dp[j][k - x[i - 1]];
        }
    }
    long long sumx = 0;
    for (int i = 1; i <= n; i++) {
        sumx += dp[i][2500];
    }
    cout << sumx << endl;




    return 0;
}

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

const int q=1000000007;
int main(){
unsigned long ans, K, Aten=0, F=0;
int N; cin >> N >> K;
int A[N], Ainc[N]={};
for(int i=0; i<N; i++){ cin >> A[i]; }
for(int i=0; i<N; i++){
  for(int j=0; j<N; j++){
    if(A[j]<A[i]){ Ainc[i]++; }
    if(i<j && A[i]>A[j]){ Aten++; }
  }
  F+=Ainc[i];
}
unsigned long KC2=(K*(K-1)/2)%q;
ans=((K*Aten)+(KC2*F))%q;
cout << ans << "\n";
}


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

int main() {
    int64_t n, a;
    cin >> n >> a;
    vector<int64_t> x(n);
    for (auto& e : x) cin >> e;

    vector<vector<vector<int64_t>>> dp(n+1, vector<vector<int64_t>>(n*a+1, vector<int64_t>(n+1)));
    dp[0][0][0] = 1;
    for (int64_t i = 0; i < n; i++) {
        for (int64_t s = 0; s <= n*a; s++) {
            for (int64_t j = 0; j <= n; j++) {
                dp[i+1][s][j] += dp[i][s][j];
                if (s+x[i] <= n*a) dp[i+1][s+x[i]][j+1] += dp[i][s][j];
            }
        }
    }

    int64_t ans = 0;
    for (int64_t j = 1; j <= n; j++) ans += dp[n][j*a][j];
    cout << ans << endl;
}


Measured memory_bytes: 56064
H, W, K = map(int, input().split(' '))
ls, rst = [], 0
for i in range(H):
    ls.append(input())
for i in range(1 << H):
    for j in range(1 << W):
        cnt = 0
        for s in range(H):
            if i >> s & 1:
                continue
            for t in range(W):
                if j >> t & 1:
                    continue
                if ls[s][t] == '#':
                    cnt += 1
        if cnt == K:
            rst += 1
print(rst)

Measured memory_bytes: 8960
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

ans = 'NO'

if A < B:
  AT = A + V*T
  BT = B + W*T
  if(BT <= AT):
    ans = 'YES'
else:
  AT = A - V*T
  BT = B - W*T
  if(BT >= AT):
    ans = 'YES'
    
print(ans)

Measured memory_bytes: 9192
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

int size (int n) {
    int s = 0;
    for (int j = 0;; j++) {
        if (n == 0) {
            s = 1;
            break;
        }
        else if ((pow(10, j)) <= n and n < (pow(10, j + 1))) {
            s++;
            break;
        }
        else s++;
    }
    return s;
}

int main () {
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int n;
        cin >> n;
        int res = 0;
        while (size(n) != 1) {
            int max = 0;
            for (int j = 1; j < size(n); j++) {
                int a, b;
                a = n % int(pow(10, j));
                b = n / int(pow(10, j));
                if (max < a * b) {
                    max = a * b;
                }
            }
            n = max;
            res++;
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 3256
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;

class DandA {
    static void Main(string[] args) {
        int n = ReadLineInt();
        string s = ReadLineStr();
        int rtn = 1;
        for (int i = 1;i < s.Length; i++) {
            if (s.Substring(i, 1) !=  s.Substring(i - 1, 1)) {
                rtn++;
            }
        }
        Console.WriteLine(rtn);
    }

    static string[] ary = new string[] {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private long ReadLineLong() {return long.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private double[] ReadLineDoubleArray() {return Console.ReadLine().Trim().Split().Select(a => double.Parse(a)).ToArray();}
    static private decimal[] ReadLineDecimalArray() {return Console.ReadLine().Trim().Split().Select(a => decimal.Parse(a)).ToArray();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}

    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
}

Measured memory_bytes: 15452
n = int(input())
F = [int(input().replace(' ',''), 2) for _ in range(n)]
P = [list(map(int, input().split())) for _ in range(n)]
ans=-10**10
for sp in range(1, 1024):
  total = 0
  for i in range(n):
    b = bin(F[i] & sp)
    total += P[i][b.count('1')]
  ans = max(ans, total)
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
random_device rnd;
mt19937 mt(rnd());

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

void solve(int n)
{
    int cur = 0;
    int tail = 0;
    int ans = 0;

    rep(i, n)
    {
        cur += i;
        while (cur > n)
        {
            cur -= tail;
            tail++;
        }
        if (cur == n)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

int main()
{
    int n;
    while (cin >> n, n)
    {
        solve(n);
    }
    return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define debug(var) do{cout << #var << " : "; print(var); } while(0)
using namespace std;
typedef long long ll;
void print() { cout << endl; }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...); }
template <class T> void print(vector<T> &vec) { for (auto& a : vec) { cout << a; if (&a != &vec.back()) cout << " "; } cout << endl; }
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec); } }
const int INF = 1e9;
const int MOD = 1e9+7;

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

	string S; cin >> S;
	string ans(S.size(), 'x');
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int R = sc.nextInt();
        int C = sc.nextInt();
        int K = sc.nextInt();
        long[][] masu = new long[R][C];
        for (int i = 0; i < K; i++) {
            int r, c;
            long v;
            r = sc.nextInt() - 1;
            c = sc.nextInt() - 1;
            v = sc.nextLong();
            masu[r][c] = v;
        }
        long[][][] maxVal = new long[R][C][4];
        for (int r = 0; r < R; r++) {
            for (int c = 0; c < C; c++) {
                for (int k = 0; k < 4; k++) {
                    maxVal[r][c][k] = 0;
                }
            }
        }
        for (int c = 0; c < C; c++) {
            maxVal[0][c][0] = 0;
        }
        for (int r = 0; r < R; r++) {
            for (int c = 0; c < C; c++) {
                if (c + 1 < C) {
                    for (int k = 0; k < 3; k++) {
                        maxVal[r][c + 1][k + 1] = Math.max(maxVal[r][c + 1][k + 1], Math.max(maxVal[r][c][k] + masu[r][c], maxVal[r][c][k + 1]));
                    }
                }
                if (r + 1 < R) {
                    for (int k = 0; k < 4; k++) {
                        maxVal[r + 1][c][0] = calculateMax(masu[r][c], maxVal[r][c]);
                    }
                }
            }
        }
        System.out.println(calculateMax(masu[R-1][C-1], maxVal[R-1][C-1]));
    }

    private static long calculateMax(long masuVal, long[] longs) {
        return Math.max(Math.max(longs[0]+ masuVal, longs[1]+ masuVal), Math.max(longs[2]+ masuVal, longs[3]));
    }
}


Measured memory_bytes: 736484
# coding: utf-8

from itertools import accumulate as accum
import sys
input = sys.stdin.readline

def f2(n, a):
    acsum = list(accum(a)) + [0]
    dp = [[float('inf')] * n for _ in range(n)]
    for i in range(n):
        dp[i][i] = 0
        if i + 1 != n:
            dp[i][i + 1] = a[i] + a[i + 1]
    for i in range(n - 3, -1, -1):
        for j in range(i + 2, n):
            c = float('inf')
            dpi = dp[i]
            for x in range(i, j):
                c_ = dpi[x] + dp[x + 1][j]
                if c_ < c:
                    c = c_
            dpi[j] = c + acsum[j] - acsum[i - 1]
    return(dp[0][n - 1])

n = int(input()) # 2 <= n <= 400
a = list(map(int, input().split()))
print(f2(n, a))


Measured memory_bytes: 47324
import sys
n = int(input())
s = input()
mod = 10**9 + 7

if s[0] == "W":
    print(0)
    sys.exit()

sg = 1
ans = 1
now = 0
for i in range(1, n*2):
    if s[i] == s[i-1]:
        now = (now+1)%2
    if now == 0:
        sg += 1
    else:
        ans = (ans * sg) % mod
        sg -= 1
    if sg < 0 or sg > n:
        ans = 0
        break
    # print(i,sg)

if sg != 0:
    print(0)
    sys.exit()

for i in range(1, n+1):
    ans = (ans*i) % mod
print(ans)

Measured memory_bytes: 41180
package main

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

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func nStr(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

var r []int

func main() {
	var sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	s := readLine()
	t := readLine()
	l := len(s)
	a := make([][]int, l)
	for i := 0; i < l; i++ {
		a[i] = make([]int, 26)
		for j := 0; j < 26; j++ {
			a[i][j] = -1
		}
	}
	c := make([]int, 26)
	for i := 0; i < 26; i++ {
		c[i] = -1
	}
	for tt := 0; tt < 2; tt++ {
		for i := l - 1; i >= 0; i-- {
			for j := 0; j < 26; j++ {
				a[i][j] = c[j]
			}
			k := int(s[i] - 'a')
			c[k] = i
		}
	}
	u := l - 1
	r := -1
	tl := len(t)
	for i := 0; i < tl; i++ {
		k := int(t[i] - 'a')
		n := a[u][k]
		if n < 0 {
			fmt.Println(-1)
			return
		}
		if n <= u {
			r++
		}
		u = n
	}
	fmt.Println(int64(r)*int64(l) + int64(u) + 1)
}


Measured memory_bytes: 24960
#                          JAI SHREE RAM

import math; from collections import *
import sys; from functools import reduce

def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())
def getlistofstring(): return list(input().strip().split())
def printxsp(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9)+7; SEXYMOD = 998244353; MAXN = int(1e5)

# sys.setrecursionlimit(10**6)
# sys.stdin=open("input.txt","r");sys.stdout=open("output.txt","w")

# for _testcases_ in range(int(input())):
n = int(input())
li = get_list()
s = sum(li)
for _ in range(int(input())):
    ind, val = get_ints()
    print(s - li[ind-1] + val)

'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

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

struct Fenwick {
  int n;
  long long *p;
  Fenwick(int n) : n(n), p(new long long[n+1]) {
    fill(p, p+n+1, 0);
  }
  ~Fenwick() { delete[] p; }
  void add(int i, long long a) {
    for(i++; i <= n; i += i&-i) p[i] = max(p[i], a);
  }
  long long sum(int i) {
    long long s = 0;
    for(; i > 0; i -= i&-i) s = max(s, p[i]);
    return s;
  }
};

int main() {
  int n; scanf("%d", &n);
  // static int xs[100000];
  // for(int i = 0; i < n; i++) scanf("%d", xs+i);
  Fenwick fwt(n+1);
  for(int i = 0; i < n; i++) {
    int x; scanf("%d", &x);
    long long cost = fwt.sum(x-1)+x;
    // printf("%d <- %d\n", x-1, cost);
    fwt.add(x-1, cost);
    // fwt.add(x, -cost);
  }
  printf("%lld\n", (long long)n*(n+1)/2-fwt.sum(n));
  return 0;
}

Measured memory_bytes: 1800
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)











int main(){
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    const double PI = acos(-1);
    double y1 = a * sin((360.0 / 12.0 * h + 30.0 * (m / 60.0)) * PI / 180.0);
    double x1 = a * cos((360.0 / 12.0 * h + 30.0 * (m / 60.0)) * PI / 180.0);
    double y2 = b * sin(360.0 / 60.0 * m * PI / 180.0);
    double x2 = b * cos(360.0 / 60.0 * m * PI / 180.0);
    cerr << y1 << " " << x1 << " " << y2 << " " << x2 << endl;
    printf("%.12lf\n", sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
}


Measured memory_bytes: 4104
#!/usr/bin/env python3

SHEEP = True
WOLF = False

def check(s, a, b):
    animals = [a, b]
    s = s[1:] + s[0]
    for c in s:
        if animals[-1] is SHEEP:
            animals.append(animals[-2] if c == 'o' else not animals[-2])
        else:
            animals.append(animals[-2] if c == 'x' else not animals[-2])

    if a is animals[-2] and b is animals[-1]:
        print(*['WS'[int(a)] for a in animals[:-2]], sep='')
        return True
    else:
        return False

def main():
    input()
    s = input()

    for a in [SHEEP, WOLF]:
        for b in [SHEEP, WOLF]:
            if check(s, a, b):
                return

    print(-1)

main()


Measured memory_bytes: 7776
string = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

s =[d for d in input()]
find = 0
i=0
found = False
while i<26 and not found:
    if string[i] in s :
        found= False
    else:
        find =string[i]
        found=True
    i +=1

if found:
    print(find)
else:
    print('None')
    
        

Measured memory_bytes: 4016
A,B,C = map(int,raw_input().split())

if A==B and B==C:
    if A%2==0 and B%2==0 and C%2==0:
        print -1
    else:
        print 0
else:
    for i in range(1000):
        if A%2==1 or B%2==1 or C%2==1:
            print i
            break
        newA = B/2 + C/2
        newB = C/2 + A/2
        newC = A/2 + B/2
        A = newA
        B = newB
        C = newC

Measured memory_bytes: 2692
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    ll x, y, a, b, c, sum_xy = 0, sum_c = 0, res = 0;

    cin >> x >> y >> a >> b >> c;
    vector<ll> as(a), bs(b), cs(c);
    rep(i, a)
    {
        cin >> as[i];
        //cout << as[i];
    }
    rep(i, b)
    {
        cin >> bs[i];
        //cout << bs[i];
    }
    rep(i, c)
    {
        cin >> cs[i];
        //cout << cs[i];
    }
    sort(as.begin(), as.end());
    sort(bs.begin(), bs.end());
    sort(cs.begin(), cs.end());
    vector<ll> ans;
    rep(i, x)
    {
        ans.push_back(as[a - 1 - i]);
        //cout << as[a - 1 - i] << endl;
    }
    rep(i, y)
    {
        ans.push_back(bs[b - 1 - i]);
        //cout << bs[b - 1 - i] << endl;
    }
    sort(ans.begin(), ans.end());
    // rep(i, x + y)
    // {
    //     cout << ans[i] << endl;
    // }
    ll max_id = -1, max_diff = 0;
    rep(i, x + y)
    {
        if (i == c || (sum_xy + ans[i] > sum_c + cs[c - 1 - i]))
            break;

        sum_xy += ans[i];
        sum_c += cs[c - 1 - i];
        if (sum_c - sum_xy > max_diff)
        {
            max_diff = sum_c - sum_xy;
            max_id = i;
        }
    }
    //cout << "max_id: " << max_id << endl;
    rep(i, x + y)
    {
        res += i > max_id ? ans[i] : cs[c - 1 - i];
    }

    cout << res << endl;
}

Measured memory_bytes: 4724
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
using namespace std;

const int N = 1e5 + 10;
int n, m, k;
int res[N], p[N];

int find(int x) {
	return (p[x] < 0 ? x : p[x] = find(p[x]));
}

void uni(int x, int y) {
	x = find(x);
	y = find(y);
	if (x != y) {
		p[x] += p[y];
		p[y] = x;
	}
}

int main() {
	cin >> n >> m >> k;
	for (int i = 0; i < n; i++) {
		p[i] = -1;
	}
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		uni(a, b);
		res[a]--;
		res[b]--;
	}
	for (int i = 0; i < k; i++) {
		int c, d;
		cin >> c >> d;
		c--;
		d--;
		if (find(c) == find(d)) {
			res[c]--;
			res[d]--;
		}
	}
	for (int i = 0; i < n; i++) {
		cout << res[i] - p[find(i)] - 1;
		if (i != N - 1)cout << ' ';
		else cout << endl;
	}
}

Measured memory_bytes: 2176
lst = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(lst[k - 1])

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int n, x;
	cin >> n >> x;
	if(n == 1){
		cout << "Yes" << endl;
		cout << 1 << endl;
	}else if(2 <= x && x <= (n - 1) * 2){
		cout << "Yes" << endl;
		--x;
		vector<int> a(n * 2 - 1);
		for(int i = 0; i < n * 2 - 1; ++i){ a[i] = i; }
		a[n - 1] = x;
		if(x < n - 1){
			a[n - 2] = 0;
			for(int i = n - 3, y = n; i >= 0; --i){
				do {
					--y;
				} while(y == x || y == 0);
				a[i] = y;
			}
		}else if(x > n - 1){
			a[n] = n * 2 - 2;
			for(int i = n + 1, y = n - 2; i < n * 2 - 1; ++i){
				do {
					++y;
				} while(y == x || y == n * 2 - 2);
				a[i] = y;
			}
		}
		for(const int x : a){
			cout << x + 1 << endl;
		}
	}else{
		cout << "No" << endl;
	}
	return 0;
}



Measured memory_bytes: 2432
#include<stdio.h>
#include<string.h>

int main()
{
	int suuretu[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	
	int K;
	scanf("%d",&K);
	printf("%d",suuretu[K-1]);
	
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int n, k;
  cin >> n >> k;
  vi p(n);
  rep(i, n) cin >> p[i];
  sort(p.begin(), p.end());
  ll ans = 0;
  rep(i, k) ans += p[i];
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	int co=0,coo=0;
	REP(i,3){
		int a;
		cin>>a;
		if(a==5)co++;
		if(a==7)coo++;
	}
	if(co==2 && coo==1)
	cout<<"YES"<<endl;
	else
	cout<<"NO"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define ss string
#define ll long long int
#define Endl endl
#define u_b upper_bound
#define rep(i,n)         for(int i=0;i<n;i++)
#define ld long double
#define tc long long t;cin>>t;while(t--)
#define fr(i,a,b)        for(long long int i=a;i<=b;i++)
#define E endl
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define V deque<ll>v;
#define aaste long long int n;cin>>n;long long int a[n];for(long long int i=0;i<n;i++)cin>>a[i];
const ll   mod=            1000000007;
const ll   MOD1=           (int)1e9 + 9;
const ll   MOD2=           998244353;
const ld    pi=             atan2(0, -1);
const ld    eps=            1e-9;
const int   N=                   2e5+5;
 
const int MAXR = 1000005;
ll         tests=          1;
 
using namespace std;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll binarySearch(ll l, ll r,ll k)
{
  if (r >= l) {
    ll mid = l + (r - l) / 2;
    if (mid*(mid+1)==k)
      return 1;
    if (mid*(mid+1)>k)
      return binarySearch( l, mid - 1,k);
    return binarySearch(mid + 1, r, k);
  }
  return 0;
}
bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 
void swap(ll *p1, ll *p2)
{
   ll temp=*p1;
   *p1=*p2;
   *p2=temp;
}
ll cbratt(ll x)
{
    ll l = 0, r = MAXR;
    while (l != r) {
        ll m = (l + r + 1) / 2;
        if (m * m * m > x)
            r = m - 1;
        else
            l = m;
    }
    return l;
}
int MaxSubArraySumReturn(int a[], int  n) //negative thakle o kaaj korbe in O(n)
{
 
    int sum = 0, best = 0;
   for(ll i=0;i<n;i++)
    {
        sum = max(a[i], a[i] + sum);
        best = max(best, sum);
    }
    return best;
 
}
ll totalDigits(ll n) 
{ 
 
    ll number_of_digits = 0; 
    for (ll i = 1; i <= n; i *= 10) 
        number_of_digits += (n - i + 1); 
  
    return number_of_digits; 
}

int main()
{
  #ifndef ONLINE_JUDGE
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        freopen("error.txt", "w", stderr);
    }
#endif
ll l,d,r;
ll ctr=0;
cin>>l>>r>>d;
for(ll i=l;i<=r;i++)
{
  if (i%d==0)
  {
    ctr++;
  }
}
cout<<ctr<<endl;

}


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

int n, a[100005];
int odd, two, four;

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

    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (a[i] % 2) odd++;
        else {
            if (a[i] % 4) two++;
            else four++;
        }
    }

    int cover_range = 0;
    cover_range = four * 3 - (four - 1);
    if (four == 0) cover_range = 0;
    if (cover_range >= n) {
        cout << "Yes" << endl;
    }
    else {
        int nokori = n - cover_range;
        if (nokori < two || two == n) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int a[100010],t[100010];
pair<int,int> tp[100010],ap[100010],fp[100010];
int main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>t[i];
	}
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		if(t[i]>t[i-1]){
			tp[i]=make_pair(t[i],t[i]);
		}
		else if(t[i]==t[i-1]){
			tp[i]=make_pair(1,t[i]);
		}
		else{
			cout<<"0";
			return 0;
		}
	}
	for(int i=n;i>=1;i--){
		if(a[i]>a[i+1]){
			ap[i]=make_pair(a[i],a[i]);
			
		}
		else if(a[i]==a[i+1]){
			ap[i]=make_pair(1,a[i]);
			
		}
		else {
			cout<<"0";
			return 0;
		}
	}
	long long x=1;
	for(int i=1;i<=n;i++){
		if(ap[i].second<tp[i].first||tp[i].second<ap[i].first){
			cout<<"0";
			return 0;
		}
		else{
			x*=min(tp[i].second,ap[i].second)-max(tp[i].first,ap[i].first)+1ll;
			x%=1000000007ll;
		}
	}
	cout<<x;
	
}


Measured memory_bytes: 2688
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    N, K = NMI()
    A = NLI()

    for k in range(min(K, 42)):
        tmp = [0] * (N+1)
        for i, a in enumerate(A):
            tmp[max(0, i-a)] += 1
            tmp[min(N, i+a+1)] -= 1
        cum = [0] * (N+1)
        for i, t in enumerate(tmp):
            if i == 0:
                cum[0] = t
                continue
            cum[i] = cum[i-1] + t
        A = cum[:-1]
    print(" ".join(map(str, A)))


if __name__ == "__main__":
    main()

Measured memory_bytes: 189456
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<utility>
#include<functional>
#include<algorithm>
#include<bitset>
#include<ctime>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
int n,w;
string a[2005];
int Left[2005][2005],Right[2005][2005],up[2005][2005],down[2005][2005];
int main()
{
    cin>>n>>w;
    for(int i=0;i<n;i++)
		cin>>a[i];
    for(int i=0;i<n;i++)
	{
        int cur=0;
        for(int j=0;j<w;j++)
		{
            if(a[i][j]=='#')
				cur=0;
            else
				cur++;
            Left[i][j]=cur;
        }
    }
    for(int i=0;i<n;i++)
	{
        int cur=0;
        for(int j=w-1;j>=0;j--)
		{
            if(a[i][j]=='#')
				cur=0;
            else
				cur++;
            Right[i][j]=cur;
        }
    }
    for(int j=0;j<w;j++)
	{
        int cur=0;
        for(int i=0;i<n;i++)
		{
            if(a[i][j]=='#')
				cur=0;
            else
				cur++;
            up[i][j]=cur;
        }
    }
    for(int j=0;j<w;j++)
	{
        int cur=0;
        for(int i=n-1;i>=0;i--)
		{
            if(a[i][j]=='#')
				cur=0;
            else cur++;
            down[i][j]=cur;
        }
    }
    int ans=0;
    for(int i=0;i<n;i++)
        for(int j=0;j<w;j++)
		{
            if(a[i][j]=='#')
				continue;
            ans=max(ans,Left[i][j]+Right[i][j]+up[i][j]+down[i][j]-3);
        }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 67072
#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
//const int MOD=998244353;
const int INF=1e9;
const long long LINF=1e18;
#define int long long
//template
template <typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
int N,A,B,C;
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
std::vector<int> Factorial(5e6),Finverse(5e6);
void Cinit(){// limit is 5e6 /// write Cinit&pw /// this takes 792ms at AtCoder
  Factorial[0]=1;
  for(int i=1;i<5e6;i++)Factorial[i]=Factorial[i-1]*i%MOD;
  for(int i=0;i<5e6;i++)Finverse[i]=pw(Factorial[i],MOD-2);
}
int nCk(int n,int k){
  if(n<k)return 1;if(k<0)return 0;
  int res=Factorial[n];
  res*=Finverse[k];res%=MOD;
  res*=Finverse[n-k];res%=MOD;
  return res;
}
int f(int x,int y,int z,int w){
  int res=nCk(x+y+z+w,x)*nCk(y+z+w,z+w)%MOD*nCk(z+w,z);res%=MOD;
  int t=C-z-3*w;
  res*=nCk(t+y-1,y-1);res%=MOD;
  return res;
}
//main
signed main(){
  Cinit();
  cin>>N>>A>>B>>C;
  //pattern 1:x
  //pattern 23...32:y=B/2
  //pattern 1in3:z=A-x
  //pattern 333:w
  if(B&1)fin(0);int y=B/2;
  if(y==0){
    int res=0;
    for(int w=0;3*w<=C;w++){
      int z=C-3*w;
      int x=A-z;if(x<0)continue;
      res+=nCk(x+w+z,x+w)*nCk(x+w,x);res%=MOD;
    }
    fin(res);
  }
  int ans=0;
  for(int x=0;x<=A;x++){
    int z=A-x;
    for(int w=0;3*w+z<=C;w++){
      ans+=f(x,y,z,w);
      ans%=MOD;
    }
  }
  fin(ans);
}


Measured memory_bytes: 78464
N, K = map(int, input().split())
s = input()
ls = []
for i in range(N):
  if i != N-1 and s[i]!=s[i+1]:
    ls += [i]
length = len(ls)
ls += [N-1]*(2*K+2)
m = 0
if s[0]=='0':
  for i in range(0,length,2):
    x = ls[i+2*K+1]-ls[i]
    if x>m:
      m = x
  x = ls[2*K-1]+1
  if x>m:
    m = x
else:
  for i in range(1, length, 2):
    x = ls[i+2*K+1]-ls[i]
    if x>m:
      m = x
  x = ls[2*K]+1
  if x>m:
    m = x
print(m)

Measured memory_bytes: 47420
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#define llint long long
#define mod 1000000007
#define inf 1e18

using namespace std;
typedef pair<llint, llint> P;

struct E{
  llint sum, lmax, rmax, mmax;
  E(){
    sum = lmax = rmax = mmax = 0;
  }
  E(llint a, llint b, llint c, llint d){
    sum = a, lmax = b, rmax = c, mmax = d;
  }
};

E merge(E& a, E& b)
{
  E ret;
  ret.sum = a.sum + b.sum;
  ret.lmax = max(a.lmax, a.sum+b.lmax);
  ret.rmax = max(b.rmax, b.sum+a.rmax);
  ret.mmax = max(max(a.mmax, b.mmax), a.rmax+b.lmax);
  return ret;
}

struct SegTree{
	int size;
	vector<E> seg;

	SegTree(){}
	SegTree(int size){
		this->size = size;
		seg.resize(1<<(size+1));
	}

	void init()
	{
		for(int i = 0; i < (1<<(size+1)); i++);
	}

	void update(int i, E val)
	{
		i += (1 << size);
		seg[i] = val;
		while(i > 1){
			i /= 2;
			seg[i] = merge(seg[i*2], seg[i*2+1]);
		}
	}

	E query(int a, int b, int k, int l, int r)
	{
		if(b < l || r < a) return E();
		if(a <= l && r <= b) return seg[k];
		E lval = query(a, b, k*2, l, (l+r)/2);
		E rval = query(a, b, k*2+1, (l+r)/2+1, r);
		return merge(lval, rval);
	}
	E query(int a, int b)
	{
		return query(a, b, 1, 0, (1<<size)-1);
	}
};

llint n, Q;
llint a[100005];
SegTree seg(18);

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

  cin >> n >> Q;
  for(int i = 1; i <= n; i++) cin >> a[i];
  for(int i = 1; i <= n; i++){
    seg.update(i, E(a[i], max(0LL, a[i]), max(0LL, a[i]), max(0LL, a[i])));
  }
  cout << seg.query(1, n).mmax << "\n";

  llint k, x;
  for(int q = 0; q < Q; q++){
    cin >> k >> x;
    seg.update(k, E(x, max(0LL, x), max(0LL, x), max(0LL, x)));
    cout << seg.query(1, n).mmax << "\n";
  }
  flush(cout);

  return 0;
}



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

int main(){

    int n;
    cin >> n;

    pair<string, int> spArray[n];
    for(int i=0; i<n; i++){
        cin >> spArray[i].first >> spArray[i].second;
    }

    int ans[n];
    for(int i=0; i<n; i++){
        ans[i] = i+1;
    }

    bool flag = true;
    while(flag){
        flag = false;

        for(int i=0; i<n-1; i++){
            if(spArray[i].second < spArray[i+1].second){
                pair<string, int> temp;
                temp = spArray[i];
                spArray[i] = spArray[i+1];
                spArray[i+1] = temp;

                int t;
                t = ans[i];
                ans[i] = ans[i+1];
                ans[i+1] = t;

                flag = true;
            }
        }
    }

    flag = true;
    while(flag){
        flag = false;

        for(int i=0; i<n-1; i++){
            if(spArray[i].first > spArray[i+1].first){
                pair<string, int> temp;
                temp = spArray[i];
                spArray[i] = spArray[i+1];
                spArray[i+1] = temp;

                int t;
                t = ans[i];
                ans[i] = ans[i+1];
                ans[i+1] = t;

                flag = true;
            }
        }
    }

    for(int i=0; i<n; i++){
        cout << ans[i] << endl;
    }

    return 0;
}

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

S = sum(A)

M = [0] * N

M[0] = S
for i in range(1,N,2):
    M[0] -= 2 * A[i]

for i in range(1,N):
    M[i] = 2*A[i-1] - M[i-1]

print(*M,sep=" ")

Measured memory_bytes: 64484
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  string ans;
  REP(i,s.size()){
    if(s[i]=='0') ans += '0';
    else if(s[i]=='1') ans += '1';
    else if(s[i]=='B' && !ans.empty()) ans.pop_back();
  }
  cout << ans << '\n';
  return 0;
}

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

using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)

int main(){
	ll n;
	cin >> n;
	ll sum = 0;
	for(int i = 1; i <= n; i++){
		sum += i - 1;
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner s = new Scanner(System.in);
	int n = s.nextInt();
	int i = 0;

	while(++i <= n){
	    int x = i;

	    if(x % 3 == 0) System.out.print(" "+i);
	    else if(x % 10 == 3) System.out.print(" "+i);
	    else{
		while(x > 0){
		    if(x % 10 == 3){
			System.out.print(" "+i);
			break;			
		    }
		    else x /= 10;
		}
	    }
	}
	System.out.println();
    }
}



Measured memory_bytes: 28768
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef pair<int, int> p;
ll gcd(ll m, ll n)
{
    if (m < n)
        swap(m, n);
    if (n == 0)
        return m;
    gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    if (m < n)
        swap(m, n);
    return m * n / gcd(m, n);
}
bool IsPrime(ll num)
{
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
vector<ll> enum_div(ll n)
{
    vector<ll> ret;
    for (ll i = 1; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i != 1 && i * i != n)
            {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}
map<ll, ll> prime_factor(ll n)
{
    map<ll, ll> ret;
    for (ll i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll a, b;
    cin >> a >> b;

    ll v_gcd = gcd(a, b);
    map<ll, ll> cd = prime_factor(v_gcd);

    ll ans = 0;

    for (auto t : cd)
    {
        ans++;
    }
    cout << ans + 1 << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
#import numpy as np

# なんこか入力
a,b = map(int, input().split())
# なんこか入力
c,d = map(int, input().split())
# なんこか入力
e,f = map(int, input().split())

p = (e-c)*a
q = (f-d)*b
#print(p,q)
if p*q >0 or p*(p+q)>0:
    print("0")
elif p == -q:
    print("infinity")
elif (-p) % (p+q) == 0:
    print(-p//(p+q)*2)
else:
    print(-p//(p+q)*2+1)



Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
long long expo(long long a,long long b){
	if(b==0)return 1;
	long long temp = expo(a,b/2);
	temp = temp*temp;
	if(b%2!=0)temp*=a;
	return temp;

}
int main(){
	long long n,p;
	cin>>n>>p;
	if(n==1)cout<<p;
	else if(p==1)cout<<1;
	else{
		long long ans=1;
		for(long long i=2;i*i<=p;i++){
			long long count=0;
			while(p%i==0){
				count++;
				p/=i;
			}
			ans = ans*expo(i,count/n);
		}
		cout<<ans;
	}
}

Measured memory_bytes: 3640
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>


using namespace std;

const int MAXN=1e5+10;

int X,Y,A,B,C;

int transparent[MAXN];

typedef long long int ll;

int main(){
    scanf("%d%d%d%d%d",&X,&Y,&A,&B,&C);

    priority_queue<int,vector<int>,greater<int>> R,G;
    
    for(int i=0;i<A;i++){
        int temp;
        scanf("%d",&temp);
        R.push(temp);
    }

    for(int i=0;i<B;i++){
        int temp;
        scanf("%d",&temp);
        G.push(temp);
    }

    for(int i=0;i<C;i++){
        int temp;
        scanf("%d",transparent+i);
    }

    sort(transparent,transparent+C);

    for(int i=A;i>X;i--) R.pop();
    for(int i=B;i>Y;i--) G.pop();

    for(int i=C-1;i>=0;i--){
        if (transparent[i]<R.top()&&transparent[i]<G.top()) break;
        if (R.top()<G.top()) {
            R.pop();
            R.push(transparent[i]);
        }else{
            G.pop();
            G.push(transparent[i]);
        }
    }

    ll sum=0;
    while (!R.empty()) sum+=R.top(),R.pop();
    while (!G.empty()) sum+=G.top(),G.pop();

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

    return 0;
}

Measured memory_bytes: 1528
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int ans = 0;
  ;
  for (int i = 0; i < 5; i++) {
    ans++;
    int x;
    cin >> x;
    if (x == 0) break;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>
#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}
using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
int sum(vector<int>);
int min(vector<int>);
int max(vector<int>);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

vector<vector<ll>> memo;

ll get(int x, int y) {
	if (memo[x][y] != -1)
		return memo[x][y];

	if (x == 0) return 1;
	if (y < x) return 0;

	memo[x][y] = get(x, y - 1) + get(x - 1, y - 1);
	return memo[x][y];
}

ll mpow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; i < b; i++) {
		ans *= a;
		ans %= 1000000007;
	}
	return ans;
}

ll nCr(ll n, ll r) {
	ll res = 1;
	for (int i = 0; i < r; i++) {
		res *= (n - i);
	}
	for (int i = 1; i <= r; i++) {
		res /= i;
	}
	return res;
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}
int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}
int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

ll _gcd(ll A, ll B) {
	return (B == 0) ? A : gcd(A % B, B);
}

vector<bool> to_binary(int x) {
	vector<bool> res;
	while (x != 0) {
		res.push_back(x % 2);
		x /= 2;
	}
	return res;
}

template<int index>
bool comp(tuple<ll, ll, ll, ll> a, tuple<ll, ll, ll, ll> b) {
	return get<index>(a) < get<index>(b);
}

int vector_finder(std::vector<ll> vec, ll number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return index;
	}
	else { // 発見できなかったとき
		return 0;
	}
}


int len(int x) {
	return (int)log10(x) + 1;
}

int same_vec(vector<int> a, vector<int> b) {
	int res = 1, num = a.size();
	for (int i = 0; i < num; i++) {
		if (a[i] != b[i]) {
			res = 0;
			break;
		}
	}
	return res;
}


ll fibs[100] = { 0 };
ll fib(int n) {
	if (fibs[n] == 0) {
		return fibs[n] = fib(n - 1) + fib(n - 2);
	}
	return fibs[n];
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	string S;
	cin >> S;

	bool flag = true;
	for (int i = 0; i < S.size(); i++) {
		if ((i + 1) % 2 == 1 && S[i] == 'L') flag = false;
		if ((i + 1) % 2 == 0 && S[i] == 'R') flag = false;
	}

	cout << (flag ? "Yes" : "No") << endl;




ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
typedef long long       ll;
#define MOD ((int)1e9+7)
#define N ((int)2e5+123)
void reads(string& x){ char kk[N]; scanf("%s",kk); x = kk;}

int ans, n, k;
int v[N];
void solve(){
    scanf("%d %d", &n, &k);
    for(int i=0;i<n;i++)scanf("%d",v+i);
    sort(v,v+n);
    for(int i=0;i<k;i++)ans+=v[i];
    printf("%d\n", ans);
}

int main(){
    ios_base::sync_with_stdio(0);
    int t = 1; //scanf("%d",&t);
    for(int caso=1;caso<=t;caso++){
        solve();
    }
}

Measured memory_bytes: 3844
#include "bits/stdc++.h"
using namespace std;
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define all(x) (x).begin(),(x).end()
#define tsort(v) sort((v).begin(), (v).end())
#define trev(v) reverse((v).begin(), (v).end())
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define pop(v) (v).back(); (v).pop_back()
#define el "\n"
#define co(x) cout<<(x)<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#ifdef tqktmp_1
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
typedef long long lint;

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

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

    int n, d, ans=0;
    bool fl[100] = {0};
    cin>>n;
    rep(i, n){
        cin>>d;
        if(!fl[d]){
            ans++;
            fl[d]=1;
        }
    }
    co(ans);
}

Measured memory_bytes: 256
function Main(input){
	const Input = input.split(" ");
	const n = Input[0];
	const x = Input[1];
  	const t = Input[2];
  const res = Math.ceil(n / x);
  const time = t * res;
  console.log(time);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29652