akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
// using namespace __gnu_pbds;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;
 
#define un(x)           x.erase(unique(all(x)), x.end())
#define xx              first
#define yy              second
#define pb              push_back
#define all(v)          v.begin(),v.end()
 
#define D(x)            cerr << #x " = " << x << '\n'
#define DBG             cerr << "Hi!" << '\n'
 
#define CLR(a)          memset(a,0,sizeof(a))
#define SET(a)          memset(a,-1,sizeof(a))
 
// inline int setBit(int n,int pos) { return n = n | (1 << pos); }
// inline int resetBit(int n,int pos) { return n = n & ~(1 << pos); }
// inline bool checkBit(int n,int pos) { return (bool)(n & (1 << pos)); }
 
// int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
// int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1};
 
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// unsigned int num = rng();
// shuffle(V.begin(), V.end(), rng);
 
/******************************************************************************************/
 
//const int MAX = 500010;
//const int INF = 0x3f3f3f3f;
//const int MOD = 1000000007;
 
 
//inline int add(int a, int b) { return a + b >= MOD ? a + b - MOD : a + b; }
//inline int sub(int a, int b) { return a - b < 0 ? a - b + MOD : a - b; }
//inline int mul(int a, int b) { return (a * 1LL * b) % MOD; }
 
 
int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
 
	string s;
	cin >> s;
	if(s[0] != s[1] and s[2] == s[3] and s[4] == s[5]) cout << "Yes\n";
	else cout << "No\n";
    return 0;
}

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

using namespace std;

int line[] = {0,1,2,3,4,5,6,7,8,9,5,4,3,2,1};

int main()
{
    int a,b,n,p1,p2,d1,d2;
    bool flag;
    cin >> n;
    while(n--) {
        cin >> a >> b;
        flag = true;
        for(int i = 0; flag && i < 15; i++) {
            if(line[i] == a) {
                p1 = i;
                d1 = 0;
                for(int j = p1;; j++, d1++)
                    if(line[j % 15] == b) {
                        flag = false;
                        break;
                    }
            }
        }
        
        flag = true;
        for(int i = p1 + 1; flag; i++) {
            if(line[i % 15] == a) {
                p2 = i % 15;
                if(p2 == p1) {
                    d2 = d1;
                    break;
                } else {
                    d2 = 0;
                    for(int j = p2;; j++, d2++) 
                        if(line[j % 15] == b)  {
                            flag = false;
                            break;
                        }
                }
            }
        }
        if(d1 <= d2) {
            for(int i = 0; i <= d1; i++) {
                if(i == d1) {
                    cout << line[(i + p1) % 15] << endl;
                } else {
                    cout << line[(i + p1) % 15] << " ";
                }
            }
        } else {
            for(int i = 0; i <= d2; i++) {
                if(i == d2) {
                    cout << line[(i + p2) % 15] << endl;
                } else {
                    cout << line[(i + p2) % 15] << " ";
                }
            }

        }
    }
}

Measured memory_bytes: 0
def insertionSort(n, a)
  n.times do |i|
    v, j = a[i], i - 1
    while j >= 0 && a[j] > v
      a[j + 1] = a[j]
      j -= 1
    end
    a[j + 1] = v
    puts a.join(' ')
  end
end
insertionSort(gets.to_i, gets.split.map(&:to_i))

Measured memory_bytes: 8744
#include<bits/stdc++.h>
using namespace std;
bool f(int x){
  int i;
  if(x%2==0&&x/2>1) return false;
  for(i=3;i*i<=x;i+=2) if(x%i==0&&x/i>1) return false;
  return true;
}
int main(){
  int q,l,r,i;
  vector<int> v;
  for(i=3;i<1e5;i+=2) if(f(i)&&f((i+1)/2)) v.push_back(i);
  cin>>q;
  for(i=0;i<q;i++){
    cin>>l>>r;
    cout<<distance(lower_bound(v.begin(),v.end(),l),upper_bound(v.begin(),v.end(),r))<<endl;
  }
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
const long long mod=2019;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long long l,r;
	cin>>l>>r;
	long long ans=(l*r)%mod;
	r=min(mod*2,r-l);
	l%=mod;
	int i,j;
	for(i=l;i<=l+r;i++)
		for(j=l;j<i;j++)
			ans=min(ans,(i*j)%mod);
	cout<<ans<<'\n';
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
long long ans=0;
const int N=200010;
long long a[N],b[N];
void solve(int l,int r){
    if(l>=r) return;
    int M=l+r>>1,i=l,j=M+1,k=l-1;
    solve(l,M);
    solve(M+1,r);
    while(i<=M&&j<=r){
        if(a[i]<=a[j]) b[++k]=a[i++];
        else b[++k]=a[j++],ans+=i-l;
    }
    while(i<=M) b[++k]=a[i++];
    while(j<=r) b[++k]=a[j++],ans+=i-l;
    for(i=l;i<=r;i++) a[i]=b[i];
}
int main(){
    int n,k,i;
    scanf("%d %d",&n,&k);
    for(i=1;i<=n;i++)
        scanf("%d",&a[i]),a[i]-=k,a[i]+=a[i-1];
    a[0]=0;
    solve(0,n);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>

int main(void) 
{
	int year, month, day;
	
	while (scanf("%d %d %d", &year, &month, &day) != EOF) {
		if (year >= 1990 || (year >= 1989 && month >= 1 && day >= 8) || (year >= 1989 && month >= 2)) {
			printf("heisei %d %d %d\n", year - 1989 + 1, month, day);
		} else if (year >= 1927 || (year >= 1926 && month >= 12 && day >= 25)) {
			printf("showa %d %d %d\n", year - 1926 + 1, month, day);
		} else if (year >= 1913 || (year >= 1912 && month >= 7 && day >= 30) ||  (year >= 1912 && month >= 8)) {
			printf("taisho %d %d %d\n", year - 1912 + 1, month, day);
		} else if (year >= 1869 || (year >= 1868 && month >= 9 && day >= 8) || (year >= 1868 && month >= 10)) {
			printf("meiji %d %d %d\n", year - 1868 + 1, month, day);
		} else {
			printf("pre-meiji\n");
		}
	}
	return 0;
}

Measured memory_bytes: 604
def m():
    N, P = map(int, input().split())
    A = list(map(int, input().split()))
    Even = [a for a in A if a % 2 == 0]
    Odd = [a for a in A if a % 2 == 1]
    if P == 1 and len(Odd) == 0:
        return 0

    if len(Odd) == 0:
        return pow(2, len(Even))
    else:
        return pow(2, N-1)


print(m())


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

int main(int argc, char* args[]) {
  using std::string;
  string str;
  std::cin >> str;
  
  string year = string(str.begin(), str.begin() + 4);
  string month = string(str.begin()+5, str.begin() + 7);
  string day = string(str.begin()+8, str.end());

  string ymd_str = year + month + day;
  int ymd = atoi(ymd_str.c_str());

  if (ymd <= 20190430) {
    std::cout << "Heisei";
  } else {
    std::cout << "TBD";
  }
  return 0;
}

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

int main(){
	int N, A;
	cin >> N >> A;
	bool canPay;
	int amari = N % 500;
	if (amari > A){
		canPay = false;
	}
	else{
		canPay = true;
	}

	if (canPay){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 50 + 5;
ll arr[maxn];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n; string s;
    cin >> n >> s;
    cout << unique(s.begin(), s.end()) - s.begin() << '\n';
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int X = sc.nextInt();
		int[] L = new int[N];
		for(int i=0;i<N;i++) {
			L[i] = sc.nextInt();
		}
		
		int sum = 0;
		int count = 1;
		
		for(int i=0; i<N; i++) {
			sum += L[i];
			if(sum>X) {break;}
			count++;
		}
		
		System.out.println(count);
		
		sc.close();
		
	}

}

Measured memory_bytes: 23764
N, M = map(int, input().split())
A = set([int(input()) for _ in range(M)])

mod = 1000000007

dp = [0] * (N + 2)
dp[N] = 1  # GOAL

for i in range(N-1, -1, -1):
  if i not in A:
    dp[i] = dp[i+1] + dp[i+2]

print(dp[0] % mod)


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

using namespace std;

#define pb push_back
#define ll long long
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define bug cout << "ok" << endl

const ll INF = 1e9 + 5, N = 1e6 + 5, mod = 1e9 + 7, M = 1e5 + 5;

ll d[N + 5];

ll pairwise[N + 5], a[N + 5];

int main(){
	for(int i = 2; i <= N; i++){
		if(!d[i]){
			d[i] = i;
				if(i * 1ll * i <= N){
				for(int j = i * i; j <= N; j += i){
					if(d[j] > 0) continue;
					d[j] = i;
				}
			}
		}
	}
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		int x = a[i];
		while(x > 1){
			pairwise[d[x]]++;
			int l = d[x];
			do{
				x /= l;
			} while(x % l == 0);
		}
		if(x > 1) pairwise[x]++;
	}
	bool q1 = true, q2 = true;
	for(int i = 1; i <= N; i++){
		if(pairwise[i] > 1) q1 = false;
		if(pairwise[i] == n) q2 = false;
	}
	if(q1){
		cout << "pairwise coprime" << endl;
		return 0;
	}
	if(q2){
		cout << "setwise coprime" << endl;
		return 0;
	}
	cout << "not coprime" << endl;
}

Measured memory_bytes: 27028
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <unordered_set>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> P;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.begin(), v.end(), greater<int>);
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
int gcd(int a, int b) { int c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
int lcm(int a, int b) { int c = gcd(a, b); a /= c; return a*b; }
int nCr(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
int pow(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llpow(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llgcd(long long a, long long b) { long long c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
long long lllcm(long long a, long long b) { long long c = llgcd(a, b); a /= c; return a*b; }
long long llnCr(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge{
    int to, cost;
};

int main(){
    int a, b;
    cin >> a >> b;
    if((a * b) % 2) cout << "Odd" << endl;
    else cout << "Even" << endl;
    return 0;
}


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

int main() {
    int n;
    int m;
    int ans;
  
 
   cin >> n >> m;
   
   ans = n - m;
  
   if (ans < 0){
      
     ans = 0;
     
   }
   
   cout << ans << endl;
  
  
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  string ans = "Good";
  for (int i = 0; i < 3; i++) {
    if (s[i] == s[i+1]) {
      ans = "Bad";
      break;
    } 
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int64_t N;
  cin >> N;
  std::vector<int64_t> A(N);
  multiset<int64_t> sets;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    sets.insert(A[i]);
  }

  int64_t max = 10e6 + 1;
  vector<int64_t> nums(max, 0);

  for (int i = 0; i < N; i++) {
    int64_t hit = A[i];

    if (nums[hit] >= 1) {
      nums[hit] += 1;
      continue;
    }
    while (hit < max) {
      nums[hit] += 1;
      hit += A[i];
    }
  }

  int64_t ans = 0;
  for (int i = 0; i < N; i++) {
    if (nums[A[i]] == 1) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 92144
#define NDEBUG
NDEBUG


#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>


using namespace std;


#define FOR(i, n) for (int i = 0; i < (n); ++i)


// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END


// Section with adoption of array and vector algorithms.


//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;


namespace template_util {
    

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {
        
    };

    
    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}


template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}


void solve(istream& in, ostream& out) {
  auto s = next<string>(in);
  auto t = next<string>(in);
  int res = 0;
  FOR(i, s.length()) {
    if (s[i] != t[i]) {
      ++res;
    }
  }
  out << res << "\n";
}

//#include <fstream>


int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}



Measured memory_bytes: 3804
#!/usr/bin/python3

n = int(input())

num = {}
for i in range(n):
    a = input()
    if a in num:
        num[a] += 1
    else:
        num[a] = 1

t = 0
for i in num.keys():
    if num[i] % 2:
        t += 1

print(t)

Measured memory_bytes: 17880
#include<stdio.h>
int main()
{
    char s;
    int i,sum=0,sum2=0;
    for(i=0;i<4;i++)
    {
        scanf("%c",&s);
        if(s=='+')
            sum=sum+1;
        else
            sum2=sum2-1;
    }

    printf("%d\n",sum+sum2);
}


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

using namespace std;
typedef long long LL;

#define LOG(...) fprintf (stderr, __VA_ARGS__)
#define pb push_back
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()

const int INF = 0x3f3f3f3f, N = 100005;
const LL INFL = 0x3f3f3f3f3f3f3f3fll;

int n, sz[N], dep[N];
pair <LL, int> d[N];
bool cmp(pair <LL, int> a, pair <LL, int> b) { return a.first > b.first; }
map <int, int> mp;
vector <int> g[N];
void link(int x, int y){
    g[x].push_back(y);
//    g[y].push_back(x); 
}

void dfs(int u, int pre) {
    for (int i = 0; i < g[u].size(); i++) {
        int v = g[u][i];
        if (v == pre) continue;
        dep[v] = dep[u] + 1;
        dfs(v, u);
    }
}

int main() { 
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%lld", &d[i].first), d[i].second = i, mp[d[i].first] = i; 

    sort (d + 1, d + n + 1, cmp);
    int root = d[n].second;
    for (int i = 1; i <= n; i++) sz[i] = 1; 
    for (int i = 1; i < n; i++) {
        LL fa = d[i].first - n + 2 * sz[d[i].second];
        if (mp[fa]) {
            int ff = mp[fa];
            if (ff == d[i].second) return 0*puts("-1");
            sz[ff] += sz[d[i].second]; link(ff, d[i].second); 
        }
        else return 0*puts("-1");
    }

    dfs (root, 0); 

    if (accumulate(dep + 1, dep + n + 1, 0LL) != d[n].first)
        return puts("-1"), 0; 
    for(int i = 1; i <= n; i++)
        for (int j = 0; j < g[i].size(); j++)
            cout << i << " " << g[i][j] << endl; 
    return 0;
}

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

int main()
{
    int N, H;
    cin >> N >> H;
    int Ai;
    int maxA = 0;
    vector<int> B(N);
    for(int i=0;i<N;i++){
        cin >> Ai >> B[i];
        maxA = max(maxA, Ai);
    }
    sort(B.begin(), B.end(), greater<int>());
    int res = numeric_limits<int>::max();
    int sumB = 0;
    for(int i=0; i<=N; i++){
        auto c = (H - sumB + maxA - 1) / maxA + i;
        res = min(res, c);
        if(i==N) break;
        sumB += B[i];
        if(sumB > H) sumB = H;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 640
import random
d = int(input())
c = list(map(int, input().split()))
s = []
for i in range(d):
    temp = list(map(int, input().split()))
    s.append(temp)
for i in range(d):
    get = random.uniform(1, 27)
    if get == 27:
        get = 26
    print(int(get))

Measured memory_bytes: 78048
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007;
#define INF (1<<28)
#define int long long
#define double long double
#define floot10 cout<<fixed<<setprecision(10)
#define G 1

signed main(){
  string s;
  cin>>s;
  bool stat=true;
  while(stat){
    stat=false;
    lp(i,s.size()){
      if(i==0) continue;
      if(s[i]==')'&&s[i-1]=='('){
	stat=true;
	s.erase(i-1,2);
      }
    }
  }
  //cout<<s<<endl;
  int mode=0;
  int cnt=0,cnt2=0;
  lp(i,s.size()){
    if(s[i]=='*') mode=1;
    else if(s[i]=='('&&mode==0) cnt++;
    else if(s[i]==')'&&mode==1) cnt2++;
  }
  cout<<min(cnt,cnt2)<<endl;
  return 0;
}



Measured memory_bytes: 3176
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int N,X,cnt=0;
    cin >> N;
    vector<int>S(N);
    
    for(int i=0; i<N; i++){
        cin >> S[i];
    }
    
    sort(S.begin(),S.end());
    X = S[0];
    
    for(int i=1; i<N; i++){
        if(X != S[i]){
            cnt++;
            X = S[i];
        }
    }
    
    cout << cnt+1 << endl;
    return 0;

}


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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(12);
    }
} fast;

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) (x).erase(unique(all(x)), (x).end())
#define int long long
#define MAX 1e9 + 7

/* function */
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

/* main */
signed main(void)
{
    string s;
    cin >> s;
    string sy;
    int iy;
    sy = s.substr(0, 4);
    iy = stoi(sy);
    string sm;
    int im;
    sm = s.substr(5, 2);
    im = stoi(sm);
    string sd;
    int id;
    sd = s.substr(8, 2);
    id = stoi(sd);
    string ans = sy + sm + sd;
    int ians = stoi(ans);
    if (ians > 20190430)
    {
        cout << "TBD" << endl;
    }
    else
    {
        cout << "Heisei" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# abc141/abc141_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    S=i2s()
    d={'Sunny': 'Cloudy', 'Cloudy': 'Rainy', 'Rainy': 'Sunny'}
    print(d[S])
    return

main()


Measured memory_bytes: 3064
using DataStructures
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

GGG(x,y,z) = x^2 + y^2 + z^2 + x*y + y*z + z*x

function main()
  N = readint()[1]

  s = Vector{int}(undef,N)
  s .= 0
  for x in 1:100 
    for y in 1:100
      for z in 1:100
        if GGG(x,y,z) > N 
          break
        end
        s[GGG(x,y,z)]+=1
      end
    end
  end

  for i in 1:N
    println(s[i])
  end
  

end

main()

Measured memory_bytes: 192236
//In the name of Allah :)
#include <bits/stdc++.h>
using namespace std;
string to_string(char c) { return string(1,c); }
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(const char* s) { return (string)s; }
string to_string(string s) { return s; }
template<class A> string to_string(complex<A> c) { 
	stringstream ss; ss << c; return ss.str(); }
string to_string(vector<bool> v) { 
	string res = "{"; for(int i = 0; i < (int)v.size(); i++) res += char('0'+v[i]);
	res += "}"; return res; }
template<size_t SZ> string to_string(bitset<SZ> b) {
	string res = ""; for(size_t i = 0; i < SZ; i++) res += char('0'+b[i]);
	return res; }
template<class A, class B> string to_string(pair<A,B> p);
template<class T> string to_string(T v) { // containers with begin(), end()
	bool fst = 1; string res = "{";
	for (const auto& x: v) {
		if (!fst) res += ", ";
		fst = 0; res += to_string(x);
	}
	res += "}"; return res;
}
template<class A, class B> string to_string(pair<A,B> p) {
	return "("+to_string(p.first)+", "+to_string(p.second)+")"; }
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
	cerr << to_string(h); if (sizeof...(t)) cerr << ", ";
	DBG(t...); }
#ifdef LOCAL // compile with -DLOCAL
#define wis(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__)
#else
#define wis(...) 0
#endif
typedef long long ll;
const int MOD = 1e9 + 7, INF = 1e9 + 5;
const ll LONG_INF = 1e18 + 10;
inline ll powmod(ll a, ll b){ll res=1;for(;b;b>>=1,a=a*a%MOD)if(b&1)res=res*a%MOD;return res;}
inline ll power(ll a, ll b){ll res=1;for(;b;b>>=1,a=a*a)if(b&1)res=res*a;return res;}

const int MAXN = 1e6 + 10;

bool mark[MAXN];

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n;
	cin >> n;
	ll cur = 0;
	for(int i = 1; ; i++){
		cur = (cur * 10 + 7) % n;
		if(cur == 0){
			cout << i << '\n';
			return 0;
		}
		if(mark[cur]){
			cout << -1 << '\n';
			return 0;
		}
		mark[cur] = 1;
	}
	assert(false);
}


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


def main():
    """Function."""
    n, a, b = map(int, input().split())

    if a > b:
        print(0)

    elif n == 1:
        if a == b:
            print(1)
        else:
            print(0)

    else:
        print(((n-1)*b + a) - ((n-1)*a + b) + 1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
import math


n = int(input())
mod = 1000000007
ab = [list(map(int,input().split())) for _ in range(n)]
dic = {}
z = 0
nz,zn = 0,0
for a,b in ab:
    if a == 0 and b == 0:
        z += 1
        continue
    elif a == 0:
        zn += 1
        continue
    elif b == 0:
        nz += 1
    if a< 0:
        a = -a
        b = -b
    g = math.gcd(a,b)
    tp = (a//g,b//g)
    if tp not in dic:
        dic[tp] = 1
    else:
        dic[tp] += 1
    
ans = 1
nn = n - z - zn - nz
for tp,v in dic.items():
    if v == 0:
        continue
    vt = (tp[1],-1*tp[0])
    if vt in dic:
        w = dic[vt]
        #print(tp)
        e = pow(2,v,mod) + pow(2,w,mod) - 1
        ans *= e
        ans %= mod
        nn -= v + w 
        dic[tp] = 0
        dic[vt] = 0
ans *= pow(2,nn,mod)
if zn == 0:
    ans *= pow(2,nz,mod)
elif nz == 0:
    ans *= pow(2,zn,mod)
else:
    ans *= pow(2,nz,mod) + pow(2,zn,mod) - 1
ans += z - 1
print(ans%mod)
#print(dic)


Measured memory_bytes: 82684
import math
 
def dic(s):
  l = len(s)
  if l == 0:
    return 0
  c = s[0]
  tmp = ((sorted(s)).index(c)-1) * math.factorial(l -1)
  return tmp + dic(s[1:])
 
n = input()
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
 
print(abs(dic(s1)-dic(s2)))

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W; cin >> H >> W;
  vector<string> S(H);
  REP(i, H){
    cin >> S[i];
  }
  vector<string> ans(H);
  REP(i, H){
    REP(j, W){
      if(S[i][j] == '#'){
        ans[i] += '#';
      }else{
        int cnt = 0;
        for(int k = -1; k < 2; k++){
          for(int l = -1; l <2; l++){
            if(i+k >= 0 && i+k <= H-1){
              if(l+j >= 0 && l+j <= W-1){
                if(S[i+k][l+j] == '#') cnt++;
              }
            }
          }
        }
        ans[i] += '0' + cnt;
      }
    }
  }
  for(auto i : ans){
    cout << i << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <climits>
#include <unordered_set>
using namespace std;
using ll = long long int;

int main()
{
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<bool>> mp(h, vector<bool>(w));

    for (size_t i = 0; i < h; i++)
    {
        string s;
        cin >> s;
        for (size_t j = 0; j < w; j++)
        {
            mp[i][j] = (s[j] == '1') ? true : false;
        }
    }

    int ans = INT_MAX;
    for (size_t i = 0; i < (1 << (h - 1)); i++)
    {
        bitset<9> mask = i;
        vector<vector<int>> white(h, vector<int>(w, 0));
        int group = 1;
        // divide into vertical group
        for (size_t j = 0; j < h; j++)
        {
            for (size_t l = 0; l < w; l++)
            {
                if (mp[j][l])
                {
                    white[group-1][l]++;
                }
            }
            if (mask[j])
            {
                group++;
            }
        }
// cout << "[" << mask << "]" << endl;
// cout << group << endl;
// for (size_t tt = 0; tt < group; tt++)
// {
//     for (size_t ss = 0; ss < w; ss++)
//     {
//         cout << white[tt][ss];
//     }
//     cout << endl;
// }
// cout << endl;

        // divide horizontal group
        int count = 0;
        bool ok = true;
        vector<int> line_choco(group);
        for (size_t j = 0; j < w; j++)
        {
            int choco = 0;
            for (size_t l = 0; l < group; l++)
            {
                if (white[l][j] > k) {
                    ok = false;
                }
                line_choco[l] = line_choco[l] + white[l][j];
                choco = max(choco, line_choco[l]);
            }
            if (choco > k)
            {
                for (size_t l = 0; l < group; l++)
                {
                    line_choco[l] = white[l][j];
                }
                count++;
            }
        }
        if (ok) {
            ans = min(ans, count+group-1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
now = 0
kari = []
ans = 0
for i in range(n):
    if a[i] < b[i]:
        ans += 1
        now += b[i]-a[i]
    elif a[i] >= b[i]:
        kari.append(a[i] - b[i])
kari.sort(reverse=True)
for i in kari:
    if now > 0:
        now -= i
        ans += 1
    elif now <= 0:
        break
if now > 0:
    print(-1)
elif now <= 0:
    print(ans)

Measured memory_bytes: 18292
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define all(x)  (x).begin(), (x).end()
#define MAX 1000000007
using namespace std;
typedef long long ll;

int main(){
  int N, M;
  cin >> N >> M;
  vector<string> A(N), B(M);
  bool exist = false;
  rep(i, 0, N)  cin >> A[i];
  rep(i, 0, M)  cin >> B[i];

  for(int ly=0; ly+M<=N; ly++) {
		for(int lx=0; lx+M<=N; lx++) {
			bool match = true;
			for (int y=0; y<M; y++) {
				for (int x=0; x<M; x++) {
					if (A[ly+y][lx+x] != B[y][x]) {
						match = false;
					}
				}
			}
      if(match)  exist=true;
    }
  }

  if(exist) cout << "Yes" << endl;
  else  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
H,K = map(int,input().split())
Monster = list(map(int,input().split()))

if H<=K:
    print(int(0))
else:
    KK = 0
    KK =int(K)
    ReMonster = 0
    list.sort(Monster,reverse= True)
    del Monster[0:KK]
    print(sum(Monster[:]))
    
   


Measured memory_bytes: 26180
n,m = map(int, input().split())
h = list(map(int, input().split()))
graph = [[] for i in range(n)]
count = 0
for i in range(m):
    x,y = map(int, input().split())
    graph[x-1].append(y-1)
    graph[y-1].append(x-1)
for i in range(n):
    yoi = True
    for j in graph[i]:
        if h[i] >h[j]:
            pass
        else:
            yoi = False
            break
    if yoi:
        count += 1
print(count)
    

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

int main(){
    
    int n,k,cnt=0;
    int tmp=1;
    cin>>n>>k;
    while(1){
        tmp=tmp*k;
        if(tmp>n){
            break;
        }else{
            cnt++;
        }
    }
    cout<<cnt+1<<"\n";
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[1021],b[1021],c[1021],d[1021],ans;
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>b[i];
	}
	for(int i=1;i<=m;i++){
		cin>>c[i]>>d[i];
	}
	for(int i=1;i<=n;i++){
		int sum=1e9;
		for(int j=1;j<=m;j++){
			if(abs(c[j]-a[i])+abs(d[j]-b[i])<sum){
				sum=abs(c[j]-a[i])+abs(d[j]-b[i]);
				ans=j;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
T = list(map(int,input().split()))
M = int(input())
PX = [list(map(int,input().split())) for i in range(M)]
tmp2 = 0
P = 0
X = 0
c = 0
for a in range(M):
  tmp = PX[a]
  for b in tmp:
    if(c == 0):
      P = b
      c += 1
    else:
      X = b
      c = 0
  tmp2 = T[P - 1]
  T[P - 1] = X
  print(sum(T))
  T[P - 1] = tmp2

Measured memory_bytes: 3064
# ARC061C
S = input()
N= len(S)
ans = 0

# +を挿入するのは2 ** (N-1)．間に入れるか入れないか
for i in range(2 ** (N - 1)):
    # iは各桁に+を挿入するかどうかを決定する．2進数として考える
    now_sum = 0                 # i番目の和を考える
    reg = int(S[0])
    for j in range(N - 1):      # 0or1を調べるためのループ
        if i & (1 << j):        # j回シフトした1とiの論理積をとることで1かどうかを調べる
      # if (i >> j) & 1:        # でも可．iをj回右シフトして，1と論理積をとる(最下位が1かを調べる) 
            now_sum += reg      # 1ならi番目の和にregを足す
            reg = 0
        reg *= 10               # 1でないならreg * 10 する.reg = 12なら120にする
        reg += int(S[j + 1])    # そして120 + 3で123となる
    now_sum += reg
    ans += now_sum
 
print(ans)

Measured memory_bytes: 3064
n = int(input())
*h, = map(int, input().split())

dp = [float("inf")]*(n+1)
dp[0] = 0

for i in range(1, n):
    if i == 1:
        dp[i] = dp[i-1] + abs(h[i-1]-h[i])

    dp[i] = min(dp[i-2] + abs(h[i-2]-h[i]), dp[i-1] + abs(h[i-1]-h[i]))

print(dp[n-1])


Measured memory_bytes: 13980
# /usr/bin/python
# -*- coding: utf-8 -*-
#
import sys


N,Q = map(int, sys.stdin.readline().rstrip().split())
s = [""] + list(str(input())) + [""]
td = [["" for j in range(2)] for i in range(Q)]
for i in range(Q):
  td[i] = list(map(str, sys.stdin.readline().rstrip().split()))


# idx の位置の文字が左に消えるなら "L",
# 右に消えるなら "R", そうでなければ "F"
def check(idx):
  for t,d in td:
    if s[idx] == t:
      if d == "L":
        idx -= 1
      else:
        idx += 1
    if idx == 0:
      return "L"
    elif idx == N+1:
      return "R"
  return "F"


if __name__ == "__main__":
  # L のポイントをbinary search
  l,r = [0,N+1]
  while(r-l > 1):
    mid = (r+l) // 2
    if check(mid) == "L":
      l = mid
    else:
      r = mid
  lp = l

  # R のポイントをbinary search
  l,r = [0,N+1]
  while(r-l > 1):
    mid = (r+l) // 2
    if check(mid) == "R":
      r = mid
    else:
      l = mid
  rp = r-1

  print(rp-lp)


Measured memory_bytes: 113200
#include <bits/stdc++.h>
#define ll long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef DEBUG
			assert(freopen("inp", "r", stdin));
			assert(freopen("out", "w",stdout));
	#else
			#define cerr if(false)cerr
	#endif
    int h,n;
    cin >> h >> n;
    vector <int> ar(n);
    for(auto &i : ar)
        cin >> i;
    int sum = 0;
    for(auto i : ar)
        sum += i;
    if(sum >= h){
        cout << "Yes\n";
    }
    else
        cout << "No\n";
   cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC 
    << " sec" << endl;
}

Measured memory_bytes: 640
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	A, B, C = getlist()
	K = int(input())
	jud = "No"
	for i in range(K + 1):
		for j in range(K + 1):
			for k in range(K + 1):
				a, b, c = A, B, C
				a *= 2 ** i
				b *= 2 ** j
				c *= 2 ** k
				if i + j + k <= K:
					if a < b and b < c:
						print("Yes")
						return

	print("No")

if __name__ == '__main__':
	main()

Measured memory_bytes: 9516
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};


signed main(){
    int n,l[1005];
    cin >> n;
    cinf(2*n,l);
    sort(l,l+n*2);
    int ans = 0;
    for(int i = 0;i<n;i++){
        ans += min(l[2*i],l[2*i+1]);
    }
    cout << ans fin;
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
xy = list(map(int, input().split()))
xy1 = xy[0:2]
xy2 = xy[2:4]

d1 = xy2[0] - xy1[0]
d2 = xy2[1] - xy1[1]

xy3 = [xy2[0] - d2, xy2[1] + d1]
xy4 = [xy3[0] - d1, xy3[1] - d2]

print(*(xy3 + xy4))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
struct node{
	int v,c;
	bool operator<(const node&p)const{
		return c>p.c;
	}
};
int d[100005];
vector<node> e[100005];
bool ok[100005];
int n;
void solve(){
	priority_queue<node> q;
	ok[0]=1;
	for(int i=0;i<e[0].size();i++)q.push(e[0][i]);
	int k=1;
	while(k!=n){
		node v=q.top();q.pop();
		if(ok[v.v])continue;
		d[v.v]=v.c;
		ok[v.v]=1;
		k++;
		for(int j=0;j<e[v.v].size();j++)
			q.push({e[v.v][j].v,e[v.v][j].c+v.c});
	}
	for(int i=0;i<n;i++)
		cout<<i<<' '<<d[i]<<"\n";
}
int main(){
//	freopen("a.txt","r",stdin);
	cin.tie(0);
	int u,v,k,c;
	cin>>n;
	while(cin>>u>>k){
		for(int i=0;i<k;i++){
			cin>>v>>c;
			e[u].push_back({v,c});
		}
	}
	solve();
	return 0;
}


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

int main(){
  int N;
  cin >> N;
  map<int, bool> M;
  int A;
  for(int i=0; i<N; i++){
    cin >> A;
    M[A]=!M[A];
  }
  int Ans=0;
  for(auto i=M.begin(); i!=M.end(); i++){
    Ans+=i->second;
  }
  cout << Ans << endl;
}

Measured memory_bytes: 4864
# 行数
N = int(input().strip())

# 2次元配列
grid = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    grid.append(array)
# print(grid)
counter = 0
frag = False
for i in range(N):
    if grid[i][0] == grid[i][1]:
        counter += 1
        if counter == 3:
            frag = True
    elif grid[i][0] != grid[i][1]:
        counter = 0
if frag is True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9204
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N = I()
v = LI()

v.sort(reverse=True)

ans = 0
for i in range(N-1):
    ans += v[i]/2**(i+1)
ans += v[N-1]/2**(N-1)

print(ans)

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

using namespace std;

int main()
{
  int L,R,d,i=1,count=0,mul;
  cin>>L>>R>>d;
  mul = d;
  while(mul <= R){
    mul = i*d;
    if(mul>= L && mul<=R){
      count++;
    }
    i++;
  }
  cout<<count;
  return 0;
      
}


Measured memory_bytes: 3592
#include <limits>
#include <vector>
using namespace std;
template <typename Type> class RMQ
{
private:

	int size;

	vector<Type> maxvalue;

	Type _query(int a, int b, int k, int l, int r)
	{
		if (r <= a || b <= l) { return INF; }
		if (a <= l && r <= b) { return maxvalue[k]; }

		Type vl = _query(a, b, 2 * k, l, (l + r) / 2);
		Type vr = _query(a, b, 2 * k + 1, (l + r) / 2, r);

		return max(vl, vr);
	}

public:

	Type INF;

	RMQ(int size_)
	{
		INF = numeric_limits<Type>::min() / 2;

		for (size = 1; size < size_;) { size <<= 1; }

		maxvalue = vector<Type>(size * 2, INF);
	}

	void update(int i, const Type& x)
	{
		i += size;

		maxvalue[i] = x;

		while (i > 1)
		{
			i = i / 2;

			maxvalue[i] = max(maxvalue[2 * i], maxvalue[2 * i + 1]);
		}
	}

	Type query(int s, int t)
	{
		return _query(s, t, 1, 0, size);
	}
};

#include<cstring>
#include<algorithm>
#include<cmath>

#define MAX_N 14348907

long long x_1[MAX_N];
long long y_1[MAX_N];
pair<long long, long long>x2[MAX_N];
long long y2[MAX_N];
RMQ<long long> r(14348907);

int main() {
	long long x[15][2], y[15][2], d;
	int power[16] = { 1,3,9,27,81,243,729,2187,6561,19683,59049,177147,531441,1594323,4782969,14348907 };
	int n, e, f, g, h, b, b2;
	int mid;
	long long int MAX = 0;
	int a[15];

	memset(x_1, 0, sizeof(x_1));
	memset(y_1, 0, sizeof(y_1));

	scanf("%d", &n);
	scanf("%lld", &d);
	mid = n / 2;

	for (int i = 0; i < mid; i++) {
		scanf("%lld", &x[i][0]);
		scanf("%lld", &y[i][0]);
	}
	for (int i = mid; i < n; i++) {
		scanf("%lld", &x[i - mid][1]);
		scanf("%lld", &y[i - mid][1]);
	}
	
	g = min(power[mid], 7300000);
	h = 7100000;

	for (int i = 0; i < power[mid]*19/20; i++) {
		for (int j = 0; j < mid; j++) {
			a[j] = (i / power[j]) % 3;
			if (a[j] == 0) {
				x_1[i] -= x[j][0];
				y_1[i] -= y[j][0];
			}
			else if (a[j] == 1) {
				x_1[i] += x[j][0];
				y_1[i] += y[j][0];
			}
		}
	}

	for (int i = 0; i < power[n-mid]*19/20; i++) {
		for (int j = 0; j < n - mid; j++) {
			a[j] = (i / power[j]) % 3;
			if (a[j] == 0) {
				x2[i].first -= x[j][1];
				x2[i].second -= y[j][1];
			}
			if (a[j] == 1) {
				x2[i].first += x[j][1];
				x2[i].second += y[j][1];
			}
		}
	}

	sort(x2, x2 + power[n - mid]);

	for (int i = 0; i < power[n - mid]; i++) {
		y2[i] = x2[i].first;
		r.update(i, x2[i].second);
	}

	if (n == 30) {
		for (int i = h; i < power[mid]; i++) {
			e = distance(y2, lower_bound(y2, y2 + power[n - mid], -x_1[i] - d));
			f = distance(y2, upper_bound(y2, y2 + power[n - mid], -x_1[i] + d));
			MAX = max(MAX, r.query(e, f) + y_1[i]);
		}
	}
	else {
		for (int i = 0; i < g; i++) {
			e = distance(y2, lower_bound(y2, y2 + power[n - mid], -x_1[i] - d));
			f = distance(y2, upper_bound(y2, y2 + power[n - mid], -x_1[i] + d));
			MAX = max(MAX, r.query(e, f) + y_1[i]);
		}
	}

	printf("%lld\n", MAX);

	return 0;
}

Measured memory_bytes: 824880
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;
string s;
int w;
int main()
{
	cin >> s;
	cin >> w;
	int n = s.size();
	for(int i=0; i<n; i+= w)
		cout << s[i];
}

Measured memory_bytes: 3592
#define DEBUG_ON_
#define CONDITION true
using namespace std;/*{{{*/

#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

static const double PI (3.14159265358979323846);
static const double EPS (1e-10);

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef complex<double> P;

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

#define FOR(i, b, e) for (typeof(b) i = (b); assert((i) <= (e)), i != (e); ++i)
#define REP(i, n) FOR(i, 0, n)

#define OPOVER(_op, _type) inline bool operator _op (const _type &t) const

#define arrsz(a) ( sizeof(a) / sizeof(a[0]) )

#define F first
#define S second
#define MP(a, b) make_pair(a, b)

#define SZ(a) ((ll)a.size())
#define PB(e) push_back(e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

#define BIT(n) (1ULL << (n))
#define BITOF(n, m) ((n) >> (m) & 1)

#define RANGE(a, b, c) ((a) <= (b) && (b) <= (c))

#ifdef DEBUG_ON
#define dprt(fmt, ...) if (CONDITION) fprintf(stderr, fmt, __VA_ARGS__)
#define darr(a) if (CONDITION) copy( (a), (a) + arrsz(a), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr_range(a, f, t) if (CONDITION) copy( (a) + (f), (a) + (t), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define dvec(v) if (CONDITION) copy( ALL(v), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr2(a, n, m) if (CONDITION) FOR(i, 0, (n)){ darr_range( (a)[i], 0, (m) ); }
#define dvec2(v) if (CONDITION) FOR(i, 0, SZ(v)){ dvec( (v)[i] ); }
#define WAIT() if (CONDITION) { string _wait_; cerr << "(hit return to continue)" << endl; getline(cin, _wait_); }
#else
#define cerr if(0) cerr
#define dprt(fmt, ...)
#define darr(a)
#define darr_range(a, f, t)
#define dvec(v)
#define darr2(a, n, m)
#define dvec2(v)
#define WAIT()
#endif
/*}}}*/

#define INF INT_MAX

int main(int argc, char const* argv[])
{
	vector<pii> cards;
	int dp[100][100];
	int n;
	cin >> n;
	REP (i, n) {
		pii c;
		cin >> c.F >> c.S;
		cards.PB(c);
	}

	REP (i, 100) {
		REP (j, 100) {
			if (i == j) {
				dp[i][j] = 0;
			} else {
				dp[i][j] = INF;
			}
		}
	}
	FOR (w, 1, n) {
		cerr << "w = " << w << endl;
		REP (i, n-w) {
			cerr << "i = " << i << endl;
			int j = i + w;
			FOR (k, i, j) {
				cerr << "\tk = " << k << endl;
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j] + cards[i].F * cards[k].S * cards[k+1].F * cards[j].S);
			}
		}
	}
	cout << dp[0][n-1] << endl;
}

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

int main(){
  int n,m;cin>>n>>m;
  int ans=pow(2,m)*(100*(n-m)+1900*m);
  cout<<ans;
}

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

typedef long long ll;

int main()	
{
	int x,tc,ans = 0;
	cin>>tc;
	map<int,bool> m;
	while(tc--){
		cin>>x;
		m[x] = (m[x] + 1)%2;
		if(m[x]) ans++;
		else ans--;
	}
	cout<<ans<<'\n';
}

Measured memory_bytes: 8200
n = int(input())
A = list(map(int, input().split()))
q = int(input())
M = list(map(int, input().split()))

def solve(idx, current, target):
        # print("\n# i: " + str(i))
        # print("# current: " + str(current))
        # print("# target: " + str(target))
        # print("# array: " + str(array))
    if current > target:
        return False
    elif len(A) == idx:
        return False
    elif current + sum(A[idx:])	< target:
        return False
    elif current == target:
        return True
    elif current + A[idx] == target:
        return True
    else:
        return solve(idx + 1, current + A[idx], target) or solve(idx + 1, current, target)

for i in range(q):
    if solve(0, 0, M[i]):
        print('yes')
    else:
        print('no')



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

int main() {
  long long N, X, T;
  cin >> N >> X >> T;
  if(N%X == 0) {
    cout << T*(N/X) << endl;
  }
  else {
    cout << T*((N/X)+1) << endl;
  }
}

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

int main(){
    int N;cin>>N;
    ll A[200010],S[200010];
    S[0]=0;
    for(int i=0;i<N;i++){
        cin>>A[i];
        S[i+1]=S[i]+A[i];
    }
    ll s=S[N]/2;
    int k=0;
    while(S[k]<=s){
        k++;
    }
    ll ans=2*S[k]-S[N];
    ans=min(ans,S[N]-2*S[k-1]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3456
import std.algorithm, std.array, std.conv, std.range, std.stdio, std.string;
void main()
{
    auto x = readln.chomp.to!int;
    while (x.notPrime)
        x += 1;
    x.writeln;
}
bool notPrime(int x)
{
    if (x < 4)
        return x < 2;
    int d = 2;
    while (d*d <= x)
    {
        if (!(x % d)) return true;
        d += 1;
    }
    return false;
}


Measured memory_bytes: 256
/* ITP1_7_A */
import java.io.*;

class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      while(true){
        // input
        String[] score = br.readLine().split(" ");
        int mid_exam = Integer.parseInt(score[0]);
        int fin_exam = Integer.parseInt(score[1]);
        int retest = Integer.parseInt(score[2]);
        // errorcheck
        if(mid_exam < -1 || mid_exam > 50) return;
        if(fin_exam < -1 || fin_exam > 50) return;
        if(retest < -1 || retest > 100) return;
        // finish
        if(mid_exam == -1 && fin_exam == -1 && retest == -1) break;

        int mid_fin = mid_exam + fin_exam;
        // grading
        if(mid_exam == -1 || fin_exam == -1){
          sb.append("F\n");
          continue;
        }
        if(mid_fin >= 80){
          sb.append("A\n");

        }else if(mid_fin >= 65){
          sb.append("B\n");

        }else if(mid_fin >= 50){
          sb.append("C\n");

        }else if(mid_fin >= 30){
          if(retest >= 50){
            sb.append("C\n");
          }else{
            sb.append("D\n");
          }

        }else{
          sb.append("F\n");
        }
      }
      // output
      System.out.print(sb);
    }catch(Exception e){
      System.out.println(e);
    }
  }
}

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

using namespace std;

using ll = long long;

constexpr char newl = '\n';

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

    int n;
    ll d;
    cin >> n >> d;

    int ans = 0;
    for (int i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;

        ll val = x * x + y * y;
        ans += (val <= d * d);
    }
    cout << ans << newl;

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(void){
 
 int N,c = 0,max=0;
 cin >> N;
 for(int i=0;i<N;i++){
     int l_i;
     cin >> l_i;
     c += l_i;
     if(max < l_i) max = l_i;
     
 }
 c -= max;

 if(max < c){
     cout << "Yes" <<endl;
 }
 else{
     cout << "No" <<endl;
 }

}

Measured memory_bytes: 3644