akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
	#define dbg(x) //cout << #x << " : " << x << endl;
#else 
	#define dbg(x)
#endif

#define int long long
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


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


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int n, a, b;
    cin >> n >> a >> b;
    int t = n / (a + b);
    int rest = n % (a + b);
    int res = t * a + min(a, rest);
    cout << res << '\n';
}


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

int main (void)
{
  int N,temp;
  cin>>N;
  vector<int> arr(N+1);
  for(int i=0;i<N;i++)
  {
    cin>>temp;
    arr[temp] = i+1;
  }
  for(int i=1;i<=N;i++)
    cout<<arr[i]<<" ";
  return 0;
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vpiipi vector<piipi>
#define pb push_back
#define pob pop_back
#define pii pair<int,int>
#define pipii pair<int,pii>
#define piipi pair<pii,int>
#define pld pair<long double,long double>
// #define mod 1000000007
// #define mod 163577857 
#define mod 998244353
#define rep(i,n) for (int i = 0; i < n; i++)
#define repp(i,a,b) for(int i = a ; i<b ; i++)
#define reppr(i,a,b) for(int i = a-1 ; i>=b ; i--)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " <<
#define setprec(x) cout << fixed << setprecision(x);
#define REVERSE(a) reverse(all(a));
#define SORT(a) sort(all(a));
#define all(n) n.begin(),n.end()
 
//GCD and LCM
    int gcd (int a, int b) { return b ? gcd (b, a % b) : a; }
    int lcm (int a, int b) { return a / gcd(a, b) * b; }
 
//Modular Exponentiation
    int powmod(int x,int y) 
    { 
        if (y == 0) return 1; 
        int p = powmod(x, y/2) % mod; 
        p = (p * p) % mod;   
        return (y%2 == 0)? p : (x * p) % mod; 
    }
 
//Modular Inverse
    int inverse(int a) 
    { 
       return powmod(a,mod-2); 
    }

//Binomial Coefficients
    int fact[500010], factinv[500010] , coefficientflag = 0;
    void Util_nCr()
    {
        fact[0] = 1 , factinv[0] = 1;
        repp(i,1,500010)
        {
            fact[i] = (fact[i-1] * i)%mod;
            factinv[i] = (factinv[i-1] * inverse(i))%mod;
        }
    }
    int nCr(int n , int r)
    {
        if(!coefficientflag) coefficientflag = 1 , Util_nCr();             
        return ((fact[n] * inverse(fact[n-r]) % mod * inverse(fact[r]))%mod) ;
    }

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

void solve()            
{
    int n;
    cin >> n;
    vpii v(n);
    rep(i,n)
        cin >> v[i].ff >> v[i].ss;
    SORT(v);
    int medmin , medmax;
    if(n%2==1)
    {
        medmin = v[n/2].ff;
        rep(i,n)
            swap(v[i].ff , v[i].ss);
        SORT(v);
        // REVERSE(v);
        medmax = v[n/2].ff;
        cout << medmax - medmin + 1;
    }
    else
    {
        medmin = v[n/2-1].ff + v[n/2].ff;
        rep(i,n)
            swap(v[i].ff , v[i].ss);
        SORT(v);
        // REVERSE(v);
        medmax = v[n/2-1].ff + v[n/2].ff;
        cout << (medmax - medmin + 1);
    }    
}

Measured memory_bytes: 6372
import std.stdio, std.math, std.algorithm, std.array, std.string, std.conv, std.container, std.range;
pragma(inline, true) T[] Reads(T)() { return readln.split.to!(T[]); }
alias reads = Reads!int;
pragma(inline, true) void scan(Args...)(ref Args args) {
    string[] ss = readln.split;
    foreach (i, ref arg ; args) arg = ss[i].parse!int;
}

void main() {
    int n; scan(n);
    writeln(n ^^ 3);
}


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

int selection(int *A,int N)
{
	int minj,temp,num=0;
	for (int i=0;i<N;i++)
	{
		minj=i;
		for (int j=i;j<N;j++)
		{
			if (A[j]<A[minj]) minj=j;
		}
		temp=A[minj];A[minj]=A[i];A[i]=temp;
		if(i!=minj) num++;
	}
	return num;
}

int main (void)
{
	int N;
	cin>>N;
	int *A=new int [N];
	for (int i=0;i<N;i++)
	    cin>>A[i];
	int j=selection(A,N);
	for (int i=0;i<N;i++)
	{
	    if (i) cout<<" ";
	cout<<A[i];}
	cout<<endl;
	cout<<j<<endl;
	delete[]A;
	return 0;
}


Measured memory_bytes: 3096
#include<stdio.h>
int main()
{
    int n,i,j;
    scanf("%d",&n);
    for(i=n;  ;i++)
    {
        int f=0;
        for(j=2;j<=sqrt(i);j++)
        {
            if(i%j==0)
                f=1;
        }
        if(f==0) 
            break;
    }
    printf("%d",i);
    return 0;
}


Measured memory_bytes: 2136
/*
    Author: zxy_hhhh
    date: 2020/03/12
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<iostream>
#define ll long long
inline ll rd() {
    ll _x=0;int _ch=getchar(),_f=1;
    for(;!isdigit(_ch)&&(_ch!='-')&&(_ch!=EOF);_ch=getchar());
    if (_ch=='-'){_f=0;_ch=getchar();}
    for(;isdigit(_ch);_ch=getchar()) _x=_x*10+_ch-'0';
    return _f?_x:-_x;
}
void write(ll _x){if (_x>=10) write(_x/10),putchar(_x%10+'0'); else putchar(_x+'0'); }
inline void wrt(ll _x,char _p){if (_x<0) putchar('-'),_x=-_x; write(_x); if (_p) putchar(_p);}
#define maxn 2005
#define mod 1000000007
int n,K;
int f[maxn][maxn];
int fac[maxn*maxn],inv[maxn*maxn];
inline int C(int n,int m) {return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;}
int main() {
    n=rd();K=rd();
    if (K==1) {
        wrt(1,'\n');
        return 0;
    }
    fac[0]=fac[1]=inv[0]=inv[1]=1;
    for(int i=2;i<=n*K;i++) {
        fac[i]=1ll*fac[i-1]*i%mod;
        inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
    }
    for(int i=1;i<=n*K;i++) {
        inv[i]=1ll*inv[i-1]*inv[i]%mod;
    }
    f[0][0]=1;
    for(int i=1;i<=n;i++) {
        for(int j=0;j<=i;j++) {
            f[i][j]=(f[i-1][j]+(j>0?1ll*f[i][j-1]*C(n*K-i-(j-1)*(K-1)-1,K-2)%mod*(n-j+1):0))%mod;
        }
    }
    wrt(f[n][n],'\n');
}

Measured memory_bytes: 47360
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  if(S[6]=='5'||S[6]=='6'||S[6]=='7'||S[6]=='8'||S[6]=='9'||S[5]=='1'){
    cout<<"TBD"<<endl;
  }else cout<<"Heisei"<<endl;
}

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

typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int sum = a[n - 1] - a[0];
    for (int i = 1; i < n - 1; i++) {
        sum += abs(a[i]);
    }
    cout << sum << endl;
    int idx = lower_bound(a.begin(), a.end(), 0) - a.begin();
    int front = a[0];
    int back = a[n - 1];
    for (int i = 1; i < n - 1; i++) {
        if (i < idx) {
            cout << back << " " << a[i] << endl;
            back -= a[i];
        } else {
            cout << front << " " << a[i] << endl;
            front -= a[i];
        }
    }
    cout << back << " " << front << endl;
    return 0;
}


Measured memory_bytes: 2304
#include <stdio.h>

int main () {
int i,j;
char n[100000] = {0};
int  x[1001] = {0};

i = 0;
j = 0;


while(1) {
scanf("%c",&n[i]);
if(n[i] == '0' && n[i-1] == '\n'|| n[0] == '0') {break;}

if(n[i] >= '1' && '9' >= n[i] && n[i] != '\n') {
x[j] += n[i]-48;
}
  if(n[i] == '\n') {
j = j + 1;
}

i= i+1;

}

for(i=0; i < j;i++) {
printf("%d",x[i]);
printf("\n"); 

} 

return 0;

}



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

const int MAX_N = 200006;
int N;
int a[MAX_N];

void solve()
{
	int need = 1;
	int res = 0;
	for(int i=1;i<=N;++i){
		if(a[i] == need){
			need++;
		}else{
			res++;
		}
	}
	if(res == N) res = -1;
	cout << res << '\n';
}

int main()
{
	cin >> N;
	for(int i=1;i<=N;++i) cin >> a[i];
	solve();
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 2019;
const ll INF = (1ll << 60);

ll power(ll x, ll y)
{
    ll ans = 1;
    while (y)
    {
        if (y & 1)
            ans = (ans * x) % MOD;
        x = (x * x) % MOD;
        y >>= 1;
    }
    return ans;
}

int main(void)
{
    string s;
    cin >> s;

    vector<ll> m(s.size() + 1);
    map<ll, ll> sum;
    ll ans = 0;
    m[s.size()] = 0;

    for (int i = s.size() - 1; i >= 0; i--)
    {
        m[i] = m[i + 1] + (s[i] - '0') * power(10, s.size() - i - 1);
        m[i] %= 2019;
    }

    for (int i = 0; i <= s.size(); i++)
    {
        sum[m[i]]++;
    }

    for (auto x : sum)
    {
        ans += x.second * (x.second - 1) / 2;
    }

    cout << ans << endl;
}


Measured memory_bytes: 5140
/**
 *      purpose : ABC 120 A
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define fi first
#define se second

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

  int a, b, c; cin >> a >> b >> c;
  if (b / a >= c) print(c);
  else print(b / a);

  return 0;
}

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

int main(void)
{
	int a, b;
	cin >> a >> b;
	if (a < b)
	{
		cout << "a < b" << endl;
	}else
	if (a > b)
	{
		cout << "a > b" << endl;
	}
	else
	{
		cout << "a == b" << endl;
	}
	return 0;
}

Measured memory_bytes: 3096
n,y=map(int,input().split())
a=False
for i in range(n+1):
    for j in range(n-i+1):
        nog=1000*i
        hig=5000*j
        fuk=10000*(n-i-j)
        if nog+hig+fuk==y and i>-1 and j>-1 and n-i-j>-1:
            print(n-i-j,j,i)
            a=True
            break
    if a==True:
        break
if a==False:
    print('-1 -1 -1')
        

Measured memory_bytes: 3060
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n, k; 
vector<int> a;

bool check(int x) {
    int cnt = 0;
    rep(i, n) {
        if(a[i] <= x) continue;
        cnt += (a[i] - 1) / x;
    }
    return (cnt <= k);
}

void solve() {
	cin >> n >> k;
    a.resize(n);
    rep(i, n) {
        cin >> a[i];
    }
    int ok = inf, ng = 0;
    while(ok - ng > 1) {
        int mid = (ok + ng) / 2;
        if(check(mid)) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

ll N, T;
pair<ll, ll> AB[3010];
ll dp[3010][16010];
ll con = 3000;

ll rec_dp(ll i, ll j) {
    if (dp[i][j] != -1) {
        return dp[i][j];
    }
    ll res;
    if (i == N) {
        res = 0;
    } 
    else if (j - con < AB[i].first && j > con) {
        res = max(rec_dp(i+1, j), rec_dp(i+1, j-AB[i].first) + AB[i].second);
    }
    else if (j - con < AB[i].first) {
        res = rec_dp(i+1, j);
    } 
    else {
        res = max(rec_dp(i+1, j), rec_dp(i+1, j-AB[i].first) + AB[i].second);
    }
    return dp[i][j] = res;
}

int main() {
    cin >> N >> T;
    for (int i = 0; i < N; i++) {
        cin >> AB[i].first >> AB[i].second;
    }

    sort(AB, AB+N);

    memset(dp, -1, sizeof(dp));

    cout << rec_dp(0, T + con) << endl;

    return 0;
}


Measured memory_bytes: 376960
//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 <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define VI(v,n) vector<int> (v)((n))


int main() {
	int n;
	cin >> n;
	VI(v, n);
	REP(i, n) {
		cin >> v[i];
	}
	vector<pair<int, int> > pairs(n);
	REP(i, n) {
		pairs[i] = make_pair(i, v[i]-1);
		if (i > v[i]-1) {
			swap(pairs[i].first, pairs[i].second);
		}
	}
	SORT(pairs);
	int cnt = 0;
	FOR(i,1, n - 1) {
		if (pairs[i] == pairs[i - 1]) {
			cnt++;
		}
	}
	cout << cnt << endl;










	return 0;
}



Measured memory_bytes: 1408
//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 <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	char c; cin >> c;
	cout << char(c+1) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		System.out.println(a + b >= 10 ? "error" : a + b);

		sc.close();

	}

}

Measured memory_bytes: 35200
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>

using namespace std;
typedef long long ll;

int gcd(int x, int y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    int r = x % y;
    x = y;
    y = r;
  }
  return x;
}

/*迷路
const int INF = 50;

typedef pair<int,int> P;
char field[52][52];
int d[51][51];
int r,c;
int sx,sy;
int gx,gy;

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

int bfs(){
    queue<P> que;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            d[i+1][j+1] = INF;
        }
    }
    que.push(P(sy,sx));
    d[sy][sx]=0;
while(que.size()){
    P p=que.front();
    que.pop();
    if(p.second==gx&&p.first==gy) break;
    for(int i=0;i<4;i++){
        int nx=p.second+dx[i];
        int ny=p.first+dy[i];

        if(1<=nx&&nx<=c&&1<=ny&&ny<=r&&field[ny][nx]!='#'&&d[ny][nx]==INF){
            que.push(P(ny,nx));
            d[ny][nx] = d[p.first][p.second] + 1;
        }
    }
}
return d[gy][gx];
}
*/

int main(){
    int n,i;
    cin>>n>>i;
    cout<<n-i+1<<endl;
    return 0;
}

Measured memory_bytes: 256
K,A,B=map(int,input().split())
if K<=A or B<A+3 :
    ans=K+1
else:
    if (K-(A-1))%2==0 :
        ans=(B-A)*((K-(A-1))//2)+A
    else:
        ans = (B - A) * ((K - (A - 1)) // 2) + A + 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+100;
int n; ll f;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i){
        if(i%5&&i%3) f+=i;
    }
    printf("%lld\n",f);
}

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

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

	for (int i = 0; i < k; ++i)
	{
		if (a >= b)
			b *= 2;
		else if (b >= c)
			c *= 2;
	}
	if (a < b && b < c)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}



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

int  main()
{
	int s; cin >> s;
	if (s == 25)
		cout << "Christmas\n";
	else if (s == 24)
		cout << "Christmas Eve\n";
	else if (s == 23)
		cout << "Christmas Eve Eve\n";
	else if (s == 22)
		cout << "Christmas Eve Eve Eve\n";
	return (0);
}

Measured memory_bytes: 256
import java.io.*;
 
class Main{
    public static void main(String[] args) throws Exception{
        int x, ans;
     
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        x = Integer.parseInt(br.readLine());
         
        ans = x*x*x;
        System.out.println(ans);
    }
}

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

#define MAX_N 200000

int lst_a[MAX_N];
int is_reach[MAX_N];
int lst_place[MAX_N];

int main() {
  int N;
  ll K;
  cin >> N >> K;
  rep(i, N) cin >> lst_a[i];
  rep(i, N) lst_a[i] -= 1;
  rep(i, N) is_reach[i] = 0;

  int place, next_place = 0;
  ll num_warp = 0;
  ll tmp = 0;
  for (ll i = 0; i < K + 1; i++) {
    place = next_place;
    is_reach[place] = 1;
    lst_place[i] = place;
    next_place = lst_a[place];
    if (is_reach[next_place]) {
      rep(j, i + 1) {
        if (lst_place[j] == next_place) {
          tmp = j;
          break;
        }
      }
      break;
    }
    num_warp++;
  }
  cout << lst_place[(K - tmp) % (num_warp - tmp + 1) + tmp] + 1 << endl;

  return 0;
}


Measured memory_bytes: 5728
using System;

namespace ABC148
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var words = Console.ReadLine().Split(' ');
            var output = "";
            for (int i = 0; i < N; i++)
            {
                output += words[0][i];
                output += words[1][i];
            }
            Console.WriteLine(output);
            //Console.ReadLine();
        }
    }
}


Measured memory_bytes: 13140
void main()
{
    string x = readln.chomp;

    auto g = x.group.array;
    long slen;
    long len = x.length;
    foreach (t; g)
    {
        if (t[0] == 'S')
        {
            slen += t[1].to!long;
        }
        else
        {
            long lmin = min(slen, t[1].to!long);
            len -= 2 * lmin;
            slen -= lmin;
        }
    }

    len.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 1336
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main(void) {
    int i;
    char string[1200];
    fgets(string,sizeof(string),stdin);
    for (i=0; i<strlen(string); i++) {
        if (isalpha(string[i])) {
            if (islower(string[i])) {
                printf("%c",toupper(string[i]));
            } else {
                printf("%c",tolower(string[i]));
            }
        } else {
            printf("%c",string[i]);
        }
    }
    return 0;
}

Measured memory_bytes: 524
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
road = [[] for _ in range(n)]
for _ in range(m):
  a,b = map(lambda x:int(x)-1,input().split())
  road[a].append(b)
  road[b].append(a)
co = set([0])
cn = set([0])
nn = set()
ans = [-1]*n
ans[0] = 0
for _ in range(n):
  if len(cn) == 0:
    break
  for i in cn:
    for j in road[i]:
      if j not in co:
        if j not in cn:
          nn.add(j)
          ans[j] = i
    co.add(i)
  cn = set(nn)
  nn.clear()
if -1 in ans:
  print("No")
else:
  print("Yes")
  for i in ans[1:]:
    print(i+1)

Measured memory_bytes: 42048
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
const int MOD=1e9+7;
 
int main() {
    vector<int> a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << a[k-1] << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int h = scanner.nextInt();
        final int w = scanner.nextInt();

        final int[][] table = new int[10][10];
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                table[i][j] = scanner.nextInt();
            }
        }

        final int[] magicPowers = new int[10];
        for (int i = 0; i < 10; i++) {
            if (i == 1) {
                continue;
            }

            final int min = table[i][1];
            magicPowers[i] = search(table, 0, i, min);
        }

        int answer = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                final int tmp = scanner.nextInt();
                if (tmp != -1) {
                    answer += magicPowers[tmp];
                }
            }
        }

        System.out.println(answer);
    }

    private static int search(final int[][] table, final int magicPower, final int index, final int min) {
        if (index == 1) {
            return magicPower + table[index][1];
        }
        if (magicPower > min) {
            return min;
        }

        int tmp = min;
        for (int i = 0; i < 10; i++) {
            if (i == index) {
                continue;
            }
            tmp = Math.min(tmp, search(table, magicPower + table[index][i], i, min));
        }

        return tmp;
    }
}


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


int main() {
    int a, b;
    cin >> a >> b;
    if (a == b) {
        cout << "Draw" << endl;
        return 0;
    }

    if (a == 1) {
        cout << "Alice" << endl;
        return 0;
    }
    if (b == 1) {
        cout << "Bob" << endl;
        return 0;
    }

    if (a > b) {
        cout << "Alice" << endl;
        return 0;
    }

    if (a < b) {
        cout << "Bob" << endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

ll N;
ll dfs(ll s){
  if(s>N)return 0;
  string str=to_string(s);
  ll three=0,five=0,seven=0;
  ll cnt=0;
  for(int i=0;i<str.size();i++){
    if(str.size()<3)break;
    if(str[i]-'0'==3)three++;
    else if(str[i]-'0'==5)five++;
    else if(str[i]-'0'==7)seven++;
  }
  if(three*five*seven>0)cnt=1;
  else cnt=0;
  ll num=atoi(str.c_str());
  cnt+=dfs(num*10+7);
  cnt+=dfs(num*10+5);
  cnt+=dfs(num*10+3);
  return cnt;
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  cout << dfs(0) << endl;
  return 0;
}


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






#define pf                  printf
#define sf(a)               scanf("%d",&a)
#define sfl(a)              scanf("%lld",&a)
#define sff(a,b)            scanf("%d %d",&a,&b)
#define sffl(a,b)           scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)         scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d)      scanf("%d %d %d %d",&a,&b,&c,&d)
#define sffffl(a,b,c,d)     scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define sfffff(a,b,c,d,e)   scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
#define sfffffl(a,b,c,d,e)  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e)
#define sfc(a)              scanf("%c",&a)
#define pii                 pair<int,int>
#define ms(a,b)             memset(a,b,sizeof(a))
#define pb(a)               push_back(a)
#define pbp(a,b)            push_back({a,b})
#define db                  double
#define ft                  float
#define ll                  long long
#define ull                 unsigned long long
#define pii                 pair<int,int>
#define ff                  first
#define ss                  second
#define sz(x)               x.size()
#define all(x)              x.begin(),x.end()
#define CIN                 ios_base::sync_with_stdio(0); cin.tie(0)
#define max3(a, b, c)       max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c)       min(a, b) < min(b, c) ? min(a, b) : min(b, c)
#define for0(i,n)           for(int i=0;i<n;i++)
#define for1(i,n)           for(int i=1;i<=n;i++)
#define forrev(i,n)         for(int i=n-1; i>=0; i--)
#define forab(i,a,b)        for(int i=a;i<=b;i++)
#define forba(i,b,a)        for(int i=b;i>=a;i--)
#define stlloop(x)          for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define case1(z)            cout<<"Case "<<z<<": "
#define case2(z)            printf("Case %d: ",z)
#define PI                  acos(-1) //3.14159265358979323846264338328
#define valid(tx,ty)        tx>=0 && tx<row && ty>=0 && ty<col
#define intlim              2147483648
#define N                   1005
#define inf                 100000008
#define mod                 1000000007

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


int main()
{
    ll i,k=0,j;
    string g;
    cin>>g;
    j=g.length()-1;
    for(i=0;i<=j;i++,j--)
    {
        if(g[i]!=g[j])
            k++;
    }
    cout<<k<<endl;
    //main();
    return 0;
}
































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

using namespace std;
int vis[9]={},x=0;
int n,m;
vector<vector<int> >v(9);
void dfs(int i)
{
    int q=0;
    for (int j=0;j<v[i].size();j++)
    {
        if(vis[v[i][j]]==0)
        {
            q=1;
            vis[v[i][j]]=1;
            dfs(v[i][j]);
            vis[v[i][j]]=0;
        }
    }
    if(q==0)
    {
        for (int j=1;j<=n;j++)
        {
            if(vis[j]==0)
                return;
        }
        x++;
    }
    return ;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m;
    for (int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    vis[1]=1;
    dfs(1);
    cout<<x<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
int main(){
  int N;
  scanf("%d", &N);
  printf("%d\n",(N+1)/2);
  return 0;
}


Measured memory_bytes: 888
def find(l, e, start, end):
	mid = (start+end)//2
	if (l[mid] == e):
		return (e, e)
	elif (l[mid] > e):
		if (l[mid-1] < e): 
			return (l[mid-1], l[mid])
		return find(l, e, start, mid)
	elif (l[mid] < e):
		if (l[mid+1] > e): 
			return (l[mid], l[mid+1])
		return find(l, e, mid, end)

def print_sum(input):
	d, n, m = input[0], input[1], input[2]
	S, K = input[3:3+n-1], input[3+n-1:]
	S = sorted(S)
	S = [S[-1]-d, 0] + S + [d]
	sum = 0
	for k in K:
		low, high = find(S, k, 0, len(S))
		sum += min(k-low, high-k)
	print sum

output = []
while (True):
	d = int(raw_input())
	if d == 0: break
	n, m = int(raw_input()), int(raw_input())
	input = [d, n, m]
	for i in range(n-1+m):
		next_int = int(raw_input())
		input.append(next_int)
	print_sum(input)

Measured memory_bytes: 15648
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
typedef long long ll;

struct params {
    ll x, y, z;
};

ll sumVector (vector<params> v, int m) {
    ll sumx = 0, sumy = 0, sumz = 0;
    int i;
    for (i = 0; i < m; i++) {
        sumx += v[i].x;
        sumy += v[i].y;
        sumz += v[i].z;
    }

    ll ans = abs(sumx) + abs(sumy) + abs(sumz);
    return ans;
}

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

    vector<params> v;
    ll x, y, z;
    for (int i = 0; i < n; i++) {
        scanf("%lld %lld %lld", &x, &y, &z);
        params tmp = {x, y, z};
        v.push_back(tmp);
    }

    ll ans = 0;
    sort(v.begin(), v.end(), [](const params& a, const params& b){ return a.x + a.y + a.z > b.x + b.y + b.z; });
    ans = max(ans, sumVector(v, m));
    sort(v.begin(), v.end(), [](const params& a, const params& b){ return a.x + a.y - a.z > b.x + b.y - b.z; });
    ans = max(ans, sumVector(v, m));
    sort(v.begin(), v.end(), [](const params& a, const params& b){ return a.x - a.y + a.z > b.x - b.y + b.z; });
    ans = max(ans, sumVector(v, m));
    sort(v.begin(), v.end(), [](const params& a, const params& b){ return a.x - a.y - a.z > b.x - b.y - b.z; });
    ans = max(ans, sumVector(v, m));
    sort(v.begin(), v.end(), [](const params& a, const params& b){ return - a.x + a.y + a.z > - b.x + b.y + b.z; });
    ans = max(ans, sumVector(v, m));
    sort(v.begin(), v.end(), [](const params& a, const params& b){ return - a.x + a.y - a.z > - b.x + b.y - b.z; });
    ans = max(ans, sumVector(v, m));
    sort(v.begin(), v.end(), [](const params& a, const params& b){ return - a.x - a.y + a.z > - b.x - b.y + b.z; });
    ans = max(ans, sumVector(v, m));
    sort(v.begin(), v.end(), [](const params& a, const params& b){ return - a.x - a.y - a.z > - b.x - b.y - b.z; });
    ans = max(ans, sumVector(v, m));

    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define maxn 4005
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define ff first
#define ss second

int n,m;
int op[maxn];
int f[maxn][maxn],w[maxn][maxn][2];
pii a[maxn];
char s[4];

inline int read(){
	int x=0,f=1; char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	n=read();
	for (int i=1;i<=(n<<1);i++){
		scanf("%s",s+1);
		if (s[1]=='B') a[i]=mp(read(),0);
		else a[i]=mp(read(),1);
	}
	for (int i=1;i<=(n<<1);i++){
		for (int j=i+1;j<=(n<<1);j++)
			++w[i][a[j].ff][a[j].ss];
		for (int j=1;j<=n;j++)
			w[i][j][0]+=w[i][j-1][0],w[i][j][1]+=w[i][j-1][1];
	}
	for (int i=1;i<=(n<<1);i++)
		for (int j=1;j<=(n<<1);j++)
			if (i==a[j].ff+a[j].ss*n){op[i]=j; break;}
	memset(f,63,sizeof(f));
	f[0][0]=0;
	for (int i=1;i<=(n<<1);i++)
		for (int j=0;j<=min(i,n);j++){
			int x=i-j; if (x>n) continue;
			if (x) f[i][j]=min(f[i][j],f[i-1][j]+w[op[x]][x][0]+w[op[x]][j][1]);
			if (j) f[i][j]=min(f[i][j],f[i-1][j-1]+w[op[j+n]][j][1]+w[op[j+n]][x][0]);
		}
	printf("%d\n",f[n<<1][n]);
	return 0;
}


Measured memory_bytes: 187520
// ARC089
// C - Traveling

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

const int MAX_N = 100000;

int N;
int t[MAX_N + 1], x[MAX_N + 1], y[MAX_N + 1];

bool solve() {
    for (int i = 1; i <= N; i++) {
        int mht = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
        int dt = t[i] - t[i - 1];
        if (!(mht <= dt && ((dt - mht) % 2 == 0))) {
            return false;
        }
    }

    return true;
}

int main() {
    cin >> N;
    t[0] = x[0] = y[0] = 0;
    for (int i = 1; i <= N; i++) {
        cin >> t[i] >> x[i] >> y[i];
    }

    cout << (solve() ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define MAX_V 25
#define INF 1<<21

int d[MAX_V][MAX_V];
int n, m;

void warshall_floyd(){
	for(int k = 0; k < n; k++){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}




int main(){
	for(int i = 0; i < MAX_V; i++){
		for(int j = 0; j < MAX_V; j++){
			d[i][j] = INF;
		}
	}


	cin >> n >> m;
	char c;
	for(int i = 0; i < m; i++){
		int a1, b1, c1, d1;
		cin >> a1 >> c >> b1 >> c >> c1 >> c >> d1;
		d[a1-1][b1-1] = c1;
		d[b1-1][a1-1]	= d1;	
	}
	int x1, x2, y1, y2;
	cin >> x1 >> c >> x2 >> c >> y1 >> c >> y2;
	
	warshall_floyd();
	cout << y1 - y2 - d[x1-1][x2-1] - d[x2-1][x1-1] << endl;
}

Measured memory_bytes: 1160
//Bismillahir-Rahmanir-Rahim
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int llu;
#define f1(i,n) for(i=1;i<=n;i++)
#define f(i,n) for(i=0;i<n;i++)
#define Max 100009
#define Mx 1e10
#define pb push_back
#define mp make_pair
using namespace std;
int main()
{
    	ll n,mn=0,mx=0,x,i,t=0,j=0,k,y;
    	set<ll>s;
    	cin>>n>>k>>x>>y;
    	if(n<=k)
            t=n*x;
        else
       t=k*x+(n-k)*y;
       cout<<t<<endl;

}







Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

ll solve(ll x){
    if(x%2==0){
        ll tmp;
        if((x/2)%2==0){
            tmp = 0;
            return x^tmp;
        } else {
            tmp = 1;
            return x^tmp;
        }
    } else {
        if(((x+1)/2)%2==0){
            return 0;
        }else {
            return 1;
        }
    }

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b; cin>>a>>b;
    a = solve(a-1); b = solve(b);
    ll ans = a^b;
    cout << ans << endl;
}

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

int n,m,s[9],c[9],d[9],ans;
bool ok[9];

int main()
{
	cin >> n >> m;
	for(int i = 1;i<=m;i++)
	{
		cin >> s[i] >> c[i];
		if(ok[s[i]] and c[i]!=d[s[i]])
		{
			cout << -1;
			return 0;
		}
		if(s[i]==1 and c[i]==0 and n!=1)
		{
			cout << -1;
			return 0;
		}
		d[s[i]] = c[i];
		ok[s[i]] = 1;
	}
	if(ok[1]==0 and n!=1)d[1] = 1;
	if(n==1)cout << d[1];
	if(n==2)cout << d[2]+d[1]*10;
	if(n==3)cout << d[3]+d[2]*10+d[1]*100;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();

			if (n == 0) {
				break;
			}

			int[] scores = new int[n];
			for (int i = 0; i < scores.length; i++) {
				scores[i] = sc.nextInt();

			}

			double average = 0, variance = 0, sum = 0;

			for (int i = 0; i < scores.length; i++) {
				sum += scores[i];

			}

			average = sum / n;

			sum = 0;

			for (int i = 0; i < scores.length; i++) {
				sum += (scores[i] - average) * (scores[i] - average);

			}

			variance = sum / n;

			System.out.println(Math.sqrt(variance));

		}

	}

}

Measured memory_bytes: 31068
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
typedef struct _data
{
    int money;
    int count;
}Data;
Data arr[100005];
int N, M;
long long result;

bool comp(Data &t, Data &u)
{
    return t.money < u.money;
}

int main()
{
    scanf("%d %d", &N, &M);
    for(int i = 0; i < N; i++)
    {
        scanf("%d %d", &arr[i].money, &arr[i].count);
    }
    sort(arr, arr + N, comp);
    for(int i = 0; i < N; i++)
    {
        result += (long long)arr[i].money * min(M, arr[i].count);
        M -= min(M, arr[i].count);
    }
    printf("%lld", result);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<P,int>
#define vpp vector<PP>
#define fi first
#define se second
#define INF (1<<30)
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int dx[]={-1,0,1,-1,0,1,-1,0,1},dy[]={-1,-1,-1,0,0,0,1,1,1};
signed main(){
    int h,w,n;
    cin>>h>>w>>n;
    map<P,int> ma;
    REP(i,n){
        int a,b;
        cin>>a>>b;
        REP(j,9){
            if(2<=a+dx[j]&&a+dx[j]<=h-1&&2<=b+dy[j]&&b+dy[j]<=w-1){
                ma[P(a+dx[j],b+dy[j])]++;
            }
        }
    }
    vi ans(10);
    int p=(h-2)*(w-2);
    for(auto itr:ma){
        cerr<<itr.fi.fi<<" "<<itr.fi.se<<":"<<itr.se<<endl;
        ans[itr.se]++;
    }
    FOR(i,1,10){
        p-=ans[i];
    }
    ans[0]=p;
    REP(i,10){
        cout<<ans[i]<<endl;
    }
    return 0;
}

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

string S;
int n,h;
int main(){
	while(cin >> S && S!="-"){
		cin >> n;
		for(int i=0;i<n;i++){
			cin >> h;
			string right = S.substr(0,h);
			string left = S.substr(h,S.size());
			S = left + right;
		}
		cout << S << endl;
	}
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    
    int n;
    cin >> n;
    vl a(n);
    vector<pll> xi(n);
    rep (i, n) {
        cin >> a[i];
        xi[i].first = a[i];
        xi[i].second = i;
    }
    sort(all(xi));
    reverse(all(xi));
    vll dp(n + 1, vl(n + 1, -INF));
    int l = 0, r = n;
    dp[l][r] = 0;
    rep (i, n) {
        ll x = xi[i].first;
        int j = xi[i].second;
        //DEBUG(pii(x, j));
        rep (l, n) {
            int r = l + n - i;
            if (r == n + 1) break;
            if (dp[l][r] == -INF) continue;
            //DEBUG(pii(l, r));
            chmax(dp[l + 1][r], dp[l][r] + x * abs(j - l));
            chmax(dp[l][r - 1], dp[l][r] + x * abs(j - (r - 1)));
        }
    }
    //DEBUG_MAT(dp);
    ll ans = -INF;
    rep (i, n + 1) {
        chmax(ans, dp[i][i]);
    }
    cout << ans << endl;
}

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

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

	for (int i = 1; i <= n; i++)
	{
		int x = i;
		if (x % 3 == 0 || x % 10 == 3) {
			cout << " " << i;
		}
		else
		{
			x /= 10;
			while (x)
			{
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
				else
					x /= 10;
			}
		}
	}
	cout << endl;
}


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

using namespace std;

int n,m;

template <typename T>
struct edge {
	int from, to;
	T cost;

	edge(int from, int to, T cost) :from(from), to(to), cost(cost) {}
};

template <typename T>
vector<T> bellman_ford(int s, int V, vector<edge<T> >& G) {
	const T INF = numeric_limits<T>::max();
	vector<T> cost(V, INF);
	cost[s] = 0;
	for (int i = 0; i < 2 * V; ++i) {
		for (edge<T> e : G) {
			if (cost[e.from] == INF) continue;
			if (cost[e.to] > cost[e.from] + e.cost) {
				cost[e.to] = cost[e.from] + e.cost;
				if (i >= V - 1 && e.to == n - 1) return vector<T>();
			}
		}
	}
	return cost;
}

int main() {
	cin >> n >> m;
	vector<edge<long long> > G;
	for(int i=0;i<m;++i) {
		int a,b,c; cin >> a >> b >> c;
		--a, --b;
		G.push_back({a,b,-c});
	}
	auto ans=bellman_ford(0,n,G);
	if(ans.empty()) cout << "inf" << endl;
	else cout << -ans[n-1] << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int h, n;
cin >> h >> n;
for (int i = 0; i < n && h > 0; ++i) {
	int ai;
	cin >> ai;
	h -= ai;
}
if (h <= 0) {
	cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}


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

int main() {
  int n, ans = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i <= n - 3; i++) {
    if (s.at(i) == 'A' && s.at(i + 1) == 'B' && s.at(i + 2) == 'C') ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var array = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var max = array.Max();
            Array.Sort(array);
            var center = N / 2 - 1;
            var count = 0;

            for (var i = 1; i <= max; i++)
            {
                if (array[center] < i && i <= array[center + 1])
                    count++;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 18144