akhauriyash/Code-Regression huggingface dataset:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()


def main():
    n,m = LI()
    r = 0
    d = collections.defaultdict(set)
    for _ in range(m):
        a,b = LI()
        d[a].add(b)
        d[b].add(a)
    for a in itertools.permutations(range(2,n+1)):
        if a[0] not in d[1]:
            continue
        f = True
        for i in range(len(a)-1):
            if a[i] not in d[a[i+1]]:
                f = False
                break
        if f:
            r += 1

    return r


print(main())


Measured memory_bytes: 5420
k,n=map(int,input().split())
arr=list(map(int,input().split()))
ans=10**18 #最小値を求めるので十分大きな値で初期化
for i in range(n): #上式を元に最短距離を求める
 dist1=(arr[i-1]-arr[i])%k
#  n個中のiの次最高びになると0番目に戻る
 dist2=(arr[i]-arr[(i+1)%n])%k
 ans=min(ans,dist1,dist2)#dist1と2の小さい方をansとする
print(ans)

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

int main() {
    //入力
    int n,k;
    int p[1010];
    cin >> n >> k;
    for (int i=0; i<n; i++) cin >> p[i];
    //pという配列に入れて小さいもの順に並び替え、0個目からk個前から取る
    sort(p, p+n);
    int ans=0;
    for (int i=0; i<k; i++) {
        ans += p[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
//I read the news today, oh boy
//About a lucky man who made the grade
 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) ll((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
#define roF(i,a,b) for(ll i = ll(a); i >= ll(b); i--)
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const ll N=2e5+100;
const ll MOD = 1e9+7;

ll mul(ll a, ll b){
	return (a*b)%MOD;
}

ll sum(ll a, ll b){
	ll ans = a+b+MOD;
	while(ans>=MOD) ans-=MOD;
	return ans;
}

ll binpow(ll a, ll p){
	if(p==0) return 1;
	ll cur = binpow(a,p>>1);
	cur = mul(cur,cur);
	if(p&1) cur = mul(cur,a);
	return cur;
}

ll f[N], invf[N];

void prec(){
	f[0]=1;
	invf[0]=1;
	For(i,1,N){
		f[i] = mul(f[i-1],i);
		invf[i] = binpow(f[i],MOD-2);
	}
}

ll calc(int i, int j, int i2, int j2){
	int h = i2-i;
	int w = j2-j;
	return mul(f[h+w],mul(invf[h],invf[w]));
}

ll h, w, n;
vii V;

bool cmp(ii a, ii b){
	if(a.ff+a.ss != b.ff+b.ss) return a.ff+a.ss < b.ff+b.ss;
	return a.ss<b.ss;
}

ll dp[N];

int main(){
	fastio;
	cin>>h>>w>>n;	
	prec();
	For(i,0,n){
		int r, c; cin>>r>>c;
		r--,c--;
		V.pb(mp(r,c));
	}
	V.pb(mp(h-1,w-1));
	sort(all(V),cmp);
	For(i,0,n+1) dp[i] = calc(0,0,V[i].ff,V[i].ss);
	For(i,0,n){
		For(j,i+1,n+1) if(V[j].ff>=V[i].ff && V[j].ss>=V[i].ss){
			dp[j] = sum(dp[j],-mul(dp[i],calc(V[i].ff,V[i].ss,V[j].ff,V[j].ss)));
		}
	}
	cout << dp[n] << endl;
	return 0;
}



Measured memory_bytes: 6884
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 2000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
long long dp[20000] = {};
int main() {
#define int long long
	int n, w;
	cin >> n >> w;
	for (int q = 10000;q >= 0;--q) {
		dp[q] = LONG_INF;
	}
	dp[0] = 0;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		for (int q = 10000;q >= 0;--q) {
			dp[q + a] = min(dp[q + a], dp[q] + b);
		}
	}
	for (int q = 10000;q >= 0;--q) {
		if (dp[q] <= w) {
			cout << q << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  if((N/1000 == N%1000/100 && N%1000/100 == N%1000%100/10) || (N%1000/100 == N%1000%100/10 && N%1000%100/10 == N%1000%100%10)){
      cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
  int sec,min,hour;

  scanf("%d", &sec);
  
  hour = sec/3600;
  min = (sec - hour *3600) / 60;
  sec -= hour * 3600 + min * 60;
 
  printf("%d:%d:%d\n",hour, min ,sec);
 
  return 0;
}


Measured memory_bytes: 2112
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	int s = min(n * a, b);
	cout << s << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

int main(void) {
	int len, rot;
	int deg;
	double north, east;
	
	deg = 0;
	north = 0; east = 0;
	while(true) {
		scanf("%d,%d", &len, &rot);
		if(len == 0 && rot == 0) { break; }
		north += sin(deg * 3.1415927 / 180.0) * len;
		east += cos(deg * 3.1415927 / 180.0) * len;
		deg += rot;
	}
	
	printf("%d\n%d\n", (int)north, (int)east);
	
	return 0;
}

Measured memory_bytes: 0
n=int(input())
itta=set()
flag=True
s=input()
owari=s[-1]
itta.add(s)
for i in range(n-1):
    s=input()
    if s[0]!=owari:
        flag=False
    owari=s[-1]
    if s in itta:
        flag=False
    itta.add(s)
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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():
    n = I()
    ans = [-1]*(2*n)
    q = [i+1 for i in range(n)]
    que = ["?"]+q
    print(*que,flush = True)
    t = input()
    T = t
    l = 0
    r = n
    while r-l > 1:
        m = (l+r) >> 1
        q = [i+m+1 for i in range(n)]
        que = ["?"]+q
        print(*que,flush = True)
        t = input()
        if t == T:
            l = m
        else:
            r = m
    if T[0] == "R":
        ans[l] = "R"
        ans[l+n] = "B"
    else:
        ans[l] = "B"
        ans[l+n] = "R"
    Q = [i+r+1 for i in range(n-1)]
    for i in range(1,2*n+1):
        if ans[i-1] != -1:
            continue
        if i in Q:
            continue
        q = Q+[i]
        que = ["?"]+q
        print(*que,flush = True)
        t = input()
        if t[0] == "R":
            ans[i-1] = "R"
        else:
            ans[i-1] = "B"
    Q_ = []
    for i in range(2*n):
        if len(Q_) == (n>>1):
            break
        if ans[i] == "R" and i+1 not in Q:
            Q_.append(i+1)
    for i in range(2*n):
        if len(Q_) == n-1:
            break
        if ans[i] == "B" and i+1 not in Q:
            Q_.append(i+1)
    for i in Q:
        q = Q_+[i]
        que = ["?"]+q
        print(*que,flush = True)
        t = input()
        if t[0] == "R":
            ans[i-1] = "R"
        else:
            ans[i-1] = "B"
    ans = ["! "]+ans
    print(*ans,sep = "")
    return

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


Measured memory_bytes: 4932
N, Q = map(int, input().split())
S = input()
S = [1 if i > 0 and S[i-1] == 'A' and S[i] == 'C' else 0 for i in range(N)]
T = [0 for _ in range(N)]
for i in range(N):
    T[i] = S[i]
    if i > 0:
        T[i] += T[i-1]
for i in range(Q):
  l, r = map(int, input().split())
  print(T[r-1]-T[l-1])


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

using namespace std;

const int maxn = 100007;

struct data
{
    int next[26], cnt, eow;
};

int prefix[maxn], sum[maxn][26][26];
string D, str[maxn];
vector <data> V;

data newNode()
{
    data emp;
    for (int i = 0; i < 26; ++i) emp.next[i] = -1;
    emp.eow = emp.cnt = 0;
    return emp;
}

void add(string x)
{
    int r = 0;
    for (char s: x)
    {
        int f = s - 'a';
        if (V[r].next[f] < 0)
        {
            V[r].next[f] = (int)V.size();
            V.push_back(newNode());
        }
        r = V[r].next[f];
        ++V[r].cnt;
    }
    ++V[r].eow;
}

void query(int k)
{
    int ans = prefix[k];
    for (char i: D)
        for (char j: D)
        {
            if (j == i) break;
            ans += sum[k][i - 'a'][j - 'a'];
        }

    cout << ans << '\n';
}

int main()
{
//    freopen("TEST.INP", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    V.push_back(newNode());
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> str[i], add(str[i]);

    for (int i = 1; i <= n; ++i)
    {
        int r = 0;
        for (char j: str[i])
        {
            for (int k = 0; k < 26; ++k)
                if (j - 'a' != k && V[r].next[k]!= -1)
                    sum[i][j - 'a'][k] += V[V[r].next[k]].cnt;

            r = V[r].next[j - 'a'];
            prefix[i] += V[r].eow;
        }
    }

    int q;
    cin >> q;
    while (q--)
    {
        int k;
        cin >> k >> D;
        query(k);
    }

    return 0;
}


Measured memory_bytes: 284284
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		
		int a = in.nextInt();
		int b = in.nextInt();
		
		double a_low = a / 0.08;
		double a_high = (a+1) / 0.08;
		double b_low = b / 0.1;
		double b_high = (b+1) / 0.1;
		double low = Math.max(a_low, b_low);
		double high = Math.min(a_high, b_high);
		if(high<=low) System.out.print("-1");
		//else if (high==low && (high%1!=0) && (low%1!=0)) System.out.print("-1");
		else {
//		System.out.println(low + " " + high);
		System.out.print((int)Math.ceil(low));
		}
	}
}


Measured memory_bytes: 23892
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

//昇順
int asc(const void* a, const void* b){
    return *(int*)a-*(int*)b;
}

int main(void){
    //A[0]~A[N-1]に格納する
    int* A;
    NEW(A,3);
    for(int i=0;i<3;i++){
        scanf("%d",&A[i]);
    }
    qsort(A,3,sizeof(int),asc);

    int ans=(A[2]-A[1])+(A[1]-A[0])/2+((A[1]-A[0])%2)*2;
    printf("%d\n",ans);

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){

  int i,j,min,max,n,a[100],esc,count=0;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);

  if(n==1) printf("%d\n0\n",a[0]);
  else{
    for(i=0;i<n-1;i++){
      min=i;
      for(j=i+1;j<n;j++){
	if(a[j]<a[min]){
	  min=j;
	}
      }
      if(i==min) continue;
      esc=a[i];
      a[i]=a[min];
      a[min]=esc;
      count++;
    }
    for(i=0;i<n;i++){
      printf("%d",a[i]);
      if(i==n-1) break;
      printf(" ");
    }
    printf("\n%d\n",count);
  }
  return 0;
}

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

using namespace std;

const int N = 2e3 + 5;
int u[N][N] , d[N][N] , l[N][N] , r[N][N];

int main() {
    int n , m;
    cin >> n >> m;
    n += 2 ;
    m += 2;
    vector<string> grid(n , string(m , '#'));
    for (int i = 1 ;i < n - 1;i++)
        for (int j = 1 ;j < m - 1 ;j++)
            cin >> grid[i][j];

    for (int i = 1 ;i < n - 1 ;i++) {
        for (int j = 1 ;j < m - 1 ;j++)
            if (grid[i][j] != '#')
                l[i][j] = l[i][j - 1] + 1;

        for (int j = m - 2 ;j >= 1 ;j--)
            if (grid[i][j] != '#')
                r[i][j] = r[i][j + 1] + 1;
    }

    for (int j = 1 ;j < m - 1 ;j++) {
        for (int i = 1 ;i < n - 1 ;i++)
            if (grid[i][j] != '#')
                u[i][j] = u[i - 1][j] + 1;

        for (int i = n - 2 ;i >= 1 ;i--)
            if (grid[i][j] != '#')
                d[i][j] = d[i + 1][j] + 1;
    }


    int ans = 0;
    for (int i = 1 ;i < n - 1 ;i++)
        for (int j = 1 ;j < m - 1 ;j++)
            ans = max(ans , u[i][j] + d[i][j] + l[i][j] + r[i][j] - 3);

    cout << ans;
}

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

int main() {
	int n, count = 0;
	char cor[200001];
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf(" %c", &cor[i]);
	bool vai = 1;
	unsigned int st = 0, ed = n - 1;
	while (vai) {
		while (cor[st] != 'W') {
			st++;
			if (st == ed){
				vai = false;
				break;
			}
		}
		if (!vai) break;
		while (cor[ed] != 'R') {
			ed--;
			if (st == ed){
				vai = false;
				break;
			}
		}
		if (!vai) break;
		char _1st = cor[st], _2nd = cor[ed];
		cor[st] = _2nd;
		cor[ed] = _1st;
		count++;
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 4016
#include<stdio.h>
#include<string.h>
int main(){
  char str[10000];
  int n,i,a,b;
  while(scanf("%s",str)!=EOF){
    a=0,b=0;
  n=strlen(str);
  for(i=0;i<n-2;i++){
    if(str[i]=='J'&&str[i+1]=='O'&&str[i+2]=='I')a++;
    if(str[i]=='I'&&str[i+1]=='O'&&str[i+2]=='I')b++;
  }
  printf("%d\n%d\n",a,b);
  }
  return 0;
}

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

int main()
{
	int n,k;
	cin >> n >> k;
	int s,p,r;
	cin >> s >> p >> r;
	string t;
	cin >> t;
	ll sum = 0;
	for(int i = 0; i < k && i < t.length(); i++){
		if(t[i] == 's')
			sum += s;
		if(t[i] == 'p')
			sum += p;
		if(t[i] == 'r')
			sum += r;
	}
	for(int i = k; i < t.length(); i++){
		if(t[i] == t[i-k]){
			t[i] = '1';
		}
		else{
			if(t[i] == 's')
				sum += s;
			if(t[i] == 'p')
				sum += p;
			if(t[i] == 'r')
				sum += r;
		}
	}
	cout << sum << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.*;
public class Main 
{
	public static void main(String args[]) 
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int d=sc.nextInt();
		int count=0;
		for(int i=0;i<n;i++) 
		{
			int a=sc.nextInt(),b=sc.nextInt();
			if(Math.sqrt(Math.pow(a, 2)+Math.pow(b, 2))<=d) 
			{
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 59520
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
    int n,x;
    cin>>n>>x;
    int a[n+1],i;
    for (i=1;i<=n;i++)
    {
    	cin>>a[i];
    }
    sort(a+1,a+n+1);
    int cnt;
    cnt=0;
    if (a[1]>x)
    {
    	cout<<0<<endl;
    	return 0;
    }
    for (i=1;i<=n;i++)
    {
    	cnt+=a[i];
    	if (cnt>x)
    	{
    		cout<<i-1<<endl;
    		return 0;
    	}
    }
    if (x-cnt==0)
    {
    	cout<<n<<endl;
    }
    else
    {
    	cout<<n-1<<endl;
    }
    return 0;
}


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

ll n,g,a[12],c[12],ans=1<<30;
bool s[12];

void cal(){
	ll sum=0,score=0;
	for(int i=0;i<n;i++){
		if(s[i]){
			sum+=a[i];
			score+=a[i]*(i+1)*100+c[i];
		}
	}
	if(score>=g){
		ans=min(ans,sum);
		return ;
	}
	for(int i=n-1;i>=0;i--){
		ll k=(i+1)*100;
		if(s[i]==0&&(g-score+k-1)/k<=a[i]){
			sum+=(g-score+k-1)/k;
			ans=min(ans,sum);
			return ;
		}
	}
}

void dep(ll d){
	if(d==n){
		cal();
		return;
	}
	s[d]=0;dep(d+1);
	s[d]=1;dep(d+1);
}

int main() {
	cin>>n>>g;
	for(int i=0;i<n;i++){
		cin>>a[i]>>c[i];
	}
	dep(0);
	cout <<ans;
	return 0;
}

Measured memory_bytes: 256
#define first f
#define second s
#define ll long long
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#include <bits/stdc++.h>
#define pii pair<string,int>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
const int maxn=1e5+5;
const int MOD=998244353;
const double PI=acos(-1);
const double e=2.718281828459;

int a[maxn];

int main()
{
    int n,k;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    sort(a+1,a+n+1);
    int mi=1e9+7;
    for(int i=1;i<=100;i++){
        int sum=0;
        for(int j=1;j<=n;j++){
            sum+=(a[j]-i)*(a[j]-i);
        }
        mi=min(mi,sum);
    }
    printf("%d\n",mi);
    return 0;
}


Measured memory_bytes: 256
n,m  = map(int,input().split())
lr =[list(map(int,input().split()))for _ in range(m)]

lr.sort(reverse = True)
ansl = lr[0][0]
ansr = 10**9
for i in range(m):
    r = lr[i][1]
    if r < ansr:
        ansr = min(ansr,r)
ans = max(0,ansr-ansl+1)

print(ans)




Measured memory_bytes: 27772
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#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 int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;

int i, j, spf[N], n;

void sieve()
{
    for (i = 1; i < N; ++i)
        spf[i] = i;
    for (i = 2; i * i < N; ++i)
    {
        if (spf[i] == i)
        {
            for (j = i * i; j < N; j += i)
            {
                if (spf[j] == j)
                    spf[j] = i;
            }
        }
    }
}

vi factorize(int x)
{
    vi ret;
    while (x != 1)
    {
        ret.pb(spf[x]);
        x /= spf[x];
    }
    return ret;
}

void solve()
{
    sieve();
    cin >> n;
    int ans = 0;
    for (i = 1; i <= n - 1; i++)
    {
        int num = n - i, div = 1;
        vi fact = factorize(num);
        map<int, int> cnt;
        for (auto j : fact)
            cnt[j]++;
        for (auto it : cnt)
            div *= it.s + 1;
        ans += div;
    }
    cout << ans << endl;
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fastio;
    int t;
    //cin >> t;
    t = 1;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 11468
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static double EPS = 1e-5;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int N = sc.nextInt();
			if (N == 0) {
				break;
			}
			double[] x = new double[2 * N];
			double[] y = new double[2 * N];
			double[] r = new double[2 * N];
			double[] m = new double[N];
			for (int i = 0; i < N; ++i) {
				x[i] = sc.nextDouble();
				y[i] = sc.nextDouble();
				r[i] = sc.nextDouble();
				m[i] = sc.nextDouble();
				x[i + N] = x[i];
				y[i + N] = y[i];
				r[i + N] = r[i] + m[i];
			}
			if (N == 1) {
				System.out.println("1");
				continue;
			}
			int ans = 0;
			for (int i = 0; i < 2 * N; ++i) {
				for (int j = 0; j < 2 * N; ++j) {
					if (i % N == j % N)
						continue;
					double theta = (x[i] == x[j] ? 0 : Math.atan((y[j] - y[i]) / (x[j] - x[i])));
					double w = Math.sqrt((x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]));
					theta*=-1;
					for (int sign = -1; sign <= 1; sign += 2) {

						double cos = (r[i] + r[j] * sign) / w;
						for (int sign2 = -1; sign2 <= 1; sign2 += 2) {
							double sin = Math.sqrt(1 - cos * cos) * sign2;
							if (cos != cos || sin != sin) {
								continue;
							}
							double a = cos * Math.cos(theta) + sin * Math.sin(theta);
							double b = -cos * Math.sin(theta) + sin * Math.cos(theta);
							double c = -r[i] - a * x[i] - b * y[i];
							int count = 0;
							for (int k = 0; k < N; ++k) {
								double dis = Math.abs(a * x[k] + b * y[k] + c) / Math.sqrt(a * a + b * b) - r[k];
								if (-EPS <= dis && dis <= m[k] + EPS) {
									++count;
								}
							}
							ans = Math.max(ans, count);

						}
					}
				}
			}
			System.out.println(ans);
		}
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Measured memory_bytes: 43476
#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> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

#define int long long

const int mod=1e9+7,N=2e5+5;
int en,h[N],fac[N],inv[N],g[N],f[N],n,sz[N];

struct edge{
	int n,v;
}e[N<<1];

void add(int x,int y){
	e[++en]=(edge){h[x],y};
	h[x]=en;
}

int fpow(int x,int y){
	int res=1;
	for(;y;y>>=1,x=x*x%mod) if(y&1) res=res*x%mod;
	return res;
}

int C(int x,int y){
	return fac[x]*inv[y]%mod*inv[x-y]%mod;
}

void dfs1(int x,int fa){
	f[x]=1;
	for(int i=h[x];i;i=e[i].n){
		int y=e[i].v;
		if(y==fa) continue;
		dfs1(y,x);
		sz[x]+=sz[y];
		f[x]=f[x]*f[y]%mod*C(sz[x],sz[y])%mod;
	}
	sz[x]++;
}

void dfs2(int x,int fa){
	for(int i=h[x];i;i=e[i].n){
		int y=e[i].v;
		if(y==fa) continue;
		g[y]=f[y]*g[x]%mod*fpow(f[y]*C(n-1,sz[y])%mod,mod-2)%mod*C(n-1,n-sz[y])%mod;
		dfs2(y,x);
	}
}

signed main(){
	read(n);
	for(int i=1,x,y;i<n;i++){
		read(x);read(y);
		add(x,y);add(y,x);
	}
	fac[0]=1;
	for(int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mod;
	inv[n]=fpow(fac[n],mod-2);
	for(int i=n-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
	dfs1(1,0);
	g[1]=f[1];
	dfs2(1,0);
	for(int i=1;i<=n;i++) write(g[i]),puts("");
}

Measured memory_bytes: 17920
#include<bits/stdc++.h>
using namespace std;
int main(){
  string x,y,z;
  cin>>x>>y>>z;
  cout<<(char)(x.at(0)+'A'-'a')<<(char)(y.at(0)+'A'-'a')<<(char)(z.at(0)+'A'-'a')<<endl;
}

Measured memory_bytes: 3600
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        a: [u64;3],
        k: u32
    }

    let mut am = a;
    am.sort();
    println!("{}", am[0]+am[1]+am[2]*2_u64.pow(k));
}

Measured memory_bytes: 4352
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List (length, sort, group)
import Data.Array.Unboxed
import Prelude hiding ((!!))

solve :: [Int] -> Int
solve xs = foldr f 0 xs
  where
    hx = head xs
    lx = last xs
    gs = group xs
    zs = zip (map head gs) (map length gs)
    aa = accumArray (+) 0 (hx, lx) zs :: UArray Int Int
    (!!) a i = let (_,e) = bounds a in if i <= e then a!i else 0
    f x a = let a' = aa!x + aa!!(x+1) + aa!!(x+2) in max a a'

main :: IO ()
main = do
    _ <- getLine
    a <- sort . map (fst . fromJust . BS.readInt)
        . BS.words <$> BS.getLine :: IO [Int]
    print $ solve a


Measured memory_bytes: 18812
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int n;
int a[100010];
int b[100010];
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++)
	{
		b[a[i]] = i;
	}
	for (int i = 1; i <= n; i++)
	{
		cout << b[i] << " ";
	}
	return 0;
}


Measured memory_bytes: 1536
import sys

inf = float('inf')

n, m = map(int, sys.stdin.readline().split())
abc = []
for _ in range(m):
    a, b, c = map(int, sys.stdin.readline().split())
    abc.append((a-1, b-1, -c))

def main():
    dist = [inf] * n
    dist[0] = 0
    for _ in range(n-1):
        for a, b, c in abc:
            dist[b] = min(dist[b], dist[a] + c)

    for _ in range(n):
        for a, b, c in abc:
            if dist[a] + c < dist[b]:
                dist[b] = -inf

    return -dist[n-1]

if __name__ == '__main__':
    ans = main()
    print(ans)

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

int main() {
  map<int, double> mp;
  int st;
  char c;
  double w, h;
  
  while(cin>>st>>c>>w>>c>>h) {
    mp[st] = w/(h*h);
  }

  for(map<int,double>::iterator it = mp.begin(); it != mp.end(); it++) {
    if((*it).second>=25.0) cout << (*it).first << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1236
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<set>
#include<stdio.h>
#include<ctype.h>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	cout << 6 - a - b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

const int N = 100001;

int n, deg[N], p[N];
vector <int> v[N];

void dfs(int node, int pnode){
    p[node] = pnode;
    for(auto &i : v[node]){
        if(i == pnode) continue;
        dfs(i, node);
    }
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for(int i = 0 ; i < n - 1 ; i++){
        int x, y;
        cin >> x >> y;
        deg[x]++; deg[y]++;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    dfs(1, -1);
    queue <int> leaves;
    for(int i = 2 ; i <= n ; i++){
        if(deg[i] == 1) leaves.push(i);
    }
    while(leaves.size()){
        int cur = leaves.front();
        leaves.pop();
        if(p[cur] == -1) finish("First");
        int k = p[cur];
        for(auto &i : v[k]){
            if(i == p[k]) continue;
            p[i] = -1;
        }
        if(p[k] != -1){
            deg[p[k]]--;
            if(deg[p[k]] <= 1) leaves.push(p[k]);
        }
    }
    cout << "Second" << endl;
}


Measured memory_bytes: 6784
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	int m[10];
	for (int i = 0; i < 10; i++) {
		cin >> m[i];
	}
	sort(m, m+10);
	cout << m[9] << endl;
	cout << m[8] << endl;
	cout << m[7] << endl;
	return 0;
}

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

int main()
{
    //freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
    
    ll ht,st,ha,sa;
    cin>>ht>>st>>ha>>sa;
    while(true)
    {
        ha-=st;
        if(ha<=0)
        {
            cout<<"Yes";
            break;
        }
        ht-=sa;
        if(ht<=0)
        {
            cout<<"No"<<endl;
            break;
        }
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;


int main() {
int H, W; cin >> H >> W;
VS S(H); rep(i, 0, H) cin >> S[i];

// . で周りのpadding
string pad("");
rep(i,0,W) pad += '.';
S.push_back(pad);
S.insert(S.begin(), pad);
rep(i, 0, H+2) {
    S[i] += '.';
    S[i].insert(S[i].begin(), '.');
}

rep(h, 1, H+1){
    rep(w, 1, W+1){
        if (S[h][w] == '.') continue;
        if (S[h-1][w] != '#' && S[h][w-1] != '#' && 
            S[h+1][w] != '#' && S[h][w+1] != '#'){
            cout << "No" << "\n";
            return 0;
        }
    }
}
cout << "Yes" << "\n";

return 0;
}

// 境界，出力文字列 チェック
// int は ± 2*10⁹.
// map[]は対数時間．unordered_map[]は一定時間．


Measured memory_bytes: 256
N = int(input())
L = list(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(N):
        for k in range(N):
            if i < j and j < k and L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
                edges = [L[i],L[j],L[k]]
                edges.sort()
                if edges[0]+edges[1] > edges[2]:
                    ans += 1
print(ans)

Measured memory_bytes: 68392
using System;
namespace program
{
    class aoj
    {
        static void Main()
        {
            while (true)
            {
                string a = Console.ReadLine();
                if (String.IsNullOrEmpty(a)) break;
                string[] e = a.Split(',');
                int b = int.Parse(e[0]);
                double c = double.Parse(e[1]), d = double.Parse(e[2]);
                double f = c / (d * d);
                if (f >= 25)
                {
                    Console.WriteLine(b);
                }
            }
        }
    }
}

Measured memory_bytes: 9148
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

typedef pair<int, int> P;
vector<P> start;
int H, W, K;
int d[1000][1000];
string S[1000];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};


void bfs(int sx, int sy) {
    queue<P> que;
    
    rep(i, H) rep(j, W) d[i][j] = INF;
    que.push(P(sx, sy));
    d[sx][sy] = 0;
 
    while(que.size()) {
        P p = que.front(); que.pop();
        if (p.first == 0 || p.first == H - 1 || p.second == 0 || p.second == W - 1) break;
        rep(i, 4) {
            int nx = p.first + dx[i], ny = p.second + dy[i];
 
            if (S[nx][ny] != '#' && d[nx][ny] == INF) {
                que.push(P(nx, ny));
                d[nx][ny] = d[p.first][p.second] + 1;
                //cout << "d[" << nx << "][" << ny <<  "]= " << d[nx][ny] << endl;
            }
        }
    }
}



int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> H >> W >> K;
    rep(i, H) cin >> S[i];
    int sx, sy;
    rep(i, H) {
        bool b = false;
        rep(j, W) {
            if (S[i][j] == 'S') {
                //cout << S[i][j] << " " << i << " " << j << endl;
                sx = i;
                sy = j;
                b = true;
            }
            if (b) break;
        }
        if (b) break;
    }
    bfs(sx, sy);

    int ans = INF;
    rep(i, H) {
        rep(j, W) {
            //if (d[i][j] != INF) cout << i + 1 << " " << j + 1 << endl;
            if (d[i][j] <= K) {
                int x = i;
                int y = j;
                //cout << x << " " << y << endl;
                ans = min(ans, (min({x, y, H - x - 1, W - y - 1}) + K - 1) / K + 1);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4096
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            sum ^= a[i];
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            sb.append(sum ^ a[i]).append(" ");
        }
        System.out.println(sb.toString().trim());
        sc.close();

    }

}


Measured memory_bytes: 61124
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<string>
#include<algorithm>
#include<iostream>
#include<bitset>
#include<functional>
#include<numeric>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<random>
#include<ctime>
#include<complex>
using namespace std;
typedef long long LL;
mt19937 gene(233);
typedef complex<double> Complex;
#define fi first
#define se second
#define ins insert
#define pb push_back
inline char GET_CHAR(){
	const int maxn = 131072;
	static char buf[maxn],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,maxn,stdin),p1==p2)?EOF:*p1++;
}
inline int getInt() {
	int res(0);
	char c = getchar();
	while(c < '0') c = getchar();
	while(c >= '0') {
		res = res * 10 + (c - '0');
		c = getchar();
	}
	return res;
}

inline int fastpo(int x, int n, int mod) {
	int res(1);
	while(n) {
		if(n & 1) {
			res = res * (LL)x % mod;
		}
		x = x * (LL) x % mod;
		n /= 2;
	}
	return res;
}

inline string itoa(int x, int width = 0) {
  string res;
  if(x == 0) res.push_back('0');
  while(x) {
    res.push_back('0' + x % 10);
    x /= 10;
  }
  while((int)res.size() < width) res.push_back('0');
  reverse(res.begin(), res.end());
  return res;
}

const int N = 1000033;
const int LOG = 20;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
int n, m;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
char a[N];
int c(int x) {
	int res = 0;
	while(x) {
		res += x / 2;
		x /= 2;
	}
	return res;
}
int main() {
	int n;
	scanf("%d", &n);
	scanf("%s", a);
	int cnt = 0, ans = 0;
	for(int i = 0; i < n; i++) {
		int x = c(n - 1) - c(i) - c(n - 1 - i);
		ans ^= (x == 0) && (a[i] % 2);
		if(a[i] == '2') cnt++;
	}
	if(cnt == 0) {
		ans = 0;
		for(int i = 0; i < n; i++) {
			int x = c(n - 1) - c(i) - c(n - 1 - i);
			ans ^= (x == 0) && (a[i] == '3');
		}
		ans *= 2;
	}
	cout << ans << endl;
}




Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

struct UnionFind{
    vector<int> rank,p;
    UnionFind(int size){
        rank.resize(size,0);
        p.resize(size,0);
        for(int i = 0; i < size; i++){
            p[i] = i;
            rank[i] = 0;
        }
    }
    bool same(int x,int y){
        return root(x) == root(y);
    }
    int root(int x){
        if(x != p[x]){
            p[x] = root(p[x]);
        }
        return p[x];
    }
    void unite(int x,int y){
        int rx = root(x);
        int ry = root(y);
        if(rank[rx] > rank[ry]){
            p[ry] = rx;
        }else{
            p[rx] = ry;
            if(rank[rx] == rank[ry]){
                rank[ry]++;
            }
        }
    }
};


int main()
{
    int n,q;
    cin >> n >> q;
    UnionFind uf(n);
    for(int i = 0; i < q; i++){
        int c,x,y;
        cin >> c >> x >> y;
        if(c == 0){
            uf.unite(x,y);
        }else{
            if(uf.same(x,y)){
                cout << 1 << endl;
            }else{
                cout << 0 << endl;
            }
        }
    }
}


Measured memory_bytes: 3188
H,W,M=gets.chomp.split(" ").map(&:to_i)
h_max=0
w_max=0
h_maxs=[]
w_maxs=[]
hs=Array.new(H,0)
ws=Array.new(W,0)
MEMO={}
M.times do
    h,w=gets.chomp.split(" ").map(&:to_i)
    hs[h-1]+=1
    ws[w-1]+=1
    MEMO["#{h-1}_#{w-1}"] = 1
    if hs[h-1] > h_max
        h_max=hs[h-1]
        h_maxs=[h-1]
    elsif hs[h-1] == h_max
        h_maxs.push(h-1)
    end
    if ws[w-1] > w_max
        w_max=ws[w-1]
        w_maxs=[w-1]
    elsif ws[w-1] == w_max
        w_maxs.push(w-1)
    end
end

h_maxs.each do |h|
    w_maxs.each do |w|
        if MEMO["#{h}_#{w}"] == nil
            puts h_max+w_max
            exit
        end
    end
end

puts h_max+w_max-1


Measured memory_bytes: 69440
#include <cstdio>
#include <vector>
#pragma warning(disable : 4996)
using namespace std;
typedef long long ll;
#ifdef _WIN32
inline unsigned int __builtin_clz(unsigned int x) {
	unsigned long r;
	_BitScanReverse(&r, x);
	return 31 - r;
}
#endif
class SparseTable {
	// bit-or sparse table
	vector<vector<ll> > st;
public:
	void init(vector<ll> v) {
		int b = 0;
		for (; (1 << b) <= v.size(); b++);
		st.assign(b, vector<ll>(1 << b));
		for (int i = 0; i < v.size(); i++) st[0][i] = v[i];
		for (int i = 1; i < b; i++) {
			for (int j = 0; j + (1 << i) <= (1 << b); j++) {
				st[i][j] = (st[i - 1][j] | st[i - 1][j + (1 << (i - 1))]);
			}
		}
	}
	ll query(int l, int r) {
		int b = 32 - __builtin_clz(r - l) - 1;
		return (st[b][l] | st[b][r - (1 << b)]);
	}
	SparseTable() {}
	SparseTable(vector<ll> v) { init(v); }
};
inline ll gcd(ll a, ll b) {
	while (b != 0) {
		ll r = a;
		a = b;
		b = r % b;
	}
	return a;
}
inline int modpow(int a, int b, int m) {
	int ret = 1; a %= m;
	while (b) {
		if (b & 1) ret = 1LL * ret * a % m;
		a = 1LL * a * a % m;
		b >>= 1;
	}
	return ret;
}
inline int modinv(int a, int m) {
	return modpow(a, m - 2, m); 
}
const int mod = 1000000007;
int N, Q, l, r; vector<int> p;
int main() {
	scanf("%d%d", &N, &Q); p.resize(N);
	for (int i = 0; i < N; i++) scanf("%d", &p[i]), p[i]--;
	vector<int> a(N), used(N, false);
	vector<ll> s(N);
	for (int i = 0; i < N; i++) {
		if (used[i]) continue;
		vector<int> comp; int r = i;
		while (!used[r]) {
			used[r] = true;
			comp.push_back(r);
			r = p[r];
		}
		int sum = 0;
		for (int j : comp) sum += j + 1, sum = (sum < mod ? sum : sum - mod);
		for (int j : comp) {
			a[j] = comp.size();
			s[j] = 1LL * sum * modinv(a[i], mod) % mod;
		}
	}
	vector<ll> b(N); vector<int> sumv(N + 1);
	for (int i = 0; i < N; i++) b[i] = (1LL << a[i]);
	for (int i = 0; i < N; i++) {
		sumv[i + 1] = sumv[i] + s[i];
		if (sumv[i + 1] >= mod) sumv[i + 1] -= mod;
	}
	SparseTable S(b);
	while(Q--) {
		scanf("%d%d", &l, &r); l--;
		ll res = S.query(l, r);
		ll rep = 1;
		for (int i = 2; i <= 40; i++) {
			if (res & (1LL << i)) rep = rep / gcd(rep, i) * i;
		}
		rep %= mod;
		int mul = sumv[r] - sumv[l]; mul = (mul >= 0 ? mul : mul + mod);
		printf("%lld\n", mul * rep % mod);
	}
	return 0;
}

Measured memory_bytes: 25696
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	int i;
	cin>>a;
	for(i=0;i<a.size();i++)
	 if(a[i]=='9')
	 {
	  cout<<"Yes"<<endl;
	  return 0;
	 }
	cout<<"No"<<endl;
	return 0;
}

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

int main()
{
    int H;
    int A;
    cin >> H >> A;
    if(H%A ==0)
    {
        cout << H/A << endl;
    }
    else
    {
        cout << H/A +1 << endl;
    }
    
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        int K = sc.nextInt();

        if(N % 2 == 0 && N / K >= 2){
            System.out.println("YES");
        } else if(N % 2 == 1 && (N + 1) / K >= 2){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }
}


Measured memory_bytes: 23252
N = int(input())

def kansuu(list_x):
    result = []
    cnt = 1
    for i in range(len(list_x)-1):
        if list_x[i] == list_x[i+1]:
            cnt += 1
        else:
            num = list_x[i]
            result.append((num,cnt))
            cnt = 1
    result.append((list_x[-1],cnt))
    return result

a_li = list(map(int,input().split()))
ans = 0
for _,i in kansuu(a_li):
    if i == 1:
        continue
    else:
        ans += i//2
print(ans)


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int64 r, d, x;
  cin >> r >> d >> x;
  for (int i = 1; i <= 10; ++i) {
    x = r * x - d;
    cout << x << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define All(a) a.begin(), a.end()
int main(){
    long long N, K;
    cin >> N >> K;
    vector<long long> p(N);
    for(int i = 0; i <N; i++) cin >> p[i];
    vector<double> per(1001);
    long long res = 0;
    for(int i = 1; i < 1001; i++){
        res += i;
        per[i] = (double)res / (double)i;
    }
    vector<double> sum(N + 1, 0);
    for(int i = 1; i < N + 1; i++){
        sum[i] += sum[i - 1] + per[p[i - 1]];
    }
    double ans = 0;
    for(int i = 0; i + K< N + 1; i++){
        ans = max(ans, sum[i + K] - sum[i]);
    }
    printf("%.10lf\n", ans);
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
ll cnt[26];
int main(){
    string s;cin>>s;
    int n=(int)s.size();
    ll ans=0;
    rep(i,n){
        ans+=i-cnt[s[i]-'a'];
        cnt[s[i]-'a']++;
    }
    ans++;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<int> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define re(i,a,b) for(i=a;i<=b;i++)
 
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll ans;
ll a,b,c,d,e;
ll x[100005],y[100005];
ll dp[105][105];
char s[100005];

int main(){
    cin>>n;
	for(i=0;i<n;i++){
		cin>>x[i];
		while(x[i]%2==0){
			x[i]/=2;
			ans++;
		}
	}
	p(ans);

}

Measured memory_bytes: 4992
import java.util.Scanner;
import java.util.Locale;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

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

    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    boolean flag = false;
    if (X == 7 || X == 5 || X == 3){
      flag = true;
    }

    System.out.println(flag ? "YES" : "NO");
  }
}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)n; i++)
const int MOD = 1000000007;
// long long a;
int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<int > num(N + 1);
  num[0] = 0;
  for(int i = 1; i <= N; i ++){
    if(S[i - 1] == 'I') num[i] = num[i - 1] + 1;
    else if(S[i - 1] == 'D') num[i] = num[i - 1] - 1;
    //    cout << "i =" << i << "num = " << num[i] << endl;
  } 
  int max = num[0];
  REP(i, N + 1){
    if(max < num[i]) max = num[i];
  }
  //x  REP(i, N + 1) cout << num[i] << endl;
  cout << max << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(x) (int)x.size()
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define RALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n; 
    if ( n>=30 ) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}

Measured memory_bytes: 3648