akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include<stdlib.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
#define pr pair<ll, ll>
#define prf pair<ld,ld>
#define vct vector<ll>
#define vpt vector<pr>
#define vcf vector<ld>
#define vpf vector<prf>
#define st set<ll>
#define pq priority_queue<ll>
#define mat vector<vector<ll> >
#define all(x) x.begin(),x.end()
#define F(i, n) for(i = 0; i < (1LL*n); i++)
#define Fr(i, n) for(i = n - 1; i >= 0; i--)
 
struct custom_hash{
    static uint64_t splitmix64(uint64_t x){
        x += 0x9e3779b97f4a7c15;x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const{
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umap unordered_map<long long, long long, custom_hash>
 
void prv(vct v){for (ll i=0;i<v.size();i++)cout<<v[i]<<" ";cout << "\n";}
void prn(ll n){cout<<n<<"\n";}
void prs(string n){cout<<n<<"\n";}
void deb(string s, ll n){cout<<s<<" : "<<n<<"\n";}
void prmt(mat m){for(ll i=0;i<(1LL*m.size());i++)prv(m[i]);}
 
mat getRzMat(ll m,ll n, ll ini=0){mat mt;mt.assign(m,vector<ll>(n,ini));return mt;}
 
ll poww(ll x, ll y, ll m){
    ll res = 1;
    while (y){
        if (y%2 == 0){x = (x * x) % m;y = y / 2;}
        else{res = (res * x) % m;y--;}
    }
    return res;
}
 
vct divsors(ll n){
    vct ans;//ans.push_back(1);
    for(ll i=1;i<=sqrt(n);i++){if(n%i==0){ans.push_back(i);if(i!=(n/i))ans.push_back(n/i);}}
    sort(ans.begin(),ans.end());
    return ans;
}
vct sieve(ll n){
    vct ans(n+1,-1);
    for(ll i=2;i<=n;i++){
        if(ans[i]==-1){
            for(ll j=i;j<=n;j+=i)if(ans[j]==-1)ans[j]=i;
        }
    }
    return ans;
}
mat mt;
ll n, k, m, l, r, x, y, z;//ll ans=0;
ll t, t1, t2;
ll q;
ll i, j;
ll a, b, c, d, w;
ll mod = 1000000007;
ld epi = 0.00000001;
ll cas=0;

void solve(){
    cin>>k>>n;
    ll cn=0;
    F(i,k+1){
        F(j,k+1){
            ll rm=n-(i+j);
            if(rm<=k && rm>=0)cn++;
        }
    }
    prn(cn);

}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    // cout<<fixed<<setprecision(10);
    // freopen("input.txt", "r", stdin); 
    // freopen("output.txt", "w", stdout);
    ll t = 1;
    // cin >> t;
    cas=1;
    while (t--){
        solve();
        cas++;
    }
    return 0;
}
 

Measured memory_bytes: 3624
//line = require('fs').readFileSync('tmp', 'ascii').split('\r\n'); // win
line = require('fs').readFileSync('/dev/stdin', 'ascii').split('\n'); // linux

s = line[0] + line[0];
p = line[1];
if (s.indexOf(p) !== -1) console.log('Yes');
else console.log('No');

Measured memory_bytes: 15604
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=400 +117;
const int MM=200 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
int mod;
struct node{
	int l,r;
	int id;
	int v(){
		if(l==-1)return r;
		else return l;
	}
}a[NN];
bool cmp(node a,node b){
	if((a.id<n&&b.id<n)||(a.id>=n&&b.id>=n)){
		return a.id>b.id;
	}
	else return a.v()==b.v()?a.id>b.id:a.v()<b.v();
}
LL dp[2][NN]={};
LL v(LL x){
	return max(x,0ll);
}
LL calc(int x){
	for(int i=0;i<=n+1;++i)dp[0][i]=0;
	dp[0][0]=1;
	int now=0;
	int pre=0;
	for(int i=0;i<2*n;++i){
		now^=1;
		for(int j=0;j<=pre+1;++j)dp[now][j]=0;
		if(a[i].l==-1){
			for(int j=0;j<=pre;++j){
				dp[now][j]=dp[now^1][j]*v(1+a[i].r-j-i+pre)%mod;
			}
		}
		else{
			for(int j=0;j<=pre;++j){
				dp[now][j]+=dp[now^1][j]*v(1+a[i].r-(n+pre+x-j));
				dp[now][j]%=mod;
				dp[now][j+1]+=dp[now^1][j]*v(1+a[i].l-j-i+pre);
				dp[now][j+1]%=mod;
			}
			++pre;
		}
	}
	return dp[now][x];
}
int main(){
	//open();
	n=read();
	mod=read();
	for(int i=0;i<2*n;++i){
		a[i].r=min(2*n-1,(int)sqrt(4*n*n-i*i));
		a[i].id=i;
		if(i>=n)a[i].l=-1;
		else a[i].l=sqrt(n*n-i*i-1);
	}
	sort(a,a+2*n,cmp);
	LL ans=0;
	for(int i=0,sym=1;i<=n;++i,sym=-sym){
		ans+=sym*calc(i);
		ans%=mod;
	}
	ans=(ans+mod)%mod;
	printf("%lld\n",ans);
	close();
	return 0;
}

Measured memory_bytes: 256
def p(x, y, n):
  #print('p({},{},{})'.format(x,y,n))
  if x == 0:
    #print('return 0')
    return 0
  count = 0
  if x == y:
    if x <= n:
      count += 1

  i = 0
  flag = True
  while flag:
    for j in range(10**i):
      if (x * 10**(i+1) + y + j *10) <= n:
        #print(': ' + str(x * 10**(i+1) + y + j))
        count+=1
      else:
        flag = False
        break
    i += 1
  #print('return {}'.format(count))
  return count

n = int(input())

#print(p(1, 2, 111))
c = 0
for NF in range(1, 10):
  for NL in range(0, 10):
    #print('({}, {}= {})'.format(NF, NL, p(NF, NL, n)))
    
    c +=  p(NF, NL, n) * p(NL, NF, n)
print(c)

Measured memory_bytes: 3064
#include<stdio.h>

int main(){
	long long h, w;
	scanf("%lld %lld", &h, &w);
	if(w==1 || h==1) puts("1");
	else printf("%lld\n", (w/2)*h+(w&1)*(h/2)+(w&1)*(h&1));
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>
#include<boost/multiprecision/cpp_int.hpp>


using namespace std;
using namespace boost::multiprecision;

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", v)
#define PRIY PRI("Yes")
#define PRIN PRI("No")
template<typename A, typename B>
void mins(A & a, const B & b) { a = min(a, (A)b); };
template<typename A, typename B>
void maxs(A & a, const B & b) { a = max(a, (A)b); };

void factorize(ll X, vector<pair<ll,ll>>& ret) {
	for (ll i = 2; i * i <= X; ++i) {
		if (X % i != 0) continue;
		ret.push_back(pair<ll, ll>{i, 0});
		while (X % i == 0) {
			X /= i;
			ret.back().second++;
		}
	}
	if (X != 1) ret.push_back(pair<ll, ll>{X, 1});
}

int main() {
	ll mod = 1e9 + 7;
	ll N, M;
	cin >> N >> M;
	vector<vector<ll>> dp(N+1);
	vector<pair<ll, ll>> P;
	factorize(M, P);
	ll maxn = 0;
	for (const auto& p : P) maxs(maxn, p.second);
	REP(i, 0, N + 1) dp[i].resize(maxn + 1, 0);
	REP(i, 0, maxn + 1)dp[1][i] = 1;
	REP(i, 0, N + 1)dp[i][1] = i;
	REP(i, 2, N + 1) REP(j, 2, maxn + 1) dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod;
	ll ans = 1;
	for (const auto& p : P) ans = ans * dp[N][p.second] % mod;
	PRI(ans);
	return 0;
}

Measured memory_bytes: 30584
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_LV_MAX		10										// 最大難易度

// 内部構造体 - 難易度情報
typedef struct Lv {
	int miCnt;													// 問題数
	int miBonus;												// ボーナス
} Lv;

// 内部変数
static FILE *szpFpI;											// 入力
static Lv sz1Lv[D_LV_MAX + 5];									// 難易度
static int siLCnt;												// 難易度数
static int siGoal;												// 目標値
static int siMin;												// 最小問題数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
#endif

// 最小問題数 - 更新
int
fUpMin(
	int piScr					// <I> 累計スコア
	, int *pipCnt				// <I> 累計問題数
)
{
	int i;

	// 累計問題数
	int li1Cnt[D_LV_MAX + 5];
	memcpy(li1Cnt, pipCnt, sizeof(li1Cnt));

	// 目標値チェック
	int liLNo = siLCnt;
	while (piScr < siGoal) {
		if (li1Cnt[liLNo] < sz1Lv[liLNo].miCnt) {		// 未解答あり
			piScr += liLNo;
			li1Cnt[liLNo]++;

			if (li1Cnt[liLNo] == sz1Lv[liLNo].miCnt) {		// ボーナス
				piScr += sz1Lv[liLNo].miBonus;
			}
		}
		else {											// 未解答なし
			liLNo--;
		}
	}

	// 最終問題数
	int liSum = 0;
	for (i = 1; i <= siLCnt; i++) {
		liSum += li1Cnt[i];
	}

	// 最小問題数 - 更新
	if (siMin > liSum) {
		siMin = liSum;
	}

	return 0;
}

// ボーナスパターン - 作成
int
fMakeBonusPtn(
	int piLNo					// <I> 難易度 1～
	, int piScr					// <I> 累計スコア
	, int *pipCnt				// <I> 累計問題数
)
{
	// 終了チェック
	if (piLNo > siLCnt) {
		fUpMin(piScr, pipCnt);								// 最小問題数 - 更新
		return 0;
	}

	// ボーナス加算なし
	fMakeBonusPtn(piLNo + 1, piScr, pipCnt);			// 下位へ

	// ボーナス加算あり
	piScr += sz1Lv[piLNo].miBonus + piLNo * sz1Lv[piLNo].miCnt;
	pipCnt[piLNo] += sz1Lv[piLNo].miCnt;
	fMakeBonusPtn(piLNo + 1, piScr, pipCnt);			// 下位へ
	pipCnt[piLNo] -= sz1Lv[piLNo].miCnt;

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i;
	char lc1Buf[1024], lc1Out[1024];

	// データ - 初期化
	siMin = INT_MAX;											// 最小問題数

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 難易度数・目標値 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d", &siLCnt, &siGoal);
	siGoal /= 100;

	// 難易度 - 取得
	for (i = 1; i <= siLCnt; i++) {
		fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
		sscanf(lc1Buf, "%d%d", &sz1Lv[i].miCnt, &sz1Lv[i].miBonus);
		sz1Lv[i].miBonus /= 100;
	}
	
	// ボーナスパターン - 作成
	int li1Cnt[D_LV_MAX + 5];
	memset(li1Cnt, 0, sizeof(li1Cnt));
	fMakeBonusPtn(1, 0, li1Cnt);

	// 結果 - セット
	sprintf(lc1Out, "%d\n", siMin);

	// 結果 - 表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N,sum=0;
    cin>>N;
    int d[N];
    for(int i=0;i<N;++i){
        cin>>d[i];
    }
    for(int i=0;i<N;++i){
        for(int j=i+1;j<N;++j){
            sum+=d[i]*d[j];
        }
    }
    cout<<sum<<endl;
}


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

int calc(int a);

int main(){
        int a,b;
        cin >> a >> b;
        int ans=calc(b-a-1);
        ans-=a;
        cout << ans << endl;
        return 0;
}

int calc(int a){
        if(a==1) return 1;
        else return a+calc(a-1);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fill(a)  memset(a, 0, sizeof (a))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

const ll mod = 1e9+7;
const ll N =  2e5;
ll iv[N+1];
ll MOD(ll x){
    if(x>mod) x-=mod;
    if(x<0) x+=mod;
    return x;
}
ll sub(ll x,ll y){
    if(x<0){
        x+=mod;
    }
    if(y<0){
        y+=mod;
    }
    return (x-y)%mod;
}
ll ModExp(ll a,ll b,ll c)
{
    a=a%c;
    ll ans=1;
    while(b>0){
        if(b&1){
            ans=(ans*a)%c;
        }
        b=b>>1; a=(a*a)%c;
    }
    return ans%mod;
}
void inverse(){
        iv[1]=1;
    for(int i=2; i<=N; ++i)
        iv[i]=mod-mod/i*iv[mod%i]%mod;
}

ll nck(ll n, ll k) {
    ll ans=1;
    for(ll i=1; i<=k; ++i)
        ans=ans*(n-i+1)%mod*iv[i]%mod;
    return ans;
}
int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll tt=1;
    // cin >> tt;
    while((tt)--){
        ll n,a,b;
         cin >> n >> a >> b;
            inverse();
            ll ans = ModExp(2,n,mod)-1;
            ans = sub(ans,nck(n,a));
            ans = sub(ans,nck(n,b));
            cout << MOD(ans) << endl;
    }
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
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; }

const long long MOD = 998244353;

// a^n modを計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while(n > 0) {
        if(n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// 二項係数を用いる
const long long MAX = 1000100;

long long fac[MAX], finv[MAX], inv[MAX];

  // テーブルを作る前処理
  /* facが普通の階乗を求めている。invが逆数を求めている。finvが逆数の階乗を求めている。*/
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++) {
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

  // 二項係数を計算する
long long COM(int n, int k) {
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

long long N, M, K;

int main() {
    cin >> N >> M >> K;

    COMinit();
    long long ans = 0;
    for(long long i = 0; i <= K; ++i) {
        long long left = (M%MOD) * modpow(M-1, N-i-1, MOD);
        left %= MOD;
        long long right = COM(N-1, i);
        right %= MOD;
        long long sum = left*right;
        sum %= MOD;
        ans += sum;
        ans %= MOD;
    }

    cout << ans << endl;
}

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

int main()
{

  int n, w;
  cin >> n >> w;

  vector<pair<ll ,ll>> v(n);
  for(int i=0;i <n; i++)
    cin >> v[i].first >> v[i].second;

  vector<vector<long long>> dp(n+1, vector<long long>(w+1, 0));

  for(int i=1; i<=n; i++)
  {
    for(int j=1; j<=w; j++)
    {
      if(v[i-1].first <= j)
      {
        dp[i][j] = max(dp[i][j], v[i-1].second + dp[i-1][j-v[i-1].first]);
      }
      if(i != n)
        dp[i+1][j] = max(dp[i+1][j] , dp[i][j]);
    }
  }  

  cout<<dp[n][w]; 
  return  0;

}


Measured memory_bytes: 80256
//#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define boost ios::sync_with_stdio(0); cin.tie(0)

#define fi first
#define se second

typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;

const int N = 700 + 5;
const int INF = 1e9 + 7;

/***************************************************************************/

int n;
int A[N];
int G[N][N];
int vis[N];

int dfs(int v, int c) {
	if(vis[v]) {
		if(vis[v] == c) return 0;
		cout<<"-1\n";
		exit(0);
	}
	vis[v] = c;
	int ans = 1;
	for(int i=1; i<=n; i++) {
		if(G[v][i] == 0) {
			ans -= dfs(i, 3-c);
		}
	}
	return ans;
}

int dp[N][N];

int fun(int p, int rem) {
	if(rem < 0) return -INF;
	if(p == 0) return 0;

	int &memo = dp[p][rem];
	if(memo != -1) return memo;

	return memo = max(fun(p-1, rem), A[p] + fun(p-1, rem-A[p]));
}

int main() {

	boost;
	int m; cin>>n>>m;
	for(int i=1; i<=n; i++) {
		G[i][i] = 1;
	}
	for(int i=1; i<=m; i++) {
		int a, b; cin>>a>>b;
		G[a][b] = G[b][a] = 1; 
	}

	int kc = 0;
	int sum = 0;

	for(int i=1; i<=n; i++) {
		if(vis[i]) continue;
		A[++kc] = abs(dfs(i, 1));
		sum += A[kc];
	}

	memset(dp, -1, sizeof dp);
	int diff = sum - 2 * fun(kc, sum / 2);

	int a = (n + diff) / 2, b = (n - diff) / 2;
	ll ans = (a * (a-1)) / 2 + (b * (b-1)) / 2;
	cout<<ans<<"\n";
	
	return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define INF (1e9)

int main() {
    ll N, ans = INF;
    cin >> N;
    vi X(N);
    for (int i = 0; i < N; i++) {
        cin >> X[i];
    }
    for (int P = 1; P <= 100; P++) {
        ll S = 0;
        for (int i = 0; i < N; i++) {
            S += (X[i] - P) * (X[i] - P);
        }
        ans = min(ans, S);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

struct Edge{
    ll to;
    ll cost;
    Edge(ll t, ll c) : to(t), cost(c) { }
};

vector<Edge> g[100010];
ll dist[100010];
bool seen[100010];

bool flag = true;

void dfs(ll v){
    if (seen[v]) return;
    ll d = dist[v];
    seen[v] = true;
    for (auto e : g[v]){
        ll nv = e.to;
        ll nd = e.cost;
        if (seen[nv]){
            if (d + nd != dist[nv]) flag = false;
            continue;
        }
        dist[nv] = d + nd;
        dfs(nv);
    }
}

int main(){
    ll n, m;
    cin >> n >> m;

    rep(i, m){
        ll l, r, d;
        cin >> l >> r >> d;
        l--, r--;
        g[l].push_back({r, d});
        g[r].push_back({l, -d});
    }

    rep(i, n) dfs(i);

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

    return 0;
}


Measured memory_bytes: 15616
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int X = scan.nextInt();
    int Y = scan.nextInt();
    int Z = scan.nextInt();
    
    System.out.println(Z + " " + X + " " + Y);
  }
  
}

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

int main() {
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (1 <= i && i <= 9) cnt++;
    if (100 <= i && i <= 999) cnt++;
    if (10000 <= i && i <= 99999) cnt++;
  }
  cout << cnt << endl;
}


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

int main()
{
    int N, Y;

    scanf("%d %d", &N, &Y);

    if (Y < 1000*N || Y > 10000*N){
        printf("-1 -1 -1\n");
        return 0;
    }
    else{
        for (int i=0; i<N+1; i++){
            for (int j=0; j<N+1; j++){
                if (10000*i + 5000*j + 1000*(N-i-j) == Y && N-i-j >= 0){
                    printf("%d %d %d\n", i, j, N-i-j);
                    return 0;
                }
            }
        }
    }

    printf("-1 -1 -1\n");

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long n = scanner.nextLong();
        long i = (long) Math.ceil(Math.sqrt(n));
        long j = (long) Math.floor(Math.sqrt(n));
        boolean b = true;
        int answer=0;
        while (b){
            if (n%i==0){
                answer = Math.max(Long.toString(i).length(),Long.toString(n/i).length());
                b = false;
            }
            i++;
            if (n%j==0){
                answer = Math.max(Long.toString(j).length(),Long.toString(n/j).length());
                b = false;
            }
            j--;
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 21972
require 'matrix'

class Matrix
  # v2.3 では代入不可
  def []=(i, j, x)
    @rows[i][j]=x
  end
end

n, m = gets.split.map(&:to_i)
a = Matrix.zero(n)
b = Matrix.zero(m)
n.times do |i|
  s = gets.chomp.chars
  n.times do |j|
    if s[j] == '#'
      a[i, j] = 1
    end
  end
end
m.times do |i|
  s = gets.chomp.chars
  m.times do |j|
    if s[j] == '#'
      b[i, j] = 1
    end
  end
end
(n - m + 1).times do |i|
  (n - m + 1).times do |j|
    if a.minor(i, m, j, m) == b
      puts "Yes"
      exit
    end
  end
end
puts "No"

Measured memory_bytes: 4604
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#include <bitset>

#define pv(val) cerr << #val << '=' << (val) << endl
#define pvn(name, val) cerr << name << '=' << (val) << endl
#define pl cerr << '@' << __LINE__ << endl

using namespace std;

using ll = int64_t;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()

template <class T>
ostream &operator<<(ostream &os, vector<T> const &vec) {
    if (vec.empty()) {
        os << "{}";
    } else {
        os << '{';
        for (size_t i = 0; i < vec.size() - 1; i++) os << vec[i] << ", ";
        os << vec.back() << '}';
    }
    return os;
}

template <class T, size_t S>
ostream &operator<<(ostream &os, array<T, S> const &arr) {
    if (arr.empty()) {
        os << "{}";
    } else {
        os << '{';
        for (size_t i = 0; i < arr.size() - 1; i++) os << arr[i] << ", ";
        os << arr.back() << '}';
    }
    return os;
}

template <class T, class U>
ostream &operator<<(ostream &os, pair<T, U> const &p) {
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

namespace math {
ll gcd(ll u, ll v) {
    while (v != 0) {
        ll r = u % v;
        u = v;
        v = r;
    }
    return u;
}
ll lcm(ll m, ll n) {
    if ((0 == m) || (0 == n)) return 0;

    return ((m / math::gcd(m, n)) * n);
}
}  // namespace math

struct UnionFind {
    vector<ll> data;
    UnionFind(ll size) : data(size, -1) {}
    bool unionSet(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool findSet(ll x, ll y) { return root(x) == root(y); }
    ll root(ll x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    ll size(ll x) { return -data[root(x)]; }
};

template <class T, class U>
pair<T, U> operator+(pair<T, U> const &a, pair<T, U> const &b) {
    return pair<T, U>(a.first + b.first, a.second + b.second);
}

template <class T, class U>
pair<T, U> operator-(pair<T, U> const &a, pair<T, U> const &b) {
    return pair<T, U>(a.first - b.first, a.second - b.second);
}

ll bound(function<bool(ll)> f, ll ng, ll ok) {
    while (abs(ng - ok) > 1) {
        ll mid = (ng + ok) / 2;
        if (f(mid))
            ok = mid;
        else
            ng = mid;
    }

    return ok;
}

ll f(ll n){
    ll const zero = 0, one = 1;
    if(n % 2 == 0){
        ll n2 = n / 2;
        if(n2 % 2 == 0)
            return n;
        else
            return (n ^ one);
    }else{
        ll n2 = (n - 1) / 2;
        if(n2 % 2 == 0)
            return one;
        else
            return zero;
    }
}

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

    ll ans = f(A - 1) ^ f(B);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n,m = inpm()
way = [[] for _ in range(n+1)]
for i in range(m):
    a,b = inpm()
    way[a].append(b)
    way[b].append(a)

ans = [0 for i in range(n+1)]
q = queue.Queue()
q.put((1,0))
while not q.empty():
    room,sign = q.get()
    if ans[room] != 0:
        continue
    ans[room] = sign

    for i in way[room]:
        q.put((i,room))

print('Yes')
for i in range(2,n+1):
    print(ans[i])

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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (n - 1); i > (a - 1); --i)
#define arep(i, x) for (auto && (i) : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define Unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) (((n) * ((n) + 1)) / 2)
#define updiv(a, b) ((a + b - 1) / b)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, 1, 1, -1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main(void) {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  string s;
  cin >> s;
  if (s == "RRR")
    cout << 3 << '\n';
  else if (s == "RRS" || s == "SRR")
    cout << 2 << '\n';
  else if (s[0] == 'R' || s[1] == 'R' || s[2] == 'R')
    cout << 1 << '\n';
  else
    cout << 0 << '\n';
  return 0;
}

Measured memory_bytes: 3560
#include <stdio.h>

int main(void)
{

	long a[3];
	int ii, jj;
	int tmp;

	scanf("%ld %ld %ld", &a[0], &a[1], &a[2]);

	for (ii = 0; ii < 3 - 1; ii++) {
		for (jj = ii + 1; jj < 3; jj++) {
			if (a[ii] > a[jj]) {
				tmp = a[ii];
				a[ii] = a[jj];
				a[jj] = tmp;
			}
		}
	}

	printf("%ld %ld %ld\n", a[0], a[1], a[2]);

	return 0;
}

Measured memory_bytes: 596
#include<stdio.h>
int main(void){
  int k,n,i,max=0,c;
  int a[200001];
  scanf("%d%d",&k,&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    c=a[(i+1)%n]-a[i];
    if(c<=0){
      c+=k;
    }
  //  printf("c=%d\n",c);
    if(max<c){
      max=c;
    //  printf("max=%d\n",c);
    }
  }
  printf("%d\n",k-max);
  return 0;
}


Measured memory_bytes: 896
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner();
		int[] num = sc.nextIntArray(3);
		int max = 0;
		for(int i = 1; i < 3; i++) 
			if(num[max] < num[i])
				max = i;
		
		int result = 1;
		for(int i = 0; i < 3; i++) {
			if(i == max)
				continue;
			result *=num[i];
		}
		
		System.out.println(result /2);
	}
}

class Scanner {
	private static final int SPACE = (int)' ';
	private static final int LINE_END_0 = 13;
	private static final int LINE_END_1 = 10;
	private static final int BEFORE = -1;
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public String next(){
		StringBuilder sb = new StringBuilder();
		
		int length = BEFORE;
		readLoop: while(true) {
			try {
				int value = br.read();
				switch(value) {
				case LINE_END_1:
					if(length == BEFORE)
						break;
					
					if((int)sb.charAt(length) == LINE_END_0)
						sb.deleteCharAt(length);
				case SPACE:
					break readLoop;
				}
				sb.append((char)value);
				length++;

			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();
	}
	
	public String[] nextArray(int length) {
		String[] array = new String[length];
		for(int i = 0; i < length; i++)
			array[i] = next();
		return array;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public double[] nextDoubleArray(int length) {
		double[] array = new double[length];
		for(int i = 0; i < length; i++)
			array[i] = nextDouble();
		return array;
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public int[] nextIntArray(int length) {
		int[] array = new int[length];
		for(int i = 0; i < length; i++)
			array[i] = nextInt();
		return array;
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public long[] nextLongArray(int length) {
		long[] array = new long[length];
		for(int i = 0; i < length; i++)
			array[i] = nextLong();
		return array;
	}
	
	public boolean ready() {
		try {
			return br.ready();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
}


Measured memory_bytes: 22868
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

a, b = MAP()

print(a*b)


Measured memory_bytes: 9248
from math import cos, radians, sqrt

a, b, h, m = map(int,input().split())

# 分針の角度
x = m * 6

# 時針の角度
y = (h * 30) + (m * (1 / 2))

# 角度差
z = abs(x - y)

# 針の先端の距離
ans = sqrt((a*a)+(b*b)-(2*a*b*cos(radians(z))))

print('{0:.20f}'.format(ans))


Measured memory_bytes: 9508
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

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

template <typename T>
struct edge {int to; T cap; int rev;};

template <typename T>
struct Graph_ {
  int n;
  vector<bool> used;
  vector<vector<edge<T>> > vec;
  Graph_(int ns) {
    n = ns;
    used.resize(n);
    vec.resize(n);
  }
  void adde(int at, int to, T cap){
    vec[at].pb((edge<T>){to, cap, (int)vec[to].size()});
    vec[to].pb((edge<T>){at, 0, (int)vec[at].size() - 1});
  }
  T dfs(int s, int t, T f){
    if(s == t)return f;
    used[s] = true;
    for(int i = 0; i < vec[s].size(); i++){
      edge<T> &e = vec[s][i];
      if(!used[e.to] && e.cap > 0){
        int d = dfs(e.to, t, min(f, e.cap));
        if(d > 0){
          e.cap -= d;
          vec[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  T min_cut(int s, int t){
    return max_flow(s, t);
  }
  T max_flow(int s, int t){
    T inf = numeric_limits<T>::max();
    T flow = 0;

    while(true){
      fill(used.begin(), used.end(), false);
      int f = dfs(s, t, inf);
      if(f == 0)return flow;
      flow += f;
    }
  }
};

typedef Graph_<int> GraphI;
typedef Graph_<ll> GraphL;
vector<int> e[100001];

int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  GraphI graph(n);
  rep(i, m){
    int a, b;
    cin >> a >> b, a--, b--;
    graph.adde(a, b, 1);
    graph.adde(b, a, 1);
    e[a].pb(b);
    e[b].pb(a);
  }
  for(int i = 0; i < n; i++){
    if(sz(e[i]) % 2 == 1){
      cout << "No" << endl;
      return 0;
    }
  }
  int s = 0;
  int f = 0;
  vector<int> vec;
  for(int i = 0; i < n; i++){
    if(sz(e[i]) > 5)s++;
    if(sz(e[i]) == 4){
      f++;
      vec.pb(i);
    }
  }
  if(s > 0 || f > 2){
    cout << "Yes" << endl;
    return 0;
  }
  if(f != 2){
    cout << "No" << endl;
    return 0;
  }
  int tmp = graph.min_cut(vec[0], vec[1]);
  if(tmp == 2)cout << "Yes" << endl;
  else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 16000
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, X):
    D = defaultdict(list)
    for x in X:
        D[x%M].append(x)
    ans = 0
    for i in range(1, M//2+1):
        j = M - i
        if i == j:
            continue
        if len(D[i]) == len(D[j]):
            ans += len(D[i])
        else:
            l = D[i]
            s = D[j]
            if len(l) < len(s):
                l, s = s, l
            C = list(Counter(l).values())
            h = []
            for c in C:
                if c % 2 == 1:
                    h.append(1)
                    c -= 1
                if c != 0:
                    h.append(c)
            heapq.heapify(h)
            s = len(s)
            while h and s > 0:
                c = heapq.heappop(h)
                if c == 1:
                    ans +=1
                    s -= 1
                else:
                    if s >= c:
                        ans += c
                        s -= c
                    else:
                        ans += s
                        heapq.heappush(h, c-s)
                        s = 0
            while h:
                c = heapq.heappop(h)
                ans += c // 2
    ans += len(D[0]) // 2
    if M % 2 == 0:
        ans += len(D[M//2]) // 2
    return ans


def main():
    N, M = read_int_n()
    X = read_int_n()
    print(slv(N, M, X))


if __name__ == '__main__':
    main()


Measured memory_bytes: 29180
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

ll calc(ll a){
    ll cnt = (a+1)/2;
    ll ans = cnt % 2;
    if(a % 2 == 0) ans ^= a;
    return ans;
}

int main(){
    ll a, b; cin >> a >> b;
    ll ans = calc(b)^calc(a-1);
    cout << ans << endl;
}

Measured memory_bytes: 3648
//https://cs.stackexchange.com/questions/84426/find-a-node-with-maximum-distance-from-given-node-in-a-tree
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
//#include <ext/rope> //header with rope
//using namespace __gnu_cxx;
//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
// find_by_order tells index pr kon hai..
// order_by_key  tells ki us element se kitne strictly smaller element hai...
#define mod 1000000007
#define fr first
#define se second
#define ll long long
#define PI 3.1415926535 
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Senky_Bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{   
    Senky_Bansal
    IIIT_ALLAHABAD
    
    ll a,b,c;
  cin>>a>>b>>c;
  cout<<(c/a)*b;
    




}








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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int A, B, C, D; scanf("%d %d %d %d", &A, &B, &C, &D);
  int ans = max(0, min(B, D) - max(A, C));
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n, a, b;

int calc_digits_sum(int k)
{
    int sum = 0;
    int divided = k;

    while (divided > 0) {
        sum += divided % 10;
        divided /= 10;
    }

    return sum;
}

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

    int sum = 0;
    for (int i = 1; i <= n; i++) {
        int digits_sum = calc_digits_sum(i);
        if (a <= digits_sum && digits_sum <= b) {
            sum += i;
        }
    }

    cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define IT iterator 
#define vi vector<int>
#define TP template<class o>
#define SZ(a) ((int)a.size())
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int N=2e5+10,size=1<<20,mod=998244353,inf=2e9;

//char buf[size],*p1=buf,*p2=buf;
template<class o> void qr(o &x) {
    char c=gc; x=0; int f=1;
    while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
    while(isdigit(c)) x=x*10+c-'0',c=gc;
    x*=f;
}
template<class o> void qw(o x) {
    if(x/10) qw(x/10);
    putchar(x%10+'0');
}
template<class o> void pr1(o x) {
    if(x<0)x=-x,putchar('-');
    qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
    if(x<0)x=-x,putchar('-');
    qw(x); putchar('\n');
}

char s[N];

int main() {
    scanf("%s",s+1); int n=3,ans=0;
    for(int i=1,d=0;i<=n;i++)
        if(s[i]=='R') ans=max(ans,++d);
        else d=0;
    pr2(ans); return 0;
}

Measured memory_bytes: 3652
s=input()
if s[0]==s[1] and s[2]==s[3] and s[0]!=s[3]:
    print("Yes")
elif s[0]==s[2] and s[1]==s[3] and s[0]!=s[1]:
    print("Yes")
elif s[0]==s[3] and s[1]==s[2] and s[0]!=s[1]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int mxn = 1e5 +5;

const int modi = 1e9+7;

void add_mod(int& a, int b){
	a+=b;
	if(a>=modi)
		a-=modi;
}


void sub_mod(int &a, int b){
	a-=b;
	if(a<0)
		a+=modi;
}

int main(){
	int n,k;
	cin >> n >> k;
	int a[n];
	for(int i =0;i<n;i++)
		cin >> a[i];
	int dp[k+1];
	memset(dp,0,sizeof(dp));
	dp[0] = 1;
	for(int i =0;i<n;i++){
		vector<int> toincrease(k+1,0);
		for(int given = k;given>=0;given--){
			int start = given+1;
			int end = given+min(a[i],k-given);
			if(start<=end){
				add_mod(toincrease[start],dp[given]);
				if(end<k)
					sub_mod(toincrease[end+1],dp[given]);
			}	
			// for(int to_give = 1;to_give<= min(a[i],k-given);to_give++){
			// 	add_mod(dp[given+to_give],dp[given]);
			// }
		}
		int to_add = 0;
		for(int i =1;i<=k;i++){
			add_mod(to_add,toincrease[i]);
			add_mod(dp[i],to_add);
		}	

	}
	// for(int i =0;i<=k;i++)
	// 	cerr<< dp[i] << " ";
	cout << dp[k] << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int S,h,m,s;
	scanf("%d",&S);
	
	s=S;
	h=s/3600;
	s-=h*3600;

	m=s/60;
	s-=m*60;
	
	printf("%d:%d:%d\n",h,m,s);
	
	return 0;
}


Measured memory_bytes: 2064
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;

int n, m;
string s;


int main() {
	cin >> n;
	cout << (n - 2) * 180 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 1; i <= N; i++)
#define vec vector<int>
using namespace std;
int main()
{
    int N, max = 0, ans;
    cin >> N;
    if (N == 1)
    {
        cout << 1 << endl;
        return 0;
    }
    rep(i, N)
    {
        int k = i, count = 0;
        while (1)
        {

            if (k % 2 == 0)
            {
                k /= 2;
                count++;
            }
            else
            {
                break;
            }
        }
        if (max < count)
        {
            max = count;
            ans = i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
// -*- mode: cpp; coding=utf-8-unix; -*-
// vim: filetype=cpp fileencoding=utf-8 fileformat=unix
#include <iostream>
#include <iomanip>
#include <math.h>
#include <map>
#include <list>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <sstream>
#include <string.h>
// #include <limits.h>

#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define INTMAX  99999999

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;

#define MAXN (1000*100)
int N;
int A[MAXN];
ll dp[MAXN][2];

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	cin >> N;
	for(int n=0; n<N; n++) {
		cin >> A[n];
	}
	// if (A[0]>=0) {
		dp[0][0] = A[0];
		dp[0][1] = -A[0];
	// }
	// else {
	// 	dp[0][0] = -A[0];
	// 	dp[0][1] = A[0];
	// }
	for(int n=0; n<N-1; n++) {
		dp[n+1][0] = max(
				dp[n][0]+A[n+1], // ひとつ前はひっくり返してなくて、自分もひっくり返してない。(A[n])
				dp[n][1]-A[n+1]);  // ひとつ前がひっくり返されて、自分はひっくり返してない
		dp[n+1][1] = max(
				dp[n][0]-A[n+1], // ひとつ前はひっくり返してなくて、自分はひっくり返した
				dp[n][1]+A[n+1]
				);
		// cout << "dp["<<n+1<<"][0]="<<dp[n+1][0]<<endl;
		// cout << "dp["<<n+1<<"][1]="<<dp[n+1][1]<<endl;
	}


	cout << max(dp[N-2][0]+A[N-1],dp[N-2][1]-A[N-1]) << endl;


	return 0;
}



Measured memory_bytes: 2176
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int N,K,p[1005];
    int sum = 0;
    scanf("%d%d",&N,&K);
    
    for(int i=0;i <= N-1;i++){
        scanf("%d",&p[i]);
    }
    
    sort(p,p+N);
    
    for(int i=0;i <=K-1;i++){
        sum+=p[i];
    }
    
    printf("%d",sum);
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    int num;
    cin>>num;
    num += 1000;
    num = num%1000;
    if(num!=0)
        cout<<1000-num<<endl;
    else
    {
        cout<<"0"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 3624
def LI(): return list(map(int,input().split()))
N,x = LI()
a = LI()
ans = 0
for i in range(N-1):
    if a[i]+a[i+1]>x:
        if a[i]>x:
            ans += a[i+1]
            a[i+1] = 0
            ans += a[i]-x
        else:
            ans += a[i+1]-(x-a[i])
            a[i+1] = x-a[i]
print(ans)


Measured memory_bytes: 14252
#include <iostream>

using namespace std;

int main()
{
string s;cin>>s;
if(s[0]!='A'||s[1]=='C'||s[s.length()-1]=='C')
{
    cout<<"WA";
    return 0;
}
int Cs=0;
for(int i=1;i<s.length();i++)
{
if(s[i]=='C')
{
    Cs++;
}
else{
    if(s[i]>='A'&&s[i]<='Z')
{
    cout<<"WA";
    return 0;
}
}
if(Cs>1)
{
    cout<<"WA";
    return 0;
}

}
if(Cs==0)
{
    cout<<"WA";
    return 0;
}
 cout<<"AC";
    return 0;
}


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

int main() {
	string a, b;
	int aa;
	cin >>aa>> a >> b;
	string c;
	for (int n = 0; n < aa; n++) {
		c += a[n];
		c+= b[n];
	}
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 256
use std::cmp::max;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s:u32 = read();
    let h = s/3600;
    let m = (s-h*3600)/60;
    let sc = s-h*3600-m*60;
    println!("{}:{}:{}",h,m,sc);
}


Measured memory_bytes: 5024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(c-a)<=d||(abs(b-a)<=d&&abs(c-b)<=d))cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	int n; 
	while (cin >> n)
	{
		if (n % 2 != 0)cout << (n / 2) + 1 << '\n';
		else cout << (n / 2) << '\n';
	}
}

Measured memory_bytes: 256
(* O(n) *)
let list_to_array n a xs =
  let res = Array.make n a in
  List.iteri (fun i x -> res.(i) <- x) xs;
  res

(* O(n * log(n)) (n = |xs|) *)
let unique_info n xs =
  if n <= 0 then
    [], 0
  else
    let sorted_xs = list_to_array n 0 xs in
    Array.sort compare sorted_xs;
    let last = sorted_xs.(n - 1) in
    let sofar, count, _ = Array.fold_right
      (fun x (sofar, count, prev) ->
        if x <> prev then
          x :: sofar, count + 1, x
        else
          sofar, count, x)
      sorted_xs
      ([last], 1, last)
    in
      sofar, count

(* O(n * log(n)) (n = |xs|) *)
let unique_count n xs = snd (unique_info n xs)

(* O(n * log(n)) *)
let solve n ds = unique_count n ds

let fold_int f a n =
  let rec fold f a i n =
    if i >= n then
      a
    else
      fold f (f a i) (i + 1) n
  in
    fold f a 0 n

let read_ints n =
  fold_int
    (fun sofar _ -> read_int () :: sofar)
    []
    n |> List.rev

let _ =
  let n = read_int () in
  let ds = read_ints n in
  solve n ds |> string_of_int |> print_endline

Measured memory_bytes: 384