akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());

		ArrayList<Integer> r = new ArrayList<Integer>();

		for(int i = 1; i <= n; i++) {
			r.add(Integer.parseInt(sc.next()));
		}

		/**
		 * ループ処理
		 * t=1→N-1で探索
		 * Rの最小値を保持し、それを用いてRの差分の最大値を求める
		 */
		int minr = r.get(0);
		int maxdr = r.get(1) - r.get(0);
		for(int i = 2; i < n; i++) {
			if(r.get(i-1) < minr) {
				minr = r.get(i-1);
			}
			if(r.get(i) - minr > maxdr) {
				maxdr = r.get(i) - minr;
			}
		}

		System.out.println(maxdr);

	}

}



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

/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//main function
fn main() {
    let m_1: i32 = read();
    let _a: i32 = read();
    let m_2: i32 = read();
    let _b: i32 = read();
    if m_1 != m_2 {
	println!("1");
    }else {
	println!("0");
    }
}


Measured memory_bytes: 4352
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int n;
ll a[100100], b[100100];
ll atot, btot;
int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%lld", &a[i]);
		atot += a[i];
	}
	for (int i = 1; i <= n; i++)
	{
		scanf("%lld", &b[i]);
		btot += b[i];
	}
	if (atot < btot)
	{
		printf("-1\n");
		return 0;
	}
	int ans = 0;
	ll diff = 0;
	vector<ll> v;
	for (int i = 1; i <= n; i++)
	{
		if (a[i] < b[i])
		{
			diff += b[i] - a[i];
			ans++;
		}
		else if (a[i] > b[i])
		{
			v.push_back(a[i] - b[i]);
		}
	}
	sort(v.begin(), v.end());
	for (int i = v.size() - 1; i >= 0 && diff>0; i--)
	{
		diff -= v[i];
		ans++;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2428
import sys

sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline

######################################################

INF = 1e10

N, K = [int(_) for _ in input().split()]


def f(b):
    """
    a= b*x + r
    a=[0,N] まで回すとき, あまり r は 0,1,...,b-1 と順番に出現する. (x = a//b)
    """
    p = (N // b)  # r が p 回 [0,b-1] をループ
    ans = max(p * (b - K), 0)

    # 残りの分
    ans += max(N % b - K + 1, 0)

    if K == 0:
        ans -= 1

    return ans

def main():
    ans =0
    for b in range(1,N+1):
        ans+=f(b)
    print(ans)
main()



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007 
#define ll long long 
#define N 200005
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define piii pair<int, pii>
#define print(x) cout << #x << "=" << x << "\t";
#define endl "\n"
#define newline cout << endl;

int n;
int cap;
int w[N];
int v[N];
ll dp[2][N];

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); 
    cin >> n >> cap;
    for(int i=1;i<=n;i++)
        cin >> w[i] >> v[i];
    
    int act = 0, pas = 1;
    for(int i = 1; i <= n; i++) {
        swap(act, pas);
        for(int j = 0; j <= cap; j++)
            dp[act][j] = dp[pas][j];
        for(int j = w[i]; j <= cap; j++)
            dp[act][j] = max(dp[act][j], v[i] + dp[pas][j - w[i]]);
    }
    cout << dp[act][cap];
    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
const int inf=0x3f3f3f3f;
int read()
{
	int r=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')r=(r<<1)+(r<<3)+ch-'0',ch=getchar();
	return r*f;
}
bool np[10000100];
int pri[5000500],tot;
void Euler()
{
	np[1]=1;int ma=1e7;
	for(int i=2;i<=ma;++i)
	{
		if(!np[i])pri[++tot]=i;
		for(int j=1;j<=tot&&i*pri[j]<=ma;++j)
		{
			np[i*pri[j]]=1;
			if(i%pri[j]==0)break;
		}
	}
}
int n;
bool po[10000100];
int pos[550];
struct data{
	int to,nxt,c;
}mp[200200];
int head[550],cnt=1;
int s,t;
int cur[550];
void link(int x,int y,int c)
{
	mp[++cnt].to=y;
	mp[cnt].nxt=head[x];
	mp[cnt].c=c;
	head[x]=cnt;
}
void add(int x,int y,int c)
{
	link(x,y,c);link(y,x,0);
//	cout<<"x: "<<x<<" y: "<<y<<endl;
}
int dis[550];
queue<int>q;
bool bfs()
{
	for(int i=1;i<=t;++i)dis[i]=0;
	dis[s]=1;q.push(s);
	int u;
	while(!q.empty())
	{
		u=q.front();q.pop();
		for(int i=head[u];i;i=mp[i].nxt)
			if(!dis[mp[i].to]&&mp[i].c)
				dis[mp[i].to]=dis[u]+1,q.push(mp[i].to);
	}
	return dis[t];
}
int dfs(int x,int f)
{
	if(x==t)return f;
//	cout<<"x: "<<x<<" f: "<<f<<endl;
	int fl,rf=0;
	for(int& i=cur[x];i;i=mp[i].nxt)
		if(dis[mp[i].to]==dis[x]+1&&mp[i].c)
		{
			fl=dfs(mp[i].to,min(f,mp[i].c));
			if(fl)
			{
				f-=fl;rf+=fl;
				mp[i].c-=fl;
				mp[i^1].c+=fl;
				if(!f)break;
			}
		}
	return rf;
}
int Dinic()
{
	int maxflow=0,flow;
	while(bfs())
	{
		for(int i=1;i<=t;++i)cur[i]=head[i];
		while(flow=dfs(s,inf))maxflow+=flow;
	}
	return maxflow;
}
int main()
{
	Euler();
//	for(int i=1;i<=10;++i)cout<<np[i]<<" ";cout<<endl;
	scanf("%d",&n);
	for(int i=1;i<=n;++i)po[read()]=1;
	n=0;
	for(int i=1;i<=1e7+1;++i)
		if(po[i]!=po[i-1]) pos[++n]=i;
	s=n+1,t=n+2;
	int odd=0,even=0;
//	for(int i=1;i<=n;++i)cout<<pos[i]<<" ";cout<<endl;
	for(int i=1;i<=n;++i)
		if(pos[i]&1)
		{
			add(s,i,1);
			odd++;
			for(int j=1;j<=n;++j)
				if((!(pos[j]&1))&&(!np[abs(pos[i]-pos[j])]))
					add(i,j,1);
		}
	for(int i=1;i<=n;++i)
		if(!(pos[i]&1))add(i,t,1),even++;
//	cout<<"even: "<<even<<" odd: "<<odd<<endl;
//	cout<<"wuhuu\n";
	int ans=Dinic();
//	cout<<"ans: "<<ans<<endl;
	even-=ans;odd-=ans;
	if((even&1)||(odd&1))ans+=3;
	even-=even&1;odd-=odd&1;
	ans+=even+odd;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 25472
package main
import "fmt"

func main () {
        var W, H, x, y, r int

        fmt.Scan(&W)
        fmt.Scan(&H)
        fmt.Scan(&x)
        fmt.Scan(&y)
        fmt.Scan(&r)

        if y + r > H || y + r < 0 || x + r > W  || x + r < 0 || x < 0 || y < 0 {
                fmt.Println("No")
        } else {
                fmt.Println("Yes")
        }
}


Measured memory_bytes: 1192
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
    os << p.first << ":" << p.second;
    return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

// edit

void solve() {
    ll X;
    cin >> X;
    
    ll m = 100;
    int y = 0;
    while(true){
        if(m >= X){
            break;
        }
        
        y++;
        m += m / 100;
    }
    
    cout << y << endl;

}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


Measured memory_bytes: 3176
// Problem : 
// 			E - Almost Everywhere Zero
// 			Editorial
// 		
// Contest : AtCoder - AtCoder Beginner Contest 154
// URL : https://atcoder.jp/contests/abc154/tasks/abc154_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long   ll;
typedef long double ld;
typedef complex< ld > cd;
 
typedef pair<int, int> pi;
typedef pair<ll, ll>   pl;
typedef pair<ld, ld>   pd;
 
typedef vector< int > vi;
typedef vector< ld >  vd;
typedef vector< ll >  vl;
typedef vector< pi >  vpi;
typedef vector< pl >  vpl;
typedef vector< cd >  vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a)    for (int i=0; i<(a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a)     for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)    for (auto& a : x)
#define uid(a, b)     uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f  first
#define s  second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

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

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
string n;
int k;
ll dp[101][3][2];
ll rec(int ind,int left,bool low)
{
		if(left==0)
		return 1;
		if(ind == sz(n))
		return 0;
		if(dp[ind][left][low]!=0)
		return dp[ind][left][low];
		int r=low ? 9:n[ind]-'0';
		ll ans=0;
		loop(i,r+1)
		ans+=rec(ind+1,left-(i!=0),low||(i<n[ind]-'0'));
		dp[ind][left][low]=ans;
		return dp[ind][left][low];
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	cin>>n>>k;
	cout<<rec(0,k,0);
	memset(dp,-1,sizeof dp);
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3684
// https://atcoder.jp/contests/abc087/tasks/abc087_b

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

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

    long ans = 0;
    for (int i = 0; i <= a; i++)
    {
        int s = 500 * i;
        for (int j = 0; j <= b; j++)
        {
            int t = s + 100 * j;
            for (int k = 0; k <= c; k++)
            {
                if (t + 50 * k == x)
                {
                    ans++;
                }
            }
        }
    }

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


Measured memory_bytes: 3584
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
begin = sum(a)
c = 0
for i in range(n):
  a[i] = a[i]-c if a[i]>c else 0
  c = 0
  c = b[i] - a[i] if b[i]>a[i] else 0
  a[i] = a[i]-b[i] if a[i]>b[i] else 0
a[n] = a[n]-c if a[n]>c else 0
after = sum(a)
print(begin-after)

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

using namespace std;

typedef long long ll;

#define INF 10000000
#define mp make_pair
#define fi first
#define se second

int main(){

    ios_base::sync_with_stdio(false);cin.tie(0);
    string s;
    cin >> s;
    string a = s;
    reverse(a.begin(),a.end());
    if(s == a){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <string>
    #include <algorithm>
    #include <set>
    #include <map>
    #include <list>
    #include <queue>
    #include <stack>
    #include <deque>
    #include <vector>
    #include <bitset>
    #include <cmath>
    #include <utility>
    #include <ctime>
    #define Maxn 100005
    #define Maxm 1000005
    #define lowbit(x) x&(-x)
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    #define PI acos(-1.0)
    #define eps 1e-8
    #define random(x) (rand()%x)+1
    #define LL long long
    #define Inf (1LL<<62)
    #define inf 0x3f3f3f3f
    #define input freopen("input.txt","r",stdin)
    #define output freopen("output.txt","w",stdout)
    using namespace std;
    int main()
    {
        int n,sum,ans;
        int dp[Maxn],arr[105];
        //input;output;
        while(~scanf("%d",&n))
        {
            sum=ans=0;
            memset(dp,0,sizeof(dp));
            for(int i=0;i<n;i++)
                scanf("%d",arr+i),sum+=arr[i];
            dp[0]=1;
            for(int i=0;i<n;i++)
            	for(int j=sum;j>=arr[i];j--)
                    if(dp[j-arr[i]])
                    	dp[j]=1;
            for(int i=sum;i>=0;i--)
                if(dp[i]&&i%10)
                {
                    ans=i;
                    break;
                }
            printf("%d\n",ans);
        }
    }

Measured memory_bytes: 640
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
L, R = 0, n

for i in range(m):
    l, r = map(int, input().split())
    L = max(l, L)
    R = min(r, R)

ans = max(R-L+1, 0)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
int INF=1e9;
int MOD=1e9+7;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
double EPS = 1e-10;
const int mod=1e9+7;
const double pai=3.14159265358979;
int main(){
	ll n,ans=1;
	cin>>n;
	REP(i,n)ans=ans*(i+1)%MOD;
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(){
	int x, max = 1;

	scanf("%d", &x);
	int p;

	if (x != 1) {
		for (int i = 2; i < x; ++i) {
			p = 2;
			while (pow(i, p) <= x)
			{
				max = fmax(max, pow(i, p));
				++p;
			}
		}
	}
	else {
		max = 1;
	}

	printf("%d", max);

	return 0;
}

Measured memory_bytes: 128
function Main(input) {
    var args = input.trim().split('\n');
    var half =  args[1].substr(0,args[1].length / 2);
    var res;
    if(half + half === args[1]) {
      res = 'Yes';
    } else {
      res = 'No';
    }
    console.log(res);
 }
 
/* var input = `9
abcdabcde`;
Main(input);
 */  
 Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
//#include <bits/stdc++.h>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007


#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 

 
int main() {
    ll N,K;
    cin >> N;
    ll a[N];
    ll ans=1;
    ll sum=0;
    FOR(i,0,N-1){
      cin>>a[i];
    }
    FOR(i,0,N-1){
      ans=lcm(a[i],ans);
    }

  cout<<ans<<endl;

  return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
/* this code is generated by shikhar verma . Dont try to copy it. You may be booked under plaigarism. */
//int numberofPaths(int h,int w,int a,int b);
int main()
{
    ll n,i,j,len1,b,h,w,t,cnt=0,cnt1=0;
   /* freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin>>n;
	ll a[2*n];
	for(i=0;i<2*n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+2*n);
    for(i=0;i<2*n;i=i+2)
    {
        cnt+=a[i];
    }
    cout<<cnt;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl


signed main(void){
    string S;
    cin >> S;
    if((S.size())%2==1){
        cout << "No" << endl;
        return 0;
    }
    REP(i,S.size()){
        if(!((i%2==0 && S[i]=='h')||(i%2==1 && S[i]=='i'))){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    
    return 0;
}



Measured memory_bytes: 256
//#pragma warning(disable:4996)
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, ll> pill;

#define eps 1e-10
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 2005;
const ll mod = 1000000007;
const double PI = acos(-1.0);

int n,k;
vector<int>edge[maxn];
int u[maxn],v[maxn];

int dfs(int x,int fa,int dis)
{
    int res=(dis<0);
    int sz=edge[x].size();

    int k=0;
    rep(i,0,sz)
    {
        k=edge[x][i];
        if(k==fa)continue;
        
        res += dfs(k,x,dis-1);
    }
    return res;
}

void solve()
{
    sa(n),sa(k);
    int i,j;
    
    repp(i,1,n-1)
    {
        sa(u[i]),sa(v[i]);
        edge[u[i]].push_back(v[i]);
        edge[v[i]].push_back(u[i]);
    }
    
    int res=n;
    
    repp(i,1,n)
    {
        res = min( res, dfs(i, -1 , k/2));
    }
    repp(i,1,n-1)
    {
        res=min( res , dfs( u[i] , v[i] , (k-1)/2 ) + dfs( v[i] , u[i] , (k-1)/2 ));
    }
    printf("%d\n", res);
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 512
from collections import Counter as c
n=int(input())
*l,=map(int,input().split())

ca=sorted(c(l[1::2]).items(),key=lambda x:x[1])[::-1]
cb=sorted(c(l[0::2]).items(),key=lambda x:x[1])[::-1]

v1=sum([i[1] for i in ca])
v2=sum([i[1] for i in cb])

a1=ca[0][0]
for i in cb:
  if a1==i[0]:continue
  b=i[1]
  break
else:
  b=0
ans1=v2-b+v1-ca[0][1]

a1=cb[0][0]
for i in ca:
  if a1==i[0]:continue
  b=i[1]
  break
else:
  b=0
ans2=v1-b+v2-cb[0][1]

print(min(ans1,ans2))


Measured memory_bytes: 72044
#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>;

int main()
{
    int n;
    cin >> n;
    int mod = n % 1000;
    if (mod == 0) {
        cout << 0 << endl;
    } else {
        cout << 1000 - mod << endl;
    }

    return 0;
}


Measured memory_bytes: 3628
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef long long int LL;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------
int N,Q;
string S;
vector<set<int>>pls;

void solve(){
	//pls.assign(26,set<int>({INF}));
	//pls.resize(26);
	for(int i=0;i<26;i++){
		set<int>s;
		s.insert(INF);
		pls.pb(s);
	}
	for(int i=0;i<N;i++){
		pls[S[i]-'a'].insert(i);
	}
	while(Q--){
		int type;cin>>type;
		if(type==1){
			int ind;char nc;cin>>ind>>nc;ind--;
			auto pc=S[ind];
			S[ind]=nc;
			pls[pc-'a'].erase(ind);
			pls[nc-'a'].insert(ind);
		}
		else{
			int l,r;cin>>l>>r;l--;
			int res=0;
			for(int c=0;c<26;c++){
				//if(pls[c].empty())continue;
				int lid=*pls[c].lower_bound(l);
				int rid=*pls[c].lower_bound(r);
				if(rid>lid)res++;
			}
			cout<<res<<endl;
		}
	}
}
//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    cin >> N >> S >> Q;
    solve();
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------



Measured memory_bytes: 24276
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;

const int maxn=510;
int n,m;
char s[maxn][maxn];

int main(){

	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%s",s[i]+1);
	for(int i=1;i<=n;i++,puts("")) for(int j=1;j<=m;j++) printf("%c",s[i][j]=='#' || (j!=m && i&1 || j==1 )?'#':'.'); puts("");
	for(int i=1;i<=n;i++,puts("")) for(int j=1;j<=m;j++) printf("%c",s[i][j]=='#' || (j!=1 &&  !(i&1) || j==m)?'#':'.');
	return 0;
}

Measured memory_bytes: 896
#include<stdio.h>

int A[10000];
int main()
{
  int n,i,j,flag,count=0;
  

  scanf("%d",&n);

  for(i=0; i<n; i++)
    {
      scanf("%d",&A[i]);
    }

  for(i=0; i<n; i++)
    {
      flag=0;
      if(A[i]%2==0 && A[i]!=2) continue; 
     
      for(j=3; j*j<=A[i]; j+=2)
	{
	 
	  if(j==A[i]) break;
	  if(A[i]%j==0) flag=1;
	}
      if(flag==0) count++;
      
    }

  printf("%d\n",count);
  return 0;
}
	   



Measured memory_bytes: 2136
#include <iostream>
using namespace std;
#define TYPE int

TYPE gcd(TYPE a,TYPE b){
  if( !b ) return a;
  return gcd(b, a%b);
}
int main(){
  TYPE a,b;
  while(cin>>a>>b){
    TYPE g = gcd(a,b);
    TYPE l = a/g*b;
    cout << g << " " << l << endl;
  }
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    string S;cin >> S;
    if(S == "ABC")cout << "ARC" << endl;
    else cout << "ABC" << endl;
}

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

#define ll long long
#define ull unsigned long long 
#define endl '\n'
const int MOD = 1e9+7;

ll power(ll a, ll b){
    ll r=1;
    while(b>0){
        if(b&1)
            r=r*a %MOD;
        a = a*a %MOD;
        b/=2;
    }
    return r;
}

int main(){
    string a, b;
    cin >> a >> b;
    if(a.length() > b.length()){
        cout << "GREATER";
        return 0;
    }
    else if(a.length() < b.length()){
        cout << "LESS";
        return 0;
    }

    if(a==b)
        cout << "EQUAL";
    else if(a < b)
        cout << "LESS";
    else
        cout << "GREATER";

}


Measured memory_bytes: 3580
import Data.List
import Control.Monad
import Control.Applicative

data Card = S Int | H Int | C Int | D Int deriving (Show, Eq, Ord)

readCards :: IO [Card]
readCards =
    map rd . lines <$> getContents 
    where
    rd :: String -> Card
    rd l =
        case (words l) of
            ["S", n] -> S (read n)
            ["H", n] -> H (read n)
            ["C", n] -> C (read n)
            ["D", n] -> D (read n)
            _ -> undefined

main = do
    _ <- getLine
    cards <- readCards
    let suit = concat [map f [1..13] | f<-[S,H,C,D]]
    mapM_ print (suit \\ cards)

Measured memory_bytes: 4008
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        long count = 0;
        while(x>4){
            if(x>=500){
                x -= 500;
                count += 1000;
            }else if(x>=5){
                x -= 5;
                count += 5;
            }
        }
        
        System.out.println(count);
    }
}

Measured memory_bytes: 21972
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N, M = LI()
sc = []
for i in range(M):
    sc.append(LI())

ans = ["0" for i in range(N)]
ans_exist = True
if N == 1:
    for i in range(M):
        s,c = sc[i]
        s -= 1
        c = str(c)
        if ans[s] == "0":
            ans[s] = c
        elif ans[s] != "0" and ans[s] == c:
            pass
        else:
            ans_exist = False
            break

    if ans_exist:
        print("".join(ans))
    else:
        print("-1")

else:
    for i in range(M):
        s,c = sc[i]
        s -= 1
        c = str(c)
        if s == 0 and c == "0":
            ans_exist = False
            break

        if ans[s] == "0":
            ans[s] = c
        elif ans[s] != "0" and ans[s] == c:
            pass
        else:
            ans_exist = False
            break

    if ans_exist:
        if ans[0] == "0":
            ans[0] = "1"
        print("".join(ans))
    else:
        print("-1")

Measured memory_bytes: 6544
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int64_t A,B,C,K;
  cin>>A>>B>>C>>K;
  if(A>=K)return cout<<K<<endl,0;
  K-=A;
  if(B>=K)return cout<<A<<endl,0;
  K-=B;
  return cout<<A-K<<endl,0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;
 
int main(){
    ll N,M;
    cin >> N >> M;
    vector<ll> a(M), b(M);
    vector<vector<ll>> c(M);
    ll cc;
    rep(i,M){
        cin >> a[i] >> b[i];
        rep(j,b[i]){
            cin >> cc;
            cc--;
            c[i].push_back(cc);
        }
    }
    vector<vector<ll>> dp(M+1, vector<ll>(4100,1e18));
    dp[0][0] = 0;
    rep(i,M){
        ll t = 0;
        rep(j,b[i]){
            t += (1LL << c[i][j]);
        }
        rep(j,(1LL << N)){
            cmin(dp[i+1][j|t], dp[i][j] + a[i]);
            cmin(dp[i+1][j], dp[i][j]);        
        }
    }
    if(dp[M][(1LL<<N)-1] == 1e18){
        cout << -1 << endl;
        return 0;
    }
    cout << dp[M][(1LL<<N)-1] << endl;
}

Measured memory_bytes: 35464
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC targett("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(ll i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 2e18
#define h_p 1110111110111;
#define five 100005;
#define six 1000005;
#define printclock cerr<<"Time "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//_______________________________________________________________________________
const int N = 3*five;
ll bit[N],bit1[N];
void update(int i,int val)
{
       if(i >= N){return ;}
       bit[i] += val;
       update(i+(i&(-i)),val);
}
ll get(int i)
{
       if(i == 0){return 0;}
       return (bit[i] + get(i-(i&(-i))));
}
int main()
{
       string s;
       cin>>s;
       string ss = "ABC";
       if(s == "ABC"){ss = "ARC";}
       cout<<ss<<endl;
}


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

int main(void)
{
    int n, d;
    cin >> n >> d;
    int div = n / (2 * d + 1);
    if(div * (2 * d + 1) < n){
        div++;
    }
    cout << div << endl;    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<int,int>; using vp = vector<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
/////////

void solve(){
  ini(N , C);
  vvi d(C , vi(C)); in(d);
  vvi c(N , vi(N)); in(c);
  trc(d , c);
  rep(i , N) rep(j , N) c[i][j]--;

  vi x , y , z;
  rep(i , N) rep(j , N){
    switch((i + j) % 3){
      case 0:
        x.pb(c[i][j]);
        break;
      case 1:
        y.pb(c[i][j]);
        break;
      case 2:
        z.pb(c[i][j]);
        break;
    }
  }

  trc(x , y , z);

  vl s(C) , t(C) , u(C);
  rep(i , C){
    each(n , x) s[i] += d[n][i];
    each(n , y) t[i] += d[n][i];
    each(n , z) u[i] += d[n][i];
  }

  ll ans = infLL;
  rep(i , C) rep(j , C) rep(k , C){
    if(i == j || j == k || k == i) continue;
    amin(ans , s[i] + t[j] + u[k]);
  }
  out(ans);

}

Measured memory_bytes: 2480
//code by 27.
#include<stdio.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath>
#include<memory.h>
#include<sstream>
#include<time.h>
using namespace std;
const int BIG=100000000;
int main()
{
	int n,m,k;
	cin>>n>>m>>k;
	if(k%n==0||k%m==0)
	{
		cout<<"Yes";
		return 0;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(i*m+j*n-i*j*2==k)
			{
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}

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

using namespace std;

int main() {
  int v, n, sv = 0, sn = 0, c = 0;
  while (scanf("%d,%d", &v, &n) == 2) {
    sv += v*n;
    sn += n;
    c++;
  }
  printf("%d\n%d\n", sv, int(round(double(sn)/c)));
  return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            int N, W;
            string[] str = Console.ReadLine().Split(' ');
            N = int.Parse(str[0]);
            W = int.Parse(str[1]);
            List<int> v = new List<int>();
            List<int> w = new List<int>();
            for (int counter = 0; counter < N; counter++)
            {
                string[] STR = Console.ReadLine().Split(' ');
                v.Add(int.Parse(STR[0]));
                w.Add(int.Parse(STR[1]));
            }
            int[][] maxvalue = new int[N+1][];
            for(int i = 0; i < N+1; i++)
            {
                maxvalue[i] = new int[W+1];
                for(int j=1;j<W+1; j++)
                {
                    maxvalue[i][j] = -1;
                }
            }

            w.Add(0);
            v.Add(0);

            Console.WriteLine(MaxValue(0, 0,N,W,v,w,maxvalue));
        }

        static  int MaxValue(int i,int j,int N,int W,List<int>v,List<int>w,int[][]maxvalue)
        {
            if (i > N)
            {
                return 0;
            }
            else if (maxvalue[i][j] > 0)
            {
                return maxvalue[i][j];
            }

            else if (W < j + w[i])
            {
                return MaxValue(i + 1, j, N, W, v, w, maxvalue);
            }



            else
            {
                maxvalue[i][j] = System.Math.Max(MaxValue(i + 1, j + w[i], N, W, v, w, maxvalue) + v[i], MaxValue(i + 1, j, N, W, v, w, maxvalue));
                return System.Math.Max(MaxValue(i + 1, j + w[i], N, W, v, w, maxvalue) + v[i], MaxValue(i + 1, j, N, W, v, w, maxvalue));
            }



            }
          



        
    }
}

Measured memory_bytes: 13296
#include<bits/stdc++.h>
        #define ll long long
        #define rep(i,a,b) for(i=a;i<b;i++)
        #define pb push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define vi vector < ll  int >
        #define CLR(a) memset((a),0,sizeof(a))
        #define mp make_pair
        #define hell 1000000007
        using namespace std;
        void solve()
           {
               ll i,j=0,r=200,p,q,k=0,ans=0,d,y=0,x,h,flag=0,n,m=0,a=hell,b=hell,id,c,h1,h2,a1,b1,w;
               cin>>n>>x>>h;
               cout<<max(x+h-n,0LL);




           }
        signed main()
        {
            ios::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            int t=1;
            //cin>>t;
            while(t--)
            solve();
        }


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string.h>
#include<string>

using namespace std;

int a, b, k;

int main()
{
	cin >> a >> b >> k;
	if (a + k - 1 >= b - k)
	{
		for (int i = a; i <= b; i++)
		{
			cout << i << "\n";
		}
		return 0;
	}
	for (int i = 0; i < k; i++)
	{
		cout << a++ << "\n";
	}
	for (int i = k - 1; i >= 0; i--)
	{
		cout << b - i << "\n";
	}
	return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll inf = 1e18;
ll mod = 1e9+7;

int main(){
    int n,m;
    cin >> n >> m;
    int sum = 0;
    for (int i = 0; i < m; i++) {
        int x;
        cin >> x;
        sum += x;
    }
    cout << max(-1,n-sum) << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<set>
#include<map>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;
typedef pair<int,int> Pi;

constexpr int INF = 1e9 + 7;
constexpr int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main() {
    string S,T; cin>>S>>T;
    int cnt_s[26],cnt_t[26];
    REP(i,26) {
        cnt_s[i] = 0;
        cnt_t[i] = 0;
    }
    REP(i,S.size()) {
        cnt_s[S[i]-'a']++;
        cnt_t[T[i]-'a']++;
    }
    sort(cnt_s,cnt_s+26);
    sort(cnt_t,cnt_t+26);
    REP(i,26) {
        cerr<<cnt_s[i]<<" "<<cnt_t[i]<<endl;
        if (cnt_s[i]!=cnt_t[i]) {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 904
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		long sum = 0;
		
		for(int i = 1; i <= n; i++) {
			if(i % 3 == 0) {
				continue;
			} else if (i % 5 == 0) {
				continue;
			} else {
				sum+=i;
			}
		}

		
		System.out.println(sum);
	}
}


Measured memory_bytes: 35536
#include<cstdio>
#include<algorithm>
const int MAXN=100000+10;
int n,h;
int sum;
bool flag;
int maxn;
int ans;
struct node{
	int a,b;
}s[MAXN];
bool cmp(node x,node y){
	return x.b>y.b;
}
int main(){
	scanf("%d%d",&n,&h);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&s[i].a,&s[i].b);
		maxn=std::max(maxn,s[i].a);
	}
	std::sort(s+1,s+n+1,cmp);
	for(int i=1;i<=n;i++){
		if(s[i].b>maxn){
			ans++;
			sum+=s[i].b;
		}
		if(sum>=h){
			flag=1;
			break;
		}
	}
	if(flag){
		printf("%d\n",ans);
		return 0;
	}
	ans+=(h-sum)/maxn;
	if((h-sum)%maxn!=0) ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_128
{
    class B
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            var dict = new SortedDictionary<string, SortedDictionary<int, int>>();
            for(int i = 0; i < n; i++)
            {
                string[] sp = Read().Split();
                string s = sp[0];
                int p = int.Parse(sp[1]);
                if (!dict.ContainsKey(s))
                {
                    dict.Add(s, new SortedDictionary<int, int>());
                }
                dict[s].Add(-p, i+1);
            }

            foreach(string s in dict.Keys)
            {
                foreach(int p in dict[s].Keys)
                {
                    WriteLine(dict[s][p]);
                }
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13792
//#include<stdio.h>
//#include<stdlib.h>
//#include<string.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=55;
const ll MOD=1e9+7;
int main()
{
    int n;
    int a;
//for(auto &a:b)
//存在n*n种组合方法，求解满足条件的方法，遍历？
    cin>>n>>a;
    ll b[N][N*N]= {0};
    int p;
    ll cnt=0;//计算方法数
    b[0][0]=1;
    for(int i=1; i<=n; i++)
    {
        cin>>p;
        for(int j=i-1; j>=0; j--)
        {
            for(int k=0; k<=N*j; k++)
            {
                b[j+1][p+k]+=b[j][k];//将每一种可能加到一个p+k，使得每一个可能的和的地方数组储存的数字都为1
            }
        }
    }
    for(int i=1; i<=n; i++)
    {
        cnt+=b[i][i*a];//若是i*a处不为0则说明p+k可以加到这个位置
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 1536
#include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <random>

using namespace std;
struct XX{
int s;
    int e;
};

class xxGreater {
public:
bool operator()(const XX& riLeft, const XX& riRight) const {
        //第2条件
if((riLeft.s) == (riRight.s)){
return riLeft.e < riRight.e;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
           //プライオリティキューの場合は > で、top()すると値の小さいものがとれる
        }
        //第1条件
        return (riLeft.s) > (riRight.s);
    }
};


int main(int argc, const char * argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);
int n;
cin>>n;
vector<int>ans;
    for(int i=0;i<n;i++){
    cout<< "ACL";
}
cout<<endl;



//cout << "Hello World" << endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
using namespace std; char s; int x[5000][5000], y[3][3], h, w, MAX, t, u, v, MAXN;
int main() {
	cin >> h >> w;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> s;
			if (s == 'J') {
				x[i][j] = 1;
			}
			else if (s == 'O') {
				x[i][j] = 2;
			}
			else {
				x[i][j] = 3;
			}
		}
	}
	for (int i = 1; i <= 2; i++) {
		for (int j = 1; j <= 2; j++) {
			cin >> s;
			if (s == 'J') {
				y[i][j] = 1;
			}
			else if (s == 'O') {
				y[i][j] = 2;
			}
			else {
				y[i][j] = 3;
			}
		}
	}
	for (int i = 1; i < h; i++) {
		for (int j = 1; j < w; j++) {
			if (x[i][j] == y[1][1] && x[i][j + 1] == y[1][2] && x[i + 1][j] == y[2][1] && x[i + 1][j + 1] == y[2][2]) {
				MAX++;
			}
		}
	}
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			t = 0;
			for (int k = -1; k <= 0; k++) {
				for (int l = -1; l <= 0; l++) {
					if (x[k + i][l + j] == y[1][1] && x[k + i][l + j + 1] == y[1][2] && x[k + i + 1][l + j] == y[2][1] && x[k + i + 1][l + j + 1] == y[2][2]) {
						t++;
					}
				}
			}
			u = x[i][j];
			for (int o = 1; o <= 3; o++) {
				x[i][j] = o;
				v = 0;
				for (int k = -1; k <= 0; k++) {
					for (int l = -1; l <= 0; l++) {
						if (x[k + i][l + j] == y[1][1] && x[k + i][l + j + 1] == y[1][2] && x[k + i + 1][l + j] == y[2][1] && x[k + i + 1][l + j + 1] == y[2][2]) {
							v++;
						}
					}
				}
				MAXN = max(MAXN, v - t);
			}
			x[i][j] = u;
		}
	}
	MAX += MAXN;
	cout << MAX << endl;
	return 0;
}

Measured memory_bytes: 20424