akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main() {
    int C[3][3];
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 3; j++)
            cin >> C[i][j];
    int _A[3][3], _B[3][3];
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 3; j++) {
            _A[i][j] = C[(i+1)%3][j] - C[i][j];
            _B[i][j] = C[i][(j+1)%3] - C[i][j];
        }
    /*
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            printf("%d ", _A[i][j]);
        }
        printf("\n");
    }
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            printf("%d ", _B[i][j]);
        }
        printf("\n");
    }
    */
    for (int i = 0; i < 3; i++) {
        if (!((_B[0][i] == _B[1][i] && _B[1][i] == _B[2][i]) ||
              (_A[i][0] == _A[i][1] && _A[i][1] == _A[i][2]))) {
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast",3,"inline")
#include <bits/stdc++.h>
using namespace std;
double /*a[100],*/ans;
int a[100];
int n;
int m=1;
double cnt;
int main(){
	ios_base::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		m=m*a[i]/__gcd(m,a[i]);
	}
	for(int i=0;i<n;i++){
		cnt+=m/a[i];
	}
	ans=m*1.0/cnt;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
static const double PI = 3.1415926535897932384626433;
static const ll LL_MAX = (ll)1 << 62;
static const ll MOD = 1000000007;

char A[100][100] = {};

int main() {
	ll a, b; cin >> a >> b;
	ll S = 100;
	rep(i, 0, S) {
		rep(j, 0, S) {
			if (i > S / 2) {
				A[i][j] = '#';
			}
			else {
				A[i][j] = '.';
			}
		}
	}
	a--; b--;
	rep(i, 0, S / 2 + 1) {
		if (!b)break;
		rep(j, 0, S) {
			if (!b)break;
			if (j % 2 == 0 && i % 2 == 0) {
				A[i][j] = '#';
				b--;
			}
		}
	}

	rep(i, S / 2 + 1, S) {
		if (!a)break;
		rep(j, 0, S) {
			if (!a)break;
			if (j % 2 == 0 && i % 2 == 0) {
				A[i][j] = '.';
				a--;
			}
		}
	}
	cout << 100 << " " << 100 << endl;
	rep(i, 0, S) {
		rep(j, 0, S) {
			cout << A[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
url = "https://atcoder.jp//contests/abc130/tasks/abc130_b"

def main():
    n,x = list(map(int, input().split()))
    lis = list(map(int, input().split()))
    lis.insert(0, 0)
    count = 0
    pos = 0
    for l in lis:
        pos += l
        count += 1
        if pos > x:
            print(count-1)
            exit()
    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9116
#include <iostream>
#include <algorithm>

using namespace std;

const int MAX = 1000000;

int main() {
	int num;
	int mini=MAX,maxi=-MAX;
	long long sum=0;

	cin >> num;
	for( int i=0; i<num; i++ ) {
		int a;
		cin >> a;
		maxi = std::max( maxi, a );
		mini = std::min( mini, a );
		sum += a;
	}
	cout << mini << " " << maxi << " " << sum << endl;
	return 0;
}

Measured memory_bytes: 3096
import java.util.*;

public class Main {
 	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Work[] arr = new Work[n];
		for (int i = 0; i < n; i++) {
		    arr[i] = new Work(sc.nextInt(), sc.nextInt());
		}
		Arrays.sort(arr);
		int total = 0;
		for (int i = 0; i < n; i++) {
		    total += arr[i].time;
		    if (total > arr[i].limit) {
		        System.out.println("No");
		        return;
		    }
		}
		System.out.println("Yes");
   }
   
   static class Work implements Comparable<Work> {
       int time;
       int limit;
       
       public Work (int time, int limit) {
           this.time = time;
           this.limit = limit;
       }
       
       public int compareTo(Work another) {
           return limit - another.limit;
       }
   }
}




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

using namespace std;

int main()
{
    int N;
    string S;
    cin >> N;
    cin >> S;
    
    string result = "No";
    
    if( N%2 == 0 ){
        int offset = N/2;
        result = "Yes";
        for( int ii = 0; ii < offset; ++ii ){
            if( S[ii] != S[offset+ii] ){
                result = "No";
                break;
            }
        }
    }
    
    cout << result << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
#define int long long

const int MAX_N = 100010;




signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	map<int, int>mp;
	rep(i, n) {
		int a; cin >> a;
		mp[a]++;
	}
	VE tmp;
	for (auto itr = mp.begin(); itr != mp.end(); itr++) {
		if (itr->second == 2 || itr->second == 3) {
			tmp.push_back(itr->first);
		}
		else if (itr->second >= 4) {
			tmp.push_back(itr->first); tmp.push_back(itr->first);
		}
	}
	if (tmp.size() < 2) { cout << 0 << endl; return 0; }
	sort(ALLR(tmp));
	cout << tmp[0] * tmp[1] << endl;
	return 0;
}


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

int main() {

  int N;
  int zero=0;
  int minus=0;
  long ans=0;
  cin >> N;
  vector<long> vec(N);
  for (int i = 0; i<N; i++){
    cin >> vec.at(i);
    if ( vec.at(i) < 0){
      minus++;
      vec.at(i) = vec.at(i)*(-1);
    }
    if ( vec.at(i) == 0){
      zero ++;
    }
  }
  sort(vec.begin(), vec.end());
  if( zero > 0){
    ans = vec.at(0);
  }
  else if( minus%2 == 0){
    ans = vec.at(0);
  }
  else{
    ans = vec.at(0)*(-1);
  }
    for (int i=1; i<N; i++){
      ans = ans + vec.at(i);
    }
  cout << ans << endl;
      

}




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

using namespace std;

int main()
{
    int n;cin>>n;
    int i=1000;
    if(n%1000==0) cout<<0;
    else
    {
        while(i<n)
        {
            i+=1000;
        }
        cout<<i-n;
    }

    return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>

void view(const std::vector<T> &v)
{
#ifndef ONLINE_JUDGE
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
#endif
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    int n, k;
    cin >> n >> k;
    vint a(n);
    rep(i, n) cin >> a[i];

    auto pos = [&](int x) {
        int sum = 0;
        rep(i, n)
        {
            int cut = a[i] / x;
            if (a[i] % x)
                cut++;
            cut--;
            sum += cut;
        }
        return sum <= k;
    };

    int l = 1,
        r = max_element(a.begin(), a.end())[0];
    while (l < r)
    {
        int mid = (l + r) / 2;
        bool ok = pos(mid);
        if (ok)
        {
            r = mid;
        }
        else
        {
            l = mid + 1;
        }
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 4036
#include <iostream>
#include <sstream>
#include <vector>
#include <array>
#include <bitset>

const unsigned M = 20;

typedef std::array<int, M> BitCount;

BitCount operator+(BitCount &lhs, unsigned rhs)
{
	BitCount bc;
	std::bitset<M> bs(rhs);
	for (unsigned m = 0; m < M; ++m) {
		bc[m] = lhs[m] + bs[m];
	}
	return bc;
}

BitCount& operator+=(BitCount &lhs, unsigned rhs)
{
	std::bitset<M> bs(rhs);
	for (unsigned m = 0; m < M; ++m) {
		lhs[m] += bs[m];
	}
	return lhs;
}

BitCount& operator-=(BitCount &lhs, unsigned rhs)
{
	std::bitset<M> bs(rhs);
	for (unsigned m = 0; m < M; ++m) {
		lhs[m] -= bs[m];
	}
	return lhs;
}

inline bool valid(const BitCount &bc)
{
	for (unsigned m = 0; m < M; ++m) {
		if (bc[m] > 1) return false;
	}
	return true;
}

int main()
{
	unsigned N;
	std::cin >> N;
	
	std::vector<unsigned> A(N);
	for (unsigned n = 0; n < N; ++n) {
		std::cin >> A[n];
	}
	
	unsigned long long int count = 0;
	
	BitCount sum;
	for (unsigned m = 0; m < M; ++m) { sum[m] = 0; }
	unsigned left = 0, right = 0;
	while (left < N) {
		while (right < N && valid(sum + A[right])) {
			sum += A[right];
			++right;
		}
		
		count += right - left;
		
		sum -= A[left];
		++left;
	}
	
	std::cout << count << std::endl;
	
	return 0;
}

Measured memory_bytes: 1024
package main

import "fmt"

func main() {

	var a int

	fmt.Scan(&a)

	e := a / 2
	if a == 1 {
		e = 0
	} else 	if a % 2 == 1 {
		e = ( (a - 1) / 2 )
	}

	result := 1 - float64 ( float64(e) / float64(a) )

	fmt.Println(result)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int lu;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> v;
typedef vector<v> vv;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<set<ll>> vsll;
typedef set<pair<ll, ll>> spll;
typedef vector<spll> vspll;
typedef vector<pll> vpll;
const ll MOD = 1e9 + 7;
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
#define round(x, y) ((2 * x + y) / (2 * y))
#define ce(x, y) ((x + y - 1) / y)
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define sz(x) (ll) x.size()
#define sq(x) ((x) * (x))
 
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
 
void solve() {

    ll n,x,t;
    cin >>n>>x>>t;
    if(n%x==0)
    {
        cout <<(n/x)*t<<"\n";
    }
    else
    {
        cout <<((n/x)+1)*t<<"\n";
    }
}
 
int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    solve();
    return 0;
}

Measured memory_bytes: 3636
#include <string>
#include <iostream>
using namespace std;
int main() {
	int N;
	cin >> N;
	string A, B, C;
	cin >> A >> B >> C;
	int sum = 0;
	for (int i = 0; i < N; ++i) {
		if (A[i] == B[i] && A[i] == C[i]) {
			sum += 0;
		}
		else if (A[i] == B[i] || B[i] == C[i] || C[i] == A[i]) {
			sum += 1;
		}
		else {
			sum += 2;
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 888
#include <cstdio>

using namespace std;

int m = 1000000007;
long long inv[200001];
long long fact[200001];
long long invfact[200001];

void calc_inv(int n, int mod) {
    inv[1] = 1;
    for (int i = 2; i <= n; i++) inv[i] = inv[mod % i] * (mod - mod / i) % mod;
    
    fact[0] = invfact[0] = 1;
    for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i % mod;
    for (int i = 1; i <= n; i++) invfact[i] = invfact[i - 1] * inv[i] % mod;
}

long long comb(long long x, long long y) {
    return fact[x] * invfact[y] % m * invfact[x - y] % m;
}

int main() {
    int h, w, a, b, i;
    long long ans;
    
    scanf("%d %d %d %d", &h, &w, &a, &b);
    
    calc_inv(200000, m);
    
    ans = comb(h - 1 + w - 1, h - 1);
    
    for (i = 0; i < a; i++) {
        ans -= comb(h - 1 - i + b - 1, h - 1 - i) * comb(i + w - b - 1, i) % m;
        if (ans < 0) ans += m;
    }
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 4864
N, M = map(int, input().split())
memo = [[] for _ in range(N+1)]

for _ in range(M):
    ai, bi = map(int, input().split())
    memo[ai].append(bi)
    memo[bi].append(ai)

queue = memo[1]

#島1から直通の場合
if N in queue:
    print("POSSIBLE")
    quit()

#島1から定期便2つ以内に島Nにたどり着けるかどうか確認する
while queue:
    island = queue.pop()
    for connected_island in memo[island]:
        if connected_island == N:
            print("POSSIBLE")
            quit()

print("IMPOSSIBLE")


Measured memory_bytes: 38320
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int N; cin >> N;
    VI A(N);
    REP(i, N) cin >> A.at(i);

    sort(ALL(A));

    cout << A.back() - A.front() << endl;
  
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;}
ll lcm(ll x, ll y) {return x/gcd(x,y)*y;}


int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;

    ll lc=lcm(c,d);
    ll ans=b-b/c-b/d+b/lc;
    ll tmp=(a-1)-(a-1)/c-(a-1)/d+(a-1)/lc;

    ans-=tmp;
    cout<<ans<<endl;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int a, b, c, d;

int main() {
	cin >> a >> b >> c >> d;
	
	cout << max(a * b, c * d) << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
//typedef __int64 LL;
typedef vector<int> ivec;
typedef vector<string> svec;

int a,b;
int main(){
    cin>>a>>b;
    if(a==1)a=14;
    if(b==1)b=14;	
	
	
    
    if(a==b)cout<<"Draw"<<endl;
    if(a>b)cout<<"Alice"<<endl;
    if(a<b)cout<<"Bob"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int n;
    int count = 0;
    scanf("%d",&n);
    int a[n];
    for(int i = 0;i < n;i++){
        scanf("%d",&a[i]);
    }
    for(int i = 0;i < n;i++){
        if(a[i]!=i+1){
            count++;
        }
    }
    if(count <= 2){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    
       return (0);
    
}

Measured memory_bytes: 128
# ABC128 D - equeue
n,k=map(int,input().split())
v=list(map(int,input().split()))
c=min(n,k)
ans=0

for a in range(c+1):
    for b in range(c-a+1):
        t=v[:a]+v[n-b:]
        t.sort()
        for i in range(k-(a+b)):
            if len(t) and t[0]<0:
                t.pop(0)
        ans=max(ans,sum(t))
print(ans)


Measured memory_bytes: 3060
#include <iostream>
	#include <vector>
	#include <algorithm>
	#include <utility>
	#include <queue>
	#include <set>
	#include <stdio.h>
	#include <string>
	using namespace std;
	#define ll long long


	int main() {
		int n;
		string s;
		cin >> n >> s;
		if (n % 2 == 1) {
			cout << "No" << endl;
			return 0;
		}
		for (int i = 0; i < n/2; i++) {
			if (s[i] != s[i + n/2]) {
				cout << "No" << endl;
				return 0;
			}
		}
		cout << "Yes" << endl;
		return 0;
	}

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

using namespace std;

const int N = 105;
const int maxn = 1e5 + 5;

int n, m, w[N], v[N];
long long dp[N][maxn];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> w[i] >> v[i];
    memset(dp, 0x3f, sizeof(dp));
    dp[0][0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < maxn; j++) {
            if (dp[i][j] < 1e18) {
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
                dp[i + 1][j + v[i + 1]] = min(dp[i + 1][j + v[i + 1]], dp[i][j] + w[i + 1]);
            }
        }
    }
    
    int ans = 0;
    for (int i = 0; i < maxn; i++) if (dp[n][i] <= m) ans = max(ans, i);
    cout << ans;
    return 0;
}

Measured memory_bytes: 82304
#include <bits/stdc++.h>
using namespace std;
int main() {
    list<int> l;
    auto itr = l.begin();
    int Q;
    cin >> Q;
    while (Q--) {
        int q; cin >> q;
        if (q == 0) {
            int x; cin >> x;
            itr = l.insert(itr, x);
        } else if (q == 1) {
            int d; cin >> d;
            while(d) {
				if (d > 0) itr++, d--;
				else itr--, d++;
			}
        } else {
            itr = l.erase(itr);
        }
    }
    for (auto& x: l) cout << x << endl;
}


Measured memory_bytes: 18588
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;

int main()
{
    int A, B;
    cin >> A >> B;

    cout << 6 - A - B << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#include <math.h> 

  int main(void)

{  

double r, c, s;  

  while(scanf("%lf", &r) != EOF) 

  {       

   c = 2.0 * r * M_PI;   

  s = r * r * M_PI;       

printf("%.6lf %.6lf\n", s, c);  

}    

return 0;

} 

Measured memory_bytes: 652
#include <iostream>
#include <algorithm>
#include <string>
#include <stdlib.h>
#include <vector>
#include <climits>
#include <math.h>
#include <map>
#include <set>
#include <stack>
#include <iomanip>
using namespace std; 
#define Endl '\n'
int main()
{
    int n;
    cin>>n;
    set<string> s;string x;
    for (int i = 0; i < n; ++i)
    {
        cin>>x;
        s.insert(x);
    }
    cout<<s.size();
}

Measured memory_bytes: 19260
#include<iostream>
#include<string>
#define endl '\n'
using namespace std;




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

	int k;
	string s;
	cin >> k >> s;
	for (int i = 0; i < s.size(); i++) {
		if (i < k)
			cout << s[i];
		else {
			cout << "...";
			break;
		}
	}



	return 0;
}





Measured memory_bytes: 3640
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair
#define debug_vec(x, n) cout << (#x) << ": "; for(int i = 0; i < n; i++) cout << x[i] << (i == n - 1 ? "\n" : " ");
 
typedef long long ll;
typedef long double ld;

void solve(){
    int n;
    cin >> n;
    int c[n + 1] = {0};
    for(int i = 1; i < n; i++){
        int x;
        cin >> x;
        c[x]++;
    }
    for(int i = 1; i <= n; i++){
        cout << c[i] << "\n";
    }
    return;
}
 
int main(){
    IOS;
    int t = 1;
    //cin >> t;
    for(int i = 1; i <= t; i++){
        //cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}

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

int n;
int a[100];

void printArray(){
    for(int i = 0; i < n; i++){
        cout << a[i];
        if(i != n-1) cout << " ";
    }
    cout << endl;
}

void insertionSort(){
    int v,j;
    printArray();
    for(int i = 1; i < n; i++){
        v = a[i];
        j = i - 1;
        while(j >= 0 && a[j] > v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        printArray();
    }
}

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

    insertionSort();

    return 0;
}


Measured memory_bytes: 3092
N, K = map(int, input().split())
from functools import lru_cache
@lru_cache(maxsize=None)
def solve(n):
    if n>=K:
        return 1.0
    else:
        return solve(n<<1) * 0.5
ans = 0
for i in range(N, 0, -1):
    ans += solve(i)
ans /= N
print(ans)


Measured memory_bytes: 15584
#include <iostream>
#include <string.h>
using namespace std;
#define cpy(a,b) tront[a-1] = temp[b-1]

class dice {
public:
	dice() {
		for (int i = 0; i < 6; i++)
			cin >> tront[i];
	}
	void rotation(char c) {
		int temp[6], i, j;
		for (i = 0; i < 6; i++)
			temp[i] = tront[i];
		switch (c) {
		case 'E':
			cpy(1, 4);
			cpy(4, 6);
			cpy(6, 3);
			cpy(3, 1);
			break;
		case 'N':
			cpy(5, 1);
			cpy(1, 2);
			cpy(2, 6);
			cpy(6, 5);
			break;
		case 'S':
			cpy(2, 1);
			cpy(1, 5);
			cpy(5, 6);
			cpy(6, 2);
			break;
		case 'W':
			cpy(1, 3);
			cpy(3, 6);
			cpy(6, 4);
			cpy(4, 1);
			break;
		}
	}
	void print(int x) {
		cout << tront[x-1] << endl;
	}
private:
	int tront[6];
};

int main() {
	dice d;
	char str[101];
	int slen, i, j;
	cin >> str;
	slen = strlen(str);
	for (i = 0; i < slen; i++)
		d.rotation(str[i]);
	d.print(1);
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define fi           first
#define se           second
#define ll           long long
#define pb           push_back
#define mp           make_pair
#define pll          pair<ll,ll>
#define pii          pair<int,int>
#define all(x)       (x).begin(),(x).end()
#define isWorking()  cout<<"Wroking"<<endl
#define FOR(i,x,y)   for(int i=x; i<y; i++)
#define SORT(x)      sort(x.begin(),x.end())
#define PRINT(ok)    cout<<(ok? "YES":"NO")<<endl
#define Fast_Input   ios_base :: sync_with_stdio(false), cin.tie(NULL);
typedef vector < int > VI;
const ll mod= 1e9+7,INF=1e18,mx= 5e6+5,mn=100;
int testCase=1,cas=0;

const int fx[]={+1,-1,+0,+0};  //Four Side
const int fy[]={+0,+0,+1,-1};  //Four Side

int vis[25][25],dis[25][25];
int ans=0;
char grid[25][25];
int n,m;

void bfs(int x,int y){
    vis[x][y]=1;

    queue<pii> q;
    q.push({x,y});
    while(!q.empty()){
        x=q.front().first;
        y=q.front().second;

        q.pop();

        for(int i=0; i<4; i++){
            int xx=x+fx[i];
            int yy=y+fy[i];
            if(xx>=0 && yy>=0 && xx<n && yy<m && !vis[xx][yy] && grid[xx][yy]=='.'){
                vis[xx][yy]=1;
                q.push({xx,yy});
                dis[xx][yy]=dis[x][y]+1;
                ans=max(ans,dis[xx][yy]);
            }
        }
    }
}


int main() {
    Fast_Input

    //cin>>testCase;
    while(testCase--){
        cin>>n>>m;

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

        for(int i=0; i<n; i++){
            for(int j=0; j<m; j++){
                if(grid[i][j]=='.'){
                    memset(vis,0,sizeof vis);
                    memset(dis,0,sizeof dis);
                    bfs(i,j);
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define INF (1e9)
#define MAX_V 2010
#define MAX_N 1010
using namespace std;
int V;
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

void add_edge(int u,int v){
  G[u].push_back(v);
  G[v].push_back(u);
}

bool dfs(int v){
  used[v] = true;
  for(int i=0; i<G[v].size(); i++){
    int u = G[v][i], w = match[u];
    if(w<0 || !used[w] && dfs(w)){
      match[v] = u;
      match[u] = v;
      return true;
    }
  }
  return false;
}

int bipartite_matching(){
  int res=0;
  memset(match, -1, sizeof(match));
  for(int v=0; v<V; v++){
    if(match[v] < 0){
      memset(used,0,sizeof(used));
      if(dfs(v)) res++;
    }
  }
  return res;
}

int main(){
  int n,m,l;
  while(1){
    cin>>n>>m>>l;
    if(!n&&!m&&!l)break;
    vector<vector<int> >g(n,vector<int>(n,INF));
    for(int i=0;i<n;i++) g[i][i]=0;
    for(int i=0;i<l+l+2;i++)G[i].clear();
    
    for(int i=0,a,b,c;i<m;i++)cin>>a>>b>>c,g[a][b]=g[b][a]=c;
    
    for(int k=0;k<n;k++)
      for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
    
    vector<int>idx(l),tl(l);
    for(int i=0,a,b;i<l;i++)cin>>a>>b,tl[i]=b,idx[i]=a;
    
    for(int i=0;i<l;i++)
      for(int j=0;j<l;j++)
	if(i!=j&&tl[i]+g[idx[i]][idx[j]]<=tl[j])add_edge(i,l+j);
    
    V=l+l;
    cout <<l-bipartite_matching()<<endl;
  }
  return 0;
}

Measured memory_bytes: 11428
using System;
using System.Collections.Generic;
using System.Linq;

class Procon {
  public Procon () { }
  static void Main (string[] agrs) {
    new Procon ().Do ();
  }

  Scanner cin;

  public void Do () {
    int[] costs = new int[9] { 2, 5, 5, 4, 5, 6, 3, 7, 6 };
    cin = new Scanner ();
    int N = cin.nextInt ();
    int M = cin.nextInt ();
    List<int> A = new List<int> (cin.arrayInt ());

    int[] DP = new int[N + 1];
    for (int i = 0; i < N; i++) {
      DP[i] = -1;
    }

    DP[0] = 0;
    for (int i = 0; i <= N; i++) {
      for (int j = 0; j < A.Count (); j++) {
        if (i - costs[A[j] - 1] < 0) {
          continue;
        }
        int tmp = DP[i - costs[A[j] - 1]] + 1;
        if (tmp > DP[i]) {
          DP[i] = tmp;
        }
      }
    }

    int maxlen = DP[N];
    int tmpN = N;
    A.Sort ((a, b) => a - b);
    for (int i = maxlen; i > 0; i--) {
      for (int j = A.Count () - 1; j >= 0; j--) {
        if (tmpN - costs[A[j] - 1] < 0) {
          continue;
        }
        if (DP[tmpN - costs[A[j] - 1]] + 1 == DP[tmpN]) {
          tmpN = tmpN - costs[A[j] - 1];
          Console.Write (A[j]);
          break;
        }
      }
    }
  }
}

class Scanner {
  string[] s;
  int i;
  int max_i;

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

  public string nextString () {
    if (i >= s.Length) {
      s = Console.ReadLine ().Split (' ');
      max_i = s.Length;
      i = 0;
      if (max_i == 0) {
        return "";
      }
      return s[i++];
    } else {
      return s[i++];
    }
  }

  public int nextInt () {
    return int.Parse (nextString ());
  }

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

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

  public string[] arrayString () {
    return Console.ReadLine ().Split (' ');
  }

  public int[] arrayInt () {
    string[] str = Console.ReadLine ().Split (' ');
    int[] array = new int[str.Length];
    for (int i = 0; i < str.Length; i++) {
      array[i] = int.Parse (str[i]);
    }
    return array;
  }

  public long[] arrayLong () {
    string[] str = Console.ReadLine ().Split (' ');
    long[] array = new long[str.Length];
    for (int i = 0; i < str.Length; i++) {
      array[i] = long.Parse (str[i]);
    }
    return array;
  }

  public double[] arrayDouble () {
    string[] str = Console.ReadLine ().Split (' ');
    double[] array = new double[str.Length];
    for (int i = 0; i < str.Length; i++) {
      array[i] = double.Parse (str[i]);
    }
    return array;
  }
}

Measured memory_bytes: 13268
N = int(input())
X = list(map(int, input().split()))

ans = 100000000000000

for i in range(min(X), max(X) + 1):
    a = 0
    for j in range(N):
        a += (X[j] - i) ** 2

    ans = min(a, ans)


print(ans)


Measured memory_bytes: 2940
s=input()
n=len(s)
cnt_b=0
cnt_w=0
#黒白の順
for i in range(n):
  if i%2==1:
    if s[i]!="1":
      cnt_b+=1
  else:
    if s[i]!="0":
      cnt_b+=1

#白黒の順
for i in range(n):
  if i%2==1:
    if s[i]!="0":
      cnt_w+=1
  else:
    if s[i]!="1":
      cnt_w+=1
      
print(min(cnt_b,cnt_w))

Measured memory_bytes: 3188
#include <algorithm>
#include <cstdio>
#include <ctype.h>
#include <functional>
#include <iostream>
#include <cassert>
#include <cfloat>
#include <climits>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
#define int long long

signed main() {
	int x, y;


	cin >> x >> y;
	int res=1000000001;
	if (y - x >= 0) {
		res = min(res, y - x);
	}
	if (y - (-x) >= 0) {
		res = min(res, 1+y - (-x));
	}
	if ((-y) - (-x) >= 0) {
		res = min(res, 2 + (-y) - (-x));
	}
	if ((-y) - x >= 0) {
		res = min(res, 1 + (-y) - x);
	}

	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

struct edge{
    ll to, gin, time;
};

typedef pair<ll,P> pp;

int main(){
    ll n,m,s; cin >> n >> m >> s;
    chmin(s,2450);
    vector<vector<edge>> G(n);
    rep(i,m){
        ll u,v,a,b; cin >> u >> v >> a >> b;
        u--; v--;
        G[u].push_back({v,a,b});
        G[v].push_back({u,a,b});
    }
    vl c(n),d(n);
    rep(i,n) cin >> c[i] >> d[i];
    rep(i,n){
        G[i].push_back({i,-c[i],d[i]});
    }
    vvl dist(n,vl(2505,linf));
    dist[0][s] = 0;
    priority_queue<pp,vector<pp>,greater<pp>> pq;
    pq.emplace(0,P(s,0));
    while(!pq.empty()){
        pp p = pq.top(); pq.pop();
        ll u = p.second.second;
        for(auto v : G[u]){
            ll nxt = p.first + v.time;
            if(p.second.first - v.gin < 0) continue;
            if(p.second.first >= 2500 && v.gin < 0) continue;
            ll tmp = min(2500LL,p.second.first-v.gin);
            if(dist[v.to][tmp] > nxt){
                dist[v.to][tmp] = nxt;
                pq.emplace(nxt,P(tmp,v.to));
            }
        }
    }
    REP(i,1,n){
        ll ans = linf;
        rep(j,2500) chmin(ans,dist[i][j]);
        cout << ans << endl;
    }
}

Measured memory_bytes: 7392
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (n, k) = (v[0], v[1]);
    let big_int: i64 = 1000_000_000 + 7;

    let mut divides = vec![];
    for i in 1..(n as f64).sqrt().floor() as i64 + 1 {
        divides.push(i);
        divides.push(n / i);
    }
    let divides = divides.into_iter().collect::<BTreeSet<_>>();
    let divides = divides.into_iter().collect::<Vec<_>>();
    let mut spans = vec![1]; // spans[0] == 1
    for i in 1..divides.len() {
        spans.push(divides[i] - divides[i - 1]);
    }

    let mut dp = vec![0i64; divides.len()];
    dp[0] = 1;
    for _ in 0..k {
        let mut dp_sum = vec![0; divides.len()];
        dp_sum[0] = dp[0];
        for i in 1..divides.len() {
            dp_sum[i] = dp_sum[i - 1] + dp[i];
            dp_sum[i] %= big_int;
        }

        let mut next = vec![0i64; divides.len()];
        for i in 0..divides.len() {
            next[i] = dp_sum[divides.len() - 1 - i] * spans[i];
            next[i] %= big_int;
        }
        dp = next;
        // debug!(dp);
    }
    let mut ans = 0i64;
    for elem in dp {
        ans += elem;
        ans %= big_int;
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair


int main() {
  int n;
  cin >> n;
  vl a(n), b(n);
  vector<pll> c(n);
  rep (i, n) {
    cin >> a[i] >> b[i];
    c[i] = pll(a[i] + b[i], i);
  }
  sort(all(c));
  reverse(all(c));
  ll f = 0, s = 0;
  rep (i, n) {
    int j = c[i].second;
    if (i % 2 == 0) {
      f += a[j];
    }
    else {
      s += b[j];
    }
  }
  cout << f - s << endl;
}


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

class Dice {
	public:
	int face[6];
	Dice (int* f) {
		for (int i=0; i<6; i++) face[i] = f[i];
	}
	void roll_x(bool d) {
		if (d) rotate(0, 4, 5, 1);
		else rotate(1, 5, 4, 0);
	}
	void roll_y(bool d) {
		if (d) rotate(0, 2, 5, 3);
		else rotate(3, 5, 2, 0);
	}
	void roll_z(bool d) {
		if (d) rotate(1, 3, 4, 2);
		else rotate(2, 4, 3, 1);
	}
	void rotate(int a, int b, int c, int d) {
	  int t;
	  t = face[d];
	  face[d] = face[c];
	  face[c] = face[b];
	  face[b] = face[a];
	  face[a] = t;
	}
	void print() {
		cout << face[0] << endl;
	}
};

bool isSameNum(Dice d1, Dice d2)
{
	for (int i=0; i<6; i++) {
		if (d1.face[i]!=d2.face[i]) return false;
	}
	return true;
}

bool isSame(Dice d1, Dice d2)
{
	for (int i=0; i<6; i++) {
		for (int j=0; j<4; j++) {
			if (isSameNum(d1, d2)) return true;
			d1.roll_z(true);
		}
		if (i%2==0) d1.roll_x(true);
		else d1.roll_y(true);
	}
	return false;
}

int main()
{
	int f1[6], f2[6];
	for (int i=0; i<6; i++) cin >> f1[i];
	for (int i=0; i<6; i++) cin >> f2[i];
	Dice d1(f1), d2(f2);
	if (isSame(d1, d2)) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}




Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define REP(i, n) for(int i=1; i<=(int)(n); i++)

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> V(N);
    vector<int> C(N);
    int ans = 0;

    rep(i, N){
        cin >> V[i];
    }
    rep(i, N){
        cin >> C[i];
        if ((V[i] - C[i]) > 0){
            ans += (V[i] - C[i]);
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,a,b;
  cin >> n >> a >> b;
  bool j = false;
  for (int i=a; i<=b; i++) {
    if (i%n == 0) {
      j = true;
    }
  }
  if (j) {
    cout << "OK" << endl;
  } else {
    cout << "NG" << endl;
  }
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define f first
#define s second
const int N=998244353;
vector<pair<int, int>>v;
vector<pair<int, int>>vec;
set<int>se;
map<int, int>m;
int t[1600005];

int maxi(int v, int tl, int tr, int l, int r) {
    if (l > r) 
        return -1;
    if (l == tl && r == tr) {
        return t[v];
    }
    int tm = (tl + tr) / 2;
    return max(maxi(v*2, tl, tm, l, min(r, tm)), maxi(v*2+1, tm+1, tr, max(l, tm+1), r));
}

void update(int v, int tl, int tr, int pos, int new_val) {
    if (tl == tr) {
        t[v] = new_val;
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2], t[v*2+1]);
    }
}

main() {
	int n;
	cin>>n;
	for(int i=0; i<n; i++){
		int x, d;
		cin>>x>>d;
		v.pb({x, d});
		se.insert(x);
		se.insert(x+d);
	}
	int pt=0;
	for(auto it=se.begin(); it!=se.end(); it++){
		m[(*it)]=pt;
		pt++;
	}
	for(auto u:v){
		vec.pb({m[u.f], m[u.f+u.s]});
	}
	sort(vec.begin(), vec.end());
	int dp[n];
	int suf[n];
	for(int i=0; i<n; i++){
		dp[i]=0;
		suf[i]=0;
	}
	dp[n-1]=n-1;
	suf[n-1]=2;
	update(1, 0, 400005, vec[n-1].f, n-1);
	for(int i=n-2; i>=0; i--){
		int maxim=maxi(1, 0, 400005, vec[i].f, vec[i].s-1);
		maxim=max(maxim, i);
		dp[i]=maxim;
		update(1, 0, 400005, vec[i].f, maxim);
		if(maxim==n-1){
			suf[i]=(1+suf[i+1])%N;
			continue;
		}
		suf[i]=(suf[i+1]+suf[maxim+1])%N;
	}
	cout<<suf[0];
	
	return 0;
}

Measured memory_bytes: 64708
#include<stdio.h>

int main(){
  int N;
  scanf("%d", &N);
  
  int a[N], b[N];
  for(int i = 0; i < N; i++) scanf("%d", a + i);
  for(int i = 0; i < N; i++) scanf("%d", b + i);
  
  int table[N + 1];
  table[0] = -1;
  for(int i = 0, j = -1; i < N; i++){
    while(j >= 0 && (a[i % N] ^ a[(i + 1) % N]) != (a[j % N] ^ a[(j + 1) % N])) j = table[j];
    table[i + 1] = ++j;
  }
  
  int ans[N];
  for(int i = 0; i < N; i++) ans[i] = -1;
  
  for(int i = 0, p = 0; i + p < 2 * N;){
    if((a[p % N] ^ a[(p + 1) % N]) == (b[(i + p) % N] ^ b[(i + p + 1) % N])){
      if(++p == N){
        ans[(N - i) % N] = a[(N - i) % N] ^ b[0];
        i = i + p - table[p];
        p = table[p];
      }
    }else{
      i = i + p - table[p];
      if(p) p = table[p];
    }
  }
  
  for(int i = 0; i < N; i++){
    if(ans[i] != -1){
      printf("%d %d\n", i, ans[i]);
    }
  }
  
  return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

const int mod = 1e9 + 7;
inline int add(int u, int v) {
  return u + v >= mod ? u + v - mod : u + v;
}
inline int mul(ll u, int v) {
  return u * v % mod;
}
inline int sub(int u, int v) {
  return add(u, mod - v);
}

const int N = 105, K = 1e5 + 5;
int ways[2][K];
int pre[2][K];

void compute_pre(int idx) {
  pre[idx][0] = ways[idx][0];
  for (int i = 1; i < K; i++) {
    pre[idx][i] = add(pre[idx][i - 1], ways[idx][i]);
  }
}

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n, k; cin >> n >> k;
  ways[0][0] = 1;
  compute_pre(0);
  for (int i = 1; i <= n; i++) {
    int a; cin >> a;
    int cur = i & 1, prv = (i & 1) ^ 1;
    for (int x = 0; x <= k; x++) {
      ways[cur][x] = sub(pre[prv][x], x > a ? pre[prv][x - a - 1] : 0);
    }

    compute_pre(cur);
  }

  cout << ways[n & 1][k] << endl;

  return 0;
}


Measured memory_bytes: 5228
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author /\
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DPreparingBoxes solver = new DPreparingBoxes();
        solver.solve(1, in, out);
        out.close();
    }

    static class DPreparingBoxes {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n + 1];
            for (int i = 1; i < n + 1; i++) {
                a[i] = in.nextInt();
            }
//        int[] cnt = new int[n + 1];
//        List<Integer> choices = new ArrayList<>();
//        for (int i = n; i >= 1; i--) {
//            if (cnt[i] % 2 != a[i]) {
//                choices.add(i);
//                for (int j = 1; j <= Math.sqrt(i); j++) {
//                    if (i % j == 0) {
//                        cnt[j]++;
//                    }
//                }
//            }
//        }
            int[] res = new int[n + 1];
            int num = 0;
            for (int i = n; i >= 1; i--) {
                int cnt = 0;
                for (int j = i; j <= n; j += i) {
                    cnt += res[j];
                }
                res[i] = Math.abs((a[i] - cnt) % 2);
            }
            StringBuilder sb = new StringBuilder();
            for (int i = 1; i < n + 1; i++) {
                if (res[i] == 1) {
                    num++;
                    sb.append(i).append(" ");
                }
            }
            out.println(num);
            out.println(sb);
        }

    }

    static class Scanner {
        private StringTokenizer st;
        private BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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


  
int main(){

  int n,k;
  cin>>n>>k;
  
  vector<bool> data(n+1,false);
  
  for (int i=0;i<k;i++){
    int d;
    cin>>d;
    for (int j=0;j<d;j++){
      int ai;
      cin>>ai;
      data.at(ai)=true;
    }
  }
  
  int count=0;
  
  for (int i=1;i<=n;i++){
    if (data.at(i)==false){
      count++;
    }
  }
  
  
  cout<<count<<endl;
      

  
  
  
  
    
  
}

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

int main() {
	string s;
	cin>>s;
	int nagasa=s.length();
	rep(i,nagasa)cout<<"x";
	
}


Measured memory_bytes: 256