akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

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

int main() {
    int t; cin >> t;
    rep(i,t) {
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        if (a < b || d < b) {cout << "No" << endl; continue;}
        if (b-1 <= c) {cout << "Yes" << endl; continue;}
        ll g = gcd(b,d);
        if (c < b - g + a%g) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
}

Measured memory_bytes: 3572
#include<cstdio>
#include<algorithm>
#include<map>
#include<cstring>
using namespace std;
int main(){
	char ss[10];
	map<char,int>ma;
	while(~scanf("%s",ss)){
		ma.clear();
		int n=strlen(ss);
		for(int i=0;i<n;i++){
			ma[ss[i]]++;
		}
		int flag=0;
		for(int i=0;i<n;i++){
			if(ma[ss[i]]!=2){
				flag=1;
				break;
			}
		}
		if(flag) printf("No\n");
		else printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(){
	long long int N,sum;
	scanf("%lld",&N);
	long long int S[N+1],C[N+1],F[N+1];
	if(N==1){
		printf("0\n");
		return 0;
	}
	for(int i=1;i<N;i++){
		scanf("%lld%lld%lld",&C[i],&S[i],&F[i]);
	}
	C[N]=S[N]=F[N]=0;
	for(int i=1;i<N;i++){
		sum = S[i]+C[i];
		for(int j=i+1;j<N;j++){
			if(sum<S[j]){
				sum=S[j];
			}else if(sum%F[j]!=0){
				sum=sum+F[j]-(sum%F[j]);
			}
			sum+=C[j];
		}
		printf("%lld\n",sum);
	}
	printf("0\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int> data(N);
  char a;
  for(int i = 0; i < N; i++) {
    cin >> a;
    data.at(i) = a - 'a';
  }
  int ans = 0, flaga = 0, flagb = 0, count = 0;;
  for(int i = 0; i < N - 1; i++) {
    count = 0;
    for(int j = 0; j < 26; j++) {
      flaga = 0, flagb = 0;
      for(int k = 0; k <= i; k++) {
        if(data.at(k) == j) {
          flaga = 1;
          break;
        }
      }
      for(int k = 0; k < N - i - 1; k++) {
        if(data.at(k + i + 1) == j) {
          flagb = 1;
          break;
        }
      }
      if(flaga == 1 && flagb == 1) count++;
    }
    if(count > ans) ans = count;
  }
  cout << ans << endl;
  return 0;
}


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

int n;  // length
int m;  // max value
int q;
vector<int> a, b, c, d;
int ans;

// 各桁が1以上m以下のn桁の数列を全列挙
// e.g. 111 112 113 122 123 133 222 223 233 333
void dfs(vector<int> A) {
  if (A.size() == n + 1) {
    int score = 0;
    rep(i, q) if (A[b[i]] - A[a[i]] == c[i]) score += d[i];
    ans = max(ans, score);
    return;
  }

  A.push_back(A.back());
  while (A.back() <= m) {
    dfs(A);
    A.back()++;
  }
}

int main() {
  cin >> n >> m >> q;
  a = b = c = d = vector<int>(q);
  rep(i, q) { cin >> a[i] >> b[i] >> c[i] >> d[i]; }
  dfs(vector<int>(1, 1));
  cout << ans << endl;
  return 0;
}

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

int main() {
    int ans = 0;
    int a;
    cin >> a;
    ans = a + a * a + a * a * a;

    cout << ans << endl;
}

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

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

using namespace std;

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a+b>c+d){
    cout<<"Left";
  }else if(a+b<c+d){
    cout<<"Right";
  }else{
    cout<<"Balanced";
  }
  return 0;
}


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

int main() {
  string S;
  int v = 700;
  cin >> S;
  if (S[0] == 'o') v += 100;
  if (S[1] == 'o') v += 100;
  if (S[2] == 'o') v += 100;
  cout << v << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;

const int MAX_N = 300000;
bool prime[MAX_N+1];

void sieve()
{
  fill(prime, prime+MAX_N+1, true);
  prime[0] = prime[1] = false;
  for(int i = 2; i <= MAX_N; i++)
    if(prime[i])
      for(int j = i*2; j <= MAX_N; j += i)
        prime[j] = false;
}

int main()
{
  sieve();
  while(1){
    int N, P;
    cin >> N >> P;
    if(N == -1 && P == -1) break;
    int n = N+1;
    int c = 0;
    int m[30];
    while(c < 30){
      if(prime[n]){
        m[c] = n;
        c++;
      }
      n++;
    }
    vector<int> v;
    REP(i,30){
      for(int j = i; j < 30; j++){
        v.push_back(m[i]+m[j]);
      }
    }
    sort(v.begin(),v.end());
    cout << v[P-1] << endl;
  }
}

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

int main(void){
  double x, h;
  double y;
  double S = 0;

  while(1){
    scanf("%lf %lf", &x, &h);
    if(x == 0 && h == 0) break;

    S = x * x;
    y = sqrt((x / 2.0) * (x / 2.0) + h * h);
    S += 4.0 * (x * y / 2.0);

    printf("%.6lf\n", S);
  }

  return 0;
}

Measured memory_bytes: 648
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
class UnionFind
{
public:
	int p[N];
	void init(int n = N)
	{
		memset(p, -1, sizeof(int) * n);
	}
	int treesize(int x)
	{
		return -p[Find(x)];
	}
	int Find(int x)
	{
		int s = x;
		while (p[s] >= 0) s = p[s];
		while (x != s)
		{
			int t = p[x];
			p[x] = s;
			x = t;
		}
		return s;
	}
	void Union(int x, int y)
	{
		int px = Find(x);
		int py = Find(y);
		if (p[px] > p[py]) swap(px, py);
		p[px] += p[py];
		p[py] = px;
	}
} uf;
int flagx[N];
int flagy[N];
int cnt[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	int sz = 1e5;
	cin >> n;
	uf.init();
	for (int i = 1; i <= n; i++)
	{
		int x, y;
		cin >> x >> y;
		flagx[x] = 1;
		flagy[y] = 1;
		if (uf.Find(x) != uf.Find(y + sz))
		{
			uf.Union(x, y + sz);
		}
	}
	for (int i = 1; i <= sz; i++)
	{
		if (flagx[i])
			cnt[uf.Find(i)]++;
	}
	LL ans = -n;
	for (int i = 1; i <= sz; i++)
	{
		if (flagy[i])
			ans += cnt[uf.Find(i + sz)];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
long long int Inv(long long int a, long long int m) {
	long long int c[50];
  	long long int e[50];  
  	c[0] = (m-2) % 2, e[0] = (m-2) / 2; 
  	for (int i = 0; i < 49; ++i){
     		c[i+1] = e[i] % 2; e[i+1] = e[i] / 2;  
  	}
	long long int d[50]; 
  	d[0] = a; 
  	for (int j = 0; j < 49; ++j){
     		d[j+1] = (d[j] * d[j]) % m; 
  	}
  	long long int Q = 1; 
	for(int k = 0; k < 49; ++k){
  		if(c[k] == 1) Q = (Q * d[k]) % m; 
	}
	return Q;
}
int main(){
	long long int N, M, K; cin >> N >> M >> K; 
	long long int P = 1e9 + 7; 
	long long int a = ((N * N * N - N) / 6) % P; 
	long long int b = ((M * M * M - M) / 6) % P; 
	long long int c = (((M * M) % P) * a) % P; 
	long long int d = (((N * N) % P) * b) % P; 
	long long int x = (c + d) % P; 
	long long int Fac[200100] = {}; Fac[0] = 1; 
	for(int i = 1; i < 200030; i++){
		Fac[i] = (Fac[i-1] * i) % P; 
	}
	long long int e = Fac[M*N-2]; 
	long long int f = Inv(Fac[K-2], P); 
	long long int g = Inv(Fac[M*N-K], P); 
	long long int h = (((e * f) % P) * g) % P; 
	cout << (x * h) % P << endl; 
}

Measured memory_bytes: 1792
n = int(raw_input())
a = map(int,raw_input().split())

if a[0] != 0:
  print 0
  exit(0)

a.sort()

if a[1] != 1:
  print 0
  exit(0)
  
ans = 1
old = 1
now = 1
c = 0

for q in range(1,len(a)):
  ans %= 998244353

  if now != a[q]:
    if now+1 != a[q]:
      print 0
      exit(0)
    else:
      ans = ans * pow(old,c,998244353)
      old = c
      c = 1
      now = a[q]
  else:
    c += 1
ans = ans * pow(old,c,998244353)

ans %= 998244353
print ans

Measured memory_bytes: 11328
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10e+6
#define DEKA 1000000007

using namespace std;

int main(){
    long n;
    cin >> n;
    cout << (n-1)*n/2 << endl;
}



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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<char> button1={'.',',','!','?',' '};
    int n; cin >> n;
    for (int i=0;i<n;++i){
        string s,ans=""; cin >> s;
        int cnt=-1;
        for (int j=0;j<s.size();++j){
            if (s[j]!='0'){++cnt; continue;}
            if (j==0||s[j-1]=='0') continue;
            int x=s[j-1]-'0';
            if (x==1) ans+=button1[cnt%5];
            else if (x==7) ans+='p'+cnt%4;
            else if (x==8) ans+='t'+cnt%3;
            else if (x==9) ans+='w'+cnt%4;
            else ans+='a'+((x-2)*3+cnt%3);
            cnt=-1;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3200
using System;
using System.Collections.Generic;

namespace abc120_b
{
  class Program
  {
    static void Main(string[] args)
    {
      var a = ConsoleInput.ReadAsInt();
      var b = ConsoleInput.ReadAsInt();
      var k = ConsoleInput.ReadAsInt();

      var cd = CD(a, b);
      cd.Reverse();

      Console.WriteLine(cd[k - 1]);

    }

    static List<int> CD(int a, int b)
    {
      var list = new List<int>();
      var min = Math.Min(a, b);

      for (int i = 1; i <= min; i++)
      {
        if (a % i == 0 && b % i == 0)
        {
          list.Add(i);
        }
      }

      return list;
    }
  }

  class ConsoleInput
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }

      return fieldBuffer.Dequeue();
    }

    public static int ReadAsInt() => int.Parse(Read());
    public static long ReadAsLong() => long.Parse(Read());
    public static double ReadAsDouble() => double.Parse(Read());

    public static string[] ReadAsStringArray(long n)
    {
      var array = new string[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }

      return array;
    }

    public static int[] ReadAsIntArray(long n)
    {
      var array = new int[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadAsInt();
      }

      return array;
    }

    public static long[] ReadAsLongArray(long n)
    {
      var array = new long[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadAsLong();
      }

      return array;
    }
    public static double[] ReadAsDoubleArray(long n)
    {
      var array = new double[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadAsDouble();
      }

      return array;
    }
  }
}


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

using namespace std;

typedef long long ll;

const int N = 200200;
const int Mod = 1e9 + 7;

int Inv[N];
int Fact[N];
int iFact[N];

void add_self(int& x, int y)
{
    if((x += y) >= Mod) x -= Mod;
}

void sub_self(int& x, int y)
{
    if((x -= y) < 0)    x += Mod;
}

int mul(int x, int y)
{
    return (ll) x * y % Mod;
}

int fp(int x, int y)
{
    int Res = 1;
    for(; y > 0; y >>= 1, x = mul(x, x))
        if(y & 1)
            Res = mul(Res, x);
    return Res;
}

int C(int n, int k)
{
    if(n < 0 || k < 0 || n < k) return 0;
    return mul(Fact[n], mul(iFact[k], iFact[n - k]));
}

int main()
{
    Inv[1] = 1;
    for(int i = 2; i < N; i++)  Inv[i] = (Mod - mul(Mod / i, Inv[Mod % i])) % Mod;

    Fact[0] = iFact[0] = 1;
    for(int i = 1; i < N; i++)  Fact[i] = mul(i, Fact[i - 1]);
    for(int i = 1; i < N; i++)  iFact[i] = mul(Inv[i], iFact[i - 1]);

    int n, m, k;    cin >> n >> m >> k;

    int Ans = 0;

    for(int x = 1; x <= n; x++)
    {
        add_self(Ans, mul(x, mul(mul(C(n * m - 2, k - 2), m), mul(x - 1, m))));
        sub_self(Ans, mul(x, mul(mul(C(n * m - 2, k - 2), m), mul(n - x, m))));
    }

    for(int y = 1; y <= m; y++)
    {
        add_self(Ans, mul(y, mul(mul(C(n * m - 2, k - 2), n), mul(y - 1, n))));
        sub_self(Ans, mul(y, mul(mul(C(n * m - 2, k - 2), n), mul(m - y, n))));
    }

    cout << Ans << endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/lexical_cast.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define pb push_back
#define mp make_pair
#define endl '\n'
#define PI acos(-1)
#define P pair<int,int>
typedef tree<int,null_type,less_equal <int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

long mod=1e9+7;
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int r,d,x;
	cin>>r>>d>>x;
	for(int i=0;i<10;i++)
	{
		x=r*x-d;
		cout<<x<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def root(x):
        if par[x] == x:
            return x
        par[x] = root(par[x])
        return par[x]
    def unite(x,y):
        x = root(x)
        y = root(y)
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1
    n,m = LI()
    v = LIR(m)
    for i in range(m):
        v[i][0] -= 1
        v[i][1] -= 1
    ans = 0
    for i in range(m):
        par = [i for i in range(n)]
        rank = [0]*n
        s = 1
        for j in range(m):
            if i == j:
                continue
            a,b = v[j]
            if root(a) != root(b):
                s += 1
                if s >= n:
                    break
                unite(a,b)
        else:
            ans += 1
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 42476
package main

import (
	"fmt"
)

func main() {
	s := scanStr()

	switch s {
	case "Sunny":
		fmt.Println("Cloudy")
	case "Cloudy":
		fmt.Println("Rainy")
	default:
		fmt.Println("Sunny")
	}

}

func scanStr() string {
	var s string
	fmt.Scan(&s)
	return s
}

func scanInt() int {
	var i int
	fmt.Scan(&i)
	return i
}


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


int main(){
     ll n; cin >> n;
     ll ans = 0;
     ll len = sqrt(n-1);
     for(ll i = 2; i <= len; i++){
          if((n-1)%i == 0){
               if(i*i == n-1) ans++;
               else ans += 2;
          }
     }
     if(n-1 > 2) ans++;
     len = sqrt(n);
     for(ll i = 2; i <= len; i++){
          if(n%i == 0){
               ll temp = n;
               while(temp % i == 0) temp /= i;
               if(temp % i == 1) ans++;

               if(i == n/i) continue;

               temp = n;
               while(temp % (n/i) == 0) temp /= (n/i);
               if(temp % (n/i) == 1) ans++;
          }
     }
     ans++;
     cout << ans << endl;
     return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define FOR(i, b, n) for (ll i = b; i < n; ++i)

using namespace std;
using ll = long long;
using P = pair<int, int>;

void solve(ll N, vector<string> S) {
  unordered_map<char, ll> count;
  REP(i, N) {
    const char head = S[i].front();
    switch (head) {
    case 'M':
    case 'A':
    case 'R':
    case 'C':
    case 'H':
      count[head]++;
      break;
    default:
      break;
    }
  }

  vector<ll> num(5);
  num[0] = count['M'];
  num[1] = count['A'];
  num[2] = count['R'];
  num[3] = count['C'];
  num[4] = count['H'];
  ll ans(0);

  ll comb = (1LL << 3) - 1;
  while (comb < (1LL << 5)) {
    ll ans_comb(1);
    REP(i, 5)
      if ((1LL << i) & comb)
	ans_comb *= num[i];
    ans += ans_comb;
    ll x = comb & -comb;
    ll y = comb + x;
    comb = ((comb & ~y) / x >> 1) | y;
  }
  cout << ans << endl;
}

int main(){
  // int 3E4  long 2E9  ll 9E18
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;
  vector<string> S(N);
  REP(i, N) {
    cin >> S[i];
  }

  solve(N, move(S));

  return 0;
}


Measured memory_bytes: 6344
from itertools import permutations
from math import sqrt

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]

result = 0
d = 0
for p in permutations(xy):
    d += 1
    for i in range(N - 1):
        result += sqrt((p[i][0] - p[i + 1][0]) * (p[i][0] - p[i + 1][0]) + (p[i][1] - p[i + 1][1]) * (p[i][1] - p[i + 1][1]))
print(result / d)


Measured memory_bytes: 3064
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<int>> mat;


int main(){
    int N;cin>>N;
    ll K;cin>>K;
    ll A[200010],S[200010];
    S[0]=0;
    
    //S[r]%Kが等しいrの集合
    mat c(200010);
    //Sのインデックス
    map<int,int> mp;
    int m=2;
    
    c[1].push_back(0);
    mp[0]=1;

    for(int i=0;i<N;i++){
        cin>>A[i];
        S[i+1]=S[i]+A[i]-1;
        if(mp[S[i+1]%K]==0){
            c[m].push_back(i+1);
            mp[S[i+1]%K]=m;
            m++;
        }
        else{
            c[mp[S[i+1]%K]].push_back(i+1);
        }
    }

    ll ans=0;
    for(int i=0;i<c.size();i++){
        int r=1;
        for(int j=0;j<c[i].size();j++){
            while(c[i][r]<c[i][j]+K && r<c[i].size()){
                r++;
            }
            ans+=r-j-1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 23680
/**
*	created: 29.08.2020 20:57:32
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

signed main() {
    int a, b, c; cin >> a >> b >> c;
    if (b * c >= a) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

using namespace std;

int main() {
	int n;
	cin >> n;
	int* A = new int[n];
	
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}

	int q;
	cin >> q;
	int k;
	int answer;

	for (int i = 0; i < q; i++) {
		cin >> k;
		answer = lower_bound(A, A + n, k) - A;
		cout << answer << endl;
	}   
}


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

int main(){
    int N, x; cin >> N >> x;
    if(x == 1 || x == 2 * N - 1){
        puts("No");
        return 0;
    }
    vector<int> ans(2 * N - 1);
    for(int i = 0; i <  2 * N - 1; i++) ans[i] = i + 1;
    if(x > N) rotate(ans.begin(), ans.begin() + x - N, ans.end());
    else if(x < N) rotate(ans.rbegin(), ans.rbegin() + N - x, ans.rend());

    puts("Yes");
    for(int i = 0; i < ans.size(); i++){
        if(i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;

}

Measured memory_bytes: 2304
// A.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	bool ans = s.length() + 1 == t.length() && t.substr(0, s.length()) == s;
	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 3628
import java.util.*;

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

        long n = scan.nextLong(), m = scan.nextLong();
        for(int i = 0; i < m; i++) {
            n -= scan.nextLong();
            if(n < 0) {
                System.out.println(-1);
                scan.close();
                return;
            }
        }
        System.out.println(n);
        scan.close();
        return;
    }
}

Measured memory_bytes: 46080
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000007
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
typedef long long lli;

int main()
{
    lli i, n, a[5], min=1e15;
    scanf("%lld",&n);
    for(i=0; i<5; i++) {
        scanf("%lld",a+i);
        min = MIN(min, a[i]);
    }
    //printf("%lld\n",min);
    if(n<=min) {
        printf("5");
        return 0;
    }
    lli ans = (n) / min + 4;
    if(n%min!=0) {
        ans += 1;
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
    #include <bits/stdc++.h>
    using namespace std;
    int main(){
        int N, M;
        cin >> N;
        string vec1[N];
        
        for(int i=0;i<N;i++){
            cin >> vec1[i];
        }
        cin >> M;
        string vec2[M];
        for(int i=0;i<M;i++){
            cin >> vec2[i];
        }
        
        
        int ans = 0;
        string x;
        int result;
        for(int i=0;i<N;i++){
            x = vec1[i];
            int count1 = 0;
            int count2 = 0;
            for(int k = 0;k<N;k++){
                if(vec1[k] == x) ++count1;
                
            }

            for(int j = 0;j<M;j++){
                if(vec2[j] == x) ++count2;
                
            }
            result = count1 - count2;
            ans = max(result,ans);

        }
        cout << ans << endl;
    }

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: u128,
        a: [u128; n],
    }

    let mut sum: u128 = 0;
    for i in 0..a.len() {
        sum += a[i];
    }

    let mut ans: u128 = 0;
    for i in 0..a.len() {
        sum -= a[i];
        ans += a[i] * sum;
        ans %= 1000000000u128 + 7u128;
    }

    println!("{}", ans);
}


Measured memory_bytes: 7188
N,M=map(int,input().split())
alist=list(map(int,input().split()))

slist=[0]
asum=0
for a in alist:
  asum+=a
  slist.append(asum%M)
#print(alist)
#print(slist)

answer=0
sdic={}
for s in slist:
  if s in sdic:
    answer+=sdic[s]
    sdic[s]+=1
  else:
    sdic[s]=1

print(answer)

Measured memory_bytes: 16172
#include <iostream>
#include <vector>
#include <sstream>
#include <cstring>
using namespace std;
int charToInt(char);
class SolveMinValue {
  public:
    vector<vector<int> > field;
    int memo[51][51];
    void setField(vector<vector<int> > _field) {
      field = _field;
      memset(memo, -1, sizeof(memo));
    }
    int solve(int startx, int starty, int destx, int desty) {
      if(memo[destx][desty] != -1) return memo[destx][desty];
      int result = field[destx][desty] + (
          (startx == destx && starty == desty) ? 0 :
          (startx == destx) ? solve(startx, starty, destx, desty - 1) :
          (starty == desty) ? solve(startx, starty, destx - 1, desty) :
          min(solve(startx, starty, destx - 1, desty), solve(startx, starty, destx, desty - 1))
      );
      memo[destx][desty] = result;
      return result;
    }
};

int main() {
  int height, width;
  cin >> height >> width;
  vector<vector<int> > field(height, vector<int>(width));
  for(int h = 0; h < height; ++h) for(int w = 0; w < width; ++w) {
    char c;
    cin >> c;
    int n = charToInt(c);
    field[h][w] = n;
  }
  SolveMinValue solver;
  solver.setField(field);
  cout << solver.solve(0, 0, height - 1, width - 1) << endl;
  return 0;
}

int charToInt(char c) {
  stringstream ss;
  int d;
  ss << c;
  ss >> d;
  return d;
}

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

long long n,m;
vector<long long> a,b,ans;
int main(){
  long long i,j,p,sum=0,T=1,count =0,ansum=0;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> p;
    a.push_back(p);
  }
  for(i=0;i<n;i++){
    cin >> p;
    b.push_back(p);
  }

  //solve
  for(i=0;i<30;i++){
    vector<long long>now = b;
    for(j=0;j<n;j++){
      now[j] %= T*2;
    }
    sort(now.begin(),now.end());
    for(j=0;j<n;j++){
      long long x = a[j];
      x %= T*2;
      count += (lower_bound(now.begin(),now.end(),2*T-x) - lower_bound(now.begin(),now.end(),T-x));
          count += (lower_bound(now.begin(),now.end(),4*T-x) - lower_bound(now.begin(),now.end(),3*T-x));
    }
    if(count%2==1)ans.push_back(1);
    else ans.push_back(0);
    count =0;
    T *=2;
  }

  p=1;
  for(i=0;i<30;i++){
    ansum += ans[i]*p;
    p*=2;
  }
  cout << ansum << endl;
  return 0;
}


Measured memory_bytes: 5104
#      
import collections, atexit, math, sys, bisect 

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

try :
    #raise ModuleNotFoundError
    import numpy
    def dprint(*args, **kwargs):
        #print(*args, **kwargs, file=sys.stderr)
        # in python 3.4 **kwargs is invalid???
        print(*args,  file=sys.stderr)
    dprint('debug mode')
except Exception:
    def dprint(*args, **kwargs):
        pass



inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    sys.stdin = open('input'+ str(inId) + '.txt', 'r') #标准输出重定向至文件
if outId>0:
    dprint('use output', outId)
    sys.stdout = open('stdout'+ str(outId) + '.txt', 'w') #标准输出重定向至文件
    atexit.register(lambda :sys.stdout.close())     #idle 中不会执行 atexit
    
N, = getIntList()
#print(N)


if N in [3,5,7]:
    print("YES")
else:
    print("NO")





Measured memory_bytes: 38384
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, K;
vector<int> G[2000];
int dfs(int x, int p, int d) {
  if (d<0)return 0;
  int c = 1;
  for (int t : G[x]) {
    if (t == p) continue;
    c += dfs(t, x, d-1);
  }
  return c;
}
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> K;

  vector<P> edges;
  rep(i, N-1) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].pb(b);
    G[b].pb(a);
    edges.pb(P(a, b));
  }
  int m = N;
  if (K%2 == 0) {
    rep(i, N) {
      m=min(m,N-dfs(i,-1,K/2));
    }
  }
  else {
    for (P p : edges) {
      m=min(m,N-(dfs(p._1,p._2,(K-1)/2)+dfs(p._2,p._1,(K-1)/2)));
    }
  }
  cout<<m<<"\n";
  return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}

template<typename T>
T gcd(T x, T y){
    if (x == 0 || y == 0) {
        return 0;
    }

    while (x != y){
        if (x > y) {
            x -= y;
        }else{
            y -= x;
        }
    }
    return x;
}

// }}}
/* vim:set foldmethod=marker: */

void solve(){
    int n, k;
    cin >> n >> k;

    int r = n % k;
    if (r == 0) {
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }


    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }

// string を int に変換 stoi("1010")
// int を string に変換 to_string(1010)


// map の key, value を全て抜き出す。
// for (auto itr = mp.begin(); itr != mp.end(); itr++) {
//     cout << "key" << itr->first << " value" << itr->second << endl;
// }

// 文字列の検索
// string s="abc";
// if (s.find('d') == string::npos){
//     cout << "find" << endl;
// }else{
//     cout << "not find" << endl;
// }


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

namespace algorithm
{
	class Program
	{
		public static void Main()
		{
			int[] nm = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
			int[] num = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
			var odd = num.Where((p, i) => i % 2 == 0).GroupBy(x => x).OrderByDescending(y => y.Count()).ToList();
			var even = num.Where((p, i) => i % 2 != 0).GroupBy(x => x).OrderByDescending(y => y.Count()).ToList();
			int odd_ = odd[0].ToList()[0];
			int even_ = even[0].ToList()[0];
			
			if (odd_ == even_)
			{
				if (even.Count <= 1 || odd.Count <= 1)
				{
					if (even.Count <= 1 && odd.Count <= 1)
					{
						even_ = -1;
					}
					else if (even.Count > 1)
					{
						even_ = even[1].ToList()[0];
					}
					else
					{
						odd_ = odd[1].ToList()[0];
					}
				}
				else if (odd[1].Count() > even[1].Count())
				{
					odd_ = odd[1].ToList()[0];
				}
				else
				{
					even_ = even[1].ToList()[0];
				}
			}
			int ans1 = num.Where((p, i) => i % 2 == 0).Where(x=>x!=odd_).Count();
			int ans2 = num.Where((p, i) => i % 2 != 0).Where(x => x!= even_).Count();


			//最頻値
			Console.WriteLine(ans1 + ans2);
			

		}





	}

}




Measured memory_bytes: 34200
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vi = vector<int>;
using vchar = vector<char>;
using vstr = vector<string>;
using pll =  pair<ll,ll>;

const ll mod = 1000000007;
const ll inf = 1000000000000000;

#define pi acos(-1)
#define pb push_back
#define test int TEST;cin>>TEST;while(TEST--)
#define all(x) x.begin(),x.end()
#define vsort(x) sort(all(x))
#define vrev(x) reverse(all(x));
#define vrevsort(xx) sort(xx.rbegin(),xx.rend())
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c,d)))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define opsp(x) cout<<x<<' '
#define opy cout<<"YES\n"
#define opn cout<<"NO\n"
#define flush fflush(stdout)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)
#define reprev(i,a,b) for(int i=a;i>=b;i--)


void solve(){
	int n;cin>>n;
  	int val=n%1000;
   if(val) cout<<1000-n%1000;
  else cout<<0;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    //test{solve();cout<<'\n';}
	solve();
    return 0;
}


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

typedef long long ll;
ll n, ans, d[25][25];
vector<ll> b, c;
string a;

ll g() {
	ll i, j, t;
	d[0][0] = 1;
	for (i = 0; i < b.size(); i++) {
		for (j = 0; j < c.size(); j++) {
			if (i == 0 && j == 0) continue;
			t = n * 2 - (i + j);
			d[i][j] = 0;
			if (i > 0 && a[t] == a[b[i]]) d[i][j] += d[i - 1][j];
			if (j > 0 && a[t] == a[c[j]]) d[i][j] += d[i][j - 1];
		}
	}
	return d[b.size() - 1][c.size() - 1];
}

void f(ll p) {
	if (p == n) {
		ans += g();
		return;
	}
	b.push_back(p);
	f(p + 1);
	b.pop_back();
	c.push_back(p);
	f(p + 1);
	c.pop_back();
}

int main()
{
	cin >> n;
	cin >> a;
	b.push_back(-1);
	c.push_back(-1);
	f(0);
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
#define mod 1000000007
ll mypower(ll a, ll b, ll N)
{
    ll ans = 1;
    while(b)
    {
        if(b%2)
            ans = ans*a%N;
        b=b/2;
        a=a*a%N;
    }
    return ans;
}
void bfs(vector<int> graph[], int v, int par[], int vis[])
{
    queue<int> q;
    q.push(v);
    vis[v] = 1;
    while(q.empty() == false)
    {
        int tp = q.front();
        q.pop();
        for(auto j : graph[tp])
        {
            if(!vis[j])
            {
                vis[j] = 1;
                par[j] = tp;
                q.push(j);
            }
        }
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    vector<int> graph[n+1];
    int i;
    for(i=1;i<=m;i++)
    {
        int x, y;
        cin >> x >> y;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    int par[n+1]={0}, vis[n+1]={0};
    bfs(graph, 1, par, vis);
    bool ok = 1;
    for(i=1;i<=n;i++)
        if(!vis[i])
        {
            ok = 0;
            break;
        }
    if(!ok)
        cout << "No\n";
    else
    {
        cout << "Yes\n";
        for(i=2;i<=n;i++)
            cout << par[i] << '\n';
    }
}

Measured memory_bytes: 10908
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  int N;
  string s, t;
  cin >> N >> s >> t;
  vector<char> a;
  REP(i, N) a.push_back(s[i]);
  REP(i, N) a.push_back(t[i]);
  ll ans = s.size() + t.size();
  REP(i, N) {
    bool check = true;
    a.erase(a.begin() + N);
    REP(j, N) {
      if (a[i] != s[i]) check = false;
    }
    REP(j, N) {
      if (t[N - 1 - j] != a[a.size() - 1 - j]) {
        check = false;
      }
    }
    if (check) ans = a.size();
  }
  cout << ans << endl;
}

Measured memory_bytes: 3656
import sys
def input():
  return sys.stdin.readline().rstrip()

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

MOD=10**9+7
num=[0]*30

for c in S:
  num[ord(c)-ord("a")]+=1

ans=1
for i in range(26):
  ans*=num[i]+1
  ans%=MOD

print((ans+MOD-1)%MOD)


Measured memory_bytes: 70724
#include <bits/stdc++.h>
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}

const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

const int N=0;

struct cmp
{
	bool operator() (pair<pii, int> &a,pair<pii, int> &b){
		return a.fr.fr>b.fr.fr;
	}
};

priority_queue<pair<pii, int>,vector<pair<pii, int>>,cmp> q;

int vis[55][7000];

vector<pair<int, pii>> v[100];
int c[100];
int d[100];

int ans[100];

void solve(){
	int n,m,s;
	cin>>n>>m>>s;
	rep(i,0,m){
		int x,y,a,b;
		cin>>x>>y>>a>>b;
		v[x].pb({y,{a,b}});
		v[y].pb({x,{a,b}});
	}
	
	rep(i,1,n+1){
		cin>>c[i]>>d[i];
		ans[i]=INF;
		rep(j,0,6001){
			vis[i][j]=INF;
		}
	}
	
	
	if(s>6000)s=6000;
	
	q.push({{0,s},1});
	
	
	while(!q.empty()){
		auto k=q.top();
		// cout<<k<<"\n";
		int t=k.fr.fr;
		int coins=k.fr.sc;
		int ver=k.sc;
		
		amin(ans[ver],t);
		
		q.pop();
		int x=coins+c[ver];
		int t2=t+d[ver];
		if(x<=6000){
			if(t2 < vis[ver][x]) q.push({{t2,x},ver}),vis[ver][x]=t2;
		}
		
		for(auto x:v[ver]){
			int nc=coins-x.sc.fr;
			int nt=t+x.sc.sc;
			if(nc>=0 && vis[x.fr][nc] > nt){
				q.push({{nt,nc},x.fr});
				vis[x.fr][nc]=nt;
			}
		}
		
	}
	
	rep(i,2,n+1){
		cout<<ans[i]<<"\n";
	}
	
}
signed main(){
	ios_base::sync_with_stdio(false);
	// cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#ifdef SEIVE
		seive();
	#endif
	#ifdef NCR
		init();
	#endif
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}


Measured memory_bytes: 11940
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back
#define inf 10000000000000000
#define N 1000000007
#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.x<<','<< P.y<<')';}
template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}

//edge cases when n=1 , m=1. wrong variable in loop. if<->while
signed main()
{
	speed
	int l;cin>>l;
	double t=l/3.0;
	printf("%.9lf",t*t*t);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int AMAX = 100000;
ll cnt[AMAX + 1];

int main(void) {
	int N;
	ll K;
	cin >> N >> K;

	for (int i = 0; i < N; ++i) {
		int A, B;
		cin >> A >> B;
		cnt[A] += B;
	}

	for (int ans = 1; ans <= AMAX; ++ans){
		if (K <= cnt[ans]) {
			cout << ans << endl;
			break;
		}
		K -= cnt[ans];
	}

	return 0;
}

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

signed main() {
  int N;
  cin >> N;
  vector<int> a(N + 1, 0);
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
  }

  vector<int> ans(N + 1, 0), v;
  for (int i = N; i >= 1; i--) {
    int sum = 0;
    for (int j = i; j <= N; j += i) {
      sum += ans[j];
    }
    if (sum % 2 != a[i]) {
      ans[i] = 1;
      v.push_back(i);
    }
  }

  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    if (i != 0) {
      cout << " ";
    }
    cout << v[i];
  }

  cout << endl;
  return 0;
}

Measured memory_bytes: 4980
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int t = sc.nextInt();
        int a = sc.nextInt();
        Double[] h = new Double[n];
        int x = 0;
        for(int i = 0 ; i < n ; i++ ){
            h[i] = sc.nextDouble();
            h[i] = Math.abs(a - t + h[i] * 0.006);
            if(h[x] > h[i]){
                x = i;
            }
        }
        System.out.println(x + 1);
        sc.close();
    }
}
//鶏になれ

Measured memory_bytes: 46840
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
        Scanner scan = new Scanner(System.in);
 int[] intArray = Arrays.stream(scan.nextLine().split(" ")) //" "で区切ってString配列へ
    .mapToInt(Integer::parseInt) //数値にして
    .toArray(); //配列へ

      long ac=(long)1f*intArray[0]*intArray[2];
      long ad=(long)1f*intArray[0]*intArray[3];
      long bc=(long)1f*intArray[1]*intArray[2];
      long bd=(long)1f*intArray[1]*intArray[3];
      long Max=ac;

       if(Max < ad) {
        Max = ad;
       }
       if(Max < bc) {
        Max = bc;
       }
       if(Max < bd) {
        Max = bd;
       }
      
       System.out.println(Max);
        scan.close();
	}
}

Measured memory_bytes: 36036
n, k = map(int, input().split())
cnt = 0
prob = 0
score = 0
for i in range(1, min(n+1,k)):
        score = i
        while True:
                score = score*2
                cnt += 1
                if score >= k:
                        break
        prob += 1/n * (1/2)**(cnt)
        cnt = 0
if n >= k:
        ans = (prob + (n-k+1)/n)
else:
        
        ans = prob
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array
#define deb(x) cout << #x << " = " << x << endl
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll N = 2e5 + 1;

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
inline ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
struct comp
{
    bool operator()(const pair<ll, ll> &x, const pair<ll, ll> &y) const
    {
        return x.first < y.first;
    }
};
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwr(ll x, ll n)
{
    if (n == 0)
        return 1;
    if (n & 1)
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    else
        return pwr(mul(x, x), n / 2);
}
ll modInv(ll n)
{
    return pwr(n, mod - 2);
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}
int main()
{
    IOS;
    int t = 1;
  //  cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int a[n], b[n];
        bool f = true;
        unordered_map<int, int> m1, m2;
        for (int i = 0; i < n; i++)
            cin >> a[i], m1[a[i]]++;
        for (int i = 0; i < n; i++)
        {
            cin >> b[i];
            m2[b[i]]++;
            if (m1[b[i]] + m2[b[i]] > n)
            {
                f = false;
            }
        }
        if (!f)
            cout << "No" << endl;
        else
        {
            cout << "Yes" << endl;
            reverse(b, b + n);
            int j = 0, k = n - 1;
            for (int i = 0; i < n; i++)
            {
                if (a[i] == b[i])
                {
                    while (j < n && (a[j] == b[i] || b[j] == a[i]))
                    {
                        j++;
                    }
                    swap(b[j], b[i]);
                    j = 0;
                }
            }
            for (int i = 0; i < n; i++)
                cout << b[i] << " ";
            cout << endl;
        }
    }
}

Measured memory_bytes: 21328
word = input()
li = ['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']
if word in li:
  print("a")
else:
  print("A")

Measured memory_bytes: 8816
n,k=map(int,input().split())
A=[int(i) for i in input().split()]
AA=[0]*n
B=[2*n+1]*(2*(10**5)+1)
for i in reversed(range(n)):
  B[A[i]]=n+i+1
for i in reversed(range(n)):
  AA[i]=B[A[i]]-(i+1)
  B[A[i]]=i+1
count,index,inc=0,0,0
Chk=[0]*n
flag=False
while count<n*k:

  inc=AA[index]+1
  count+=inc  
  index=(index+inc)%n
  if Chk[index]!=0 or index==0:
    if flag==False:
      dd=count-Chk[index]
      count+=(((n*k)-count)//dd)*dd
      flag=True
  Chk[index]=count

count-=inc
index=(index+n-inc)%n

d=n*k-count
Ans1=A+A
Ans2=AA+AA
Ans=[]
i=index
while i<d+index:
  if i+Ans2[i]>=d+index:
    Ans.append(Ans1[i])
    i+=1
  else:
    i+=Ans2[i]+1
print(*Ans)


Measured memory_bytes: 106904
#  --*-coding:utf-8-*--

import math

N,D,A = map(int, input().split())
XH = sorted(tuple(map(int, input().split())) for _ in range(N))

Q = []
qIdx = 0
s = 0
t = 0

for (x, h) in XH:
    while qIdx < len(Q) and  Q[qIdx][0] < x:
        s -= Q[qIdx][1]
        qIdx += 1

    if s < h:
        q = int(math.ceil((h-s)/A))
        Q.append((x+2*D, q*A))
        s += q*A
        t += q

print(t)


Measured memory_bytes: 58596
import java.util.*;                                                                                  

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] l = line.split(" ");
        int a = Integer.parseInt(l[0]);
        int b = Integer.parseInt(l[1]);
        int c = Integer.parseInt(l[2]);

        int count = 0;
        for(int i = a; i <= b; i++) {
          if(c % i == 0) {
            count++;
          }   
        }   

        System.out.println(count);
    }   
}

Measured memory_bytes: 26152