akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define INFLL 100000000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

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



string s, t;
int dp[3100][3100];

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

  int n = s.size();
  int m = t.size();

  Rep(i, n) {
    Rep(j, m) {
      if (s[i] == t[j]) {
        dp[i+1][j+1] = dp[i][j] + 1;
      } else {
        dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);      
      }
      //cout << dp[i+1][j+1];
    }
    //cout << "\n";
  }

  string ans = "";

  int i = n;
  int j = m;

  while (true) {
    if (i == 0 || j == 0) {
      break;
    }

    if (dp[i][j] == dp[i][j-1]) {
      j--;
    } else if (dp[i][j] == dp[i-1][j]) {
      i--;
    } else {
      ans = s[i-1] + ans;
      i--; j--; 
    }
  }

  cout << ans << "\n";
}

Measured memory_bytes: 37120
#abc087 c
n=int(input())
a1=[0]*(n+1)
a2=[0]*(n+1)
for i in range(2):
    x=list(map(int,input().split()))
    if i==0:
        for j,k in enumerate(x):
            a1[j+1]=a1[j]+k
    else:
        for j,k in enumerate(x):
            a2[j+1]=a2[j]+k


ans=0
for i in range(1,n):
    sum=a1[i]+a2[n]-a2[i-1]
    ans=max(ans,sum)
if n==1:
    ans=a1[1]+a2[1]
print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define ll long long
using namespace std;

const ll mod = 1e9 + 7;

ll C[2005][2005];
ll dp[100005][13];

int main(){
    int a,ans=0,N,m=2*1e5+1;
    cin >> N;
    vector<int> P(N+5,0);
    for (int i = 0; i < N; i++){
        cin >> a;
        m = min(m,a);
        if(a == m)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import numpy as np

k, n = map(int, input().split())
A = list(map(int, input().split()))
A.append(A[0]+k)
A = np.array(A)

A_shift = np.roll(A, -1)
A_diff = A_shift - A
ans = k - np.max(A_diff[:-1])
print(str(ans))

Measured memory_bytes: 34628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define endl "\n"
#define pque priority_queue

const int mod = 1000000007, N = 100005;
int a[N], dis[N], b[N], reach[N][18];

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	memset(reach, -1, sizeof(reach));
	int n, l, q, x, y;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		if (i != 0) dis[i] = a[i] - a[i - 1];
	}
	cin >> l >> q;
	int idx = 0;
	for (int i = 0; i < n; i++){
		while (idx < n && a[idx] - a[i] <= l){
			idx++;
		}
		idx--;
		b[i] = idx;
		//cout << b[i] << endl;
	}
	for (int j = 0; j < 17; j++){
		for (int i = 0; i < n; i++){
			if (j == 0){
				reach[i][j] = b[i];
			}
			else{
				reach[i][j] = reach[reach[i][j - 1]][j - 1];
			}
			//cout << reach[i][j] << " ";
		}
		//cout << "\n";
	}
	while (q--){
		cin >> x >> y;
		x--;
		y--;
		if (x == y){
			cout << 0 << endl;
			continue;
		}
		if (x > y){
			swap(x, y);
		}
		int ans = 0;
		for (int j = 17; j >= 0; j--){
			if (reach[x][j] < y && reach[x][j] != -1){
				x = reach[x][j];
				ans += 1 << j;
			}
		}
		cout << ans + 1 << endl;
	}
}


Measured memory_bytes: 9088
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * https://abc045.contest.atcoder.jp/tasks/arc061_b
 */
public class Main {

	static Map<String,Point> map = new HashMap<>();
	static long H;
	static long W;
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		H = Long.parseLong(sc.next());
		W = Long.parseLong(sc.next());
		int N = Integer.parseInt(sc.next());
		for(int i=0; i<N; i++){
			Point p = new Point(Integer.parseInt(sc.next()), Integer.parseInt(sc.next()));
			map.put(getKey(p.x,p.y), p);
		}
		sc.close();
		
		long[] ans = new long[10];
		for(Point p:map.values()){
			for(int x=0; x<=2; x++){
				for(int y=0; y<=2; y++){
					int count = count(p.x-x,p.y-y);
					if(count>0){
						ans[count]++;
					}
				}
			}
		}
		long sum = 0;
		for(int i=1; i<=9; i++){
			ans[i] = ans[i]/i;
			sum+=ans[i];
		}
		ans[0] = (H-2)*(W-2)-sum;
		for(long a:ans){
			System.out.println(a);
		}
	}
	
	static int count(int x, int y){
		int count = 0;
		if( x<=0 || y<=0 || x>W-2 || y>H-2 ) return -1;
		for(int i=0; i<=2; i++){
			for(int j=0; j<=2; j++){
				if(map.containsKey(getKey(x+i,y+j))){
					count++;
				}
			}
		}
		return count;
	}
	
	static String getKey(int x, int y){
		return x+"."+y;
	}
	
	static class Point{
		int x;
		int y;
		Point(int y, int x){
			this.x = x;
			this.y = y;
		}
	}

}

Measured memory_bytes: 176892
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
int ceil(int a,int b){
    return (a+b-1)/b;
}
int main(void){
    long long int n,sum=0;
    vector<int> v(3,0);
    cin>>n;
    rep(i,n){
        int a,b;
        cin>>a>>b;
        sum+=b-a+1;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    ll n, a, b ;
    cin >> n >> a >> b ;
    
    // 二人の中央で落ち合う
    if ( (b-a) % 2 == 0 ) {
        cout << (b-a)/2 ;
    // すれ違うので困る
    } else {
        if ( (b-1) > (n-a) ) {
            ll new_a = n - b + 1 ;
            ll new_b = n - a + 1 ;
            a = new_a ;
            b = new_b ;
        }
        ll ans = 0 ;
        ans += a ;
        b = b - a ; 
        a = 1 ;
        ans += (b-a)/2 ;
        cout << ans ;
    }
    cout << endl ;
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif


ll pow(ll x, ll y, ll mod) {
    if (y == 0) {
        return 1;
    }
    if (y % 2 == 0) {
        return pow(x * x % mod, y / 2, mod) % mod;
    } else {
        return x * pow(x, y - 1, mod) % mod;
    }
}


void solve() {
    string S;
    cin >> S;
    ll N = S.size();
    vector<ll> M(N + 1, 0);
    reverse(S.begin(), S.end());
    rep(i, N) {
        ll d = S[i] - '0';
        M[i + 1] = (M[i] + d * pow(10, i, 2019)) % 2019;
    }
    map<ll, ll> cnt;
    ll ans = 0;
    rep(i, N + 1) {
        ll a = M[i];
        ans += cnt[a];
        cnt[a] ++;
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 5040
#include <iostream>
#include <vector>
#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    LL n;
    cin >> n;
    string c;
    vector<LL> white;
    vector<LL> red;
    cin >> c;
    for(LL i=0; i<n; i++){
        if(c[i]=='W'){
            white.push_back(i);
        }else{
            red.push_back(i);
        }
    }

    LL w_size=white.size();
    LL r_size=red.size();
    LL w_idx=0;
    LL r_idx=r_size-1;
    LL ans=0;
    if(w_size!=0 && r_size!=0){
        while(white[w_idx]<red[r_idx]){
            //cout << ans << " " << white[w_idx] << " " << red[r_idx] << endl;
            ans++;
            w_idx++;
            r_idx--;
            if(w_idx>=w_size || r_idx<0){
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5720
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

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

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

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

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	
	int h, w; cin >> h >> w;

	vector<int> sumc(w, 0);
	for (int i = 0; i < h; i++) {
		int sum = 0;
		for (int j = 0; j < w; j++) {
			int buf; cin >> buf;
			sum += buf;
			sumc[j] += buf;

			cout << buf;
			
			cout << " ";
			
		}
		cout << sum << endl;
		
	}

	int sum = 0;
	for (int i = 0; i < w; i++) {
		cout << sumc[i] << " ";
		sum += sumc[i];
	}

	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a!=c) cout << 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding:utf-8 -*-

S = list(input())
T = list(input())
Flag=0
for i in range(len(S)):
    K=[]
    L = S[0:len(S)-(i+1)]
    K = S[len(S)-i-1:]
    K = K+L
    #print(K)
    if (K)==T:
        print("Yes")
        Flag=1
        break;
if Flag==0:
    print("No")



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

public class P
{
    public int x { get; set; }
    public int y { get; set; }
    public int hp { get; set; }
    public int step { get; set; }
}

public class hello
{
    public static int h, w, sx, sy, gx, gy;
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            w = int.Parse(line[0]);
            h = int.Parse(line[1]);
            if (w == 0 && h == 0) break;
            var map = new int[h, w];
            for (int i = 0; i < h; i++)
            {
                line = Console.ReadLine().Trim().Split(' ');
                for (int j = 0; j < w; j++)
                {
                    var t = int.Parse(line[j]);
                    map[i, j] = t;
                    if (t == 2) { sx = i; sy = j; }
                    if (t == 3) { gx = i; gy = j; }
                }
            }
            getAns(map);
        }
    }
    static void getAns(int[,] map)
    {
        var dx = new int[] { 0, 1, 0, -1 };
        var dy = new int[] { 1, 0, -1, 0 };
        var visited = new bool[h, w, 7];
        var q = new Queue<P>();
        q.Enqueue(new P { x = sx, y = sy, hp = 6 });
        visited[sx, sy, 6] = true;
        while (q.Count() > 0)
        {
            var t = q.Dequeue();
            if (t.x == gx && t.y == gy) { Console.WriteLine(t.step); return; }
            for (int i = 0; i < 4; i++)
            {
                var nx = t.x + dx[i];
                var ny = t.y + dy[i];
                if (nx >= 0 && nx < h && ny >= 0 && ny < w && map[nx, ny] != 0)
                {
                    var nhp = t.hp - 1;
                    if (nhp == 0) continue;
                    if (map[nx, ny] == 4) nhp = 6;
                    if (!visited[nx, ny, nhp])
                    {
                        q.Enqueue(new P { x = nx, y = ny, hp = nhp, step = t.step + 1 });
                        visited[nx, ny, nhp] = true;
                    }
                }
            }
        }
        Console.WriteLine(-1);
    }
}



Measured memory_bytes: 16552
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define lb long double
#define  maxn 200005
#define pb push_back
#define forup(i,a,b) for(int i=(a);i<=(b);i++)  
#define fordown(i,a,b) for(int i=(a);i>=(b);i--)
int n,m;
int val[maxn];
int val2[maxn];
int ans=1;
int vis[maxn];
int cmin,cmax;
int weiyi[maxn];
int  tmp;
vector<int> a;
struct Edge
{int to,s;};
vector<Edge> g[maxn];
void dfs(int x,int f)
{a.pb(x); 
 for(int i=0;i<g[x].size();i++)
  {int u=g[x][i].to,s=g[x][i].s;
   if(vis[u]==1) continue;
   val[u]=s-val[x];
   vis[u]=1;
   dfs(u,x);
  }
}
void dfs2(int x,int f)
{ for(int i=0;i<g[x].size();i++)
  {int u=g[x][i].to,s=g[x][i].s;
   if(vis[u]==1) continue;
   val2[u]=s-val2[x];
   vis[u]=1;
   dfs2(u,x);
  }
}
void dfs3(int x,int f)
{ for(int i=0;i<g[x].size();i++)
  {int u=g[x][i].to,s=g[x][i].s;
   if(vis[u]==1) continue;
      vis[u]=1;
    if(val[u]<val2[u])
      {cmin=max(cmin,1-val[u]-val[tmp]);//zuixiao
	  }
   else
      { cmax=min(cmax,val[u]-1-val[tmp]);
      	
	  }  
	dfs3(u,x);  
  }
}
void dfs4(int x,int f)
{
 for(int i=0;i<g[x].size();i++)
  {int u=g[x][i].to,s=g[x][i].s;
   if(vis[u]==1) continue;
   val[u]=s-val[x];
   vis[u]=1;
   dfs4(u,x);
  }
}
bool check(int node)
{ for(int i=0;i<a.size();i++) vis[a[i]]=0;
  vis[node]=1; dfs(node,0);
  for(int j=0;j<a.size();j++)
	  {int node=a[j];
	   for(int k=0;k<g[node].size();k++)
	   {int u=g[node][k].to;
	    if(val[node]+val[u]!=g[node][k].s)
	     {return false;}
	   }
     }
    for(int i=0;i<a.size();i++)
    {int u=a[i];
     if(val[u]<1) return false;
	}
return true;
}
signed main()
{ //cout<<0<<endl; return 0; 
  cin>>n>>m;
   forup(i,1,m)
    {int u,v,s; cin>>u>>v>>s;
    g[u].pb((Edge){v,s});g[v].pb((Edge){u,s});
	}
   forup(i,1,n)//wujie
   if(!vis[i])
     { vis[i]=1;
      val[i]=0;
      a.clear();
	  dfs(i,0);
	  for(int j=0;j<a.size();j++)
	  {int node=a[j];
	   for(int k=0;k<g[node].size();k++)
	   {int u=g[node][k].to;
	    if(val[node]+val[u]!=g[node][k].s)
	    {int cha=g[node][k].s-val[node]-val[u];
	     if(cha%2!=0) {cout<<0<<endl; return 0;}
		 val[node]+=cha/2;
		 if(check(node)==false) {cout<<0<<endl;return 0;}
		 else 
		  {for(int p=0;p<a.size();p++) {vis[a[p]]=1;weiyi[a[p]]=1;}
		   break;
		  }
		}
	   }
	  } 
	 }     
 forup(i,1,n) vis[i]=0;	   	
   forup(i,1,n)
	{if((!vis[i])&&(weiyi[i]!=1))
	  {vis[i]=1;
	   val2[i]=val[i]+2;
	    dfs2(i,0);
	  }
	}
  forup(i,1,n) vis[i]=0;
   forup(i,1,n)
	{if((!vis[i])&&(weiyi[i]!=1))
	  { cmin=1;cmax=100000000000000;
	    tmp=i;
	   vis[i]=1;
	    dfs3(i,0);
	   // cout<<cmax<<' '<<cmin<<endl;
	   if(cmax<cmin) {cout<<0<<endl; return 0;}
	   ans=ans*(cmax-cmin+1);
	  }
	}
	cout<<ans<<endl;
	return 0;
}



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

int main() {
    int D;
    while (cin >> D, D) {
        int n, m; cin >> n >> m;
        vector<int> d(n + 1);
        for (int i = 1; i < n; i++) cin >> d[i];
        d[0] = 0, d[n] = D;
        sort(d.begin(), d.end());
        int ans = 0;
        while (m--) {
            int x; cin >> x;
            int idx = upper_bound(d.begin(), d.end(), x) - d.begin();
            ans += min(abs(d[idx - 1] - x), abs(d[idx] - x));
        }
        cout << ans << endl;
    }
    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    long long int ans = 0;
    int i =1;
    for(i=1; i<n; i++){
        if(n%i ==0){
            ans = ans + (n/i) -1;
        }else
        ans = ans + (n/i);
    }
    
    
    cout<<ans<<endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <string.h>
using namespace std;

typedef pair<int, int> P;
int n, a[100010];

bool check(int x){
	if(x == 1)
		return (a[1] && a[1] > a[2]);
	else if(x == n)
		return (a[n] && a[n - 1] < a[n]);
	else if(x > n || x <= 0)
		return false;
	else
		return (a[x] && (a[x - 1] < a[x] && a[x] > a[x + 1]));
}

int main() {
	int l;
	while(cin >> n >> l){
		memset(a, 0, sizeof(a));
		int ans = 0;
		priority_queue<P> que;
		for(int i = 1; i <= n; ++i){
			scanf("%d", &a[i]);
		}
		for(int i = 1; i <= n; ++i){
			if(check(i))
				que.push(P(a[i], i));
		}
		int cnt = 0;
		while(!que.empty()){
			P p = que.top();
			que.pop();
			int c = l - p.first;
			if(c - cnt > 0)
				cnt += (c - cnt);
			else
				c = 0;
			a[p.second] = 0;
			if(check(p.second - 1))
				que.push(P(a[p.second - 1] - cnt, p.second - 1));
			if(check(p.second + 1))
				que.push(P(a[p.second + 1] - cnt, p.second + 1));
		}
		cout << cnt << endl;
	}
	
	return 0;
}

Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, e, f;
int main() {
	cin >> a >> b >> c >> d >> e >> f;
	cout << a + b + c + d + e + f - min({a, b, c, d}) - min(e, f) << endl;
	return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)

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

    cout << min(a,b) << " " << max((a+b-n),0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
#define ll long long int
const double mx = 2e6 + 5 ;

void solve()
{
	int x;
	REP(i,5)
	{
		cin>>x;
		if(x==0)
		{
			cout<<i+1<<"\n";
			return;
		}
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3636
/******************
*  Author: BD747  *
******************/
#include<algorithm>
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int n,h,w;

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n>>h>>w;
	
	cout<<((n-h+1)*(n-w+1))<<endl;

	return 0;
}


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

using namespace std;

int n;
typedef long long ll;
const ll INF = 1e16;
ll sum[200001];
int main() {
  cin >> n;
  for(int i = 1; i <= n; i++) {
    ll a;
    cin >> a;
    sum[i] = a + sum[i-1];
  }

  ll ans = INF;

  for(int i = n-1; i > 0; i--) {
    ans = min(ans,abs(sum[i] - sum[n] + sum[i]));
  }

  cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
typedef long long ll;
const int N=1e5+5;
int n;
int d[105][3];
int main(){
    // freopen("a.in","r",stdin);
    // int T;scanf("%d",&T);for(int tttt=1;tttt<=T;tttt++){
    if(1){
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d%d",&d[i][1],&d[i][2]);
    bool ok=0;
    for(int i=1;!ok&&i+2<=n;i++){
        if(d[i][1]==d[i][2]&&d[i+1][1]==d[i+1][2]&&d[i+2][1]==d[i+2][2]) ok=1;
    }
    if(ok) puts("Yes");
    else puts("No");
    }return 0;
}


Measured memory_bytes: 3660
#include <stdio.h>
#include <algorithm>
int main()
{
    char s[4], t[4];
    int cnt = 0;
    scanf("%s", s);
    scanf("%s", t);
    for (int i = 0; i < 3; i++)
    {
        if (s[i] == t[i])
            cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 128
package main

import (
  "fmt"
)

func main() {
  var n int 
  fmt.Scan(&n)
  w := make([]string, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&w[i])
  }
  used := make(map[string]bool)
  prev := w[0]
  used[prev] = true
  ans := "Yes"
  for i := 1; i < n; i++ {
    nxt := w[i]
    if nxt[0] != prev[len(prev)-1] {
      ans = "No"
      break
    }
    if _, ng := used[nxt]; ng {
      ans = "No"
      break
    }
    prev = nxt
    used[prev] = true
  }
  fmt.Println(ans)
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n;cin >>n;
    vector<ll>a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    ll mx=-1;
    ll sum=0;
    mx=a[0];
    for (int i = 0; i < n; ++i) {
        if(a[i]<mx)sum+=mx-a[i];
        else mx=a[i];
    }
    cout <<sum<<endl;
}


Measured memory_bytes: 4784
use std::io;
use std::str::FromStr;

fn input() -> i64 {
    let mut buf = "".to_string();
    let _ = io::stdin().read_line(&mut buf);
    i64::from_str(buf.trim().as_ref()).unwrap()
}

fn main() {
    let x = input().abs();
    let ans = {
        let tmp = (2.0 * x as f64).sqrt().floor() as i64;
        if tmp * (tmp + 1) / 2 >= x {
            tmp
        }else {
            tmp + 1
        }
    };
    println!("{:}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <math.h>  /* M_PI */
using namespace std;

int main() {
    double r;

    cin >> r;
    //cout << a/b << " " << a%b << " ";
    cout <<fixed<<setprecision(6)<< r*r*M_PI << " " << 2.0*r*M_PI << endl;
    return 0;
}


Measured memory_bytes: 3236
import java.util.Arrays;
import java.util.Scanner;
import java.util.concurrent.atomic.AtomicInteger;

public class Main {

  public static void main(String[] args) {
    try (Scanner scanner = new Scanner(System.in)) {
      scanner.hasNextInt();
      final int n = scanner.nextInt();
      int[] l = new int[n * 2];
      for (int i = 0; i < l.length; i++) {
        l[i] = scanner.nextInt();
      }
      final AtomicInteger index = new AtomicInteger();
      int sum = Arrays.stream(l).sorted().filter(i -> index.incrementAndGet() % 2 == 1).sum();
      System.out.println(sum);
    }
  }
}


Measured memory_bytes: 28368
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint INF = 1e16;

signed main(){
  lint N; cin >> N;
  vector<lint> a(N);
  for(lint i = 0; i < N; i++) cin >> a[i];
  lint ans = INF;
  for(lint i = -100; i <= 100; i++){
    lint ans1 = 0;
    for(lint j = 0; j < N; j++) ans1 += (i - a[j]) * (i - a[j]);
    ans = min(ans, ans1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


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


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


a, b, c, d, e = zz()
if(a == 0):
    print(1)
    exit()
if(b == 0):
    print(2)
    exit()
if(c == 0):
    print(3)
    exit()
if(d == 0):
    print(4)
    exit()
if(e == 0):
    print(5)
    exit()


Measured memory_bytes: 26960
#include<stdio.h>

int main(){
	int N, a0, a1, a2, a3;
	scanf("%d",&N);
	a0 = N%10;
	a1 = (N%100 - a0)/10;
	a2 = (N%1000 - (a0 + a1))/100;
	a3 = (N - (a0 + a1 + a2))/1000;
	if(a0==a1 && a1 == a2) printf("Yes\n");
	else if(a1==a2 && a2 == a3) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

int main() {
    int N, H, W;
    cin >> N >> H >> W;
    vector<int> A(N);
    vector<int> B(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (H <= A[i] && W <= B[i]) {
            ans++;
        }
    }

    cout << ans << endl;
}

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

int main()
{
	long a, b;

	cin >> a >> b;

	cout << std::bitset<32>(a & b) << endl;
	cout << std::bitset<32>(a | b) << endl;
	cout << std::bitset<32>(a ^ b) << endl;

	return 0;
}


Measured memory_bytes: 3176
use std::io::BufRead;

fn main() {
  let stdin = std::io::stdin();
  let lines = stdin.lock().lines()
    .filter_map(|x| x.ok())
    .collect::<Vec<_>>();

  let mut ite1 = lines[0].trim().split_whitespace()
    .map(|x| x.parse::<usize>().unwrap());
  let n = ite1.next().unwrap();
  let m = ite1.next().unwrap();

  let vec_a = lines[1..n + 1].iter().map(|line| {
    line.trim()
      .split_whitespace()
      .map(|x| x.parse::<i32>().unwrap())
      .collect::<Vec<_>>()
  }).collect::<Vec<_>>();
  
  let vec_b = lines[n + 1..n + 1 + m].iter().map(|line|
    line.trim().parse::<i32>().unwrap()
  ).collect::<Vec<_>>();

  for a in vec_a {
    let sum = a.iter().zip(vec_b.iter()).map(|(a, b)| a * b).sum::<i32>();
    println!("{}", sum);
  };
}


Measured memory_bytes: 5056
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int D=sc.nextInt();
		int X=sc.nextInt();
		int A[]=new int[N];
		int a=N+X;
		for(int i=0;i<N;i++) {
			A[i]=sc.nextInt();
		}
		for(int i=0;i<N;i++) {
			for(int k=1;A[i]*k+1<=D;k++) {
				a=a+1;
			}
		}
		System.out.println(a);
	}
}

Measured memory_bytes: 20948
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    int i;
    for(i=0;i<s.size();i++)
    {
        if(i==(k-1))
        {
            s[i]=tolower(s[i]);
        }
    }
    cout<<s<<endl;
}


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

using namespace std;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()

long long inq(long long x, long long y)
{
    if (!y) return 1;
    long long l = inq(x, y / 2);
    if (y % 2) return l * l * x;
    return l * l;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, c;
    cin >> n >> c;
    vector<int> Len(n), p(n - 1);
    forn(i, n) cin >> Len[i], Len[i] *= n;
    sort(all(Len));
    c *= n;
    iota(all(p), 0);
    long long good = 0, all_ways = 0, W = Len[n - 1];
    while (1)
    {
        all_ways += inq(c / n, n - 1);
        vector<vector<long long> > dp(c + 1, vector<long long>((1 << (n - 1))));
        dp[W][0] = 1;
        for (int i = 0; i < c; i++)
        {
            if (i % n == 0) continue;
            int we = p[i % n - 1];
            int le = Len[we];
            for (int mask = 0; mask < (1 << (n - 1)); mask++)
            {
                if ((1 << we) & mask) continue;
                int m2 = mask + (1 << we);
                for (int ac = i; ac <= c; ac++)
                {
                    int wc = max(ac, min(c, le + i));
                    dp[wc][m2] += dp[ac][mask];
                }
            }
        }
        good += dp[c][(1 << (n - 1)) - 1];
        if (!next_permutation(all(p)))
        {
            printf("%.15f", (double)good / all_ways);
            return 0;
        }
    }
}



Measured memory_bytes: 384
#include<stdio.h>
#define MAX 102
#define WHITE -1
#define BLACK -2
#define INF 10000000
#define NIL -1

int n;
int a[MAX][MAX],d[MAX],pi[MAX],color[MAX];

void prim(){
  int i,u,v,mincost;

  for( u = 0 ; u < n ; u++ ){
    d[u] = INF;
    pi[u] = NIL;
    color[u] = WHITE;
  }

  d[0] = 0;

  while(1){
    mincost = INF;
    for( i = 0 ; i < n ; i++ )
      {
	if( color[i] != BLACK && d[i] < mincost ){
	  mincost = d[i];
	  u = i;
	}
      }
    color[u] = BLACK;
    if( mincost == INF ) break;

    for( v = 0 ; v < n ; v++ ){

      if( a[u][v] != NIL ){
	if( color[v] != BLACK && a[u][v] < d[v] ){
	pi[v] = u;
	d[v] = a[u][v];
      }
      }
    }
  }


}

int main(){
  int sum=0,i,j;

  scanf("%d",&n);

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

  prim();

  for( i = 0 ; i < n ; i++ ){
    if( pi[i] != NIL && a[pi[i]][i] != NIL ){
      sum += a[pi[i]][i];
    }
  }

  printf("%d\n",sum);

  return 0;
}

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

int cnt[200001] = {0};
int anscnt[200001] = {0};

int dfs(int score, const vector<vector<int>>&graph, int now, int from){

    int nextscore;
    anscnt[now] = score + cnt[now];
    for (int i = 0; i < graph[now].size(); i++)
    {
        if (graph[now][i] == from) continue;
        dfs(anscnt[now], graph, graph[now][i], now);
    }
}

int main()
{
    int n, q;cin >> n >> q;
    vector<vector<int>> graph(n+1);
    rep(i, n - 1){ 
        int a, b; cin>>a>>b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }    
    rep(i, q){
        int p, x; cin>>p>>x;
        cnt[p] += x;
    }
    dfs(0, graph, 1, -1);

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


Measured memory_bytes: 27136
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

using ll=int64_t;

int main() {
  ll X,Y; cin >>X >>Y;
  int ans=0;
  ll i=1;
  while (true) {
    ll temp=X*pow(2,i-1);
    if (Y<temp) {
      cout <<ans <<endl;
      return 0;
    }
    ans++;
    i++;
  }
}


Measured memory_bytes: 384
import java.util.*;
import java.lang.*;
import java.math.*;


public class Main {
	
	Scanner sc = new Scanner(System.in);
	
	void run() {
		
		int n = sc.nextInt();
		int b = 100;
		
		for (int i=0;i<n;i++) {
			
			if ( (double)(b*0.05) - (int)(b*0.05) > 0 )
				b = (int)( b * 1.05 ) + 1;
			else 
				b = (int)( b * 1.05 );
			
		}
		
		System.out.println(b*1000);
		
	}
	
	public static void main(String[] args) {
		
		new Main().run();
		
	}
	
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
    	int c1=0;
      int c2=0;
      int c3=0;
      int c4=0;
  	while(n--){
    	string a;
      	cin >> a;
      	if(a=="AC"){c1++;}
      if(a=="WA"){c2++;}
      if(a=="TLE"){c3++;}
      if(a=="RE"){c4++;}
    }
  	cout <<"AC x "<<c1<<"\nWA x "<<c2<<"\nTLE x "<<c3<<"\nRE x "<<c4<<"";

	return 0;
}


Measured memory_bytes: 3624
d = int(input())
c = list(map(int,input().split()))
s = []
p = [1]*d
for i in range(d):
    s.append(list(map(int,input().split())))
x = [0]*26
for i in range(d):
    q = 1
    m = -1
    for j in range(26):
        n = s[i][j] - x[j] - c[j]
        x[j] += c[j]
        if(m < n):
            m = n
            q = j
    x[q] *= 0
    p[i] = q+1
for i in range(d):
    print(p[i])

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define pb push_back

typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;

struct unionfind{
    vint root;
    vector<ll> group_size;

    unionfind(int n){
        root.resize(n);
        group_size.resize(n);
        rep(i,n)root[i]=i;
        rep(i,n)group_size[i]=1;
    }
    //ノードのグループ番号（親番号）を返す
    int find(int x){
        return x==root[x]? x : find(root[x]);
    }

    int size(int x){
        x=find(x);
        return group_size[x];
    }

    void unite(int x,int y){
        x=find(x),y=find(y);
        int x2=max(x,y);
        int y2=min(x,y);
        group_size[x2]+=group_size[y2];
        root[y2]=x2;
    }
};

int main(){
    int n,m;
    cin>>n>>m;
    vector<pint> road(m);
    vector<ll> ans(m);
    ll counter=n*(ll)(n-1)/2;
    unionfind uf(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        road[i].first=a-1;
        road[i].second=b-1;
    }
    repr(i,m){
        ans[i]=counter;
        int x=road[i].first,y=road[i].second;
        if(uf.find(x)!=uf.find(y)){
            counter-=ll((ll)uf.size(x)*(ll)uf.size(y));
            uf.unite(x,y);
        }
    }
    rep(i,m)cout<<ans[i]<<endl;
}

Measured memory_bytes: 4096
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const MAX = 500000*2 + 2
const NIL = -3000000000

var A [MAX]int
var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func maxHeapify(i int) {
	left := i * 2
	right := i*2 + 1

	largest := i
	if A[left] > A[largest] {
		largest = left
	}
	if A[right] > A[largest] {
		largest = right
	}

	if largest != i {
		A[largest], A[i] = A[i], A[largest]
		maxHeapify(largest)
	}
}

func buildMaxHeap(n int) {
	for i := n / 2; i >= 1; i-- {
		maxHeapify(i)
	}
}

func main() {
	for i := range A {
		A[i] = NIL
	}

	n := scanInt()
	for i := 1; i <= n; i++ {
		v := scanInt()
		A[i] = v
	}

	buildMaxHeap(n)

	w := bufio.NewWriter(os.Stdout)
	for i := 1; i <= n; i++ {
		fmt.Fprint(w, " ", A[i])
	}
	fmt.Fprintln(w)
	w.Flush()
}



Measured memory_bytes: 13672
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define bug(x) cerr<<#x<<"="<<x<<endl;
#define el printf("\n");
const ll mod = 1e7;




inline ll nxt() {
	ll x;
	scanf("%lld\n",&x);
	return x;
}

ll nCr(ll n ,ll k){
    if( k==n || k==0 )return 1;
    return (nCr(n-1,k-1)%mod+nCr(n-1,k)%mod)%mod;
}

int main(){
    //ios_base::sync_with_stdio(0);
    int n,k;
    scanf("%d %d",&n,&k);
    if(n<10){
        printf("%d\n",(k+(100*(10-n))));
    }
    else{
        printf("%d\n",k);
    }


}


Measured memory_bytes: 256
/*我是萌新*/
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include <iomanip> 
#include <cstdio>
typedef long long ll;
const int mod = 1e9 + 7;
using namespace std;


int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    string s;
    while (cin >> s)
    {
        int flag = 1, len = s.length();
        for (int i = 0; i < len / 2; i++)
        {
            if (s[i] != s[len - 1 - i]) { flag = 0; break; }
        }
        for (int i = 0; i < (len - 1) / 2; i++)
        {
            if (s[i] != s[(len - 1) / 2 - 1 - i]) { flag = 0; break; }
        }
        for (int i = (len + 3) / 2 - 1; i < len; i++)
        {
            if (s[i] != s[len - 1 - i]) { flag = 0; break; }
        }
        if (flag)cout << "Yes\n";
        else cout << "No\n";
    }

}



Measured memory_bytes: 256
use std::io;

fn main() {
    let line = read_line();
    let mut split = line.split(' ').map(|s| s.parse::<usize>().unwrap());
    let count = split.next().unwrap();
    let disp_rate = split.next().unwrap();
    let internal_rate = if count >= 10 {
        disp_rate
    } else {
        // internal - some = disp
        // internal = disp + some
        disp_rate + 100 * (10 - count)
    };
    println!("{}", internal_rate);
}
fn read_line() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>							
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
const ll maxsize = 100000009;

void solve() {
	int n;
	string s, t;
	cin >> n >> s;
	if(1 & n) {
		cout << "No" << endl;
		return;
		}
		cout << t << endl;
	for(int i = 0; i < n / 2; ++i) {
		if(s[i] != s[n / 2 + i]) {
			cout << "No" << endl;
			return;
			}
		}
		cout <<"Yes" << endl;
	}

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	solve();
	return 0;
}
 
 
 



Measured memory_bytes: 3652
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)

def main():
    N = int(input())
    odd = 0
    even = 0
    for i in range(1, N + 1):
        if i % 2 == 0:
            even += 1
        else:
            odd += 1
    print(odd / (odd + even))


if __name__ == '__main__':
    main()

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



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	int R, G, B, N; cin >> R >> G >> B >> N;

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

	cout << ans << endl;



	return 0;

}


Measured memory_bytes: 256
//

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

int main(){
  int a[3];
  int d;
  cin >> a[0] >> a[1] >> a[2] >> d;

  if(max(a[0],a[2]) - min(a[0],a[2]) <= d){
    cout << "Yes" << endl;
    return 0;
  }
  sort(a, a+3);
  if(a[2] - a[1] <= d && a[1] - a[0] <= d) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


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

int main(void){
	int H,W;
	bool res=true;
	cin>>H>>W;
	string s[H];
	rep(y,H)cin>>s[y];
	int X=0,Y=0;
	while(1){
		s[Y][X]='.';
		if(Y<H-1 && s[Y+1][X]=='#')Y++;
		else if(X<W-1 && s[Y][X+1]=='#')X++;
		else break;
	}
	rep(y,H)rep(x,W)res &= s[y][x]=='.';
	cout<<(res ? "Possible" : "Impossible")<<endl;
	return 0;
}


Measured memory_bytes: 256
// Try AtCoder
// authoer: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let a = get!();
    let mut b = get!();
    
    if a <= 5 {
        b = 0;
    } else if a <= 12 {
        b /= 2;
    }
    
    println!("{}", b);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
const int MXN = 100005;
int p[MXN], r[MXN];

void init(int n)
{
    for(int i = 0; i <= n; ++i)
    {
        p[i] = i;
        r[i] = 1;
    }
}

int Find(int x)
{
    return (x == p[x] ? x : p[x] = Find(p[x]));
}

bool Union(int x, int y)
{
    x = Find(x);
    y = Find(y);
    if(x == y)
    {
        return false;
    }
    if(r[x] == r[y])
    {
        p[y] = x;
        ++r[x];
    }
    else if(r[x] > r[y])
    {
        p[y] = x;
    }
    else
    {
        p[x] = y;
    }
    return true;
}

int main(){
    int n, m;
    cin >> n >> m;
    init(n);
    for(int i = 0, x, y, z; i != m; ++i)
    {
        cin >> x >> y >> z;
        if(Union(x, y))
        {
            --n;
        }
    }
    cout << n << '\n';
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main()
{
  int A, B;
  cin >> A >> B;
  
  if(A == B)
  {
    cout << A * 2 << endl;
    return 0;
  }
  else
  {
    cout << max(A, B) * 2 - 1 << endl;
    return 0;
  }
}

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

int main() {
    long long N, K; cin >> N >> K;
    vector<long long> nums(110000, 0);
    for(int i = 0; i < N; ++i) {
        int a, b; cin >> a >> b;
        nums[a] += b;
    }
    
    long long res = 0;
    for(int i = 0; i < 110000; ++i) {
        res += nums[i];
        if(res >= K) {
            cout << i << endl;
            break;
        }
    }
}


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

int main() {
    int A,B;
  cin >> A >> B;
  
  if ( (A+B)%2 == 1 ){
    cout << "IMPOSSIBLE" << endl;
      }
  else {
   cout <<  (A+B)/2 << endl;
    }
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int x;
    cin>>x;
    int ans;
    if(x<=599) ans=8;
    else if(x<=799) ans=7;
    else if(x<=999) ans=6;
    else if(x<=1199) ans=5;
    else if(x<=1399) ans=4;
    else if(x<=1599) ans=3;
    else if(x<=1799) ans=2;
    else if(x<=1999) ans=1;

    cout<<ans<<endl;
}



Measured memory_bytes: 3636
n,a,*x=map(int,open(0).read().split())
x=[0]+x
dp=[[[0]*(50*n+1)for j in range(n+1)]for i in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
  dp[i][0]=dp[i-1][0]
  for j in range(1,n+1):
    for k in range(1,50*n+1):
      dp[i][j][k]=dp[i-1][j][k]
      if k-x[i]>=0:
        dp[i][j][k]+=dp[i-1][j-1][k-x[i]]
ans=0
for i in range(1,n+1):
  j=i*a
  if j<50*n+2:
    ans+=dp[-1][i][j]
print(ans)

Measured memory_bytes: 92892
#include <iostream>

using namespace std;

int main() {
  int H, W, A, B;
  cin >> H >> W >> A >> B;
  for (int h = 0; h != H; ++h) {
    for (int w = 0; w != W; ++w) {
      cout << ((w < A) ^ (h < B));
    }
    cout << endl;
  }
}


Measured memory_bytes: 3584
using System;

namespace aoj
{
    class Program
    {
        static void Main(string[] args)
        {
            var num = Console.ReadLine();
            string[] nums = num.Split(' ');   
            int one =  int.Parse(nums[0]);
            int two =  int.Parse(nums[1]);
            int around = (one * 2) + (two * 2);     
            int area = one * two;     
            Console.WriteLine(area + " " + around);
        }
    }
}



Measured memory_bytes: 13832
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define vi vector<int>
#define srt(a) sort(a.begin(), a.end());
#define se second
#define fi first
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout << fixed;
    LL n;
    cin >> n;
    string s;
    cin >> s;
    int q;
    cin >> q;
    vector<LL> v(q);
    forn(i, q) cin >> v[i];
    for (auto k : v)
    {
        LL a = 0, b = 0, c = 0, d = 0, cc = 0;
        for (auto i : s)
        {

            if (i == 'M')
            {
                b++;
                c += a;
            }
            else if (i == 'D')
                a++;
            if (k <= cc && s[cc - k] == 'D')
            {
                a--, c -= b;
            }
            else if (k <= cc && s[cc - k] == 'M')
                b--;
            if (i == 'C')
                d += c;
            cc++;
        }
        cout << d << endl;
    }

    return 0;
}

Measured memory_bytes: 1948
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 1; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int n;
  cin >> n;
  if (n / 100 == n % 10) Yes;
  else No;
  return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn.{readLine,readInt}

object Main {
  def main(args: Array[String]) = {
    val l = readLine().split(" ").map(_.toDouble)
    val (vx, vy) = (l(2)-l(0), l(3)-l(1))
    val n = readInt()
    val sqr = vx*vx + vy*vy
    val (vsqxx, vsqxy, vsqyy) = ((vx*vx)/sqr,(vy*vx)/sqr, (vy*vy)/sqr)

    val str = new StringBuilder
    for( i <- 1 to n ) {
      val l2 = readLine().split(" ").map(_.toDouble)
      val (vx2, vy2) = (l2(0)-l(0),l2(1)-l(1))
      val (xt, yt) = ( vsqxx*vx2 + vsqxy*vy2 + l(0), vsqxy*vx2 + vsqyy*vy2 + l(1) )

      str ++= xt + " "+ yt + "\n"
    }
    print(str.toString)
  }
}

Measured memory_bytes: 47520
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do(): 
    l,r,d=INTM()
    ct=0
    for i in range(l,r+1):
        if i%d==0:
            ct+=1
    print(ct)
if __name__ == '__main__':
    do()

Measured memory_bytes: 9188