akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
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 const INF = 1001001001;
ll const MOD = 1000000007;


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

int a,b;
cin >> a >> b;
if((a+b) % 2 == 0) cout << (a+b)/2 << endl;
else cout << (a+b+1)/2 << endl;

return 0;
}

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

int Array(int x[],int n){
    for(int i=0;i<n;i++){
        cin >> x[i] ;
    }
    return *x;
}

int main(){
    string s,t,u;
    int a,b;
    cin >> s >> t >> a >> b >> u;
    if(u==s){
        cout << a-1 << " " << b << endl;
    }else{
        cout << a << " " << b-1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = if n <= m then  List.range n `To m else []
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

module ModOp = struct
  let prime = 1_000_000_007
  let (-) a b = (a + prime - b) mod prime
  let (+) a b = (a + b) mod prime
  let ( * ) a b = (a * b) mod prime

  let rec pow x n =
    if n = 0 then 1
    else if n mod 2 = 0 then pow (x*x) (n/2)
    else x * pow (x*x) (n/2)
end

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'
let itoa n = Char.chr (n + Char.code '0')

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let n = scan "%d" id
let ls = scan_list ~sep:' ' Int.of_string
let print_list ls =
  ListL.iteri ls ~f:(fun i v ->
      if i <> 0 then Printf.printf " ";
      Printf.printf "%d" v);
  Printf.printf "\n"

let () =
  let total = ListL.fold_left ls ~init:0 ~f:(lxor)  in
  ListL.map ls ~f:(fun v -> total lxor v) |> print_list


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
#define ll long long
ll mod = 1000000000+7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    cout.tie(NULL);
    ll T;
    T=1;
    //cin>>T;
    start:
    while(T--)
    {
       ll n,m,k;
       cin>>n>>m>>k;
       ll a[n],b[m];
       ll sum = 0;
       for(int i=0;i<n;i++)
       {
        //   cin>>a[i];
           ll x;
           cin>>x;
           sum += x;
           a[i] = sum;
       }
       sum=0;
       for(int i=0;i<m;i++)
       {
           ll x;
           cin>>x;
           sum += x;
           b[i] = sum;
           
       }
       
       ll ans = 0;
       for(int i=0;i<n;i++)
       {
           if(a[i]>k){break;}
           ll ind = upper_bound(b,b+m,k-a[i])-b;
           ind--;
           ans = max(ans,ind+i+2);
       }
       for(int i=0;i<m;i++)
       {
           if(b[i]>k){break;}
           ll ind = upper_bound(a,a+n,k-b[i])-a;
           ind--;
           ans = max(ans,ind+i+2);
       }
       
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 6732
def inpl():
    return list(map(int, input().split()))


HW = inpl()
HW.sort()
if HW[0] == 1:
    print(1)
    exit()
print(HW[0] * HW[1] // 2 + int(HW[0] % 2 == 1 and HW[1] % 2 == 1))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
constexpr ll MOD = 10e9+7;
constexpr ll INF = 1LL << 60;
constexpr int Inf = 1e9;
inline int in() {int x; cin >> x; return x;}
template <typename T> inline void out(const T& x) {cout << x << endl;}
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 
  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//

signed main()
{
  ios();
  int A,B,K;
  cin >> A >> B >> K;
  int cnt = 0;
  for(int i = gcd(A,B);i >0 ;i --)
  {
    
    if(A % i == 0 && B % i ==0)
    {
      cnt ++;
    }
    if(cnt == K)
    {
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
#define ll long long int
#define ve vector<int>
#define vl vector<long long int>
#define all(a) a.begin(),a.end()
using namespace std;

int main(){
  ll x,y,A=1;
  cin>>x>>y;
  while(true){
    x=x*2;
    if(x>y) break;
    A++;
  }
  cout<<A<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a,b,c;
  scanf("%d%d",&a,&b);
  if(a<b){
    c=2*b-1;
    printf("%d",c);
  }else if(b<a){
    c=2*a-1;
     printf("%d",c);
  }  else{
    c=a+b;
     printf("%d",c);
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;

int main(){
    priority_queue<ll,vector<ll>,greater<ll>> q;
    ll n,m,x,ans=0;cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>x;
        q.push(x);
    }
    vector<pair<ll,ll>> v(m);
    for(int i=0;i<m;i++) cin>>v[i].second>>v[i].first;
    sort(v.begin(),v.end(),greater<>());
    for(int i=0;i<m;i++){
        for(int j=0;j<v[i].second;j++){
            if(q.empty()||q.top()>=v[i].first) break;
            ans+=v[i].first;q.pop();
        }
    }
    while(!q.empty()) {
        ans+=q.top();q.pop();
    }
    cout<<ans;
}

Measured memory_bytes: 2676
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, legs;
    cin>>n>>legs;
    if(legs%2 != 0){
        cout<<"No";
    }
    else{
        int maxm = 4*n;
        int minm = 2*n;
        if(legs >= minm && legs <= maxm){
            cout<<"Yes";
        }
        else{
            cout<<"No";
        }
    }
}

Measured memory_bytes: 3648
n,k=map(int,input().split())
a=list(map(int,input().split()))
MOD=10**9+7
ans=0

part=0
all=0
for i in range(n):
    for j in range(i,n):
        if a[i]>a[j]:
            part+=1
    for l in range(n):
        if a[i]>a[l]:
            all+=1

ans=(k*part)%MOD+(all*(k*(k-1))//2)%MOD
print(ans%MOD)




Measured memory_bytes: 3188
//file_name:ABC45_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    string s[3];
    cin >> s[0] >> s[1] >> s[2];


    int x = 0;
    int n[3] = {};
    while(true){
        if(s[x].size()-n[x]==0){
            if(x==0){
                cout << 'A' << endl;
            }
            if(x==1){
                cout << 'B' << endl;
            }
            if(x==2){
                cout << 'C' << endl;
            }
            return 0;
        }
        n[x]++;
        if(s[x][n[x]-1]=='a'){
            x = 0;
        }else if(s[x][n[x]-1]=='b'){
            x = 1;
        }else{
            x = 2;
        }

    }



    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
typedef double dd;
#define pb push_back
#define mp make_pair
#define endl "\n"
ll const M = 1000000007;
dd const pi = acos(-1);
ll const inf = 2e18;
ll const N = 200001;
int main()
{
    fast;
    ll i,j,t;
    cin >> i >> j;
    cout<<i*j<<endl;
    return 0;
}    

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )

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

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

ll gcd(ll a, ll b) {
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll factorial(ll x) {
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }
	if (n == r) { return 1; }

	if (r > n / 2) { r = n / 2; }

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

	return (ll)result;
}

bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (ll i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

ll GreaterBinarySearch(ll *array, ll key, ll max, ll min) {
	if(array[max]<array[min]) {
		return NULL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int main() {
	int n,m; cin>>n>>m;
	if(n>m) swap(n,m);
	for(int i=0; i<m; i++) cout<<n;
	cout<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        System.out.printf("%.6f %.6f%n", r * r * Math.PI, 2 * r * Math.PI);
    }
}


Measured memory_bytes: 28348
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re

l = input().split()
a = int(l[0])
b = int(l[1])
pc = input()

result = re.fullmatch(r'[0-9]{%d}-[0-9]{%d}' % (a, b), pc)
if result:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <stdio.h>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cassert>
#include <random>
#include <time.h>
#define fi first
#define se second
#define pb emplace_back
#define all(x) x.begin(),x.end()
#define re return
#define mp make_pair

using namespace std;

typedef long long ll;

const double pi = 3.14159265;
const ll mod = 1e9 + 7;
const ll N = 3e5 + 5;
const int OMG = 9e6 + 5;
const ll P0 = 281;
const ll P1 = 257;


int main()
{
    //freopen("ladder.in ", "r", stdin);
    //freopen("OMOMOMMG.txt", "w", stdout);
    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll h, n, sum = 0;
    cin >> h >> n;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        sum += a;
    }
    if(sum >= h)
        cout << "Yes";
    else cout << "No";
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n[3];
    int i, count5 = 0, count7 = 0;
    scanf("%d%d%d", &n[0], &n[1], &n[2]);

    for(i = 0; i < 3; i++)
    {
        if(n[i] == 5) count5++;
        else if (n[i] == 7) count7++;
    }

    if (count5 == 2 && count7 == 1) printf("YES\n");
    else printf("NO\n");

    return (0);
}


Measured memory_bytes: 128
int main()
{
	int D[10000];
	int C[10000];
	int n;
	int i, j;
	int kosu = 0;
	int count = 0;
	D[count] = 2;

	for (i = 3; i <= 10000; i += 2)
	{
		int k = 0;
		for (j = 3; j <= i / 3; j += 2)
		{
			if (i%j == 0)
			{
				k = 1;
				break;
			}

		}
		if (k == 0)
		{
			count = count + 1;
			D[count] = i;
		};
	}


	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &C[i]);
	}
	
	for (j = 0; j < n; j++)
	{
		int k = 0;
			for (int l =0 ; l < count ; l ++)
			{
				if (C[j] % D[l] == 0 && C[j]>D[l])
				{
					k=1;
					break;
				}
			}

			if (k == 0)
			{
				kosu++;
			}
	}
	
		printf("%d\n",kosu);	
		//for (i = 0; i <= count; i++)
		//{
		//	printf_s(" %d", D[i]);
		//}
 }

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

int main() {
  int n;
  cin >> n;
  int a[n + 1];
  int i;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int count = 0;
  int next_button = 1;
  while (true) {
    if (a[next_button] == -1) {
      cout << -1 << endl;
      break;
    } else if (a[next_button] == 2) {
      cout << count + 1 << endl;
      break;
    }
    int temp = next_button;
    next_button = a[next_button];
    a[temp] = -1;
    count++;

  }
  return 0;
}


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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

const int X = 1e9;

int main() {
    int N, K, S;
    cin >> N >> K >> S;
    vector<int> a(N);
    int unko = (S == X ? X - 1 : X);
    rep(i, N) a[i] = (i < K ? S : unko);
    rep(i, N) cout << a[i] << ' ';
    cout << endl;
}


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

int main(){
	cout << fixed << setprecision(6);
	
	double r;

	cin>>r;
	
    double pi = 3.141592653589;
	
	double area = r * r * pi;
	double cir = (r + r) * pi;

	cout<<area<<" "<<cir<<endl;

	return 0;
}


Measured memory_bytes: 3212
import sys


last_month = [0] * 1001
this_month = [0] * 1001
current = last_month
for line in sys.stdin:
    line = line.rstrip()
    if line == '':
        current = this_month
        continue
    num, day = map(int, line.split(','))
    current[num] += 1
for i in xrange(1, 1001):
    if last_month[i] and this_month[i]:
        print i, last_month[i] + this_month[i]

Measured memory_bytes: 4244
#include <stdio.h>

int main(void)
{
    int h, w, i, j, tgl_y, tgl_x;

    scanf("%d %d", &h, &w);

    while ((h!=0) || (w!=0)) {
        tgl_y = 0;
        for (i=0; i<h; i++) {
            tgl_x = 0;
            for (j=0; j<w; j++) {
                if ((tgl_x ^ tgl_y) == 0) {
                    printf("#");
                } else if ((tgl_x ^ tgl_y) == 1) {
                    printf(".");
                }
                tgl_x = tgl_x ^ 1;
            }
            tgl_y = tgl_y ^ 1;
            printf("\n");
        }
        printf("\n");
        scanf("%d %d", &h, &w);
    }

    return 0;
}


Measured memory_bytes: 2052
import sys
import numpy as np
from numba import njit


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

@njit('(i8[::1],)', cache=True)
def c(A):
    N = len(A)
    B = np.zeros_like(A)
    for i, a in enumerate(A):
        l = max(0, i - a)
        r = min(N - 1, i + a)
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    B = np.cumsum(B)
    return B


def main():
    N, K = map(int, readline().split())
    A = np.array(readline().split(), np.int64)


    K = min(K, 50)
    for _ in range(K):
        A = c(A)

    print(' '.join(A.astype(str)))


if __name__ == '__main__':
    main()

Measured memory_bytes: 146984
#include <iostream>
#include <vector>
#include <algorithm>

int main(int argc, char *argv[]){
    int P, Q, R;
    std::cin >> P >> Q >> R;
    std::vector<int> D = {P+Q, P+R, Q+R};
    std::cout << *std::min_element(D.begin(),D.end()) << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int dp[102][4][2];
string s;
int krk;
int main(){
	ios::sync_with_stdio(0);
    cin>>s>>krk;
    dp[0][0][0]=1;
    forn(i,0,sz(s)){
        forn(j,0,4){
            forn(k,0,2){
                int sd=s[i]-'0';
                forn(d,0,10){
                    int i1=i+1,j1=j,k1=k;
                    if(d)
					j1++;
                    if(j1>krk)
					break;
                    if(k==0){
                        if(d>sd)
						break;
                        if(d<sd)
						k1=1;
                    }
                    dp[i1][j1][k1]+=dp[i][j][k];
                }
            }
        }
    }
    cout<<dp[sz(s)][krk][0]+dp[sz(s)][krk][1];
	re 0;
}

Measured memory_bytes: 256
package main

import "fmt"

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

	ans := 0
	for i := 0; i <= 100; i++ {
		if i >= a && i < b && i >= c && i < d {
			ans++
		}
	}
	fmt.Println(ans)
}


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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

struct Job {
  ll reward;
  ll day;
  bool used;
};

int main(int argc, char* argv[]) {
  ll n, m;
  cin >> n >> m;
  map<ll, vector<ll>> jobs;
  set<ll> days;
  rep(i, 0, n) {
    ll d, c;
    cin >> d >> c;
    days.insert(d);
    jobs[d].push_back(c);
  }

  priority_queue<ll> q;
  ll ans = 0;

  auto first = begin(days);
  auto last = end(days);
  rep(i, 1, m + 1) {
    if (*first <= i && first != last) {
      for (ll val : jobs[*first]) {
        q.push(val);
      }
      first++;
    }

    if (q.empty()) continue;
    ans += q.top();
    q.pop();
  }

  cout << ans << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 15488
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double EPS = 1e-10;
const int INF = 2147483647;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

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

	if (n % 2 == 0) {
		cout << n << " " << n << " " << n / 2 << endl;
	}
	else {
		for(ll i=1;i<3500;i++)
			for (ll j = 1;j < 3500;j++) {
				ll x = 4 * i * j - n * (i + j);

				if ( x > 0 && (n * i * j) % x == 0) {
					cout << (n * i * j) / x << " " << i << " " << j << endl;
					return 0;
				}
			}
	}

	return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <cstdlib>
using i64 = long long;

int main() {
    int x, n;
    int v[101] {};
    std::cin >> x >> n;
    while (n--) {
        int p;
        std::cin >> p;
        v[p] = 1;
    }

    int ret = -1000;
    for (int j = -100; j <= 200; j++) {
        if (0 <= j && j <= 100 && v[j]) continue;
        if (abs(ret - x) > abs(j - x)) ret = j;
    }

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
const int INF = 111111111;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int DIV = 1000000007; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;



int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================
	
	string S;
	cin >> S;
	ll size = S.size();

	vector<ll> ans(size);
	vector<ll> memoR;

	for (ll i = 0; i < size-1; i++) {
		if (S[i] == 'R' && S[i + 1] == 'L') {
			memoR.emplace_back(i);
		}
	}

	for (ll i = 0; i <= memoR[0]; i++) {
		if ((memoR[0] - i) % 2 == 0) {
			ans[memoR[0]]++;
		}
		else {
			ans[memoR[0] + 1]++;
		}

	}

	ll next = 1;
	for (ll i = memoR[0] + 1; i < size; i++) {
		if (memoR[next] + 1 <= i) {
			if (next + 1 < memoR.size()) {
				next++;

				// L なはず
				ll mod = (i - memoR[next - 1]) % 2;
				ans[memoR[next - 1] + mod]++;

			}
			else {
				ll mod = (i - memoR[next]) % 2;
				ans[memoR[next] + mod]++;
			}

		}

		else {
			if (S[i] == 'R') {
				ll mod = (memoR[next] - i) % 2;
				ans[memoR[next] + mod]++;
			}
			else {
				ll mod = (i - memoR[next - 1]) % 2;
				ans[memoR[next - 1] + mod]++;
			}
		}
	}


	for (ll i = 0; i < size; i++) {
		cout << ans[i] << " ";
	}


}



Measured memory_bytes: 1864
#include<iostream>

using namespace std;

long gcd(long n, long m) {
    if (n < m)swap(n, m);
    if (n == m || m == 0)return n;
    return gcd(m, n % m);
}

int main() {
    long n, m;
    cin >> n >> m;
    cout << gcd(n, m) << endl;
}


Measured memory_bytes: 3108
import java.io.IOException;
import java.util.Scanner;

public class Main{
	public static int n;
	public static int A[];
	public static int B[];
	public static int C[] = new int[10000];
	public static StringBuilder sb = new StringBuilder();

	public static void main(String[] args) throws NumberFormatException, IOException {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		A = new int[n];
		B = new int[n];

		for(int i = 0; i<n ;i++){
			A[i] = scan.nextInt();
			C[A[i]]++;
		}

		for(int i=1;i<10000;i++){
			C[i] = C[i-1]+C[i];
		}

		for(int i = n-1;i>=0;i--){
			B[C[A[i]]-1] = A[i];
			C[A[i]]--;
		}

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

	}

}

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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
//const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;
#define ret() return 0;

bool contain(set<char> &s, char a) { return s.find(a) != s.end(); }

//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);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

class CumulativeSum {
    vector<double> numbers;
    vector<double> sums;

public:
    CumulativeSum(int n) {
        numbers.resize(n);
        sums.resize(n);
    }

    void set(int i, double value) {
        numbers[i] = value;
    }

    double getSum(int i) {
        if (i == -1) return 0;
        if (i == sums.size()) return 0;
        return sums[i];
    }

    double getSectionSum(int start, int end) {
        return getSum(end) - getSum(start - 1);
    }

    void calculate() {
        for (int i = 0; i < numbers.size(); i++) {
            sums[i] = getSum(i - 1) + numbers[i];
        }
    }

};


int main() {
    int n, k;
    cin >> n >> k;
    CumulativeSum cs(n);
    rep (i, n) {
        double p;
        cin >> p;

        double e = (p + 1) / 2;
        cs.set(i, e);
    }
    cs.calculate();
    double ans = 0;
    for (int i = 0; i + k <= n; i++) {
        cmax(ans, cs.getSectionSum(i, i + k - 1));
    }
    printf("%.20f\n", ans);
}




Measured memory_bytes: 3328
import * as fs from 'fs';

export function Main(input: string) {
    const [a, b, h, m] = input.split(' ').map(int => parseInt(int));    // ?

    const angleH = 2 * Math.PI * (h + m / 60) / 12;   // ?
    const angleM = 2 * Math.PI * m / 60;  // ?

    const Xh = Math.cos(angleH) * a;    // ?
    const Yh = Math.sin(angleH) * a;    // ?

    const Xm = Math.cos(angleM) * b;    // ?
    const Ym = Math.sin(angleM) * b;    // ?

    let result: any = Math.sqrt((Xh - Xm) ** 2 + (Yh - Ym) ** 2);
    // result = result.toFixed(9);

    //output

    console.log(result);
    return result;
}

// Don't edit this line!
Main(fs.readFileSync("/dev/stdin", "utf8"));


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

int factor(int n){
	if(n == 0)
		return 1;
	return n*factor(n-1);
}

int main(){
	int N, M;
	cin >> N >> M;
	int sum = N*(N-1)/2;
	sum += M*(M-1)/2;
	cout << sum << endl;

	return 0;	
}

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

int main(){
	string s, t;
	int a, b;
	string u;
	cin >> s >> t >> a >> b >> u;

	if(s == u)
		cout << a-1 << " " << b << endl;
	else
		cout << a << " " << b-1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
  int N, n;
  int x, y;
  
  cin >> N >> n;
  int f[4];
  while(n--){
    cin >> x >> y;
    
    f[0] = x;
    f[1] = y;
    f[2] = N+1-x;
    f[3] = N+1-y;
    
    sort(f, f+4);

    if(f[0] % 3 == 1) cout << 1 << endl;
    else if(f[0] % 3 == 2) cout << 2 << endl;
    else cout << 3 << endl;
  }
  return 0;
}

    

Measured memory_bytes: 0
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto na = readln.split.to!(int[]);
    auto N = na[0];
    auto A = na[1];
    auto xs = readln.split.to!(int[]);

    auto DP = new long[][][](N, N, N*50+1);
    foreach (ref a; DP) foreach (ref b; a) foreach (ref c; b) c = -1;
    long solve(int i, int n, int s) {
        if (i == N) return n != 0 && s / n == A && s % n == 0 ? 1 : 0;
        if (DP[i][n][s] == -1) {
            DP[i][n][s] = solve(i+1, n, s) + solve(i+1, n+1, s + xs[i]);
        }
        return DP[i][n][s];
    }
    writeln(solve(0, 0, 0));
}

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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

int h1, h2, m1, m2, m, k;

int main() {
	scanf("%d%d%d%d%d", &h1, &m1, &h2, &m2, &k);
	m = (h2 - h1) * 60;
	if (m2 < m1) m2 += 60, m -= 60;
	m += m2 - m1;
	printf("%d\n", m - k);
}

Measured memory_bytes: 3828
import java.util.Scanner;
public class Main {

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

		int A = sc.nextInt();
		int B = sc.nextInt();

		int max = A + B;
		if(max < A-B) {
			max = A-B;
		}if(max < A*B) {
			max = A*B;
		}System.out.println(max);

	}

}


Measured memory_bytes: 23124
/**
 * @author Finn Lidbetter
 */
import java.util.*;
import java.io.*;
import java.awt.geom.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();
    
    String[] s= br.readLine().split(" ");
    int n = Integer.parseInt(s[0]);
    int m = Integer.parseInt(s[1]);
    int[][] mat = new int[n][m];
    for (int i=0; i<n; i++) {
      s = br.readLine().split(" ");
      for (int j=0; j<m; j++) {
        mat[i][j] = Integer.parseInt(s[j])-1;
      }
    }
    int[] ptrs = new int[n];
    HashSet<Integer> removed = new HashSet<Integer>();
    int minMax = n+1;
    while (removed.size()<m) {
      int[] count = new int[m];
      for (int j=0; j<n; j++) {
        int v = mat[j][ptrs[j]];
        while (removed.contains(v)) {
          ptrs[j]++;
          v = mat[j][ptrs[j]];
        }
        count[v]++;
      }
      int max = 0;
      for (int j=0; j<m; j++) {
        if (count[j]>max) {
          max = count[j];
        }
      }
      if (max<minMax)
        minMax = max;
      for (int j=0; j<m; j++) {
        if (count[j]==max)
          removed.add(j);
      }
    }
    System.out.println(minMax);
  }
}


Measured memory_bytes: 32720
sx, sy, tx, ty = map(int, input().split())
yoko = tx - sx
tate = ty - sy
#まず一周
for _ in range(yoko):
    print("R", end="")
for _ in range(tate):
    print("U", end="")
for _ in range(yoko):
    print("L", end="")
for _ in range(tate):
    print("D", end="")

#二週目
print("D", end="")
for _ in range(yoko + 1):
    print("R", end="")
for _ in range(tate + 1):
    print("U", end="")
print("L", end="")
#二週半
print("U", end="")
for _ in range(yoko + 1):
    print("L", end="")
for _ in range(tate + 1):
    print("D", end="")
print("R", end="")



Measured memory_bytes: 69976
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, k;
  	int f = 1;
  	cin >> n >> k;
  	for (int i = 0; i<n; i++){
    	if(f*2 <= f+k){
          f *= 2;
        }else{
          f += k;
        }
    }
  	cout << f << endl;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> A(M);
  for(int i=0;i<M;i++)  cin >> A.at(i);

  vector<int> cnt={0,2,5,5,4,5,6,3,7,6};
  sort(A.begin(),A.end());

  vector<int> dp(N+1,0);
  dp.at(0)=1;
  for(int i=0;i<M;i++){
    int x=cnt.at(A.at(i));
    for(int j=0;j<N+1;j++){
      if(j-x<0) continue;
      if(dp.at(j-x)==0) continue;
      dp.at(j)=max(dp.at(j),dp.at(j-x)+1);
    }
  }
  string ans="";
  int now=N;
  for(int i=M-1;i>=0;i--){
    int x=cnt.at(A.at(i));
    for(;now>=0;){
      if(now-x<0) break;
      if(dp.at(now-x)==0) break;
      if(dp.at(now)==dp.at(now-x)+1){
        ans+=(A.at(i)+'0');
        now-=x;
      }
      else  break;
    }
  }
  cout << ans << endl;

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	string s;
	cin>> s;

	cout<< s[0] << s[1] << s[2] <<endl;

	return 0;
}

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

using namespace std;

#define ll long long
#define pb push_back
#define pf push_front
#define loop(i, n) for(int i = 0 ; i < n ; ++i)
#define LOOP(i, a, b) for(int i = a ; i < b ; ++i)
#define max3(a, b, c) max(a, max(b,c))
#define max4(a, b, c, d) max3(a, b, max(c, d))
#define ff first
#define ss second
#define mkp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vii vector<pii>
#define vvii vector<vii>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define nmbr(c) (int)(c-'0')
#define ltr(c) (int)(c-'a')
#define INF 1e18
#define inf 1e9
#define MOD 1000000007 //check
#define _69e27 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int d;
string k;
ll dp[10005][105][2];

ll ways(int i, int sum, int f)
{
	if(i == sz(k) && sum == 0) return 1;
	if(i == sz(k)) return 0;
	ll &ans = dp[i][sum][f];
	if(ans != -1) return ans;
	ans = 0;
	if(f) loop(j, 10)
	{
		ans += ways(i+1, (sum+j)%d, 1);
		ans %= MOD;
	}
	else loop(j, nmbr(k[i])+1)
	{
		if(j != nmbr(k[i])) ans += ways(i+1, (sum+j)%d, 1);
		else ans += ways(i+1, (sum+j)%d, 0);
		ans %= MOD;
	}
	return ans%MOD;
}
int main() {
	_69e27;
	memset(dp, -1, sizeof(dp));
	cin >> k >> d;
	cout << (ways(0, 0, 0)-1+MOD)%MOD;
	return 0;
}

Measured memory_bytes: 17408
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair

int main() {
int r;
cin>>r;
cout<<fixed<<setprecision(3)<<2*r*3.141<<endl;
return 0;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < N; X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair


using namespace std;

int main(){

    //Aiに出てきた数字の回数の偶奇をみればいい
    //mapに数字を入れていって、最後にmapをループで回す
    //O(n log n)か  

    int n;
    cin >> n;

    map<int,int> m;
    int ans = 0;

    rep(i,n){
        int tmp;
        cin >> tmp;
        m[tmp]++;
    }

    for(auto itr = m.begin(); itr != m.end(); itr++){
        if(itr->second % 2 == 1) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define test            int t; cin>>t; while(t--)
#define io             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
int32_t main(){
  io ;

  int n;
  cin >> n;
  long double d;
  cin >> d; 
  vector<pii> arr(n+1);
  for (int i = 0; i < n;i++){
      cin >> arr[i].ff >> arr[i].ss; 
  }
  vector<long double> s; 
  for (int i = 0; i < n; i++){
      long double x = sqrt(arr[i].ff * arr[i].ff + arr[i].ss * arr[i].ss);
      s.pb(x);
  }
  sort(s.begin(), s.end());
  map<long double, int> p;
  int i = 1;
  for(auto f:s){
      p[f] = i++; 
  }
  int ans; 
  auto it = lower_bound(s.begin(), s.end(), d); 
  if(*it==d){
      ans = p[*it]; 
  }else{
    if(it==s.begin()){
       ans = 0; 
    }else{
      it--;
      ans = p[*it]; 
    }
  }
  cout << ans << "\n"; 
}

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

#define all(v)  begin(v), end(v)
#define endl    '\n';
#define int     long long
#define pii     pair<int, int>
#define sz(x)   (int) x.size()

void test_case() {
    string s;
    cin >> s;
    
    int n = s.size();
    if (s[n-1] == 's') {
        s += "es";
    }
    else {
        s += "s";
    }
    cout << s << endl;
}

int32_t main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(0);

    int t = 1;
    // cin >> t;

    while (t--) { 
        test_case();
    }
    return 0;
}


Measured memory_bytes: 3672
import java.io.*;
import java.util.*;
 
public class Main {
    void run() {
        int N = readInt();
        for (int i = 1; i <= N; i++) {
            int x = i;
            if (x % 3 == 0) {
                sysout.print(" " + i);
                continue;
            }
            while (x > 0) {
                boolean end = false;
                if (x % 10 == 3) {
                    sysout.print(" " + i);
                    end = true;
                }
                if (end) break;
                x /= 10;
            }
        }
        sysout.println();
    }
 
    public static void main(String[] args) {
        new Main().run();
    }
 
    // flush automatically iff you call `println` or `printf` or `format`.
    PrintWriter sysout = new PrintWriter(System.out, true);
 
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer buffer = null;
 
    String readLine() {
        buffer = null;
        try {
            return in.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
 
    String read() {
        if (buffer == null || !buffer.hasMoreTokens()) {
            buffer = new StringTokenizer(readLine());
        }
        return buffer.nextToken();
    }
 
    int readInt() {
        return Integer.parseInt(read());
    }
 
    long readLong() {
        return Long.parseLong(read());
    }
 
    double readDouble() {
        return Double.parseDouble(read());
    }
}

Measured memory_bytes: 25584
import java.util.*;

class Main{
 public static void main(String[] args){
 
  Scanner scan = new Scanner(System.in).useDelimiter("\\s\\n*");

  int W=scan.nextInt(),H=scan.nextInt(),x=scan.nextInt(),y=scan.nextInt(),r=scan.nextInt();

  if(x+r<=W && x-r>=0 && y+r<=H && y-r>=0){System.out.println("Yes");}
  else{System.out.println("No");}
 }
}

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

using namespace std;

int main(){
    int n;
    cin>>n;
    long long ans=0;
    
    for(int i=0;i<n;i++){
        int hoge;
        cin>>hoge;
        while(hoge%2==0){
            hoge/=2;
            ans++;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}

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

using namespace std;

#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second

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

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

vector<vector<char>> grid;
map<pii, bool> visited;

ll dott, hashh;

void dfs(pii v) {
    visited[v] = true;
    if (grid[v.ff][v.ss] == '.') dott++;
    else hashh++;
    for (int i = 0; i < 4; ++i) {
        pii u = mp(v.ff + dx[i], v.ss + dy[i]);
        if (!visited[u] && grid[u.ff][u.ss] == (grid[v.ff][v.ss] == '#' ? '.' : '#')) {
            dfs(u);
        }
    }
}

int main() {
    int h, w;
    cin >> h >> w;
    vector<pii> srcs;
    visited.clear();
    grid = vector<vector<char>>(h + 2, vector<char>(w + 2, '-'));
    for (int i = 1; i <= h; ++i) {
        string str;
        cin >> str;
        for (int j = 1; j <= w; ++j) {
            grid[i][j] = str[j - 1];
            if (str[j - 1] == '.') srcs.eb(mp(i, j));
        }
    }
    ll ans = 0;
    for (pii src : srcs) {
        dott = 0;
        hashh = 0;
        dfs(src);
        ans += dott * hashh;
    }
    cout << ans << "\n";
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  ll a,b,c;cin>>a>>b>>c;
  if((a==b&&c!=a)||(a==c&&b!=a)||(b==c&&b!=a))out("Yes");
  else out("No");

  return 0;
}


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

typedef pair<int, int> P;
const int MAX = 51;
int a[MAX];

int main() {
  int n, min, max;
  bool satisfy = true;
  int cnt = 0;
  vector<P> op;
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> a[i];
    if (i==0) {
      min = max = 0;
    } else {
      satisfy &= (a[i-1] <= a[i]);
    }
    if (a[min] > a[i]) {
      min = i;
    }
    if (a[max] < a[i]) {
      max = i;
    }
  }
  // if everything is same, or in order no need to modify.
  if (a[min] == a[max] || satisfy) {
    cout << cnt << endl;
    return 0;
  }
  bool positive = true;
  if (a[min] < 0) {
    if (abs(a[min]) < abs(a[max])) {
      for (int i=0;i<n;i++) {
        a[i] += a[max];
        op.push_back(P(max, i));
        cnt++;
      }
    } else {
      for (int i=0;i<n;i++) {
        a[i] += a[min];
        op.push_back(P(min, i));
        cnt++;
      }
    }
  }
  // Then make arrays to be
  // a1, a1 + a2, a1 + a2 + a3, ... if all value is positive
  // a1 + a2 + ..., ..., an-1 + an, an if all value is negative
  if (a[0] < 0) {
    for (int i=n-2;i>=0;i--) {
      a[i] += a[i+1];
      op.push_back(P(i+1, i));
      cnt++;
    }
  } else {
    for (int i=0;i<n-1;i++) {
      a[i+1] += a[i];
      op.push_back(P(i, i+1));
      cnt++;
    }
  }
  cout << cnt << endl;
  for (int i=0;i<op.size();i++) {
    cout << (op[i].first + 1) << " " << (op[i].second + 1) << endl;
  }
}


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

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

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256