akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}

ll const N=(ll)2e6+11;
ll const LG=(ll)log2(N)+1;


void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
        
        
       cin>>n;
       vll a(n);
       for(i=0;i<n;i++){
               cin>>a[i];
       }
       ll ans=0;
       for(i=0;i<n;i++){
               for(j=i+1;j<n;j++){
                       for(k=j+1;k<n;k++){
                               if(a[i]!=a[j] && a[i]!=a[k] && a[j]!=a[k]){
                                       ll tt=max({a[i],a[j],a[k]});
                                       ll s=a[i]+a[j]+a[k]-tt;
                                       if(s>tt){
                                               ans++;
                                       }
                               }
                       }
               }
       }
       cout<<ans<<endl;
        
        
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        for(ll tc=1;tc<=q;tc++){
                // cout<<"Case #"<<tc<<": ";
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


Measured memory_bytes: 3576
while True:
    line = input().split()
    if line[1]=='?': break
    a, b, op = int(line[0]),int(line[2]),line[1]
    if op=='+': result = a+b
    elif op=='-': result = a-b
    elif op=='*': result = a*b
    elif op=='/': result = a//b
    print(result)

Measured memory_bytes: 7696
#include<iostream>
#include<queue>
#include<map>
#include<string>
using namespace std;
typedef pair<string,int> P;
int bfs(string);
int main(){
    string worm;
    while(cin>>worm,worm!="0"){
        int rep=bfs(worm);
        if(rep>=0)cout<<rep<<endl;
        else cout<<"NA"<<endl;
    }
    return 0;
}

int bfs(string worm){
    queue<P>Q;
    map<string,bool>M;
    Q.push(make_pair(worm,0));

    while(Q.size()){
        P p=Q.front();
        Q.pop();
        if(M[p.first])continue;
        M[p.first]=true;
        string str=p.first;
        bool flag=false;
        for(int i=0;i<str.size()-1;i++)
            if(str[i]!=str[i+1])flag=true;

        if(!flag)return p.second;

        for(int i=0;i<str.size()-1;i++){
            string next=str;
            char temp;
            if(next[i]!=next[i+1]){
                if(next[i]!='g'&&next[i+1]!='g')temp='g';
                else if(next[i]!='r'&&next[i+1]!='r')temp='r';
                else temp='b';

                next[i]=next[i+1]=temp;
                Q.push(make_pair(next,p.second+1));
            }
        }


        }

        return -1;



}

Measured memory_bytes: 3204
function Main(input){
    const num = input.split('\n')[1].split(' ').map(Number);
    let odd_count = 0;
    // 奇数のマスのみチェック
    for(let n=0; n <num.length; n+=2){
       if(num[n] % 2 == 1)
           odd_count++;
    }
    // countの数を出力
    console.log(odd_count);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

// わからなかったので解説みました…全探索
// 方針がわかっても実装できなかった…editorialみてわかるようになりたいです
// 書き終えたけど自分で書けるかといわれると書けない、、解説放送の写しただけみたいな状態
int main() {
  string s;
  cin >> s;
  string t = "ATCG";
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    int now = 0;
    for (int j = i; j < s.size(); j++) {
      bool b = false;
      for (int k = 0; k < t.size(); k++) {
        if (s.at(j) == t.at(k)) {
          b = true;
        }
      }
      if (b) {
          now++;
          ans = max(ans, now);
      }
      else {
        break;
      }
    }
  }
  cout << ans << endl;
}

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

using namespace std;
typedef long long int ll;
typedef long double ld;
#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)
#define REPR(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define FOR(i, n, m) for(ll i = (ll)n; i < (ll)(m); i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define PRINT(x) std::cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll countDigit(ll n) { return floor(log10(n) + 1); } 
typedef pair <ll,ll> P;
static const ll dx[8] = {0,1,0,-1, 1, -1, 1, -1}, dy[8] = {1,0,-1,0,1,1,-1,-1};

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) os << v[i] << " ";  
    return os; 
}

template <typename T1, typename T2> 
ostream& operator<<(ostream& os, const map<T1, T2>& m) 
{ 
    for (auto p : m) os << "<" << p.first << ", " << p.second << "> "; 
    return os; 
}



map<ll, ll> primeFactors(ll n)
{
    map<ll, ll> ret;
    while (n % 2 == 0) {
        ret[2]++;
        n = n / 2;
    }
    for (ll i = 3; i <= sqrt(n); i = i+2) {
        while (n%i == 0) {
            ret[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        ret[n]++;
    }
    return ret;
}

int main()
{
  ll N;
  cin >> N;
  auto m = primeFactors(N);
  ll ans = 0;
  for(auto p : m) {
    ll cnt = 1;
    while(p.second - cnt >= 0) {
        p.second -= cnt;
        cnt++;
        ans++;
    }
  }
  PRINT(ans);
  return 0;
} 

Measured memory_bytes: 3724
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;
typedef LL T;

// powmod p^n%mod
T powmod(T p,T n,T mod){
	T q=p%mod;
	T pow=1;
	while(n){
		if(n&1){
			pow*=q;
			pow%=mod;
		}
		q=q*q;
		q%=mod;
		n/=2;
	}
	return pow;
}

LL C[3001][3001];
LL N,M;
LL S[3001][3001];

LL G[3001];
LL f(LL k){
	LL s=0;
	/*
	for(int a=0;a<=k;a++){
		LL ss=0;
		for(int b=0;b<=a;b++){
			ss+=S[a][b]*powmod(2,(N-k)*b,M)%M;
			ss%=M;
		}
		s+=C[k][a]*ss%M;
		s%=M;
	}
	*/
	for(int b=0;b<=k;b++){
		s+=((b+1)*S[k][b+1]%M+S[k][b])%M*powmod(2,(N-k)*b,M)%M;
		s%=M;
	}
	return s;
}
int main() {
	cin >> N >> M;
	memset(G,-1,sizeof(G));
	for(int i=0;i<=3000;i++){
		C[i][0]=1;
		if(i==0){
			S[i][0]=1;
		}
		else{
			S[i][0]=0;
		}
		for(int j=1;j<=i;j++){
			C[i][j]=C[i-1][j-1]+C[i-1][j];
			C[i][j]%=M;
			S[i][j]=S[i-1][j-1]+j*S[i-1][j]%M;
			S[i][j]%=M;
		}
	}
	LL r=0;
	//cout << r << endl;
	for(LL i=0;i<=N;i++){
		LL a=f(i);
		LL e=powmod(2,N-i,M-1);
		LL d=powmod(2,e,M);
		LL s=a*d%M;
		s*=C[N][i];
		s%=M;
		if(i%2==0){
			r+=s;
			r%=M;
		}
		else{
			r+=M-s;
			r%=M;
		}
	}
	cout << r << endl;

	return 0;
}



Measured memory_bytes: 139392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

int a[1001];

void func(int X){
	int x = X;
	for(int i=2; i*i<=X; ++i){
		if(x%i!=0) continue;
		while(x%i==0){
			a[i]++;
			x /= i;
		}
	}
	if(x != 1) a[x]++;
}

int main(){
	int n;
	cin >> n;
	FOR(i,2,n+1){
		func(i);
	}
	
	const ll mod = 1000000007;
	ll ans = 1;
	FOR(i,2,n+1){
		if(a[i]==0) continue;
		ans *= a[i]+1;
		ans %= mod;
	}
	cout << ans << endl;
	
	return 0;
}

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


int main() {
    string S;
    cin >> S;
    vector<int> numbers(4);
    for (int i = 0; i < 4; i++) {
        numbers.at(i) = S.at(i) - '0';
        // cout << numbers.at(i) << "\n";
    }
    // 0 -> -, 1 -> +
    for (int bits; bits < 1 << 3; bits++) {
        int sum = numbers.at(0);
        for (int i = 0; i < 3; i++) {
            sum += ((bits >> i) & 1) ? numbers.at(i + 1) : -numbers.at(i + 1);
        }
        if (sum == 7) {
            string result;
            result.push_back(S.at(0));
            for (int i = 0; i < 3; i++) {
                char op = ((bits >> i) & 1) ? '+' : '-';
                result.push_back(op);
                result.push_back(S.at(i + 1));
            }
            result += "=7";
            cout << result << "\n";
            return 0;
        }
    }
    cout << "hoge" << "\n";
}

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

#define ll int64_t
const long MOD = 1e9 + 7;

int main()
{
  long x, y;
  long n;
  cin >> n;

  vector<long> a(n);
  map<long, long> mp;

  for (long i = 0; i < n; ++i) {
    cin >> a[i];
    // c[a[i]]++;
    mp[a[i]]++;
  }
  long ans = 0;




  for (auto itr = mp.begin(); itr != mp.end() ; ++itr) {
    if (itr->second != 0 && itr->second != itr->first) {
      if (itr->second - itr->first > 0) {
        ans += itr->second - itr->first;
      } else {
        ans += itr->second ;
      }
    }
  }


  cout << ans;

  return 0;
}

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

const int MAX = 300005;
int main() {
    vector<int> prime(MAX, 0);
    for (int i = 2; i < MAX; i++) {
        if (i % 7 == 1 || i % 7 == 6)
            prime[i] = 1;
        else
            prime[i] = 0;
    }
    for (int i = 6; i * i < MAX; i++) {
        if (prime[i]) {
            for (int j = 2 * i; j < MAX; j += i) prime[j] = 0;
        }
    }
    int n;
    while (cin >> n) {
        if (n == 1) break;
        cout << n << ":";
        for (int i = 1; i < n + 1; i++) {
            if (prime[i] && n % i == 0) cout << " " << i;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    ll a[100002];
    ll x[100002];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(i % 2) x[0] -= a[i];
        else x[0] += a[i];
    }
    cout << x[0] << " ";
    for(int i = 1; i < n; i++){
        x[i] = -x[i - 1] + a[i - 1] * 2;
        cout << x[i] << " ";
    }
}

Measured memory_bytes: 2816
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
	int N,M,x,y,s;
	int gem[21][21];
	int px,py;
	char v;
	while(1){

		cin >> N ;
		if (N == 0) break;
		for(int i=0;i<21;i++){
			for(int j=0;j<21;j++){
				gem[i][j]=0;
			}
		}
		for(int i=0;i<N;i++){
			cin >>x >>y;
			gem[x][y] = 1;
		}
		cin >> M;
		px = 10;
		py = 10;
		int gemc= N ;
		for(int j=0;j<M;j++){
			cin >> v >> s;
			if (v =='E'){
			for(int i=0;i<s;i++){
				px +=1;
				if(gem[px][py]==1){
					gem[px][py] =0;
					gemc -=1;
				}
			}
			}
			else if (v =='W'){
			for(int i=0;i<s;i++){
				px -=1;
				if(gem[px][py]==1){
					gem[px][py] =0;
					gemc -=1;
				}
			}
			}
			else if (v =='N'){
			for(int i=0;i<s;i++){
				py +=1;
				if(gem[px][py]==1){
					gem[px][py] =0;
					gemc -=1;
				}
			}
			}
			else {
			for(int i=0;i<s;i++){
				py -=1;
				if(gem[px][py]==1){
					gem[px][py] =0;
					gemc -=1;
				}
			}
			}
		}
		if(gemc!=0)cout << "No" <<endl;
		else cout << "Yes" <<endl;

	}
	return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] list = new int[n];
		double sum = 0;
		int count = 0;

		for (int i = 0; i < n; i++) {
			list[i] = sc.nextInt();
			sum += list[i];
		}

		for (int i = 0; i < n; i++) {
			if (list[i] >= sum / (4 * m)) {
				count++;
			}
		}

		if (count >= m) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();

	}
}

Measured memory_bytes: 35856
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		double max,min;
		max = min = scan.nextDouble();
		while(scan.hasNext()){
			double t = scan.nextDouble();
			if(max < t){
				max = t;
			}else if(min > t){
				min = t;
			}
		}
		System.out.println(max-min);
	}
}

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

int n,maxw;
long long w[128],v[128],dp[128][128000];

int main()
{
	ios::sync_with_stdio("false");
//	freopen(".in","r",stdin);
//	freopen(".out","r",stdout);
	
	cin>>n>>maxw;
	for(int i=1;i!=n+1;++i)
		cin>>w[i]>>v[i];
	for(int i=1;i!=n+1;++i)
		for(int j=1;j!=maxw+1;++j)
		{
			if(j>=w[i])
				dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
			else dp[i][j]=dp[i-1][j];
		}
	cout<<dp[n][maxw]<<"\n";
	
	return 0;
}


Measured memory_bytes: 101376
fun main(args: Array<String>) {
    val (N, K) = readLine()!!.split(" ").map { Integer.parseInt(it) }

    fun Int.getProbability(): Double {
        return Math.pow(
            0.5,
            Math.max(
                0.0,
                Math.ceil(
                    Math.log(K / this.toDouble())
                            / Math.log(2.0)
                )
            )
        )
    }
    print((1..N).map { it.getProbability() }.average())


}



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

string s;
int m, h, su;

int main() {
    while (true) {
        cin >> s;
        if (s == "-") break;
        cin >> m;
        for (int i=0; i<m; i++) {
            cin >> h;
            su+=h;
        }
        su = su % s.length();
        for (int i=0; i<s.length(); i++) {
            cout << s[(i+su) % s.length()];
        }
        cout << endl;
        su = 0;
    }
}


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

int main(){
    int x,y,z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))


int main(){
	ll a,b,c,x,y;
	scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&x,&y);
	ll ans=0;
	if(2*c<=a+b){
		ll d=min(x,y);
		ans+=c*2*d;
		x-=d;
		y-=d;
	}
	if(2*c<=a){
		ans+=c*2*x;
		x=0;
	}
	if(2*c<=b){
		ans+=c*2*y;
		y=0;
	}
	printf("%lld\n",ans+x*a+b*y);
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys


def solve(s: str, K: int):

    candidate = set()
    N = len(s)
    for length in range(1,K+1):
        for i in range(N):
            if i+length>N:
                break
            candidate.add(s[i:i+length])
    
    candidate = sorted(list(candidate))
    print(candidate[K-1])
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    solve(s, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4592
n, m, q = map(int, input().split())
image = [[0] * n for _ in range(n)]
for _ in range(m):
    l, r = map(int, input().split())
    image[l - 1][r - 1] += 1
sumimage = [[0] * (n + 1) for _ in range(n + 1)]
for l in range(1, n + 1):
    for r in range(1, n + 1):
        sumimage[l][r] = image[l - 1][r - 1] + sumimage[l][r - 1] + sumimage[l - 1][r] - sumimage[l - 1][r - 1]
for _ in range(q):
    a, b = map(int, input().split())
    c = sumimage[b][b] - sumimage[a - 1][b] - sumimage[b][a - 1] + sumimage[a - 1][a - 1]
    print(c)


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

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

    string D[K];
    for (int i=0; i<K; i++) {
        cin >> D[i];
    }

    bool irohaNG = true;
    while(irohaNG) {
        string str = to_string(N);
        irohaNG = false;
        for (int i=0; i<K; i++){
            if (str.find(D[i]) != string::npos) {
                irohaNG = true;
                N++;
                break;
            }
        }
    }

    cout << N << endl;
    return 0;
}


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

typedef long long ll;
#define rep(i,n) for( ll (i)=0; (i)<(n); ++(i) )
#define rpi(i,n) for( int (i)=0; (i)<(n); ++(i) )
#define rpv(d) for(auto& v:d)
#if __cplusplus < 201703L
  std::ostream& co_(){ return std::cout << std::endl; }
  std::istream& cn_(){ return std::cin; }
  template<class Head, class... Args>
  std::ostream& co_( Head&& head, Args&&... args ){ std::cout << head; return co_(std::forward<Args>(args)...); }
  template<class Head, class... Args>
  std::istream& cn_( Head&& head, Args&&... args ){ std::cin >> head; return cn_(std::forward<Args>(args)...); }
#else
  template<class... Args>
  std::ostream& co_( Args... args ){ return std::cout << ... << args << std::endl; }
  template<class... Args>
  std::istream& cn_( Args... args ){ return std::cin >> ... >> args; }
#endif
#define co(...) co_(__VA_ARGS__);
#define cn(...) cn_(__VA_ARGS__);
#define all(x) (x).begin(), (x).end()
#define rgt(x,i) (x).begin(), (x).begin()+(i)

int main(){
  ll n,a,b;cn(n,a,b)
  ll t = n/(a+b);
  co(min(n-t*(a+b),a)+t*a)
}

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

#define IOS                               \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);                      \
	cin.exceptions(cin.failbit);
#define int long long int //Comment when Unnecessary
#define ll long long
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define pii pair<int, int>
#define vi vector<int>
#define F first
#define S second
#define endl "\n" // Remove on Interactive

const int N = 300009;
const int mod = 1000000007;

void pre()
{
}

int32_t main()
{
	IOS;
	pre();
	int a, b;
	cin >> a >> b;
	int mx = (100 * 100) / 8;
	rep(i, 1, mx + 1)
	{
		if(((i*8)/100) == a)
		{
			if(((i*10)/100) == b)
			{
				cout<<i<<endl;
				return 0;
			}
		}
	}
	cout<<-1<<endl;
	return 0;
}


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

typedef long long ll;

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

  ll ans;
  if (2 * N > M) {
    ans = M / 2;
  } else {
    M -= 2 * N;
    ans = N + M / 4;
  }

  // 解答
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
/* 最大公約数 */
QWORD gcd(QWORD a, QWORD b) 
{
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

	vector<int> A;
	REP(i, N) {
		int a;
		cin >> a;
		A.emplace_back(a);
	}

	int ans = A[0];
	for (int i = 1; i < N; i++) {
		ans = gcd(ans, A[i]);
	}
	cout << ans << endl;
	return 0;
}


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

#define ll long long
#define db double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ino freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);

#define fr(i,n) for(i=0;i<n;i++)
#define frs(i,a,n) for(i=a;i<n;i++)
#define frv(i,n) for(i=n-1;i>=0;i--)

#define ne cout<<"\n";
#define cas(i) cout<<"Case #"<<i<<": "

#define vpi vector <pair <int,int> >
#define vpin(v,a,b) v.push_back(make_pair(a,b))
#define vsort(v) sort(v.begin(),v.end());

#define todegree(rad) rad*(180.0/pi)
#define isnttriangle(a,b,c) (a+b<c||a+c<b||b+c<a)
#define pi acos(-1)
#define siz 1000


int main()
{
    ll a;
    cin>>a;
    ll num=a+(a*a)+(a*a*a);
    cout<<num<<"\n";
    return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main(){fastio
    ll a,b,c;cin>>a>>b>>c;
    cout<<max(0,c-(a-b))<<endl;
    
    return 0;
}




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

int main(){
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> B(m);
  rep(i, m) cin >> B.at(i);
  vector<vector<int>> A(n, vector<int>(m));
  rep(i, n){
    rep(j, m){
      cin >> A.at(i).at(j);
    }
  }

  int ans;
  ans = 0;
  rep(i, n){
    int p = 0;
    rep(j, m){
      p += B.at(j) * A.at(i).at(j);
    }
    if (p > -1 * c) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

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

	int n;
	cin >> n;
	vi a(n);
	for (int i = 0; i < n; i++) cin >> a[i];

	vi b;
	for (int i = 1; i < n; i++)
		if (a[i] > a[i-1]) b.push_back(i);
	b.push_back(n);

	int ans = b[0];
	for (int i = 1; i < sz(b); i++) ans = max(ans, b[i] - b[i-1]);
	--ans;
	cout << ans << endl;
}


Measured memory_bytes: 1276
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define Mx 200001
#define inf 1e15
const int MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


typedef long long  L;
//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a,b,a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,q,q1,q2,q3,q4,r,s,t,
u,v,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,id4,lim;

//double rat;
L A[Mx+5],B[Mx+5];


//struct node{L nid,nv;node(L nid_,L nv_){nid=nid_;nv=nv_;}};
//vector<node>V;

void solve(){
	for(L i=1;i<=100000;i++){
		c1=i*8/100;
		c2=i/10;
		if(c1==a&&c2==b){
			printf("%lld\n",i);return;
		}
	}
	printf("-1\n");
}
int main()
{
    scanf("%lld%lld",&a,&b);
    solve();
    return 0;
}
/// lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 256
def slove(n, k):
    iter1 = iter(range(n+1))
    iter2 = iter(range(n, -1, -1))

    lower_num = 0
    upper_num = 0
    for _ in range(k):
        lower_num += iter1.__next__()
        upper_num += iter2.__next__()

    ans = len(range(lower_num, upper_num+1))

    for i in range(k, n+1):
        lower_num += iter1.__next__()
        upper_num += iter2.__next__()
        ans += len(range(lower_num, upper_num+1))

    return ans % (10**9 + 7)

if __name__ == "__main__":
    n, k  = [int(i) for i in input().split()]
    print(slove(n, k))

Measured memory_bytes: 9220
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
//constexpr int inf = 3e18;

int N;
vector<int>G[100005];
int dist[100005];
void dfs1(int x,int p){
	for(int i:G[x])if(i!=p){
		dist[i]=dist[x]+1;
		dfs1(i,x);
	}
}
int dfs2(int x,int p){
	int res=0,mn=N;
	for(int i:G[x])if(i!=p){
		int j=dfs2(i,x);
		res+=max(1,j);chmin(mn,j);
	}
	if(mn==0)res--;
	return res;
}
signed main(){
	cin>>N;
	rep(i,N-1){
		int a,b;cin>>a>>b;
		G[a].pb(b);G[b].pb(a);
	}
	dfs1(0,0);
	int par,mx=0;
	rep(i,N)if(chmax(mx,dist[i]))par=i;
	cout<<dfs2(par,par)+1<<endl;
}


Measured memory_bytes: 15536
import java.util.Scanner;

public class Main {
    public static int MAX = 200000;
    public static void main(String[] args) {
        int[] R = new int[MAX];
        int n;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for (int i = 0;i < n;i++) {
            R[i] = sc.nextInt();
        }
        int minv = R[0];
        int maxv = -2000000000;
        for(int j = 1;j < n;j++){
            maxv = Math.max(maxv,R[j] - minv);
            minv = Math.min(minv,R[j]);
        }
        System.out.println(maxv);
    }
}



Measured memory_bytes: 101336
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define LL_MAX LLONG_MAX
#define ULL_MAX ULLONG_MAX
#define ull unsigned long long
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define sort(a) sort(a.begin(),a.end())
#define pii pair<int,int>
#define sz(x) int(x.size())
#define mk make_pair
#define endl '\n'

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

    map<int,int> mp;

    ll sum=0;
    for (int i = 0; i < n; i++)
    {
        int temp;
        cin>>temp;
        sum+=temp;
        mp[temp]++;
    }
    
    int q;
    cin>>q;

    while(q--)
    {
        int b,c;
        cin>>b>>c;
        sum+=(c-b)*mp[b];
        mp[c]+=mp[b];
        mp[b]=0;
        cout<<sum<<endl;
    }

}

Measured memory_bytes: 8032
import java.util.Scanner;
 
public class Main {
 
	public static void main(String args[]) {
 
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
 
		int l = s.length();
		for(int i=l-2;i>1;i-=2) {
			String a = s.substring(0, i/2);
			String b = s.substring(i/2, i);
			if(a.equals(b)) {
				System.out.println(i);
				return;
			}
		}
	}
 
}

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

int main() {
    ll n;
    std::cin >> n;
    map<char,ll> val;
    for (int i = 'A'; i <= 'C'; i++) {
        std::cin >> val[i];
    }
    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        std::cin >> s[i];
    }
    vector<char> ans;
    for (int i = 0; i < n; i++) {
        char c1 = s[i][0];
        char c2 = s[i][1];
        char cL = ((val[c1]>=val[c2]) ? c1 : c2 );
        char cS = c1^c2^cL;
        if(val[cL]==0){
            std::cout << "No" << std::endl;
            return 0;
        }
        if(val[cL]==1&&val[cS]==1&&i+1<n&&(s[i+1][0]==cL||s[i+1][1]==cL))swap(cL,cS);
        ans.push_back(cS);
        val[cL]--;
        val[cS]++;
        // std::cout << val['A']<<" "<<val['B']<<" "<<val['C'] << std::endl;
    }
    std::cout << "Yes" << std::endl;
    for (auto e : ans) {
        std::cout << e << std::endl;
    }
}

Measured memory_bytes: 6720
LARGE = 10 ** 9 + 7


def solve(n, a_list):

    # inverse
    res = 0
    for i in range(n):
        res += pow(a_list[i], LARGE - 2, LARGE)
        res %= LARGE

    # primes
    p_candidate_list = [1] * 10 ** 3
    p_candidate_list[0] = 0
    p_candidate_list[1] = 0
    for p in range(2, 10 ** 3):
        if p_candidate_list[p]:
            for q in range(p * p, 10 ** 3, p):
                p_candidate_list[q] = 0
    primes_1000 = [p for p in range(1000) if p_candidate_list[p]]

    lcm = 1
    for p in primes_1000:
        r_max = 0
        for i in range(n):
            r = 0
            while a_list[i] % p == 0:
                r += 1
                a_list[i] = a_list[i] // p
            r_max = max(r_max, r)
        lcm *= pow(int(p), r_max, LARGE)
        lcm %= LARGE

    for q in set(a_list):
        lcm *= q
        lcm %= LARGE

    return res * lcm % LARGE


def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    res = solve(n, a_list)
    print(res)


def test():
    assert solve(3, [2, 3, 4]) == 13
    assert solve(5, [12, 12, 12, 12, 12]) == 5
    assert solve(3, [1000000, 999999, 999998]) == 996989508


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 44380
#include<bits/stdc++.h>
using namespace std ; 
#define pb push_back 
int main()
{
	int n ; 
  cin>>n ; 
  vector<int > v(n) ; 
  for(int i =0 ;i<n;i++)
  {
    cin>>v[i] ; 
  }
  long long ans = 0 ; 
  for(int i =0 ;i<n-1;i++)
  {
    for(int j =i+1 ; j<n;j++)
      ans += v[i]*v[j] ; 
  }
  cout <<ans ; 
  
  
}

Measured memory_bytes: 256
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
  int N,D,X;
  cin>>N>>D>>X;
  vector<int>A(N);
  for(int i=0;i<N;i++)cin>>A[i];

  int ans=X;
  for(int i=0;i<N;i++){
      int B=(D-1)/A[i]+1;
      ans+=B;
  }

  cout<<ans<<endl;

}


Measured memory_bytes: 256
package main

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

const INFINITY = math.MaxInt64/2 - 1

func exec(stdin *Stdin, stdout *Stdout) {
	n := stdin.ReadInt()
	m := stdin.ReadInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = stdin.ReadInt()
	}

	sum := 0
	for _, v := range a {
		sum += v
	}

	c := 0
	for i := 0; i < n; i++ {
		if sum <= 4*m*a[i] {
			c++
		}
	}

	if m <= c {
		stdout.Println("Yes")
	} else {
		stdout.Println("No")
	}
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), INFINITY)
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Min(a int, b ...int) int {
	for _, v := range b {
		if v < a {
			a = v
		}
	}
	return a
}

func Max(a int, b ...int) int {
	for _, v := range b {
		if a < v {
			a = v
		}
	}
	return a
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}

func Pow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x *= x
			y /= 2
		} else {
			z *= x
			y -= 1
		}
	}
	return z
}

func CreateMatrix(x, y int) [][]int {
	matrix := make([][]int, x)
	for i := 0; i < x; i++ {
		matrix[i] = make([]int, y)
	}
	return matrix
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	std::string str;
	int okasi[100];
	int n = 0,x=0,min=0,sum=0;
	std::cin >> n >> x;
	for(int i = 0; i < n; i++) {
		std::cin >> okasi[i];
		sum += okasi[i];
	}
	min = okasi[0];
	for (int i = 0; i < n; i++) {
		if (okasi[i] < min) {
			min = okasi[i];
		}
	}
	std::cout << n+ (x-sum)/ min << endl;

}

Measured memory_bytes: 256
N = int(input())
all_sum = int(N / 2 * (N + 1))
i = 1
while i <= N:
	if i % 3 == 0 and i % 5 == 0:
		all_sum -= i
	elif i % 3 == 0:
		all_sum -= i
	elif i % 5 == 0:
		all_sum -= i
	i += 1
print(all_sum)

Measured memory_bytes: 9180
n = int(input())
s = list(input())
left=s[:n]
right=s[n:]
right.reverse()

from itertools import *
from collections import defaultdict
d = defaultdict(int)

for pro in product([0,1], repeat=n):
    s1=s2=""
    for i,p in enumerate(pro):
        if p==0:
            s1+=left[i]
        else:
            s2+=left[i]
    d[(s1,s2)]+=1

ans=0
for pro in product([0,1], repeat=n):
    s1=s2=""
    for i,p in enumerate(pro):
        if p==0:
            s1+=right[i]
        else:
            s2+=right[i]
    ans+=d[(s1,s2)]
print(ans)

Measured memory_bytes: 237512
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <iomanip> // setprecision
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    int N;
    cin >> N;
    vll data(N);
    ll sum = 0;
    for (int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        sum += a;
        data[i] = a;
    }
    ll suma = data[0];
    ll ans = max(sum - data[0], data[0]) - min(sum - data[0], data[0]);
    for (int i = 1; i < N - 1; i++) {
        suma += data[i];
        ll dist = max(suma, sum - suma) - min(suma, sum - suma);
        if (ans > dist) {
            ans = dist;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4844
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <unordered_map>
using namespace std;

int N, K;
vector<int> plan;
vector<vector<vector<int > > > dp;

int solve(int day, int today, int tommorow) {
	if (dp[day][today][tommorow] != -1) return dp[day][today][tommorow];
	if (day == N - 2)return 1;
	int tmp = 0;
	dp[day][today][tommorow] = 0;
	for (int i = 0; i < 3; i++) {
		if ((plan[day + 2] != -1 && plan[day + 2] != i) || (today == tommorow && tommorow == i))continue;
		dp[day][today][tommorow] += solve(day + 1, tommorow, i);
	}
	if (dp[day][today][tommorow] > 10000)dp[day][today][tommorow] %= 10000;
	return dp[day][today][tommorow];
}

int main() {
	cin >> N >> K;
	plan = vector<int>(N+2, -1);
	for (int i = 0; i < K; i++) {
		int a, b;
		cin >> a >> b;
		plan[a - 1] = b - 1;
	}
	dp = vector<vector<vector<int > > >(N+2, vector<vector<int> >(3, vector<int>(3, -1)));

	int ans = 0;
	for (int i = 0; i < 3; i++){
		if (plan[0] != -1 && plan[0] != i)continue;
		for (int j = 0; j < 3; j++) {
			if (plan[1] != -1 && plan[1] != j)continue;
			ans += solve(0, i, j);
		}
	}

	if (ans > 10000)ans %= 10000;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3180
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
using namespace std;

int main() {
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'o') cnt++;
    }

    if (cnt + 15 - s.size() >= 8) cout << "YES" << endl;
    else  cout << "NO" << endl;
    return 0;
}

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


int main(void) {
    int a, b, k;
    cin >> a >> b >> k;
    rep(i, b-a+1){
        if(i < k || i > b - a - k)cout << a + i << endl;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <stdio.h>
using namespace std;
using ll = long long;

#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define RBF(i, n) for(auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()

int main() {
  int N;
  IN(N);
  vector<int> X(N);
  REP(i, N) IN(X[i]);
  sort(ALL(X));
  double ans = X[0];
  REP(i, N-1) ans = (X[i+1]+ans)/2;
  OUT(ans);
}	

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e5+10;
int f[MAXN];  
int d[MAXN]; 

void init(int N)
{    
    for(int n = 0; n <N; n++){ 
		f[n]=n;       
    }   
}    

int find(int x)  
{  
    if(f[x]==x)  return x;
    else{
		int r=find(f[x]);  
    	d[x]=d[f[x]]+d[x]; 
    	return f[x]=r;
	}
}  
  
  
int union_nodes(int x,int y,int z)  
{  
    int fx=find(x);  
    int fy=find(y);  
    if(fx==fy)  return z==d[y]-d[x];
    else{
    	f[fy]=fx;  
    	d[fy]=d[x]+z-d[y];  
    	return 1;  
	}
}  
  
  
int main()  
{  
    int N,M;  
    int flag=1;  
    scanf("%d %d",&N,&M);  
   	init(N);
   	
    for(int m=0;m<M;m++){  
        int x,y,z;  
        scanf("%d %d %d",&x,&y,&z); 
    	if(flag!=0){ flag=union_nodes(x,y,z);}
    }  
  
    if(flag)  printf("Yes\n"); 
    else  printf("No\n");
    
	return 0;  
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define ll long long
  #define int long long
  #define double long double
  #define max(a,b) (a>b?a:b)
  #define min(a,b) (a<b?a:b)
  #define mp make_pair
  #define pb push_back
  #define inf INT_MAX
  #define f first
  #define s second
  #define all(v) v.begin(), v.end()
  #define mod INT_MAX 
  const int MOD=1e9+7;
  const int N=2e5+2;
 
  
int32_t main(){
    /*#ifndef ONLINE_JUDGE
       freopen("in.txt","r",stdin);
       freopen("out.txt","w",stdout);
    #endif*/
       IOS
       int h1,h2,m1,m2,k;
       cin>>h1>>m1>>h2>>m2>>k;
       int tot=(h2-h1)*60 + (m2-m1);
       cout<<tot-k;
    return 0;
 }


Measured memory_bytes: 3640
#include <cstdio>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <utility>
#include <list>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <numeric>
#include <functional>
#include <ctime>
#include <bitset>
#include <map>
#include <set>

using namespace std;

typedef long long ll;
typedef long long LL;
typedef unsigned long long ull;
typedef unsigned long long ULL;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<ll> VLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pii PII;

#define endl "\n"

#ifdef WIN32
#define debug(x) cerr << #x << " : " << x << "\n"
#else
#define debug(x)
#endif

struct DisjointSet {
	vector<int> rank, p;

	DisjointSet(){}

	DisjointSet(int size) {
		rank.resize(size, 0);
		p.resize(size, 0);
		for (int i = 0; i < size; i++){
			makeSet(i);
		}
	}

	void makeSet(int x) {
		p[x] = x;
		rank[x] = 0;
	}

	bool same(int x, int y){
		return findSet(x) == findSet(y);
	}

	void unite(int x, int y){
		link(findSet(x), findSet(y));
	}

	void link(int x, int y){
		if (rank[x] > rank[y]) {
			p[y] = x;
		}
		else{
			p[x] = y;
			if (rank[x] == rank[y]){
				rank[y]++;
			}
		}
	}

	int findSet(int x){
		if (x != p[x]){
			p[x] = findSet(p[x]);
		}
		return p[x];
	}
};



int main(){
	int n, a, b, q;
	int t;

	cin >> n >> q;
	DisjointSet ds = DisjointSet(n);
	for (int i = 0; i < q; i++){
		cin >> t >> a >> b;
		if (t == 0) ds.unite(a, b);
		else if (t == 1){
			if (ds.same(a, b)) cout << 1 << "\n";
			else cout << 0 << "\n";
		}
	}
}

Measured memory_bytes: 1284
from itertools import accumulate

def time_to_seconds(time):
    h, m, s = time.split(':')
    return int(h) * 3600 + int(m) * 60 + int(s)

ans = []
while(1):
    N = int(input())
    if N==0:
        break
    A = []
    for n in range(N):
        begin, end = input().split()
        begin = time_to_seconds(begin)
        end = time_to_seconds(end)
        A.append((begin,1))
        A.append((end,-1))
    A.sort()
    mx = 0
    cumsum = 0
    for _, x in A:
        cumsum += x
        mx = max(mx, cumsum)
    ans.append(mx)

for a in ans:
    print(a)


Measured memory_bytes: 7780
#include <iostream>
#include <algorithm>
using namespace std;
int N,A,B,C[3],P;
int main(){
  cin>>N>>A>>B;
  for(int i=0;i<N;i++){
    cin>>P;
    if(P<=A){C[0]++;}
    else if(P<=B){C[1]++;}
    else{C[2]++;}
  }
  cout<<min(C[0],min(C[1],C[2]))<<endl;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
lis = list(map(int, input().split()))

su = [0] * (n + 1)

for i in range(n):
    su[i + 1] = su[i] + ((lis[i] + 1) / 2)

res = 0
for j in range(n - k + 1):
    res = max(res, su[j + k] - su[j])   
print(res)


Measured memory_bytes: 25060
#include <bits/stdc++.h>
#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)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

int A,B,C;
cin >> A >> B >> C;
map<int,int> mp;
mp[A]++;
mp[B]++;
mp[C]++;
if(mp[5] == 2 && mp[7] == 1) cout << "YES" << endl;
else cout << "NO" << endl;

return 0;
}

Measured memory_bytes: 256
import math
import bisect

N = int(input())

A = sorted([int(n) for n in input().split()])

mINF = -1e18
INF = 1e18

mx = A[-1]
A = [mINF] + A[:-1] + [INF]
idx = bisect.bisect_left(A, (mx+1) // 2)

ans = A[idx] if A[idx] - (mx+1) // 2 < (mx+1) // 2 - A[idx-1] else A[idx - 1]

print(mx, ans)


Measured memory_bytes: 14428
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;

typedef long long ll;

const ll INF = (ll) 1e18;

ll a[100005], mx[100005];

int main()
{
 	//freopen("input.txt", "r", stdin);
 	//freopen("output.txt", "w", stdout);
 	ios_base::sync_with_stdio(0); cin.tie(0);
 	int n;
 	cin >> n;
 	for (int i = 0; i <= n; i++) cin >> a[i];
 	
 	ll kol = 1;
 	for (int i = 0; i <= n; i++)
 	{
 	 	mx[i] = kol;
 	 	if (kol <= INF) kol = 2 * (kol - a[i]);
 	}
 	kol = 0;
 	for (int i = n; i >= 0; i--)
 	{
 	 	kol += a[i];
 	 	mx[i] = min(mx[i], kol);
 	}
 	for (int i = 0; i <= n; i++) if (mx[i] < a[i]) cout << "-1\n", exit(0);
 	ll sum = 0;
 	for (int i = 0; i <= n; i++) sum += mx[i];
 	cout << sum << '\n';
 	return 0;
}

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

long inv(int a, int m) {
    long i = 1, j = 0;
    for(int b = m; a > 1; swap(i, j), swap(a, b)) {
        j = (j + b / a * (m - i)) % m;
        b %= a;
    }
    return i;
}
int main() {
    int n, p = 1e9 + 7;
    cin >> n;
    map<int, int> f;
    long x = 0;
    for(int j = 0; j < n; j++) {
        int m;
        cin >> m;
        (x += inv(m, p)) %= p;
        for(int i = 2; i * i <= m; i++) {
            if(m % i)
                continue;
            int c = 0;
            while(m % i == 0)
                m /= i, c++;
            f[i] = max(f[i], c);
        }
        if(m > 1)
            f[m] = max(f[m], 1);
    }
    for(auto i : f)
        for(int j = 0; j < i.second; j++)
            (x *= i.first) %= p;
    cout << x << endl;
    return 0;
}


Measured memory_bytes: 768