akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
#include <queue>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;

vector<int> primes;
map<int, int> factors;

void erathosthenes(int n) {
    bool primeFlags[n+1];
    for (int i = 0; i <= n; i++) primeFlags[i] = true;
    primeFlags[0] = primeFlags[1] = false;
    vector<int> sqrtprimes;
    for (int i = 2; i*i <= n; i++) {
        bool mod0 = false;
        for (int j = 2; j*j <= i; j++) {
            if (i%j == 0) mod0 = true;
        }
        if (!mod0) sqrtprimes.push_back(i);
    }
    for (int i = 0; i < sqrtprimes.size(); i++) {
        for (int j = 2; j <= n; j++) {
            if (j%sqrtprimes[i] == 0) primeFlags[j] = false;
        }
    }
    for (int i = 0; i < sqrtprimes.size(); i++) primeFlags[sqrtprimes[i]] = true;
    for (int i = 1; i <= n; i++) if (primeFlags[i]) primes.push_back(i);
    return;
}

void factoring(ll n) {
    ll m = sqrt(n);
    erathosthenes(m);
    for (int i = 0; i < primes.size(); ++i) {
        while(n%primes[i] == 0){
            factors[primes[i]]++;
            n /= primes[i];
        }
    }
    factors[n]++;
    factors.erase(1);
}

int main(int argc, char const *argv[]) {
    ll n, p;
    cin >> n >> p;
    if (n == 1) {
        cout << p << std::endl;
        return 0;
    }
    if (p == 1) {
        cout << 1 << std::endl;
        return 0;
    }
    factoring(p);
    ll ans = 1;
    for (auto x : factors) {
        long double sisu = x.second/n;
        long double jousu = powl(x.first, sisu);
        ans *= jousu;
    }
    cout << ans << std::endl;
    return 0;
}

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

int x,y,a,b,c,k;
    vector<int>verde;
    vector<int>verm;
    vector<int>color;
int32_t main(){
    cin>>x>>y>>a>>b>>c;

    for(int i=0;i<a;i++){
        cin>>k;
        verm.push_back(k);
    }
    for(int i=0;i<b;i++){
        cin>>k;
        verde.push_back(k);
    }
    for(int i=0;i<c;i++){
        cin>>k;
        color.push_back(k);
    }



    sort(verm.begin(),verm.end(),greater<int>());
    sort(verde.begin(),verde.end(),greater<int>());

    for(int i=0;i<x;i++){
        color.push_back(verm[i]);
    }
    for(int i=0;i<y;i++){
        color.push_back(verde[i]);
    }
    sort(color.begin(),color.end(),greater<int>());
    int resp=0;
    for(int i=0;i<x+y;i++){
        resp+=color[i];
    }
    cout<<resp;



}

Measured memory_bytes: 7792
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back

using namespace std;

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

int n;
vll dp(1000005, -1);
vector<bool> broken(1000005, false);

ll f(int p) {
    if (broken[p]) {
        return 0;
    }
    if (p == n || p == n-1) {
        return 1;
    }
    if (dp[p] != -1) {
        return dp[p];
    }
    ll ans = (f(p+1) + f(p+2)) % ((ll)(1e9 + 7));
    dp[p] = ans;
    return ans;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	
    int m, val;
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        cin >> val;
        broken[val] = true;
    }
	
    cout << f(0) << endl;
	
	return 0;
}


Measured memory_bytes: 11264
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define re cin>>
#define pr cout<<
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)


const int N=2e6+5;
const int mod=1e9+7;


int main(){
      
      cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false);
      int x;
      cin>>x;
      if(x>=30) cout<<"Yes";
      else cout<<"No";
      
      return 0;
}

Measured memory_bytes: 3632
N = int(input())
S = []
S += [input()]
S += [input()]

idx = 0
if S[0][idx]==S[1][idx]:
    flag = 0
    cnt = 3
    idx +=1
elif S[0][idx]!=S[1][idx]:
    flag = 1
    cnt = 6
    idx +=2

while idx<N:
  tmp = [S[0][idx],S[1][idx]]
  if flag == 0:
    if S[0][idx]==S[1][idx]:
      cnt *=2
      flag = 0
      idx +=1
    else:
      cnt *=2
      flag =1
      idx +=2
  elif flag ==1:
    if S[0][idx]==S[1][idx]:
      cnt *=1
      flag = 0
      idx +=1
    else :
      cnt *=3
      flag =1
      idx +=2

print(cnt%1000000007)

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

using i64 = std::int64_t;

namespace io {
  using i64 = std::int64_t;
  constexpr int is = 1 << 17;
  char ib[is], *ip = ib + is, it;
  inline char getc() {
    if (ip == ib + is) { read(STDIN_FILENO, ib, is); ip = ib; }
    return *ip++;
  }
  inline i64 scan() {
    i64 r = 0;
    if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';
    else while ((it = *ip++) & 16) r = r * 10 + it - '0';
    return r;
  }
  constexpr int os = 1 << 17;
  char ob[os], *op = ob, ot;
  inline void putc(const char c) {
    *op++ = c;
    if (op == ob + os) { write(STDOUT_FILENO, ob, os); op = ob; }
  }
  /* x shoud be greater than or equal to zero */
  inline void print(i64 x) {
    char d[20];
    int i = 0;
    while (true) {
      d[i] = x % 10 + 48;
      x /= 10;
      ++i;
      if (x <= 0) break;
    }
    while (i--) {
      putc(d[i]);
    }
  }
  inline void flush() {
    write(STDOUT_FILENO, ob, op - ob);
  }
}

signed main() {
  using namespace io;
  i64 h = scan();
  i64 n = scan();
  i64 s = 0;
  for (int i = 0; i < n; i++) {
    i64 a = scan();
    s += a;
  }
  if (s >= h) {
    puts("Yes");
  } else {
    puts("No");
  }
}

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

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

    vector<vector<int> > P(N+1);
    rep(i, M){
        int A, B;
        cin >> A >> B;
        P[A].push_back(B);
        P[B].push_back(A);
    }

    vector<int> ans(N+1, -1);
    ans[1] = 0;

    queue<int> X;
    X.push(1);

    while (!X.empty()){
        int i = X.front(); X.pop();
        for (int j = 0; j < P[i].size(); j++){
            int a = P[i][j];
            if(ans[a] == -1){
                ans[a] = i;
                X.push(a);
            }
        }
    }

    cout << "Yes" << endl;

    rep(i, N-1){
        cout << ans[i+2] << endl;
    }
}

Measured memory_bytes: 13392
#include<bits/stdc++.h>
#define fi first
#define se second
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pi pair<int,int>
#define pb push_back
#define IT iterator
#define SZ(a) ((int)a.size())
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int N=4e5+10,size=1<<20,mod=998244353;
const ll inf=1e18;

template<class o> void qr(o &x) {
	char c=gc; x=0; int f=1;
	while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
	while(isdigit(c)) x=x*10+c-'0',c=gc;
	x*=f;
}
template<class o> void qw(o x) {
	if(x/10) qw(x/10);
	putchar(x%10+'0');
}
template<class o> void pr1(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); puts("");
}


int n,dic[150],f[N*2][2],g[N*2][2];
ll ans=inf;
vector<pi> x[N],y[N];

int main() {
	qr(n);
	dic['U']=0;
	dic['D']=1;
	dic['R']=2;
	dic['L']=3;
	for(int i=1;i<=n;i++) {
		int a,b,c;qr(a); qr(b);
		char str[6]; scanf("%s",str);
		a++; b++; c=dic[str[0]];
		x[a].pb(mk(b,c));
		y[b].pb(mk(a,c));
	}
	for(int i=1;i<N;i++) {
		sort(all(x[i]));
		sort(all(y[i]));
		ll a,b;
		a=b=inf;
		for(auto j:x[i]) {
			if(j.se==0) a=j.fi;
			else if(j.se==1) b=j.fi;
			if(a<b) ans=min(ans,(b-a)*5);
		}
		a=b=inf;
		for(auto j:y[i]) {
			if(j.se==2) a=j.fi;
			else if(j.se==3) b=j.fi;
			if(a<b) ans=min(ans,(b-a)*5);
		}
	}
	for(int i=1;i<N;i++) 
		for(auto j:x[i]) {
			int t=j.fi;
			if(j.se==2) {
				f[j.fi-i+N][0]=i;
				f[j.fi+i][1]=i;
			}
			else if(j.se==3) {
				int k=g[j.fi+i][1];
				if(k) ans=min(ans,(i-k)*10LL);
				k=g[j.fi-i+N][0];
				if(k) ans=min(ans,(i-k)*10LL);
			}
			else if(j.se==1) {
				int k=f[j.fi-i+N][0];
				if(k) ans=min(ans,(i-k)*10LL);
				g[j.fi+i][1]=i;
			}
			else if(j.se==0) {
				int k=f[j.fi+i][1];
				if(k) ans=min(ans,(i-k)*10LL);
				g[j.fi-i+N][0]=i;
			}
		}
	if(ans>inf/2) puts("SAFE");
	else pr2(ans);
	return 0;
}



Measured memory_bytes: 40052
from collections import Counter


def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    counter = Counter(A)
    searched = [0 for _ in range(10 ** 6 + 1)]
    ans = 0
    for i in range(1, 10 ** 6 + 1):
        if counter[i] == 0:
            continue
        if searched[i] == 0 and counter[i] == 1:
            ans += 1
        for j in range(1, ((10 ** 6) // i) + 1):
            searched[i * j] = 1
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 44020
import sys,queue,math,copy,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())

N,M = LI()
g = [[i,0] for i in range(N+1)]
g_num = [1 for i in range(N+1)]

def find(x,z):
    if g[x][0] == x: return x,z
    r,d = find(g[x][0],g[x][1])
    g[x] = [r,d]
    return g[x][0],g[x][1]+z

def union(x,y,d):
    if g_num[g[x][0]] < g_num[g[y][0]]:
        x,y = y,x; d = -d
    g_num[g[x][0]] += g_num[g[y][0]]
    g_num[g[y][0]] = 0
    g[g[y][0]][1] = g[x][1] + d - g[y][1]
    g[g[y][0]][0] = g[g[x][0]][0]


for _ in range(M):
    l,r,d = LI()

    if find(l,0)[0] == find(r,0)[0]:
        if g[l][1] + d != g[r][1]:
            print('No')
            exit(0)
    else:
        union(l,r,d)
print('Yes')


Measured memory_bytes: 111532
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_CHAR_MAX		100005									// 最大文字数

// 内部変数
static FILE *szpFpI;											// 入力
static char sc1Str[D_CHAR_MAX];									// 文字列
static int siSLen;												// 文字列長

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 文字列長 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siSLen);

	// 文字列 - 取得
	fgets(sc1Str, sizeof(sc1Str), szpFpI);

	// 融合数 - 取得
	int liCnt = 0;
	for (i = 1; i < siSLen; i++) {
		if (sc1Str[i] == sc1Str[i - 1]) {
			liCnt++;
		}
	}

	return siSLen - liCnt;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(){
    int r,d,x=0;
    scanf("%d %d %d",&r,&d,&x);
    x=(r*x)-d;
    printf("%d",x);
    for(int i=0;i<9;i++){
        x=(r*x)-d;
        printf("\n%d",x);
    }
    return 0;
}

Measured memory_bytes: 128
# 参考URL https://note.nkmk.me/python-union-find/
class UnionFind():
    # 各要素の親要素の番号を格納するリスト
    # 要素が根（ルート）の場合は-(そのグループの要素数)を格納する
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    # 要素xが属するグループの根を返す
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    # 要素xが属するグループと要素yが属するグループとを併合する
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    # 要素x, yが同じグループに属するかどうかを返す
    def same(self, x, y):
        return self.find(x) == self.find(y)

def main():
    from sys import stdin
    def input():
        return stdin.readline().strip()
    
    n, m = map(int, input().split())
    p = list(map(int, input().split()))

    uf = UnionFind(n)
    for _ in range(m):
        i, j = map(int, input().split())
        uf.union(i-1, j-1)
    
    ans = 0
    for i in range(n):
        if uf.same(i, p[i]-1):
            ans += 1
    
    print(ans)

main()

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> r(2019);
  string s;
  ll o = 0;
  cin >> s;
  for(int i = 0; i < s.length(); i++) {
    vector<int> tr(2019);
    tr[s[i] - '0'] = 1;
    for(int j = 0; j < 2019; j++) tr[(j * 10 + s[i] - '0') % 2019] += r[j];
    r = tr;
    o += r[0];
  }
  printf("%lld\n", o);
}

Measured memory_bytes: 3840
N, Y = map(int, input().split())

for ib in range(9):
    if (Y-4000*ib-1000*N) % 9000 == 0:
        a = (Y-4000*ib-1000*N)//9000
        if a >= 0 and N-a-ib >= 0:
            print(a, ib, N-a-ib)
            exit()
print(-1, -1, -1)


Measured memory_bytes: 2940
import math
k = int(input());
    
sum = 0;
sum += (k*k*k-(k-1)*(k-1)*(k-1))

for p in range(2,k+1):
    for q in range(2,k+1):
        g = math.gcd(p,q);
        if g == 1:
            sum += k-1
        else:
            for r in range(2,k+1):
                sum += math.gcd(g,r);
            
print(sum);

Measured memory_bytes: 9136
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <cstdio>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll s;
  cin >> s;
  ll x1, x2, x3, y1, y2, y3;
  x1 = 0;
  y1 = 0;
  x3 = 0;
  y2 = 0;
  x2 = 0;
  y3 = 0;

  x2 = (MOD-7);
  y2 = 1;

  ll mod = s % (MOD-7);
  ll div = s / (MOD-7);

  y3 = div + 1;
  x3 = (MOD-7) - mod;

  if(s == 1000000000000000000ll){
    x3 = 0;
    y3 = x2;
    y2 = 0;
  }

  printf("%lld %lld %lld %lld %lld %lld", x1, y1, x2, y2, x3, y3);
}


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

using namespace std;

#define pb push_back
#define F first
#define S second
#define INF ll(1e18)
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
    int a;cin>>a;cout<<(a*a);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define all_acc(x) (x).begin(),(x).end(),0LL
#define int long long
using namespace std;
using P=pair<int,int>;
using Graph=vector<vector<int>>;
using ll=long long;

int accumulate(int* a,int n){
    return accumulate(a,a+n,0LL);
}

int accumulate(vector<int> a){
    return accumulate(a.begin(),a.end(),0LL);
}

vector<pair<int,int>> soinsuu(int n){
    vector<pair<int,int>> ret;
    for(int i=2;i*i<=n;i++){
        if(n%i !=0) continue;
        int ex=0;
        while(n%i ==0){
            ex++;
            n /= i; //n変更することで、それ以降の約数で割り切れることはない
        }
        ret.push_back(make_pair(i,ex));
    }
    //nが素数だった場合
    if(n!=1) ret.push_back(make_pair(n,1));
    return ret;
}

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

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

    // 素数である
    return true;
}

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

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

    sort(all(a));

    int len=pow(10,6);
    vector<int> able(len+1,0);
    int result=0;

    for(int i=0;i<n;i++){
        if(se[a[i]]>1){
            if(able[a[i]]==0){
                int key=a[i];
                int plus=a[i];
                while(key<=len){
                    able[key]=1;
                    key+=plus;
                }
            }
        }else{
            int key=a[i];
            int plus=a[i];
            if(able[key]==0){
                result++;
                while(key<=len){
                    able[key]=1;
                    key+=plus;
                }
            }
        }
    }

    cout<<result<<endl;


}  

Measured memory_bytes: 25068
#include<bits/stdc++.h>
#define rint register int
#define deb(x) cerr<<#x<<" = "<<(x)<<'\n';
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
const ll mod = 1e9 + 7;
const int maxn = 3e5 + 10;
int l, r, a, b; 

int main() {
	scanf("%d%d", &l, &r);
	ll x = 1e18;
	for(int i=l; i<=r; i++){
		for(int j=i+1; j<=r; j++){
			ll t = 1ll * i % 2019 * j % 2019 % 2019;
			if(t==0) {
				printf("0");
				return 0;
			}
			x = min(x, t);
		}
	}
	
	printf("%lld", x);
	
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    string S;
    cin >> S;
    int n = S.length();
    bool OK = true;
    for(int i=0;i<n;i++){
        if(i%2==0){
            if(S[i] == 'R'||S[i]=='U'||S[i]=='D') ;
            else OK =false;
        }
        if(i%2==1){
            if(S[i] == 'L'||S[i]=='U'||S[i]=='D') ;
            else OK =false;
        }
    }
    if(OK) cout << "Yes" <<endl;
    else cout << "No" <<endl;
}

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

int main(){
    int h, a, x=0;
    cin >> h >> a ;
    for(int n=0; n*a<h; ++n){
        ++x;
    }
    cout << x << endl;

    return 0;
}
     

Measured memory_bytes: 256
n,k,c=map(int,input().split())
s="?"+input()
fwd=set()
now=1
while now<=n:
	if s[now]=="o":
		fwd.add(now)
		now+=c+1
	else:
		now+=1
bwd=set()
now=n
while now>=1:
	if s[now]=="o":
		bwd.add(now)
		now-=c+1
	else:
		now-=1
if len(fwd)==k:
	print(*sorted(list(fwd&bwd)),sep="\n")
else:
	exit()

Measured memory_bytes: 47256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

const vector<vector<int>> dir4 = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};

int main()
{
    int h, w;
    cin >> h >> w;
    vector<vector<bool>> hen(h + 2, vector<bool>(w + 2));
    for(int i = 1; i <= h; i++)for(int j = 1; j <= w; j++){
        char tmp; cin >> tmp; hen[i][j] = tmp == '.';
    }
    int res = 0;

    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            for(int k = 1; k <= h; k++){
                for(int t = 1; t <= w; t++){

                    if(!hen[i][j] || !hen[k][t])continue;
                    vector<vector<int>> dist(h + 2, vector<int>(w + 2, -1));
                    queue<pair<int,int>> que;
                    dist[i][j] = 0;


                    que.push({i,j});
                    while(true) {
                        auto cur = que.front();
                        que.pop();
                        if(cur.first == k && cur.second == t){
                            res = max(res, dist[cur.first][cur.second]);
                            break;
                        }

                        for(int i = 0; i < 4; i++){
                            int y = cur.first + dir4[i][0], x = cur.second + dir4[i][1];
                            if(!hen[y][x] || dist[y][x] != -1)continue;
                            dist[y][x] = dist[cur.first][cur.second] + 1;
                            que.push({y,x});
                        }
                    }

                    
                }
            }
        }
    }


    cout << res << endl;

}

Measured memory_bytes: 256
N = int(input())
P = list(map(int, input().split()))
p0 = 0
p1 = P[0]
temp = []
for i, p in enumerate(P[1:]):
    if p >= p1:
        p0 = p1
        p1 = p
        continue
    else:
        temp.append(i)
        p1 = p

if len(temp) == 2:
    P[temp[0]], P[temp[1]+1] = P[temp[1]+1], P[temp[0]]

    p0 = 0
    p1 = P[0]
    temp = []
    for i, p in enumerate(P[1:]):
        if p >= p1:
            p0 = p1
            p1 = p
            continue
        else:
            temp.append(i)
            p1 = p
    if len(temp) == 0:
        print("YES")
    else:
        print("NO")
elif len(temp)==0:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 61576
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int n, b[100] = { 0 }, i, j, m;
	char a[100][100], s;
	cin >> n;
	for (i = 1; i < n + 1; i++) {
		cin >> s >> m;
		if (s == 'S') {
			b[m]++;
		}
		else if (s == 'H') {
			b[m + 13]++;
		}
		else if (s == 'C') {
			b[m + 26]++;
		}
		else {
			b[m + 39]++;
		}
	}
	for (i = 1; i <= 52; i++) {
		if (b[i] == 0) {
			if (i > 0 && i < 14) {
				printf("S %d\n", i);
			}
			else if (i > 13 && i < 27) {
				printf("H %d\n", i - 13);
			}
			else if (i > 26 &&i < 40) {
				printf("C %d\n", i - 26);
			}
			else {
				printf("D %d\n", i - 39);
			}
		}
	}
}

Measured memory_bytes: 3176
#include <stdio.h>
#include <stdlib.h>

#define MAX_N (2000L)
#define MAX_K (2000L)
#define MAX_FACT (100000L)
#define NUM_MOD (1000000007L)

long fs[MAX_FACT + 1], finvs[MAX_FACT + 1], invs[MAX_FACT + 1];

void combination_init() {
  fs[0] = fs[1] = 1;
  finvs[0] = finvs[1] = 1;
  invs[1] = 1;
  for (long i = 2; i <= MAX_FACT; i++) {
    fs[i] = fs[i - 1] * i % NUM_MOD;
    invs[i] = NUM_MOD - invs[NUM_MOD % i] * (NUM_MOD / i) % NUM_MOD;
    finvs[i] = finvs[i - 1] * invs[i] % NUM_MOD;
  }
}

long combination(long n, long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fs[n] * (finvs[k] * finvs[n - k] % NUM_MOD) % NUM_MOD;
}

long mod(long n, long k) { return n % k >= 0 ? n % k : n % k + k; }

int main(int argc, char *argv[]) {
  // read inputs
  long N, K;
  scanf("%ld %ld", &N, &K);

  // solve
  combination_init();
  for (long i = 1; i <= K; i++) {
    if (N == K) {
      if (i == 1) {
        printf("1\n");
      } else {
        printf("0\n");
      }
    } else {
      const long t0 = combination(K - 1, i - 1);
      const long t1 = combination(N - K - 1, i);
      const long t2 = 2 * combination(N - K - 1, i - 1);
      const long t3 = combination(N - K - 1, i - 2);
      printf("%ld\n", mod(t0 * mod(t1 + t2 + t3, NUM_MOD), NUM_MOD));
    }
  }

  return 0;
}


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

namespace ConsoleApp15
{
    class Class51
    {
        static void Main()
        {
            //入力
            int n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(long.Parse).ToArray();

            //計算
            Array.Sort(a);
            long[] pair = new long[2];
            for(int i = n - 2; i >= 0; i--)
            {
                if (a[i] == a[i + 1])
                {
                    if (pair[0] == 0)
                    {
                        pair[0] = a[i];
                        i--;
                    }
                    else if (pair[1] == 0)
                    {
                        pair[1] = a[i];
                        break;
                    }
                }
            }

            //出力
            Console.WriteLine(pair[0] * pair[1]);
        }
    }
}


Measured memory_bytes: 21216
def main():
    def bisect(a,x):
        ok=len(a)
        ng=-1
        while ok-ng>1:
            mid=(ok+ng)//2
            if a[mid]>x:ok=mid
            else:ng=mid
        return ok
    import sys
    from operator import itemgetter
    b=sys.stdin.buffer
    n,d,a=map(int,b.readline().split())
    m=map(int,b.read().split())
    c=[0]*(n+1)
    z=sorted(zip(m,m),key=itemgetter(0))
    y=[x for x,_ in z]
    s=b=0
    for i,(x,h)in enumerate(z):
        c[i]+=b
        b=c[i]
        h-=b
        t=-h//a
        if t<0:
            b-=t*a
            c[bisect(y,x+d+d)]+=t*a
            s-=t
    print(s)
main()

Measured memory_bytes: 55880
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
	
	void run() {
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		System.out.println(n-k+1);
		
	}
}


Measured memory_bytes: 24276
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

signed main()
{
    int n, x, t;
    cin >> n >> x >> t; 
    int resultat = n * t / x;
    int div = resultat / t;
    int mod = resultat % t;
    if (mod == 0)
        cout << resultat;
    else 
        cout << t * (div + 1);
    return 0;
}

Measured memory_bytes: 3604
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=2e5+5;
int n,k,e[N][30],f[N][30],a[N],cnt[N];

void init(){
    for(int i=1;i<=n;i++) e[i][0]=f[i][0]=a[i];
    for(int j=1;(1<<j)<=n;j++) for(int i=1;i+(1<<j)-1<=n;i++){
        e[i][j]=min(e[i][j-1],e[i+(1<<j-1)][j-1]);
        f[i][j]=max(f[i][j-1],f[i+(1<<j-1)][j-1]);
    }
}

int quee(int l,int r){
	int k=log2(r-l+1);
    return min(e[l][k],e[r-(1<<k)+1][k]);
}

int quef(int l,int r){
	int k=log2(r-l+1);
    return max(f[l][k],f[r-(1<<k)+1][k]);
}

signed main(){
	read(n,k);
	for(int i=1;i<=n;i++) a[i]=read(a[i])+1;
	init();
	for(int i=1;i<=n;i++) cnt[i]=cnt[i-1]+(a[i]>a[i-1]);
	int ans=n-k+1,exist=0;
	for(int i=k;i<=n;i++){
		if(cnt[i]-cnt[i-k+1]==k-1){
			exist=1;
			ans--;
			continue;
		}
		if(i>k&&a[i-k]<quee(i-k+1,i-1)&&quef(i-k+1,i-1)<a[i]) ans--;
	}
	write(ans+exist);
}

Measured memory_bytes: 52096
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let s: Vec<char> = iterator.next().unwrap().chars().collect();

    for i in 0..3 {
        if s[i] == s[i + 1] {
            return "Bad".to_string();
        }
    }

    return "Good".to_string();
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i, n) for(int i=((int)(n));i>0;i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)	
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define REVSORT(c) SORT(c);REVERSE(c)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
const long long MOD = 10e9 + 7;
typedef long long ll;

int main(){
	ll a, b, c;
	cin >> a >> b >> c;
	ll ans;
	if(a == 0){
		ans = b / c + 1;
	} else {
		b /= c;
		a = (a - 1) / c;
		ans = b - a;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
const int mod = 1e9 + 7;
const int INF = 1e9;
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    int a[n];
    int b[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> b[i]; 
    }
    int ans = 0;
    for(int i = 0; i < n ;i++){
        if(a[i] - b[i] > 0){
            ans += (a[i] - b[i]);
        }
    }
    cout << ans;
}

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

int memo[101][10001];
int w[1001], v[1001];

int dp(int i, int j)
{
    if (i == 0)
        return memo[i][j] = 0;
    if (memo[i][j] >= 0)
        return memo[i][j];
    if (j - w[i - 1] < 0)
        return memo[i][j] = dp(i - 1, j);

    return memo[i][j] = max(dp(i - 1, j), (dp(i - 1, j - w[i - 1]) + v[i - 1]));
}

int main()
{
    int N, W;
    for (int i = 0; i < 101; i++)
    {
        for (int j = 0; j < 10001; j++)
        {
            memo[i][j] = -1;
        }
    }
    scanf("%d %d", &N, &W);
    for (int k = 0; k < N; k++)
    {
        scanf("%d %d", &v[k], &w[k]);
    }
    printf("%d\n", dp(N, W));
}



Measured memory_bytes: 6708
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n = int(input())
s = [str(input()) for _ in range(n)]
s = sorted(["".join(sorted(_)) for _ in [i for i in s]])
ans = 0
preb = str()
cnt = 1
for line in s:
  if preb == line:
    cnt += 1
  elif cnt >= 2:
    ans += cmb(cnt, 2)
    cnt = 1
  else:
    cnt = 1
  preb = line
if cnt >= 2:
    ans += cmb(cnt, 2)
print(ans)

Measured memory_bytes: 18944
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func oneInt() int {
	var a int
	fmt.Scan(&a)
	return a
}

func oneInt64() int64 {
	var a int64
	fmt.Scan(&a)
	return a
}

func oneStr() string {
	var a string
	fmt.Scan(&a)
	return a
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func scanNums() (nums []int) {
	s := nextLine()
	numStr := strings.Split(s, " ")

	for _, n := range numStr {
		i, _ := strconv.Atoi(n)
		nums = append(nums, i)
	}
	return nums
}

func scanStrings() (strs []string) {
	s := nextLine()
	list := strings.Split(s, " ")
	strs = append(strs, list...)
	return strs
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}

func permutation(n int, k int) int {
	v := 1
	if 0 < k && k <= n {
		for i := 0; i < k; i++ {
			v *= (n - i)
		}
	} else if k > n {
		v = 0
	}
	return v
}

func factorial(n int) int {
	return permutation(n, n-1)
}

func combination(n int, k int) int {
	return permutation(n, k) / factorial(k)
}

func homogeneous(n int, k int) int {
	return combination(n+k-1, k)
}

var memo []int
var hights []int

func main() {
	N := oneInt()

	for index := 0; index < N; index++ {
		hights = append(hights, oneInt())
		memo = append(memo, math.MaxInt64)
	}

	fmt.Print(rec(N - 1))
}

func rec(i int) int {
	if memo[i] < math.MaxInt64 {
		return memo[i]
	}

	if i == 0 {
		memo[i] = 0
		return 0
	}

	score1 := abs(hights[i]-hights[i-1]) + rec(i-1)
	if i > 1 {
		score2 := abs(hights[i]-hights[i-2]) + rec(i-2)
		score1 = min(score1, score2)
	}

	memo[i] = score1
	return score1
}


Measured memory_bytes: 35328
#include<iostream>
#include<cstring>
#include<cassert>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<vector>
#include<time.h>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(int i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep0(i,n) REP(i,0,n-1)
#define repG(i,x) for(int i=pos[x];~i;i=e[i].next)
#define ll long long
#define db double
const int N=7;
const int INF=1e9+7;
int n;

int main(){
	scanf("%d",&n);
	int m=n;
	while(m%2==0)m/=2;
	if(m==1){
		puts("No");
		return 0;
	}
	puts("Yes");
	puts("1 2");
	puts("2 3");
	printf("3 %d\n",n+1);
	printf("%d %d\n",n+1,n+2);
	printf("%d %d\n",n+2,n+3);
	for(int i=5;i<=n;i+=2){
		printf("%d %d\n",n+i-1,i);
		printf("%d %d\n",i-1,n+i);
		printf("1 %d\n",i);
		printf("1 %d\n",i-1);
	}
	if(n%2==0){
		if(n%4==0){
			int lw=n&(-n);
			printf("%d %d\n",n,n-lw);
			printf("%d %d\n",n+n,lw^1);
		}
		else{
			printf("%d %d\n",n,n-1);
			printf("%d %d\n",n+n,2);
		}
	}
	return 0;
}


Measured memory_bytes: 2304
#167
#c
import sys
import itertools
import numpy
n,m,x  = map(int, input().split())
zentan = itertools.product([0,1],repeat = n)
condi  = []
for i in range(n):
    ln = list(map(int, input().split()))
    condi.append(ln)
min_cost = 10**10
for i in zentan:# e.g.   i = (0,0, ...) len(i ) = n
    cost = 0
    skills= [0]*m
    # cost 
    for n1, n2 in enumerate(i):# n1 = 0~n-1, n2 = i[n1]
        cost += condi[n1][0]*n2
        #skills
        for n3 in range(m): # n3 = 0~m-1
            skills[n3] += condi[n1][n3+1]*n2
    if min(skills) >= x and cost < min_cost:
        min_cost = cost
    
        

            
            
if min_cost<10**10:
    print(min_cost)
else:
    print('-1')
                

Measured memory_bytes: 27168
/**
 * @author Finn Lidbetter
 */
import java.util.*;
import java.io.*;
import java.awt.geom.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();
    
    int n = Integer.parseInt(br.readLine());
    int[] arr = new int[n];
    String[] s = br.readLine().split(" ");
    int prev = -1;
    int len = 1;
    int sum = 0;
    for (int i=0; i<n; i++) {
      arr[i] = Integer.parseInt(s[i]);
      if (arr[i]==prev) {
        len++;
      } else {
        sum += len/2;
        len = 1;
      }
      prev = arr[i];
    }
    sum += len/2;
    System.out.println(sum);
  }
}


Measured memory_bytes: 23252
n, x, m = map(int, input().split())

lst, num = set(), []
for i in range(1, n + 1):
    lst.add(x), num.append(x)
    x = x ** 2 % m
    if x in lst:
        break

if x in lst:
    cnt, idx = i, num.index(x)
    div, mod = divmod(n - cnt, len(num) - idx)
    ans = sum(num[:idx + mod])
    ans += sum(num[idx:]) * (div + 1)
else:
    ans = sum(num)
print(ans)


Measured memory_bytes: 77368
#include <iostream>
using namespace std;
int main()
{
	int h, w, n;
	cin >> h >> w >> n;

	if (h > w) {
		if (n % h != 0) {
			cout << n / h + 1 << endl;
		}
		else {
			cout << n / h << endl;
		}
	}
	else {
		if (n % w != 0) {
			cout << n / w + 1 << endl;
		}
		else {
			cout << n / w << endl;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main() {
 char a, b, c,d;
 cin >> a >> b>>c>>d;
 if( a==b && a==c){
	cout << "Yes" << endl;
 }
 else if( b==c && b==d){
	cout << "Yes" << endl;
 }
 else {
 	cout << "No" << endl;
 }
}


Measured memory_bytes: 256
n = int(input())
H = list(map(int, input().split()))
ans = 0
count = 0
k = len(H)

for i in range(k-1, 0, -1):
    if H[i-1] >= H[i]:
        count += 1
        continue
    else:
        ans = max(ans, count)
        count = 0

ans = max(count, ans)

print(ans)


Measured memory_bytes: 14224
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
 
int main(){
  string S;
  cin>>S;
  string E="abcdefghijklmnopqrstuvwxyz";
  rep(i,26){
    bool ja=true;
    rep(j,S.length()){
      if(S[j]==E[i]){
        ja=false;
      }
    }
    if(ja){
      cout<<E[i]<<endl;
      return 0;
    }
  }
  cout<<"None"<<endl;
}   

Measured memory_bytes: 3760
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>	// upper_bound(A, A+N, num), lower_bound(A, A+N, num)
#include <functional>
#include <string>
#include <sstream>
#include <complex>
#include <vector>		// V[i],  push_back(x), pop_back(), insert(index, x), erase(index), sort(v.begin(), v.end(), greater<int>())
#include <list>			// push_front(x), push_back(x), pop_front(), pop_back(), insert(index, x)
#include <queue>		// push(x), front(), pop()
#include <deque>
#include <stack>		// push(x), top(), pop()
#include <map>			// M[key],  insert(key, val), erase(key), find(key), 
#include <set>			// insert(key), erase(key), find(key)

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

#define PI 3.141592653589793
#define MOD 1000000007
#define REP(i, n) for(int i = 0; i < n; i++)

int a, b, c, d;

void solve() {
	cin >> a >> b >> c >> d;
	if (abs(a - c) > d) {
		if (abs(a - b) <= d && abs(b - c) <= d) {
			cout << "Yes" << endl;
			return;
		}
	}
	else {
		cout << "Yes" << endl;
		return;
	}
	cout << "No" << endl;
}

int main() {
	solve();
	return 0;
}

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

int main(){
    int n; cin >> n;
    vector<int> p(n);
    int ans=0;

    rep(i,n){
        cin >> p[i];
    }

    rep(i,n-2){
        if((p[i+1] < p[i]) && (p[i+1] > p[i+2]) || (p[i+1] > p[i]) && (p[i+1] < p[i+2])){
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int x,y,s,p;
  int i,j,max=0,ans=0;
  while(scanf("%d%d%d",&x,&y,&s),x!=0&&y!=0&&s!=0){
    p=(100*s/(100+x));
    for(i=1;i<p;i++){
      for(j=1;j<p;j++){
	ans=i*(100+x)/100+j*(100+x)/100;
	if(ans==s){
	  ans=i*(100+y)/100+j*(100+y)/100;
	  if(max<ans) max=ans;
	}
      }
    }
    printf("%d\n",max);
    max=0;
  }
  return 0;
}

Measured memory_bytes: 600
from collections import Counter as c
from functools import lru_cache,reduce

@lru_cache()
def comb(a,b):
    if not a>=b>=0:
        return 0
    if b==1:
        return a
    elif b==0:
        return 1
    return comb(a-1,b)+comb(a-1,b-1)

n,a,b=map(int,input().split())
v=sorted(map(int,input().split()))[::-1]

c1=c(v)
ans1=sum(v[:a])
ans2=0

for i in range(a,b+1):
    if ans1*i!=sum(v[:i])*a:break
    c2=c(v[:i])
    ans2+=reduce(lambda x,y:x*y,map(lambda x:comb(c1[x],c2[x]),c2.keys()))

print(ans1/a,ans2,sep="\n")

Measured memory_bytes: 48984
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define grep(i,u) for (int i = head[u],v = e[i].v; i; v = e[i = e[i].nxt].v)
#define il inline
#define LL long long
#define ULL unsigned LL
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>
#define fi first
#define se second
using namespace std;
il int read() {
	int res = 0,f = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') f = -f; ch = getchar();}
	while (isdigit(ch)) {res = res*10+ch-'0'; ch = getchar();} return res*f;
}
namespace qiqi {
	const int N = 2e5+5; int n,a[N],s[N],top;
	il bool check(int k) {top = 0; rep(i,2,n) if (a[i] <= a[i-1]) {while (a[i] < s[top]) --top; s[++top] = a[i]; while (top >= k && s[top] == s[top-k+1]) --s[top -= k-1];} return s[1] > 0 || !top;}
	void main() {n = read(); rep(i,1,n) a[i] = read(); bool flg = 1; rep(i,2,n) flg &= a[i] > a[i-1]; if (flg) {puts("1"); return;} int l = 2,r = 2e5,mid; while (l <= r) check(mid = (l+r)/2) ? r = mid-1 : l = mid+1; printf("%d\n",l);}
}
int main() {
	qiqi::main(); return 0;
}

Measured memory_bytes: 5248
k,a,b=io.read("*n","*n","*n")

if b-a<=2 then
    print(k+1)
else
    if k-(a-1)>=2 then
        x=(k-(a-1))//2
        y=(k-(a-1))%2
        print(a+(b-a)*x+y)
    else
        print(k+1)
    end
end

Measured memory_bytes: 888
import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))

MOD = pow(10, 9) + 7

def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    seta = set(a)
    setb = set(b)
    if len(seta) != n or len(setb) != m:
        print(0)
        return
    
    ans = 1
    aa, bb = 0, 0
    for i in range(n*m, 0, -1):
        if i in seta and i in setb:
            aa += 1
            bb += 1
        elif i in seta and i not in setb:
            ans = ans * bb % MOD
            aa += 1
        elif i not in seta and i in setb:
            ans = ans * aa % MOD
            bb += 1
        else:
            ans = ans * (aa * bb - (n*m-i)) % MOD
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long ;
int main()
{
    ll h;
    cin>>h;
    ll ans=1,i=1;
    while(h!=1){
        i*=2;
        h/=2;
        ans+=i;
    }
    cout<<ans;
}

Measured memory_bytes: 3616
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll N;
    cin >> N;
    ll ans = 1000 - (N % 1000);
    if(ans == 1000){
        print(0);
    }else{
        print(ans);
    }



    

}

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

Measured memory_bytes: 3648
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MOD 1000000007
#define ll long long
typedef int data_t;

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int min;
    if(a>=b && a>=c) min=b+c;
    else if(b>=a && b>=c) min=a+c;
    else min=a+b;
    printf("%d\n",min);

    return 0;
}


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

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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

int main(void){
    int n,m;
    cin >> n >> m;
    int a[n];
    int b[n];
    rep(i,n){
        cin >> a[i];
        b[i] = abs(a[i]-m);
    }
    int ans = b[0];
    rep1(i,n)ans = gcd(ans,b[i]);
    cout << ans << endl;
    return 0;
}

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

int it;
map<char, int> dic;

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int N;
	while (cin >> N, N) {
		it = 0;
		dic.clear();
		vector<bool> flag(10);
		vector<vector<int>> val(N);
		for (int i = 0; i < N; i++) {
			string s;
			cin >> s;
			for (auto c : s) {
				val[i].push_back(dic.count(c) ? dic[c] : dic[c] = it++);
			}
			if ((int)s.size() != 1) flag[val[i][0]] = true;
		}
		vector<int> d(10);
		for (int i = 0; i < 10; i++) d[i] = i;
		int res = 0;
		do {
			int zer = find(d.begin(), d.end(), 0) - d.begin();
			if (flag[zer]) continue;
			int sum = 0;
			for (int i = 0; i < N; i++) {
				int x = 0;
				for (auto v : val[i]) {
					x = x * 10 + d[v];
				}
				sum += i + 1 == N ? -x : x;
			}
			if (sum == 0) res++;
		} while (next_permutation(d.begin(), d.end()));
		for (int i = 1; i <= 10 - it; i++) res /= i;
		cout << res << endl;
	}
	return 0;
}



Measured memory_bytes: 3224
x=int(input())
cac=0
cwa=0
ctle=0
cre=0

for i in range(0,x):
    moji=input()
    if(moji=='AC'):
        cac+=1
    if(moji=='WA'):
        cwa+=1
    if(moji=='TLE'):
        ctle+=1
    if(moji=='RE'):
        cre+=1
print('AC x ',cac)
print('WA x' ,cwa)
print('TLE x ',ctle)
print('RE x' ,cre)

Measured memory_bytes: 9036
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<map>
using namespace std;
#define ll long long
int main(){
    int N;
    cin >> N;
    if(N%2==0){
      cout << N;
    }else{
      cout << N*2;
    }
    return 0;
}


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

typedef pair<int,int> P;
const int INF = 500000000;

int main(){
    int n;
    cin >> n;
    vector<int> x(n), l(n);
    vector<P> arms(n);
    for (int i = 0; i < n; i++){
        cin >> x[i] >> l[i];
        arms[i] = P(x[i]+l[i], x[i]-l[i]);
    }
    sort(arms.begin(),arms.end());

    int ans = 0, right = -2147483648;
    for (int i = 0; i < n; i++){
        if (arms[i].second >= right){
            ans++;
            right = arms[i].first;
        }
    }
    cout << ans << "\n";
}

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

using namespace std;

int main()
{
    int n,d,x,a[110];
    scanf("%d",&n);
    scanf("%d %d",&d,&x);
    int s=x+n,i;
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        int j=a[i];
        while(j+1<=d)
        {
            s++;j=j+a[i];
        }
    }
    printf("%d\n",s);
    return 0;
}

Measured memory_bytes: 256
func gcd(_ x: Int, _ y: Int) -> Int {
    return y>0 ? gcd(y, x%y) : x
}

let N = Int(readLine()!)!
var sum = 0

for a in 1...N {
    for b in 1...N {
        let ab = gcd(a, b)
        for c in 1...N {
            sum += gcd(ab, c)
        }
    }
}

print(sum)

Measured memory_bytes: 7788
#include<stdio.h>

int main(void){
	const int n_max = 100000;
	int n, q, S[n_max+1], T, i, ans = 0;
	int left, right, mid;

	scanf("%d", &n);
	for(i=0; i<n; ++i)
		scanf("%d", S+i);
	scanf("%d", &q);
	for(i=0; i<q; ++i){
		scanf("%d", &T);
		left = 0;
		right = n;
		if(T < S[0] || S[n-1] < T)
			continue;
		while(left < right){
			mid = (left+right)/2;
			if(T == S[mid]){
				++ans;
				break;
			}
			if(T > S[mid]){
				left = mid +1;
			}else if(T < S[mid]){
				right = mid;
			}
		}
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 2092
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>
#include <cstring>
#include <math.h>
using namespace std;


int main() {
   int n;
 
   cin >> n;
  
   long long sum = 0;
  
   for(int i=1;i<=n;i++){
     
     if(i%15==0){
       
     }else{
       
        if(i%3==0||i%5==0){
        
          
        }else{
          sum = sum + i;
        }
     }
     
   }
  
  cout << sum << endl;
  
  
  return 0;
}


Measured memory_bytes: 3600