akhauriyash/Code-Regression huggingface dataset:
integer N
integer,allocatable,dimension(:)::a
integer ans
read*,N
allocate(a(N))
read*,a

ans=0
do i=1,N
  do while(and(a(i),1)==0)
    ans=ans+1
    a(i)=rshift(a(i),1)
  end do
end do
print"(i0)",ans
end

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int a,b,t;
int j;
int main(){
	a=0,b=0;
	for(j=0;j<4;j++){
		cin>>t;
		a+=t;
	}
	for(j=0;j<4;j++){
		cin>>t;
		b+=t;
	}
	if(a>b){
		cout<<a<<endl;
	}else{
		cout<<b<<endl;
	}
	return 0;
}

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

using namespace std;

void GrandGarden()
{
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; i++)
  {
    cin >> h[i];
  }
 
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    while (h[i] > 0)
    {
      for (int j = i; j < n; j++)
      {
        if (h[j] > 0)
        {
          h[j]--;
          if (j + 1 == n) ans++;
        }
        else
        {
          ans++;
          break;
        }
      }
    }
  }
 
  cout << ans << endl;
  return;
}
 
 
int main()
{
  GrandGarden();
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	char a[100]={0},b[100]={0},c[200]={0};
	int n,i,j,z;
	scanf("%d",&n);
	scanf(" ");
	for(i=0;i<n;i++)
	{
		scanf("%c",&a[i]);
	}
	scanf(" ");
	for(i=0;i<n;i++)
	{
		scanf("%c",&b[i]);
	}
	for(i=0,j=0,z=0;i<2*n;i++)
	{
		if(i%2==0)
		{
			c[i]=a[j++];
		}
		else 
			c[i]=b[z++];
	}
	for(i=0;i<2*n;i++)
		printf("%c",c[i]);
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	string S, T;
	cin >> S >> T;

	Int len_S = S.size();
	Int len_T = T.size();

	Int flag = 0;
	Int temp;
	for (Int i = 0; i < len_S; i++) {
		if (S[i] == T[0] || S[i] == '?') {
			for (Int j = 0; j < len_T; j++) {
				if (i + j >= len_S)break;
				if (S[i + j] != T[j] && S[i + j] != '?') {
					break;
				}
				if (j == len_T - 1) {
					flag = 1;
					temp = i;
					break;
				}
			}

		}
	}

	if (flag) {
		for (Int i = 0; i < len_T; i++) {
			S[i + temp] = T[i];
		}
	}

	for (Int i = 0; i < len_S; i++) {
		if (S[i] == '?')S[i] = 'a';
	}

	cout << (flag ? S : "UNRESTORABLE") << "\n";

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
  char x,y;
  cin >> x >> y;

  if(x > y) cout << ">" << endl;
  else if(x < y) cout << "<" << endl;
  else cout << "=" << endl;
}

Measured memory_bytes: 3484
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

class BIT{
public:

  vector<ll> bit;
  BIT(){}
  BIT(int size){
    bit.resize(size,0);
  }

  ll sum(int i){
    ll s=0;
    while(i>0){
      s+=bit[i];
      i-=i&(-i);
    }
    return s;
  }

  void add(int i,int x){//i!=0
    while(i<bit.size()){
      bit[i]+=x;
      i+=i&(-i);
    }
  }
};

int main(){
  ll n,k;
  cin>>n>>k;
  ll a[n+1]={};
  vector<ll> v;
  v.push_back(0);
  for(int i=1;i<=n;i++){
    cin>>a[i];
    a[i]+=a[i-1];
    a[i]-=k;
    v.push_back(a[i]);
  }

  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());

  ll ans=0;
  BIT bit(n+2);
  for(int i=0;i<=n;i++){
    ll tmp=lower_bound(v.begin(),v.end(),a[i])-v.begin()+1;
    //cout<<tmp<<endl;
    ans+=bit.sum(tmp);
    bit.add(tmp,1);
  }

  cout<<ans<<endl;

  return 0;
}


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

// Optimization

//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 2e5 + 5, mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e9 + 7;
const ll infll = 1e18 + 7;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s; cin >> s;
    if (s == "ABC") cout << "ARC";
    else cout << "ABC";
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 3648
class UnionFind (object):
	def __init__(self, N):
		self.parent = [-1] * N

	def root(self, x):
		if self.parent[x] < 0:
			return x
		self.parent[x] = self.root(self.parent[x])
		return self.parent[x]

	def size(self, x):
		x = self.root(x)
		return -self.parent[x]

	def unite(self, x, y):
		x, y = self.root(x), self.root(y)
		
		if x == y:
			return False
		
		if -self.parent[x] < -self.parent[y]:
			x, y = y, x
		self.parent[x] += self.parent[y]
		self.parent[y] = x
		return True


N, M = map(int, input().split())
uf = UnionFind(N)

for i in range(M):
	X, Y, Z = map(int, input().split())
	X, Y = X - 1, Y - 1
	uf.unite(X, Y)

print(sum(p < 0 for p in uf.parent))



Measured memory_bytes: 5404
//23
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>

#define S(X) ((X)*(X))

using namespace std;

struct E{
  double l;
  double s,t;
  bool operator<(E a)const{
    return l>a.l;
  }
};

int uf[10000];

int find(int x){
  return (x==uf[x])?x:uf[x]=find(uf[x]);
}

void unite(int a,int b){
  uf[find(a)]=find(b);
}

int main(){
  int N,M;
  cin>>N>>M;
  for(int i=0;i<N;i++){
    uf[i]=i;
  }
  int x[10000],y[10000];
  for(int i=0;i<N;i++){
    cin>>x[i]>>y[i];
  }
  vector<E> v(M);
  double t=0;
  for(int i=0;i<M;i++){
    int p,q;
    cin>>p>>q;
    p--;
    q--;
    E e;
    e.s=p;
    e.t=q;
    e.l=sqrt(S(y[p]-y[q])+S(x[p]-x[q]));
    t+=e.l;
    v[i]=e;
  }
  sort(v.begin(),v.end());
  for(int i=0;i<M;i++){
    if(find(v[i].s)!=find(v[i].t)){
      unite(v[i].s,v[i].t);
      t-=v[i].l;
    }
  }
  cout<<fixed<<t<<endl;
  return 0;
}

Measured memory_bytes: 1796
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B = map(int, read().split())
print(A + B if A + B < 10 else 'error')


Measured memory_bytes: 3060
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
x = Counter(a)
cnt = sorted(x.items(), key=lambda x: x[0], reverse=True)
ans = 0
for i in range(len(cnt)):
    x = cnt[i][1]
    if i != 0:
        if cnt[i][0] == cnt[i-1][0] - 1:
            x += cnt[i-1][1]
    if i != len(cnt) - 1:
        if cnt[i][0] == cnt[i+1][0] + 1:
            x += cnt[i+1][1]
    ans = max(ans, x)
print(ans)

Measured memory_bytes: 16088
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ld,ld> pll;
typedef pair<ll,pll> trp;
typedef vector<ll> vi;
typedef vector<pll> vp;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define f1(i,n)     for(ll i=1;i<=n;i++)
#define fs(i,s)     for(ll i=0;i+1<=s.length();i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define pob         pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a<<endl
#define pr2(a,b)    cout<<a<<" "<<b<<endl
#define rpr(a)      return cout<<a<<endl,0
#define prY         cout<<"Yes"<<endl
#define prN         cout<<"No"<<endl
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define	mp3(a,b,c)  make_pair(a,make_pair(b,c))
#define se          second
#define fi          first 
#define sse         second.second
#define sfi         second.first
#define soA         sort(A+1,A+1+n)
#define so(A,n)     sort(A+1,A+1+n)
#define sov(v)      sort(all(v))
#define sovr(v)     sort(all(v),greater<ll>())
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll mnz(ll& a,ll b){return a=(a>b?b:a);}
inline ll mxz(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5];
pll P[MAXN+5];
ld Dis(pll a,pll b){
	re sqrt((a.fi-b.fi)*(a.fi-b.fi)+(a.se-b.se)*(a.se-b.se));
}
ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
	sc(n);
	f1(i,n){
		sc2(P[i].fi,P[i].se);
	}
	f1(i,n)A[i]=i;
	ld sumv2=0;
	do{
		ld sumv=0;
		fu(i,2,n)sumv+=Dis(P[A[i]],P[A[i-1]]);
		sumv2+=sumv;
		cnt++;
	}while(next_permutation(A+1,A+1+n));
	cout<<prec(10)<<sumv2/cnt;
	
	
	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	if(fopen("locin.txt", "r"))INPUT;
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	} 		
}

Measured memory_bytes: 2304
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N,M;cin>>N>>M;
  vector<int>cnt(M,0);
  for (int i=0;i<N;++i){
    int K;cin>>K;
    for (int j=0;j<K;++j){
      int A[K];cin>>A[j];--A[j];
      ++cnt[A[j]];
    }
  }
  int ans=0;
  for (int i=0;i<M;++i){
    if (cnt[i]==N)++ans;
  }
  cout<<ans<<endl;
}
    


Measured memory_bytes: 256
if __name__ == '__main__':
    a = int(input())
    list = []
    list2=[]
    for i in range(a):
        b = int(input())
        list.append(b)
        list2.append(b)
    list.sort(reverse=True)
    for i in list2:
        if i == list[0]:
            print(list[1])
        else:
            print(list[0])

Measured memory_bytes: 14140
import java.util.Scanner;

public class Main {
	static char[] cArray;
	static int N;

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        N = S.length();
        cArray = S.toCharArray();

        long w = 0;
        long cnt = 0;
        for(int i = N-1; i>=0; i--) {
            if(cArray[i] == 'W') w++;
            if(cArray[i] == 'B') cnt = cnt + w;
        }

        System.out.println(cnt);
        sc.close();

	}

}

Measured memory_bytes: 27080
import java.util.Scanner;

class Dice {
    int[] dn = new int[6];

    Dice(int[] d) {
        for (int i = 0; i < 6; i++) {
            dn[i] = d[i];
        }
    }

    void turnN() {
        int x = dn[0];
        dn[0] = dn[1];
        dn[1] = dn[5];
        dn[5] = dn[4];
        dn[4] = x;
    }

    void turnS() {
        int x = dn[0];
        dn[0] = dn[4];
        dn[4] = dn[5];
        dn[5] = dn[1];
        dn[1] = x;
    }

    void turnW() {
        int x = dn[0];
        dn[0] = dn[2];
        dn[2] = dn[5];
        dn[5] = dn[3];
        dn[3] = x;
    }

    void turnE() {
        int x = dn[0];
        dn[0] = dn[3];
        dn[3] = dn[5];
        dn[5] = dn[2];
        dn[2] = x;
    }

    void sideturn() {
        int x = dn[1];
        dn[1] = dn[2];
        dn[2] = dn[4];
        dn[4] = dn[3];
        dn[3] = x;
    }

    static boolean judge(Dice d1, Dice d2) {
        boolean a = false;

        a = a || check(d1, d2);
        d2.turnN();
        a = a || check(d1, d2);
        d2.turnE();
        a = a || check(d1, d2);
        d2.turnE();
        a = a || check(d1, d2);
        d2.turnE();
        a = a || check(d1, d2);
        d2.turnN();
        a = a || check(d1, d2);

        return a;
    }
    
    static boolean check(Dice d1, Dice d2) {
        boolean b = false;
        if (d1.dn[0] == d2.dn[0] && d1.dn[5] == d2.dn[5]) {
            for (int i = 0; i < 4; i++) {
                b = b || check2(d1, d2);
                d2.sideturn();
            }
        }
        return b;
    }
    
    static boolean check2(Dice d1, Dice d2) {
        boolean c = true;
        for (int i = 1; i < 5; i++) {
            c = c && d1.dn[i] == d2.dn[i];
        }
    
        return c;
    }
}

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[6];
        Dice[] dc = new Dice[n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 6; j++) {
                num[j] = sc.nextInt();
            }
            dc[i] = new Dice(num);
        }

        boolean ans = false;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i > j) {
                    ans = ans || Dice.judge(dc[i], dc[j]);
                }
            }
        }

        if (ans) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 28992
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)
#define add(x,y)(x=(x+y)%MOD)

ll a[200010];
int main(){
	int n;
	scanf("%d",&n);
	ll sum=0;
	rep(i,0,n){
		scanf("%lld",a+i);
		sum^=a[i];
	}
	rep(i,0,n)printf("%lld ",sum^a[i]);
}

Measured memory_bytes: 3984
#define ENABLE_LL
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std;

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr; typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; } char nextChar(){ char r; ist>>r; return r;} }; Scanner sc(cin);
void ALERT(bool judgememt, const char* phrase) { if (judgememt) { puts(phrase); throw "ALERT"; } }
bool alert(bool judgememt, const char* phrase) { if (judgememt) puts(phrase); return judgememt; }


void init() {
     
}

void solve() {
    long double a, b;
    cin >> a >> b;
    long long c = (long long)(a*b);
    cout << c << endl;
}


#ifdef ENABLE_LL
#undef int
#endif
int main(){
#ifndef CUSTOM_MAIN
#ifdef MULTIPLE_TEST_CASES_WITH_T

int T; scanf("%d",&T); while(T--) {init(); solve();}

#else
#ifdef MULTIPLE_TEST_CASES_WITHOUT_T

while(1) {try{init(); } catch(bool t){return 0;} solve(); }

#else

init(); solve();

#endif
#endif
#endif
    return 0;
}



Measured memory_bytes: 3712
from itertools import accumulate

n,k = map(int, input().split())
p = list(map(int, input().split()))
cumsum = [0] + list(accumulate(p))
ans = 0
for i in range(n-k+1):
  tmp = cumsum[k+i] - cumsum[i]
  ans = max(ans,tmp)
ans = (ans + k) / 2
print(ans)

Measured memory_bytes: 25152
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int  n = sc.nextInt();
		int[] A = new int[n+1];
		int[] B	= new int[n];
		int[] C = new int[10001];
		
		for (int i=1; i<n+1; i++){
			A[i] = sc.nextInt();
			C[A[i]]++;
		}
		for (int i=1; i<10001; i++){
			C[i] = C[i] + C[i-1];
		}
		for (int i=n; i>=1; i--){
			B[C[A[i]]-1] = A[i];
			if(C[A[i]] > 0) C[A[i]]--;
		}

		StringBuilder sb = new StringBuilder();
		sb.append(B[0]);
		for (int i=1; i<n; i++) sb.append(" "+B[i]);
		System.out.println(sb);
	}
}



Measured memory_bytes: 549808
n=int(input())
alist=list(map(int,input().split()))


alist.sort()

hurui=[0]*(alist[-1]+1)

for i in range(n):
    for j in range(1,alist[-1]//alist[i]+1):
        hurui[alist[i]*j]+=1
ans=0
for i in range(n):
    if hurui[alist[i]]==1:
        ans+=1
print(ans)


Measured memory_bytes: 32376
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

//macro
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define EPS (1e-8)
#define equals(a,b)(fabs((a)-(b))<EPS)

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;
//func
template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main() {
	REP(i, 3) {
		REP(j, 3) {
			char c = IN<char>();
			if (i == j)cout << c;
		}
	}
	cout << endl;
}

Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)                  cerr<<#x<<": "<<x<<endl
#define trace2(x, y)              cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)              cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)          cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)     cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    char c;
    cin >> c;
    string s="aeiou";
    for(ll i=0; i<5; i++){
        if(s[i]==c){
            cout << "vowel";
            return 0;
        }
    }
    cout << "consonant";
    return 0;
}
/* The judge is never wrong! Your code is buggy 
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	unsigned long long int h;
	cin>>h;
	int bit=0;
	unsigned long long int ans=0;
	unsigned long long int i=1;
	while(h>=1)
	{
		h=h/2;
		ans+=i;
		i=i*2;
	}
	cout<<ans;
}

Measured memory_bytes: 3636
N=300005
n,m,nums=map(int,input().split())
x=[0 for i in range(nums)]
y=[0 for i in range(nums)]
rows=[0 for i in range(N)]
cols=[0 for i in range(N)]
for i in range(nums):
    xx,yy=map(int,input().split())
    x[i]=xx
    y[i]=yy
    rows[xx]+=1
    cols[yy]+=1
cnt_row=0
cnt_col=0
max_row=0
max_col=0
for i in range(N):
    if(rows[i]>max_row):
        max_row=rows[i]
        cnt_row=0
    if(rows[i]==max_row):
        cnt_row+=1
for i in range(N):
    if(cols[i]>max_col):
        max_col=cols[i]
        cnt_col=0
    if(cols[i]==max_col):
        cnt_col+=1
ans=max_row+max_col
cnt=0
for i in range(nums):
    if(rows[x[i]]==max_row and cols[y[i]]==max_col):
        cnt+=1
if(cnt==cnt_row*cnt_col):
    ans-=1
print(ans)

Measured memory_bytes: 37384
#include<bits/stdc++.h>
using namespace std;
const int maxn=200009;

int n,K;
int a[maxn];

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

Measured memory_bytes: 4468
SIZE = 3
A = [[int(i) for i in input().split()] for j in range(SIZE)]
N = int(input())
B = [int(input()) for j in range(N)]


def rotate_counterclockwise(matrix):
    """2次元リストを反時計回りに回転"""
    return list(map(list, zip(*matrix)))[::-1]


for b in B:
    for row in range(SIZE):
        for col in range(SIZE):
            if A[row][col] == b:
                A[row][col] = 0
ans = 'No'
for _ in range(2):
    # 行と対角成分のそれぞれについて、和が 0 になったらビンゴとなる
    for row in range(SIZE):
        if sum(A[row]) == 0:
            ans = 'Yes'
    if sum(A[k][k] for k in range(SIZE)) == 0:
        ans = 'Yes'
    # カードを回転させることで、同じ処理を使い回す
    A = rotate_counterclockwise(A)

print(ans)

Measured memory_bytes: 3188
// https://atcoder.jp/contests/abc167/tasks/abc167_d

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DEBUG 1
#if DEBUG
  #define _GLIBCXX_DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

const int N_MAX = 2*1e5;
const ll K_MAX = 1e18;

int N;
ll K;
vector<int> A;

vector<int> path;
vector<int> dist;

int main() {
  cin >> N >> K;
  A = vector<int>(N);
  REP(i, N) {
    int a;
    cin >> a;
    A[i] = a - 1;
  }

  path = vector<int>(N, -1);
  dist = vector<int>(N, -1);

  int v = 0;
  int d = 0;
  while (dist[v] < 0) {
    path[d] = v;
    dist[v] = d;
    v = A[v];
    d++;
  }

  // DUMP(path);
  // DUMP(dist);

  int m = d - dist[v];
  int r = dist[v];
  if (K >= d) K = r + (K - r) % m;
  cout << (path[K] + 1) << endl;
}


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

int main() {
    string s;
    cin >> s;
    if(s.at(s.size()-1) == 's') cout << s << "es" << endl;
    else cout << s << "s" << endl;
    return 0;
}

Measured memory_bytes: 3628
//
//  main.cpp
//  AOJ-1172
//
//  Created by Kenta Kodera on 2017/06/18.
//  Copyright ?? 2017??´ Kenta Kodera. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
#include <ctype.h> // isdigit
#include <cassert>
using namespace std;

bool isprime(int n){
  int n_ = sqrt(n);
  
  if(n == 2){
    return true;
  }else if(n%2 == 0){
    return false;
  }else {
    int i = 3;
    while(i <= n_){
      if(n%i == 0){
        return false;
      }
      i += 2;
    }
  }
  return true;
}


int main(){
  
  int n;
  while(cin >> n, n){
    int ans=0;
    for(int i=n+1; i<=2*n; i++){
      if(isprime(i)){
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3056
#include <iostream>
using namespace std;
int main(void){
int x,y;
while(1){
cin>>x>>y;
    if(x==0&&y==0)break;
    if(x>y){
cout<<y<<" "<<x<<endl;
}
else{
    cout<<x<<" "<<y<<endl;
}

}
}



Measured memory_bytes: 3000
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <string>
#include <list>
#include <deque>
#include <math.h>
using namespace std;

typedef pair<int, int> P;
#define ll long long
#define int ll
#define INF (1LL<<30)

int n, c[50][26];
signed main(){

	cin >> n;
	for (int i = 0; i < n; i++){
		string s;
		cin >> s;

		for (int j = 0; j < s.length(); j++){
			c[i][s[j] - 'a']++;
		}
	}

	for (int i = 0; i < 26; i++){

		int r = INF;
		for (int j = 0; j < n; j++){
			if (c[j][i] < r) r = c[j][i];
		}

		for (int k = 0; k < r; k++){
			cout << (char)('a' + i);
		}
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
int main(){   
   int n;
   cin>>n;
   vector<string>s(n);
   vector<long double>a(n);
   long double sum=0.0;
   rep(i,n){
      cin>>a[i]>>s[i];
      if(s[i]=="JPY") sum+=a[i];
      else if(s[i]=="BTC") sum+=a[i]*380000.0;
   }
   cout<<sum<<endl;
   

return 0;
}


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

int main() {
  int A, B, C, D, L, R;
  cin >> A >> B >> C >> D;
  L = A + B;
  R = C + D;
  if (L == R) {
    cout << "Balanced" << endl;
  }
  else if (L > R) {
    cout << "Left" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

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

const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }

 long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }

  ll modPow(ll a, ll b){
        if(b==0)
            return 1LL;
        if(b==1)
            return a%M;
        ll res=1;
        while(b){
            if(b%2==1)
                res=mul(res,a);
            a=mul(a,a);
            b=b/2;
        }
        return res;
    }

int main(){
  long long n;
  cin>>n;
  cout<<mod(modPow(10,n)-2*modPow(9,n)+modPow(8,n));
}
  

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i = 0;i < n;i++)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()

template<class T> bool chmax(T& a,T b){ if(a < b){ a = b; return true; }else return false; }
template<class T> bool chmin(T& a,T b){ if(a > b){ a = b; return true; }else return false; }
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
using vpi = vector<Pi>;
using vpl = vector<Pl>;
 
void lyn(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}
 
#define debug(arr) cout << #arr << " = " << arr << '\n'
#define debug2(a,b) cout << "[" << #a << "," << #b << "] = " << "[" << a << "," << b << "]" << '\n'
template<class T> ostream &operator << (ostream& out, const vector<T>& arr) {
	cout << "{"; for (int i = 0; i < arr.size(); i++)cout << (!i ? "" : ", ") << arr[i]; cout << "}";
	return out;
}
template<class T> ostream &operator << (ostream& out, const vector<vector<T> >& arr) {
	cout << "{\n"; for (auto& vec : arr)cout << "  " << vec << ",\n"; cout << "}";
	return out;
}
template<class S,class T> ostream &operator << (ostream& out, const pair<S,T>& p){
  cout << "{" << p.first << "," << p.second << "}" << '\n';
  return out;
}
template<class T> istream &operator >> (istream& in, vector<T>& arr) {
	for (auto& i : arr)cin >> i; return in;
}

int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(20);
  
  int n;cin >> n;
  vl sum,sub;
  REP(i,n){
    ll x,y;cin >> x >> y;
    sum.eb(x+y);
    sub.eb(x-y);
  }
  
  sort(all(sum));
  reverse(all(sum));
  sort(all(sub));
  reverse(all(sub));
  
  cout << max(sum[0] - sum[n-1],sub[0] - sub[n-1]) << '\n';
  
  return 0;
}


Measured memory_bytes: 6656
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int a, b, h, m;
double sz, fz, cha;
int main()
{
	scanf("%d%d%d%d", &a, &b, &h, &m);
	sz = (h * 60 + m) * 0.5;
	fz = 6 * m;
	cha = fabs(sz - fz);
	if(cha > 180) cha = 360 - cha;
	cha = cha * M_PI / 180;
	printf("%.20f", sqrt(a*a+b*b-2*a*b*cos(cha)));
	return 0;
}

Measured memory_bytes: 4260
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
int main(){
    ll a;
    double b;
    cin>>a>>b;
    ll c=b*100+0.5;
    cout<<a*c/100;
}

Measured memory_bytes: 3716
#include<bits/stdc++.h>
 
using namespace std;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<long long , long long>
#define pb push_back
#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;}
const ll mod = 1e9 + 7;
const ld pi = 3.14159265358979;
 
int run_test(){
    int n,m,x;
    cin >> n >> m >> x;
    int price[n]; 
    vector<int> v[n];
    for(int i=0; i<n; i++){
        cin >> price[i];
        for(int j=0; j<m; j++){
            int t;
            cin >> t;
            v[i].pb(t);
        }
    }
    int ans = 10000000;
    for(int i=0; i < (1 << n); i++){
        int p = 0;
        vector<int> check(m);
        for(int s=0; s<m; s++){
            check[s]  =0;
        } 
        for(int j=0; j<n; j++){
            if(((i >> j) & 1 )== 1){
                p += price[j];
                for(int k = 0; k<m; k++){
                    check[k] += v[j][k];
                }
            }
        }
        bool ok = false;
        for(int l = 0; l<m; l++){
            if(check[l] < x){
                ok = true; break;
            }
        }
        if(ok == false){
            ans = min(ans, p);
        }
    } 
    if(ans == 10000000){
        cout << -1;
    }
    else{
        cout << ans;
    }
    return 0;
}
 
int main(){
    FAST;
    ll t;
    t = 1;
 
    while(t--){
        run_test();
    }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define LL long long
#define FOR(i,c) for(__typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define F first
#define S second
using namespace std;

const LL mod = 1e9 + 7;

template<typename T> T gcd(T a, T b) { return b == 0?a: gcd(b, a % b); }
template<typename T> T LCM(T a, T b) { return a*(b/gcd(a, b)); }
template<typename T> T expo(T base, T e, T mod) { T res = 1;
  while(e > 0) { if(e&1) res = res * base % mod; base = base * base % mod; e >>= 1; }
  return res;
}
template<typename T, typename S> T expo(T b, S e){if(e <= 1)return e == 0?1: b;\
	return (e&1) == 0?expo((b*b), e>>1): (b*expo((b*b), e>>1));}
template<typename T, typename S> T modinv(T a, S mod) { return expo(a, mod-2, mod); }
template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<class T> std::ostream& operator<<(std::ostream &os, const std::vector<T> &t) {
	os<<"["; FOR(it,t) { if(it != t.begin()) os<<", "; os<<*it; } os<<"]";
	return os;
}

const int MAXN = 1e5 + 30;

LL x[MAXN], y[MAXN], n, m;

int main() {
  ios_base::sync_with_stdio(false);
	cin >> n >> m;
	for(int i = 1; i <= n; i++) {
		cin >> x[i];
	}
	for(int i = 1; i <= m; i++) {
		cin >> y[i];
	}
	LL res = 0, two = 0;
	for(int i = 1; i <= n; i++) {
		res += (x[i] * (n - i)) % mod;
		res -= (x[i] * (i - 1)) % mod;
		res %= mod;
		if(res < 0) res += mod;
	}
	for(int i = 1; i <= m; i++) {
		two += (y[i] * (m - i)) % mod;
		two -= (y[i] * (i - 1)) % mod;
		two %= mod;
		if(two < 0) two += mod;
	}
	res = (res * two) % mod;
	cout << res << '\n';
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main()
{
    int n;
    cin >> n;
    int a[n + 2];
    rep(i, 1, n + 1) cin >> a[i];

    a[0] = a[n + 1] = 0;
    ll sum[n + 1];
    sum[0] = abs(a[1] - a[0]);
    rep(i, 1, n + 1) {
        sum[i] = sum[i - 1] + abs(a[i + 1] - a[i]);
    }

    rep(i, 1, n + 1) {
        ll ans = sum[n] - abs(a[i + 1] - a[i]) - abs(a[i] - a[i - 1]) + abs(a[i + 1] - a[i - 1]);
        cout << ans << endl;
    }
    return 0;
}


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

int main(){
	int n,x;

	for (;;){
		cin >> n >> x;
		if (n == 0 && x == 0)
			break;
		int count = 0;


		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)
					{
						count++;
					}
				}
			}
		}

		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        
	    int h = x/3600;
    	int m = (x%3600)/60;
	    int s = ((x%3600)%60);
	
	    System.out.println(h+":"+m+":"+s);

    }
    
}


Measured memory_bytes: 26224
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int H, W, N;
  cin >> H >> W >> N;
  int m = max(H, W);
  int ans = (N + m - 1) / m;
  cout << ans << endl;
  return (0 ^ _ ^ 0);
}



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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	int a[n],b[n];
	int c[n]={};
	int x[n]={};
	for(int i=0;i<n;++i){
		cin>>a[i];
		x[a[i]-1]++;
	}
	for(int i=0;i<n;++i){
		cin>>b[i];
		c[b[i]-1]++;
		x[b[i]-1]++;
	}
	int flag=0;
	for(int i=0;i<n;++i){
		if(x[i]>n){
			flag=1;
			break;
		}
	}
	if(flag){
		cout<<"No";
	}else{
		cout<<"Yes"<<"\n";
		int low =0;
		int high = n-1;
		int d[n];
		for(int i=n-1;i>=0;--i){
			if(c[i]>0){
				for(int j=0;j<c[i];++j){
					if(a[low]!=i+1){
						d[low] = i+1;
						++low;
					}else{
						if(a[high]!=i+1){
							d[high] = i+1;
							--high;
						}else{
							int tr=0;
							for(int k=low-1;k>=0;--k){
								if(a[k]!=i+1&&a[high]!=d[k]){
									d[high]=d[k];
									d[k]=i+1;
									--high;
									tr = 1;
									break;
								}
							}
							for(int k=high+1;tr==0&&k<n;++k){
								if(a[k]!=i+1&&a[high]!=d[k]){
									d[high]=d[k];
									d[k]=i+1;
									--high;
									tr = 1;
									break;
								}
							}
						}
					}
				}
			}
		}
		for(int i=0;i<n;++i){
			cout<<d[i]<<" ";
		}
	}
	return 0;
}



Measured memory_bytes: 7568
from collections import deque
s=input()[::-1]
l=[0]*2019
ten=1
sm=0
cnt=0
l[0]=1
for i in range(len(s)):
    sm += int(s[i])*ten
    sm %= 2019
    cnt += l[sm]
    l[sm] += 1
    ten = ten *10 %2019
print(cnt)

Measured memory_bytes: 9676
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_asc(const void* a, const void* b) {
	return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}

int compare_sz_desc(const void* a, const void* b) {
	return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_i64_asc(const void* a, const void* b) {
	return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_i64_desc(const void* a, const void* b) {
	return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}

int compare_c_asc(const void* a, const void* b) {
	return *((char*)a) < *((char*)b) ? -1 : 1;
}

int compare_c_desc(const void* a, const void* b) {
	return *((char*)a) > * ((char*)b) ? -1 : 1;
}

static size_t powSz(const size_t base, const size_t exp) {
	if (exp == 0) {
		return 1;
	}

	if (exp == 1) {
		return base;
	}

	if (exp % 2 == 0) {
		return powSz(base * base, exp / 2);
	}
	else {
		return base * powSz(base, exp - 1);
	}
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
	uint64_t result = 1;

	for (uint64_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static size_t gcdZu(size_t m, size_t n) {
	size_t temp;

	while (m % n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m % n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

int main(void) {
	size_t N,D;
	int32_t X[10][10];

	scanf("%zu %zu", &N, &D);
	for (size_t row = 0; row < N; row++) {
		for (size_t col = 0; col < D; col++) {
			scanf("%"PRId32, &X[row][col]);
		}
	}

	size_t cnt = 0;

	for (size_t i = 0; i < N - 1; i++) {
		for (size_t j = i+1; j < N; j++) {
			size_t dis2 = 0;
			for (size_t c = 0; c < D; c++) {
				dis2 += (X[i][c] - X[j][c]) * (X[i][c] - X[j][c]);
			}

			bool isNumericNum = false;

			for (size_t val = 1; val <= 127; val++) {
				if (val * val == dis2) {
					isNumericNum = true;
					break;
				}
			}

			if (isNumericNum) {
				cnt++;
			}
		}
	}

	printf("%zu\n", cnt);

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<set>
#include<bitset>
#include<cmath>
#include<numeric>
#include<limits>

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
using namespace std;
typedef long long ll;
typedef long long int lli;
static const int MOD = 10000007;
static const int MAX = 100005;


int n;
vector<int> S;

int main(){
  cin >> n;
  int A[n];
  int S = 0;
  rep(i,n) {
    cin >> A[i];
    S += A[i];
  }

  int B[n];
  int init = 0;
  rep(i,n/2) {
    init += A[(i*2+1)];
  }
  B[0] = S - 2*(init);

  REP(i, 1, n) {
    B[i] = 2*A[i-1] - B[i-1];
  }

  rep(i,n) cout << B[i] << " ";
  cout << endl;
}


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

int main() {
  string S;
  cin >> S;
  int n = -1;
  for (int i = 0; i < 4; i++)
  {
    if (n == S.at(i))
    {
      cout << "Bad" << endl;
      break;
    }
    else if (i == 3 && n != S.at(i))
    {
      cout << "Good" << endl;
    }
    else
    {
      n = S.at(i);
    }
  }
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
using ll = long long;

int main() {    
    ll N, C;
    cin >> N >> C;

    ll x[N], v[N];
    for (int i=0; i<N; i++){
        cin >> x[i] >> v[i];
    }

    ll rsum[N+10], lsum[N+10], vr=0, vl=0;
    rsum[0] = 0;
    lsum[0] = 0;
    for (int i=0; i<N; i++){
        vr += v[i];
        rsum[i+1] = max(rsum[i], vr-x[i]);
        vl += v[N-i-1];
        lsum[i+1] = max(lsum[i], vl-(C-x[N-i-1]));
    }
    
    ll ans=0;
    for (int i=0; i<N+1; i++){
        ll sum = rsum[i] + lsum[N-i];

        ll rcal = x[i-1];
        if (i == 0) rcal = 0;
        ll rans = sum - rcal;
        
        ll lcal = C - x[i];
        if (i == N) lcal = 0;
        ll lans = sum - lcal;

        ans = max({ans, rans, lans});
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328