akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int INF = 1001001001;

int a[12][12];

int main() {
 int N,K;
 cin>>N>>K;
 vector<int>h(N);
 for(int i=0;i<N;i++){
   cin>>h.at(i);
 }
 sort(h.begin(),h.end());
 int ans=INF;
 for(int i=0;i<=N-K;i++){
  ans=min(ans,h.at(i+K-1)-h.at(i));
 }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
    int A,B,C;
    cin >> A >> B >> C;
    bool kawaiso = false;
    if(A==B&&B!=C) kawaiso = true;
    else if(A==C&&B!=C) kawaiso = true;
    else if(B==C&&A!=C) kawaiso = true;

    if(kawaiso) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int N;
  cin >> N;
  string s, t;
  cin >> s >> t;
  int ans = 2 * N;
  for (int i = 0; i <= N; i++)
  {
    string t_sub = t.substr(i, N - i);
    string st = s + t_sub;
    if (st.substr(0, N) == s && st.substr(st.length() - N, N) == t)
      ans = st.length();
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> B(N);
    vector<ll> C(N);
    REP(i,N){
        cin >> A[i];
        B[i] = -A[i]+i;
        C[i] = -A[i]-i;
    }
    sort(ALL(B));
    sort(ALL(C));
    ll count = 0;
    REP(i,N){
        count+=upper_bound(ALL(B),A[i]+i) - lower_bound(ALL(B),A[i]+i);
        count+=upper_bound(ALL(C),A[i]-i) - lower_bound(ALL(C),A[i]-i);
    }
    cout << count/2 << "\n";
}

Measured memory_bytes: 7904
#include <bits/stdc++.h>
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define ff first
#define sc second
#define INF 3000000000
#define SINF 2*(1e18)
#define inf -10000000
#define pb push_back
#define forr(i,p,n) for(int i=p;i<n;i++)
#define mpk make_pair
#define upb(a,s) upper_bound(a.begin(),a.end(),s)
#define lwb(a,s) lower_bound(a.begin(),a.end(),s)
#define mem(a,val) memset(a,val,sizeof a)
#define cc continue
#define eb emplace_back
#define bb break
#define mostbit(n) 32-__builtin_clz(n)-1
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
//priority_queue<ll> pq;
ll n,m,a,b;
ll dp[100010][4];
ll mat[100010][4];
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie();
    cin>>n;
    forr(i,0,n){
      cin>>mat[i][0]>>mat[i][1]>>mat[i][2];
    }
    forr(i,0,n){
      if(i==0){
	dp[i][0]=mat[i][0];
	dp[i][1]=mat[i][1];
	dp[i][2]=mat[i][2];
	cc;
      }
      dp[i][0]=max(dp[i-1][1]+mat[i][0],dp[i-1][2]+mat[i][0]);
      dp[i][1]=max(dp[i-1][0]+mat[i][1],dp[i-1][2]+mat[i][1]);
      dp[i][2]=max(dp[i-1][0]+mat[i][2],dp[i-1][1]+mat[i][2]);
    }
    ll ans=-1;
    forr(i,0,3){
      ans=max(dp[n-1][i],ans);
    }
    cout<<ans<<endl;
}


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

#define INF 1000000007
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define CLR(a) memset((a), 0, sizeof(a))

using ll = long long;
using ull = unsigned long long;
using namespace std;

inline int toInt(string s){
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}

template<class T> inline string toString(T x){
    ostringstream sout;
    sout << x;
    return sout.str();
}

int main(void){

    ll n, a, b;
    cin >> n >> a >> b;

    ll ans = (a+b*(n-1)) - (a*(n-1)+b) + 1;

    if(ans<0)ans = 0;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);

		
		while(true){
			int a=scan.nextInt();
			String op=scan.next();
			int b=scan.nextInt();
	    
			
			if(op.equals("?"))
				break;
			 if(op.equals("+"))
				System.out.println(a+b);
			else if(op.equals("-"))
				System.out.println(a-b);
			else if(op.equals("*"))
				System.out.println(a*b);
			 else if(op.equals("/"))
				System.out.println(a/b);
			
		}
	}
}


Measured memory_bytes: 26188
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
	int i,j,c=0;
	char s[1000],s1[1000],v,x;
	scanf("%s",s);
	scanf("%s",s1);
	for(i=0;i<strlen(s);i++)
{	c=0;	x=s[strlen(s)-1];
	for(j=strlen(s)-2;j>=0;j--)
		s[j+1]=s[j];
	s[0]=x;	
	for(j=0;j<strlen(s);j++)
	if(s[j]==s1[j])c++;
	if(c==strlen(s)){printf("Yes\n");break;} 
	}
	if(c!=strlen(s))printf("No\n");
	
	return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
#include  <cstdio>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using ld = long double;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vd = vector<double>;
using Vld = vector<long double>;
using Vll = vector<vector<ll> >;
using Vldd = vector<vector<ld> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Pli = pair<ll, int>;
using VPi = vector<Pi>;
using VPl = vector<Pl>;
using VPli = vector<Pli>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;

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

const int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX / 10;
const ll LINF = LLONG_MAX / 10;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };

int main()
{
	int n, r;
	cin >> n >> r;
	if (n >= 10) cout << r << endl;
	else {
		r += 100 * (10 - n);
		cout << r << endl;
	}
}


Measured memory_bytes: 3640
#include<iostream>
#include<cmath>
using namespace std;
const int mod=1000000007;
#define ll long long
ll quickPower(ll x,ll y)
{
    ll ans=1;
    while(y)
    {
        if(y&1)
            ans=ans*x%mod;
            x=x*x%mod;
            y/=2;
    }
    return ans;
}
ll choose(ll x,ll y)
{
    ll ans=1;
    for(ll i=y;i>=1;i--)
    {
        ans=ans*x%mod;
        x--;
        ans=ans*quickPower(i,mod-2)%mod;
    }
    return ans;
}
/*int quickPower(long int b, long int p)//是求a的b次方
{
    long long s, t;
	s=b%mod;
    t=1;
    for (int i=2;i<=p;i++)
    {
        s=s*b%mod;
        if (s==b%mod) break;
        t++;
    }
    p=p%t;s=1;
    if (p==0) p=t;
    for (int i=1;i<=p;i++)
    s=s*b%mod;
    return s;
}
long long int choose(int x, int y){
	long long int ans=1;
    for(long long int i=y;i>=1;i--)
    {
        ans=ans*x%mod;
        x--;
        ans=ans*quickPower(i,mod-2)%mod;
    }
    return ans;
}*/
int main(){
	int n, a, b;
	cin>>n>>a>>b;
	//cout<<(-0.5)%10<<" "<<choose(220,219)<<" "<<quickPower(2,1000)<<endl;
	long long int pint;
	pint=(quickPower(2,n)-choose(n,a)-choose(n,b)-1)%mod;
    pint=(pint%mod+mod)%mod;
    cout<<pint<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int h, w, d;
    cin >> h >> w >> d;

    if (d % 2)
    {
        REP(i, h)
        {
            REP(j, w)
            cout << ((i + j) % 2 ? "R" : "B");
            cout << endl;
        }
        return 0;
    }

    REP(i, h)
    {
        REP(j, w)
        {
            int x = (i + j + h + w) / d;
            int y = (i - j + h + w) / d;

            if (x % 2)
                cout << (y % 2 ? "R" : "B");
            else
                cout << (y % 2 ? "Y" : "G");
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main() {
	int S;
	int h, m;
	
	scanf("%d", &S);
	
	m = S / 60;
	S = S % 60;
	
	h = m / 60;
	m = m % 60;

	printf("%d:%d:%d\n", h, m, S);
	
	return 0;
}
	
	
	


Measured memory_bytes: 2144
/*input
4 5
1 2
2 3
2 4
4 1
4 3
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=1005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,y)
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
int main() {
    int h,w;
    cin>>h>>w;
    int ans=0;
    REP(i,h){
        REP(j,w){
            char x;
            cin>>x;
            ans+=(x=='#');
        }
    }
    if(ans==(h+w-1)){
        cout<<"Possible";
    }    
    else{
        cout<<"Impossible";
    }
}

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

using namespace std;

int main(){
    int l, r;
    int mod = 2019;
    cin >> l >> r;
    int ans = 2019;
    if(l / mod < r / mod) ans = 0;
    l %= mod;
    r %= mod;
    for(int i = l; i <= r && i <= 2019; i++){
        if(i % 2019 == 0){
            ans = 0;
            break;
        }
        for(int j = i + 1; j <= r && j <= 2019; j++){
            if(j % 2019 == 0 || (i % 3 == 0 && j % 673 == 0) || (j % 3 == 0 && i % 673 == 0)){
                ans = 0;
                break;
            }
            ans = min(ans, ((i % mod) * (j % mod)) % mod);
        }
        if(ans == 0){
            break;
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
#include <algorithm>
#include <atcoder/all>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using namespace atcoder;
using ll = long long;

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

	dsu d(N);

	for (int i = 0; i < Q; i++) {
		int t, u, v;
		cin >> t >> u >> v;
		if (t == 0) {
			d.merge(u, v);
		} else {
			if (d.same(u, v)) {
				cout << 1 << endl;
			} else {
				cout << 0 << endl;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 4084
#include <stdio.h>

int main()
{
    int x;
    if ( scanf("%d", &x) != 1 || x < 1 || x > 3000) {
        printf("InputError!\n");
        return -1;
    }

    if (x < 1200) printf("ABC");
    else          printf("ARC");

    return 0;
}

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

int main() {
    int n;
    cin >> n;
    cout << (n+1)/2 << endl;

    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        n: usize,
        av: [u64; n]
    };

    let mut res = 0_u64;
    let mut max = 0;
    for a in av {
        max = max.max(a);
        res += max - a;
    }
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


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

int main() {
    long long n;
    scanf("%lld", &n);
    char s[10000];
    int nCount = 0;
    while(n) {  
        bool res = false;
        int m = n % 26;
        if(m == 0) {
            m = 26;
            res = true;
        }
        s[nCount++] = m + 'a' - 1;
        n /= 26;
        if(res) {
            n--;
        }
    }
    for(int i=nCount-1; i>=0; i--) {
        printf("%c", s[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 3708
#include <stdio.h>

int main(void){
    int n;
    int x[100+5];
    scanf("%d", &n);
    for(int i=0; i<n; i++)scanf("%d", &x[i]);
    
    int p=0;
    for(int i=0; i<n; i++)p+=x[i];
    p/=n;
    
    // 平均をpとして計算
    int ans1=0;
    for(int i=0; i<n; i++){
        ans1+=(x[i]-p)*(x[i]-p);
    }
    
    // 平均+1で計算
    int ans2=0;
    p++;
    for(int i=0; i<n; i++){
        ans2+=(x[i]-p)*(x[i]-p);
    }
    
    if(ans1<ans2)printf("%d\n", ans1);
    else printf("%d\n", ans2);
    return 0;
}


Measured memory_bytes: 1736
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto W = RD;
	auto H = RD;
	auto N = RD;
	auto xya = new long[3][](N);
	foreach (i; 0..N)
	{
		xya[i] = [RD, RD, RD];
	}

	long l, r = W, t, b = H;
	foreach (i; 0..N)
	{
		if (xya[i][2] == 1)
			l = max(l, xya[i][0]);
		else if (xya[i][2] == 2)
			r = min(r, xya[i][0]);
		else if (xya[i][2] == 3)
			t = max(t, xya[i][1]);
		else
			b = min(b, xya[i][1]);
	}
	
	writeln(max(r - l, 0) * max(b - t, 0));
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
n = int(input())
arr = list(map(int, input().split()))
  
cost = [0]*n
cost[0] = 0
for i in range(1, n):
  if i > 1:
    cost[i] = min(abs(arr[i]-arr[i-2])+cost[i-2], abs(arr[i]-arr[i-1])+cost[i-1])
  elif i == 1:
    cost[i] = abs(arr[i]-arr[i-1])

print(cost[-1])

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

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  rd(string, s);
  wt(count(all(s), '+') - count(all(s), '-'));
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int a,b,c,d;

    Scd2(a,b);
    Scd2(c,d);

    printf("%d\n", max(a*b,c*d));

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())

const int N = 110, K = 1e5 + 100, mod = 1e9 + 7;
vector<vector<int>> dp(N, vector<int>(K, 0));

class Fenwick{
public:
    int n;
    vector<int> bit;
    Fenwick() {}
    Fenwick(int sz, vector<int> &a) {
        this->n = sz;
        bit.assign(n + 10, 0);
        for (int i = 0; i < n; i++) {
            add(i, a[i]);
        }
    }
    void add(int idx, int val) {
        for (++idx; idx <= n; idx += idx & -idx) {
            bit[idx] += val;
        }
    }
    int sum(int idx) {
        int res = 0;
        for (++idx; idx > 0; idx -= idx & -idx) {
            res += bit[idx];
            res %= mod;
        }
        return res;
    }

    int sum (int l, int r) {
        return (sum(r) - sum(l - 1) + mod) % mod;
    }
};

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    int a[n + 1];
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    dp[0][k] = 1;
    for (int i = 1; i <= n; i++) {
        Fenwick fen(k + 1, dp[i - 1]);
        for (int j = 0; j <= k; j++) {
            dp[i][j] = fen.sum(j, min(k, j + a[i]));
        }
    }
    cout << dp[n][0] << "\n";
}

Measured memory_bytes: 87296
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int n;
  cin >> n;
  int mi = 2e9, ma = -2e9;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    mi = min(mi, x);
    ma = max(ma, x);
  }
  cout << ma - mi << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define P(x) cout << x << endl
#define D(x) P(#x << ": " << x)
#define F(i,n) for (int i=0; i<(int)(n); i++)
#define DEC(i,n) for (int i=(int)(n); --i>=0;)
#define S(s) (int)((s).size())
#define ALL(v) v.begin(), v.end()
#define MI(a,v) a = min(a,(v))
#define MA(a,v) a = max(a,(v))
#define V vector
#define pb push_back
#define mt make_tuple
using namespace std;

int rup(int a, int n) {
    return (a+n-1)/n;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,a,b; cin>>n>>a>>b;
    int h[n];
    F(i,n) cin>>h[i];
    int lo=-1, hi=1e10;
    while (hi-lo >= 2) {
        int t = (lo+hi)/2;
        int nec=0;
        F(i,n) {
            nec += max(0LL, rup(h[i]-b*t, a-b));
        }
        if (nec > t)
            lo = t;
        else
            hi = t;
    }
    P(hi);
}

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

int main(){
  int64_t N;
  cin >> N;
  int64_t S=(int64_t)pow(N, 0.5);
  for(int64_t i=S; S>0LL; S--){
    if(N%S==0LL){
      cout << (int64_t)log10(N/S)+1 << endl;
      break;
    }
  }
}

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

int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    rep(i, H)
    {
        cin >> S[i];
    }
    rep(i, W + 2)
    {
        cout << "#";
        if (i == W + 1)
        {
            cout << endl;
        }
    }
    rep(i, H)
    {
        cout << "#" << S[i] << "#" << endl;
    }
    rep(i, W + 2)
    {
        cout << "#";
        if (i == W + 1)
        {
            cout << endl;
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 300

int main(void){
    int H[MAX],W[MAX];
    int i=0,j,w,h;
    for (i=0; i<MAX; i++) {
        scanf("%d %d",&H[i],&W[i]);
        if(H[i]==0&&W[i]==0){
            break;
        }
        else{
            if(H[i]<3||W[i]<3||300<H[i]||300<W[i]){
                return 0;
            }
        }
    }
    
    for(j=0;j<i;j++){
        for(h=0;h<H[j];h++){
            for(w=0;w<W[j];w++){
                if(w==0||w==W[j]-1||h==0||h==H[j]-1){
                    printf("#");
                }
                else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2104
import java.util.*;

class Piece {
    private int position;

    public Piece() {

    }

    public void setPosition(int pos) {
        this.position = pos;
    }

    public int getPosition() {
        return this.position;
    }

    public void movePosition() {
        this.position++;
    }
}

class Rule {
    public Rule() {

    }

    public void movePiece(Piece piece1, Piece piece2) {
        int pos1 = piece1.getPosition();
        int pos2 = piece2.getPosition();

        if (pos1 + 1 != pos2) {
            piece1.movePosition();
        }
    }
}

public class Main {

    public static void main(String[] args) {
        // write your code here
        final int MAX_POS = 2020;

        Rule rule = new Rule();
        Scanner sc = new Scanner(System.in);

        int N = Integer.parseInt(sc.next());
        Piece[] pieces = new Piece[N + 2];
        for (int i = 1; i <= N; i++) {
            int X = Integer.parseInt(sc.next());
            pieces[i] = new Piece();
            pieces[i].setPosition(X);
        }
        
        pieces[N + 1] = new Piece();
        pieces[N + 1].setPosition(MAX_POS);

        int M = Integer.parseInt(sc.next());
        for (int i = 0; i < M; i++) {
            int A = Integer.parseInt(sc.next());
            rule.movePiece((pieces[A]), pieces[A + 1]);
        }

        for (int i = 1; i <= N; i++) {
            System.out.println(pieces[i].getPosition());
        }
    }
}



Measured memory_bytes: 26352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Main
{
    class Program
    {
        static void Main(string[] arg)
        {
            //int n = int.Parse(Console.ReadLine());
            var Line = GetIntList(Console.ReadLine());
            int a = Line[0];
            int b = Line[1];

            if(b % a == 0)
            {
                Console.WriteLine(a + b);
            }
            else
            {
                Console.WriteLine(b-a);
            }
            //Console.WriteLine();
            Console.ReadLine();

        }
        private static int[] GetIntList(string line)
        {
            return line.Split(' ').Select(x => int.Parse(x)).ToArray();

        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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; }

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


long long r, D, x;

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

    while (cin >> r >> D >> x) {
        for (int i = 0; i < 10; ++i) {
            x = x * r - D;
            cout << x << endl;
        }
    }
    
}


















Measured memory_bytes: 256
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()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let xy = read_vec::<u64>();
    let (x,y) = (xy[0]-1,xy[1]-1);
    let v = vec![1,3,1,2,1,2,1,1,2,1,2,1];
    let ans = if (v[x as usize] == v[y as usize]){
        "Yes"
    } else{
        "No"
    };
    println!("{}",ans );
}

Measured memory_bytes: 4352
### constant

MAX_INT = 1 << 30

HDXYS = {
  "5" => [0, 0],
  "8" => [0, -1], "6" => [1, 0], "4" => [-1, 0], "2" => [0, 1]
}
DXYS = [[0, 0], [0, -1], [1, 0], [-1, 0], [0, 1]]

### main

loop do
  h, w = gets.split.map(&:to_i)
  break if h == 0 && w == 0

  hw = h * w
  mat = h.times.map{w.times.map{true}}
  gst = hst = nil

  for y in (0...h)
    line = gets.strip
    for x in (0...w)
      case line[x]
      when '#'
        mat[y][x] = false
      when 'A'
        gst = [x, y]
      when 'B'
        hst = [x, y]
      end
    end
  end
  #p mat
  #p [gst, hst]

  hpat = gets.strip
  nhpat = hpat.length
  #p [nhpat, hpat]

  dists = nhpat.times.map{hw.times.map{hw.times.map{MAX_INT}}}
  dists[0][gst[0] + gst[1] * w][hst[0] + hst[1] * w] = 0

  q = [[0, *gst, *hst]]
  #p q

  min_t = []

  while ! q.empty?
    ut, ugx, ugy, uhx, uhy = q.shift
    if ugx == uhx && ugy == uhy
      min_t = [dists[ut][ugx + ugy * w][uhx + uhy * w], ugy, ugx]
      break
    end

    du = dists[ut][ugx + ugy * w][uhx + uhy * w]

    hdx, hdy = HDXYS[hpat[ut]]
    vhx = uhx + hdx
    vhy = uhy + hdy
    if vhx < 0 || vhx >= w || vhy < 0 || vhy >= h
      vhx = uhx
      vhy = uhy
    end
    vhid = vhx + vhy * w

    vt = (ut + 1) % nhpat

    for dxy in DXYS
      vgx = ugx + dxy[0]
      vgy = ugy + dxy[1]

      if vgx >= 0 && vgx < w && vgy >= 0 && vgy < h && mat[vgy][vgx]
        vgid = vgx + vgy * w
        dv = dists[vt][vgid][vhid]
        if dv > du + 1
          dists[vt][vgid][vhid] = du + 1
          if dv >= MAX_INT
            q << [vt, vgx, vgy, vhx, vhy]
          end
        end
      end
    end
  end

  if min_t.empty?
    puts 'impossible'
  else
    puts min_t.join(' ')
  end
end

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

using namespace std;

const int N = 100010;

int n; 
long long a[N];

int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  long long ans = 0;
  for (int i = 1; i <= n;) {
    if (!a[i]) {
      ++i;
      continue;
    }
    int j = i;
    long long tot = 0;
    while (j <= n and a[j]) tot += a[j++];
    ans += tot / 2, i = j;
  }
  cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 4364
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){ return (int)s.size(); }

int main(){
    cout << setprecision(20);
    int n,t; cin >> n >> t;
    ll ans = 0;
    vi a(n);
    rep(i,n) cin >> a[i];
    rep(i,n-1)
        ans += min(t, a[i+1]-a[i]);
    cout << ans + t << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n,ans = 0;
	cin >> n;
	for(int i = 1;i * i <= n;i++){
		if(n % i == 0){
			int _i = n / i;
			if(_i - 1 > i) ans += _i - 1;
			else if(i - 1 > _i) ans += i - 1;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#define ll long long

using namespace std;

ll a[200002];

bool isValid(ll n,ll k,ll x){
  ll count=0;
  for(ll i=0;i<n;i++){
    if(a[i]>x) count+=a[i]/x;
  }
  return (count<=k);
}

ll getAns(ll n, ll k){
  if(k==0){
    ll ans=a[0];
    for(ll i=1;i<n;i++) ans=max(ans,a[i]);
    return ans;
  }
  
  ll low=1;
  ll high=1000000002;
  ll mid=0;
  ll ans;
  
  while(low<=high){
 	mid = low + (high-low)/2;
    if(isValid(n,k,mid)){
      ans=mid;
      high=mid-1;
    }
    else low=mid+1;
  }
  return ans;
}
  

int main(){
  ll n,k;
  cin>>n>>k;
  
  for(ll i=0;i<n;i++) cin>>a[i];
  
  cout<<getAns(n,k)<<'\n';
}


Measured memory_bytes: 5156
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`

										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	s := next()

	l := 0
	r := len(s) - 1
	ans := 0

	for l < r {
		if s[l] != s[r] {
			if s[l] == 'x' && s[r] != 'x' {
				l++
				ans++
			} else if s[l] != 'x' && s[r] == 'x' {
				r--
				ans++
			} else {
				ans = -1
				break
			}
		} else {
			l++
			r--
		}
	}

	//fmt.Fprintln(out, "[DEBUG]", a)
	fmt.Fprintln(out, ans)

}

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

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func printArray(a []int) {
	for i := 0; i < len(a); i++ {
		if i >= 1 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, a[i])
	}
	fmt.Fprintln(out)
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}

// 挿入ソート配列
type slist struct {
	l []int
}

func makeSlist() slist {
	return slist{[]int{}}
}

func (s *slist) add(a int) {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	if pos < len(s.l) {
		s.l = append(s.l[:pos+1], s.l[pos:]...)
		s.l[pos] = a
	} else {
		s.l = append(s.l, a)
	}
}
func (s slist) contains(a int) bool {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	return pos < len(s.l) && s.l[pos] == a
}


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

int main(){

  string s;
  cin >> s;
  s = s.substr(0, s.size() - 1);

  int len;
  for(len = s.size()/2; len>=0; len--){
    if(s.substr(0, len) == s.substr(len, len)){
      break;
    }
  }

  cout << len * 2 << endl;
 return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  ll n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;

  rep(i, n) {
    ll j = n - 1 - i;
    if (i * c - j * d <= a - b && a - b <= i * d - j * c) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";






  
  return 0;
}

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

int main() {
	int n;
	int ara[200000];
	cin>>n;
	long long int s=0;
	for (int i=0;i<n;i++){
		cin>>ara[i];
		s=s^ara[i];
	}
	for (int i=0;i<n;i++){
		cout<<(s^ara[i])<<" ";
	}
	
	return 0;
}

Measured memory_bytes: 4320
#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;

int main(){
	int n;
	cin >> n;
	while( n-- > 0 ){
		string num1, num2;
		cin >> num1 >> num2;
		if( num1.size() > 80 || num2.size() > 80 ){
			cout << "overflow" << endl;
			continue;
		}
		int sum[101];
		int degit = 0;
		for( int i = 0; i < 101; i++ ) sum[i] = 0;
		for( int i = 0; i < num1.size(); i++ ){
			sum[100-i] = num1[num1.size()-i-1]-'0';
		}
		int d;
		for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){
			int now;
			if( i < num2.size() ){
				now = sum[100-i] + (int)num2[num2.size()-i-1]-(int)('0') + degit;
			}else{
				now = sum[100-i] + degit;
			}
			sum[100-i] = (now%10);
			if( now >= 10 ) degit = 1;
			else degit = 0;
			d = i;
		}
		if( d < 80 ){
			for( int i = 100-d; i < 101; i++ ) cout << sum[i];
			cout << endl;
		}else{
			cout << "overflow" << endl;
		}
	}
}

Measured memory_bytes: 1208
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ O(logN)
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//

int n;
int a[30];

bool solve(int i, int k) {
    if (i < n) {
        return solve(i + 1, k) || solve(i + 1, k - a[i]);
    }
    else {
        if (k == 0) return true;
        else return false;
    }
}

int main() {

    cin >> n;
    rep(i,n) cin >> a[i];
    int q; cin >> q;
    int m[q]; 
    rep(i,q) cin >> m[i];
    rep(i,q) {
        if (solve(0, m[i])) cout << "yes" << endl;
        else cout << "no" << endl;
    }


    return 0;
}











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

using namespace std;

typedef long long ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll N, K;
    cin >> N >> K;
    ll a = N % K;
    ll b = (K - a) % K;
    cout << min(a, b) << endl;

    return 0;
}

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

int main() {
  int n,k,x,y;
  cin>>n>>k>>x>>y;
  if(k<=n)
    cout<<k*x+y*(n-k)<<endl;
  if(k>n) {
    cout<<n*x<<endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
 
using namespace std;
 
int main(){
    int n,x;
    scanf("%d",&n);
 
    for(int i = 1; i<= n; i++)
    {
        if(i%3 == 0){
            printf(" %d",i);
        }else{
            x = i;
            do{
                if(x%10 == 3){
                    printf(" %d",i);
                    break;
                }
                x /=10;
            }while(x);
        }
    }
    printf("\n");
}

Measured memory_bytes: 2740
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  int ac = 0, wa = 0;
  vector<int> a(n, 0);
  for (int i = 0; i < m; i++) {
    int p;
    string s;
    cin >> p >> s;
    p--;
    if (a[p] <= 0 && s == "AC") {
      ac++;
      wa += -a[p];
      a[p] = 1;
    }
    else if (a[p] == 1 && s == "AC") {
      continue;
    }
    else if (a[p] <= 0 && s == "WA") {
      a[p]--;
    }
    else if (a[p] == 1 && s == "WA") {
      continue;
    }
  }
  cout << ac << " " << wa << endl;
  return 0;
}

Measured memory_bytes: 640
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

vector<string> ans;

void solve(int k, const int n, string s, char maxi){
    if(k == n){
        ans.push_back(s);
        return;
    }

    if(k == 0){
        solve(1, n, "a", 'a');
    }else{
        for(char c = 'a' ; c <= maxi + 1 ; c++){
            solve(k + 1, n, s + c, max(maxi, c));
        }
    }

    return;
}

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int n;
    cin >> n;

    solve(0, n, "", 'A');

    SORT(ans);

    for(auto s : ans){
        cout << s << endl;
    }

    cout << flush;

    return 0;
}

Measured memory_bytes: 7796
#include<iostream>
#include<cstdio>
#include<cstring>

int Hash[300000000];
char s[13];  
 
int getChar(char ch){
	if(ch=='A') return 1;
	else if(ch=='C') return 2;
	else if(ch=='G') return 3;
	else return 4;
}
 
int getKey(){
	int sum=0,p=1;
	
	for(int i=0;i<strlen(s);i++){
		sum+=p*(getChar(s[i]));
		p*=5;
	}
	return sum;
}
 
int main(){
	int n;
	char com[7];
	
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%s %s",com,s);
		if(com[0]=='i'){
			Hash[getKey()]=1;
		}
		else{
			if(Hash[getKey()]==1)
			puts("yes");
			else
			puts("no");
		}
	}
}

Measured memory_bytes: 20052
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;
string s;
int dp[80001][11];

void solve() {
    memset(dp,0,sizeof(dp));
    if(s[0]!='0') {
        dp[0][s[0]-'0']++;
    }
    rep(i,s.size()) if(i) {
        rep(j,11) {
            dp[i][(j*10+s[i]-'0')%11]+=dp[i-1][j];
        }
        if(s[i]!='0') dp[i][s[i]-'0']++;
    }
    int ans=0;
    rep(i,s.size()) ans+=dp[i][0];
    cout<<ans<<endl;
}

int main() {
    while(cin>>s) {
        if(s=="0") break;
        solve();
    }

    return 0;
}

Measured memory_bytes: 4760
#include "stdio.h"
#include "stdlib.h"

int main(void)
{
  int n;
  scanf("%d\n", &n);

  char s[101], t[101];
  scanf("%s %s", s, t);

  for (int i = 0; i < n; i++) {
    printf("%c%c", s[i], t[i]);
  }

  return 0;
}


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

#define INF 100000000
#define ABS(a) (a<0?-(a):a)
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define REP(i,a) for(int i=0;i<a;i++) 

using namespace std;
int main(){
  int W, a, b;
  cin >> W >> a >> b;
  if((a <= b && b <= a+W) || (b <= a && a <= b+W)){
    cout << 0 << endl;
  }else{
    cout << MIN(ABS(a+W-b), ABS(b+W-a)) << endl;
  }

}



Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2,tune=native")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("trapv")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
const ll mod = 7 * 17 * (1 << 23) + 1;
const ll inf = 1e18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());\
int a[] = { 100000, 200000, 300000 };
int main() { //DINIC ORZ
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n, s = 0, c = 0;
	vi a;
	cin >> n;
	a.resize(n);
	for(auto &i : a) cin >> i, s += i;
	ll ans = s;
	for(auto i : a) {
		c += i;
		ans = min(ans, abs(s-2*c));
	}
	cout << ans;
}


Measured memory_bytes: 1792
using System;

class AtCoder
{
    static void Main()
    {
        string str;
        Boolean A=false ,B=false, C=false;
        str = Console.ReadLine();

        for(int i = 0 ; i < str.Length ; i++){
            if (str[i] == 'a')
                A = true;
            if (str[i] == 'b')
                B = true;
            if (str[i] == 'c')
                C = true;
        }

        if (A == true && B == true && C == true)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }

}

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

int main(){
  int H, W;
  for (int i = 0; i < 100000; i++){
    cin >> H >> W;
    if (H == 0 && W == 0){
      break;
    }
    else{
      for (int j = 0; j < H; j++){
        for (int k = 0; k < W; k++){
          cout << "#";
        }
        cout << endl;
      }
      cout << endl; 
    }
  }
} 



Measured memory_bytes: 3112
#include <iostream>

void swap(int *array, const int i, const int j) {
  int t = array[i];
  array[i] = array[j];
  array[j] = t;
}

int main(int argc, char const* argv[])
{
  int n[3];
  std::cin >> n[0] >> n[1] >> n[2];
  if (n[0] > n[1])
    swap(n, 0, 1);
  if (n[1] > n[2])
    swap(n, 1, 2);
  if (n[0] > n[1])
    swap(n, 0, 1);
  std::cout << n[0] << " " << n[1] << " " << n[2] << std::endl;
  return 0;
}

Measured memory_bytes: 1164