akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<=e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
#define ANS cout<<ans<<'\n'
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
const ld pi = 3.14159265358979323846;
ll MOD = 1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) fo(i, n){fo(j, m)cout<<dp[i][j]<<" ";cout<<"\n";}
ll nxt(){ll x; cin >> x; return x;}
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}
void solve(){
    ll n;
    cin >> n;
    cout << 1 - n << nl;
}
int main(){ 
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll TC = 1;
    //cin>>TC;
    fo(TT, TC){
        // Google,FB cout << "Case #"<< TT + 1 << ": ";
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


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

int n;

int main()
{
    cin >> n;
    ll sum = 0;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            for(int k = 1; k <= n; k++)
            {
                sum += __gcd(i, __gcd(j, k));
            }
        }
    }
    cout << sum << endl;
    
    return 0;
}

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

int main() {
	int N, a, b;
	cin >> N;
	if (N == 1)cout << "Hello World" << endl;
	if (N == 2) {
		cin >> a >> b;
		cout << a + b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
#define INF 1000000000
typedef struct card{
  char s;
  int v;
}Card;
void merge(Card A[],int left,int m,int right){
  Card R[MAX/2+2],L[MAX/2+2];
  int i,j,k;
  int n1,n2;
  n1 = m - left;
  n2 = right - m;

  for(i=0;i<n1;i++){
    L[i] = A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i] = A[m+i];
  }
  L[n1].v = INF;
  R[n2].v = INF;
  i = 0;
  j = 0;
  for(k=left;k<right;k++){
    if(L[i].v <= R[j].v){
      A[k] = L[i++];
    }else{
      A[k] = R[j++];
    }
  }
}
void mergeSort(Card A[],int left,int right){
  int m;
  if(left + 1 < right){
    m = (left+right)/2;
    mergeSort(A,left,m);
    mergeSort(A,m,right);
    merge(A,left,m,right);
  }
}
int partition(Card A[],int p,int r){
  Card tmp,x;
  int i,j;
  x = A[r];
  i = p - 1;
  for(j=p;j<r;j++){
    if(A[j].v <= x.v){
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;

  return i + 1;
}
void quick(Card A[],int p,int r){
  int q;
  if(p<r){
    q = partition(A,p,r);
    quick(A,p,q-1);
    quick(A,q+1,r);
  }
}
int main(){
  int i,j,total,v,stable = 0;
  Card A[MAX],B[MAX];
  char s;
  scanf("%d",&total);
  for(i=0;i<total;i++){
    scanf(" %c%d",&s,&v);
    A[i].s = B[i].s = s;
    A[i].v = B[i].v = v;
  }

  mergeSort(A,0,total);
  quick(B,0,total-1);

  for(i=0;i<total;i++){
    if(A[i].s != B[i].s) stable = 1;
  }

  if(stable == 0)printf("Stable\n");
  else printf("Not stable\n");

  for(i=0;i<total;i++){
    printf("%c %d\n",B[i].s,B[i].v);
  }
  return 0;
}


Measured memory_bytes: 4028
n = int(input())
b = list(map(int,input().split()))

a = []
buf = -1
for i in b :
    a.append(max(buf, i))
    if buf == -1 :
        a.append(i)
    buf = i

for j in range(n - 1):
    if b[j] < a[j] and b[j] < a[j + 1]:
        a[j] = b[j]
        a[j + 1] = b[j]
print(sum(a))

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

#define int long long int
int gcd(int p,int q){
        return p==0 ? q : gcd(q%p,p);
}

int dfs(int p,int q,int a,int n,int m,int pre){
        if(p==0) return 1;
        if(n==0) return 0;
        int res=0;
        for(int i=pre;i*m<=a;i++){
                if(n*q<p*i) break;
                int newp=p*i-q;
                if(newp<0) continue;
                int newq=q*i;
                int g=gcd(newp,newq);
                newp/=g,newq/=g;
                res+=dfs(newp,newq,a,n-1,m*i,i);
        }
        return res;
}
signed main(){
        int p,q,a,n;
        while(cin>>p>>q>>a>>n,p){
                int res=dfs(p,q,a,n,1,1);
                cout<<res<<endl;
        }
        return 0;
}

Measured memory_bytes: 3044
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Comparator;
import java.util.Collections;
import java.io.InputStream;

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

    static class Taskb {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            ArrayList<node> a = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                a.add(new node(in.nextInt(), in.nextInt()));
            }
            Collections.sort(a, new Comparator<node>() {

                public int compare(node o1, node o2) {
                    return (int) (o1.a - o2.a);
                }
            });
            long ans = 0;
            int i = 0;
            while (m > 0) {
                ;
                if (m > a.get(i).b) {
                    ans += a.get(i).a * a.get(i).b;
                    m -= a.get(i).b;
                } else {
                    ans += a.get(i).a * m;
                    m = 0;
                }
                i++;
            }
            out.println(ans);
        }

        class node {
            long a;
            long b;

            node(int a, int b) {
                this.a = a;
                this.b = b;
            }

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

vector<vector<ll>> adj;
vector<ll> dp;

int dfs(int n) {
  if (dp[n]!=-1) return dp[n];
  int result = 0;
  for (auto x: adj[n]) result = max(result,dfs(x)+1);
  return dp[n] = result;
}

int main() {
  int N, M; cin >> N >> M;
  adj.resize(N); dp.resize(N,-1);
  rep(i,M) {
    int x, y; cin >> x >> y; x--; y--;
    adj[x].push_back(y);
  }
  rep(i,N) if (dp[i]==-1) dfs(i);
  // debug(all(dp));

  ll result = 0; rep(i,N) result = max(result, dp[i]);
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 8576
#include <iostream>
using namespace std;
static const int N = 100;

#pragma warning( disable:4996 )

int main() {
	int M[N][N];
	int n, u, k, v;

	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			M[i][j] = 0;
		}
	}

	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		u--;
		for (int j = 0; j < k; j++) {
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (j) cout << " ";
			cout << M[i][j];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3092
#include <cstdio>
#include <algorithm>

using namespace std;

int a[200000];

int main() {
    int n, ans = 1, c = 1, i;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        int x;
        
        scanf("%d", &x);
        
        a[x - 1] = i;
    }
    
    for (i = 1; i < n; i++) {
        if (a[i] > a[i - 1]) {
            c++;
        } else {
            c = 1;
        }
        
        ans = max(ans, c);
    }
    
    printf("%d\n", n - ans);
    
    return 0;
}


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

using namespace std;

int main(){
    const long int mod = 1e9 + 7;
    long long int n,m,a;
    cin >> n >> m;
    long long int dp[n+1];
    vector<bool> bl(n,true);
    for (long int i = 0; i < m; i++)
    {
        cin >> a;
        bl[a] = false; 
    }
    dp[0] = 1; dp[1] = 1;
    for (long int i = 0; i < n-1; i++)
    {
       dp[i+2] = (dp[i]*bl[i] + dp[i+1]*bl[i+1])%mod;
       dp[i+2] *= bl[i+2];   
    }
    cout << dp[n]%mod << endl;
    return 0;
}

Measured memory_bytes: 1024
//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
//template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 10005;
#define endl '\n'
//#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()

const ll md = (ll)998244353;
 
inline ll add(ll a, ll b) {
  a += b;
  if (a >= md) a -= md;
  return a;
}
 
inline ll sub(ll a, ll b) {
  a -= b;
  if (a < 0) a += md;
  return a;
}
 
inline ll mul(ll a, ll b) {
  return (ll) ((long long) a * b % md);
}
 
inline ll power(ll a, long long b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
 
inline ll inv(ll a) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

int32_t main()
{ 
  IOS
  
  int n,s;
  cin>>n>>s;
  int a[n];
  for(int i = 0;i<n;i++){
    cin>>a[i];
  } 
  int dp[n+1][s+1];
  memset(dp,0,sizeof(dp));
  dp[0][0] = power(2,n);
  for(int i = 0;i<n;i++){
    for(int j = 0;j<=s;j++){
      dp[i+1][j]=add(dp[i][j],dp[i+1][j]);
      if(j+a[i]<=s)
        dp[i+1][j+a[i]]=add(mul(dp[i][j],inv(2)),dp[i+1][j+a[i]]);
    }
  }
  
  cout<<dp[n][s]<<endl;
}
 

Measured memory_bytes: 38812
#include <bits/stdc++.h>
using namespace std;
int main(){
  int r,D;
  cin>>r>>D;
  vector<int> X(11);
  cin>>X.at(0);
  for(int i=0;i<10;i++){
X.at(i+1)=r*X.at(i)-D;
    cout<<X.at(i+1)<<endl;
  }
  return 0;
}


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

using namespace std;

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

    int curr = 1;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        if (a == curr) curr++;
    }

    curr--;
    cout << (curr == 0 ? -1 : n - curr) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define INF 100000
int n,a[55],ans=INF;
vector<int>s;
int main(void){
    cin>>n;
    for(int i=1;i<=n;i++){
        int b;
        cin>>b;
        a[i]+=b;
        a[i+1]+=a[i];
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<=n;j++){
            s.push_back(a[j]-a[i]);
        }
    }
    for(int k=0;k<s.size();k++){
        int dp[55][3];
        for(int i=0;i<=n;i++){
            dp[i][0]=INF;
            dp[i][1]=INF;
            dp[i][2]=INF;
        }
        dp[0][0]=0;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<=n;j++){
                if(a[j]-a[i]>=s[k]){
                    dp[j][1]=min(dp[j][1],max(dp[i][0],a[j]-a[i]));
                    dp[j][2]=min(dp[j][2],max(min(dp[i][1],dp[i][2]),a[j]-a[i]));
                }
            }
        }
        ans=min(ans,dp[n][2]-s[k]);
    }
    cout<<ans<<endl;
}



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

int main() {
	int h, w; cin >> h >> w;
	string a[100];
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}

	vector<bool> row(w, false);
	vector<bool> col(h, false);

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true; col[j] = true;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi           first
#define se           second
#define ll           long long
#define pb           push_back
#define mp           make_pair
#define pll          pair<ll,ll>
#define pii          pair<int,int>
#define SZ(x)        ((int)(x).size())
#define READ(x)      freopen(x,"r",stdin)
#define WRITE(x)     freopen(x,"w",stdout)
#define all(x)       (x).begin(),(x).end()
#define isWorking()  cout<<"Wroking"<<endl
#define FOR(i,x,y)   for(int i=x; i<y; i++)
#define SORT(x)      sort(x.begin(),x.end())
#define PRINT(ok)    cout<<(ok? "YES":"NO")<<endl
#define Fast_Input   ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
typedef vector<int> VI;
const ll mod= 1e9+7,INF=1e18,mx= 1e5,mn=100;
int testCase=1,cas=0;

bool flag[mx+5];

void seive() {

    for(int i=2; i<=mx; i++)  flag[i]=1;

    int val=sqrt(mx)+1;
    for(int i=2; i<val; i++)
        if(flag[i])
            for(int j=i; j*i<=mx; j++)
                flag[i*j]=0;
}

vector <int> Like;

int main() {
    seive();

    for(int i=3; i<=mx; i+=2){
        int k= (i+1)/2;
        if(flag[i] && flag[k]){
            Like.push_back(i);
        }
    }

    scanf("%d",&testCase);

    while(testCase--) {
        int l,r;
        scanf("%d %d",&l,&r);
        int a= lower_bound(all(Like),l)-Like.begin();
        int b= lower_bound(all(Like),r)-Like.begin();
        if(Like[b]==r) b++;
        printf("%d\n",b-a);
    }
    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    map<string,bool> m;
    rep(i,N){
        string s; cin >> s;
        m[s]=true;
    }
    int M; cin >> M;
    int frag=1;
    rep(i,M){
        string s; cin >> s;
        if(m[s]) {
            if(frag) cout << "Opened by ";
            else cout << "Closed by ";
            frag=1-frag;
        }
        else {
            cout << "Unknown ";
        }
        cout << s << "\n";
    }

}


Measured memory_bytes: 3260
#include<stdio.h>
#include<string.h>

//strlenは文字列の長さを返す

//変数の宣言(ここ、mainより外です）
//入力
int Dice[7]; //サイコロ
//処理用
int i;
int tmp; //一時

//入力
void saikoro() {
    for (i=0; i<6; i++) {// iは0 ~ 5
        scanf("%d", &Dice[i+1]); //Dice[1] ~ Dice[6] に入力
    }
}


//サイコロを転がす-------------------------------

void N () {
    tmp = Dice[1];
    Dice[1] = Dice[2];
    Dice[2] = Dice[6];
    Dice[6] = Dice[5];
    Dice[5] = tmp;
    //Dice[3]は変わらない
    //Dice[4]は変わらない 以下似たような感じ
}

void W () {
    tmp = Dice[1];
    Dice[1] = Dice[3];
    Dice[3] = Dice[6];
    Dice[6] = Dice[4];
    Dice[4] = tmp;
}

void S () {
    tmp = Dice[1];
    Dice[1] = Dice[5];
    Dice[5] = Dice[6];
    Dice[6] = Dice[2];
    Dice[2] = tmp;
}

void E () {
    tmp = Dice[1];
    Dice[1] = Dice[4];
    Dice[4] = Dice[6];
    Dice[6] = Dice[3];
    Dice[3] = tmp;
}

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



int main() {
    char str[110]; //文字列
    
    //入力
    saikoro(); //サイコロの目を入力する関数
    scanf("%s", str); //転がす方向を入力、またその数を数えられるように
    
    for (i=0; i<strlen(str); i++) { //文字数の分だけ 0 ~
        if (str[i] == 'N') {
            N();
        }else if (str[i] == 'W') {
            W();
        }else if (str[i] == 'S') {
            S();
        }else if (str[i] == 'E') {
            E();
        }
    }
    
    //出力（関数によって上面はDice[1]に固定されている
    printf("%d\n", Dice[1]);
    
    return 0;
}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,s[100],ans=0,tmp;
  while(1){
    ans=0;
    cin>>n;
    if(n==0) break;
    for(int i=0;i<n;i++){
      cin>>s[i];
    }
    for(int i=0;i<n;i++){
      for(int j=n-1;i<j;j--){
	if(s[j]>s[j-1]){
	  tmp=s[j-1];
	  s[j-1]=s[j];
	  s[j]=tmp;
	}
      }
    }
    for(int i=1;i<n-1;i++){
      ans+=s[i];
    }
    ans/=(n-2);
    cout<<ans<<endl;
  }
return 0;
}



Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define int long long int
#define pb push_back
#define BOOST ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define debugL(i)  cout<<"line no-> "<<i<<" working"<<endl
#define debugVL(i,l)  cout<<"val at line no."<<i<< " ->"<<l<<endl
#define  init(st,et,val,arr) for(int i=st;i<=et;i++)arr[i]=val;
//LLONG_MAX
const int M=1e9 + 7;
const int MAX=1e5+7;
using namespace std;
struct node{
	int l,r,v;
};
int32_t main() 
{
	BOOST;
	int a,b;cin>>a>>b;
	int ans=max((int)0,a-2*b);
	cout<<ans<<endl;
	
	return 0;
}
 















 
 

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

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

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    cin >> n;
    int mn_x = INT_MAX, mx_x = INT_MIN, mn_y = INT_MAX, mx_y = INT_MIN;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        int xx = x + y, yy = y - x;
        mn_x = min(mn_x, xx);
        mx_x = max(mx_x, xx);
        mn_y = min(mn_y, yy);
        mx_y = max(mx_y, yy);
    }

    cout << max(mx_x - mn_x, mx_y - mn_y) << '\n';

    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

const int max_n = 200000+10;
int N;
int A[2*max_n];
int B[2*max_n];

int main(void) {
    cin>>N;
    int M = 0;
    for(int i = 1;i <= N;i++) {
        cin>>A[i];
    }

    for(int i = N;i >= 1;i--) {
        int sum = 0;
        for(int j = 1;j*i <= N;j++) {
            sum += B[i*j];
        }
        if(sum % 2 != A[i]) {
            M++;
            B[i] = 1;
        }
    }

    vector<int> C;
    for(int i = 1;i <= N;i++) {
        if(B[i] == 1)
            C.push_back(i);
    }
    cout<<M<<endl;
    if(M > 0) {
        for(auto d: C) {
            cout<<d<<" ";
        }
    }

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))


#define forr(i,n) for(i=0; i<n; i++)
#define whilee(i,t) while(i!=t)
//#define pb(x) push_back(x);

//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//accumulate(A.begin(), A.end(), 0);
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());



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

    //vector <int> A;
    //deque <int> A;
    //queue <int> A;
    //stack <int> A;
    //set <int> A;
    //map <int,int> A;
    //pair <int,int> A ;
    //vector <pair <int,int>> A ;
    //string S, T;
    int i, j, k, a, b, c, h, w, l, m, n, p, q, r, s, t, x, y, z, cnt=0;
    cin>>h>>w;
    char A[h][w];
    forr(i,h)
    {
        forr(j,w)
        {
            cin>>A[i][j];
        }
    }
    forr(i,h)
    {
        cnt=0;
        forr(j,w)
        {
            if(A[i][j]=='.')
            {
                cnt++;
            }
        }
        if(cnt==w)
        {
            forr(j,w)
            {
                A[i][j]='0';
            }
        }
    }
    forr(i,w)
    {
        cnt=0;
        forr(j,h)
        {
            if(A[j][i]=='.' || A[j][i]=='0')
            {
                cnt++;
            }
        }
        if(cnt==h)
        {
            forr(j,h)
            {
                A[j][i]='0';
            }
        }
    }
    forr(i,h)
    {
        x=0;
        forr(j,w)
        {
            if(A[i][j]!='0')
            {
                x=1;
                cout<<A[i][j];
            }
        }
        if(x==1)
        {
            cout<<endl;
        }
    }
    return 0;
}



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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N; cin >> N;
    priority_queue<double, vector<double>, greater<double>> q;
    REP(i, N)
    {
        double v; cin >> v;
        q.push(v);
    }
    REP(i, N-1)
    {
        double x = q.top(); q.pop();
        double y = q.top(); q.pop();
        q.push((x+y)/2);
    }
    cout << q.top() << endl;
}
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
  int k, s;
  cin >> k >> s;
  int cnt = 0;
  REP(x,k+1){
    REP(y,k+1){
      int z = s - x - y;
      if(z <= k && z >= 0) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> P;

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define Rep(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える

int main() {
	int n; cin >> n;
	vector<vector<int>> G(n);
	rep(i, n) {
		int u, k; cin >> u >> k;
		u--;
		//G[u].resize(k);

		rep(j, k) {
			int v; cin >> v;
			v--;
			G[u].push_back(v);
		}
	}

	vector<int> dist(n, -1);

	dist[0] = 0;
	queue<int> que;
	que.push(0);

	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (auto nv : G[v]) {
			if (dist[nv] != -1) continue;
			else {
				dist[nv] = dist[v] + 1;
				que.push(nv);
			}
		}
	}

	rep(i, n) {
		cout << i + 1 << " " << dist[i] << endl;
	}

	//return 0;
}


Measured memory_bytes: 3156
//https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_e
//E - Colorful Hats 2
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
constexpr ll MOD=1e9+7;
int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N; cin>>N;    
    vector<ll> an(N);
    for(auto&& a:an){
        cin>>a;
    }
    ll ans=1;
    ll x=0,y=0,z=0;
    FOR(i,0,N){
        auto c=an.at(i);
        ll mul=0;
        if(x==c) ++mul;
        if(y==c) ++mul;
        if(z==c) ++mul;
        if(x==c) {
            ++x;
        } else if(y==c) {
            ++y;
        } else if(z==c) {
            ++z;
        }else {
            cout<<0<<endl;
            exit(0);
        }
        ans *= mul;
        ans %= MOD;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(void){
   int N;
   int a,b,c;
   scanf("%d",&N);
   a=N/100;
   b=N/10%10;
   c=N-a*100-b*10;
   if(a==7||b==7||c==7){
      printf("Yes");
   }else{
      printf("No");
   }
   return 0;
}


Measured memory_bytes: 1728
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
const int MAX_N = 200;

int is_prime[MAX_N];
void init_primes()
{
    rep(i, 0, MAX_N) is_prime[i] = 1;
    is_prime[0] = is_prime[1] = 0;

    rep(i, 2, MAX_N)
    if (is_prime[i])
    {
        for (int j = i*i; j < MAX_N; j += i)
            is_prime[j] = 0;
    }
}

vector<int> cumsum(1000, 0);
ll num(int n)
{
    return cumsum[cumsum.size() - 1] - cumsum[n - 1];
}


int main()
{
    init_primes();

    int n;
    cin >> n;

    map<int, int> n_cnt;
    rep(i, 2, n + 1)
    {
        int num = i;
        
        rep(j, 2, 101)
        if (is_prime[j])
        while (num % j == 0)
        {
            ++n_cnt[j];
            num /= j;
            // cout << j << ' ' << i << endl;
        }
    }

    vector<int> ndiv(1000, 0);
    for (auto n_c: n_cnt)
        ++ndiv[n_c.second];

    rep(i, 1, cumsum.size())
        cumsum[i] = cumsum[i - 1] + ndiv[i];
    
    // rep(i, 0, cumsum.size())
    //     cout << i << ' ' <<  ndiv[i] << endl;

    ll ans = 0;
    ans += num(74);
    ans += num(24) * (num(2) - 1);
    ans += num(14) * (num(4) - 1);
    ans += num(4) * (num(4) - 1) * (num(2) - 2) / 2;

    // cout << num(74) << endl;
    // cout << num(24) * (num(2) - 1) << endl;
    // cout << num(14) * (num(4) - 1)<< endl;
    // cout << num(4) <<' ' <<  (num(4) - 1) << ' ' << (num(2) - 2)<< endl;
    cout << ans << endl;
    return 0;
}

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

int main()
{
	int d,g;
	cin >> d >> g;

	vector<int> p(d);
	vector<int> c(d);
	for (int i=0;i<d;++i)
	{
		cin >> p.at(i) >> c.at(i);
	}

	int mask_max=1<<d;
	int minimum_q=1000000; // some large number
	for (int i=0;i<mask_max;++i)
	{
		int point=0;
		int q=0;
		for (int j=0;j<d;++j)
		{
			if ( (i&(1<<j))!=0 )
			{
				// with complete bonus
				q+=p.at(j);
				point+=p.at(j)*(j+1)*100 + c.at(j);
			}
		}
		for (int j=d-1;(j>=0)&&(point<g);--j)
		{
			if ( (i&(1<<j))==0 )
			{
				// not completed - can be added
				int qq=min( (g-point)/(100*(j+1)), p.at(j));
				point+=qq*(j+1)*100;
				q+=qq;
			}
		}
		//fprintf(stderr,"mask: %d, point: %d, q: %d\n",i,point,q);

		if (point>=g)
		{
			if (q<minimum_q)
			{
				minimum_q=q;
			}
		}

	}

	cout << minimum_q << endl;

}



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

int main() {
  int A, B;
  scanf("%d %d", &A, &B);
  
  int addition, subtraction, multiplication;
  addition = A + B;
  subtraction = A - B;
  multiplication = A * B;
  
  
  int ma = max( {addition, subtraction, multiplication} );
  printf("%d", ma);
  
  return 0;
}

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

using namespace std;

long long f(long long x)
{
    return x*(x+1)/2;
}

void solve()
{
    int n;
    cin >> n;
    long long res=0;
    for (int i=1; i<=n; i++)
        res+=i * f(n/i);
    cout << res;
}

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

}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)


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

	vector<int> r;
	int tmp;
	REP(i, n) {
		cin >> tmp;
		r.push_back(tmp);
	}
	
	int maxv=-2000000000;
	int minv = r[0];
	FOR(i,1,n) {
		maxv = max(maxv, r[i] - minv);
		minv = min(minv, r[i]);
	}

	cout << maxv << endl;
	return 0;
}



Measured memory_bytes: 3948
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_lim=(n); i<i##_lim; ++i)
#define FOR(i, a, b) for (int i=(a), i##_lim=(b); i<i##_lim; ++i)
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;

int main()
{
    int R, G, B, N;
    cin >> R >> G >> B >> N;

    int ret = 0;
    REP(i, N/R+1)
    {
        REP(j, (N-i*R)/G+1)
        {
            if ((N-i*R-j*G)%B == 0) ++ret;
        }
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here

        int count = 0;

        Scanner scanner = new Scanner(System.in);
        int food = scanner.nextInt();
        int[] A = new int[food], B = new int[food], C = new int[food - 1];
        for (int i = 0; i < food; i++) A[i] = scanner.nextInt();
        for (int i = 0; i < food; i++) B[i] = scanner.nextInt();
        for (int i = 0; i < food - 1; i++) C[i] = scanner.nextInt();

        int lastPoint = -1;

        for (int i = 0; i < food; i++) {
            if (lastPoint != -1 && A[lastPoint] + 1 == A[i]) count += C[A[i] - 2];
            count += B[A[i] - 1];
            lastPoint = i;
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 22740
// abc157_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;

    int ans = (N + 1) / 2;
    print(ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
const ll mod = 1e9+7;
// __uint128_t

const int MAXX = 510000;
const int MOD = 1000000007;
long long fac[MAXX], finv[MAXX], inv[MAXX];

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

// a^{-1} mod を計算する
// (a%MOD) * modinv(b, MOD) % MOD で　a/b;
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAXX; 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;
}

int main(){
    COMinit();
    ll N; cin >> N;
    vector<ll> V(N); for(int i = 0; i < N; i++) cin >> V[i];
    vector<ll> D(N-1);
    ll ans = 0;
    for(int i = 0; i < N-1; i++){
        ll id = i+1; //idこ選ぶ
        D[i] = ((COM(N-1, id) * fac[N-1-id]%MOD) * fac[id-1])%MOD;
    }

    for(int i = 0; i < N-2; i++) D[i+1] = (D[i]+D[i+1])%MOD;
    for(int i = 0; i < N-1; i++){
        ll d = V[i+1]-V[i];
        ans += (d*D[i])%MOD;
        ans%=MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 13824
x,k,d = map(int,input().split())
if abs(x) >= k*d:
  print(abs(x)-k*d)
  exit()
x = abs(x)
r = x%d
if ((x-r)//d)%2 == k%2:
  print(r)
else:
  print(abs(r-d))

Measured memory_bytes: 61700
#include<bits/stdc++.h>
#define LL long long
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,a,b) for(int i=(a);i>=(b);--i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define TASK "A - Frog 1"
using namespace std;
///---------------------------------------------------
const int N = 1e5 + 5;
LL n, a[N], F[N];
///---------------------------------------------------
void nhap(){
    cin>>n;
    fo(i,1,n) cin>>a[i];
}
///---------------------------------------------------
void solve(){
    F[2] = abs(a[1] - a[2]);
    fo(i,3,n) F[i] = min(F[i-1]+ abs(a[i]-a[i-1]), F[i-2]+ abs(a[i]-a[i-2]));
    cout<<F[n];
}
///---------------------------------------------------
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    nhap();
    solve();
}



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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)

#define ll long long

#define pq(name,type) priority_queue<type> name
#define vec(name,type,length,value) vector<type> name(length,value)
#define vec2(name,type,length,width,value) vector<vector<type>> name(length,vector<type>(width,value));

int main(){
	double N,g = 0,k = 0;
  cin >> N;
  froop1(1,N + 1){
    if(i % 2 == 0) g++;
    else k++;
  }
  printf("%.10f",k / (g + k));
}

Measured memory_bytes: 3760
#include <stdio.h>
int main(){
    int n,m,i,j;
    int a,b;
    int A[100][100] = {0};
    int B[100] = {0};
    int c[100] = {0};

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

    for(j=0; j<n; j++){
        for(i=0; i<m; i++){
            scanf("%d",&a);
            A[j][i] = a;
        }
    }
    for(j=0; j<m; j++){
        scanf("%d",&b);
        B[j] = b;
    }
    for(j=0; j<n; j++){
        for(i=0; i<m; i++){
           c[j] = c[j] + A[j][i]*B[i];
        }
    }
    for(i=0; i<n; i++){
        printf("%d\n",c[i]);
    }
    return 0;
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
 
int main() {
	int n, x;
	while(cin>>n>>x && !(n==0 && x==0))
	{
		int c=0; //initialization must be inside while i.e. when a test case start processing.
		for(int i=1; i<=n-2; i++)
		{
             for(int j=i + 1; j<=n-1 ; j++)
			 {
				for(int k = j + 1; k<=n; k++)
				{
					if(i+j+k == x) c++;
				}
			}
		}
	cout<<c<<endl;
	}
}


Measured memory_bytes: 3092
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;

int main(){
int a[3]={read(),read(),read()};
sort(a,a+3);
write(a[2]-a[0]);
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int i=0,ai,bi;
    long double a,pi=3.141592653589793238;
    long double A,C;
    scanf("%Lf",&a);
    C=pi*a*2;
    A=pi*a*a;
    printf("%Lf %Lf\n",A,C);
    return 0;

}


Measured memory_bytes: 2064
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<map>
#include<ctime>

using namespace std;

template <typename T>

inline T read()
{
	T x=0,f=1;char c=getchar();
	while(!isdigit(c))
	{if(c=='-') f=-f;c=getchar();}
	while(isdigit(c))
	{x=(x<<3)+(x<<1)+(c-48);c=getchar();}
	return x*f;
}

#define lint long long int
#define ulint unsigned lint

const int inf=1e9+1e7;
const double PI=3.1415926;

int main(void)
{

	// freopen("testdata.in","r",stdin);
	// freopen("testdata.out","w",stdout);

	double n;

	cin>>n;

	cout<<2*n*PI<<endl;

	return 0;

}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
#include<iostream>
#define mod 1000000007;
#define SIZE_INT sizeof(int) * 8
#define ll long long int 
using namespace std;

int main()
{
	ll i,t,res;
	for(i = 0;i<5;i++)
	{
		cin>>t;
		if(t == 0)
			res = i+1;
	}
	cout<<res<<"\n";
}


Measured memory_bytes: 3628
#include<iostream>
using namespace std;
#define df 0

int main(){
  if(df) printf("*debug mode*\n");
  int n; cin >>n;
  int prev; cin >>prev;
  int s=prev;
  if(df)printf("n:%d b:%d \ns:%d\n",n,prev,s);
  for(int i=1;i<n-1;i++){
    int b; cin >>b;
    s+=min(prev,b);
    if(df)printf("s:%d\n",s);
    prev=b;
  }
  cout << s+prev;
}

/// confirm df==0 ///


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

const LL P = 1e9+7;

LL fp(LL a, LL n){
    if(n==0)
        return 1LL;

    LL h = fp(a, n/2);
    h = h*h%P;
    if(n&1)
        h = h * a %P;
    return h;
}

LL fac(LL n){
    return n==0 ? 1LL : fac(n-1) * n % P;
}

int a[100010];

int main(){
    int n, k;
    cin >>n>>k;
    for(int i=1;i<=n;i++){
        cin >>a[i];
    }

    sort(a+1, a+n+1);

    LL f = fac(k-1);
    LL revf1 = fp(f, P-2);
    LL revf2 = 1;
    //cout << f<<" "<<revf1<<" "<<revf2<<endl;
    LL ans = 0;
    for(int i=0;i<n-k+1;i++){
        LL c = a[k+i] - a[n-k+1-i];
        c %= P;
        if(c<0)
            c+= P;

        ans +=  c * (f * revf1 % P * revf2 % P) % P;
        ans %= P;

        f = f * (k+i) % P;
        revf2 = revf2 * fp(i+1, P-2) % P;

       // cout << f <<" "<<revf1<<" "<<revf2<<endl;
    }
    cout << ans<<endl;
}


Measured memory_bytes: 1408
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main{
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try{
            ArrayList<Integer> side;
            String line = br.readLine();
            int x = Integer.parseInt(line);
            StringTokenizer tokens;
            for(int i=0;i<x;i++){
                line = br.readLine();
                tokens = new StringTokenizer(line);
                side = new ArrayList<>();
                side.add(Integer.parseInt(tokens.nextToken()));
                side.add(Integer.parseInt(tokens.nextToken()));
                side.add(Integer.parseInt(tokens.nextToken()));
                Collections.sort(side);
                if(side.get(0)*side.get(0)+side.get(1)*side.get(1)==side.get(2)*side.get(2)){
                    System.out.println("YES");
                }else{
                    System.out.println("NO");
                }
            }
        }
        catch(Exception e){
            System.out.println(e);
        }

    }

}

Measured memory_bytes: 25904
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
using namespace std::literals;
using namespace std;

namespace xmaho
{
inline namespace input
{
template<typename T>
T get_value(std::istream& is = std::cin);
template<typename C>
C get_container(std::istream& is = std::cin, typename C::size_type length = std::numeric_limits<typename C::size_type>::max());
}
}
using namespace xmaho;

int main()
{
  const auto N {get_value<unsigned long>(cin)};
  const auto K {get_value<unsigned long>(cin)};
  auto A {get_container<vector<unsigned long>>(cin, N)};

  vector<unsigned long> footprints(N);

  auto pos {0ul};
  for (auto i {0ul}; i < K; ++i) {
    if (footprints[pos] == 0) {
      footprints[pos] = i + 1;
      pos = A[pos] - 1;
    } else {
      const auto loop_length {i + 1 - footprints[pos]};
      if (loop_length > 1) {
        const auto left_count {K - i};
        const auto surplus_left_count {left_count % loop_length};
        const auto it {find(footprints.begin(), footprints.end(), surplus_left_count + footprints[pos])};
        pos = distance(footprints.begin(), it);
      }
      break;
    }
  }

  cout << pos + 1 << '\n';

  return 0;
}

class initalization
{
  class custom_numpunct: public std::numpunct<char>
  {
  public:
    using numpunct::numpunct;
  protected:
    std::string do_truename() const override { return "Yes"; }
    std::string do_falsename() const override { return "No"; }
  };

public:
  initalization()
  {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.imbue(std::locale(std::cout.getloc(), new custom_numpunct{}));
    std::cout << std::boolalpha << std::fixed << std::setprecision(15);
  }
} initalize;

template<typename T>
T xmaho::input::get_value(std::istream& is)
{ T v {}; is >> v; return v; }

template<typename C>
C xmaho::input::get_container(std::istream& is, typename C::size_type length)
{
  C v {};
  if (length != std::numeric_limits<typename C::size_type>::max())
    v.reserve(length);
  typename C::value_type e {};
  for (auto i {length}; i != 0 && is >> e; --i)
    v.push_back(std::move_if_noexcept(e));
  return v;
}


Measured memory_bytes: 6392
#include<stdio.h>
int solve(int, int);
int A[2001],M[2001],n;

int main(){
  int i,j, q,value=0,value2=0;

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

  scanf("%d",&q);
for(j=0;j<q;j++){
  scanf("%d",&M[j+1]);
 }
for(j=0;j<q;j++){
  value =solve(1, M[j+1]);

  if(value==1) printf("yes\n");
  else printf("no\n"); 

 }


  return 0;
}


 int solve(int key,int key2){
    
   
   if(key2==0)return 1;
   if(key>n)return 0;
   if(solve(key+1,key2-A[key]) == 1) return 1;
   if(solve(key+1,key2) == 1) return 1;

   return 0;
 }

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define req(i, j, n) for(int i = j; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
  char pp;
  cin>>pp;
   char po[27]={'0','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
for(int i=1;i<=26;i++){
  if(pp==po[i]){
    cout<<po[i+1]<<endl;
    return 0;}
}

}

Measured memory_bytes: 256