akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
  int N,X;
  cin>>N>>X;
  int sum=0,cnt=1;
  int L[N];
  rep(i,N){
      cin>>L[i];
      sum+=L[i];
      
      if(sum>X){
          break;
      }
      cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 3536
open Batteries
let explode s = List.init (String.length s) (String.get s)
let s = read_line () |> explode

let get_all_elements l =
  let rec get existed lst =
    match lst with
     [] -> existed
    | first :: rest -> if List.exists (fun a -> a = first) existed then get existed rest 
                       else get (first :: existed) rest
  in get [] l

let ans l =
  let rec p lst =
    match lst with
    | [] -> true
    | first :: rest -> if List.length (List.find_all (fun a -> a = first) s) = 2 then p rest else false
  in p l

let all = get_all_elements s
let _ = if List.length all != 2 then print_endline "No"
        else if ans all then print_endline "Yes" else print_endline "No"


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

int main() {
  int N, K, x;
  cin >> N >> K;
  x = 1;
  for (int i = 0; i < N; i++) {
    if (x * 2 > x + K) {
      x += K;
    }
    else {
      x *= 2;
    }
  }
  cout << x << endl;
}


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

using namespace std;

int main(){

	int data;
	while(cin>>data&&data!=0){
		vector<int> d;
		set<int> s;
		s.insert(data);
		d.push_back(data);
		for(int i = 0; i < 4; i++){
			int t;
			cin>>t;
			s.insert(t);
			d.push_back(t);
		}
		if(s.size()==3||s.size()==1){
			for(int i = 0; i < 5; i++){
				cout<<3<<endl;
			}
		}
		else{
			bool f[4];
			f[0]=f[3]=f[1]=f[2]=false;
			for(set<int>::iterator it = s.begin(); it!=s.end();it++){
				f[*it]=true;
			}
			if(!f[3]){
				for(int i = 0; i < 5; i++){
					if(d[i]==1){
						cout<<1<<endl;
					}
					else
						cout<<2<<endl;
				}
			}
			else if(!f[1]){
				for(int i = 0; i < 5; i++){
					if(d[i]==2){
						cout<<1<<endl;
					}
					else
						cout<<2<<endl;
				}
			}
			else if(!f[2]){
				for(int i = 0; i < 5; i++){
					if(d[i]==3){
						cout<<1<<endl;
					}
					else
						cout<<2<<endl;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 0
a,b,c = gets.split.map(&:to_i)
puts [
  a*b*(c/2) - a*b*(c-c/2),
  a*c*(b/2) - a*c*(b-b/2),
  b*c*(a/2) - b*c*(a-a/2),
].map(&:abs).min


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

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

    if (a<k)
    {
        if (a+b < k)
        {
            cout << a*2 + b -k << endl;
        }else{
            cout << a << endl;
        }
        return 0;
    }else{
        cout << k << endl;
        return 0;
    }
    
}

Measured memory_bytes: 3652
#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 all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (ll)4e18;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll h, w;
	cin >> h >> w;
	if (h % 3 == 0 || w % 3 == 0) {
		cout << 0 << endl;
		return 0;
	}
	ll ans = inf;
	for (int i = 1; i <= h - 1; ++i) {
		if (i >= h - i) {
			ll num1 = (h - i) * w;
			ll num2 = int(i / 2) * w;
			ll num3 = int(w / 2) * i;
			ll res1 = max({ num1,num2,i * w - num2 }) - min({ num1,num2,i * w - num2 });
			ll res2 = max({ num1,num3,i * w - num3 }) - min({ num1,num3,i * w - num3 });
			mins(ans, min({ res1,res2 }));
		}
		else {
			ll num1 = i * w;
			ll num2 = int((h - i) / 2) * w;
			ll num3 = int(w / 2) * (h - i);
			ll res1 = max({ num1,num2,(h - i) * w - num2 }) - min({ num1,num2,(h - i) * w - num2 });
			ll res2 = max({ num1,num3,(h - i) * w - num3 }) - min({ num1,num3,(h - i) * w - num3 });
			mins(ans, min({ res1,res2 }));
		}
	}
	for (int i = 1; i <= w - 1; ++i) {
		if (i >= w - i) {
			ll num1 = (w - i) * h;
			ll num2 = int(i / 2) * h;
			ll num3 = int(h / 2) * i;
			ll res1 = max({ num1,num2,i * h - num2 }) - min({ num1,num2,i * h - num2 });
			ll res2 = max({ num1,num3,i * h - num3 }) - min({ num1,num3,i * h - num3 });
			mins(ans, min({ res1,res2 }));
		}
		else {
			ll num1 = i * h;
			ll num2 = int((w - i) / 2) * h;
			ll num3 = int(h / 2) * (w - i);
			ll res1 = max({ num1,num2,(w - i) * h - num2 }) - min({ num1,num2,(w - i) * h - num2 });
			ll res2 = max({ num1,num3,(w - i) * h - num3 }) - min({ num1,num3,(w - i) * h - num3 });
			mins(ans, min({ res1,res2 }));
		}
	}
	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++)

using namespace std;
typedef long long LL;

int main(){
  int N, M;
  cin >> N >> M;
  int tot=1900*M+100*(N-M);
  cout << tot*pow(2,M) << endl;

  return 0;
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	if (n % 2 == 0) cout << n / 2 - 1 << endl;
	else cout << n / 2 << endl;
	return 0;
}

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

int main() {
    int a,b,t;
    cin >> a >> b >> t;
    cout << b*(t/a) << endl;
}


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

#ifdef DEBUG
#include "../.inc/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("_input.txt");

    long long A, B;
    cin >> A >> B;

    if ((A+B) % 2 == 0) {
        cout << (A+B)/2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;

const ll INF = LLONG_MAX;
const ll MOD = 1e9+7;

int main() {
    // input, ready
    int K,A,B;
    cin >> K >> A >> B;

    // resolve
    int check = 0;
    bool flag = false;
    while(check <= B) {
        check+=K;
        if (A <= check && check <= B) {
            flag = true;
            break;
        }
    }

    // output
    if (flag) cout << "OK" << endl;
    else cout << "NG" << endl;

    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h> 
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<vector<int>>;

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int m1;
    rep(i,n){
        cin>>a[i];
        m1=max(m1,a[i]);
    }

    int m2=0;
    int cnt=0;
    rep(i,n){
        if(a[i]==m1)++cnt;
        else m2=max(m2,a[i]);
    }

    rep(i,n){
        if(a[i]!=m1){
            cout<<m1<<endl;
        }else if(cnt>1){
            cout<<m1<<endl;
        }else{
            cout<<m2<<endl;
        }
    }

}

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

#define ll long long
const int mod = 1e9+7;
ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)res=res*b%mod;
        b>>=1;
        a=a*a%mod;

    }
    return res;
}
int main(){
    int x,i;
    cin>>x;
    string s;
    cin>>s;
    for(i=0;i<s.length();i++){
        s[i]+=x;
        if(s[i]>'Z')s[i]-=26;
    }
    cout<<s;



}


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

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 50);

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int N;
    cin >> N;
    vi A(N);
    rep(i, N) cin >> A[i];

    bool ok = true;
    rep(i, N) {
        if (A[i] % 2 == 0) {
            if (!(A[i] % 3 == 0 or A[i] % 5 == 0)) {
                ok = false;
            }
        }
    }

    if (ok) {
        cout << "APPROVED" << endl;
    } else {
        cout << "DENIED" << endl;
    }

    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> isPair;
using vvll = vector< vector<ll> >;
using vll = vector<ll> ;
#define Pll pair<ll,ll>
#define vpll vector<pll>
#define sll set<ll>
#define mll map<ll,ll>

const ll oo=1e18;
const ll maxs = 3e5+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
#define mp make_pair
#define I insert
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define LB lower_bound
#define UB upper_bound
#define line() cout<<endl;
#define fr(i,a,b) for(int i=a;i<=b;++i)
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mst(x,a) memset(x,a,sizeof(x))

ll n;
ll a[maxs];

ll go(ll p)
{
    ll sum=0;
    for(ll i=0;i<n;i++)
    {
        ll val = a[i] - p;
        sum += (val*val);
    }
    return sum;
}

int main() 
{
    fastio();
	ll t=1;
    //cin>>t;
    while(t--){
        cin>>n;
        
        for(ll i=0;i<n;i++)
            cin>>a[i];
        
        ll MIN = oo;
        for(ll i=1;i<=100;i++){
            ll val = go(i);
            MIN = min(MIN , val);
        }
        
        cout << MIN << endl;
            
    }  
    return 0;
}

Measured memory_bytes: 256
def pow(m,n,a)
  if n==0
     1
  elsif n.even?
    pow(m*m % a,n/2,a) % a
  else
    pow(m*m % a,n/2,a)*m % a
  end
end

def main
  a=1000000007
  fh=STDIN
  #fh=File.new("x.txt", "r")
  m,n = fh.gets.chomp.split.map(&:to_i)
  puts pow(m,n,a)
end

if $0 == __FILE__ then
  main
end



Measured memory_bytes: 6856
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;
int dp[1111][1111];
const int mod=1e9+7;

int main(){
  int h,w;cin>>h>>w;
  char v[h][w];
  for(int i=0;i<h;i++)for(int j=0;j<w;j++)cin>>v[i][j];
  for(int i=0;i<h;i++)for(int j=0;j<w;j++)dp[i][j]=0;
  for(int i=h-1;i>=0;i--){
    if(v[i][w-1]=='#')break;
    dp[i][w-1]=1;
  }
  for(int j=w-1;j>=0;j--){
    if(v[h-1][j]=='#')break;
    dp[h-1][j]=1;
  }
  for(int i=h-2;i>=0;i--)for(int j=w-2;j>=0;j--){
    if(v[i][j]=='#')continue;
    if(v[i+1][j]=='.')dp[i][j]+=dp[i+1][j];
    dp[i][j]%=mod;
    if(v[i][j+1]=='.')dp[i][j]+=dp[i][j+1];
    dp[i][j]%=mod;
  }
  cout<<dp[0][0]%mod;

}

Measured memory_bytes: 5504
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		while(true){
			int n = stdIn.nextInt();
			int r = stdIn.nextInt();
			if(n==0&&r==0){
				return;
			}
			int[] a = new int[n+1];
			for(int i=1;i<=n;i++){
				a[n-i+1] = i;
			}
			for(int i=0;i<r;i++){
				int p = stdIn.nextInt();
				int c = stdIn.nextInt();
				int[] b = new int[n+1];
				for(int j=1;j<=n;j++){
					b[j] = a[j];
				}
				for(int j=1;j<=c;j++){
					a[j] = b[p+j-1];
				}
				for(int j=c+1;j<p+c;j++){
					a[j] = b[j-c];
				}
			}
			System.out.println(a[1]);
		}
	}
}

Measured memory_bytes: 12000
//
//AtCoder Regular Contest 080
//C - 4-adjacent
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    vector<int> a(n);
    int cnt2=0;
    int cnt4=0;
    REP(i, n) {
        cin >> a[i];
        if (a[i]%4==0) cnt4++;
        else if (a[i]%2==0) cnt2++;
    }
    string ans="No";
    if (n/2<=cnt4+cnt2/2) ans="Yes";
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3768
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n;
    cin>>n;
    string s;
    cin>>s;
    ll r=0,g=0,b=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R')   r++;
        else if(s[i]=='G')  g++;
        else if(s[i]=='B')  b++;
    }
    ll res = r*g*b;
    //cout<<res<<endl;
    for(int j=0;j<n;j++){
        for(int d=1;d<n;d++){
            int i = j-d, k=j+d;
            if(i>=0 && k<n && s[i]!=s[j] && s[j]!=s[k] && s[i]!=s[k])   res--;
        }
    }
    cout<<res<<endl;
    /*
    int cnt=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(s[i]=='R' && s[j]=='G' && s[k]=='B'){
                    if((j-i)!=(k-j))    cnt++;
                }
                if(s[i]=='R' && s[j]=='B' && s[k]=='G'){
                    if((j-i)!=(k-j))    cnt++;
                }
                if(s[i]=='G' && s[j]=='R' && s[k]=='B'){
                    if((j-i)!=(k-j))    cnt++;
                }
                if(s[i]=='G' && s[j]=='B' && s[k]=='R'){
                    if((j-i)!=(k-j))    cnt++;
                }
                if(s[i]=='B' && s[j]=='R' && s[k]=='G'){
                    if((j-i)!=(k-j))    cnt++;
                }
                if(s[i]=='B' && s[j]=='G' && s[k]=='R'){
                    if((j-i)!=(k-j))    cnt++;
                }
            }
        }
    }
    cout<<cnt<<endl;
    vector<bool> r,g,b;
    for(int i=0;i<n;i++){
        if(s[i]=='R') r.push_back(i);
        else if(s[i]=='G')  g.push_back(i);
        else    b.push_back(i);
    }
    vector<bool> r_vis(r.size(), false);
    vector<bool> g_vis(g.size(), false);
    vector<bool> b_vis(b.size(), false);

    for(int i=0;i<r.size();)
    */
    return 0;
}




Measured memory_bytes: 3640
use std::io::stdin;
use std::str::FromStr;
#[allow(dead_code, unused_mut)]
fn read<T: FromStr>() -> T {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().ok().expect("1")
}
#[allow(dead_code, unused_mut)]
fn read_vec<T: FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().expect("2"))
        .collect()
}
#[allow(dead_code, unused_mut)]
fn read_two<T: FromStr>() -> (T, T) {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let mut x = s.split_whitespace().map(|x| x.parse().ok().unwrap());
    (x.next().unwrap(), x.next().unwrap())
}
#[allow(dead_code, unused_mut)]
fn read_three<T: FromStr>() -> (T, T, T) {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let mut x = s.split_whitespace().map(|x| x.parse().ok().unwrap());
    (x.next().unwrap(), x.next().unwrap(), x.next().unwrap())
}
fn main() {
    let n: i32 = read();
    let mut v: Vec<i32> = read_vec();
    let mut ans = 0;
    v.sort();
    v.reverse();
    for i in 0..n {
        if i % 2 == 0 {
            ans += v[i as usize];
        } else {
            ans -= v[i as usize];
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
open Scanf
open Printf

let read_int () = scanf " %d" (fun x -> x)
let rec read_ints n = if n = 0 then [] else let i = read_int () in i :: read_ints (n-1)

let () =
  let n = read_int () in
  let xs = List.sort (-) @@ read_ints n in
  let f (a, h) x = if h < x then (a+1, x) else (a, h) in
  let ans, _ = List.fold_left f (0, -1) xs in
  printf "%d\n" ans


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <array>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

int mod(int x, int md) {
  x %= md;
  if (x < 0) {
    x += md;
  }
  return x;
}

int main() {
  int N, L, T;
  std::cin >> N >> L >> T;
  std::vector<int> X(N), D(N);
  std::vector<int> after(N);
  int count = 0;
  for (int i: range(0, N)) {
    std::cin >> X[i] >> D[i];
    D[i] = (D[i] == 1 ? 1 : -1);
    after[i] = mod(X[i] + D[i] * T, L);
    if (D[i] == 1) {
      int val = T - (L - X[i]);
      if (val >= 0) {
        count += val / L + 1;
      }
    }
    else {
      int val = (T - 1) - X[i];
      if (val >= 0) {
        count -= val / L + 1;
      }
    }
  }
  std::sort(after.begin(), after.end());
  for (int i: range(0, N)) {
    std::cout << after[mod(count + i, N)] << '\n';
  }
  return 0;
}


Measured memory_bytes: 2304
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp7
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] param = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int studentNum = param[0];
            int checkPointNum = param[1];

            List<List<int>> student = new List<List<int>>();
            List<List<int>> checkPoint = new List<List<int>>();

            for (int index = 0; index < studentNum; index++)
            {
                student.Add(Console.ReadLine().Split(' ').Select(int.Parse).ToList());
            }

            for (int index = 0; index < checkPointNum; index++)
            {
                checkPoint.Add(Console.ReadLine().Split(' ').Select(int.Parse).ToList());
            }


            //search most near check point

            foreach (var s in student)
            {
                var distances = checkPoint.Select(v => Math.Abs(v[0] - s[0]) + Math.Abs(v[1] - s[1])).ToList();

                Console.WriteLine(1 + distances.IndexOf(distances.Min()));


            }







        }
    }
}


Measured memory_bytes: 13408
function Main(input) {
  'use strict';

  const temp = input.split(" ");

  const a = parseInt(temp[0], 10);
  const b = parseInt(temp[1], 10);

  let payment;
  if(a <= 5) payment = 0;
  else if(a <= 12) payment = b / 2;
  else payment = b;

  console.log(payment);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22964
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <string>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;


int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main(int argc, const char * argv[]) {

    string N;
    cin >> N;
    int cnt = 0;
    for(int i = 0;i<N.size();i++){
        
         if(N[i]== '2'){

            cnt+=1;
        }
     }
     cout << cnt <<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using static System.Console;
using static System.Math;
class Simple
{
    int N;
    void Solve() {
        //input
        N = io.Int;
        //cal
        Func<int, long> lucas = null;
        Func<int, long> mLucas = null;
        lucas = (n) => {
            if (n == 0) return 2;
            if (n == 1) return 1;
            return mLucas(n - 1) + mLucas(n - 2);
        };
        mLucas = Memoize(lucas);
        var ans = mLucas(N);
        //ret
        WriteLine(ans);
    }
    Func<Func<int, long>, Func<int,long>> Memoize = (f) => {
        var memo = new Dictionary<int, long>();
        Func<int, long> memoizedFunc = (input) => {
            if (memo.ContainsKey(input)) return memo[input];
            return memo[input] = f(input);
        };
        return memoizedFunc;
    };
   
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    private void Stream() {
        //var exStdIn = new System.IO.StreamReader("stdin.txt");
        //SetIn(exStdIn);
        Solve();
        io.Flush();
    }
}
class SimpleIO
{
    string[] _nextBuffer;
    int _bufferCnt;
    char[] cs = new char[] { ' ', '"', ',' };
    StreamWriter sw = new StreamWriter(OpenStandardOutput()) {
        AutoFlush = false
    };
    public SimpleIO() {
        _nextBuffer = new string[0];
        _bufferCnt = 0;
        SetOut(sw);
    }
    string Next() {
        if (_bufferCnt < _nextBuffer.Length)
            return _nextBuffer[_bufferCnt++];
        var st = ReadLine();
        while (st == "")
            st = ReadLine();
        if (st != null)
            _nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        else
            st = "";
        _bufferCnt = 0;
        return _nextBuffer[_bufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void Flush() => Out.Flush();
}


Measured memory_bytes: 13152
N,A,B,C=map(int,input().split())
lis=[int(input()) for i in range(N)]

def kado(cur,a,b,c):
  if cur==N:
    return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else 10**9
  cal1=kado(cur+1,a,b,c)
  cal2=kado(cur+1,a+lis[cur],b,c)+10
  cal3=kado(cur+1,a,b+lis[cur],c)+10
  cal4=kado(cur+1,a,b,c+lis[cur])+10
  return min(cal1,cal2,cal3,cal4)
print(kado(0,0,0,0))

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

int main() {
  map<string, int> mp;
  int N; cin >> N;
  for (int i = 0; i < N; ++i) {
    string s; cin >> s;
    mp[s] = (mp.find(s) == end(mp)) ? 1 : mp[s] + 1;
  }
  int M; cin >> M;
  for (int i = 0; i < M; ++i) {
    string t; cin >> t;
    mp[t] = (mp.find(t) == end(mp)) ? -1 : mp[t] - 1;
  }
  int ans = 0;
  for (auto&& x : mp) {
    ans = max(ans, x.second);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());

		while(N/10 > 0) {
			N = N%10;
		}

		if(N == 3) {
			System.out.println("bon");

		} else if(N==0 || N==1 ||N==6||N==8) {
		System.out.println("pon");

		} else {
		System.out.println("hon");

		}
	}
}


Measured memory_bytes: 35732
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
using namespace std;
 
 
 


int main() 
{ 
    int n,k;
    cin>>n>>k;
    int entry=0;
    int a[n];
    pan(i,n) {
        cin>>a[i];
        if(a[i]>=k) entry++;
    }
    cout<<entry;
} 


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 int main(){
   int H,W;
   cin >> H >> W;
   vector<vector<char>>s(H,vector<char>(W));
  for(int i = 0 ; H > i ; i++ ){
    for( int j = 0 ; W > j ; j++ ){
      cin >> s.at(i).at(j);
    }
  }
   
 
   vector<bool>row(H,false);
   vector<bool>col(W,false);
   for( int i = 0 ; H > i ; i++){
     for(int j =0 ; W > j ; j++){
       if( s.at(i).at(j) == '#' ){
         row.at(i) = true;
         col.at(j) = true;
       }
     }
   }
   for( int i = 0 ; H > i ; i++){
     if( row.at(i) ){
       for( int j = 0 ; W > j ; j++){
         if ( col.at(j) ){
           cout << s.at(i).at(j);
         }
       }
        cout << endl;
     }
       
        }

 }

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

a, b, c, d = map(int, input().replace("\n","").split())

takahashihp = a
aokihp = c

while True:
    aokihp -= b
    if aokihp < 1:
        print("Yes")
        break
    takahashihp -= d
    if takahashihp < 1:
        print("No")
        break

Measured memory_bytes: 61616
N = int(input())
S = input()

white_all = S.count('.')
ans = white_all

white = 0
black = 0
for i, s in enumerate(S):
    if s is '.':
        white += 1
    else:
        black += 1
    ans = min(black+(white_all-white), ans)

print(ans)


Measured memory_bytes: 3500
s=input()
t=input()
cnt=0
k=0
for i in t:
  f=s.find(i,k)
  if f<0:
    cnt+=1
    f=s.find(i)
    if f==-1:
      print(-1)
      exit()
    else:
      k=f+1
  else:
    k=f+1
print(cnt*len(s)+k)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define ll long long
#define coYes cout << "Yes" << endl
#define coYES cout << "YES" << endl
#define coyes cout << "yes" << endl
#define coNo cout << "No" << endl
#define coNO cout << "NO" << endl
#define cono cout << "no" << endl
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
int gcd(int a, int b){ //最大公約数
    if(a%b == 0){
        return b;
    }else{
    return gcd(b, a%b);
    }
}

int main(){
    int n,m,x,temp;
    bool flag=false;
    cin >> n >> m >> x;
    vector<int> a(m);
    rep0(i,m)
        cin >> a[i];
    rep0(i,m){
        if(x<a[i]){
            temp=i;
            break;
        }//else{
        //   flag=true;
        //}
    /*if(flag){
        cout << 0 << endl;
        return 0;
    }*/
    }
    //cout << temp << endl;
    int q=0,w=0;
    rep0(i,temp)
        q++;
    //cout << q << endl;
    rep0(i,m-temp)
        w++;
    //cout << w << endl;
    cout << min(q,w) << endl;
    return 0;
}

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




int main() {
    
    int N,cnt=0,com;
    cin >> N;
    vector<int>P(N);
    
    for(int i=0;i<N;i++){
        cin >> P[i];
    }
    com=P[0];
    
    
    for(int i=0;i<N;i++){
        if(P[i]<=com){
            com=P[i];
            cnt++;
        }
    }
    
    cout << cnt << endl;
    
}







Measured memory_bytes: 1024
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divUp(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	ll a, b;
	cin >> a >> b;

	if (a <= b * 2)
	{
		cout << 0;
	}
	else
	{
		cout << (a - b*2);
	}
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	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 out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    vector<int> r(n);

    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];
    int a,b;
    r = q;
    sort(all(r));
    int cnt=0;
    do{
        if (r == p) a = cnt;
        if (r == q) b = cnt;
        cnt++;
    } while (next_permutation(all(r)));

    out(abs(a-b));
}

Measured memory_bytes: 256
h, w = map(int, input().split())

if h % 2 == 0:
    ans = int(h/2) * w
elif w % 2 == 0:
    ans = int(w/2) * h
else:
    ans = (int(w//2)+1)*(int(h//2)+1) + int(w//2)*int(h//2)

if h == 1 or w == 1:
    ans = 1

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int digit(int,long long);
void ABC060(int,int,int);
void ABC058(string,string);
void line(int);
int main(){
	int h,w;
	cin>>h>>w;
	string s[100];
	for(int i=0;i<h;i++){
		cin>>s[i];
	}
	for(int j=0;j<w+2;j++){
		cout<<"#";
	}
	cout<<endl;
	for(int l=0;l<h;l++){
		cout<<"#"<<s[l]<<"#"<<endl;
	}
	for(int k=0;k<w+2;k++){
		cout<<"#";
	}
	cout<<endl;
}
void ABC060(int a,int b,int c){
	
	for(int u=1;u<100;u++){
		if(a*u%b==c){
			cout<<"YES"<<endl;
			break;
			}
		else if(a*u%b==0){
			cout<<"NO"<<endl;
			break;
		}
	}
}
int digit(int n,long long dig){
	return n%(dig*10)/dig;
}
void ABC058(string o,string e){
	int z=o.size(),x=e.size();
	for(int i=0;i<z+x;i++){
		if(i%2==0){
			cout<<o[i/2];
		}
		else{
			cout<<e[(i+1)/2-1];
		}
	}
	cout<<endl;
}
void line(int w){
	
	for(int k=0;k<w+2;k++){
		cout<<"#";
	}
	cout<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>

int sumipe(const void* x, const void* y) {
	int a = *(const int*)x, b = *(const int*)y;
	return a > b ? -1 : a < b;
}

int N;
int A[271828];

int main(void) {
	int i;
	int j;
	int nyan = 0;
	int64_t kitaeri = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &A[i]) != 1) return 1;
	}
	qsort(A, N, sizeof(*A), sumipe);
	j = 0;
	for (i = 1; i < N; i++) {
		kitaeri += A[j];
		nyan++;
		if (nyan >= (j == 0 ? 1 : 2)) {
			j++;
			nyan = 0;
		}
	}
	printf("%" PRId64 "\n", kitaeri);
	return 0;
}

/*

降順に並べ替える貪欲

最初の人は1回、次以降は2回使える

*/


Measured memory_bytes: 3096
// C++ implementation of the approach 
#include <bits/stdc++.h> 
using namespace std; 
  
// Function to find special numbers 
void divisibilityCheck(int arr[], int n) 
{ 
  
    // Storing all array elements in a hash 
    // and finding maximum element in the array 
    unordered_set<int> s; 
    int max_ele = INT_MIN; 
    for (int i = 0; i < n; i++) { 
        s.insert(arr[i]); 
  
        // Update the maximum element of the array 
        max_ele = max(max_ele, arr[i]); 
    } 
  
    // Traversing the array elements and storing the array 
    // multiples that are present in s in res 
    unordered_set<int> res; 
    for (int i = 0; i < n; i++) { 
  
        // Check for non-zero values only 
        if (arr[i] != 0) { 
  
            // Checking the factors of current element 
            for (int j = arr[i] * 2; j <= max_ele; j += arr[i]) { 
  
                // If current factor is already part 
                // of the array then store it 
                if (s.find(j) != s.end()) 
                    res.insert(j); 
            } 
        } 
    } 
  
    // For non-distinct elmments 
    // To store the frequency of elements 
    unordered_map<int, int> mp; 
    for (int i = 0; i < n; i++) 
        mp[arr[i]]++; 
  
    unordered_map<int, int>::iterator it; 
    vector<int> ans; 
    for (it = mp.begin(); it != mp.end(); it++) { 
  
        // If frequency is at least 2 
        if (it->second >= 2) { 
            if (res.find(it->first) == res.end()) { 
  
                // If frequency is greater than 1 and 
                // the number is not divisible by 
                // any other number 
                int val = it->second; 
  
                // Then we push the element number of 
                // times it is present in the vector 
                while (val--) 
                    ans.push_back(it->first); 
            } 
        } 
  
        // If frequency is greater than 1 and the number 
        // is divisible by any other number 
        if (res.find(it->first) != res.end()) { 
            int val = it->second; 
  
            // Then we push the element number of 
            // times it is present in the vector 
            while (val--) 
                ans.push_back(it->first); 
        } 
    } 
    cout<<n-ans.size();

} 
  
// Driver code 
int main() 
{ int n=0;
    cin>>n;
    int arr[n]={0};
    for(int i=0;i<n;i++)
    cin>>arr[i];
    sort(arr,arr+n);
    //int arr[] = { 2, 3, 8, 6, 9, 10 }; 
    //int n = sizeof(arr) / sizeof(arr[0]); 
  
    divisibilityCheck(arr, n); 
  
    return 0; 
} 

Measured memory_bytes: 30532
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}

	void solve(){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[]L=new int[2*n];
		for(int i=0;i<2*n;i++) {
			L[i]=sc.nextInt();
		}
		Arrays.sort(L);
		long ans=0;
		for(int i=0;i<2*n;i++) {
			if(i%2==0)ans+=L[i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
typedef long long int ll;

ll go(ll *h,ll n,ll index,ll *dp){
  if(dp[index]!=0){

    return dp[index];
  }
  if(n<0){
    return 0;
  }
  if(n==0){
    return 0;
  }
  if(n==1){
    return 0;
  }
  if(n==2){
    return abs(h[1]-h[0]);
  }
  ll ans1=go(h+1,n-1,index+1,dp)+abs(h[1]-h[0]);
  ll ans2=go(h+2,n-2,index+2,dp)+abs(h[2]-h[0]);
  return dp[index]=min(ans1,ans2);
}

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

    ll n,k;
    cin>>n>>k;
    ll *h=new ll[n];
    ll *dp=new ll[n];
    REP(i,n){
       cin>>h[i];
      dp[i]=0;
    }
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++){
      int x=0;
      int temp=0;
      int min1=INT_MAX;
      for(int j=i-1;j>=0 && x<k;j--){
          temp=dp[j]+abs(h[j]-h[i]);
          min1=min(min1,temp);
          x++;
    }
    dp[i]=min1;
    }

    cout<<dp[n-1]<<endl;
    return 0;
  }




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

int main()
{
  int N;
  std::cin >> N;
  std::vector<long long> d(N);
  for (int i=0;  i<N; ++i)
    std::cin >> d[i];
  
  long long sum = 0;
  for (int i=0; i<N-1; ++i)
    for (int j=i+1; j<N; ++j)
      sum += d[i] * d[j];
      
  std::cout << sum << std::endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;


class Main {

	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String[] s=br.readLine().split(" ");
		int n=Integer.parseInt(s[0].trim());
		int m=Integer.parseInt(s[1].trim());
		int res=n*m;
		System.out.println(res);
		
	}

}


Measured memory_bytes: 32480
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  sort(S.begin(),S.end());
  if(S.at(0)==S.at(1)&&S.at(1)!=S.at(2)&&S.at(2)==S.at(3)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
#include<numeric>
#include<stack>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 9e18;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------


int main(){
  int N,W;
  cin >> N >> W;
  vector<vector<ll>> type(4);
  ll w,v;
  cin >> w >> v;
  type[0].push_back(v);
  ll st = w;
  for(int i=1; i<N; i++){
    cin >> w >> v;
    type[w-st].push_back(v);
  }
  for(int i=0; i<4; i++){
    sort(type[i].begin(),type[i].end(),greater<ll>());
  }
  ll ans = 0;
  for(int i=0; i<4; i++){
    auto it = type[i].begin();
    it = type[i].insert(it,0);
  }
  for(ll i=0; i<type[0].size(); i++){
    for(ll j=0; j<type[1].size(); j++){
      for(ll k=0; k<type[2].size(); k++){
        for(ll l=0; l<type[3].size(); l++){
          ll w_sum=0,v_sum=0;
          for(int m=1; m<=100; m++){
            if(i>=m){
              w_sum += st;
              v_sum += type[0][m];
            }
            if(j>=m){
              w_sum += st+1LL;
              v_sum += type[1][m];
            }
            if(k>=m){
              w_sum += st+2LL;
              v_sum += type[2][m];
            }
            if(l>=m){
              w_sum += st+3LL;
              v_sum += type[3][m];
            }
          }
          if(W < w_sum) continue;
          chmax(ans,v_sum);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(void){
  int s;
  cin >> s;
  int a = s / 100, b = s % 100;
  
  if (a > 12)
  {
    if (b == 0 || b > 13)
    {
      cout << "NA";
    }
    else
    {
      cout << "YYMM";
    }
  }
  else if (a > 0)
  {
    if (b > 12)
    {
      cout << "MMYY";
    }
    else if (b > 0)
    {
      cout << "AMBIGUOUS";
    }
    else
    {
      cout << "MMYY";
    }
  }
  else
  {
    if (b > 0 && b < 13)
    {
      cout << "YYMM";
    }
    else
    {
      cout << "NA";
    }
  }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	
	int n,i,maxv,minv,tmp,j;
	int count=0;
	scanf("%d",&n);
	int a[100];
	
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	
	for(i=0;i<n;i++)
	{
		for(j=n-1;j>i;j--){
			  if(a[j]<a[j-1]){
				tmp=a[j-1];
				a[j-1]=a[j];
				a[j]=tmp;
				
				count++;
			}
		}
	}
	
	for(i=0;i<n;i++)
	{
		printf("%d",a[i]);
		if(i!=n-1){printf(" ");}
	}
	printf("\n");
	printf("%d\n",count);
	return 0;
}


Measured memory_bytes: 2092
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);++i)
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
using namespace std;
typedef long long ll;

int main() {
    int n,m;
    int x[100000];
    cin>>n>>m;
    rep(i,m)    cin>>x[i];

    sort(x,x+m);
    int d[100000];
    rep(i,m-1) {
        d[i]=(x[i+1]-x[i]);
    }
    sort(d,d+(m-1));
    int ans=(x[m-1]-x[0]);
    rep(i,n-1) {
        ans-=d[m-2-i];
    }

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

Measured memory_bytes: 1024
package main

import (
  "fmt"
)

func main() {
  k:=[32]int{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}
  var n int
  fmt.Scanf("%d", &n)
  fmt.Printf("%d", k[n-1])
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;

int main() {
    string s;
    cin >> s;
    if(s[1] == 'B') {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }
}

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

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

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 200000;
const int N = 200000;

vi G[N];
int d[N];

int main() {
	int n,m;cin>>n>>m;
	rep(i,m) {
		int a,b;cin>>a>>b;a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	queue<int> Q;
	rep(i,n) d[i]=INF;
	d[0]=0;
	Q.push(0);
	while(!Q.empty()){
		int i=Q.front();Q.pop();
		for(auto j:G[i]) {
			if(d[j]>d[i]+1) {
				d[j]=d[i]+1;
				Q.push(j);
				if(j==n-1 && d[j]<=2) {
					cout << "POSSIBLE" << endl;
					return 0;
				}
			}
		}
	}
	cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 13168
# -*- coding: utf-8 -*-
import sys
from fractions import gcd
from string import ascii_uppercase as ABC
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))
A = int(input())
B = int(input())

print(list(set([1, 2, 3]) - set([A, B]))[0])

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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  
  int n;
  cin >> n;
  set<string> st;
  map<string, int> mp;
  rep(i, n) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if(st.count(s) == 0) st.insert(s);
    else {
      ++mp[s];
    }
  }
  
  auto fac = [&](ll n) {
    ll res = 0;
    for(ll a = 1; a <= n; ++a) {
      res += a;
    }
    return res;
  };
  
  ll ans = 0;
  for(auto i = mp.begin(); i != mp.end(); ++i) {
    ans += fac(i->second);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 11444
#include <bits/stdc++.h>
#define LL long long
using namespace std;
int L;
int n = 20, m = 60, s = 1, t = n;
int id[25];
struct node
{
    int u, v, w;
} pool[100];
int cnt;
void addedge(int u, int v, int w)
{
    if(u == v)
        return ;
    pool[cnt].u = u; pool[cnt].v = v; pool[cnt].w = w;
    cnt ++;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> L;
    L --;
//    if(L < 50)
//    {
//        for(int i = 0; i <= L; i ++)
//            addedge(s, t, i);
//        return 0;
//    }
//    cout << n << ' ' << m << '\n';
    for(int i = 1; i <= n; i ++)
        id[i] = i;
    int k = log2(L + 1);
    if(1 << k > L + 1) k --;
    if(1 << (k + 1) <= L + 1) k ++;
    for(int i = 1; i <= k; i ++)
        addedge(i, i + 1, 0);
    for(int i = 1; i <= k; i ++)
        addedge(i, i + 1, 1 << (i - 1));
    addedge(k + 1, t, 0);
    int cur = 1 << k;
    for(int i = k; i >= 1 && cur <= L; i --)
    {
        if(cur + (1 << (i - 1)) - 1 <= L)
        {
            addedge(i, t, cur);
            cur += 1 << (i - 1);
        }
    }
    m = cnt;
    cout << n << ' ' << m << endl;
    for(int i = 0; i < cnt; i ++)
        cout << pool[i].u << ' ' << pool[i].v << ' ' << pool[i].w << endl;
//    cout << tot << endl;
//    cout << cur << endl;
    return 0;
}


Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる


int main() {
  ll n,k;
  cin >> n>>k;
  
  vector<ll> p(n);
  
  ll ans = 1000000000000;
  rep(i,n){
  cin>>p[i];
  }
  
  sort(all(p));
  
  rep(i,n-k+1){
    ans=min(ans,p[i+k-1]-p[i]);
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>
 
int main(){
 
    double x1, y1, x2, y2;
 
 
    scanf( "%lf %lf %lf %lf", &x1, &y1, &x2, &y2 );
 
 
    printf( "%lf\n", hypot(x2-x1,y2-y1) );
 
 
    return 0;
 
}

Measured memory_bytes: 664