akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main()
{
    int D;
	int N;
	int num = 1;
	int ans;
	
	cin >> D >> N;
    for (int i=0; i < D; ++i) {
		num *= 100;
	}
    if (num == 1) {
        if (N == 100) {
			ans = N + 1;
		} else {
			ans = N;
		}
    } else {
        if (N == 100) {
			ans = num * (N + 1);
		} else {
			ans = num * N;
		}
    }
    cout << ans << endl;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
 
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair
 
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    cout << 60*(h2-h1) + (m2-m1) - k;
    return 0;
}


Measured memory_bytes: 3668
import java.util.Scanner;


class Main {
	public static void main(String args[]) {
		
	Scanner sc = new Scanner(System.in);
	String  t = sc.next();
	int a = Integer.parseInt(t);
	String  y = sc.next();
	int b = Integer.parseInt(y);
	System.out.print( a * b );
	System.out.print( " " );
	System.out.println( a + a + b + b );
	}

}

Measured memory_bytes: 17120
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  if(n%2)cout<<2*n<<endl;
  else cout<<n<<endl;

  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<algorithm>
#define ii pair<int,int>
#define ll long long
using namespace std;
const int N = 200*1000+15;


struct lap{
    int price;
    int quality;
    int pos;
};
bool fun(lap a1,lap a2){
    return a1.price<a2.price;
}
bool is(string number){
    for(int i = 0;i <number[i];i++){
        if(number[i]!='1' && number[i]!='4'){
            return false;
        }
    }
    if(number.find("444")!=number.npos){
        return false;
    }
    if(number[0] =='4'){
        return false;
    }
    return true;
}

int main() {
    int n;cin>>n;
    cout<<"Christmas ";
    for(int i = n;i < 25;i++){
        cout<<"Eve ";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define fr(i,x,y) for(int i=(x);i<=(y);i++)
#define rf(i,x,y) for(int i=(x);i>=(y);i--)
#define frl(i,x,y) for(int i=(x);i<(y);i++)
using namespace std;
const int N=200002;
int n,l[N],r[N];
int id[N],suf[N],smx[N];

void read(int &x){
	char ch=getchar();x=0;
	for(;ch<'0'||ch>'9';ch=getchar());
	for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<3)+(x<<1)+ch-'0';
}

bool cmp(const int q,const int w){
	return l[q]<l[w];
}

int len(int l,int r){
	return max(r-l+1,0);
}

int main(){
	read(n);
	int mnr=1e9,mxl=0,mnl=1e9;
	fr(i,1,n){
		read(l[i]);read(r[i]);
		mnr=min(mnr,r[i]);
		mxl=max(mxl,l[i]);
		id[i]=i;
	}
/*	if (n==2){
		//
	}*/
	sort(id+1,id+1+n,cmp);
	fr(i,1,n) if (r[i]==mnr) mnl=min(mnl,l[i]);
	suf[n]=r[id[n]];
	rf(i,n-1,1) suf[i]=min(suf[i+1],r[id[i]]);
	int ans=0;
	frl(i,1,n)
	 if (l[id[i]]>=mnl) ans=max(ans,len(l[id[i]],mnr)+len(mxl,suf[i+1]));
	ans=max(ans,len(l[id[1]],r[id[1]])+len(l[id[n]],suf[2]));
	int R=r[id[1]];
	frl(i,2,n){
		ans=max(ans,len(l[id[i]],r[id[i]])+len(l[id[n]],min(R,suf[i+1])));
		R=min(R,r[id[i]]);
	}
	ans=max(ans,len(l[id[n]],r[id[n]])+len(l[id[n-1]],R));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(){
  int n,i,max;
  scanf("%d",&n);
  int b[n+1];
  for(i=0;i<n-1;i++)
    scanf("%d",&b[i]);
  max=b[0]+b[n-2];
  for(i=0;i<n-2;i++){
    if(b[i]>b[i+1])
      max+=b[i+1];
    else
      max+=b[i];
  }
  printf("%d\n",max);
  return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int N, D, X, A;
    cin >> N >> D >> X;
    int res = X;
    REP(i, N) {
        cin >> A;
        res += ceil(D, A);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
def myAnswer(N:int,T:list,M:int,P:list,X:list)-> None:
   all_time = sum(T)
   for i in range(M):
      print(all_time - T[P[i]-1] + X[i])

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   T = list(map(int,input().split()))
   M = int(input())
   P = []
   X = []
   for _ in range(M):
      p,x=map(int,input().split())
      P.append(p)
      X.append(x)
   myAnswer(N,T[:],M,P[:],X[:])

if __name__ == '__main__':
   main()

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;

const int INF = 1001001001;

int main() {

    int n;
    cin >> n;
    int max_len = 0;
    int current_len = -1;
    ll prev = INF;

    rep(i, n) {
        ll h;
        cin >> h;
        if (h > prev) {
            current_len = 0;
        } else {
            current_len++;
            max_len = max(max_len, current_len);
        }
        prev = h;
    }

    cout << max_len << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
 
using namespace std;
 
int main() {
  string n;
  int k;
  cin >> n >> k;
  vector<bool> b(10);
  for(int i = 0; i < k; i++) {
    int a;
    cin >> a;
    b[a] = true;
  }
  vector<int> c;
  for(int i = 0; i < 10; i++) if(!b[i]) c.push_back(i);
  bool v = true;
  for(int i = 0; i < n.size(); i++) {
    auto it = lower_bound(c.begin(), c.end(), n[i] - '0');
    if(it == c.end()) v = false;
    if(n[i] - '0' != *it) v = false;
  }
  if(v) {
    cout << n << endl;
    return 0;
  }
  auto it = upper_bound(c.begin(), c.end(), n[0] - '0');
  if(it == c.end()) {
    if(c[0] == 0) {
      cout << c[1];
      for(int i = 0; i < n.size(); i++) cout << c[0];
      cout << endl;
      return 0;
    } else {
      for(int i = 0; i < n.size() + 1; i++) cout << c[0];
      cout << endl;
      return 0;
    }
  } else {
    cout << *it;
    for(int i = 0; i < n.size() - 1; i++) cout << c[0];
    cout << endl;
    return 0;
  }
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL);
    int res = 1e9;
    int n; cin >> n;
    for(int i = 1; i <= n; i++) {
        int cnt = 0, x;
        for(cin >> x; x % 2 == 0; x /= 2) cnt++;
        res = min(res, cnt);
    }
    cout << res;
}


Measured memory_bytes: 256
//Utkarsh.25dec
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
// bool vis[N];
vector <int> adj[N];
void solve()
{
    ll n,m,v1,p;
    cin>>n>>m>>v1>>p;
    vl v;
    map <ll,ll> cnt;
    map <ll,ll> vis;
    ll sum[n+1]={0};
    rep(i,n)
    {
        ll c;
        cin>>c;
        v.pb(c);
        cnt[c]++;
    }
    sort(all(v));
    for(int i=0;i<n;i++)
    {
        if(i==0)
            sum[i]=v[i];
        else
            sum[i]=sum[i-1]+v[i];
    }
    ll smreq=(n-p);
    ll ans=0;
    for(int i=n-1;i>=0;i--)
    {
        if(vis[v[i]])
            continue;
        vis[v[i]]=1;
        if(n-i<=p)
        {
            ans+=cnt[v[i]];
            continue;
        }
        ll temp=v1;
        temp-=(i+1);
        temp-=(p-1);
        temp*=m;
        auto it=upper_bound(all(v),v[i]+m);
        ll ahead=v.end()-it;
        if(ahead>=p)
            continue;
        ll t=n-p-(i+1)+1;
        ll det=t*(m+v[i])-(sum[n-p]-sum[i]+temp);
        if(det>=0)
            ans+=cnt[v[i]];
    }
    cout<<ans<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
}

Measured memory_bytes: 26100
import java.util.Scanner;

public class Main {

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

		for(int i = 0; i < n; i++) {
			a += sc.nextInt();
			if(h <= a) {
				System.out.println("Yes");
				return;
			}
		}

		System.out.println("No");

		return;

	}

}



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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

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

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

const ll MOD = TEN(9) + 7;

int main() {
	int N; ll K; cin >> N >> K;
	vi A(N);
	rep(i, N) cin >> A[i];
	ll ans = 0;

	rep(i, N) {
		rep(j, N) {
			if (A[i] > A[j]) {
				ll t = (i < j ? K * (K + 1) / 2 : (K - 1) * K / 2);
				ans += t;
				ans %= MOD;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<vector>
#include <algorithm>

using namespace std;

int main(){

  int i,j,k,N,c,rmax,gmax;
  int R[2000],G[2000];
  long ans;
  string S;
  string dammy;

  cin>>N;
  cin>>S;

  ans = 0;
  gmax=0;
  rmax=0;
  
  for(i=0;i<N;i++){
    //if(S[i]==R){
    dammy=S[i];
    if(dammy=="R"){
      R[rmax]=i;
      rmax+=1;
    }
    else if(dammy=="G"){
      G[gmax]=i;
      gmax+=1;
    }
  }

  c=N-rmax-gmax;
  //cout<<"rmax = "<<rmax<<endl;
  //cout<<"gmax = "<<gmax<<endl;
  
  for(i=0;i<rmax;i++){
    for(j=0;j<gmax;j++){
      ans+=c;

      k=2*G[j]-R[i];
      //cout<<k<<endl;
      if(k>(N-1) or k<0){
      }
      else{
      dammy=S[k];
      if(dammy=="B")ans-=1;
      }
      
      k=2*R[i]-G[j];
      //cout<<k<<endl;
      if(k>(N-1) or k<0){
      }
      else{
      dammy=S[k];
      if(dammy=="B")ans-=1;
      }

      k=(G[j]+R[i])/2;
      //cout<<k<<endl;
      if(((G[j]+R[i])%2)!=0){
      }
      else{
      dammy=S[k];
      if(dammy=="B")ans-=1;
      }

    }
  }

  cout << ans<< endl;  

  return 0;
}


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

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

  if(a%2==0 || b%2==0 || c%2==0)cout<<0<<endl;
  else{
    if(a>=b && a>=c)cout<<b*c<<endl;
    else if(b>=a && b>=c)cout<<c*a<<endl;
    else cout<<a*b<<endl;
  }
}

Measured memory_bytes: 256
s = int(input())

def f(n):
	if n % 2 ==0:
		return int(n / 2)
	else:
		return 3 * n + 1

a = [s]

for i in range(1000000):
	if f(a[i]) in a:
		print(i + 2)
		break
	a.append(f(a[i]))

Measured memory_bytes: 3060
package main

import (
	"fmt"
)

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)

	forward := n / (a + b) * a
	back := n % (a + b)
	if a < back{
		back = a
	}

	fmt.Println(forward + back)
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>

using namespace std;

int n;

bool isPrim(int x) {
    for (int i = 2; i * i <= x; i++) {
        if (x % i == 0) return false;
    }
    return true;
}

int main() {
    scanf("%d", &n);
    int ans = 0;
    while (n--) {
        int num;
        scanf("%d", &num);
        if (isPrim(num)) ans++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
    public static void main(String arg[]) {
        Scanner sc = new Scanner(System.in);
        
        
        for(int i = 1; i < 10000; i++) {
            
            int a = sc.nextInt();
            String op = sc.next();
            int b = sc.nextInt();
            //????????¢??°????????????
            if(op.equals("?")) {
                break;                
            }else if(op.equals("+") || op.equals("-") || op.equals("*") || op.equals("/")) {
                Calculator(a,op,b);
            }else {
                break;
            }
            
        }
    }
    
    public static void Calculator(int a, String op, int b) {
        if(calcJudge(a,op,b)) {
            if(op.equals("+")) {
                System.out.println(a + b);
            }else if(op.equals("-")) {
                System.out.println(a - b);
            }else if(op.equals("*")) {
                System.out.println(a * b);
            }else if(op.equals("/") && b != 0) {
                System.out.println(a / b);
            }else if(op.equals("/") && b == 0) {
                System.out.println("0??????????????????????????\????????????");
            }else {
                System.out.println("??£??????????????\????????????????????????");
            } 
        }
    }
        
    public static boolean calcJudge(int a, String op, int b) {
        if(a < 0 || b < 0 || a > 20000 || b > 20000) {
            return false;
        }else return true;
    }
}

Measured memory_bytes: 26224
#2回目


n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[-1]*n

for i in range(min(k,n)):
    dp[i]=abs(h[i]-h[0])
#print(dp)

for i in range(k,n):
    #print(i)
    mindp=10**9
    for j in range(i-k,i):
        #print(j)
        mindp=min(mindp , abs(h[i]-h[j])+dp[j])
        
    dp[i]=mindp
 #   print(dp[i])
#print(dp)
print(dp[-1])



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

using namespace std;

typedef long long ll;

int main(){
  ll N;
  ll i;
  cin >> N; //10^n-2*9^n-8^n
  ll a = 1;
  ll b = 1;
  ll c = 1;
  for(i=0;i<=N-1;i++) a = 10 * a % 1000000007;
  for(i=0;i<=N-1;i++) b = 9 * b % 1000000007;
  for(i=0;i<=N-1;i++) c = 8 * c % 1000000007;
  ll ans = (a - 2 * b + c) % 1000000007;
  if(ans < 0) ans += 1000000007;
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
const int P=924844033;
int n,d,len=1,f[N][2],g[N][2];
long long fac[N];
int main(){
	scanf("%d%d",&n,&d),fac[0]=fac[1]=f[0][0]=g[0][0]=1;
	for(int i=2;i<=n;i++)	fac[i]=fac[i-1]*i%P;
	for(int i=1;i<=d;i++){
		for(int j=1;j<=len;j++)
			g[j][0]=(g[j][0]+g[j][1])%P,g[j][1]=0;
		for(int j=i+d;j<=n;j+=d,++len){
			for(int k=1;k<=len;k++){
				f[k][0]=(g[k][0]+g[k][1])%P;
				f[k][1]=g[k-1][0];
			}
			for(int k=1;k<=len;k++){
				g[k][0]=f[k][0];
				g[k][1]=f[k][1];
			}
		}
	}
	for(int i=d+1;i<=d*2;i++){
		for(int j=1;j<=len;j++)
			g[j][0]=(g[j][0]+g[j][1])%P,g[j][1]=0;
		for(int j=i;j<=n;j+=d,++len){
			for(int k=1;k<=len;k++){
				f[k][0]=(g[k][0]+g[k][1])%P;
				f[k][1]=g[k-1][0];
			}
			for(int k=1;k<=len;k++){
				g[k][0]=f[k][0];
				g[k][1]=f[k][1];
			}
		}
	}
	long long ans=fac[n];
	for(int i=1;i<=n;i++)
		ans=(ans+(i&1?-1:1)*fac[n-i]*(f[i][0]+f[i][1])%P)%P;
	printf("%lld\n",(ans+P)%P);
	return 0;
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(){
    int a[4][50],b[4][50],hit,blow,n;
    n = 0;
    while(cin >> a[0][n] >> a[1][n] >> a[2][n] >> a[3][n] 
            >> b[0][n] >> b[1][n] >> b[2][n] >> b[3][n] ){
        n++;
       
    }
    
    for(int i = 0;i < n;i++){
        hit = blow = 0;
        for(int j = 0;j < 4;j++){
            for(int k = 0;k < 4;k++){
                if(a[j][i] == b[k][i]){
                    if(j == k){
                        hit++;
                    }
                    else{
                        blow++;
                    }
                }
            }
        }
        cout << hit << " " << blow << endl;
    }
}


Measured memory_bytes: 3004
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	i64 A, B;
	cin >> A >> B;
	cout << (A >= 13 ? B : A >= 6 ? B / 2 : 0) << endl;
	return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 6)


def main():
    x=int(input())
    if x==1:
        print(1)
        exit()
    ans=0
    for b in range(2,33):
        for p in range(2,11):
            if b**p>x:break
            ans=max(ans,b**p)
    print(ans)

main()

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
#define f first
#define s second
using namespace std;
const int INF=(int)0x3f3f3f3f;
const int MOD=(int)1e9+7;
const double eps=1e-9;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<b-a+1-(b/c-(a-1)/c+b/d-(a-1)/d-b/(c*d/__gcd(c,d))+(a-1)/(c*d/__gcd(c,d)));
    return 0;
}



Measured memory_bytes: 3604
#include<iostream>
#include<vector>
using namespace std;
int main(){
    long long int n,x;
    cin>>n>>x;
    vector<long long int>a(n);
    for(long long int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    long long int count=0;
    for(long long int i=0;i<n-1;i++)
    {
        if(a[i]+a[i+1]>=x){
            if(a[i]>x){
                long long int temp=a[i];
                a[i]=x;
                count+=temp-a[i];
                count+=a[i+1];
                a[i+1]=0;
            }
            else{
                long long int temp=a[i+1];
                a[i+1]=x-a[i];
                count+=temp-a[i+1];
            }
        }
    }
    cout<<count;
}

Measured memory_bytes: 3984
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>
#include <iterator>
#include <cassert>

using namespace std;

#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

#define Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;




/*for文でx,yを上下左右確認するやつだよ。正直使いづらいよ。

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


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}

*/

/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}

*/

/*2重for文書くのめんどくなった時用だよ。

for (int i = 0; i < h; ++i) {
	for (int j = 0; j < w; ++j) {

	}
}

*/



int main() {
	int n; cin >> n;
	ll a[114514];
	ll b[114514];

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

	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	ll tmp = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] <= b[i]) {
			tmp += a[i];
			b[i] -= a[i];
			a[i] = 0;
			if (a[i + 1] <=b[i] ) {
				tmp += a[i+1];
				b[i] -= a[i];
				a[i + 1] = 0;
			}
			else {
				tmp += b[i];
				a[i + 1] -= b[i];
			}
		}
		else {
			tmp += b[i];
			a[i] -= b[i];
		}
	}


	cout << tmp << endl;


	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FOR(x, to) for(x=0; x<(to); x++)
using namespace std;

int main(){
    int N, X, i;
    cin >> N >> X;
    vector<int> L(N);
    FOR(i, N){
        cin >> L[i];
    }

    int count=1, D=0;
    for(i=0; i<N; i++){
        D += L[i];
        if(D <= X){
            count++;
        }else{
            break;
        }
    }
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Set<String> s = new HashSet<String>();
    for(int i=0;i<n;i++){
      String d = sc.next();
      s.add(d);
    }
    System.out.println(s.size());
  }
}

Measured memory_bytes: 78372
#include <iostream>
#include <stdio.h>
#include <math.h> 
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>
#include <numeric>
#include <bitset>
#include <queue>
#include <map>

using namespace std;

int main()
{
	vector<int> mnt;

	int n = 0;
	cin >> n;

	for (int i = 0; i < n; ++i) {
		int tmp = 0;
		cin >> tmp;
		mnt.push_back(tmp);
	}

	int ans = 1;

	vector<int> tmp;
	tmp.push_back(mnt[0]);

	for (int i = 1; i < n; ++i) {
		//最初を除く今見ている値が、それまでの最大値を超えているときにカウンタを増やす
		tmp.push_back(mnt[i]);
		sort(tmp.begin(), tmp.end(), std::greater<int>());
		if (mnt[i] >= tmp[0]) {
			ans++;
		}


	}

	cout << ans << endl;


}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

const ll mod = 1000000007;
ll fact[200200];
ll invfact[200200];

inline ll take_mod(ll a) { return (a % mod + mod) % mod; }

inline ll add(ll a, ll b) { return take_mod(a + b); }

inline ll sub(ll a, ll b) { return take_mod(a - b); }

inline ll mul(ll a, ll b) { return take_mod(a * b); }

inline ll pow(ll x, ll n) {
  ll res = 1LL;
  while (n > 0) {
    if (n & 1) res = mul(res, x);
    x = mul(x, x);
    n >>= 1;
  }
  return res;
}

ll mod_inv(ll x) { return pow(x, mod - 2); }

void make_fact(ll n) {
  fact[0] = 1;
  ll res = 1;
  for (int i = 1; i <= n; i++) {
    fact[i] = res;
    res = mul(res, i + 1);
  }
}

void make_invfact(ll n) {
  invfact[0] = 1;
  invfact[n] = mod_inv(fact[n]);
  for (int i = n - 1; i >= 1; i--) {
    invfact[i] = mul(invfact[i + 1], i + 1);
  }
}

ll perm(ll n, ll k) { return mul(fact[n], invfact[n - k]); }

ll comb(ll n, ll k) { return mul(mul(fact[n], invfact[n - k]), invfact[k]); }

int main() {
  ll N, M;

  cin >> N >> M;

  if(abs(N - M) >= 2){
    cout << 0 << endl;
    return 0;
  }

  make_fact(100100);

  ll inu = fact[N];
  ll sru = fact[M];
  ll ans = mul(inu, sru);
  if (N == M) ans = mul(ans, 2);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <stdlib.h>
#include <functional>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <set>
#include <queue>
#include <map>
using namespace std;
int main(){
	int n,a,b;
	cin>>n>>a>>b;
	string s;
	cin>>s;
	int ab=0,bb=0;
	for(int i=0;i<n;i++){
		if(s[i]=='a'){
			if(ab<a+b){
				cout<<"Yes"<<endl;
				ab++;
			}
			else{
				cout<<"No"<<endl;
			}
		}
		else if(s[i]=='b'){
			if(ab<a+b&&bb<b){
				cout<<"Yes"<<endl;
				ab++;
				bb++;
			}
			else{
				cout<<"No"<<endl;
				bb++;
			}
		}
		else{
			cout<<"No"<<endl;
		}
	}
    return 0;
}

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

using namespace std;

vector<int>v;

void go(){
	int n; cin>>n;
	for(int i=0; i<n;i++) {int x; cin>>x; v.push_back(x);}
	
	int ini = 0;
	int ans = 0;
	
	for(int i=1; i<n;i++){
		if(v[i] > v[i-1]){
			ans = max(ans , i- 1 - ini);
			ini = i;
		}
	}
	ans = max(ans , n-1 - ini);
	cout<<ans<<"\n";
}

int main() {
	go();
    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  ll N;
  cin >> N;
  vector<ll> D(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> D.at(i);
  }

  ll ans = 0;
  for (ll i = 0; i < N; i++)
  {
    for (ll j = i + 1; j < N; j++)
    {
      ans += D.at(i) * D.at(j);
    }
  }
  cout << ans << endl;
}

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


int main() {

  int64_t a,b,c,k;
  cin>>a>>b>>c>>k;

  //偶数回はA-B
  //奇数回はB-A

  int64_t out;
  if(k%2==0){
    out=a-b;
  }else{
    out=b-a;
  }

  if(abs(out)>1000000000000000000)
    cout<<"Unfair"<<endl;
  else
    cout<<out<<endl;

  return 0;
}

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

////////////
// ModInt //
////////////

// 四則演算の最も左に存在する値がModIntでなければキャストでバグる
// 例えばx = mint * 1000;やx = ModInt(1000) * mint;はいいがx = 1000 * mint;は駄目。
template<int64_t mod_ = 1'000'000'007>
class ModInt {
private:
	int64_t integer_;

public:
	constexpr ModInt(const int64_t initial_number = 0)
		: integer_(initial_number){}
	
	// 四則演算
	constexpr ModInt operator+(const ModInt& operand) const
	{
		ModInt ret{this->integer_ + operand.integer_};
		if (ret.integer_ >= mod_)
			ret.integer_ -= mod_;
		return ret;
	}
	constexpr ModInt operator-(const ModInt& operand) const
	{
		ModInt ret{this->integer_ - operand.integer_};
		if (ret.integer_ < 0)
			ret.integer_ += mod_;
		return ret;
	}
	constexpr ModInt operator*(const ModInt& operand) const
	{
		return {this->integer_ * operand.integer_ % mod_};
	}
	constexpr ModInt operator/(const ModInt& operand) const
	{
		return *this * (operand ^ (mod_ - 2));
	}

	// 単項演算子
	constexpr ModInt& operator++()
	{
		if (integer_ + 1 == mod_) integer_ = 0;
		else integer_++;
		return *this;
	}

	constexpr ModInt& operator--()
	{
		if (integer_ == 0) integer_ = mod_ - 1;
		else integer_--;
		return *this;
	}

	constexpr ModInt operator+()
	{
		return *this;
	}

	constexpr ModInt operator-()
	{
		if (integer_ == 0) return ModInt(0ll);
		else return ModInt(mod_ - integer_);
	}

	// 累乗
	constexpr ModInt operator^(const int64_t operand) const
	{
		ModInt ret{1}, pow_ope{this->integer_};
		for (int64_t pow{operand}; pow > 0; pow >>= 1)
		{
			if (pow & 1) ret *= pow_ope;
			pow_ope *= pow_ope;
		}
		return ret;
	}

	// 代入
	constexpr ModInt& operator=(const ModInt& operand)
	{
		this->integer_ = operand.integer_;
		return *this;
	}
	constexpr ModInt& operator+=(const ModInt& operand)
	{
		*this = *this + operand;
		return *this;
	}
	constexpr ModInt& operator-=(const ModInt& operand)
	{
		*this = *this - operand;
		return *this;
	}
	constexpr ModInt& operator*=(const ModInt& operand)
	{
		*this = *this * operand;
		return *this;
	}
	constexpr ModInt& operator/=(const ModInt& operand)
	{
		*this = *this / operand;
		return *this;
	}

	// その他
	constexpr operator int64_t() { return integer_; }

	constexpr ModInt getOne() const
	{
		return ModInt(1ll);
	}
	constexpr ModInt getZero() const
	{
		return ModInt(0ll);
	}

	static constexpr int64_t mod{mod_};
};
using Mint = ModInt<998'244'353>;

Mint solve();

int main()
{
	std::cout << solve() << std::endl;

	return 0;
}

Mint solve()
{
	int N;
	scanf("%d", &N);
	{
		int first;
		scanf("%d", &first);
		if (first != 0) return Mint(0);
	}
	std::vector<int> D(N);
	D[0] = 1;
	for (int i{1}; i < N; i++)
	{
		int tmp;
		scanf("%d", &tmp);
		D[tmp]++;
	}
	if (D.front() != 1)
		return Mint(0);
	Mint ans(1);
	for (int i{1}; i < N; i++)
		for (int j{}; j < D[i]; j++)
			ans *= Mint(D[i - 1]);
	return ans;
}

Measured memory_bytes: 640
/*
 * main.cpp
 *
 *  Created on: 2019/05/04
 *      Author: family
 */

//#include <iostream>
#include <stdio.h>

//using namespace std;

int main()
{
    int A, B, C = 1;
    int ans = 0;
    scanf("%d %d", &A, &B);

    for(C  = 1; C < 4; C++) {
        if((A*B*C)%2 == 0) {
            //
        } else {
            ans++;
        }
    }
    if(ans == 0) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

int main(){
  int N, f, d;
  scanf("%d", &N);
  d = N;
  
  do{
    f += N%10;
    N /= 10;
  }while(N != 0);
  
  if(d%f == 0){
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  
  return 0;
}

Measured memory_bytes: 128
use strict;
use warnings;
package SuffixArray;
sub sa_is(\@$);
sub sa_is(\@$){
	my@s=@{$_[0]};
	my$upper=$_[1];
	my$n=@s;
	if($n==0){
		return();
	}
	elsif($n==1){
		return(0);
	}
	my@sa;
	my@ls;
	for(my$i=$n-2;$i>=0;$i--){
		$ls[$i]=$s[$i]==$s[$i+1]?$ls[$i+1]:$s[$i]<$s[$i+1];
	}
	my@sum_l=(0)x($upper+1);
	my@sum_s=(0)x($upper+1);
	$ls[$_]?$sum_l[$s[$_]+1]++:$sum_s[$s[$_]]++for 0..$n-1;
	for(0..$upper){
		$sum_s[$_]+=$sum_l[$_];
		$sum_l[$_+1]+=$sum_s[$_]if$_<$upper;
	}
	my$induce;
	$induce=sub{
		my@sa=(-1)x$n;
		my@buf=@sum_s;
		for(@_){
			next if$_==$n;
			$sa[$buf[$s[$_]]++]=$_;
		}
		@buf=@sum_l;
		$sa[$buf[$s[$n-1]]++]=$n-1;
		for(@sa){
			$sa[$buf[$s[$_-1]]++]=$_-1if$_>=1&&!$ls[$_-1];
		}
		@buf=@sum_l;
		for(my$i=$n-1;$i>=0;$i--){
			my$v=$sa[$i];
			$sa[--$buf[$s[$v-1]+1]]=$v-1if$v>=1&&$ls[$v-1];
		}
		return@sa;
	};
	my@lms=grep!$ls[$_-1]&&$ls[$_],1..$n-1;
	my@lms_map;
	my$m=@lms;
	for(0..$m-1){
		$lms_map[$lms[$_]]=$_;
	}
	@sa=$induce->(@lms);
	if($m){
		my@sorted_lms=grep defined$lms_map[$_],@sa;
		my@rec_s;
		my$rec_upper=0;
		$rec_s[$lms_map[$sorted_lms[0]]]=0;
		for(1..$m-1){
			my$l=$sorted_lms[$_-1];
			my$r=$sorted_lms[$_];
			my$end_l=$lms[$lms_map[$l]+1]//$n;
			my$end_r=$lms[$lms_map[$r]+1]//$n;
			my$different;
			if($end_l-$l!=$end_r-$r){
				$different=1;
			}
			else{
				$l++,$r++while$l<$end_l&&$s[$l]==$s[$r];
				$different=$l==$n||$s[$l]!=$s[$r];
			}
			$rec_s[$lms_map[$sorted_lms[$_]]]=$rec_upper+=$different;
		}
		my@rec_sa=sa_is(@rec_s,$rec_upper);
		$sorted_lms[$_]=$lms[$rec_sa[$_]]for 0..$m-1;
		@sa=$induce->(@sorted_lms);
	}
	return@sa;
}
sub suffix_array(\$){
	my@s=map ord,split"",${$_[0]};
	return sa_is(@s,255);
}
package LcpArray;
sub lcp(\@\@){
	my@s=@{$_[0]};
	my$n=@s;
	my@sa=@{$_[1]};
	my@rnk;
	$rnk[$sa[$_]]=$_ for 0..$n-1;
	my@lcp;
	my$h=0;
	for(0..$n-1){
		$h--if$h>0;
		next if$rnk[$_]==0;
		my$j=$sa[$rnk[$_]-1];
		$h++while$j+$h<$n&&$_+$h<$n&&$s[$j+$h]==$s[$_+$h];
		$lcp[$rnk[$_]-1]=$h;
	}
	return@lcp;
}
sub lcp_array(\$\@){
	my@s=map ord,split"",${$_[0]};
	return lcp(@s,@{$_[1]});
}
package main;
my$s=<>;
chomp$s;
my@sa=SuffixArray::suffix_array($s);
my@lcp=LcpArray::lcp_array($s,@sa);
my$ans=@sa*(@sa+1)/2;
$ans-=$_ for@lcp;
print$ans,$/;


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

#define W first
#define V second
#define ll long long int

using namespace std;

const ll INF = 1e18;

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

    vector<ll> weigth(n);
    vector<ll> values(n);

    for(int i=0;i<n;i++){
        cin >> weigth[i] >> values[i];
    }
    
    ll sum=0; for(ll a : values) sum += a;

    vector<ll> dp(sum+1,INF);

    dp[0] = 0;

    for(ll i=0;i<n;i++){
        for(ll j=sum; j>= values[i]; j--){
            dp[j] = min(dp[j],dp[j - values[i]] + weigth[i]);
        }
    }

    ll mx=0;

    for(ll i=0;i<=sum;i++){
        if(dp[i] <= w)
            mx = max(mx,i);
    }

    cout << mx << endl;
}

Measured memory_bytes: 1024
from itertools import combinations
n = int(input())
s = []
for _ in range(n):
    s.append(input())

march = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}
for i in s:
    if i[0] in march:
        march[i[0]] += 1

ans = 0
for i, j, k in combinations(march.values(), 3):
    ans += i*j*k
print(ans)

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e10;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


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

    int ans = 0;
    rep(i, s.size()) {
        if (s[i] == '+') {
            ans++;
        } else {
            ans--;
        }
    }
    cout << ans << endl;

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  	ci(n);
  if(n%10==n/100) co("Yes")
    else co("No")
    }

Measured memory_bytes: 256
def j(cont):
    if int(cont)>=1 and int(cont)<=12:
        return True
    else:
        return False

s = input()
l,r = s[:2],s[2:]
if j(l) is True and j(r) is True:
    print('AMBIGUOUS')
elif j(l) is False and j(r) is False:
    print('NA')
elif j(l) is False and j(r) is True:
    print('YYMM')
else:
    print('MMYY')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define lcm( a, b ) ((a)/__gcd(a,b)*(b))
#define MP make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> iP;
typedef pair< LL, LL > LP;

const int INF = INT_MAX;
const int MIN = INT_MIN;
const LL LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const int SIZE = 300005;

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );
            if( i * i != n ) ret.pb( n / i );

        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n;
    cin >> n;
    int res = 0;
    int d[n];
    for( int i = 0; i < n; ++i ) cin >> d[i];

    for( int i = 0; i < n; ++i ) {
        for( int j = i + 1; j < n; ++j ) {
            res += d[i] * d[j];

        }
    }

    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (K, N) = readLine()!!.split(" ").map(String::toInt)
    val AN = readLine()!!.split(" ").map(String::toInt)

    var ans = K
    for (i in 0 until N) {
        val start = AN[i]
        val goal = AN[(N - 1 + i) % N].let {
            if (it < start) {
                it + K
            } else {
                it
            }
        }

        ans = Math.min(ans, goal - start)
    }
    println(ans)

}





Measured memory_bytes: 82640
import sys

def ep(*params):
    print(*params,file=sys.stderr)

(N,A,B) = list(map(int,input().split()))

times = N // (A+B)
left = N % (A+B)
ba = times * A
if left >= A:
    ba += A
else:
    ba += left
print(ba)
sys.exit()


Measured memory_bytes: 3060
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (n, k) = scan!(usize, usize);

    let mut ans = 0.0;
    for i in 1..n + 1 {
        let mut m = i;
        let mut num = 0;
        for _ in 1.. {
            if m >= k {
                break;
            }
            m *= 2;
            num += 1;
        }
        ans += 1.0 / (n as f64) * (1.0f64 / 2.0).powf(num as f64)
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.*;
import java.lang.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		int result = 0;
		result += n/100;
		result = result * 111;

		System.out.println(n<=result
			?result
			:result==999
				?result+112
				:result+111);




	}
}

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

int main(){
    int X;
    cin >>X;
    int sum = 0;
    while(X>=500){
        X -= 500;
        sum += 1000;
    }
    while(X>=5){
        X -= 5;
        sum += 5;
    }
    cout <<sum<<endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
red=[1]+[0 for _ in range(1,N)]
num=[1]*N

for _ in range(M):
    x,y=map(int,input().split())
    x-=1
    y-=1
    if red[x]>0:
        if num[x]==1:
            red[y]=red[x]
            red[x]=0
        else:
            red[x]=1
            red[y]=1
    num[x]-=1
    num[y]+=1

print(len([True for r in red if r>0]))

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

int main(){
    string S;  cin >> S;
    string day[7] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};

    for(int i=0; i<7; i++){
        if(S == day[i]){
            if(i < 6){
                cout << 6 - i << endl;
            }else if(i==6){
                cout << 7 << endl;
            }
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H, W, A, B;
  cin >> H >> W >> A >> B;
  vector<vector<int>> vec(H,vector<int>(W));
  for(int i=0; i<B; i++){
    for(int j=0; j<A; j++){
      vec.at(i).at(j) = 1;
    }
  }
  for(int i=B; i<H; i++){
    for(int j=A; j<W; j++){
      vec.at(i).at(j) = 1;
    }
  }
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cout << vec.at(i).at(j);
    }
    cout << endl;
  }
}

Measured memory_bytes: 5120
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;

#define rep(i,n) for(int i=0; i<(int)n; ++i)

int n;
int cost[8][8];

inline int encode(const vector<int> &v) {
    int ret = 0;
    for(int i=0; i<v.size(); ++i)
        ret |= (v[i]<<(i*3));
    return ret;
}

inline int get(const int x,int idx) { return 7&(x>>(idx*3)); }

int solve() {
    map<int,int> dist;
    set<int> seen;
    vector<int> s(n);
    for(int i=0; i<n; ++i) s[i] = i;
    dist[encode(s)] = 0;
    priority_queue<pair<int,int>, vector<pair<int,int> >, greater<pair<int,int> > > q; q.push(make_pair(0,encode(s)));

    while(!q.empty()) {
        pair<int,int> p = q.top(); q.pop();
        int d = p.first,st = p.second;

        if(seen.find(st) != seen.end()) continue;
        seen.insert(st);

        for(int i=0; i<n; ++i) s[i] = get(st,i);
        // for(int i=0; i<n; ++i) cout<<s[i]<<" ";
        // cout<<endl;

        for(int i=0; i<n; ++i)
            for(int j=0; j<n; ++j) {
                swap(s[i],s[j]);
                int nd = d+cost[s[i]][s[j]];
                int ns = encode(s);
                if(dist.find(ns) == dist.end() || dist[ns] > nd) {
                    dist[ns] = nd;
                    q.push(make_pair(nd,ns));
                }
                swap(s[i],s[j]);
            }
    }

    int ans = 0;
    for(map<int,int>::iterator it = dist.begin(); it != dist.end(); ++it)
        ans = max(ans, it->second);

//    cout<<dist.size()<<endl;
    return ans;
}

int main() {
    cin>>n;
    rep(i,n) rep(j,n) cin>>cost[i][j];
    cout<<solve()<<endl;
}

Measured memory_bytes: 3528
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int main()
{
    scanf("%d%d",&n,&k);
    ll ans=0;
    if(k==0)
    {
        printf("%lld\n",(ll)n*n);
        return 0;
    }
    for(int b=k+1;b<=n;b++)
    {
        ans+=(b-k);
        int t=n/b;
        if(t) ans+=(t-1)*(b-k);
        if(b*t+k<=n)
            ans+=max(0,n-(b*t+k)+1);
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
n = int(input())
a = []
b = []
for i in range(n):
  aa,bb = map(int,input().split())
  a.append(aa)
  b.append(bb)
a.sort()
b.sort()
if n%2 == 1:
  print(b[n//2]-a[n//2]+1)
else:
  print(b[n//2]+b[n//2-1]-a[n//2]-a[n//2-1]+1)


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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(100000);
    REP(i, n) cin >> h[i];
    const int INF = 1e9;
    vector<int> dp(100000, INF);
    dp[0] = 0;
    for(int i = 0; i < n; i++) {
        for(int j = 1; j <= k; j++) {
            int cost = abs(h[i] - h[i + j]);
            dp[i + j] = min(dp[i + j], dp[i] + cost);
        }
    }
    cout << dp[n - 1] << endl;
}


Measured memory_bytes: 1024
a = int(input())
b = int(input())
c = int(input())
x = int(input())
n = 0

for ai in range(a+1):
    x1 = x - 500*ai
    
    if x1 == 0:
        n += 1
        break
        
    for bi in range(b+1):
        x2 = x1 - 100*bi
        
        if x2 == 0:
            n += 1
            break
        
        for ci in range(c+1):
            x3 = x2 - 50*ci
            
            if x3 == 0:
                n += 1
                break
            

print(n)

Measured memory_bytes: 3064