akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a,ll b,int m) {
    if (b==0) return 1;
    ll c = power(a,b>>1,m);
    c = (c*c)%m;
    if (b&1) return (c*a)%m;
    return c;
}
ll powerwithoutmod(ll a,ll b) {
    if (b==0) return 1;
    ll c = powerwithoutmod(a,b>>1);
    c = (c*c);
    if (b&1) return (c*a);
    return c;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)2e5+5;
const int Q = 301;
const int logN = 16;

void solve() {
    int n;
    cin>>n;
    cout<<(n+1)/2;
}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
/*
g++ -std=c++11 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG nikkei2019/d.cpp
*/
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

typedef struct node_{
    vector<int> pre;
    vector<int> nx;
    int nprev;
    int nnext;
    int depth;
    int parent;
    int visited;
}* node;

vector<node> g;
vector<int> l;

void visit(int n){
    if(g[n] -> visited == 0){
        g[n] -> visited = 1;
        rep(i, g[n] -> nnext){
            visit(g[n] -> nx[i]);
        }
        l.push_back(n);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);//おまじないでcin, cout早くする
    int n, m;
    cin >> n >> m;
    g.resize(n);
    rep(i, n){
        node nd = new node_;
        g[i] = nd;
        g[i] -> nprev = 0;
        g[i] -> nnext = 0;
        g[i] -> depth = -1;
        g[i] -> parent = -1;
        g[i] -> visited = 0;
    }

    rep(i, n - 1 + m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a] -> nx.push_back(b);
        g[b] -> pre.push_back(a);
        g[a] -> nnext++;
        g[b] -> nprev++;
    }
    rep(i, n){
        visit(i);
    }
    int root = l[n - 1];
    g[l[n - 1]] -> parent = 0;
    g[l[n - 1]] -> depth = 0;
    for(int i = n - 2; i >= 0; i--){
        node nd = g[l[i]];
        rep(j, nd->nprev){
            if(nd->depth < g[nd->pre[j]]->depth + 1){
                nd->depth = g[nd->pre[j]]->depth + 1;
                nd->parent = nd->pre[j];
            }
        }
    }

    rep(i, n){
        if(i == root) cout << 0 << "\n";
        else cout << g[i] -> parent + 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 19452
#include <bits/stdc++.h>
  #define hell                         1000000007 
  #define M                            1000000007
  #define Maxi                      10000000000000000
      #define lcm(a,b)                     (a*b)/__gcd(a,b)
      #define ll                           long long

      #define vll                          vector<ll>
      #define vi                           vector<long long>
      #define pll                          vector< pair<ll,ll> >
      #define pb                           push_back
      //#define mp                           make_pair
      #define all(v)                       v.begin(),v.end()
      #define lbnd                         lower_bound
      #define ubnd                         upper_bound
      #define bs                           binary_search
      #define F                            first
      #define S                            second
      #define rep(i,a,b)                   for(i=a;i<b;i++)
      #define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
      #define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
      #define ret(x)                       return cout<<x,0;
      #define dbg(x)                       cout << #x << " is " << x << endl;
      //#define endl                           '\n'
   
   
      // Debug //
   
      #define trace(x)                 cerr << #x << ": " << x << endl;
      #define trace1(x)                cerr << #x << ": " << x << endl;
      #define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
      #define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
      #define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
      #define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
      #define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;


  using namespace std;




  int main()
  {

        ios_base::sync_with_stdio(false);
        cin.tie(NULL);cout.tie(NULL);
      
        
        ll n;
        cin>>n;
        ll i,j;
        ll a[n];
        rep(i,0,n)
        {
          cin>>a[i];
        }
        
        if(n==1)
        {
          cout<<"Yes"<<endl;
          return 0;
        }
        a[0]--;
        ll f=0;
        rep(i,1,n)
        {
          if(a[i]>a[i-1])
          {
            a[i]--;
          }
          else if(a[i]<a[i-1])
          {
            f=1;
          }
        }
        if(f==1)
        {
          cout<<"No"<<endl;
          return 0;
        }
        else
        {
          cout<<"Yes"<<endl;
        }
    return 0;

        
    }



  //10773275
  //4306643

Measured memory_bytes: 1024
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn main() {
    let n: usize = read();
    let w: Vec<i32> = (0..n).map(|_| read::<i32>()).collect();

    let ans = (1.. n).map(|t| {
        let s1 = &w[0..t].iter().fold(0, |a, b| a + *b);
        let s2 = &w[t..].iter().fold(0, |a, b| a + *b);
        (s1 - s2).abs()
    }).min().unwrap();

    println!("{}", ans);
}


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

bool judge(string s){
  int n = s.size();
  if(n%2==0){
    for(int i=0;i<=(n-1)/2;i++){
      if(s[i] != s[n-1-i]){
        return false;
      }
    }
  }else{
    for(int i=0;i<(n-1)/2;i++){
      if(s[i] != s[n-1-i]){
        return false;
      }
    }
  }
  return true;
}

int main(){
  string s;
  cin >> s;
  int n = s.size();
  string a = s.substr(0,(n-1)/2);
  string b = s.substr((n-1)/2+1);

  bool f1=false,f2=false,f3=false;
  f1 = judge(s);
  f2 = judge(a);
  f3 = judge(b);

  if(f1==true&&f2==true&&f3==true) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main(int argc, char const *argv[])
{
	int a[3][3]; rep(i, 3)rep(j, 3) cin >> a[i][j];
	int n; cin >> n;
	vector<int> b(n); rep(i, n) cin >> b[i];
	rep(i, n)rep(j, 3)rep(k, 3) {
		if (a[j][k] == b[i]) {
			a[j][k] = 0;
		}
	}

	bool flag = false;
	rep(i, 3) {
		if (a[i][0] == 0 and a[i][1] == 0 and a[i][2] == 0) {
			flag = true;
		}
		if (a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0) {
			flag = true;
		}
	}
	if (a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0) {
		flag = true;
	}
	if (a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0) {
		flag = true;
	}
	cout << (flag ? "Yes" : "No") << endl;
	return 0;
}


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

using namespace std;

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

  string s, t;
  cin >> s >> t;

  string ans = "No";
  for (unsigned int i = 0; i < s.size(); ++i) {
    // cerr << s << '\n';
    if (s == t) {
      ans = "Yes";
      break;
    }
    char tmp = s[0];
    for (unsigned int i = 0; i < s.size() - 1; ++i) {
      s[i] = s[i + 1];
    }
    s[s.size() - 1] = tmp;
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
 
/* Coding Space*/
template<class T>
struct BIT{
    vector<T> d;
    BIT(size_t n):d(n+1){}
    T sum(size_t i){T s{};for(++i;i>0;i-=i&-i)s+=d[i];return s;}
    T sum(size_t i,size_t j){return i?sum(j)-sum(i-1):sum(j);}
    void add(size_t i,T x){for(++i;i<d.size();i+=i&-i)d[i]+=x;}
};
 
vi zip(vector<ll> v){
  vector<ll> v2 = v;
  vi ret;
  sort(ALL(v2));
  rep(i,v.size())
    ret.pb(int(lower_bound(ALL(v2),v[i])-v2.begin())+1);
  return ret;
}
 
int main(){
  int n,k; cin >> n >> k;
  BIT<ll> bit(n+1);
  vector<ll> vl;
  rep(i,n){
    ll in; cin >> in;
    vl.pb(in-k);
  }
  for(int i=1; i < n;i++)
    vl[i] = vl[i] + vl[i-1];
  vi z = zip(vl);
 
  ll ans = 0;
  for(int i = 0; i < n; i++){
    if(vl[i]  >= 0) ans++;
    ans += bit.sum(z[i]);
    bit.add(z[i],1);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8304
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n,p;
  cin>>n>>p;
  vint a(n);
  ll ki=0,gu=0;
  rep(i,n){
    cin>>a[i];
    if(a[i]%2==0){
      gu++;
    }
    else{
      ki++;
    }
  }
  ll sum=0;
  if(p==0){
    if(ki==0){
      sum=pow(2,n);
    }
    else{
      sum=pow(2,n-1);
    }
  }
  else{
    if(ki==0){
      sum=0;
    }
    else{
      sum=pow(2,n-1);
    }
  }
  cout<<sum<<'\n';
  return(0);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}



	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}


	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}


	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}


	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 int N=sc.nextInt();
	 long[] A=new long[N];
	 for(int i=0;i<N;i++) {
		 A[i]=sc.nextLong();
	 }
	 long g = lcm_n(A);
	 System.out.println(g);

	 
	 
 }
	


}


Measured memory_bytes: 23380
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

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

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/

#define MAX_V 100010

// 
vector<pair<ll, ll>> G[MAX_V];
vector<bool> used(MAX_V, false);
vector<int> color(MAX_V, 2);

void dfs(int from) {
	rep(i, (int)G[from].size()) {
		int to = G[from][i].first;
		if (!used[to]) {
			if (G[from][i].second % 2 == 0) {
				color[to] = color[from];
			}
			else {
				color[to] = 1 - color[from];
			}
			used[to] = true;
			dfs(to);
		}
	}
}

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

	int n;
	cin >> n;
	vector<int> u(n - 1), v(n - 1);
	vector<ll> w(n - 1);
	rep(i, n - 1) {
		cin >> u[i] >> v[i] >> w[i];
		G[u[i] - 1].push_back({ v[i] - 1,w[i] });
		G[v[i] - 1].push_back({ u[i] - 1, w[i] });
	}

	// 一つ決めてそれからたどる
	color[0] = 0;
	used[0] = true;
	dfs(0);
	//rep(i, (int)G[0].size()) {
	//	dfs(G[0][i].first);
	//}

	rep(i, n) {
		if (color[i] != 2) {
			cout << color[i] << endl;
		}
		else {
			cout << 0 << endl;
		}
	}

	cout << endl;

	return 0;
}


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

int main(){
    int a, b, k;
    vector<int> num;
    cin >> a >> b >> k;
    for(int i=1;i<=100;i++){
        if(a % i == 0 && b % i == 0){num.push_back(i);}
    }
    sort(num.begin(), num.end(), greater<int>());
    cout << num[k-1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    int mod = 1000000007;
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        sum += A[i];
        sum %= mod;
    }
 
    long ans = 0;
 
    //i について全探索する
    for (int i = 0; i < N; i++)
    {
        //A[i+1] ... A[N] の値を更新する
        sum -= A[i];
        if (sum < 0) sum += mod;
 
        ans += A[i] * sum;
        ans %= mod;
    }
 
    cout << ans << endl;
}

Measured memory_bytes: 3960
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ll long long
#define MOD 1000000007
#define INF 2000000001
using namespace std;

int n, m, o, k, l = 1, ans;
vector<int> v[100001];
int main() {
	cin >> n >> m >> o >> k;
	ans = n + m + o - max({ n,m,o });
	rep(i, k) {
		l *= 2;
	}
	ans += max({ n,m,o })*l;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
import sys
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
read = sys.stdin.read
readline = sys.stdin.readline

N, M, R = map(int, readline().split())
r = list(map(int, readline().split()))
ABC = map(int, read().split())

INF = float('inf')
graph = [[INF] * (N + 1) for _ in range(N + 1)]

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

for A, B, C in zip(*[iter(ABC)] * 3):
    graph[A][B] = C
    graph[B][A] = C

distance = floyd_warshall(graph)
answer = 10 ** 9
for tour in permutations(r):
    tmp = 0
    for i, j in zip(tour, tour[1:]):
        tmp += distance[i][j]

    if tmp < answer:
        answer = tmp

print(int(answer))

Measured memory_bytes: 30860
from collections import Counter
MOD=2019
S=input();N=len(S)
Cum=[0]*(N+1)
for i in range(N):
    Cum[i+1]=(Cum[i]+int(S[N-i-1])*pow(10,i,MOD))%MOD
res=0
c=Counter(Cum).most_common()
for a,b in c:
    res+=b*(b-1)//2
    if(b==1):
        break
print(res)

Measured memory_bytes: 16668
//sppsfver - 05.08.2020
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pll = pair <ll, ll>;

ll n, a, ans = 1;
bool flag, zero;

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

    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> a;
        if (a == 0) return cout << 0 << endl, 0;
        a <= 1000000000000000000/ans ? ans *= a : flag = 1;
    }
    cout << (flag ? -1 : ans) << endl;
	return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define mem0(x) memset(x, 0, sizeof(x))
#define asort(x) sort(x.begin(), x.end());
#define dsort(x, t) sort(x.begin(), a.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back

int main() {
    ll N, hp;
    ll ans = 100000000000LL;
    cin >> N;
    int X[101];
    for(ll i = 0; i < N; i++) {
        cin >> X[i];
    }
    for(ll i = 1; i <= 100; i++) {
        hp = 0;
        for(ll j = 0; j < N; j++) {
            hp += pow((X[j] - i), 2);
        }
        ans = min(ans, hp);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int i,l,r,d;
	scanf("%d %d %d",&l,&r,&d);
	int count=0;
	for(i=l;i<=r;i++)
	{
		if(i%d==0)
		{
			count++;
		}
	}
	printf("%d",count);
}

Measured memory_bytes: 1728
import java.util.Scanner;

class Main{
  public static void main(String arg[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();

    if(a+b+c==17){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }  
  }
}

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

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   	int N,K;
   	cin>>N>>K;
   	ll sum1=0,sum2=0,index1=0,index2=N,ans=0;
   	for(int i=1;i<=N+1;i++)
   	{
   		sum1+=index1;
   		sum2+=index2;
   		index1++;
   		index2--;
   		if(i>=K)
   			ans=(ans+sum2-sum1+1)%mod;
   		//cout<<ans<<" ";
   	}
   	cout<<ans<<endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>


int main(){
  int N;
  long long A, B;
  scanf("%d", &N);
  scanf("%lld", &A);
  scanf("%lld", &B);
  std::vector<int > h(N);
  for (int i=0; i<N; i++){
    scanf("%d", &h[i]);
  }
  long long min=0;
  long long max=1e10;
  auto check = [&](long long k){
    long long cnt = 0;
    for (int i=0; i<N; i++){
      if (h[i]<=k*B) continue;
      long long hh = h[i]-k*B;
      cnt += (hh+A-B-1)/(A-B);
    }
    return cnt<=k;
  };
  while(max-min>1){
    long long mid = (min+max)/2;
    if (check(mid)) max=mid;
    else min=mid;
  }
  std::cout << max << std::endl;
  return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void){
	string s;
	cin >> s;
	const int n = s.size();

	vector<int> ary;
	int st = 0;
	
	rep(i, n){
		if(st == 0){
			if(s[i] == 'A'){
				st = 0;
				ary.push_back(1);
			}
			if(s[i] == 'B'){
				st = 1;
			}
			if(s[i] == 'C'){
				st = 0;
				ary.push_back(2); 
			}
		} else {
			if(s[i] == 'A'){
				st = 0;
				ary.push_back(2);
				ary.push_back(1);
			}
			if(s[i] == 'B'){
				st = 1;
				ary.push_back(2);				
			}
			if(s[i] == 'C'){
				st = 0;
				ary.push_back(0);
			}
		}
	}

	if(st == 1) ary.push_back(2);

	ll ans = 0LL;
	const int m = ary.size();

	ll last = -1LL;
	rrep(i, m){
		if(ary[i] == 2){
			last = -1;
			continue;
		}

		if(last == -1) last = i;
		if(ary[i] == 1){
			ans += abs(last - i);
			last--;
		}
	}

	cout << ans << endl;

	return 0;
}

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

template <typename T> T load() { T r; cin >> r; return r; }
template <typename T> vector<T> loadMany(int n) { vector<T> rs(n); generate(rs.begin(), rs.end(), &load<T>); return rs; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    auto n = load<int>();
    auto k = load<int>();
    auto jumps = loadMany<int>(n);
    auto dyn = vector<int>(k+1);
    dyn[0] = 0;
    for (auto i=1; i<=k; ++i) {
        auto reach = vector<bool>(n+1, false);
        for (auto l : jumps)
            if (i-l >= 0)
                reach[dyn[i-l]] = true;
        auto mex = (int)(find(reach.begin(), reach.end(), false) - reach.begin());
        dyn[i] = mex;
    }
    cout << (dyn[k] == 0 ? "Second\n" : "First\n");
}


Measured memory_bytes: 640
#include <numeric>
#include <iostream>
#include <array>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <math.h> 
#include <set>
#include <map>
#include <utility>
#include <deque>
#include <queue>
#include <iomanip>

using namespace std;

#define ll long long int
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repp(i, n) for(ll i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
#define all(a)  (a).begin(),(a).end()
using vi = vector<int>;
using vs = vector<string>;
using vc = vector<char>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vb = vector<bool>;
using vvb = vector<vb>;
const ll MOD = 1e9 + 7;
set<char> alphabet = { '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' };

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    tuple<double, int, int> ans(0, 100 * A, 0);

    for (int i = 0; 100 * A * i <= F; i++) {
        for (int j = 0; 100 * A * i + 100 * B * j <= F; j++) {
            for (int k = 0; 100 * A * i + 100 * B * j + C * k <= F; k++) {
                for (int l = 0; 100 * A * i + 100 * B * j + C * k + D * l <= F; l++) {
                    int water = 100 * A * i + 100 * B * j;
                    int sugar = C * k + D * l;
                    int all = water + sugar;
                    if (100 * sugar <= E * water && all > 0) {
                        double max = get<0>(ans);
                        double d = sugar*100.0 / all;
                        if (max < d) {
                            ans = make_tuple(d, all, sugar);
                        }
                    }
                }
            }
        }
    }
    cout<< get<1>(ans) << " " << get<2>(ans) << endl;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
S = [input() for i in range(H)]

dxy = [(1,0),(1,1),(0,1),(-1,1),(-1,0),(-1,-1),(0,-1),(1,-1)]

ans = [''] * H
for y in range(H):
    for x in range(W):
        if S[y][x] == '#':
            ans[y] += '#'
        else:
            b = 0
            for dx,dy in dxy:
                nx,ny = x+dx, y+dy
                if not 0 <= nx < W: continue
                if not 0 <= ny < H: continue
                if S[ny][nx] == '#':
                    b += 1
            ans[y] += str(b)

print(*ans,sep='\n')

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

def get(K: int, X: int, Y: int):
    p = None
    if X >= K:
        X -= K
        p = [K, 0]
    elif Y >= K:
        Y -= K
        p = [0, K]
    else:
        if X + Y >= K:
            p = [X, K - X]
            Y -= K - X
            X = 0
        else:
            p = [-K, 0]
            X += K
    return p, X, Y

def jump_two(K: int, X: int, Y: int):
    assert(X + Y < 2 * K)
    if X + Y == 0:
        return []
    elif X + Y == K:
        return [(X, Y)]
    ret = []
    rev = False
    if X > Y:
        X, Y = Y, X
        rev = True
    a = K - (Y - X)//2
    b = K - (Y + X)//2
    assert(0 <= a and a <= K)
    assert(0 <= b and b <= K)
    ret.append([a, K - a])
    ret.append([-b, K - b])
    if rev:
        for i in range(len(ret)):
            ret[i][0], ret[i][1] = ret[i][1], ret[i][0]
    return ret

def calc(K: int, X: int, Y: int):
    ret = []
    if X + Y < K:
        if (X + Y) % 2 != 0:
            # 3
            p, X, Y = get(K, X, Y)
            ret.append(p)
        ret += jump_two(K, X, Y)
        return ret
    while X + Y >= K * 2:
        p, X, Y = get(K, X, Y)
        ret.append(p)
    if X + Y == K:
        # 1
        ret.append([X, Y])
    else:
        # K * 2 > X + Y > K
        if (X + Y) % 2 != 0:
            p, X, Y = get(K, X, Y)
            ret.append(p)

        ret += jump_two(K, X, Y)
    return ret


def solve(K: int, X: int, Y: int):
    if K % 2 == 0 and (X + Y) % 2 != 0:
        print(-1)
        return
    negate_X = False
    negate_Y = False
    if X < 0:
        X *= -1
        negate_X = True
    if Y < 0:
        Y *= -1
        negate_Y = True
    v = calc(K, X, Y)
    for i in range(len(v)):
        if negate_X:
            v[i][0] *= -1
        if negate_Y:
            v[i][1] *= -1
    x = 0
    y = 0
    print(len(v))
    for dx, dy in v:
        x += dx
        y += dy
        print(x, y)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(K, X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 26016
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

/* see https://github.com/pllk/cphb/
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
    tree_order_statistics_node_update> indexed_set;
 **/

typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

//typedef __int128 lll;
typedef pair<int, int> pii;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;

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

    cout<<3*n*n<<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;

vector<int>to[10];
int n,m,ans;

void dfs(int v, int p, vector<bool>x, vector<int>y){
    if(x[v])return;
    y.push_back(v);
    x[v]=true;
    for(int u:to[v]){
        if(u==p)continue;
        dfs(u,v,x,y);
    }
    if(y.size()==n)ans++;
}

int main(){
    cin>>n>>m;
    rep(i,m){
        int a,b; cin>>a>>b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    dfs(0,-1,vector<bool>(n,false),vector<int>());
    cout<<ans<<endl;
}

Measured memory_bytes: 3644
#include <array>
#include <vector>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <tuple>
#include <utility>
#include <limits>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

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

constexpr int N = 1000;

int dp[N+1][N+1];

int solve(const string& x, const string& y)
{
    int m = x.size();
    int n = y.size();

    FOR(i, 0, m+1)
        dp[i][0] = 0;
    FOR(j, 0, n+1)
        dp[0][j] = 0;

    FOR(i, 1, m+1) {
        FOR(j, 1, n+1) {
            if(x[i-1] == y[j-1])
                dp[i][j] = dp[i-1][j-1] + 1;
            else
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }

    return dp[m][n];
}

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

    REP(_, n) {
        string x, y;
        cin >> x;
        cin >> y;

        int lcs_len = solve(x, y);
        cout << lcs_len << "\n";
    }

    return 0;
}

Measured memory_bytes: 7052
#include <bits/stdc++.h>
using namespace std;
 
signed main () {
	int n;
	cin >> n;
	string s;
	cin >> s;
	map < char, int > xyu;
	xyu['R'] = 0;
	xyu['G'] = 1;
	xyu['B'] = 2;
	vector < vector < int > > pref(n + 1, vector < int > (3, 0));
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < 3; ++j)
			pref[i + 1][j] = pref[i][j];
		++pref[i + 1][xyu[s[i]]];
	}
	long long ans = 0;
	for (int i = 1; i < n - 1; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (s[i] != s[j]) {
				if (j - i > i) {
					set < char > ij;
					ij.insert(s[i]);
					ij.insert(s[j]);
					char our;
					if (ij.find('R') == ij.end())
						our = 'R';
					else if (ij.find('G') == ij.end())
						our = 'G';
					else 
						our = 'B';
					ans += pref[i][xyu[our]];
				}
				else if (s[i - (j - i)] != s[i] && s[i - (j - i)] != s[j])
					ans += pref[i][xyu[s[i - (j - i)]]] - 1;
				else {
					set < char > ij;
					ij.insert(s[i]);
					ij.insert(s[j]);
					char our;
					if (ij.find('R') == ij.end())
						our = 'R';
					else if (ij.find('G') == ij.end())
						our = 'G';
					else 
						our = 'B';
					ans += pref[i][xyu[our]];
				}
			}
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 3860
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

from heapq import *

n,m = [int(i) for i in readline().split()]
ab = [[int(i) for i in readline().split()] for _ in range(n)]

ab.sort(reverse = True)

q = []
ans = 0
for i in range(m-1,-1,-1):
    while ab and ab[-1][0] + i <= m:
        (a,b) = ab.pop()
        heappush(q,-b)
    
    if q: ans -= heappop(q)

print(ans)

Measured memory_bytes: 21900
#include <iostream>

using namespace std;

long long int N,M,K;
//sumAはA1~Aiまでの和、sumBも同様
long long int A[200200],B[200200],sumA[200200]={},sumB[200200]={};


int main(){

  
    cin>>N>>M>>K;
    for(long long int i = 1; i <= N; i++){
        cin>>A[i];
        sumA[i]=sumA[i-1]+A[i];
    }
    for(long long int i = 1; i <= M; i++){
        cin>>B[i];
        sumB[i]=sumB[i-1]+B[i];
    }
    //resは答えを記録する変数
    long long int res=0;

    //Aの机からi冊読むとき
    for(long long int i = 0; i <= N; i++){
        //KnokoriはBの机の本にかけられる時間
        long long int Knokori=K-sumA[i];
        //負になってはいけません
        if(Knokori<0){continue;}
        
        //0冊は読めるし、M+1冊は読めない。ここから二分探索で境目を求める。
        long long int ok=0,ng=M+1,mid;

        //最終的にはngとokが1違うようになれば終了
        while((ng-ok)>1){
            mid=(ok+ng)/2;
            //1~midまでの本をBの机から読めたらok、読めなかったらng
            if(sumB[mid]<=Knokori){
                ok=mid;
            }else{
                ng=mid;
            }
        }
        
        //iはAの机から読む本の数、okはBの机から読む本の数
        res=max(res,i+ok);
    }
    cout<<res<<endl;
    
}



Measured memory_bytes: 9880
#include <stdio.h>

void dfs(char used[],char result[],int num,int n){
    int i;
    
    if(num==n){
        for(i=0;i<n-1;i++)printf("%d ",result[i]);
        printf("%d\n",result[i]);
        return;
    }
    
    for(i=1;i<=n;i++){
        if(used[i]==1)continue;
        
        result[num]=i;
        used[i]=1;
        
        dfs(used,result,num+1,n);
        
        used[i]=0;
    }
}
int main(){
    int i;
    
    int n;
    scanf("%d\n",&n);
    
    char used[n];
    for(i=0;i<n;i++)used[i]=0;
    char result[n];
    
    dfs(used,result,0,n);
    
    return 0;
}


Measured memory_bytes: 2048
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();

    if (c>=a) {
      if (c<=b) {
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 21716
from collections import Counter
n = int(input())
v = [int(x) for x in input().split()]

cnt_even = Counter(v[0::2])
cnt_odd = Counter(v[1::2])

# [(要素, 出現回数), (要素, 出現回数), ....]
common_even = cnt_even.most_common()
common_odd = cnt_odd.most_common()
common_even.append((0, 0))
common_odd.append((0, 0))

# 偶数番目に一番多く現れる数と奇数番目に一番多く現れる数が異なる
if common_even[0][0] != common_odd[0][0]:
    ans = n - common_even[0][1] - common_odd[0][1]
else:
    ans = min(n - common_even[1][1] - common_odd[0][1], \
              n - common_even[0][1] - common_odd[1][1])

print(ans)

Measured memory_bytes: 21184
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main(){
	FIO
	
	int n, a;
	cin >> n >> a;
	n %= 500;
	if(a >= n)puts("Yes");
	else puts("No");
	return 0; 
}


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

int main()
{
    int N;
    string S;
    cin >> N >> S;
    string ans;
    int skip_count = 0;
    rep(i, S.size())
    {
        if (S[i] == '(')
            skip_count++;
        else
        {
            if (skip_count == 0)
                ans += '(';
            else
                skip_count--;
        }
    }
    ans += S;

    skip_count = 0;
    rep(i, S.size())
    {
        if (S[N - i - 1] == ')')
            skip_count++;
        else
        {
            if (skip_count == 0)
                ans += ')';
            else
                skip_count--;
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pll, int> plp;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const bool debug = 0;
//--------------------------------//

int N, K, D, R;
int f[50000][4];
vector<int> g[50000];
int cnt[50000];
int et[4], er[50001];
pll pri[50000][24];
map<int, int> ord;
bool done[50000];

inline int convert(int *a, int n) {
	int res = 0;
	for (int i = n - 1; i >= 0; i--) res = res * 10 + a[i];
	return res;
}

int main() {
	cin >> N >> K;
	int tmp[4] = {1,2,3,4};
	do {
		ord[convert(tmp, K)] = ord.size() - 1;
	} while (next_permutation(tmp, tmp + K));
	
	REP(i, N) REP(j, K) scanf("%d", &f[i][j]), f[i][j]--;
	cin >> D;
	REP(i, D) {
		int a, b;
		scanf("%d %d", &a, &b);
		g[a - 1].push_back(b - 1);
		cnt[b - 1]++;
	}
	REP(i, K) scanf("%d", et + i);
	cin >> R;
	
	memset(er, -1, sizeof(er));
	REP(i, R) {
		int m;
		scanf("%d", &m);
		REP(j, K) scanf("%d", tmp + j);
		er[m] = ord[convert(tmp, K)];
	}
	
	REP(i, N) {
		for (map<int, int>::iterator it = ord.begin(); it != ord.end(); ++it) {
			memset(tmp, 0, sizeof(tmp));
			
			tmp[0] = f[i][it->fi%10 - 1];
			if (K >= 2) tmp[1] = f[i][it->fi/10%10 - 1];
			if (K >= 3) tmp[2] = f[i][it->fi/100%10 - 1];
			if (K >= 4) tmp[3] = f[i][it->fi/1000 - 1];
			
			pri[i][it->se] = pll(tmp[0]*100000ll+tmp[1], tmp[2]*100000ll+tmp[3]);
		}
	}
	
	priority_queue<plp> pq[24];
	REP(i, N) if (cnt[i] == 0) {
		REP(j, 24) pq[j].push(plp(pri[i][j], i));
	}
	
	vector<int> ans;
	
	int e = ord[convert(et, K)];
	int fcnt = 0;
	while (!pq[e].empty()) {
		int pos = pq[e].top().se;
		pll tttt = pq[e].top().fi;
		
		pq[e].pop();
		if (done[pos]) continue;
		done[pos] = true;
		
		ans.push_back(pos + 1);
		
		REP(i, g[pos].size()) if (--cnt[g[pos][i]] == 0) {
			REP(j, 24) pq[j].push(plp(pri[g[pos][i]][j], g[pos][i]));
		}
		
		fcnt++;
		if (er[fcnt] != -1) e = er[fcnt];
	}
	
	REP(i, ans.size()) printf("%d\n", ans[i]);
	
	return 0;
}

Measured memory_bytes: 53600
import numpy as np
N, W = map(int, input().split())
dp = np.zeros(W + 1, dtype=int)

wv = [list(map(int, input().split())) for _ in range(N)]

# その重みを超えないように選んだ時の最大価値
for w, v in wv:
    np.maximum(dp[w:], dp[:-w] + v, out=dp[w:])

print(dp[W])

Measured memory_bytes: 14604
#include<stdio.h>
int a[10] = {0};
int main()
{
    int b,c,d;
    scanf("%d%d%d",&b,&c,&d);
    a[b]++;
    a[c]++;
    a[d]++;
    if(a[5] == 2 && a[7]==1){
        printf("YES");
    }
    else{
        printf("NO");
    }
    return 0;

}

Measured memory_bytes: 128
#include<stdio.h>

#define N 100000

int Partition(int A[],int p,int r);


int main(){
    int i,n,A[N],q;
    
    scanf("%d",&n);
    for(i=0; i<n; i++) scanf("%d",&A[i]);
    
    q = Partition(A,0,n-1);
    
    for(i=0; i<n; i++){
        if(i==q) printf("[%d] ",A[i]);
        else if(i==n-1) printf("%d\n",A[i]);
        else printf("%d ",A[i]);
    }
    
    return 0;
}


int Partition(int A[],int p,int r){
    int i,j,x,tmp;
    
    x = A[r];
    i = p-1;
    
    for(j=p; j<=r-1; j++){
        if(A[j]<=x){
            i++;
            tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
        }
    }
    
    tmp = A[i+1];
    A[i+1] = A[r];
    A[r] = tmp;
    
    return i+1;
}

Measured memory_bytes: 992
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

int compare(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void)
{
    char n[4];
    int i;
    scanf("%s",n);
    for(i=0;i<3;++i){
        if(n[i]=='9')n[i]='1';
        else if(n[i]=='1')n[i]='9';
    }
    puts(n);
    return 0;
}

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

int main(){
    long long N;
    cin >> N;
    
    vector<pair<long long, long long>> R(N);
    vector<pair<pair<long long, long long>, bool>> B(N);
    for(long long i = 0; i < N; ++i)cin >> R[i].first >> R[i].second;
    for(long long i = 0; i < N; ++i)cin >> B[i].first.second >> B[i].first.first;
    
    sort(R.rbegin(), R.rend());
    sort(B.begin(), B.end());
    
    long long ans(0);
    
    for(auto r : R){
        for(auto& b : B){
            if(!b.second){
                if(b.first.second > r.first && b.first.first > r.second){
                    ++ans;
                    b.second = true;
                    break;
                }
            }
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    ll n;cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll tot=0;
    rep(i,n)tot^=a[i];
    vector<ll> b(n);
    rep(i,n) {
        b[i]=tot^a[i];
        cout<<b[i]<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 6400
use std::io::*;
const MOD: u64 = 1_000_000_007;

fn upper_bound<T: PartialOrd>(x: T, a: &Vec<T>) -> usize {
    let mut l: usize = 0;
    let mut r: usize = a.len();
    while r != l {
        let mid = (l + r) >> 1;
        if a[mid] > x {
            r = mid;
        } else {
            l = mid + 1;
        }
    }
    l
}

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let mut a: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse::<usize>().unwrap() - 1)
        .collect();
    a.dedup();
    let n = a.len();
    let mut pos: Vec<Vec<usize>> = vec![Vec::new(); 200002];
    for i in 0..n {
        pos[a[i]].push(i);
    }

    let mut dp: Vec<u64> = vec![0; n + 1];
    dp[0] = 1;
    for i in 0..n {
        let next = upper_bound(i, &pos[a[i]]);
        if next != pos[a[i]].len() {
            // use
            dp[pos[a[i]][next]] += dp[i];
            dp[pos[a[i]][next]] %= MOD;
        }
        // not use
        dp[i + 1] += dp[i];
        dp[i + 1] %= MOD;
    }

    println!("{}", dp[n]);
}


Measured memory_bytes: 22780
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N;
	cin>>N;
	vector<int> score(N);
	int ans = 0;
	int rest = inf;
	rep(i,N){
		cin>>score[i];
		ans += score[i];
		if(score[i]%10 != 0)rest = min(rest,score[i]);
	}
	if(ans % 10 != 0){cout<<ans<<endl; return 0;}
	if(rest != inf){cout<<ans-rest<<endl; return 0;}
	cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n,ans=100000;
    cin>>n;
    for (int i=0; i<n; i++)
    {
        ans*=1.05;
        if (ans%1000!=0) ans=((ans/1000)+1)*1000;
    }
    cout<<ans<<'\n';
    return 0;
}



Measured memory_bytes: 3004
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

string S;

int main() {
	cin >> S;
	for(int i = 0; i < S.size() - 1; i++) {
		if(S[i] == S[i + 1]) {
			printf("Bad\n");
			return 0;
		}
	}
	printf("Good\n");
	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

using namespace std;

/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)  //a~(b - 1)?????§
#define print(i) cout << i << endl //?°??????????Python?????????
#define all(i) (i).begin(),(i).end() //??¨??????(sort??¨???)
#define mp make_pair //mp(OO, OO)??¨???:::pint??¨???

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/

int main(void)
{
  int a[101] = {};
  int mx = 0;
  int x;

  while (scanf("%d", &x) != EOF){
    a[x]++;
    if (mx < a[x]) mx = a[x];
  }
  FOR(i, 1, 101){
    if (a[i] == mx){
      cout << i << endl;
    }
  }
  return 0; 
}

Measured memory_bytes: 1208