akhauriyash/Code-Regression huggingface dataset:
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long 
using namespace std; 

const long long N = 1e6 + 100, OO = 1e18, M = 1e9 + 7, M2 = 998244353, sq = 31622, lg = 23;
typedef pair <int, int> pii;
int a[N];

int32_t main() {
	use_fast;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		a[x - 1] = i;
	}
	for(int i = 0; i < n; i++) 
		cout << a[i] + 1 << " ";
	cout << endl;
	return 0;
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ... 
*/

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

//宣言
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//数値
#define MOD 1000000007
#define INF (1<<20)
const double EPS = 1e-10;
const double PI = acos(-1.0);

//操作
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) FOR(i,0,n)
#define REPB(i,n) for(int i=n;i>=0;--i)
#define SORT(A) sort(A,A+sizeof(A)/sizeof(A[0]))
#define VSORT(A) sort(A.begin(),A.end())
#define EXIST(s,e) (s.find(e)!=s.end())
#define PB push_back
#define MP make_pair
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);

//DEBUG
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
	int n; cin >> n;
	int i = 0;
	REP(j, n) {
		int a; cin >> a;
		if (a % 2) i++;
	}
	if (i % 2) cout << "NO" << endl;
	else cout << "YES" << endl;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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 modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

int s[55][55];  
int visit[55][55];
int d[55][55];

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

  // 迷路の幅優先探索

  int H, W;
  cin >> H >> W;

  int cnt_white = 0;
  for(int i = 1; i <= H; i++){
    string s_;
    cin >> s_;
    for(int j = 1; j <= W; j++){
      if(s_[j-1] == '.'){
        s[i][j] = 1;
        cnt_white++;
      }else{
        s[i][j] = 0;
      }
      visit[i][j] = 0;
      d[i][j] = -1;
    }
  }

  queue<pair<int, int>> q;
  q.push(make_pair(1, 1));
  d[1][1] = 1;

  while(!q.empty()){
    auto p = q.front();
    q.pop();
    int h = p.first;
    int w = p.second;

    //上
    if(s[h-1][w] == 1 && visit[h-1][w] == 0){
      q.push(make_pair(h-1, w));
      d[h-1][w] = d[h][w] + 1;
      visit[h-1][w] = 1;
    }
    //下
    if(s[h+1][w] == 1 && visit[h+1][w] == 0){
      q.push(make_pair(h+1, w));
      d[h+1][w] = d[h][w] + 1;
      visit[h+1][w] = 1;
    }
    // 左
    if(s[h][w-1] == 1 && visit[h][w-1] == 0){
      q.push(make_pair(h, w-1));
      d[h][w-1] = d[h][w] + 1;
      visit[h][w-1] = 1;
    }
    // 右
    if(s[h][w+1] == 1 && visit[h][w+1] == 0){
      q.push(make_pair(h, w+1));
      d[h][w+1] = d[h][w] + 1;
      visit[h][w+1] = 1;
    }

  }

  if(d[H][W] == -1){
    cout << -1 << endl;
  }else{
    cout << (cnt_white - d[H][W]) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import Foundation
 
let input_line = readLine()!
 
let split = input_line.componentsSeparatedByString(" ") //components(separatedBy:)と実質同じ
let N = Int(split[0])!
let M = Int(split[1])!

//標準入力二行目以降
var starts = [Int]()
var ends = [Int]()

for i in 0..<M {
    let input_line = readLine()!
    let split = input_line.componentsSeparatedByString(" ") //components(separatedBy:)と実質同じ
	starts.append(Int(split[0])!)
	ends.append(Int(split[1])!)
}

var returnNumberOfIDCard = 0
if starts.maxElement() <= ends.minElement() {
	returnNumberOfIDCard = ends.minElement()! - starts.maxElement()! + 1
}

print(returnNumberOfIDCard)

//当初案
//標準入力二行目以降
/*
var ranges = [Range<Int>]()

for i in 0..<M {
    let input_line = readLine()!
    let split = input_line.componentsSeparatedByString(" ") //components(separatedBy:)と実質同じ
	let start = Int(split[0])!
	let end = Int(split[1])!
    ranges.append(start...end)
}

var returnNumberOfIDCard = 0

for i in 1...N {
	 for j in 0..<M { 
     	if ranges[j].contains(i) == false {
        	break
        } else if j == M - 1 {
        	returnNumberOfIDCard += 1
        }
     }
}
*/


Measured memory_bytes: 7400
#include <bits/stdc++.h>
using namespace std;
bool queries[100010];
string s,c;
int main()
{
	int n;
	cin >> n;
	cout << "0" << "\n";
	cout.flush();
	cin >> s;
	if(s=="Vacant")
    {
        return 0;
    }
    else
    {
        int l=1,r=n-1;
        while(l<r)
        {
            int mid=((l+r)>>1);
            cout << mid << "\n";
            cout.flush();
            cin >> c;
            if(c=="Vacant")
                return 0;
            string ans;
            if(mid%2==0)
            {
                ans=s;
            }
            else
            {
                if(s=="Female")
                    ans="Male";
                else
                    ans="Female";
            }
            if(c==ans)
            {
                l=mid+1;
            }
            else
            {
                r=mid;
            }
        }
        cout << l << "\n";
        cout.flush();
    }
}


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

using namespace std;

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

    int n;
    string s, t;
    cin >> n >> s >> t;

    for (int k = n; ; k++) {
        bool flag = true;
        for (int i = 0; i < n; i++) {
            if (i - (k - n) >= 0 && s[i] != t[i - (k - n)]) {
                flag = false;
                break;
            }
        }
        if (flag) {
            cout << k << '\n';
            return 0;
        }
    }
}


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

int main(){

  int n, q;
  int s[10001] = {};
  int t, cnt = 0;

  cin >> n;
  for(int i = 0; i < n; i++) cin >> s[i];
  cin >> q;
  for(int i = 0; i < q; i++){
    cin >> t;
    for(int j = 0; j < n; j++){
      if(t == s[j]){
        cnt++;
        break;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3148
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
	__INIT() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}__init;

int main(void) {
    ll n;
    cin>>n;
    map<string,ll> pitsu;
    ll maxi = 0;
    rep(i,n){
        string s;
        cin>>s;
        pitsu[s]++;
        maxi = max(maxi,pitsu[s]);
    }
    vector<string> ngo;
    for(pair<string,ll> tmp:pitsu){
        if(tmp.second == maxi) ngo.push_back(tmp.first);
    }
    sort(all(ngo));
    rep(i,ngo.size()){
        cout<<ngo[i]<<endl;
    }
	return 0;
}


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

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

    vector<int> x(n);

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

    sort(x.begin(), x.end());

    int rob_a = 0;
    int rob_b = 0;
    for(int i = 0; i < n; i++){
        if(x[i] < k - x[i]){
            rob_a += x[i];
        } else {
            rob_b += k - x[i];
        }
    }

    cout << rob_a * 2 + rob_b * 2 << endl;
}

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

int main() {
  int N;
  vector<int> vec(110);
  
  cin >> N;
  
  for (int i = 0;i < N;i++) {
    cin >> vec.at(i);
  }
  
  int sum = 0;
  
  for (int i = 0;i < N;i++) {
    for (int j = 0;j < N;j++) {
      for (int k =0;k < N;k++) {
        if (vec.at(i) == vec.at(j) || vec.at(i) == vec.at(k) || vec.at(j) == vec.at(k)) {
          continue;
        }
        else if (((vec.at(i)+vec.at(j))>vec.at(k) && (vec.at(j)+vec.at(k))>vec.at(i)) && (vec.at(i)+vec.at(k))>vec.at(j)) {
          sum += 1;
        }
      }
    }
  }
   cout << sum/6 << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
constexpr double pi=3.14159265358979;
 
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;
}
using namespace std;

void solve(){
 int n;
 cin>>n;
 vector<int>d(n);
 rep(i,n)cin>>d[i];
 int ans=0;
 rep(i,n-1){
   for(int j=i+1;j<n;++j){
     ans+=d[i]*d[j];
   }
 }
 cout<<ans<<endl;
 return;
}
 
signed main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
  cout<<fixed<<setprecision(20);
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
#define vecmin(A) *min_element(A.begin(),A.end())
#define vecmax(A) *max_element(A.begin(),A.end())
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  cout << vecmax(a)-vecmin(a) << endl;
}

Measured memory_bytes: 256
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools
import heapq
#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    k=int(input())
    s=list(input())
    if len(s)>k:
        print("".join(s[0:k])+"...")
    else:
        print("".join(s))




if __name__ == "__main__":

    main()

Measured memory_bytes: 9788
program main
  implicit none
  integer i,N,i2,ball,j,t
  integer,allocatable :: a(:),b(:),b2(:)
  !read(*, *) (L(i), i = 1,N)
  read(*, *) N
  allocate(a(N))
  allocate(b(N))
  allocate(b2(N))
  read(*, *) (a(i), i = 1,N)
  b2 = a
  t = 1
  do i = 1,N
    i2 = N-i+1
    ball = 0
    do j = 1,N/i2
      ball = ball+b2(i2*j)
    end do
    !b(i2) = mod(ball,2)
    ball = mod(ball,2)
    b2(i2) = ball
    if (ball == 1) then
      b(t) = i2
      t = t+1
    end if
  end do
  write(*, *) t-1
  if (t /= 1) then
    write(*, *) b(1:t-1)
  end if
end program main


Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
const int N = 10004, K = 102, M = 1000000007;

int n;
char a[N];
int k;

int dp[N][K][2];
int main()
{
    cin >> a;
    n = strlen(a);
    cin >> k;
    dp[0][0][1] = 1;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < k; ++j)
        {
            for (int u = 0; u <= 9; ++u)
            {
                dp[i + 1][(j + u) % k][0] = (dp[i + 1][(j + u) % k][0] + dp[i][j][0]) % M;
            }
            for (char u = '0'; u < a[i]; ++u)
            {
                dp[i + 1][(j + u - '0') % k][0] = (dp[i + 1][(j + u - '0') % k][0] + dp[i][j][1]) % M;
            }
            dp[i + 1][(j + a[i] - '0') % k][1] = (dp[i + 1][(j + a[i] - '0') % k][1] + dp[i][j][1]) % M;
        }
    }
    cout << ((dp[n][0][0] - 1 + M) % M + dp[n][0][1]) % M << endl;
    return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string T;
	cin >> T;
	vector<int> num(2, 0);
	vector<int64> zero({0});
	REP(i, T.size()) {
	  if (T[i] == '0') zero.back()++;
	  else {
	    num[(i+1)%2]++;
	    zero.push_back(0);
	  }
	}
	int64 res = 0, sum = 0, tail = zero.back();
	res += num[1];
	zero.pop_back();
	vector<int> num2(num);
	num[0] = num[1] = 0;
	REP(i, zero.size()) {
    while (zero[i] > sum%2) {
      swap(num2[0], num2[1]);
      res += num2[1] + num[1];
      zero[i]--;
    }
    sum += zero[i];
    sum++;
    num[(sum)%2]++;
    num2[(sum)%2]--;
	}
	res += num[1] * tail;
	num2[0] = num2[1] = 0;
	for (int i = zero.size()-1; i >= 0; i--) {
    if (sum % 2 == 1) {
      num2[1]++;
      num[1]--;
    } else {
      num2[0]++;
      num[0]--;
    }
    if (zero[i]) {
      swap(num2[0], num2[1]);
      res += num[1] + num2[1];
    }
    sum -= 1 + zero[i];
	}
	FOR(i, 1, zero.size()+1) {
	  res += (i)/2;
	}
	cout << res << endl;
}


Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
string ans="";
void Main(){
    string s;cin>>s;
    ll q;cin>>q;
    vector<string> add(2,"");
    ll rev=0;
    For(i,0,q){
        ll t;cin>>t;
        if(t==1){
            rev++;
        }
        else if(t==2){
            ll f;cin>>f;f--;
            char c;cin>>c;
            add[(rev+f)%2]+=c;
        }
    }
    if(rev%2==0){
        reverse(ALL(add[0]));
        ans=add[0]+s+add[1];
    }
    else{
        reverse(ALL(add[1]));
        reverse(ALL(s));
        ans=add[1]+s+add[0];
    }
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}

Measured memory_bytes: 1348
A = []
str = "357"
lim = 11

def dfs(bef, sz):
    if sz + 1 == lim:
        return
    for i in str:
        t = bef + i
        A.append(t)
        dfs(t, sz + 1)

def main():
    n = int(input())

    dfs("", 0)

    ans = 0

    for a in A:
        q = False
        w = False
        e = False
        for i in a:
            if i == '3':
                q = True
            elif i == '5':
                w = True
            elif i == '7':
                e = True
        if q and w and e:      
            ai = int(a)
            if ai <= n:
                ans += 1

    print(ans)

main()

Measured memory_bytes: 15180
#include<iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <math.h>

using namespace std;
int main()
{

	int a;
	cin >> a;
	int Ans = 0;

	if (a % 2 == 0) {
		Ans = a / 2 * a / 2;
	}
	else {
		Ans = a / 2 * (a / 2 + 1);
	}



	cout << Ans;


	return 0;
}


Measured memory_bytes: 256
#abc149d
n,k=map(int,raw_input().split())
r,s,p=map(int,raw_input().split())
t=map(str,raw_input().rstrip())
pt={'r':p,'s':r,'p':s,'':0}
res=0
for i in range(n):
 x=i-k
 if x>=0 and t[x]==t[i]:
  t[i]=''
 res+=pt[t[i]]
print res


Measured memory_bytes: 6532
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

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

func main() {
	n, k := readInt(), readInt()
	m := make(map[int]int)
	for i := 0; i < n; i++ {
		a := readInt()
		m[a]++
	}

	if k >= len(m) {
		fmt.Println(0)
		return
	}

	b := make([]int, len(m))
	idx := 0
	for _, c := range m {
		b[idx] = c
		idx++
	}

	sort.Ints(b)
	ans := 0
	for i := 0; i < len(m)-k; i++ {
		ans += b[i]
	}
	fmt.Println(ans)
}


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

using namespace std;
typedef long long ll;

const int DAY_LIMIT = 3652425;

struct Service {
        ll w;
        int t, x;
        Service(ll w = 0ll, int t = 0, int x = 0) : w(w), t(t), x(x) { }
};

int main(){
        ios_base::sync_with_stdio(false);
        int N, Q;
        cin >> N >> Q;
        vector<Service> services(N);
        for(int i = 0; i < N; ++i){
                cin >> services[i].w >> services[i].t >> services[i].x;
        }
        vector<int> y(Q);
        for(int i = 0; i < Q; ++i){ cin >> y[i]; }
        int recovered = 0, logged = 0;
        vector<ll> logs(Q);
        vector<ll> answers(N, DAY_LIMIT + 1);
        vector<ll> add(0x4000);
        ll level = 0;
        for(int i = 0; i <= DAY_LIMIT && (logged < Q || recovered < N); ++i){
                level += add[i & 0x3fff];
                add[i & 0x3fff] = 0;
                while(recovered < N && services[recovered].w <= level){
                        const Service &s = services[recovered];
                        answers[recovered] = i;
                        if(s.t == 0){
                                for(int j = 1; j <= s.x; ++j){ add[(i + j) & 0x3fff] += 1; }
                        }else if(s.t == 1){
                                for(int j = 1; j <= s.x; ++j){ add[(i + j) & 0x3fff] += j; }
                        }else if(s.t == 2){
                                for(int j = 1; j <= s.x; ++j){ add[(i + j) & 0x3fff] += j * j; }
                        }
                        ++recovered;
                }
                if(logged < Q && y[logged] == i){
                        logs[logged++] = level;
                }
                ++level;
        }
        for(int i = 0; i < N; ++i){
                if(answers[i] > DAY_LIMIT){
                        cout << "Many years later" << endl;
                }else{
                        cout << answers[i] << endl;
                }
        }
        for(int i = 0; i < Q; ++i){
                cout << logs[i] << endl;
        }
        return 0;
}

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

#define int long long 
#define ll long long 
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define ff first
#define ss second
#define vi vector<ll>
#define mod 1000000007
#define full(a) a.begin(),a.end()
#define inf INT_MAX
#define minf INT_MIN
ll n;
ll vacation(ll i,ll a[],ll b[],ll c[],ll dp[][4],ll cnta,ll cntb,ll cntc){
    if(i==n)return 0;
    if(dp[i][cnta+cntb*2+cntc*3]!=-1)return dp[i][cnta+cntb*2+cntc*3];

    ll q=minf;
     if(cnta==0)q=max(q,a[i]+vacation(i+1,a,b,c,dp,1,0,0));
     if(cntb==0)q=max(q,b[i]+vacation(i+1,a,b,c,dp,0,1,0));
     if(cntc==0)q=max(q,c[i]+vacation(i+1,a,b,c,dp,0,0,1));
    

    return dp[i][cnta+cntb*2+cntc*3]=q;
}


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

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

    cin>>n;
    ll a[n],b[n],c[n];
    
    ll dp[n][4];
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i];

    cout<<vacation(0,a,b,c,dp,0,0,0);
    
    

    return 0; 
 }
    

Measured memory_bytes: 20012
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;



public class Main {

	public static void main(String[] args) {
		 FastScanner scanner =new FastScanner();
		 PrintWriter out=new PrintWriter(System.out);
		  int n=scanner.nextInt();
		  long d=scanner.nextLong();
		  int ans=0;
		  for(int i=0;i<n;i++) {
			  long x=scanner.nextLong(),y=scanner.nextLong();
			  BigInteger bi1=BigInteger.valueOf(x*x);
			  BigInteger bi2=BigInteger.valueOf(y*y);
			  //long t1=x*x, t2=y*y;
			//  System.out.println(t1+" "+t2);
			 BigInteger bi=bi1.add(bi2);
			 // System.out.println(bi);
			 
			  //System.out.println(dis);
			 BigInteger b1=BigInteger.valueOf(d*d);
			// System.out.println(bi+" "+b1);
			  if(bi.compareTo(b1)<=0) ans++;
		  }	
		  System.out.println(ans);
			
		
	
		    	
		    }
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
}

		    
		}

Measured memory_bytes: 55200
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int cnt=0;
		for(int i=0; i<N; i++){
			if(isPrime(sc.nextInt())) cnt++;
		}
		System.out.println(cnt);
	}
	static boolean isPrime(int x){
		int i, s;
		if(x==2){
			return true;
		}
		if(x<2 || x%2==0){
			return false;
		}
		i = 3;
		s = (int)Math.sqrt(x);
		while(i<=s){
			if(x%i==0){
				return false;
			}
			i += 2;
		}
		return true;
	}
}

Measured memory_bytes: 29324
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		String S = scanner.nextLine();
		int length = S.length();

		while(true) {
			if ((S.length() -1) % 2 == 0) {
				String sub1 = S.substring(0, S.length() / 2);
//				System.out.println("sub1:" + sub1);
				String sub2 = S.substring(S.length() / 2, S.length() -1);
//				System.out.println("sub2:" + sub2);
				if (sub1.equals(sub2)) {
					System.out.println(S.length()-1);
					return;
				} else {
					S = S.substring(0, (S.length()-1));
				}
			} else {
				S = S.substring(0, (S.length()-1));
			}
//			System.out.println(S);
		}
	}
}

Measured memory_bytes: 20820
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <numeric>
#include <set>
#include <list>
#include <valarray>
#include <functional>
#include <array>

int main() {
	std::string str;
	std::cin >> str;
	int s = str.size();
	std::vector<int> v(26, 0);
	for (int i = 0; i < s; i++) {
		if (v[(str[i]) - 97] != 0) {
			std::cout << "no" << std::endl;
			return 0;
		}
		v[char(str[i]) - 97]++;
	}
	std::cout << "yes" << std::endl;
	return 0;
}



Measured memory_bytes: 256
"use strict";

const main = (arg) => {
  const input = arg.trim().split("\n")[0];
  const X = parseInt(input.split(" ")[0]);
  const Y = parseInt(input.split(" ")[1]);

  const A = 2 * X - Y / 2;
  const B = Y / 2 - X;

  if (
    Number.isInteger(A) && Number.isInteger(B) // 整数判定
    && A >= 0 && B >= 0
  ) {
    console.log("Yes");
  } else {
    console.log("No");
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  


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

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

	if(a > b)
		cout << "a > b" << endl;
	else if(a < b)
		cout << "a < b" << endl;
	else
		cout << "a == b" << endl;

	return 0;
}

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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
int n,i,j;
cin>>n;
ld p[n];
ld ans=0.0;
for(i=0;i<n;i++) cin>>p[i];
vector<vector<long double> > M(n+1,vector<long double>(n+1,-1.0));
//cout<<"initially M = \n";
/*for(i=0;i<=n;i++)
{
cout<<"\n";
	for(j=0;j<=n;j++)
	cout<<M[i][j]<<" ";
}*/
for(i=0;i<=n;i++)
	for(j=0;j<n;j++) M[i][j]=-1;
M[0][0] = 0;
M[1][0] = 100*(1-p[0]); 
M[1][1] = 100*p[0]; 
for(i=2;i<=n;i++)
{
	for(j=0;j<=n;j++)
	{
		if(j==0) M[i][j] = (1-p[i-1])*M[i-1][j];
		else if(j<i)
		{
			M[i][j] = M[i-1][j]*(1-p[i-1]) + M[i-1][j-1]*(p[i-1]);
		}
		else if(j==i) M[i][j] = M[i-1][j-1]*p[i-1];
	}
}
for(i=n/2+1;i<=n;i++) 
{
ans+=M[n][i];
}
ans = ans/100;
/*cout<<"\n\n";
for(i=0;i<=n;i++)
{
cout<<"\n";
	for(j=0;j<=n;j++)
	cout<<M[i][j]<<" ";
}*/
//cout<<setprecision(12)<<ans<<"\n";
printf("%.12Lf",ans);
}



Measured memory_bytes: 141056
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, tmp, ans = 0;
  cin >> n >> m;

  int k[m], p[m];
  vector<int> s[m];
  for (int i = 0; i < m; i++) {
    cin >> k[i];
    for (int j = 0; j < k[i]; j++){
      cin >> tmp;
      s[i].push_back(tmp);
    }
  }

  for (int i = 0; i < m; i++)
    cin >> p[i];

  for (int tmp = 0; tmp < (1 << n); tmp++) {
    bitset<10> bs(tmp);
    int flag = 0;
    for (int i = 0; i < m; i++) { // about switch k
      int sum = 0;
      for (int j = 0; j < k[i]; j++) {
      sum += bs[s[i][j]-1];
      }
      if (sum % 2 != p[i])
        flag++;
    }
    if (flag == 0)
      ans++;
  }
  cout << ans;
  return 0;
}

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

using namespace std;

int main() {

    int m,d;
    int cnt = 0;
    cin >> m >> d;

    for(int i = 1;i <= m;i++){
        for(int j = 22;j <= d;j++){
            if(j % 10 <= 1){
                continue;
            }
            if((j / 10) * (j % 10) == i){
                cnt++;
            }
        }
    }

    cout << cnt;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <map>
#include <queue>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

int main() {
	char c[100];
	cin >> c;
	printf("%c%d%c\n", c[0], strlen(c) - 2, c[strlen(c) - 1]);
}

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

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

using namespace std;

int main(){
  int an = 0,bn = 0,cn = 0,n = 0;
  string a,b,c;
  cin >> a >> b >> c;
  
  while(1){
    switch(n){
      case 0:
        an++;
        if(an-1 == a.size()){
          cout << "A" << endl;
          return 0;
        }
        else{
          n = (int)a[an-1] - 97;
        }
        break;
      case 1:
        bn++;
        if(bn-1 == b.size()){
          cout << "B" << endl;
          return 0;
        }
        else{
          n = (int)b[bn-1] - 97;
        }
        break;
      case 2:
        cn++;
        if(cn-1 == c.size()){
          cout << "C" << endl;
          return 0;
        }
        else{
          n = (int)c[cn-1] - 97;
        }
        break;
    }
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define ll long long
#define ull unsigned long long
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define FOR(i,start,stop)  for(int i=(start); i < (stop); i++)
#define FORD(i,start,stop) for(int i=(start); i >= (stop); i--)
#define RIP(i,stop) FOR(i,0,stop)
#define PI 3.141592653589793
#define PRECISION(c,f) fixed << setprecision(c) << f
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N, M; 
  cin >> N >> M;

  vector<int> a(N);
  ll sum=0;
  RIP(i,N) {cin >> a[i]; sum += a[i];}

  sort(a.begin(), a.end(), greater<int>());

  double d;
  d = sum / (4.0*M);

  if(d <= a[M-1]) yes;
  else no;

  return 0;
}


Measured memory_bytes: 3628
void main() {
    string s = readln.chomp;
    int diff = 1000;
    foreach (i; 2 .. s.length) {
        int x;
        foreach_reverse (j; 0 .. 3) {
            x += (s[i-j] - '0') * 10 ^^ j;
        }
        diff = min(diff, abs(x-753));
    }
    diff.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.container;
import std.typecons;

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;


#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;


void Main(){
   int a,b;
   cin >> a >> b;
  // vector<int> L(2*N);
  // rep(i,2*N) cin >> L[i];

 string ans;
  if( (a<0 && b>0) || (a*b==0) ){
     ans = "Zero";
  }
  else if( (a>0) || ((b-a)%2 == 1)){
     ans = "Positive";
  }
  else {
     ans = "Negative";
  }
  cout << ans << endl;
 return;
 }
  
int main(){
 cin.tie(nullptr);
 ios_base::sync_with_stdio(false);
 cout << fixed << setprecision(15);
 Main();
 return 0;
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
#define reps(i,s,n) for(int i = (s); i < (n); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
long long gcd(long long x, long long y) {
    return y ? gcd(y, x%y) : x;
}
int main(){

  int a1,a2,a3; cin >> a1 >> a2 >> a3;
  if(a1+a2+a3>21) cout << "bust";
  else cout << "win";

  return 0;
 }

Measured memory_bytes: 256
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (lli)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n>>m;
    if(n<10)
    m+=100*(10-n);
    cout<<m<<endl;

}   aryanc403();
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<malloc.h>
using namespace std;
//#define int long long
typedef pair<int, int> pii;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

struct node{
    int key;
    struct node *next;
    struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSerch(int key){
    NodePointer cur = nil->next;
    while(1){
        if(cur == nil)break;
        if(cur->key == key)break;
        cur = cur->next;
    }
    return cur;
}

void init(){
    nil = (NodePointer)malloc(sizeof(struct node));
    nil->next = nil;
    nil->prev = nil;
}

void printList(){
    NodePointer cur = nil->next;
    int isf = 1;
    while(1){
        if(cur == nil)break;
        if(isf == 0)printf(" ");
        printf("%d", cur->key);
        isf = 0;
        cur = cur->next;
    }
    printf("\n");
}

void deleteNode(NodePointer t){
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(){
    NodePointer t = nil->next;
    if(t == nil)return;
    deleteNode(t);
}

void deleteLast(){
    NodePointer t = nil->prev;
    if(t == nil)return;
    deleteNode(t);
}

void Delete(int key){
    NodePointer t = listSerch(key);
    if(t == nil)return;
    deleteNode(t);
}

void insert(int key){
    NodePointer x;
    x = (NodePointer)malloc(sizeof(struct node));
    x->key = key;
    x->prev = nil;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
}

signed main(){
    int key, N, size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &N);
    init();
    for(int i = 0; i < N; i++){
        scanf("%s", com);
        if(com[0] == 'i'){
            scanf("%d", &key);
            insert(key);
            np++;
            size++;
        }
        else if(com[0] == 'd'){
            if((int)strlen(com) > 6){
                if(com[6] == 'L'){
                    deleteLast();
                }
                else if(com[6] == 'F'){
                    deleteFirst();
                }
            }
            else {
                scanf("%d", &key);
                Delete(key);
                nd++;
            }
            size--;
        }
    }
    printList();

    return 0;
}

/*

*/


Measured memory_bytes: 34404
//Name: Sum of 4 Integers II
//Level: 2
//Category: 数学,数え上げ,メモ化再帰
//Note:

/**
 * f(k,n) = k個の数を使ってnを作るパターン数
 * として、メモ化再帰を書く。
 *
 * オーダーは O(N^2K)。
 * ただし、Kは使う整数の個数で、K=4。
 */
#include <iostream>
#include <algorithm>

using namespace std;

int memo[5][4001];
bool visited[5][4001];

int calc(int k, int n) {
    if(k == 0) return n == 0;
    if(visited[k][n]) return memo[k][n];

    visited[k][n] = true;
    for(int i = 0; i <= min(n, 1000); ++i) {
        memo[k][n] += calc(k-1, n-i);
    }
    return memo[k][n];
}

bool solve() {
    int N;
    if(!(cin >> N)) return false;
    cout << calc(4, N) << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    while(solve()) ;
    return 0;
}

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

int main() {
  int n, x = 1, y;
  int64_t k, l, i = 1;
  cin >> n >> k;
  vector<int> a(n), b(n, 0);
  for (int j = 0;j < n;j++) {
    cin >> a[j];
  }
  while (b[x - 1] == 0) {
    b[x - 1] = i;
    x = a[x - 1];
    i += 1;
  }
  l = i - b[x - 1];
  if (i <= k) {
    y = (k - b[x - 1] + 1) % l;
    for (int j = 0;j < y ;j++) {
      x = a[x - 1];
    }
  } else {
    x = 1;
    for (int j = 0;j < k;j++) {
      x = a[x - 1];
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 4844
#include <stdio.h>

int main(void){

    int N = 0;
    int count = 1;
    scanf("%d", &N);
    int a[N];

    for (int i = 0; i < N; i++){
        scanf("%d", &a[i]);  
        if (count == a[i]){
            count++;
        }
    }

    if (count - 1 == N){
        printf("0\n");

    } else if(count == 1){
        printf("-1\n");

    } else {
        //if (a[N - 1] == count - 1){
            N = N - count + 1;
            printf("%d\n", N);
        //} else if (a[N - 1] != count - 1){
            //N = N - count;
            //printf("%d\n", N);
        //}
    }

    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
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;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

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

  double w, h, x, y;
  cin >> w >> h >> x >> y;
  printf("%.16f %d\n", w*h/2.0, (w/2 == x && h/2 == y));
  return 0;
}

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

int main(){

    int A,B,C;
    cin >> A >> B >> C;

    if ( (A==B) && (B!=C) && (C!=A) ){
        cout << "Yes" << endl;
    }
    else if ( (A!=B) && (B==C) && (C!=A) ){
        cout << "Yes" << endl;
    }
    else if ( (A!=B) && (B!=C) && (C==A) ){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int amount = N * A;
  
  if (amount <= B) {
  	cout << amount << endl; // 真
  } else {
  	cout << B << endl; // 偽
  }
}

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

int main(){
    string s;
    cin >> s;
    s[0] = '2';
    s[1] = '0';
    s[2] = '1';
    s[3] ='8';
    cout << s << endl;
}

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

int main() {
	int n;
	while(cin>>n,n){
		int num[1001]={};
		for(int i=0;i<n;i++){
			cin>>num[i];
			num[1000]+=num[i];
		}
		sort(num,num+n);
		cout<<(num[1000]-num[0]-num[n-1])/(n-2)<<endl;
	}
}

Measured memory_bytes: 1176
N = int(input())
A = list(map(int, input().split()))
X = [0] * N
Y = [0] * N
sum_gcd = []
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

x = A[0]
y = A[N-1]
X[0] = x
Y[N-1] = y
for i in range(1, N):
    x = gcd(x, A[i])
    y = gcd(y, A[len(A)-i-1])
    X[i] = x
    Y[N-i-1] = y

sum_gcd.append(max(Y[1], X[N-2]))
for i in range(N-2):    
    sum_gcd.append(gcd(X[i], Y[i+2]))

print(max(sum_gcd))


Measured memory_bytes: 14400
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int a, b;

	while (scanf("%d%d", &a, &b) != EOF){
		int ma = max(a, b);
		int mi = min(a, b);
		int rem;

		while (1){
			rem = ma % mi;
			if (rem == 0){
				break;
			}
			ma = mi;
			mi = rem;
		}
		cout << mi << endl;
	}

	return (0);
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=2005;
int n,m,k,Sx,Sy;
int dis[maxn][maxn];
char s[maxn][maxn];
int a[maxn][maxn];
pin Queue[maxn*maxn];
const int dx[]={1,-1,0,0};
const int dy[]={0,0,-1,1};
inline int get(int a,int b){if(a==0)return 0;return (a-1)/b+1;}
int main(){
	read(n);read(m);read(k);
	rep(i,1,n)scanf("%s",s[i]+1);
	rep(i,1,n)rep(j,1,m){
		a[i][j]=s[i][j]=='.';
		if(s[i][j]=='S')Sx=i,Sy=j;
	}
	memset(dis,-1,sizeof(dis));
	int front=0,finish=0;
	Queue[++finish]=mk(Sx,Sy);dis[Sx][Sy]=0;
	while(front!=finish){
		pin w=Queue[++front];
		if(dis[w.w1][w.w2]==k)continue;
		rep(i,0,3){
			int tx=w.w1+dx[i],ty=w.w2+dy[i];
			if(tx<1||tx>n||ty<1||ty>m)continue;
			if(dis[tx][ty]==-1&&a[tx][ty]){
				dis[tx][ty]=dis[w.w1][w.w2]+1;
				Queue[++finish]=mk(tx,ty);
			}
		}
	}int ans=1e9;
	rep(i,1,n)rep(j,1,m)if(dis[i][j]!=-1){
		// printf("%d %d\n",i,j);
		ans=min(ans,get(min(i-1,n-i),k));
		ans=min(ans,get(min(j-1,m-j),k));
	}
	printf("%d\n",ans+1);
	return 0;
}


Measured memory_bytes: 34304
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n;
		int taro[]   = new int[200];
		int hanako[] = new int[200];
		int a;
		int field;
		int faze;
		boolean flag;
		int taroCount, hanakoCount;

		n = scanner.nextInt();
		while (n != 0) {
			for (int i = 0; i < 2 * n; i++) {
				taro[i] = 0;
				hanako[i] = 1;
			}
			for (int i = 0; i < n; i++) {
				a = scanner.nextInt();
				taro[a - 1] = 1;
				hanako[a - 1] = 0;
			}

			field = 0;
			faze = 1;
			flag = true;
			taroCount = n;
			hanakoCount = n;
			while (flag) {
				if (faze == 1) {
					for (; field < 2 * n; field++) {
						if (taro[field] == 1) {
							taro[field] = 0;
							faze = 0;
							taroCount--;
							break;
						}
					}
					if (taroCount == 0) {
						flag = false;
					}
					if (2 * n <= field) {
						faze = 0;
						field = 0;
					}
				} else {
					for (; field < 2 * n; field++) {
						if (hanako[field] == 1) {
							hanako[field] = 0;
							faze = 1;
							hanakoCount--;
							break;
						}
					}
					if (hanakoCount == 0) {
						flag = false;
					}
					if (2 * n <= field) {
						faze = 1;
						field = 0;
					}
				}
			}
			System.out.println(hanakoCount);
			System.out.println(taroCount);
			n = scanner.nextInt();
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>

using namespace std;

int main() {

	int n = 0;
	int x = 0;
	int count = 0;

	cin >> n >> x;

	while (!(n == 0 && x == 0)) {

		for (int i = 1; i < n - 1; i++) {

			for (int u = i + 1; u < n; u++) {

				for (int y = u + 1; y < n + 1; y++) {

					if (i + u + y == x) {

						count++;

					}

				}

			}

		}

		cout << count << endl;

		cin >> n >> x;

		count = 0;

	}


	return 0;

}



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

int main()
{
    int N, A, B;
    cin >> N >> A >> B;

    int P;
    int first = 0;
    int second = 0;
    int third = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> P;
        if (P <= A)
        {
            first++;
        }
        else if (P <= B)
        {
            second++;
        }
        else
        {
            third++;
        }
    }

    cout << min(first, min(second, third)) << endl;
}


Measured memory_bytes: 256
<?php
/**
 * ABC121
 * A - White Cells
 */

// $s = trim(fgets(STDIN));
// fscanf(STDIN, "%d %d", $a, $b);
// $n = array_map('intval', explode(' ', trim(fgets(STDIN))));

fscanf(STDIN, "%d %d", $H, $W);
fscanf(STDIN, "%d %d", $h, $w);

echo ($H - $h) * ($W - $w), PHP_EOL;


Measured memory_bytes: 4604
// ABC163C - management

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

int main() {
	int N;
	cin >> N;
	map<int, int> ans;

	for (int i = 1; i <= N; i++) {
		ans[i] = 0;
	}
	for (int i = 0; i < N - 1; i++) {
		int t;
		cin >> t;
		ans[t]++;
	}

	for (map<int, int>::iterator it = ans.begin(); it != ans.end(); it++) {
		pair<int, int> t = *it;
		cout << t.second << endl;
	}

	return 0;
}


Measured memory_bytes: 12976