akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
  
int puz[3][3];
int tmp[3][3];
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void empty(int *x,int *y) {
  int i,j;
  for(i=0; i<3; i++){
    
    for(j=0; j<3; j++){
      
      if(!puz[i][j]){
	
	*x = j;
	*y = i;
	return;
      }
    }
  }
}
   
void swap(int *a,int *b){
  int tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}
  
int cal(){
  int i,a,sum=0; 
  for(i=0; i<9; i++){
    a = puz[i/3][i%3];
    if(a){
      a--;
      sum += abs(i/3 - a/3) + abs(i%3 - a%3);
    }
  }    
  return sum;
}
  
int dfs(int x,int y,int p,int dep,const int lim){
    int i,h,nx,ny,res;   
    h = cal();
    if(h==0) return dep;
    if(dep+h>lim) return -1; 
    for(i=0; i<4; i++){
        nx = x+dx[i];
        ny = y+dy[i];      
        if(~p && i==(p+2)%4) continue;
        if(!(0<=nx && nx<3 && 0<=ny && ny<3)) continue;    
        swap(&puz[y][x],&puz[ny][nx]);
        res = dfs(nx,ny,i,dep+1,lim);
        if(~res) return res;       
        swap(&puz[y][x],&puz[ny][nx]);
    }   
    return -1;
}  
    
int main() {
    int i,j,ans,x,y,l;
      
    for(i=0; i<3; i++){
        for(j=0; j<3; j++)
	  scanf("%d",&puz[i][j]);
    }
       
    empty(&x,&y);
    for(l=0; l<100; l++){
        for(i=0; i<3; i++){
            for(j=0; j<3; j++)
	      tmp[i][j] = puz[i][j];
        }
          
        ans = dfs(x,y,-1,0,l);
        if(ans!=-1){
            printf("%d\n",ans);
            break;
        }
          
        for(i=0; i<3; i++){
            for(j=0; j<3; j++)
	      puz[i][j] = tmp[i][j];
        }
          
        ans = -1;
	
        if(l==99)
	  printf("%d\n",ans);
    }
      
    return 0;
}



Measured memory_bytes: 2108
/* be name khoda */

// #define stream_enable
#define long_enable

#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>

// #include <bits/stdc++.h>
// #include <numeric>
// #include <iomanip>
// #include <cmath>
// #include <bitset>
// #include <fstream>

using namespace std;

#ifdef stream_enable
#define cin sss
#endif

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<vi> vii;
typedef vector<pii> vpii;

const ll MOD = 1000000007;

const long long BIG = 1446803456761533460LL;
const int Big = 336860180;

#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back

#define debug(x) cout << #x << " -> " << (x) << endl;
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl;
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl;
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl;
#define debugp(x) cout << #x << " -> " << "(" << (x).ff << ", " << (x).ss << ")" << endl;
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugap(x, n) cout << #x << " ->\n"; fori (i1_dap, n) { cout << "(" << (x)[i1_dap].ff << ", " << (x)[i1_dap].ss << ")" << endl; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
#define debugav(x, n) cout << #x << " ->\n"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_da].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\n'; } cout << endl
#define debugia(x, n) cout << #x << " ->\n"; fori (i1_dia, n) { cout << i1_dia << " : " << (x)[i1_dia] << '\n'; } cout << endl

#define forifrom(i, s, n) for(ll i = (s); i < (n); ++i)
#define forirto(i, n, e) for(ll i = (n) - 1; i >= (e); --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define Add(a, b) a = (a + (b)) % MOD
#define Mul(a, b) a = (a * (b)) % MOD

stringstream sss;

// -----------------------------------------------------------------------

const ll maxn = 100010;

void MAIN() {

    ll n;
    cin >> n;
    string s;
    cin >> s;
    for (auto c : s) {
        c = ((c - 'A' + n) % 26 + 'A');
        cout << c;
    }
    cout << endl;

}

// -----------------------------------------------------------------------

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // cout << fixed << setprecision(10);
    sss << R"(

    )";
    MAIN();
    return 0;
}


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

using namespace std;

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int N, Q;
int S[220000], T[220000], X[220000];
int D[220000];
vector<pair<int, pint>> ev;
int ans[220000];

signed main() {
    cin >> N >> Q;
    for (int i = 0; i < N; i++) {
        cin >> S[i] >> T[i] >> X[i];
        S[i] -= X[i];
        T[i] -= X[i];
        ev.push_back(make_pair(S[i], make_pair(0, i)));
        ev.push_back(make_pair(T[i], make_pair(1, i)));
    }
    for (int i = 0; i < Q; i++) {
        cin >> D[i];
        ev.push_back(make_pair(D[i], make_pair(2, i)));
    }
    sort(ev.begin(), ev.end());
    multiset<int> ms;
    ms.insert(1e11);
    for (int i = 0; i < ev.size(); i++) {
        if (ev[i].second.first == 0) {
            ms.insert(X[ev[i].second.second]);
        } else if (ev[i].second.first == 1) {
            ms.erase(ms.find(X[ev[i].second.second]));
        } else if (ev[i].second.first == 2) {
            ans[ev[i].second.second] = *ms.begin();
        }
    }
    for (int i = 0; i < Q; i++)cout << ((ans[i]==1e11)?(-1):ans[i]) << endl;

}

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

int main() {
    int N, Q;
    string S;
    cin >> N >> Q >> S;
    int cnt[N];
    int X = 0;
    for (int i = 1; i < N; i++) {
        if (S[i - 1] == 'A' && S[i] == 'C') {
            X++;
            cnt[i - 1] = X - 1;
            cnt[i] = X;
        }
        else {
            cnt[i - 1] = cnt[i] = X;
        }
    }
    for (int i = 0; i < Q; i++) {
        int l, r;
        cin >> l >> r;
        cout << cnt[r - 1] - cnt[l - 1] << endl;
    }
}


Measured memory_bytes: 1408
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main
{
    static long sum(int l,int r,long arr[]){
        return arr[r]-arr[l-1];
    }

    public static void process()throws IOException
    {
        int n=ni();

        long dp[][]=new long[n+1][n+1],pref[]=new long[n+1];

        for(int i=1;i<=n;i++) pref[i]=pref[i-1]+nl();

        for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) if(i==j) dp[i][j]=0l; else dp[i][j]=100000l*100000l*10000l+100000000l;
        for(int len=1;len<=n;len++){
            for(int i=1;i+len-1<=n;i++){
                int j=i+len-1;

                for(int k=i;k<j;k++){

                    dp[i][j]=Math.min(dp[i][j], sum(i,k,pref)+sum(k+1,j,pref)+
                                                dp[i][k]+dp[k+1][j]);
                }
            }
        }
        pn(dp[1][n]);
    }
 
 
    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new FastReader();
 
        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();
 
        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }
    
    
    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static int ni()throws IOException{return Integer.parseInt(sc.next());}
    static long nl()throws IOException{return Long.parseLong(sc.next());}
    static double nd()throws IOException{return Double.parseDouble(sc.next());}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    
    static long mod=(long)1e9+7l;
 
    static<T> void r_sort(T arr[],int n){
        Random r = new Random(); 
        for (int i = n-1; i > 0; i--){ 
            int j = r.nextInt(i+1); 
                  
            T temp = arr[i]; 
            arr[i] = arr[j]; 
            arr[j] = temp; 
        } 
        Arrays.sort(arr); 
    }
    
/////////////////////////////////////////////////////////////////////////////////////////////////////////
    static class FastReader{ 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader(){ 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next(){ 
            while (st == null || !st.hasMoreElements()){ 
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); } 
            } 
            return st.nextToken(); 
        } 
  
        String nextLine(){ 
            String str = ""; 
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } 
            return str; 
        } 
    } 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 38096
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod // i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD


# --------------------------------------------

dp = None


def main():
    print(len(set(li_input())))


main()


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

int main(){
  int n;
  cin >> n;
  vector<pair<long long ,long long>> an(n);
  for(int i=0;i<n;i++){
    long long  a,b;
    cin >> a >> b;
    an[i] = make_pair(b,a);
  }
  sort(an.begin(),an.end());
  
  long long time=0;
  for(int i=0;i<n;i++){
    time += an[i].second;
    if(an[i].first < time){cout << "No" << endl; return 0;}
  }
  cout << "Yes" << endl;
  
}

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

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

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

/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}

__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    ll x, y;
    cin >> x >> y;
    if (x % y != 0) cout << x << '\n';
    else cout << -1 << '\n';
}


Measured memory_bytes: 3652
#include<iostream>
#include<stdlib.h>
#include<math.h>
#define EPS (1e-10)
using namespace std;
struct Point{
  double x,y;
  Point(){};
  Point(double x,double y):x(x),y(y){}
  Point operator-(Point p){return Point(x-p.x,y-p.y);}
};
double dot(Point a,Point b){
  return a.x*b.x+a.y*b.y;
}
int main(){
  Point p[4];
  while(cin>>p[0].x>>p[0].y){
    int i,j,k;
    for(i=1;i<4;i++) cin>>p[i].x>>p[i].y;
    if(fabs(dot(p[0]-p[1],p[2]-p[3]))<EPS) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

Measured memory_bytes: 1216
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back

#define maxN 100011

const int lim = 100000;

int n, i, x, bb, ans;
int a[maxN];

int main()
{
   // freopen("test.in","r",stdin);

    scanf("%d", &n);
    for (i = 1; i <= n; i++) {
        scanf("%d", &x);
        a[x]++;
    }

    for (i = 1; i <= lim; i++) {
        while (a[i] >= 3) a[i] -= 2;
        if (a[i] > 0) ans++;
        if (a[i] == 2) bb ^= 1;
    }

    if (bb == 1)
        ans--;

    printf("%d", ans);



    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long A,B,K,G;
  cin >> A >> B >> K;
  G=__gcd(A,B);
  for (int i=100;i>0;i--) {
    if (G%i==0) {K--;}
	if (K==0) {cout << i << endl;return 0;}
  }
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	x := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&x[i])
	}
	sort.Ints(x)

	d := make([]int, m-1)
	for i := 0; i < m-1; i++ {
		d[i] = x[i+1] - x[i]
	}
	sort.Ints(d)

	ans := 0
	for i := 0; i < len(x)-n; i++ {
		ans += d[i]
	}
	fmt.Println(ans)
}


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

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

  ll H; cin >> H;
  ll N; cin >> N;
  vector<ll> A(N), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }

  ll INF = 1e15;
  vector<vector<ll>> dp(N + 1, vector<ll>(H + 1, INF));
  dp[0][0] = 0;
  for (int i = 0; i < N; i++) {
    dp[i + 1][0] = 0;
    for (int j = 0; j <= H; j++) {
      if (j <= A[i]) dp[i + 1][j] = min(dp[i][j], B[i]);
      else dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i]);
    }
  }
  cout << dp[N][H] << '\n';
  return 0;
}

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

def main():
    n = int(input())
    V = [int(e) for e in input().split(" ")]
    C = [int(e) for e in input().split(" ")]

    N = [0 for i in range(n+1)]

    max_n = 0
    for i in range(1, n+1):
        prev = N[i-1]
        current = N[i-1] + (V[i-1] - C[i-1])
        if prev < current:
            N[i] = current
        else:
            N[i] = prev

    print(N[n])

main()



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    int x;
    cin >> x;
    
    int ans = 0;
    for (int i = 1; i <= 360; i++) {
        if (x * i % 360 == 0) {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3632
#include <cstdio>
#define Maxn 200000
int head[Maxn+5],arrive[Maxn<<1|5],nxt[Maxn<<1|5],tot;
void add_edge(int from,int to){
	arrive[++tot]=to;
	nxt[tot]=head[from];
	head[from]=tot;
}
int dep[Maxn+5];
int n;
int s,t;
void dfs(int u,int fa){
	dep[u]=dep[fa]+1;
	for(int i=head[u];i;i=nxt[i]){
		int v=arrive[i];
		if(v==fa){
			continue;
		}
		dfs(v,u);
	}
}
int main(){
	int u,v;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		scanf("%d%d",&u,&v);
		add_edge(u,v);
		add_edge(v,u);
	}
	dfs(1,0);
	for(int i=1;i<=n;i++){
		if(dep[i]>dep[s]){
			s=i;
		}
	}
	dfs(s,0);
	for(int i=1;i<=n;i++){
		if(dep[i]>dep[t]){
			t=i;
		}
	}
	if(dep[t]%3==2){
		puts("Second");
	}
	else{
		puts("First");
	}
	return 0;
}


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

int main() {
    int k, a, b;
    cin >> k >> a >> b;
    int i = 1;
    int x;
    bool flag = false;

    while (true) {
        x = k * i;
        if (a <= x && x <= b) {
            flag = true;
            break;
        }

        else if (b < x) {
            break;
        }
        i += 1;
    }
    if (flag == true) {
        cout << "OK" << endl;
    }

    else if (flag == false) {
        cout << "NG" << endl;
    }
}


Measured memory_bytes: 3628
N = int(input())
lsA = list(map(int,input().split()))
lsB = [0]+list(map(int,input().split()))
lsC = [0]+list(map(int,input().split()))
sumB = sum(lsB)
for i in range(N-1):
    if lsA[i]+1 == lsA[i+1]:
        sumB += lsC[lsA[i]]
print(sumB)

Measured memory_bytes: 9104
readints()=parse.(Int,split(readline()))
readint()=parse.(Int,readline())

A,V=readints()
B,W=readints()
T=readint()

D_d=abs(A-B)
D_v=(V-W)

if D_d <= D_v*T
    print("YES")
else
    print("NO")
end

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

int main() {

    int x, n;
    cin >> x >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    int tmp;
    rep(i,110) {
        tmp = x - i;
        int cnt = 0;
        rep(j,n) {
            if (tmp != p[j]) cnt++;
        }
        if (cnt == n) {
            cout << tmp << endl;
            return 0;
        }
        tmp = x + i;
        cnt = 0;
        rep(j,n) {
            if (tmp != p[j]) cnt++;
        }
        if (cnt == n) {
            cout << tmp << endl;
            return 0;
        }

    }
    return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
double syousu(double a,double b);
int main()
{
  int a,b;
  double ans;
  scanf("%d %d",&a,&b);
  ans=syousu(a,b);
  printf("%d %d %f",a/b,a%b,ans);
  return 0;
}
double syousu(double a,double b){
  double n;
  n=a/b;
  return n;
}

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
P = [p-1 for p in LIST()]

A = [0] * N
B = [0] * N
gap = 30000
for i in range(N):
    A[i] = gap * i + 1
    B[i] = gap * (N-i)

for i, p in enumerate(P):
    A[p] += i

print(*A)
print(*B)


Measured memory_bytes: 6300
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
const int MD = 1e9+7;
const int MX = 1005;
int n, a, b, c, d;
ll dp[MX] = {1}, fact[MX] = {1}, invf[MX];;

ll exp(ll b, ll n){
	ll res = 1;
	for(; n; n/=2,(b*=b)%=MD) if(n%2) (res *= b) %= MD;
	return res;
}
void setcomb(int n){
	for(int i = 1; i <= n; i++) fact[i] = (fact[i-1] * i) % MD;
	invf[n] =  exp(fact[n],MD-2);
	for(int i = n; i > 0; i--) invf[i-1] = (invf[i] * i) % MD;
}

int main(){
	scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);
	setcomb(n);
	for(int i = a; i <= b; i++) for(int j = n; j >= 0; j--){
		for(int k = c; k*i <= j && k <= d; k++) (dp[j] += dp[j-k*i] * fact[n-j+k*i] % MD * invf[n-j] % MD * exp(invf[i],k) % MD * invf[k]) %= MD;
	}
	printf("%lld\n", dp[n]);
}

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

int main() {
  int A, B;
  cin >> A >> B;
  int ans = -1;
  for (int x = 0; x < 10000; x++){
      if(floor(0.08 * x) == A && floor(0.1 * x) == B){
        ans = x;
        break;
      }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;
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; }

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll>mae(n+2);
    rep(i,n+2){
        mae[i]=i*(n-i+1)+1;
    }
    mint ans = 0;
    for(int i=k;i<=n+1;i++){
        ans += mae[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4844
/*2019/10/19 */
/*template*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){if(*(int*)a < *(int*)b)return -1;else if(*(int*)a == *(int*)b)return 0;else return 1;}
int desc(const void *a,const void *b){if(*(int*)a < *(int*)b)return 1;else if(*(int*)a == *(int*)b)return 0;else return -1;}
int llasc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return -1;else if(*(ll*)a == *(ll*)b)return 0;else return 1;}
int lldesc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return 1;else if(*(ll*)a == *(ll*)b)return 0;else return -1;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}
 
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return -1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return 1;}
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return 1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return -1;}
double to_deg(double r) {return r * 180.0 / (atan(1.0) * 4.0);}

int main(){
    int x,y;
    int pointx[300]={},pointy[300]={};
    int ans=0;
    scanf("%d %d",&x,&y);
    pointx[0]=pointy[0]=300000;
    pointx[1]=pointy[1]=200000;
    pointx[2]=pointy[2]=100000;
    ans+=pointx[x-1];
    ans+=pointy[y-1];
    if(x==1&&y==1){
        ans+=400000;
    }
    printf("%d\n",ans);
    return 0;
}

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

using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;

long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}

/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  

double eps = .000000001;
const long long maxx = 1000000000000000000LL;
int main(){
  prep();
  int h, w, k;
  cin >> h >> w >> k;
  string grid[h];
  for (int i=0; i<h; i++){
      cin >> grid[i];
     
  }
  int peices[h][w];
  int rowsum[h] = {0};
  for (int i=0; i<h; i++){
      for (int j=0; j<w; j++){
          if (grid[i][j] == '#'){
              rowsum[i]++;
          }
      }
  }
  int curpeice = 0;
  for (int i=0; i<h; i++){
      bool found = false;
      for (int j=0; j<w; j++){
          if (grid[i][j] == '#'){
              
              if (!found){
                  found = true;
                  curpeice++;
                  for (int l=0; l<=j; l++){
                      peices[i][l] = curpeice;
                  }
              }else{
                  curpeice++;
                  peices[i][j] = curpeice;
              }
              
          }else{
              peices[i][j] = curpeice;
          }
      }
  }
  bool found = false;
  for (int i=0; i<h; i++){
      if (found && rowsum[i] == 0){
          for (int j=0; j<w; j++){
              peices[i][j] = peices[i-1][j];
          }
          rowsum[i] = 1000;
      }else if (rowsum[i] != 0){
          found = true;
      }
  }
  found = false;
  for (int i=h-1; i>=0; i--){
      if (found && rowsum[i] == 0){
          for (int j=0; j<w; j++){
              peices[i][j] = peices[i+1][j];
          }
      }else if (rowsum[i] != 0){
          found = true;
      }
  }
  for (int i=0; i<h; i++){
      for (int j=0; j<w; j++){
          cout << peices[i][j] <<" ";
      }
      cout << '\n';
  }
  return 0; 
}

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

using namespace std;
int main(){
int a,b,k;
cin>>a>>b>>k;
int d;
d=b-a+1;
if(d<=k*2){
    for(int i=a;i<=b;i++){
        cout<<i<<endl;
    }
}
else{
        int x=k;
while(x>0){
    cout<<a++<<endl;
    x--;
}
x=k;
b=(b-k+1);
while(x>0){
    cout<<b++<<endl;
    x--;
}


}
return 0;

}


Measured memory_bytes: 256
package main

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

func main() {
	fmt.Printf("%d\n", parseProblem(os.Stdin))
}

func parseProblem(r io.Reader) int {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	_ = scanInt(sc)

	return strings.Count(scanString(sc), "ABC")
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


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

using namespace std ;

const int MAX = 1e5 + 10 ;

int arr[MAX] ;
int n ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	map<int , int>mp ;
	for(int i = 0 ; i < n ; ++i)
	{
		int x ;
		cin>>x ;
		mp[x]++ ;
	}
	int ans = 0 ;
	for(auto &i : mp)
	{
		if(i.second < i.first)
			ans += i.second ;
		else
			ans += i.second - i.first ;
	}
	return cout<<ans<<"\n" , 0 ;
}		

Measured memory_bytes: 4736
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

M1, D1 = map(int, input().split())
M2, D2 = map(int, input().split())

lastd = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

if D2 == 1:
    print(1)
else:
    print(0)

Measured memory_bytes: 21644
#![allow(unused_imports)]
#![allow(dead_code)]
use std::io::prelude::*;
use std::cmp::{max, min};
use std::collections::BinaryHeap;

const MOD: i64 = 1e9 as i64 + 7; 

fn main(){
    let n: usize = read();
    let k: isize = read();
    let s: Vec<char> = read::<String>().chars().collect();
    let mut cnt: isize = 0;
    for i in 1..n{
        if s[i - 1] != s[i]{
            cnt += 1;
        }
    }
    let n: isize = n as isize;
    let ans = min(n - 1, (n - cnt - 1) + 2 * k);
    println!("{}", ans);
}

fn read<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

int main(){
	int a, b;

	cin >> a >> b;
	
	int k = (a + b) / 2;

	if ( a + b == k * 2 ) cout << k << endl;
	else cout << "IMPOSSIBLE" << endl;

	cin >> a;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
#define s second
#define f first
const int MOD = 1e9+7;
using namespace std;

ll llmax(ll x, ll y){
	if (x > y) return x;
	return y;
}

ll llmin(ll x, ll y){
	if (x > y) return y;
	return x;
}

bool is_prime(int x){
	for (int i = 2; i*i <= x; i++){
		if (!(x%i)) return false;
	}
	return true;
}


int main(){
	int n;
	string s, t;
	cin >> n >> s >> t;
	for (int i = 0; i < n; i++){
		cout << s[i] << t[i];
	}
	cout << endl;
	return 0;
}




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

int isprime(int N){
  int S=(int)sqrt(N);
  int Ans=1;
  if(N==1){
    return 0;
  }
  for(int i=2; i<=S; i++){
    if(N%i==0){
      Ans=0;
      break;
    }
  }
  return Ans;
}

int main(){
  int N;
  cin >> N;
  vector<int> P(1, 0);
  for(int i=1; i<1382; i+=5){
    if(isprime(i)==1){
      P.push_back(i);
    }
  }
  for(int i=1; i<N+1; i++){
    cout << P.at(i) << " ";
  }
  cout << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	int n;
	
	String[] card;
	int[] num;
	int[] stable;
	int flag = 1;
	
	public void input() {
		n = sc.nextInt();
		card = new String[n];
		num = new int[n];
		stable = new int[n];
		
		for(int i=0; i<n; i++) {
			card[i] = sc.next();
			num[i] = sc.nextInt();
			stable[i] = i;
		}
	}
	
	public void quickSort(int[] A, int n, int p, int r) {
		int q;
		if(p < r) {
			q = partition(A, n, p, r);
			quickSort(A, n, p, q-1);
			quickSort(A, n, q+1, r);
		}
	}
	
	public int partition(int[] A, int n, int p, int r) {
		int x = A[r];
		int work = p - 1;
		for(int j=p; j<r; j++) {
			if(A[j] <= x) {
				work++;
				exchange(A, work, j);
			}
		}
		exchange(A, work+1, r);
		return work+1;
	}
	
	public void exchange(int[] A, int x, int y) {
		int swap = A[x];
		A[x] = A[y];
		A[y] = swap;
		
		String change = card[x];
		card[x] = card[y];
		card[y] = change;
		
		swap = stable[x];
		stable[x] = stable[y];
		stable[y] = swap;
	}

	public void solve() {
		for(int i=0; i<n-1; i++) {
			if(num[i] == num[i+1]) {
				if(stable[i] > stable[i+1]) flag = 0;
			}
		}
	}

	public void output() {
		quickSort(num, n, 0 , n-1);
		solve();
		if(flag == 1) System.out.println("Stable");
		else System.out.println("Not stable");
		for(int i=0; i<n; i++) { System.out.println(card[i]+" "+num[i]); }
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.output();
	}
}



Measured memory_bytes: 99216
n=int(input())
s=input()
m=n+5
w=0
e=0
for i in range(1,n):
    if s[i]=='E':
        e+=1
m=min(m,w+e)
for i in range(1,n):
    if s[i-1]=='W':
        w+=1
    if s[i]=='E':
        e-=1
    m=min(m,w+e)
print(m)

Measured memory_bytes: 3828
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1000000007;
const ll N=998244353;
ll power(ll x,ll n){ll res=1;while(n>0){if(n&1) res=res*x%MOD;x=x*x%MOD;n>>=1;}return res;}
ll modinverse(ll a){return power(a, MOD-2);}
void solve()
{
	ll t;
	cin>>t;
	if(t>=30)
		cout<<"Yes\n";
	else
		cout<<"No\n";
}
int main()
{
	#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

int main(){

  int a,b,c,count = 0,count2 = 0;
  char x,y;

  while(cin >> a >> x >> b >> y >> c){

    if(c*c == a*a + b*b) count++;
    else if(a == b) count2++;

  }

  cout << count << endl << count2 << endl;
}

Measured memory_bytes: 1160
using System;
class Program
{
	static void Main(string[] args)
	{
		int c = int.Parse(Console.ReadLine());
		string[] input = Console.ReadLine().Split(' ');
		int sum = 0;
		int max = 0;
      foreach(string i in input)
	{
         int j = int.Parse(i);
        sum += j;
        if(max < j)
          max = j;
      }
		Console.WriteLine(sum>max*2?"Yes":"No");
	}
}


Measured memory_bytes: 11092
n = int(input())
l = [list(map(int, input().split())) for _ in range(2)]

r1 = [sum(l[0][:i+1])for i in range(n)]
r2 = [sum(l[1][i:])for i in range(n)]

max_cnt = 0
for i in range(n):
    cnt = r1[i] + r2[i]
    max_cnt = max(max_cnt, cnt)
print(max_cnt)

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

int main() {
	int N, D, M, T, i;
	cin >> N;
	unordered_map<int, int> a;
	for (i = 0; i < N; ++i) {
		cin >> D;
		if (a.end() == a.find(D)) a[D] = 1;
		else ++a[D];
	}
	cin >> M;
	for (i = 0; i < M; ++i) {
		cin >> T;
		if (a.end() == a.find(T)) break;
		else {
			--a[T];
			if (!a[T]) a.erase(T);
		}
	}
	if (M == i) cout << "YES";
	else cout << "NO";
}

Measured memory_bytes: 8520
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define PB(a,num) FOR(i,0,num) {ll x; scanf("%lld",&x); a.pb(x); }
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define INF 111111111111111111
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef set<ll> SET;
typedef map<ll, ll> MAP;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag, ok;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[8] = { 1,-1,0,0,1,1,-1,-1 }, ddy[8] = { 0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 111111



int main(void) {
  cin >> n;
  ll sm[MAX * 2];
  sm[0] = 0;
  FOR(i, 0, n) {
	cin >> tmp;
	sm[i + 1] = sm[i] + tmp;
  }

  ans = INF;
  FOR(i, 1, n) {
	ans = min(ans, llabs(sm[i] - (sm[n] -sm[i])));
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static System.Console;

namespace ConsoleApp2
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var an = Console.ReadLine().Split().Select(s => int.Parse(s)).ToList();
            var sum = 0;
            for (var i=0;i<N;i++)
            {
                sum = sum ^ an[i];
            }
            Console.WriteLine(0<sum?"No" : "Yes");
        }

    }
}

Measured memory_bytes: 22112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
#define INF (1e9)

int main() {
    ld A, B, H, M, ans = 0;
    cin >> A >> B >> H >> M;
    ans = A * A + B * B - 2 * A * B * (cos(((H + M / 60) / 12 - M / 60) * M_PI * 2));
    cout << fixed << setprecision(15);
    cout << sqrt(ans) << endl;
}


Measured memory_bytes: 4168
import collections

def main():
    S = list(input())
    CS = collections.Counter(S)
    letter = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
    for l in letter:
        if l not in CS:
            print(l)
            return
    print('None')

if __name__ == "__main__":
    main()


Measured memory_bytes: 4332
n,m = map(int,input().split())
li = [0]*n
for i in range(n):
  li[i] = list(map(int,input().split()))
  li[i] = li[i][1:]

ans = 0
for i in range(1,m+1):
  for j in range(n):
    if i in li[j]:
      continue
    else:
      break
  else:
    ans += 1
print(ans)

Measured memory_bytes: 3064
X = int(input())
def is_beki(N):
    for i in range(2,int(N**.5)+1):
        if N%(i**2)==0:
            k = 1
            while k<N:
                k *= i
            if N == k:
                return True
    return False

for x in range(X, 1, -1):
    if is_beki(x):
        print(x)
        break
else:
    print(1)

Measured memory_bytes: 3060
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 100005;
const int mod = 1000000007;

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
   string s,t;
   cin>>s>>t;
   if(s.size()+1==t.size()&&t.substr(0, s.size())==s)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (int i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define fi first
#define se second
#define int long long
using namespace std;
using ll = long long;
using II = pair<int, int>; using VII = vector<II>; using VVII = vector<VII>;
using VI = vector<int>; using VVI = vector<VI>; using VVVI = vector<VVI>;
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, const vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream &s, const vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream &s, const pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, const map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
constexpr int MOD = 1e9 + 7;

signed main() {
  int n; cin >> n;
  VI a(n), b(n);
  REP (i, n) cin >> a[i];
  REP (i, n) cin >> b[i];

  priority_queue<int> x, y;
  REP (i, n) {
    int dif = a[i] - b[i];
    if (dif > 0) {
      x.push(dif);
    }
    if (dif < 0) {
      y.push(-dif);
    }
  }
  int ans = 0;
  int rem = 0;
  while (!y.empty()) {
    ans++;
    int dif = y.top(); y.pop();
    dump(dif);
    int use = min(rem, dif);
    dif -= use;
    rem -= use;
    while (dif > 0) {
      if (x.empty()) {
        cout << -1 << endl; return 0;
      }
      ans++;
      rem += x.top(); x.pop();
      int use = min(rem, dif);
      dif -= use;
      rem -= use;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 2936
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (String.valueOf(n).contains("7")) {
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }

}


Measured memory_bytes: 35752
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, q, c;
string s;
int cnt[500010][26];
queue<pair<int, pair<char, char>>> que;

signed main() {
	cin >> n >> s >> q;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 26; j++) {
			if (j == s[i] - 'a')cnt[i + 1][j] = cnt[i][j] + 1;
			else cnt[i + 1][j] = cnt[i][j];
		}
	}
	for (int i = 0; i < q; i++) {
		cin >> c;
		if (c == 1) {
			int d;
			char e;
			cin >> d >> e;
			que.push({ d - 1,{s[d - 1],e} });
			s[d - 1] = e;
		}
		else {
			int d, e;
			cin >> d >> e;
			int cnt2[26], cnt3[26];
			for (int j = 0; j < 26; j++) {
				cnt2[j] = cnt[d - 1][j];
				cnt3[j] = cnt[e][j];
			}
			int x = (int)que.size();
			for (int j = 0; j < x; j++) {
				pair<int, pair<char, char>> p = que.front(); que.pop();
				if (d - 2 >= p.first) {
					cnt2[p.second.first - 'a']--;
					cnt2[p.second.second - 'a']++;
				}
				if (e - 1 >= p.first) {
					cnt3[p.second.first - 'a']--;
					cnt3[p.second.second - 'a']++;
				}
				que.push(p);
			}
			int cnt4 = 0;
			for (int j = 0; j < 26; j++) {
				if (cnt3[j] - cnt2[j] != 0) {
					cnt4++;
				}
			}
			cout << cnt4 << endl;
		}
	}
}

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

long long GCD(long long x,long long y){
  if(y == 0) return x;
  return GCD(y,x%y);
}

long long f(long long a){
  long long t = 0;
  while(a%2 == 0){
    a/=2;
    t++;
  }
  return t;
}

int main() {
  long long n,m;
  cin >> n >> m;
  vector<long long>a(n);
  for(long long i = 0;i < n;i++){
    long long s;
    cin >> s;
    a[i] = s/2;
  }
  long long t = f(a[0]);
  for(int i = 0;i < n;i++){
    if(f(a[i]) != t){
      cout << 0 << endl;
      return 0;
    }
    a[i] >>= t;
  }
  m >>= t;
  long long lcm = 1;
  for(long long i = 0;i < n;i++){
    lcm = lcm*a[i]/GCD(lcm,a[i]);
    if(lcm > m){
      cout << 0 << endl;
      return 0;
    }
  }
  m /= lcm;
  int ans = (m+1)/2;
  cout << ans << endl;
}


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

struct Card { 
	char suit ,value;
};

void BubbleSort(Card C[], int N) {
	Card temp;
	for (int i = 0; i < N; i++) {
		for (int j = N-1; j >= i; j--) {
			if (C[j - 1].value > C[j].value) {
				temp = C[j - 1];
				C[j - 1] = C[j];
				C[j] = temp;
			}
		}
	}
}


void SelectionSort(Card C[], int N) {
	Card temp;
	int minj;
	for (int i = 0; i < N; i++) {
		minj = i;
		for (int j = i; j < N; j++) {
			if (C[minj].value > C[j].value) {
				minj = j;
			}
		}
		temp = C[i];
		C[i] = C[minj];
		C[minj] = temp;
	}

}

int main(void) {
	int N;
	Card A[101];
	cin >> N;
	char input;
	for (int i = 0; i < N; i++) cin >> A[i].suit >> A[i].value;

	Card B[101];
	for (int i = 0; i < N; i++) B[i] = A[i];
	BubbleSort(B, N);
	for (int i = 0; i < N-1; i++) cout << B[i].suit << B[i].value << " ";
	cout << B[N-1].suit << B[N-1].value << endl;
	cout << "Stable" << endl;

	Card C[101];
	for (int i = 0; i < N; i++) C[i] = A[i];
	SelectionSort(C, N);
	for (int i = 0; i < N-1; i++) cout << C[i].suit << C[i].value << " ";
	cout << C[N-1].suit << C[N-1].value << endl;

	bool check = true;
	for (int i = 0; i < N; i++) {
		if (B[i].suit != C[i].suit) {
			check = false;
			break;
		}
		if (B[i].value != C[i].value) {
			check = false;
			break;
		}
	}
	if (check) {
		cout << "Stable" << endl;
	}
	else {
		cout << "Not stable" << endl;
	}

	return 0;
}


Measured memory_bytes: 3128