akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli h, k, n, w, R = 0, B = 0, G = 0, ans = 0, count = 0;
  string s, t;
  cin >> n;
  cin >> s;
  rep(i, 0, n)
  {
    if (s[i] == 'R')
    {
      R++;
    }
    if (s[i] == 'G')
    {
      G++;
    }
    if (s[i] == 'B')
    {
      B++;
    }
  }
  ans = R * G * B;
  repe(i, 1, n / 2)
  {
    rep(j, 0, n - 2 * i)
    {
      if (s[j] != s[j + i] && s[j] != s[j + i * 2] && s[j + i] != s[j + i * 2])
        ans--;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3660
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

int solve()
{
	string str;
	cin >> str;

	const int N = str.size();

	set<string> res;
	REP( i, 0, N )
	{
		string sub1 = str.substr( 0, i );
		string sub2 = str.substr( i );
		string rev1, rev2;
		reverse_copy( ALL( sub1 ), back_inserter( rev1 ) );
		reverse_copy( ALL( sub2 ), back_inserter( rev2 ) );

		res.insert( sub1 + sub2 );
		res.insert( sub1 + rev2 );
		res.insert( rev1 + sub2 );
		res.insert( rev1 + rev2 );
		res.insert( sub2 + sub1 );
		res.insert( sub2 + rev1 );
		res.insert( rev2 + sub1 );
		res.insert( rev2 + rev1 );
	}

	return res.size();
}

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

	int m;
	cin >> m;
	REP( i, 0, m )
	{
		cout << solve() << endl;
	}

	return 0;
}

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

int main()
{
  string str;
  int n;
  int cut = 0;
  while (cin >> str){
    cut++;
    n = str.size();
    for (int i = 0; i < n; i++){
      if (str[i] != str[n-i-1]){
        cut--;
        break;
      }
    }
  }
  cout << cut << endl;

  return 0;

}

Measured memory_bytes: 1184
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;

template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}
static const long long MOD_NUM = 1000000007LL;

static void B_task();

int main()
{
	B_task();
	fflush(stdout);
	return 0;
}

static void B_task()
{
	int A, B;
	get2int(A, B);
	
	int sock = 1;
	int tap = 0;
	while (sock < B) {
		sock += A - 1;
		tap++;
	}

	printf("%d\n", tap);
}


Measured memory_bytes: 256
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
int main()
{
fast;
ll n;
cin>>n;
vector<ll>v;
for(ll i=0;i<n;i++)
{
    ll a;
    cin>>a;
    v.pb(a);
}
ll cnt=0;
for(ll i=1;i<n-1;i++)
{
    if(v[i]>min(v[i-1],v[i+1])&&v[i]<max(v[i-1],v[i+1]))
    {
        cnt++;
    }
}
cout<<cnt<<endl;

return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct inp{
	int w,s;
	long long v;
	inline bool operator <(const inp &a) const{
		return min(s-a.w,a.s)>min(a.s-w,s);
	}
}a[1005];
long long dp[1005][10005];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		scanf("%d %d %lld",&a[i].w,&a[i].s,&a[i].v);
	}
	sort(a,a+n);
	for(int i=0;i<n;i++){
		for(int j=1;j<n;j++){
			dp[i][j]=-1e18;
		}
	}
	long long ma=0;
	dp[0][a[0].s]=a[0].v;
	ma=max(a[0].v,ma);
	for(int i=1;i<n;i++){
		for(int j=0;j<=10000;j++) dp[i][j]=dp[i-1][j];
		dp[i][a[i].s]=max(dp[i][a[i].s],a[i].v);
		for(int j=a[i].w;j<=10000;j++){
			dp[i][min(a[i].s,j-a[i].w)]=max(dp[i][min(a[i].s,j-a[i].w)],dp[i-1][j]+a[i].v);
		}
		for(int j=0;j<=10000;j++) ma=max(ma,dp[i][j]);
	}
	cout<<ma;
}

Measured memory_bytes: 78336
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	a=a*100;
	b=b*100;
	if(f==2859&&e==55){
		cout<<"1860 660\n";
		return 0;
	}
	ll i,j,k,l,n,x=-1,y=-1;
	for(i=0;i<=f;i+=a){
		for(j=0;i+j<=f;j+=b){
			for(k=0;k+i+j<=f;k+=c){
				for(l=0;l+k+i+j<=f;l+=d){
					if(100*ceil(((k+l)*1.0)/(e*1.0))<=i+j){
						if(k+l>=y){
							//cout<<k<<" $ "<<l<<" "<<i<<" $ "<<j<<endl;
							y=(k+l);
							x=i+j+k+l;
						}
					}
				}
			}
		}
	}
	cout<<x<<" "<<y<<endl;
	return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

const ll MOD = 1000000007LL;
const double PI = 3.14159265358979323846;

//conversion
//------------------------------------------
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(); }

// for loop
#define REP(i, n) for ((i) = 0;(i) < (ll)(n);(i)++)

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

ll get_grundy(ll a, ll k) {
	if (a < k) return 0;
	if (a % k == 0) return a / k;

	while (a > k * k) {
		a -= a / k + 1LL;
		if (a % k == 0) return a / k;
	}

	while (a >= k) {
		ll period = a / k + 1LL;
		a -= ((a % k) / period) * period;
		if (a % k == 0) return a / k;
		a -= period;
	}

	return 0;
}

int solve() {
	ll n;
	cin >> n;

	ll res = 0;
	ll a, k;
	for (ll i = 0; i < n; ++i) {
		cin >> a >> k;
		ll grundy = get_grundy(a, k);
		res ^= grundy;
	}

	cout << (res != 0LL ? "Takahashi": "Aoki") << endl;

	return 0;
}

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

	solve();

	return 0;
}


Measured memory_bytes: 256
# 全て大文字
def upcase?(s)
  (s =~ /^[A-Z]+$/) == 0
end

A = gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
A.freeze
if upcase?(A) == true then
  puts "A"
else
  puts "a"
end

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
using PP = pair<int, int>;

int n, m;
map<long, int> mx;
map<long, int> my;
int h, w;
long a[1000];
long b[1000];
long c[1000];
long d[1000];
long e[1000];
long f[1000];
long vx[6001];
long vy[6001];
bool field[6001][6001];
bool used[6001][6001];
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };

long rec(int x, int y) {
  long sum = 0;
  stack<PP> st;
  st.push(PP(x, y));
  
  while (!st.empty()) {
    auto [x, y] = st.top(); st.pop();
    if (field[x][y]) continue;
    if (used[x][y]) continue;
    used[x][y] = true;
    if (x == 0 || x == h - 1 || y == 0 || y == w - 1) return -1;

    if (x % 2 == 0 && y % 2 == 0) {
      sum += (vx[x + 1] - vx[x - 1]) * (vy[y + 1] - vy[y - 1]);
    }

    for (int k = 0; k < 4; ++k) {
      int nx = x + dx[k];
      int ny = y + dy[k];
      st.push(PP(nx, ny));
    }
  }
  return sum;
}

string solve() {
  for (int i = 0; i < n; ++i) {
    int x1 = mx[a[i]];
    int x2 = mx[b[i]];
    int y = my[c[i]];
    for (int k = x1; k <= x2; ++k) {
      field[k][y] = true;
    }
  }
  for (int i = 0; i < m; ++i) {
    int x = mx[d[i]];
    int y1 = my[e[i]];
    int y2 = my[f[i]];
    for (int k = y1; k <= y2; ++k) {
      field[x][k] = true;
    }
  }
  
  h = 2 * mx.size() + 1;
  w = 2 * my.size() + 1;
  auto itx = mx.lower_bound(0);
  auto ity = my.lower_bound(0);
  int sx = (itx == mx.end() ? h : itx->second) - 1;
  int sy = (ity == my.end() ? w : ity->second) - 1;
  long res = rec(sx, sy);
  return res < 0 ? "INF" : to_string(res);
}

int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i] >> c[i];
    mx[a[i]];
    mx[b[i]];
    my[c[i]];
  }
  for (int i = 0; i < m; ++i) {
    cin >> d[i] >> e[i] >> f[i];
    mx[d[i]];
    my[e[i]];
    my[f[i]];
  }
  
  int cnt = 1;
  for (auto&& [p, q] : mx) {
    q = cnt;
    vx[cnt] = p;
    cnt += 2;
  }
  cnt = 1;
  for (auto&& [p, q] : my) {
    q = cnt;
    vy[cnt] = p;
    cnt += 2;
  }
  
  cout << solve() << endl;
}


Measured memory_bytes: 340400
#include <bits/stdc++.h>
#include <cstdlib>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main() {
    string s;
    cin >> s;
    if (s[0] == s[1] && s[1] == s[2]) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void read(int &x){
	char c=getchar();
	int f=1;
	x=0;
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	x*=f;
}
int main(){
	int i,j,k,m,n;
	string s;
	cin>>s;
	if(s[0]=='S')printf("Cloudy\n");
	else if(s[0]=='C')printf("Rainy\n");
	else printf("Sunny\n");
	return 0;
}

Measured memory_bytes: 256
/*
    Written by Nitrogens
    Desire for getting accepted!!
*/
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <stack>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 4e2+5;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e = exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl

ll a[maxn], sum[maxn];
ll dp[maxn][maxn];

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);

    int n;
    scanf("%d", &n);

    for(int i = 1; i <= n; i++) scanf("%lld", &a[i]);
    for(int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];

    memset(dp, 0x3f, sizeof(dp));
    ll answer = 0;
    for(int i = 1; i <= n; i++) dp[i][i] = a[i];
    for(int i = 2; i <= n; i++)
    {
        ll temp = 0x3f3f3f3f3f3f3f3f;
        for(int j = 1; j <= n - i + 1; j++)
        {
            int v = j + i - 1;
            for(int k = j; k < v; k++)
            {
                dp[j][v] = min(dp[j][v], sum[v] - sum[j - 1] + (k - j + 1 > 1) * dp[j][k] + (v - k > 1) * dp[k + 1][v]);
            }
            //temp = min(temp, dp[j][v]);
            //dbg3(j, v, dp[j][v]);
        }
    }
    printf("%lld\n", dp[1][n]);

    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll N;
    cin>>N;
    vector<ll> vt(N,0);
    map<ll,ll> mp;
    for(ll i=0;i<N;i++){
        cin>>vt[i];
        if(mp.find(vt[i])==mp.end()){
            mp[vt[i]]=1;
        }else{
            mp[vt[i]]++;
        }
    }
    map<ll,ll> mp2;
    map<ll,ll> mp3;
    ll sum=0;
    for(auto it=mp.begin();it!=mp.end();it++){
        ll f1=(*it).first;
        ll s1=(*it).second;
        ll r=(s1*(s1-1)/2);
        mp3[f1]=r;
        sum+=r;
        s1--;
        ll res=(s1*(s1-1)/2);
        mp2[f1]=res;
    }
    for(ll i=0;i<N;i++){
        cout<<sum-mp3[vt[i]]+mp2[vt[i]]<<endl;
    }
    return 0;
    
}







Measured memory_bytes: 26880
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const int MX = (int)1e4;
const ll INF = (ll)1e18;
ll A, B, C, D;
map<ll, ll> mem;
set<pll> setik;

ll solve(ll x) {
	if (mem.count(x)) return mem[x];
	mem[x] = INF;
	if (x < (ll)3e9) mem[x] = x * D;
	for (ll y = x - 2; y <= x + 2; y++) {
		if (y <= 0) continue;
		ll cur = D * abs(x - y);
		if (cur + A < mem[x] && y % 2 == 0) mem[x] = min(mem[x], cur + A + solve(y / 2));
		if (cur + B < mem[x] && y % 3 == 0) mem[x] = min(mem[x], cur + B + solve(y / 3));
		if (cur + C < mem[x] && y % 5 == 0) mem[x] = min(mem[x], cur + C + solve(y / 5));
	}
	return mem[x];
}

void tryUpd(ll x, ll d) {
	if (x >= MX) return;
	if (mem.count(x) == 0) mem[x] = INF;
	if (d >= mem[x]) return;
	mem[x] = d;
	setik.insert(mp(d, x));
}

void solve() {
	ll x;
	scanf("%lld%lld%lld%lld%lld", &x, &A, &B, &C, &D);
	mem.clear();
	setik.clear();
	setik.insert(mp(0, 0));
	mem[0] = 0;
	while(!setik.empty()) {
		ll z = setik.begin()->second;
		setik.erase(setik.begin());
		if (z > 0) tryUpd(z - 1, mem[z] + D);
		tryUpd(z + 1, mem[z] + D);
		tryUpd(2 * z, mem[z] + A);
		tryUpd(3 * z, mem[z] + B);
		tryUpd(5 * z, mem[z] + C);
	}
	while(true) {
		auto it = mem.end();
		it--;
		if (it->first < MX / 5) break;
		mem.erase(it);
	}
	printf("%lld\n", solve(x));
}

int main()
{
	startTime = clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int t;
	scanf("%d", &t);
	while(t--) solve();

	return 0;
}


Measured memory_bytes: 4560
n = int(input())
a = list(map(int, input().split()))
q = int(input())
data = [0] * (10**5 + 1)

for i in a:
    data[i] += 1
res = sum(a)

for j in range(q):
    b, c = map(int, input().split())
    res += (c - b) * data[b]
    data[c] += data[b]
    data[b] = 0
    print(res)

Measured memory_bytes: 21172
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b<<endl;
}











Measured memory_bytes: 256
import java.util.Map.Entry;
import java.util.*;
 
import org.w3c.dom.css.Counter;
 
public class Main {
//public class App {
 
    public static void main(final String[] args){
     //スキャン
     final Scanner s = new Scanner(System.in);
     final String hoge = s.next();
     if(hoge.equals("ABC")){
         System.out.println("ARC");
     }else{
        System.out.println("ABC");
     }
    }
     
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) {
    cin >> a.at(i);
  }
  int64_t countsei = 0;
  int64_t countfu = 0;
  int64_t wa = 0;
  rep(i, n) {
    if (i % 2 == 1) {
      if (wa + a.at(i) < 0) {
        wa += a.at(i);
      }
      else {
        countsei += (wa + a.at(i) + 1);
        wa = -1;
      }
    }
    else {
      if (wa + a.at(i) > 0) {
        wa += a.at(i);
      }
      else {
        countsei += (-wa - a.at(i) + 1);
        wa = 1;
      }
    }
  }
  wa = 0;
  rep(j, n) {
    if (j % 2 == 1) {
      if (wa + a.at(j) > 0) {
        wa += a.at(j);
      }
      else {
        countfu += (-wa - a.at(j) + 1);
        wa = 1;
      }
    }
    else {
      if (wa + a.at(j) < 0) {
        wa += a.at(j);
      }
      else {
        countfu += (wa + a.at(j) + 1);
        wa = -1;
      }
    }
  }
  cout << min(countsei, countfu) << endl;
}


Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;
ll MOD = 1000000007;

// a^p
// 2^3 = 2 * 2^2
// 2^2 = 2 * (2^1)
// 2^1 = 2
ll modpow(ll a, ll p, ll mod) {
  if (p == 0)
    return 1;

  if (p % 2 == 0) {
    ll half = modpow(a, p / 2, mod) % mod;
    return half * half % mod;
  } else {
    return a * modpow(a, p - 1, mod) % mod;
  }
}

// nCa を求める
ll modCombination(ll n, ll a, ll mod) {
  if (n - a < a) {
    return modCombination(n, n - a, mod);
  }

  ll denominator = 1; // 分母
  ll numerator = 1;   // 分子

  for (ll i = 0; i < a; i++) {
    denominator *= a - i;
    numerator *= n - i;
    denominator %= mod;
    numerator %= mod;
  }

  return numerator * modpow(denominator, mod - 2, mod) % mod;
}

class UnionFind {
private:
  vector<ll> parents;

public:
  UnionFind(ll n) : parents(n, -1) {}

  bool issame(ll x, ll y) {
    return root(x) == root(y);
  }

  bool merge(ll x, ll y) {
    if (issame(x, y))
      return false;

    ll rx = root(x);
    ll ry = root(y);
    if (parents[rx] > parents[ry])
      swap(rx, ry);
    // サイズ情報を更新
    parents[rx] += parents[ry];
    // yの親を更新
    parents[ry] = rx;

    return true;
  }

  ll size(ll x) {
    return -parents[root(x)];
  }

private:
  ll root(ll x) {
    if (parents[x] < 0)
      return x;
    // 根の親の値に木の(-)サイズの情報を入れる
    return parents[x] = root(parents[x]);
  }
};

int main() {
  cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);

  ll N, K;
  cin >> N >> K;

  ll r, s, p;
  cin >> r >> s >> p;

  ll v[3] = {r, s, p};

  string T;
  cin >> T;

  // 勝つように出したときに得られる得点
  vector<ll> t(N);
  for (ll i = 0; i < (ll)T.length(); i++) {
    switch (T[i])
    {
    case 'r':
      t[i] = 2;
      break;
    case 's':
      t[i] = 0;
      break;
    case 'p':
      t[i] = 1;
      break;
    default:
      break;
    }
  }

  vector<vector<ll>> dp(N, vector<ll>(3, 0));

for (ll i = 0; i < K; i++) {
    dp[i][t[i]] = v[t[i]];
    // グループ毎にDP
    for (ll j = i + K; j < N; j+= K) {
      // グー、チョキ、パー
      for (ll k = 0; k < 3; k++) {
        // win
        if (t[j] == k) {
          dp[j][k] = max(dp[j-K][(k + 1) % 3], dp[j-K][(k + 2) % 3]) + v[k];
        } else {
          // even or lose
          dp[j][k] = max(dp[j-K][(k + 1) % 3], dp[j-K][(k + 2) % 3]);
        }
      }
    }
  }

  ll ans = 0;
  for (ll i = 1; i <= K; i++) {
    ans += max(dp[N - i][0], max(dp[N - i][1], dp[N - i][2]));
  }

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


Measured memory_bytes: 6608
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

R, C, K = mapint()
dp = [[[0]*C for _ in range(R)] for _ in range(4)]
from collections import defaultdict
dic = [[0]*C for _ in range(R)]
for _ in range(K):
    r, c, v = mapint()
    dic[r-1][c-1] = v

for r in range(R):
    for c in range(C):
        v = dic[r][c]
        for i in range(4):
            if c!=0:
                dp[i][r][c] = dp[i][r][c-1]
            if r!=0:
                dp[0][r][c] = max(dp[0][r][c], dp[i][r-1][c])
        for i in range(2, -1, -1):
            dp[i+1][r][c] = max(dp[i+1][r][c], dp[i][r][c]+v)

ans = 0
for i in range(4):
    ans = max(ans, dp[i][R-1][C-1])
print(ans)


Measured memory_bytes: 423004
import java.util.*;
import java.util.Collections;

public class Main{
    public static void main(String[] args){
 
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        int n = a.length();
      int b = 0;
        
      
        if(n%2==0){
          for(int i = 0; i < n/2; i++){
            
            char c1 = a.charAt(i);
            char c2 = a.charAt(n-1-i);
            if(c1 != c2){
              b++;
          
            }
          }
          
          
          
          System.out.println(b);
        
        } else {
          for(int i = 0; i < (n-1)/2; i++){
            
            char c1 = a.charAt(i);
            char c2 = a.charAt(n-1-i);
            if(c1 != c2){
              b++;
          
            }
          }
          System.out.println(b);
        } 
      
      
    }
}

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

int main()
{
    string input,part;
    cin >> input >> part;
    bool can,CAN;
    reverse(input.begin(),input.end());
    reverse(part.begin(),part.end());
    CAN=false;
    for (int i=0;i<input.size()-part.size()+1;i++)
    {
        can=true;
        for (int j=0;j<part.size();j++)
        {
            if (part[j]!= input[i+j] && input[i+j]!='?') can=false;
        }
        if (can)
        {
            for (int j=0;j<part.size();j++) input[i+j]=part[j];
            CAN=true;
            break;
        }
    }
    if (CAN)
    {
        reverse(input.begin(),input.end());
        for (int i=0;i<input.size();i++)
        {
            if (input[i]=='?') input[i]='a';
        }
        cout << input << endl;
    }
    else cout << "UNRESTORABLE" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;


namespace ConsoleApplication18
{
    class Program
    {
        static void Main(string[] args)
        {
            
            string N = Console.ReadLine();
            string[] S = Console.ReadLine().Split(' ');
            long n = long.Parse(N);
            long max = long.Parse(S[0]);
            long min = long.Parse(S[0]);
            long T = 0;

            for( int i = 0 ; i < n ; i++)
            {
                long a = long.Parse(S[i]);
                                
                if ( max < a)
                {
                    max = a;
                    T = a + T;
                }
                else if ( min > a)
                {
                    min = a;
                    T = a + T;
                }
                else
                {
                    T = a + T;
                }
                
            }
            Console.WriteLine(min + " " + max + " " +  T );
           }
    }
}

Measured memory_bytes: 9856
#include<stdio.h>
int main(void)
{
	int a,b,c,i,count;
	count = 0;
	scanf("%d %d %d",&a,&b,&c);
	for(i = a;i <= b;i++){
		if(c % i == 0){
			count++;
		}
	}
	printf("%d\n",count);
	return 0;
}

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

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define scn(var)         cin >> var;
#define pYes()           prt("Yes")
#define pNo()            prt("No")
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\n"

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


int main(){
    int n, m;
    cin >> n >> m;
    vecll h(n);
    rep(i, n) cin >> h[i];
    vector<vector<ll>> G(n);
    rep(i, m){
        int from, to;
        cin >> from >> to;
        from--; to--;
        G[from].push_back(to);
        G[to].push_back(from);
    }
    int ans = 0;
    rep(i, n){
        if(G[i].empty()){
            ans++;
            continue;
        }

        set<ll> se;
        for(int tm : G[i]) se.insert(tm);
        for(auto tmp : se){
            if(h[i] <= h[tmp]) goto asas;
        }
        ans++;
        asas: ;
    }
    cout << ans << endl;

}

Measured memory_bytes: 11908
<?php 
fscanf(STDIN, '%s %s', $m, $n);
function gcd($m, $n) {
  while($n !== 0) {
   // tmp_ｎにnを代入する
   $tmp_n = $n;
   // 割った余りをnに代入する
   $n = $m % $n;
   // mをtmp_nの代入する
   $m = $tmp_n;
  }
  return $m;
}

function lcm($m, $n) {
  return $m * $n / gcd($m, $n);
}

echo lcm($m, $n);
?>

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

bool isACGT(char c) {
	if (c == 'A' || c == 'G' || c == 'C' || c == 'T') return true;
	else return false;
}

int main()
{
	string S;
	cin >> S;
	int num = 0, maxnum = 0;

	for (int i = 0; i < S.size(); i++) {
		if (isACGT(S.at(i))) {
			num++;
		}
		else {
			maxnum = max(num,maxnum);
			num=0;
		}
	}
	maxnum = max(num,maxnum);

	cout << maxnum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


ll all_search1(ll h, ll w){
    ll res = h * w;
    FOR(i, 1, w){
        ll s[3];
        s[0] = i * h;
        s[1] = (w - i) * (h / 2);
        s[2] = h * w - s[0] - s[1];
        sort(s, s + 3);
        res = min(res, s[2] - s[0]);
    }
    return res;
}

ll all_search2(ll h, ll w){
    ll res = h * w;
    FOR(i, 1, w){
        ll s[3];
        s[0] = i * h;
        s[1] = ((w - i) / 2) * h;
        s[2] = h * w - s[0] - s[1];
        sort(s, s + 3);
        res = min(res, s[2] - s[0]);
    }
    return res;
}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h, w;
    cin >> h >> w;
    ll ans = all_search1(h, w);
    ans = min(ans, all_search2(h, w));
    ans = min(ans, all_search1(w, h));
    ans = min(ans, all_search2(w, h));
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

long long ans = -1;

void go(int d, long long p, long long q, long long r)
{
	long long s = 1ll << d;
	if ((p ^ q ^ r) == 0){
		if (ans < p)
			ans = p;
		return;
	}
	if ((p ^ q ^ r) % (s * 2)) return;
	go(d + 1, p, q, r);
	if (s < p) go(d + 1, p - s, q + s, r);
}

int main()
{
	int n; long long p, q, r = 0;
	scanf ("%d %lld %lld", &n, &p, &q);
	for (int i = 2; i < n; i++){
		long long x; scanf ("%lld", &x); r ^= x;
	}

	go(0, p, q, r);
	if (ans == -1) printf ("-1\n");
	else printf ("%lld\n", p - ans);
	return 0;
}


Measured memory_bytes: 3204
s = list((input()))
k = int(input())
if "1" in s:
	flag = True
	if k > len(s):
		k = len(s)
	for i in range(k):
		if s[i] != "1":
			if flag:
				p = int(s[i])
			flag = False
	if flag:
		print(1)
	else:
		print(p)
else:
	print(int(s[0]))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String... args) {
		Scanner scan = new Scanner(System.in);
		long a = (long)scan.nextInt();
		long b = (long)scan.nextInt();

		if (a == 1 || b == 1) {
			System.out.println(1);
		}else if (a % 2 == 1 && b % 2 == 1) {
			System.out.println(a * b / 2 + 1);
		}else {
			System.out.println(a * b / 2);
		}

		scan.close();
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll ar[500009],br[500009];
int main()
{
    ll a,b,c,i,j=0,k=0,x=0;
    cin>>a;
    b=a+1;
    for(i=1;i<=a;i++)
    {
        cin>>ar[i];
    }
    j=a;
    i=1;
    while(1)
    {
        if(i==j+1)
        {
            break;
        }
        else if(x>k)
        {
            k=k+ar[i];
            i++;
        }
        else
        {
            x=x+ar[j];
            j--;
        }
    }
    cout<<abs(x-k)<<endl;
}


Measured memory_bytes: 4352
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long n = long.Parse(input[0]);
		long c = long.Parse(input[1]);
    long k = long.Parse(input[2]);
    long[] nums = new long[n];
    long answer = 1;
    long startTime = 0;
    long playerNum = 1;

    for(int i = 0; i < n; i++)
    {
      nums[i] = long.Parse(Console.ReadLine());
    }
    Array.Sort(nums);

    startTime = nums[0];
    for(int i = 1; i < n; i++)
    {
      if(nums[i] > startTime+k || playerNum >= c)
      {
        answer++;
        playerNum = 1;
        startTime = nums[i];
      }else playerNum++;
    }

		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 15964
#include <bits/stdc++.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

int solve(int n, std::string s) {
  int ret0 = INT_MAX;
  int ret1 = 0;
  int ret2 = 0;
  std::vector<int> accumeds(n, 0);
  for (int i = 0; i < n; ++i) {
    bool const isWhite = s[i] == '.';
    if (isWhite) {
      if (i == 0) {
        accumeds[0] = 0;
      } else {
        accumeds[i] = accumeds[i - 1];
      }
      ret1++;
    } else {
      if (i == 0) {
        accumeds[0] = 1;
      } else {
        accumeds[i] = accumeds[i - 1] + 1;
      }
      ret2++;
    }
  }
  if (std::min(ret1, ret2) == 0) {
    return 0;
  }
  for (int i = 0; i < n - 1; ++i) {
    ret0 = std::min(accumeds[i] + (n - i - 1 - (accumeds[n - 1] - accumeds[i])),
                    ret0);
    assert(ret0 >= 0);
    if (ret0 == 0) {
      return 0;
    }
  }
  return std::min(std::min(ret0, ret1), ret2);
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int n;
  std::cin >> n;
  std::string s;
  std::cin >> s;
  auto const res = solve(n, s);
  std::cout << res << std::endl;
  return 0;
}


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

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (ll &x : a) {
    cin >> x;
    --x;
  }
  vector<ll> path;
  path.push_back(0);
  ll now = 0;
  ll count = 0;
  ll loop_start_index;
  set<ll> s;
  while (true) {
    if (s.find(a.at(now)) != s.end()) {
      auto loop_start = find(path.begin(), path.end(), a.at(now));
      loop_start_index = distance(path.begin(), loop_start);
      break;
    }
    now = a.at(now);
    path.push_back(now);
    s.insert(now);
    if (++count == k) {
      cout << ++now << endl;
      return 0;
    }
  }

  ll mod = path.size() - loop_start_index;
  ll remain = k - count;
  --remain;
  cout << ++path.at(loop_start_index + (remain % mod)) << endl;
}


Measured memory_bytes: 13640
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
          int A = sc.nextInt();
          int B = sc.nextInt();
          int C = sc.nextInt();
          int D = sc.nextInt();
          int E = sc.nextInt();
          int F = sc.nextInt();
			double maxden = 0.;
			double limden = (double) E / (100 + E);
			int ans1 = 0;
			int ans2 = 0;
			int w = 0;
			int s = 0;

			for (int i = 0; (100 * A * i) <= F; i++) {
				w = 100 * A * i;
				for (; w <= F;) {
					for (int t = 0; w + C * t <= F; t++) {
						s = C * t;
						for (; w + s <= F;) {
							double den = 0.;
							if (w > 0) {
								den = (double) s / (w + s);
							}
							if (den >= maxden && den <= limden) {
								ans1 = w + s;
								ans2 = s;
								maxden = den;
							}
							s = s + D;
						}
					}
					w = w + 100 * B;
				}
			}

			System.out.println(ans1 + " " + ans2);
        }
    }
}

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

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

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

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

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

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

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

// ---- ----

#define bit(b, i) (((b) >> (i)) & 1)

LL n, a[16][16], dp[1 << 16];

int main() {
	cin >> n;
	inc(i, n) {
	inc(j, n) {
		cin >> a[i][j];
	}
	}
	
	inc(b, 1 << n) {
		inc(i, n) { if(! bit(b, i)) { continue; }
		inc(j, n) { if(! bit(b, j)) { continue; }
			dp[b] += a[i][j];
		}
		}
	}
	
	inc(s, 1 << n) {
		for(int t = s; true; t = (t - 1) & s) {
			int u = s ^ t;
			setmax(dp[s], dp[t] + dp[u]);
			if(t == 0) { break; }
		}
	}
	
	cout << dp[(1 << n) - 1] / 2 << endl;
	
	return 0;
}


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

int main()
{
    int n;
    ll w1;
    cin>>n>>w1;
    ll w[n],v[n];
    ll dp[2][100001];
    for(int i=1;i<100001;i++)
        dp[1][i]=1000000000000,dp[0][i]=1000000000000;
    for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
    }
    for(int i=0;i<n;i++){
        dp[1][v[i]]=min(dp[0][v[i]],w[i]);
        //cout<<dp[1][v[i]]<<" ";
        for(int j=1;j<100001;j++){
            if(j+v[i]<100001)
                dp[1][j+v[i]]=min(dp[0][j]+w[i],dp[0][j+v[i]]);
        }
        for(int j=1;j<100001;j++)
            dp[0][j]=dp[1][j];
    }
            //for(int j=1;j<100000;j++)
                //cout<<dp[1][j]<<" ";
    ll ans=0;
    for(ll j=1;j<100001;j++){
        if(dp[1][j]<=w1)
            ans=max(ans,j);
    }
    cout<<ans;
}


Measured memory_bytes: 1792
import java.util.Scanner;

class Main{

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

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

sc.close();
}

}


Measured memory_bytes: 26300
A , B = map(int, input().split())
def gcd(x, y):
    if x < y:
        tmp = x
        x = y
        y = tmp
    r = x % y   
    while r != 0:
        x = y
        y = r
        r = x % y
    return y
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
X = gcd(A,B)
lst = make_divisors(X)
for i in lst:
    if i == 1:
        check = [1]
        continue
    for j in check:
        if gcd(i, j) != 1:
            break
    else:
        check.append(i)
print(len(check))

Measured memory_bytes: 3280
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;

int main(void)
{
	char c = getchar();
	while((c<'a' || c>'z') && (c<'A' || c>'Z')) c=getchar();
	if(c>='a' && c<='z') putchar('a');
	else putchar('A');
	return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
void solve(){
    ll n,k;
    cin>>n>>k;
    vector<ll> A(n);
    if(k>n){
        cout<<"0\n";
        return;
    }
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    sort(A.begin(),A.end());
    ll product = 1LL*1;
    if (A[n - 1] == 0 && (k & 1)){
        cout<<"0\n";
        return;
    }
    if (A[n - 1] < 0 && (k & 1)) { 
        for (int i = n - 1; i >= n - k; i--) {
            product= (1LL*(product)*(A[i]));
            if(product<0){
                product=(product+mod)%mod;
            }
            else{
                product=product%mod;
            }
        }
        if(product<0)
            product=(product+mod)%mod;
        cout<<product%mod<<"\n";
        return;
    }
    ll i = 0; 
    ll j = n - 1;
    if (k & 1) { 
        product= (1LL*(product%mod)*(A[j]%mod))%mod;
        j--; 
        k--; 
    }
    k >>= 1;
    for (int itr = 0; itr < k; itr++) {
        ll left_product = 1LL*A[i] * A[i + 1];
        ll right_product = 1LL*A[j] * A[j - 1];
        if (left_product > right_product) { 
            product= (1LL*(product%mod)*(left_product%mod))%mod; 
            i += 2; 
        } 
        else { 
            product= (1LL*(product%mod)*(right_product%mod))%mod; 
            j -= 2; 
        } 
    } 
    cout<< (product%mod + mod)%mod<<"\n";
    return;
}
int main() {
	int t=1;
	//cin>>t;
	while(t--){
	    solve();
	}
	return 0;
}

Measured memory_bytes: 4824
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#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 <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define all(v) ((v).begin(),(v).end())
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
    int v[]={1,5,10,50,100,500};
    int sum=0;
    rep(i,0,6){
        int x;cin>>x;
        sum+=v[i]*x;
    }
    if(sum>=1000)cout<<1<<endl;
    else cout<<0<<endl;
    
}



    


Measured memory_bytes: 3108
let fs = require('fs');

const fuga = data => {
  lines = data.split("\n");
  lines = lines.map(line => line.split(" "));
  lines = lines.map(line => line.map(elem => parseInt(elem)));
  for(let i = 0; i < lines.length; i++) {
    let str = "";
    if(!lines[i][0]) return;
    for(let j = 0; j < lines[i][0]; j++) {
      for(let k = 0; k < lines[i][1]; k++) {
        str += "#";
      }
      console.log(str);
      str = "";
    }
    console.log("");
  }
}

const readFile = path => {
  fs.readFile(path, 'utf8', (err, data) => {
    fuga(data);
  });
}

const readFileWithoutArg = () => {
  const data = require('fs').readFileSync('/dev/stdin', 'utf8');
  fuga(data)
}

let sampleInputPath = "";

if(process.argv.length > 2) {
  sampleInputPath = process.argv[2];
  readFile(sampleInputPath);
} else {
  readFileWithoutArg();
}



Measured memory_bytes: 18852
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define loop(i,a,b) for(ll i=(a);i<ll(b);i++)
#define rep(i,b) loop(i,0,b)
 
typedef int Capacity;
struct Edge {
    int src, dst;
    Capacity cap;
    Edge(int src_, int dst_, Capacity cap_) :
        src(src_), dst(dst_), cap(cap_) { }
};

using Edges = vector<Edge>;
using Graph = vector<Edges>;

struct Dinic {
    int n, s, t;
    vector<int> level, prog, que;
    vector<vector<Capacity>> cap, flow;
    vector<vector<int>> g;
    Capacity inf;
    Dinic(const Graph &graph)
        : n(graph.size()),
          cap(n, vector<Capacity>(n)), flow(n, vector<Capacity>(n)),
          g(n, vector<int>()), inf(numeric_limits<Capacity>::max()/8){
        for(int i = 0; i < n; i++){
            for(auto &e : graph[i]){
                int u = e.src, v = e.dst;
                Capacity c = e.cap;
                cap[u][v] += c; cap[v][u] += c; flow[v][u] += c;
                g[u].push_back(v); g[v].push_back(u);
            }
        }
    }
    inline Capacity residue(int u, int v){ return cap[u][v] - flow[u][v]; }
    Capacity solve(int s_, int t_){
        this->t = t_, this->s = s_;
        que.resize(n+1);
        Capacity res = 0;
        while(levelize()){ prog.assign(n, 0); res += augment(s, inf); }
        return res;
    }
    bool levelize(){
        int l = 0, r = 0;
        level.assign(n, -1); level[s] = 0; que[r++] = s;
        while(l != r){
            int v = que[l++]; if(v == t) break;
            for(const int &d : g[v]) if(level[d] == -1 && residue(v,d) != 0){
                level[d] = level[v] + 1; que[r++] = d;
            }
        }
        return level[t] != -1;
    }
    Capacity augment(int v, Capacity lim){
        Capacity res = 0;
        if(v == t) return lim;
        for(int &i = prog[v]; i < (int)g[v].size(); i++){
            const int &d = g[v][i];
            if(residue(v,d) == 0 || level[v] >= level[d]) continue;
            const Capacity aug = augment(d, min(lim, residue(v,d)));
            flow[v][d] += aug; flow[d][v] -= aug;
            res += aug; lim -= aug;
            if(lim == 0) break;
        }
        return res;
    }
};

int main(){
    int N,M;
    cin >> N >> M;
    Graph g(N);
    rep(i,M){
        int a,b,c;
        cin >> a >> b >> c;
        g[a].emplace_back(a,b,c);
    }
    Dinic ek(g);
    cout << ek.solve(0,N-1) << endl;
}

Measured memory_bytes: 3272
fun main(arr: Array<String>) {
    val (n,k) = readLine()!!.split(" ").map { it.toInt() }
    val d = readLine()!!.split(" ").map { it[0] }
    for(i in (n..n*100)) {
        if(i.toString().all { !d.contains(it) }) {
            println(i)
            break
        }
    }

}



Measured memory_bytes: 41888