akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;
const long long INF=-mod;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
//ショートカット
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,k,n) for(int i=k;i<n;i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

#define max(a,b) max((ll)a,(ll)b)
#define min(a,b) min((ll)a,(ll)b)

//関数
//最大公約数
long long gcd(long long m,long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m,long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x,long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//nCr
long long C(long long n, long long r);
//nCr (mod)
long long modC(long long n, long long r) {
    vector<long long> f(n+1),inv(n+1),invf(n+1);
    f[0]=f[1]=1;
    invf[0]=invf[1]=1;
    inv[1]=1;
    for (long long i=2;i<n+1;i++) {
        f[i]=(i*f[i-1])%mod;
        inv[i]=mod-((mod/i)*inv[mod%i])%mod;
        invf[i]=(inv[i]*invf[i-1])%mod;
    }
    long long cmb=f[n]*(invf[r]*invf[n-r]%mod)%mod;
    if (n>=r) return cmb;
    else return 0;
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  char s;cin>>s;
  cout<<(char)(s+1);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for (int i = 0; i < (int)(n); ++i)
#define mod 1000000007
#define bigger(a,b) (a>b?a:b)
#define smaller(a,b) (a<b?a:b)
#define mem(A,g) memset(A,g,sizeof(A))
#define gc getchar_unlocked
#define positive(a) (bigger(a,-a))

const int INF = 1e9 + 5;
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int n,k;
cin>>n>>k;
vector<int>h;
for(int i=0;i<n;i++){
	int input;
	cin>>input;
	h.push_back(input);
}
vector<int>dp(n,INF);
dp[0] = 0;
for(int i=0;i<n;i++){
	for(int j = 1; j<=k; j++){
		if(i+j < n)
		dp[i+j] = min(dp[i+j], dp[i] + abs(h[i]-h[i+j]));
	}
}
cout<<dp[n-1]<<"\n";

return 0;
}

Measured memory_bytes: 1144
package main
import (
	"fmt"
	//"math"
	//"math/rand"
)
func main() {
	var N,M,X,Y int
	fmt.Scan(&N,&M,&X,&Y)
	var x [100]int
	var y [100]int
	P:=-10000
	Q:=10000
	for i:=0;i<N;i++{
		fmt.Scan(&x[i])
		if P<x[i]{
			P = x[i]
		}
	}
	for i:=0;i<M;i++{
		fmt.Scan(&y[i])
		if Q>y[i]{
			Q = y[i]
		}
	}
	if P<X {
		P=X
	}
	if Q>Y {
		Q=Y
	}
	if Q-P>=1{
		fmt.Println("No War")
	}else{
		fmt.Println("War")
	}
}


Measured memory_bytes: 1844
#include <vector>
#include <iostream>
#include <queue>
#include <string>
struct Point {
	int x, y;
	constexpr Point(int a, int b) :x{ a }, y{ b } {}
	Point operator+(const Point &other) const { return Point(x + other.x, y + other.y); }
};
enum class Cell :char {
	Wall, Path
};
class Stage {
	std::vector<std::vector<Cell>> vec;
public:
	Stage(const std::vector<std::vector<Cell>> &v) :vec{ v } {}
	Cell & operator[](const Point &point) {
		return vec[point.x][point.y];
	}
	Cell operator[](const Point &point) const {
		return vec[point.x][point.y];
	}
	bool is_in(const Point &point) {
		return 0 <= point.x && point.x < vec.size() && 0 <= point.y && point.y < vec[0].size();
	}
};
constexpr Point dir[]{ Point(0, 1), Point(1, 0), Point(-1, 0), Point(0, -1) };
int main() {
	int h, w;
	std::cin >> h >> w;
	std::vector<std::vector<Cell>> vec;
	{
		std::string str;
		auto mapper = [](const std::string &s) {
			std::vector<Cell> res(s.size() + 2, Cell::Wall);
			for (auto i = 0; i < s.size(); ++i) {
				switch (s[i]) {
				case '.': res[i + 1] = Cell::Path; break;
				default: break;
				}
			}
			return res;
		};
		vec.push_back(std::vector<Cell>(w + 2, Cell::Wall));
		for (auto i = 0; i < h; ++i){
			std::cin >> str;
			vec.push_back(mapper(str));
		}
		vec.push_back(std::vector<Cell>(w + 2, Cell::Wall));
	}
	auto stage = Stage(vec);
	std::queue<Point> queue;
	queue.push(Point(1, 1));
	int count = 1;
	int all_white = 0;
	for (auto i = 0; i < h; ++i) {
		for (auto j = 0; j < w; ++j) {
			if (vec[i + 1][j + 1] == Cell::Path) ++all_white;
		}
	}
	while (stage[Point(h, w)] != Cell::Wall && queue.size() != 0) {
		for (auto i = queue.size(); i > 0; --i) {
			for (const auto &d : dir) {
				if (stage[queue.front() + d] == Cell::Path) {
					stage[queue.front() + d] = Cell::Wall;
					queue.push(queue.front() + d);
				}
			}
			queue.pop();
		}
		++count;
	}
	if (stage[Point(h, w)] == Cell::Wall) {
		std::cout << all_white - count << std::endl;
	}
	else {
		std::cout << -1 << std::endl;
	}
}

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


int main(void)
{
    int c;
    cin >> c;
    if (c == 1) {
        cout << "Hello World" << endl;
    } else {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <utility>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (int a, b; a = in(), b = in(), a || b;) {
		int c = 0;
		if (a < b)
			swap(a, b);
		while (b) {
			c++;
			a %= b;
			swap(a, b);
		}
		outl(a, ' ', c);
	}
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define INF 100100100
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;


int main(){
  int n;
  cin >> n;
  ll ans = 0;
  unordered_map<string, ll> map;
  vector<string> s(n);
  rep(i,n){
  	cin >> s[i];
  	sort(s[i].begin(), s[i].end());
  	if(map.count(s[i])){
  		ans += map.at(s[i]);
  		++map[s[i]];
  	}
  	else map[s[i]] = 1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 17700
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500 + j*100 + k*50 == x:
        ans += 1
print(ans)

Measured memory_bytes: 9148
#include <bits/stdc++.h>
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();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

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

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0, sizeof(a))

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

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

int main(void){
    int N; cin >> N;
    vector<ll> a(3*N); REP(i,3*N) cin >> a[i];
    vector<ll> h(N+1,0), l(N+1,0);
    priority_queue<ll> ql;
    priority_queue<ll,vector<ll>,greater<ll>> qh;
    ll sumh = 0, suml = 0;

    REP(i,N){
        sumh += a[i];
        qh.push(a[i]);
    }
    h[0] = sumh;
    FOR(i,N,2*N){
        sumh += a[i];
        qh.push(a[i]);
        sumh -= qh.top(); qh.pop();
        h[i-N+1] = sumh;
    }

    REVERSE(a);
    REP(i,N){
        suml += a[i];
        ql.push(a[i]);
    }
    l[0] = suml;
    FOR(i,N,2*N){
        suml += a[i];
        ql.push(a[i]);
        suml -= ql.top(); ql.pop();
        l[i-N+1] = suml;
    }
    REVERSE(l);

    ll ans = -LL_INF;
    REP(i,N+1) chmax(ans, h[i]-l[i]);
    cout << ans << en;
    return 0;
}

Measured memory_bytes: 6516
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	int N, K, R, S, P;
	char[] T, buf;
	long result = 0;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		K = Integer.parseInt(tokens[1]);
		tokens = in.readLine().split(" ");
		R = Integer.parseInt(tokens[0]);
		S = Integer.parseInt(tokens[1]);
		P = Integer.parseInt(tokens[2]);
		T = in.readLine().toCharArray();
		buf = new char[T.length];
	}

	void calc() {
		for (int i = 0; i < K; ++i) {
			// 好きなように出して，勝てる
			result += getScore(T[i]);
			buf[i] = getResult(T[i]);
		}
		for (int i = K; i < N; ++i) {
			// K回前と同じだと勝てない
			char currentResult = getResult(T[i]);
			if (currentResult != buf[i - K]) {
				// 勝てる
				buf[i] = currentResult;
				result += getScore(T[i]);
			} else {
				// 勝てない．bufには適当な値を入れる
				buf[i] = 'n';
			}
		}
	}

	int getScore(char c) {
		switch (c) {
		case 'r':
			return P;
		case 's':
			return R;
		case 'p':
		default:
			return S;
		}
	}

	char getResult(char c) {
		switch (c) {
		case 'r':
			return 'p';
		case 's':
			return 'r';
		case 'p':
		default:
			return 's';
		}
	}

	void showResult() {
		System.out.println(result);
	}
}


Measured memory_bytes: 25044
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;
typedef long long ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

void Main() {
  Cin(int, x1, y1, x2, y2);
  int x = x2 - x1;
  int y = y2 - y1;

  // [rx] = [cos -sin] [x]
  // [ry]   [sin  cos] [y]
  int rx = -y;
  int ry = x;

  int x3 = x2 + rx;
  int y3 = y2 + ry;

  int x4 = x1 + rx;
  int y4 = y1 + ry;

  printf("%d %d %d %d\n", x3, y3, x4, y4);
  return;
}

int main() {
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 312345;
const int INF = 1001001001;
int dp[MAX_N];
int lis(const vector<int>& A) {
  int N = (int)A.size();
  REP(i, N+1) dp[i] = INF;
  REP(i, N) {
    int pos = lower_bound(dp, dp + N, A[i]) - dp;
    dp[pos] = A[i];
  }
  int res = lower_bound(dp, dp + N, INF) - dp;
  // cout << res << ": "; pv(ALL(A));
  return res;
}



void output(const vector<int> &v) {
  REP(i, v.size()){
    if (i > 0) printf(" ");
    printf("%d", v[i]);
  }
  printf("\n");
}



int main2() {
  int N = nextInt();
  int A = nextInt();
  int B = nextInt();
  if (A + B > N + 1) {
    cout << -1 << endl;
    return 0;
  }
  if (min(A, B) == 1) {
    vector<int> v;
    if (A == 1 && B == N) {
      REP(i, N) v.push_back(N-i);
      output(v);
    } else if (A == N && B == 1) {
      REP(i, N) v.push_back(i+1);
      output(v);
    } else {
      cout << -1 << endl;
    }
    return 0;
  }

  vector<int> v;
  REP(i, N) v.push_back(N-i);
  reverse(v.begin(), v.begin() + A);

  int p = A;
  int E = N - A;
  int b = N - A + 1;
  while (p < N && B != b) {
    int L = min(min(A, E), b - B + 1);
    // cout << E << " " << b << endl;
    // pv(ALL(v)); 
    // cout << L << endl;
    if (L <= 1) break;
    reverse(v.begin() + p, v.begin() + p + L);
    p += L;
    E -= L;
    b -= L - 1;
  }

  int a1 = lis(v);
  reverse(ALL(v));
  int b1 = lis(v);
  reverse(ALL(v));
  if (a1 == A && b1 == B) {
    output(v);
  } else {
    cout << -1 << endl;
  }
  return 0;
}

int main() {
  // vector<int> v;
  // int N = 9;
  // REP(i, N) v.push_back(i + 1);
  // int count[N+1][N+1] = {};
  // do {
  //   int A = 0;
  //   int B = 0;
  //   A = lis(v);
  //   reverse(ALL(v));
  //   B = lis(v);
  //   reverse(ALL(v));
  //   count[A][B] += 1;
  //   // if (A == 3 && B == 2) {
  //     // pv(ALL(v));
  //   // }
  // } while (next_permutation(ALL(v)));
  // for (int a = 0; a <= N; a++) {
  //   for (int b = 0; b <= N; b++) {
  //     if (count[a][b] > 0) cout << a << " " << b << " " << (N+1)-(a+b) << " " << count[a][b] << endl;
  //   }
  // }

  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 4592
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    string s; cin >> s;
    int p_c = inf, p_f = -1;
    rep(i,s.size()) {
        if (s[i] == 'C') {
            p_c = i;
            break;
        }
    }
    for (int i = (int)s.size()-1; i >= 0; i--) {
        if (s[i] == 'F') {
            p_f = i;
            break;
        }
    }
    if (p_c < p_f) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
using P = pair<long long, long long>;

int main() {
  long long N;
  cin >> N;
  map<string, long long> mp;
  long long ans = 0;
  rep(i, N) {
    string temp;
    cin >> temp;
    sort(temp.begin(), temp.end());
    if(!mp[temp]) {
      mp[temp] = 1;
    } else {
      ans += mp[temp];
      mp[temp] = mp[temp] + 1;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
    string S; cin >> S;
    int ans = 0;
    if(S.size()%2 == 0){
        for(int i = 0; i < S.size();i++){
            if(i%2 == 0){
                if(S[i] != 'h'){
                    break;
                }
            }
            else{
                if(S[i] != 'i'){
                    break;
                }
            }
            ans++;
        }
    }
    if(ans == S.size()){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
int ans=0;
getline(cin,s);
for(int i=0;i<=s.length();++i){
    if(s[i]=='A'){
        for(int j=i;j<=s.length();++j){
            if(s[j]=='Z'){
                ans = (j-i)+1;
                }
                }
         }
 if(ans!=0){
printf("%d",ans);
break;}
}}


Measured memory_bytes: 640
#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以上の値が最初に現れる時のイテレータ
// 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 main(void) {

    int N; cin >> N;
    vector <string> S(N);
    rep(i,N) cin >> S[i];
    Sort(S);
    int ans = 1;
    rep(i,N-1) {
        if (S[i] != S[i+1]) {
            ++ans;
        }
    }
    out(ans);


    return 0;
}











Measured memory_bytes: 9548
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
int main() {
  ll x,y,a,b,c ;
  cin>>x>>y>>a>>b>>c ;
  vector<ll> p(a) ;
  rep(i,a)  cin>> p[i] ;
  sort(p.rbegin(),p.rend()) ;
  vector<ll> q(b) ;
  rep(i,b)  cin>> q[i] ;
  sort(q.rbegin(),q.rend()) ;
  vector<ll> r(c) ;
  rep(i,c)  cin >>r[i] ;
  rep(i,x) r.push_back(p[i]) ;
  rep(i,y) r.push_back(q[i]) ;
  sort(r.rbegin(),r.rend()) ;
  ll ans=0 ;
  rep(i,x+y) ans+=r[i] ;
  

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





Measured memory_bytes: 6384
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int K = stdIn.nextInt();
		int X = stdIn.nextInt();
		for(int i = X - K + 1; i < X + K; i++){
			System.out.println(i);
		}
		stdIn.close();
	}
}


Measured memory_bytes: 35680
#include <iostream>
#include <vector>

using namespace std;

#define int long long

const int MOD = 1e9 + 7;

int n, l;
int a[500000];

signed main()
{
    cin >> n >> l;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int t = -1;
    for (int i = 0; i + 1 < n; i++)
    {
        if (a[i] + a[i + 1] >= l)
        {
            t = i;
        }
    }
    if (t == -1)
    {
        cout << "Impossible";
        return 0;
    }
    cout << "Possible\n";
    t++;
    for (int i = 1; i < t; i++)
    {
        cout << i << "\n";
    }
    for (int i = n - 1; i > t; i--)
    {
        cout << i << "\n";
    }
    cout << t << "\n";
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x;
  cin >> x;
  int a = 0;
  for (int i = 0; i<1001; i++) {
    if (x <= 105*i && x >= 100*i) {
      a = 1;
    }
  }

  if (a == 1) {
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
using namespace std;

string str;
int dp[80001][11][2];

int main(void){
	while(cin >> str){
		if(str=="0")break;
		memset(dp,0,sizeof(dp));
		int res=0;
		for(int i=0;i<str.size();i++){
			dp[i][0][0]+=1;
			for(int j=0;j<=10;j++){
				for(int k=0;k<2;k++){
					if(dp[i][j][k]>=1){
						if(k==1 || str[i]-'0'>=1)dp[i+1][(j*10+str[i]-'0')%11][1]+=dp[i][j][k];
						if(k==1 && (j*10+str[i]-'0')%11==0)res+=dp[i][j][k];
					}
				}
			}
		}
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 8264
N, M = map(int,input().split())
E = [list(map(int, input().split())) for _ in range(M)]

T = [[0 for _ in range(N)] for _ in range(N)]

for i in range(M):
	a,b = E[i]
	T[a-1][b-1] = 1
	T[b-1][a-1] = 1

def bfs(table, flg, q):
	c = q.pop(0)
	flg[c-1] = 1

	NN = [ind+1 for ind in range(N) if table[c-1][ind] == 1]
	for n in NN:
		if flg[n-1] == 0:
			q.append(n)
	
	if len(q) == 0:
		return flg.count(0)

	return bfs(table, flg, q)

ans = 0

for i in range(M):
	a,b = E[i]
	T[a-1][b-1] = 0
	T[b-1][a-1] = 0
	
	flg = [0 for _ in range(N)]

	cnt = bfs(T, flg, [1])

	if cnt > 0:
		ans += 1

	T[a-1][b-1] = 1
	T[b-1][a-1] = 1

print(ans)

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

int main(){
    int N,K,ans=0;
    cin >> N >> K;
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin >> vec[i];
    }
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());
    for(int i=0;i<K;i++){
        ans+=vec[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int main() {
  int a, b;
  char op;

  while(scanf("%d %c %d", &a, &op, &b)) {
    if (op == '?') {
      break;
    } else if(op == '+') {
      printf("%d\n", a + b);
    } else if (op == '-') {
      printf("%d\n", a - b);
    } else if (op == '*') {
      printf("%d\n", a * b);
    } else if (op == '/') {
      printf("%d\n", a / b);
    } else {
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define ll long long
#define f(i,l,r) for(int i=l;i<r;i++)
using namespace std;
ll n,w[101],v[101],W,dp[100001][101];
ll solve(int left,int i)
{
    if(dp[left][i]!=-1)
        return dp[left][i];
    if(i==n||left==0)
        return 0;
    dp[left][i]=solve(left,i+1);
    if(left>=w[i])
        dp[left][i]=max(dp[left][i],v[i]+solve(left-w[i],i+1));
    return dp[left][i];
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>W;
    for(int i=0;i<=W;i++)
    {
        for(int j=0;j<n;j++)
        dp[i][j]=-1;
    }
    f(i,0,n)    cin>>w[i]>>v[i];
    ll ans=solve(W,0);
    cout<<ans;
    return 0;
}

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

int main() {
  int a; string s;
  cin >> a >> s;
  cout << (a>=3200? s : "red") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main()
{
    long long n,h,i;
    while(scanf("%lld %lld",&h,&n)==2){
        long long a[n],s=0;
        for(i=0;i<n;i++){
            scanf("%lld",&a[i]);
            s+=a[i];
        }
        if(s<h)
            printf("No\n");
        else
            printf("Yes\n");
    }
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

using namespace std;

template <typename T> void output(T, int);
int gcd(int a, int b);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int h, w;
    cin >> h >> w;
    vector<string> a;
    string up = "";
    rep(i, w + 2) { up += "#"; }
    a.push_back(up);
    rep(i, h) {
        string temp;
        cin >> temp;
        temp = "#" + temp + "#";
        a.push_back(temp);
    }
    a.push_back(up);

    rep(i, h + 2) { cout << a[i] << endl; }

    return 0;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

void prime_map(map<ll, ll> &m, ll num) {
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }

    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }
        return;
    } else {
        prime_map(m, num);
    }
}


Measured memory_bytes: 256
import java.util.*;

class Main {

    static void solve (long n) {
        
        long result = 0;

        for(long i = 5; i <= n; i *= 5) {
            result += n / i;     
        }

        System.out.println(result);
    }

    public static void main (String [] args) {

        Scanner sc = new Scanner(System.in);

        while(true) {
            long n = sc.nextLong();
            
            if (n == 0) break;
            
            solve(n);
        }

    }
}

Measured memory_bytes: 11000
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<iosfwd>
#include<sstream>
using namespace std;

int main(){
    int min=10;
    int sum= 0;
    vector<int> dish(5);
    for(int i=0; i<5; i++){
        cin >> dish[i];
        sum+= dish[i]+(10-dish[i]%10);
        if(dish[i]%10==0) sum-=10;
        if(min>(dish[i]%10) && dish[i]%10!=0) min= dish[i]%10;
    }

    if(min!=10) sum-=(10-min);
    // cout << min <<endl;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e14;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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 (b<a) { a=b; return 1; } return 0; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N,K;
    cin >> N >> K;

    ll ans = 0;
    if(N==0){
        cout << 0 << endl;
        return 0;
    }
    while(N){
        N /= K;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define ALL(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define COUT(x) cout << (x) << endl
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl



int main() {
    IN(int, k);
    IN(int, n);
    vi a(n);
    REP(i, n){
        cin >> a[i];
    }
    
    
    vi d(n);
    REP(i, n-1){
        d[i] = a[i+1]-a[i];
    }
    d[n-1] = k-a[n-1]+a[0];
    
    
    sort(ALL(d));
    
    COUT(k-d[n-1]);
    return 0;
}


Measured memory_bytes: 1920
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"

using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i, n)  FOR(i,0,(n))
typedef pair<int, int> P;


class DGridRepainting {
public:
    vector<vector<char>> s;
    vector<vector<bool>> seen;
    queue<P> q;
    int h, w;
    int cnt = 0;

    void func(P v) {
      if (v.first < 0 || v.second < 0 || v.first >= h || v.second >= w) {
        return;
      }
      if (!seen[v.first][v.second] && s[v.first][v.second] == '.') {
        seen[v.first][v.second] = true;
        q.push({v.first, v.second});
      }
    }

    void bfs(P v) {
      cnt = 0;
      q.push({v.first, v.second});
      while (!q.empty()) {
        int t = q.size();
        REP(i, t) {
          v = q.front();
          if (v == make_pair(h - 1, w - 1)) return;
          q.pop();
          func({v.first - 1, v.second});
          func({v.first, v.second - 1});
          func({v.first + 1, v.second});
          func({v.first, v.second + 1});
        }
        cnt++;
      }
      cnt = -1;
    }

    void solve(std::istream &in, std::ostream &out) {
      in >> h >> w;
      s = vector<vector<char>>(h, vector<char>(w));
      seen = vector<vector<bool>>(h, vector<bool>(w));
      int sharp_num = 0;
      REP(i, h) REP(j, w) {
          in >> s[i][j];
          if (s[i][j] == '#') sharp_num++;
        }
      bfs({0, 0});
      out << (cnt == -1 ? cnt : h * w - cnt - sharp_num - 1) << endl;
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  DGridRepainting solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ",debug(__VA_ARGS__);
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os,pair<T,S>a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}
vector<int> inv(const vector<int> &perm){
    vector<int> res(perm.size());
    rep(i,perm.size()){
        res[perm[i]] = i;
    }
    return res;
}
vector<int> product(const vector<int> &a, const vector<int> &b){
    vector<int> res(a.size());
    rep(i,a.size()){
        res[i] = a[b[i]];
    }
    return res;
}
vector<int> power(const vector<int> &a, ll p){
    auto res = a;
    auto temp = a;
    p--;
    for(int i = 0; i < 60; i++){
        if(p >> i & 1){
            res = product(res, temp);
        }
        temp = product(temp, temp);
    }
    return res;
}
ll x[100005];
ll dx[100005];
ll a[100005];
vector<int>b;
signed main(){
    int n;
    cin >> n;
    rep(i,n){
        cin >> x[i];
    }
    rep(i,n-1){
        dx[i] = x[i+1] - x[i];
        //        show(dx[i]);
    }
    int m;
    ll k;
    cin >> m >> k;
    rep(i,n-1){
        b.push_back(i);
    }
    rep(i,m){
        cin >> a[i];
        a[i]--;
        swap(b[a[i]-1],b[a[i]]);
    }
    rep(i,n-1){
        //        show(b[i]);
    }
    auto c = power(b,k);
    ll ans = x[0];
    rep(i,n){
        cout << ans << endl;
        if(i!=n-1){
            ans += dx[c[i]];
        }
    }
}

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

int main(){
    long long h, w, a, b;
    cin >> h >> w >> a >> b;

    long long ans[h][w];

    for(long long y = 0; y < h; y++){
        for(long long x = 0; x < w; x++){
            if(y < b){
                if(x < a) ans[y][x] = 0;
                else ans[y][x] = 1;
            }
            else{
                if(x < a) ans[y][x] = 1;
                else ans[y][x] = 0;
            }
        }
    }

    for(long long y = 0; y < h; y++){
        for(long long x = 0; x < w; x++){
            printf("%lld", ans[y][x]);
        }
        printf("\n");
    }
    return 0;
}

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

typedef long long ll;

string s;

bool isP(int i, int j) {
    if (i > j) return false;
    while (i < j) {
        if (s[i - 1] != s[j - 1]) {
            return false;
        }
        ++i;
        --j;
    }
    return true;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> s;

    int n = s.length();
    bool ok = isP(1, n) && isP(1, (n - 1) / 2) && isP((n + 3) / 2, n);

    if (ok)
        puts("Yes");
    else
        puts("No");

    return 0;
}



Measured memory_bytes: 256
N,K=map(int,input().split())
A=list(map(int,input().split()))
m=max(A)
m=max(m,K)
L=len(bin(m))-2
mihon=0
for k in range(L-1,-1,-1):
    s=0
    for a in A:
        s+=(a&1<<k)>>k
    mihon*=2
    mihon+=s<(N-s)
#print(mihon)
#dp[L][smaller]
ans=0
for a in A:
    ans+=a^K
for i in range(L):
    if not(K&(1<<L-i)):
        continue
    t=(K&(((1<<L)-1)<<(L-i+1)))+(0<<L-i)+(mihon&((1<<(L-i))-1))
    s=0
    for a in A:
        s+=a^t
    ans=max(ans,s)
print(ans)


Measured memory_bytes: 69264
n,k=map(int, input().split())
v=list(map(int, input().split()))

r=min(n,k)
ans=0

for a in range(r+1):
    for b in range(r+1):
        jew=[]
        if a+b>r:
            break
        for i in range(a):
            jew.append(v[i])
        for i in range(n-1,n-b-1,-1):
            jew.append(v[i])
        
        if len(jew)==0:
            continue

        jew.sort(reverse=True)

        for i in range(k-(a+b)):
            if len(jew)>0:
                if jew[-1]<0:
                    jew.pop(-1)
                else:
                    break
        ans=max(ans,sum(jew))
print(ans)


Measured memory_bytes: 74240
from collections import Counter

if __name__ == "__main__":
    n = int(input())
    v = list(map(int, input().split()))
    even = v[1::2]
    odd = v[0::2]

    even_num = Counter(even).most_common(2)
    odd_num = Counter(odd).most_common(2)
    even_num.append((0, 0))
    odd_num.append((0, 0))

    if even_num[0][0] != odd_num[0][0]:
        print(n-even_num[0][1]-odd_num[0][1])
    else:
        print(min(n-even_num[1][1]-odd_num[0][1],
                  n - even_num[0][1]-odd_num[1][1]))


Measured memory_bytes: 15972
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define int ll
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }

struct node
{
	map<int,int> son;
	int col=-1;
}; vector<node> tree;

void build(int n)
{
	tree.resize(n);
	int a,b,l;
	For(i,0,n-2)
	{
		cin>>a>>b>>l;
		tree[a-1].son[b-1]=l;
		tree[b-1].son[a-1]=l;
	}
}

void color(int s)
{
	for(auto &i:tree[s].son)
	{
		if(tree[i.F].col!=-1) continue;
		if(i.S%2==0) tree[i.F].col=tree[s].col;
		else tree[i.F].col=(tree[s].col==0?1:0);
		color(i.F);
	}
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n; cin>>n;
	build(n);
	tree[0].col=0;
	color(0);
	for(auto &i:tree) cout<<i.col<<"\n";
	return 0;
}















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

int main(){
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  int i, j, count = 0, buf;
  for(i = 0; i <= a; i++){
    for(j = 0; j <= b; j++){
	  buf = x - 500 * i - 100 * j;
      if(buf % 50 == 0 && buf / 50 <= c && buf >= 0)
        count++;
    }
  }
  cout << count << endl;
  
  return 0;
}

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

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

	long long n;
	int x, m;
	cin >> n >> x >> m;
	int prv = x;
	vector<int> rep; rep.reserve((int) 1e6);
	vector<bool> vis(m);
	while (!vis[prv]) {
		vis[prv] = 1;
		rep.push_back(prv);
		prv = (long long) prv * prv % m;
	}
	int i = 0;
	uint64_t ans = 0;
	for (; i < (int) rep.size() && n; ++i) {
		if (rep[i] == prv) break;
		ans += rep[i];
		--n;
	}
	if (n) {
		ll period = (int) rep.size() - i;
		ll divs = n / period;
		ll left = n % period;
		assert(i + left <= (int) rep.size());
		ans += ((long long) divs * accumulate(rep.begin() + i, rep.end(), (long long) 0) +
			accumulate(rep.begin() + i, rep.begin() + i + left, (long long) 0));
	}
	cout << ans << endl;

	return 0;
}

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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define pii pair<ll, ll>
#define sz size()

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>void __f(const char* name, Arg1&& arg1){cout<<name<<" : "<<arg1<<"\n";}
template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args)
{const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" , ";__f(comma+1, args...);} 
#define traceloop(x,a) { cerr<<#a<<": "; for(ll ix=0;ix<x;ix++) cerr<<a[ix]<<" "; cerr<<endl; }

#define INF 1e18+3

int main()
{
	ios::sync_with_stdio(0);
	ll i, n, j, W;
	cin>>n>>W;

	int w[n], v[n];

	for(i=0;i<n;++i)
		cin>>w[i]>>v[i];

	vector<ll> dp(n*1e3+1, INF);

	// dp[i] = minimum weight I need to make total value i
	dp[0] = 0;
	for(i=0;i<n;++i)
	{
		vector<ll> new_dp(n*1e3+1);	

		for(int val=0;val<=n*1e3;++val)
		{
			if(val-v[i] >= 0)
				new_dp[val] = min(dp[val-v[i]] + w[i], dp[val]);
			else
				new_dp[val] = dp[val];
			
		}
		dp = new_dp;
	}

	ll ans = INF;
	for(i=0;i<=n*1e3;++i)
		if(dp[i] <= W)
			ans = i;

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1800
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
#define dbg(x) cout << #x"=" << x << endl; 

int main(){ 
    //freopen("in.txt", "r", stdin);
    int A,B,C;
    cin >> A >> B >> C;
    cout << C-min(C, A-B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) c.begin(),c.end()
#define tr(c,i) for(i = c.begin(); i != c.end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e;++i)
#define forsn(i,s,e) for(int i = s; i < e;++i)
#define rforn(i,s) for(int i = s; i >= 0;--i)
#define rforsn(i,s,e) for(int i = s; i >= e;--i)
# define INF 0x3f3f3f3f 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=1e5+5,MOD=1e9+7;

int main()
{
    ll i,j,k,m,n;
    cin>>n>>k;
    v64 h(n);
    forn(i,n)
        cin>>h[i];
    ll dp[n+5];
    forn(i,n)
    {
        if(i==0)
            dp[i]=0;
        else
        {
            dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
            for(j=i-1;j>=i-k && j>=0;j--)
                dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
        }
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 4748
n,k = map(int,input().split())
 
if k==1 :
  ln=0
elif k==0 :
  ln=n
elif n>=k:
  a = n%k
  n=a
  while 1:
    ln = n
    n = abs(a-k)
    if ln<=n:
      break
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

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

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

    static class B {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int X = in.Int();
            int Y = in.Int();

            String ans = "No";
            for (int i = 0; i <= X; i++) {
                if (i * 2 + (X - i) * 4 == Y) {
                    ans = "Yes";
                }
            }
            out.println(ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    }
}



Measured memory_bytes: 32792
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
/*---define types---*/
typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
/*---define variables---*/
const ll mod=1000000007;
ll way[100005];
int n,m;
bool br[100005];
/*---define function---*/

/*---main code---*/
int main()
{
	FIO;
	way[0]=1ll;
	cin>>n>>m;
	for(int i=1;i<=m;++i)
	{
		int x;
		cin>>x;
		br[x]=1;
	}
	for(int i=1;i<=n;++i)
	{
		if(br[i])
		{
			continue;
		}
		way[i]+=way[i-1];
		if(i-2>=0)
		{
			way[i]+=way[i-2];
		}
		way[i]%=mod;
	}
	cout<<way[n]<<'\n';
	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vl vector<ll>
#define pll pair<ll, ll>
#define vll vector<pll>
#define coutp cout << fixed << setprecision(12)
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

ll power(ll x, ll y, ll m)
{
    ll res = 1;
    x = x % m;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % m;
        y = y >> 1;
        x = (x * x) % m;
    }
    return res;
}
vector<vi> a(2e5+1);
vi color(2e5+1);
int cnt;
void dfs(int u,int grp) {
    color[u]=grp;
    cnt++;
    for(int v:a[u]) {
        if(color[v]==0) {
            dfs(v,grp);
        }
    }
}

void solve()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++) {
        int u,v;
        cin>>u>>v;
        u--;v--;
        a[u].pb(v);
        a[v].pb(u);
    }
    int grp=1;
    int ans=0;
    for(int i=0;i<n;i++) {
        cnt=0;
        if(color[i]==0) {
            dfs(i,grp);
            grp++;
            ans=max(ans,cnt);
        }
    }

    cout<<ans;


}

int main()
{
    fastio;
    int t;
    t = 1;
    //cin >> t;
    //int test=t;
    
    while (t-- > 0)
    {
        //cout<<"Case #"<<(test-t)<<": ";
        solve();
        cout << newl;
    }

    return 0;
}

Measured memory_bytes: 21152
#include<bits/stdc++.h>
using namespace std;
int a,b;
void solve(){
  if(a>9||b>9){
    cout<<"-1"<<endl;
  }else{
    cout<<a*b<<endl;
  }


}



int main(){
  cin>>a>>b;

  solve();
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
long long int lis[200002];
int main(){
    int N,K;
    cin>>N>>K;
    for(int i=0;i<N;i++)cin>>lis[i];
    K=min(K,400);
    for(int i=0;i<K;i++){
        long long int rui[200002]={0};
        for(int j=0;j<N;j++){
            rui[max((long long int)0,j-lis[j])]++;
            rui[min((long long int)N,j+lis[j]+1)]--;
        }
        for(int j=0;j<N;j++){
            if(j==0)lis[j]=rui[j];
            else lis[j]=lis[j-1]+rui[j];
        }
    }
    for(int i=0;i<N;i++){
        cout<<lis[i];
        if(i!=N-1)cout<<' ';
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 6760
n = int(input())
def dfs(x):
    if len(x) == n:
        print(''.join(map(lambda i: chr(ord('a') + i - 1), x)))
        return
    for i in range(max(x)+1):
        y = x.copy()
        y.append(i+1)
        dfs(y)
dfs([1])



Measured memory_bytes: 4404