akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string btos(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int n,a,b;cin>>n>>a>>b;
  int ans=0;
  rep(i,n){
    int num=i+1;
    int sum=0;
    while(num!=0){
      sum+=num%10;
      num/=10;
    }
    if(sum>=a&&sum<=b){
      ans+=i+1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main(void){
	int K; cin >> K;
	int i = 1;
	int tmp = 0;
	while (1){
		tmp = (tmp * 10 + 7) % K;
		if (tmp == 0){
			cout << i << endl;
			break;
		}
		++i;
		if (i > K){
			cout << -1 << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3632
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	int d, n, T[256], low[256], hi[256], M[256];
	int dp[256][256]; //dp[i][j] : i日目に服jを着た時の派手さの最大値

	cin >> d >> n;

	for(int i = 0; i < d; i++)
	{
		cin >> T[i];
	}
	for(int i = 0; i < n; i++)
	{
		cin >> low[i] >> hi[i] >> M[i];
	}	

	for(int i = 0; i < 201; i++)
	{
		for(int j = 0; j < 201; j++)
		{
			dp[i][j] = 0;
		}
	}

	int res = 0;

	for(int i = 1; i < d; i++)
	{
		for(int j = 0; j < n; j++)
		{
			if(T[i] >= low[j] && T[i] <= hi[j])
			{
				for(int k = 0; k < n; k++)
				{
					if(low[k] <= T[i-1] && hi[k] >= T[i-1])
					{
						dp[i][j] = max(dp[i][j], abs(M[j]-M[k])+ dp[i-1][k]);
						res = max(res, dp[i][j]);
					}
				}
			}
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 1372
from operator import itemgetter

N, M = map(int,input().split())
demand = [list(map(int,input().split())) for _ in range(M)]
demand.sort(key=itemgetter(1))
x = 1
b = demand[0][1]

for i in range(1, M):
    if demand[i][0] < b:
        pass
    else:
        x += 1
        b = demand[i][1]

print(x)


Measured memory_bytes: 29152
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const ll mod = 1e9 + 7;
const int M = 2e6 + 5;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   if(pow < 0) return 0;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ll mult_mod(ll a , ll b){a = a%mod; b = b%mod;ll c = (a * b)%mod;return c;}
ll add_mod(ll a , ll b){a = (a + mod)%mod;b = (b + mod)%mod;ll c = (a + b)%mod;return c;}
ll fac[(int)(2e6 + 7)] , inv_fac[(int)(2e6 + 7)];
void precomp_factorial(){fac[0] = 1;for(ll i = 1 ; i <= M ; i++) fac[i] = mult_mod(i , fac[i - 1]);
    inv_fac[M] = inv(fac[M]);for(ll i = M - 1 ; i >= 0 ; i--) inv_fac[i] = mult_mod(i + 1 , inv_fac[i + 1]);}
ll nCk(ll n , ll k){ll ans = fac[n];ans = mult_mod(ans , inv_fac[n - k]);ans = mult_mod(ans , inv_fac[k]);return ans;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
 
 
int main()
{
   string s;
   cin >> s;
   string cur, prev;
   int ans = 0;
   for(int i = 0; i < s.size(); i++){
       cur += s[i];
       if(cur != prev){
           ans++;
           prev = cur;
           cur = "";
       }
   }
   cout << ans;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define ll long long
using namespace std;
const int inf=1e9;
const int mod=1e9+7;
const int maxn=1e5+10;

int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	int n;
	cin>>n;
	for(int i=1;i<=9;i++){
		if(n%i==0&&n/i<=9){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

list_n = list(range(n))

l = [[] for i in range(n)]

for i in range(m):
    p,s = input().split()
    p = int(p) - 1
    l[p].append(s)

ac = 0
wa = 0
for i in l:
    if 'AC' in i:
        ac += 1
        wa_l = i[0:(i.index('AC'))]
        wa += wa_l.count('WA')
        
print(ac,wa)

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n;
  cin >> n;
  
  vector<ll> a(n+1), b(n);
  REP(i, n+1)
    cin >> a[i];

  REP(i, n)
    cin >> b[i];

  ll ans = 0;
  ll remaining = 0;
  REP(i, n){
    if(a[i] > remaining){
      a[i] -= remaining;
      ans += remaining;
    }
    else{
      ans += a[i];
      a[i] = 0;
    }

    if(a[i] < b[i]){
      ans += a[i];
      b[i] -= a[i];
      a[i] = 0;

      if(a[i+1] < b[i]){
        ans += a[i+1];
        b[i] -= a[i+1];
        a[i+1] = 0;
        remaining = b[i];
      }
      else{
        ans += b[i];
        a[i+1] -= b[i];
        b[i] = 0;
        remaining = b[i];
      }
    }
    else{
      ans += b[i];
      remaining = 0;
    }
  }

  cout << ans << endl;




  
  
}


Measured memory_bytes: 1792
N = int(input())
A = list(map(int, input().split()))
flag = 0
for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 == 0 or A[i] % 5 == 0:
      pass
    else:
      flag = 1
      break
if flag == 0:
  print("APPROVED")
else:
  print("DENIED")

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main() {
	int i;
	cin >> i;
	int x, y, z;
	for (x = 1; x <= i; x++) {
		z = x;
		y = 0;
		if (z % 3 == 0) y = 1;
		if (z % 10 == 3) y = 1;
		while (z > 10) {
			z = z / 10;
				if (z % 10 == 3) y = 1;
		}
		if (y == 1) cout << " " << x;
	}
	cout << endl ;
	return 0;
}


Measured memory_bytes: 3112
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	N := readInt()
	for N > 0 {
		if N%10 == 9 {
			println("Yes")
			return
		}
		N /= 10
	}
	println("No")
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
}

ll getdigit(ll n){
	string s=to_string(n);
	return s.size();
}
	
int main(){
	init();
	string s,t;
	cin>>s>>t;
	string ans;
	for(int i=0;i<s.length();i++){
		ans+=s[i];
		if(i<t.length())ans+=t[i];
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int N,M,C;
	static int A[100],P[100];
	scanf("%d%d",&N,&M);
	for(int i=0;i<M;i++)scanf("%d",&A[i]);
	for(int i=0;i<M;i++)for(int j=0;j<N;j++){
	scanf("%d",&C);
	if(C==A[i]){
		P[j]++;
		}else{
		P[A[i]-1]++;	
		}
	}
	for(int j=0;j<N;j++)printf("%d\n",P[j]);
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
char c[300100];
int n,i,j,cou,l[300100],r[300100],sum[300100],ans=1e9;
int main(){
    scanf(" %d",&n);
    scanf(" %s",c);
    cou=0;
    for(i=1;i<n;i++){
        if(c[i-1]=='W'){
            cou++;
        }
        l[i]=cou;
    }
    cou=0;
    for(i=n-2;i>=0;i--){
        if(c[i+1]=='E'){
            cou++;
        }
        r[i]=cou;
    }
    for(i=0;i<n;i++){
        sum[i]=l[i]+r[i];
        ans=min(ans,sum[i]);
    }
    printf("%d",ans);
}


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

#define INF (1e9+5)
using namespace std;
typedef long long ll;

ll mod = 998244353;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i=0; i<n; i++) {
    int x;
    scanf("%d", &x);
    if ((i==0) != (x==0)) {
      printf("0\n");
      return 0;
    }
    a[x]++;
  }

  ll ans=1;
  for (int i=1; i<a.size(); i++) {
    ll pls = 1;
    for (int j=0; j<a[i]; j++) {
      pls = (pls * a[i-1]) % mod;
    }
    ans = (ans * pls) % mod;
  }

  printf("%lld\n", ans);
}


Measured memory_bytes: 640
#C
import math
a, b, h, m = map(int, input().split())
a_rad = h*math.pi/6 + m*math.pi/360
b_rad = m*math.pi/30
print((a**2 + b**2 -2*a*b*math.cos(a_rad-b_rad))**(1/2))

Measured memory_bytes: 79512
import java.util.*;
 
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
        int n1 = sc.nextInt();
        String s = sc.next();
        int n2 = sc.nextInt();
        if(s.equals("+")){
        	System.out.println(n1 + n2);
        }else{
        	System.out.println(n1 - n2);
        }
	}
}

Measured memory_bytes: 35788
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>

using namespace std;

typedef long long int64;

int main(void){
    string S;
    int64 K;
    cin>>S>>K;
    int64 l=S.length();
    int64 cnt=0,tmp=0,tmp1=0,tmp2=0;
    int64 j=0;

    if(S[0]==S[l-1]){
        tmp1=0;
        for(j=0;S[j]==S[0];j++){
            tmp1++;
        }
        if(tmp1==l){
            cout<<l*K/2<<endl;
            return 0;
        }
        tmp2=0;
        for(j=l-1;S[j]==S[0];j--){
            tmp2++;
        }
        for(int64 i=tmp1+1;i<l-tmp2;i++){
            for(tmp=1;S[i]==S[i-1]&&i<l;i++){
                tmp++;
            }
            cnt+=tmp/2;
        }
        cout<<cnt*K+tmp1/2+tmp2/2+((tmp1+tmp2)/2)*(K-1)<<endl;

    }else{
        for(int64 i=1;i<l;i++){
            for(tmp=1;S[i]==S[i-1]&&i<l;i++){
                tmp++;
            }
            cnt+=tmp/2;
        }
        cout<<cnt*K<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n; cin >> n;
	
	ll ans = 0;
	for(ll i = 2; i*i <= n; i++){
		ll cnt = 0;
		while(n%i == 0){
			n /= i;
			cnt++;
		}
		
		ll at = 1;
		while(cnt > 0){
			cnt -= at;
			if(cnt >= 0)ans++;
			at++;
		}
	}
	
	if(n > 1)ans++;
	print(ans)
	
	return 0;
}

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

int main(){
	int N;
	cin >> N;
	int a[N];
	int count = 1;
	int ans = N+1;
	for(int i = 0; i < N; i++){
		cin >> a[i];
	}
	for(int i = 0; i < N; i++){
		if(a[i] == count){
			ans = count;
			count++;
		}
	}
	cout << N-ans;
	return 0;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
using namespace std;

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <stack>
#include <bitset>

int main() {
	int H, W;
	cin >> H >> W;

	string a[101];

	rep(i, H) {
		cin >> a[i];
	}
	
	for (int i = 0; i <= W + 1; i++) {
		cout << '#';	
	}
	cout << endl;

	rep(i, H) {
		cout << '#' << a[i] << '#' << endl;;
	}

	for (int i = 0; i <= W + 1; i++) {
		cout << '#';
	}
	cout << endl;
}

Measured memory_bytes: 256
s = input()
ans = 0
if s[0] == 'R':
    ans = 1
    if s[1] == 'R':
        ans = 2
        if s[2] == 'R':
            ans = 3
elif s[1] == 'R':
    ans = 1
    if s[2] == 'R':
        ans = 2
elif s[2] == 'R':
    ans = 1
print(ans)

Measured memory_bytes: 61688
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = [INT() for _ in range(N)]

A_sorted = sorted(A, reverse=True)
max_ = A_sorted[0]

for i in A:
	if i != max_:
		print(max_)
	else:
		print(A_sorted[1])


Measured memory_bytes: 16172
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = s, i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = s; i < (n); ++i)
#define VFORS(i, s, n) for(int i = s; i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = s, i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = s, i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;

const int MOD = 1000000007;
const int INF = 1000000000;

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



int main(){
    int n, xx = -1, yy = -1, hh = 0;//とりあえずhが0でないものを保存
    cin >> n;
    VI x(n), y(n), h(n);
    REP(i, n){
        cin >> x[i] >> y[i] >> h[i];
        if(!hh && h[i]){
            xx = x[i]; yy = y[i]; hh = h[i];
        }
    }
    REPS(i, 100){
        REPS(j, 100){
            int H = hh + abs(i - xx) + abs(j - yy);
            bool okay = true;
            REP(k, n){
                if(h[k] != max(0, H-abs(i-x[k])-abs(j-y[k]))) okay = false;  
            }
            if(okay){
                cout << i << " " << j << " " << H << "\n";
            }
        }
    }
    return 0;
}


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

int main() {
	int a, b, c, sum = 0, i = 1;
	cin >> a >> b >> c;
	while (a * i <= a * b) {
		int now = a * i;
		if (now % b == c) {
			cout << "YES" << endl;
			return 0;
		}
		i++;
	}
	cout << "NO" << endl;
}

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

int main()
{
         char S[100],T[100];
         cin>>S;
         cin>>T;
         if(strlen(T)==strlen(S)+1)
         {

                           T[strlen(T)-1]='\0';



                  int i=strcmp(S,T);
                  if(i==0)
                           cout<<"Yes"<<endl;
                  else
                           cout<<"No"<<endl;
         }
         else
                  cout<<"No"<<endl;
         return 0;
}


Measured memory_bytes: 3640
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl   = input.ReadLine().Split(' ');
        var n     = int.Parse(spl[0]);
        var k     = int.Parse(spl[1]);

        var hh = new int[n];

        for(int i=0; i<n; i++) {
            hh[i] = int.Parse(input.ReadLine());
        }

        Array.Sort(hh);

        int st = 0;
        int ed = k-1;

        var min = long.MaxValue;
        while (ed < n) {
            min = Math.Min(min, hh[ed] - hh[st]);

            st++;
            ed++;            
        }

        return min;
    }
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll gcd(ll a, ll b) { for (; b; a %= b, swap(a, b)); return a; }

const int INF = 987654321;

int h, w;
int a[200001];
int b[200001];

set <pii> st;
multiset <int> ms;

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

	cin >> h >> w;
	for (int i = 0; i < h; i++)
		cin >> a[i] >> b[i];

	for (int i = 1; i <= w; i++)
	{
		st.insert({ i,i });
		ms.insert(0);
	}

	for (int i = 0; i < h; i++)
	{
		while (true)
		{
			auto it = st.lower_bound({ a[i],0 });
			if (it == st.end()) break;
			if (it->first > b[i]) break;

			int s = it->second, e = it->first;

			st.erase(it);
			ms.erase(ms.find(e - s));

			if (b[i] != w)
			{
				st.insert({ b[i] + 1,s });
				ms.insert(b[i] + 1 - s);

				while (true)
				{	
					auto it = st.lower_bound({ b[i] + 1,0 });
					auto jt = next(it);
					if (jt == st.end() || jt->first != b[i] + 1) break;

					int s = it->second, e = it->first;

					st.erase(it);
					ms.erase(ms.find(e - s));
				}
			}
		}

		if (ms.empty()) cout << "-1\n";
		else cout << (*ms.begin()) + i + 1 << '\n';
	}
}

Measured memory_bytes: 23960
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

class mod;

#define MOD 1000000007

using lli = long long int;
using ulli = unsigned long long int;

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int N, M;
vector<int> R[50];
int a, b, ans = 0;

int main(){
  cin >> N >> M;
  for(int l = 0; l < M; l++){
    cin >> a >> b;
    R[a-1].push_back(b);
    R[b-1].push_back(a);
  }
  for(int l = 0; l < N; l++){
    /*
    for(auto i : R[l]){
      dbugf(i);
    }
    dbugln;
    */
    cout << R[l].size() << endl;

  }

  return 0;
}


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

int main(){
	int N,K;
	cin >> N >> K;
	vector<int> h(N);
	for(int i=0;i<N;i++)cin >> h[i];
	int ans=0;
	for(int i=0;i<N;i++)if(h[i]>=K)ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
N,K=map(int,input().split())
d=[]
A=[]
for i in range(K):
    x=int(input())
    y=list(map(int,input().split()))
    for i in y:
        A.append(i)

ans=0
for i in range(1,N+1):
    if i in A:
        continue
    else:
        ans+=1
print(ans)

Measured memory_bytes: 9192
n=int(input())
plus=[input() for _ in range(n)]
m=int(input())
minus=[input() for _ in range(m)]
res=[]
for i in plus:
    a=plus.count(i)
    b=minus.count(i)
    res+=[(a-b,i)]
res.sort(reverse=1)
print(max(0,res[0][0]))

Measured memory_bytes: 9216
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var A = sc.nextInt();
        var B = sc.nextInt();
        if (A + B >= 10) {
            WriteLine("error");
        } else {
            WriteLine(A + B);
        }

    }
    
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 11220
t = int(input())
for _ in range(t):
  n = int(input())
  lst = list(map(int, input().split()))
  M = m = 0
  for i in range(n - 1):
    M = max(lst[i + 1] - lst[i], M)
    m = min(lst[i + 1] - lst[i], m)
  print(M, -m)


Measured memory_bytes: 5608
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//string alp = "abcdefghijklmnopqrstuvwxyz";
using namespace std;
int main(){
  vector<int> v;
  REP(i,3){
    int a;
    cin >> a; 
    v.push_back(a);
  }
  sort(v.begin(),v.end());
  cout << v[0]+v[1] << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long m = sc.nextLong();
		long[] a = new long[n + 1];
		long gcd = 0;
		long lcm = 1;
		for(int i = 0 ; i < n ; i++) {
			a[i] = sc.nextLong() / 2;
			gcd = gcd(lcm , a[i]);
			lcm = lcm * a[i] / gcd;
			if(m < lcm) {
				System.out.println(0);
				return;
			}
		}
		for(int i = 0 ; i < n ; i++) {
			if((lcm / a[i]) % 2 == 0) {
				System.out.println(0);
				return;
			}
		}

		sc.close();
		System.out.println((m / lcm) - (m / (lcm * 2)));

	}
	public static long gcd(long num1,long num2) {
        if(num2 == 0) return num1;
        else return gcd(num2 , num1 % num2 );
 }
}



Measured memory_bytes: 60072
//Har Har Mahadev
using namespace std;
#include <bits/stdc++.h>
#define booga cout << "booga" << endl
#define ll long long int
#define pb push_back
#define mp make_pair
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " -> " << a << endl;
	err(++it, args...);
}

void testcase(){
	int x;cin >> x;
	if(x == 0)cout << 1;
	else cout << 0;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	while(t--){
		testcase();
	}
	return 0;
}


Measured memory_bytes: 3636
#!/usr/bin/env python3
import sys
args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False
input = sys.stdin.readline
S = input()[0:-1]
Sr = S[::-1]
count = 0
for i in range(0,int(len(S)/2)):
  if S[i] != Sr[i]:
    count += 1
print(count)


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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (b > d)cout << 1 << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	i64 n, k; scanf("%lld%lld", &n, &k); std::vector<i64> a(n);
	for(int i = 0; i < n; i++) scanf("%lld", &a[i]);

	const int MOD = 1e9 + 7;
	
	i64 s = 0, t = 0;
	for(int i = 0; i < n; i++) for(int j = 0; j < i; j++) s += (a[i] < a[j]);
	for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) t += (a[i] < a[j]);

	i64 ans = s * k % MOD + (k - 1) * k / 2 % MOD * t % MOD;
	printf("%lld\n", ans % MOD);
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main
{
 
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m= sc.nextInt();
    int[] a = new int[n];
    for(int i=0;i<n;i++)
    {
      a[i]=sc.nextInt();
    }
    Arrays.sort(a);
    int sum=0;
    for(int i=0;i<m;i++)
    {
     sum=sum+a[i];
    }
    System.out.print(sum);
  }
   
  }

Measured memory_bytes: 38808
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, m, a;
multiset<int> mst;
long long sum;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a;
		mst.insert(a);
	}
	while (m && !mst.empty()) {
		auto x = mst.end();
		x--;
		int tmp = *x;
		mst.erase(x);
		if (tmp / 2 > 0) mst.insert(tmp / 2);
		m--;
	}
	for (auto x : mst) {
		sum += x;
	}
	cout << sum << E;
	//system("pause");
	return 0;
}

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

int main() {
    ll N; int K;
    cin >> N >> K;
    ll ans = 0;
    if(K==0){
        ans = N*N;
        cout << ans << endl;
        exit(0);
    }
    for(int b = 1; b <= N; b++){
        int p = N/b;
        int r = N%b;
        ans += p*max(0,b-K);
        ans += max(0,r-K+1);
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b&&b==c&&c==a){
    cout<<"No"<<endl;
  }else if(a!=b&&c!=b&&a!=c){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define FOR(i, x, y) for (ll i = x; i < y; i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;

ll dp[10001][101];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    ll d;
    cin >> s >> d;
    dp[0][0] = 1;
    FOR(i, 1, s.size()) {
        FOR(j, 0, d) {
            dp[i][j] = 0;
            FOR(k, 0, 10) {
                dp[i][j] = (dp[i][j] + dp[i - 1][(j - k + 100 * d) % d]) % MOD;
            }
        }
    }
    ll ans = dp[s.size() - 1][0] - 1;
    ll pref = 0;
    FOR(j, 1, s[0] - '0') {
        ans = (ans + dp[s.size() - 1][(100000 * d - (pref + j)) % d]) % MOD;
    }
    pref += (s[0] - '0');
    FOR(i, 1, s.size()) {
        FOR(j, 0, s[i] - '0') {
            ans = (ans + dp[s.size() - i - 1][(100000 * d - (pref + j)) % d]) %
                  MOD;
        }
        pref += (s[i] - '0');
    }
    ans += (pref % d == 0);
    cout << ans << '\n';
    return 0;
}

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

using namespace std;

string solve()
{
	int N;
	cin >> N;

	int ct = 0;
	int cx = 0;
	int cy = 0;
	for (int i = 0; i < N; ++i) {
		int t, x, y;
		cin >> t >> x >> y;

		int d = abs(x - cx) + abs(y - cy);
		int dt = t - ct;
		if (dt < d || (dt - d) % 2 != 0) {
			return "No";
		}

		ct = t;
		cx = x;
		cy = y;
	}
	return "Yes";
}

int main()
{
	cout << solve() << endl;
}


Measured memory_bytes: 256
use std::io::Write;

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let n: usize = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.parse().unwrap()
    };

    let a: Vec<isize> = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right().to_owned();
        s.split_whitespace().map(|x| x.parse().unwrap()).collect()
    };

    let mut sum = 0;
    for i in 0..n {
        if i % 2 == 0 {
            sum += a[i];
        } else {
            sum -= a[i];
        }
    }

    let mut rain = vec![-1; n];
    rain[0] = sum;

    for i in 1..n {
        sum = -sum + 2 * a[i - 1];
        rain[i] = sum;
    }
    println!("{}", rain.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(" "));
}


Measured memory_bytes: 13428
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
	int K, A, B;
	cin >> K >> A >> B;
	bool ok = false;
	for (int i = A; i <= B; ++i) {
		if (i % K == 0) {
			ok = true;
		}
	}
	cout << (ok ? "OK" : "NG") << endl;
	return 0;
}

Measured memory_bytes: 3624
import fractions

def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)

a, b, c, d = map(int, input().split())

cc = b // c - (a-1) // c
dd = b // d - (a-1) // d
l = lcm(c, d)
cd = b // l - (a-1) // l

print(b-a+1-(cc+dd-cd))


Measured memory_bytes: 65004
import java.util.*;

public class Main{          
    
     static final int INF = 100000000;
           
      public static void main(String[] args) {          
          
        Scanner sc = new Scanner(System.in);
       
        int N = sc.nextInt();
        int M = sc.nextInt();
        
        int a[] = new int[M];
        int b[] = new int[M];
        int c[] = new int[M];
        
        int [][] dist = new int[N][N];
        
        for(int i = 0;i < M;i++){
            a[i] = sc.nextInt() - 1;
            b[i] = sc.nextInt() - 1;
            c[i] = sc.nextInt();
        }
        
        for(int i = 0;i < N;i++){
            for(int j = 0;j < N;j++){
                if(i == j) 
                   dist[i][j] = 0;
                else
                   dist[i][j] = INF;
            }            
        }
        
        for(int i = 0;i < M;i++){
            dist[a[i]][b[i]] = Math.min(dist[a[i]][b[i]],c[i]);
            dist[b[i]][a[i]] = Math.min(dist[b[i]][a[i]],c[i]);            
        }
        
        for(int k = 0;k < N;k++){
            for(int i = 0;i < N;i++){
               for(int j = 0;j < N;j++){
                   dist[i][j] = Math.min(dist[i][k] + dist[k][j],dist[i][j]);
               }   
            }            
        }
                
        int ans = M;
        
        for(int i = 0;i < M;i++){
            boolean shortest = false;
            for(int j = 0;j < N;j++){
                if(dist[j][a[i]] + c[i] == dist[j][b[i]]){
                    shortest = true;
                }
            }            
            if(shortest == true){
                ans--;
            }            
        }
        
        System.out.println(ans);
        
    }     
}       



Measured memory_bytes: 25940
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		if(s.substring(2,3).equals(s.substring(3,4))&&
				s.substring(4,5).equals(s.substring(5,6))){
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}
}

Measured memory_bytes: 21844
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    ios::sync_with_stdio(false);
	cin.tie(0);
    int n,q;
    cin>>n>>q;
    atcoder::dsu uf(n);
    for (size_t i = 0; i < q; i++)
    {
        int t,u,v;
        cin>>t>>u>>v;
        if(t)
        {
            cout<<uf.same(u,v)<<endl;
        }
        else
        {
            uf.merge(u,v);
        }
        
    }
    
    return 0;
}

Measured memory_bytes: 3936
#pragma target("avx")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define rep(i,b,e) for(ll i=b; i<e; i++)
#define be(vec) vec.begin(),vec.end()
#define print(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define scan(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n, a, b;
	scanf("%d", &n);
	V links[n];
	rep(i, 0, n-1){
		scanf("%d %d", &a, &b);
		links[a-1].push_back(b-1);
		links[b-1].push_back(a-1);
	}
	V c(n); scan(c);
	std::sort(be(c), std::greater<ll>());

	ll ans[n], used[n];
	memset(ans, 0, sizeof(ans));
	memset(used, 0, sizeof(used));
	std::queue<ll> que;
	que.emplace(0);
	ans[0] = c[0];
	ll cnt = 0, idx = 1;
	while(!que.empty()){
		ll from = que.front();
		que.pop();
		used[from] = 1;
		for(ll to: links[from]){
			if(!used[to]){
				ans[to] = c[idx++];
				que.emplace(to);
				cnt += std::min(ans[from], ans[to]);
			}
		}
	}

	printf("%ld\n", cnt);
	for(ll &i: ans) printf("%ld ", i);
	return 0;
}


Measured memory_bytes: 1280
import sys
n = int(input())
a,b,c = sys.stdin
count = 0
for i in range(n):
  if a[i] == b[i] == c[i]:
    continue
  elif a[i] == b[i] or a[i] == c[i] or b[i] == c[i]:
    count += 1
  else:
    count += 2
print(count)

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

using namespace std;

int N, M, ans, dp[1000009], ap[1000009], sum[1000009], sum2[1000009];
const int mod = 998244353;

int add (int x, int y) {int ans = x + y; if (ans >= mod) ans -= mod; return ans;}
int subtract (int x, int y) {if (x >= y) return x - y; return x - y + mod;}
int mul (int x, int y) {return 1LL * x * y % mod;}
void adto (int &x, int y) {x += y; if (x >= mod) x -= mod;}

int power (int a, int b)
{
    int p = 1;
    for (int i=0; (1<<i) <= b; i++)
    {
        if (b & (1 << i)) p = mul (p, a);
        a = mul (a, a);
    }
    return p;
}

int fac[2000009], inv[2000009];
void Prec (int lim){fac[0] = inv[0] = 1;for (int i=1; i<=lim; i++)fac[i] = mul (fac[i - 1], i);
inv[lim] = power (fac[lim], mod - 2);for (int i=lim - 1; i>=0; i--)inv[i] = mul (inv[i + 1], i + 1);}
int comb (int N, int K){if (K > N || N < 0 || K < 0) return 0; int ans = mul (fac[N], inv[N - K]);ans = mul (ans, inv[K]);return ans;}
int getInverse (int n){if (n == 1) return 1;return mul (fac[n - 1], inv[n]);}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d", &N), M = 0;
for (int i=1; i<=N; i++)
{
    int x;
    scanf ("%d", &x);
    ap[x] ++;
    if (x > M)
        M = x;
}
/*for (int i=2; 1LL * i * i <= M; i++)
    if (cr[i] == 0)
        for (int j=i * i; j<=M; j+=i)
            cr[j] = i;
for (int i=2; i<=M; i++)
    if (cr[i] == 0)
        cr[i] = i;*/
for (int i=1; i<=M; i++)
    for (int j=i; j<=M; j+=i)
        adto (sum[i], mul (ap[j], j)),
        adto (sum2[i], mul (ap[j], mul (j, j)));
for (int i=M; i>=1; i--)
{
    dp[i] = subtract (mul (sum[i], sum[i]), sum2[i]);
    if (dp[i] & 1) dp[i] += mod;
    dp[i] >>= 1;
    for (int j=i + i; j<=M; j+=i)
        dp[i] = subtract (dp[i], dp[j]);
}
Prec (M + 10);
for (int i=1; i<=M; i++)
    adto (ans, mul (dp[i], getInverse (i)));
printf ("%d\n", ans);
return 0;
}


Measured memory_bytes: 27392
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,x;
    cin>>n>>x;
    vector<int> m(n);
    for(int i=0;i<n;i++)
    cin>>m[i];
    int64_t min=100001,sum=0;
    for(int i=0;i<n;i++){
        if(min>m[i])
        min=m[i];
        sum+=m[i];
    }
    x-=sum;
    cout<<n+x/min<<endl;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
   int n,m;
   cin >> n >> m;
   int s[m],c[m];
   rep(i,m) cin >> s[i] >> c[i];
   for(int i=0;i<1000;i++){
       int d = 0;
       int a = i;
       vector<int> l;
       while(a>0){
           l.push_back(a%10);
           a /= 10;
           d++;
       }
       if(i==0) {
           l.push_back(0);
           d++;
       }
       reverse(l.begin(),l.end());
       bool flag = 0;
       rep(j,m){
           if(s[j]>d) flag = 1;
           if(l[s[j]-1]!=c[j]) flag = 1;
       }
       if(d!=n) flag = 1;
       if(!flag){
           cout << i << endl;
           return 0;
       }
   }
   cout << -1 << endl;
}

Measured memory_bytes: 256
n=int(input())
s=input()
mae=0
ushi=0
ans0=0
ans1=0
ans01=[]
flag=False
for i in range(n):
    ans01.append(s[i])
    if s[i]=='(':
        mae+=1
        flag=True
        ans1+=1
    else:
        ushi+=1
        if flag:
            ans1-=1
            if ans1<=0:
                flag=False
    ans0=max(ushi-mae,ans0)
ans00=[]
ans11=[]
for i in range(ans0):
    ans00.append('(')
for i in range(ans1):
    ans11.append(')')

print(''.join(ans00+ans01+ans11))

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>

using i8 = std::int8_t;
using u8 = std::uint8_t;
using i16 = std::int16_t;
using u16 = std::uint16_t;
using i32 = std::int32_t;
using u32 = std::uint32_t;
using i64 = std::int64_t;
using u64 = std::uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

auto main() -> i32 {
	int n, x, t;
	scanf("%d%d%d", &n, &x, &t);
	int cnt = (n + x - 1) / x;
	printf("%d\n", cnt * t);
	return 0;
}


Measured memory_bytes: 1680
#include<stdio.h>
int main(){
  int n,k,i;
  double e=0,max;
  scanf("%d%d",&n,&k);
  double p[n+1];
  for(i=0;i<n;i++){
    scanf("%lf",&p[i]);
    p[i]=(p[i]+1)/2;
  }
  for(i=0;i<k;i++)
    max+=p[i];
  e=max;
  for(i=0;i<n-k;i++){
    e=e-p[i]+p[k+i];
    if(max<e)
      max=e;
  }
  printf("%lf\n",max);
  return 0;
}


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

typedef multimap< int, pair<int, int> > HL;

int main() {
  int n, m, ans;
  int h, p, q;

  while (cin >> n >> m >> ans, n && m && ans) {
    set<int> hs;
    multimap<int, pair<int, int>> hl;

    rep (i, m) {
      cin >> h >> p >> q;
      hs.insert(h);
      hl.insert(make_pair(h, make_pair(p, q)));
    }

    for (set<int>::reverse_iterator sit=hs.rbegin(); sit!=hs.rend(); sit++) {
      int hhead = *sit;

      for (multimap<int, pair<int, int>>::iterator it = hl.lower_bound(hhead); it != hl.upper_bound(hhead); it++) {
        // ????????¢????????????????????¨???????????????
        // pair<int, int> v = it.second;
        // pair<int, int> v = (*it).second;

        pair<int, int> v = it->second;
        if (v.first == ans) {
          ans = v.second;
          break;
        }
        else if (v.second == ans ) {
          ans = v.first;
          break;
        }
      }
    }

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

Measured memory_bytes: 3164
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> pl;
const int INF=100000001;

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

  cout<<3*r*r<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>

#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n;i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b;i++)
#define repv(x, arr) for (auto& x:arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a,b) make_pair(a,b)
#define op(i) cout << (i) << endl;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const ll mod = 1e9 + 7;



int main(){
    set<int> cnt;
    int x;
    rep(i,3){
        cin >> x;
        cnt.insert(x);
    }
    cout << cnt.size() << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int n , k ;
    cin >> n >> k ;
    int x[n] ;

    int ans = 0 ;
    for(int i = 0 ; i <  n ; i++){
        cin >> x[i] ;
    }
    for(int i = 0 ; i < n ; i++){
        if(k - x[i]>=x[i]){
            ans += 2 * x[i] ;
        }else{
            ans += 2 * (k - x[i] ) ;
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr)
#define FORS(x,plus,arr) for(auto x = begin(arr)+(plus); x != end(arr); ++x)
#define FORREV(x,plus,arr) for(auto x = (arr).rbegin()+(plus); x !=(arr).rend(); ++x)
#define REE(s_) {cout<<s_<<'\n';exit(0);}
#define GET(arr) for(auto &i: (arr)) sc(i)
#define whatis(x) cerr << #x << " is " << (x) << endl;
#define e1 first
#define e2 second
#define INF 0x7f7f7f7f
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef int64_t ll;
typedef uint64_t ull;
#define umap unordered_map
#define uset unordered_set
using namespace std;
using namespace __gnu_pbds;

#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> P) { for(auto const &vv: P)os<<"("<<vv.first<<","<<vv.second<<")"; return os; }
template<class T> ostream& operator<<(ostream &os, set<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) { os<<"("<<P.first<<","<<P.second<<")"; return os; }
inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
inline void getch(char &x){while(x = getchar_unlocked(), x < 33){;}}
inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}
template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //s.find_by_order(), s.order_of_key() <- works like lower_bound
template<typename T> using ordered_map = tree<T, int, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 1000001

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int a,b;
    sc(a,b);
    cout << max({a+b,a-b,a*b});
}



Measured memory_bytes: 256