akhauriyash/Code-Regression huggingface dataset:
A, B, M = map(int, input().rstrip().split())

As = [int(x) for x in input().rstrip().split()]
Bs = [int(x) for x in input().rstrip().split()]

min_val = min(As) + min(Bs)

for i in range(M):
    x, y, c = map(int, input().rstrip().split())
    val = As[x-1] + Bs[y-1] - c
    if min_val > val:
        min_val = val
print(min_val)


Measured memory_bytes: 18488
#include <bits/stdc++.h>
using namespace std;
int main() {
    int x1=0,x2=0,y1=0,y2=0;
    int x3=0,x4=0,y3=0,y4=0;
    cin>>x1>>y1>>x2>>y2;

    int D=0,d1=0,d2=0;
    d1=y1-y2;
    d2=x1-x2;

    x3=x2+d1;
    y3=y2-d2;
    x4=x3+d2;
    y4=y3+d1;
    cout<<x3<<' '<<y3<<' '<<x4<<' '<<y4;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <cstdio>
#define LIMIT 10000
using namespace std;
bool ck(vector<int>&v){
	for(int i=0;i<v.size();i++)if(v[i]!=i+1)return false;
	return true;
}
main(){
	int n,i,j,s,x,l;
	vector<int>tri;
	for(i=1;i<799;i++)tri.push_back(i*(i+1)/2);
	for(;scanf("%d",&n),n;){
		vector<int>v;
		for(s=i=0;i<n;i++){
			scanf("%d",&x);
			s+=x;
			v.push_back(x);
		}
		vector<int>::iterator idx=find(tri.begin(),tri.end(),s);
		i=LIMIT+1;
		if(idx!=tri.end()){
			for(i=0;i<=LIMIT&&!ck(v);i++){
				l=v.size();
				for(j=0;j<l;j++)v[j]--;
				v.erase(remove(v.begin(),v.end(),0),v.end());
				v.push_back(l);
			}
		}
		printf("%d\n",i>LIMIT?-1:i);
	}
}

Measured memory_bytes: 1064
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

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

int main(){
    int w,h,c;
    cin>>w>>h>>c;
    cout<<w/gcd(w,h)*h/gcd(w,h)*c<<endl;
    
    return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
long long  h[110000];
long long dp[110000];
int main()

{   int n,k;
    cin >> n >> k;
    h[0] =  0;
    rep(i,n){
        cin >> h[i+1];
    }
    dp[0] = 0;
    dp[1] = 0;
    for(int i = 2;i <= n;i++){
        dp[i] = 1001001001;
    }
    for(int i = 1;i <= n; i++){
        for(int j = 1;j < k+1;j++){
            if (i-j < 1) continue;
            dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
        }

    }
    cout << dp[n] << endl;

 

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <climits>
#include <string>
#include <stdlib.h>
#include <algorithm>

using namespace std;
 
int ascSort(const void* v1, const void* v2) {
    const int _v1 = *((const int*)v1);
    const int _v2 = *((const int*)v2);
 
    if ( _v1 < _v2 ) {
        return 1;
    } else if ( _v1 > _v2 ) {
        return -1;
    } else {
        return 0;
    }
}
int main(){
	long a[10005],b[10005];
	long n,i,x=0,y=0;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	for(i=0;i<n;i++){
		cin >> b[i];
	}
	for(i=0;i<n;i++){
		if(a[i]>b[i]){
			x+=a[i]-b[i];
		}else{
			x+=(a[i]-b[i])/2;
		}
	}
	if(x<=0){
		cout << "Yes" <<endl;
	}else if(x>0){
		cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;

const int number[] = { 0,2,5,5,4,5,6,3,7,6 };

int main() {
	int N, M;

	cin >> N >> M;

	vector<int> A(M);
	for (int i = 0; i < M; i++) {
		cin >> A[i];
	}

	//最大何桁作れるか
	vector<int> DP(N + 1, -100000000);
	DP[0] = 0;
	for (int i = 2; i <= N; i++)
	{
		for (int j = 0; j < M; j++)
		{
			if (i - number[A[j]] >= 0) {
				DP[i] = max(DP[i], DP[i - number[A[j]]] + 1);
			}
		}
	}

	sort(A.begin(), A.end(), greater<int>());
	//最上位桁から降順に数字を選んでいく
	int sticks = N, digits = DP[N];
	string ans = "";
	while (digits > 0) {
		for (int i = 0; i < M; i++) {
			if (sticks - number[A[i]] >= 0 && DP[sticks - number[A[i]]] == digits - 1) {
				digits--;
				sticks -= number[A[i]];
				ans += A[i] + '0';
				break;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
		ll x;
		cin>>x;
		ll p;
		p=x%10;
		if(p==2||p==4||p==5||p==7||p==9)
		{
			cout<<"hon"<<"\n";
		}
		else if(p==0||p==1||p==6||p==8)
		{
			cout<<"pon"<<"\n";
		}
		else
		{
			cout<<"bon"<<"\n";
		}
	return 0;
}


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

#define rep(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
const ll inf = 100100100100100;


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

    int n;
    cin >> n;
    vector<string> w;

    string s;
    cin >> s;
    w.push_back(s);
    n--;
    while(n--){
        string t;
        cin >> t;
        rep(i,0,w.size()){
            if(w[i] == t) {
                cout << "No" << endl;
                return 0;
            }
        }

        if(w[w.size()-1].back() != t[0]){
            cout << "No" << endl;
            return 0;
        }
        w.push_back(t);
    }
    cout << "Yes" << endl;

}

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

int N, K, x[55], y[55];
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> x[i] >> y[i];
  ll ret = 1LL << 62;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      for (int k = 0; k < N; k++) {
        for (int l = 0; l < N; l++) {
          if (x[i] <= x[j] && y[k] <= y[l]) {
            int cnt = 0;
            for (int p = 0; p < N; p++) {
              if (x[i] <= x[p] && x[p] <= x[j] && y[k] <= y[p] && y[p] <= y[l])
                cnt++;
            }
            if (cnt >= K) ret = min(ret, 1LL * (x[j] - x[i]) * (y[l] - y[k]));
          }
        }
      }
    }
  }
  cout << ret << endl;
  return 0;
}


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

from collections import defaultdict
dic = defaultdict(int)
for _ in range(n):
   a,b = map(int,input().split())
   a -= 1
   b -= 1
   for aa in range(a-1, a+2):
      for bb in range(b-1, b+2):
         if 1 <= aa <= h-2 and 1 <= bb <= w-2:
            dic[(aa,bb)] += 1
ans = [0 for i in range(10)]
for i in dic.values():
   ans[i] += 1

ans[0] = (h-2)*(w-2) - sum([ans[i] for i in range(1,10)])

for anss in ans:
   print(anss)

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt(), b = sc.nextInt();
		System.out.println(Math.max(a + b, Math.max(a - b, a * b)));
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
int main()
{
    using namespace std;
    int N;
    cin >> N;
    long a[N];
    for (int i = 0; i < N; i++)
        cin >> a[i];
    int sum(0), tmp(0);
    for (int i = 0; i < N; i++)
    {
        while (a[i] % 2 == 0)
        {
            a[i] /= 2;
            tmp++;
        }
        if (tmp >= sum)
            sum = tmp;
    }
    cout << sum << endl;
}

Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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(a>b){a=b;return 1;}return 0;}

string table[2010];

ll yoko[2010][2010];
ll tate[2010][2010];

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

  int h, w;
  cin >> h >> w;

  REP(i, h){
    string s;
    cin >> s;
    table[i] = s;
  }

  //REP(i, h) REP(j, w) cout << table[i][j] << endl;

  REP(i, h){
    int start=0, cnt=0;
    REP(j, w){
      if(table[i][j] == '#'){
	FOR(k, start, j) {
	  yoko[i][k] = cnt;
	}
	yoko[i][j] = 0;
	cnt = 0;
	start = j+1;
      }
      else if(j == w-1){
	FOR(k, start, w) {
	  yoko[i][k] = cnt+1;
	}	
      }
      else {
	cnt++;
      }
    }        
  }
  /*
  //check
  REP(i, h){
    REP(j, w) cout << yoko[i][j] << " ";
    cout << endl;
  }
  */

  REP(j, w){
    int start=0, cnt=0;    
    REP(i, h){      
      if(table[i][j] == '#'){
	FOR(k, start, i) {
	  tate[k][j] = cnt;
	}
	tate[i][j] = 0;
	cnt = 0;
	start = i+1;
      }
      else if(i == h-1){
	FOR(k, start, h) {
	  tate[k][j] = cnt+1;
	}	
      }
      else {
	cnt++;
      }
    }        
  }
  /*
  //check
  REP(i, h){
    REP(j, w) cout << tate[i][j] << " ";
    cout << endl;
  }  
  */

  ll ans = 0LL;
  REP(i, h) REP(j, w) ans = max(ans, yoko[i][j]+tate[i][j]);
  cout << ans-1 << endl;
  
  return 0;
}


Measured memory_bytes: 67328
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

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

template <class T> void max_swap(T& a, const T b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int N, L;
int dp[100100];
int len[100100];
int time(int i)
{
	if (~dp[i])
		return dp[i];

	int late = 0;
	if (len[i] <= len[i - 1])
		late = time(i - 1);
	if (len[i] <= len[i + 1])
		max_swap(late, time(i + 1));

	return dp[i] = (L - len[i]) + late;
}
int main()
{
	scanf("%d%d", &N, &L);
	for (int i = 1; i <= N; ++i)
		scanf("%d", len + i);

	fill(dp, dp + (N + 1), -1);
	dp[0] = dp[N + 1] = 0;

	int res = 0;
	for (int i = 1; i <= N; ++i)
		max_swap(res, time(i));
	printf("%d\n", res);
}

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

using namespace std;

typedef long long ll;

const int N = 2e5+10;
int q[N];

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    int n,t;
    cin >> n >> t;
    ll ans = 0;
    for(int i=0;i<n;i++) cin >> q[i];
    for(int i=n-1;i>=0;i--){
    	if(i==n-1){
    		ans += t;
			continue;
		}
		ans += min(q[i+1]-q[i],t);
	}
	cout << ans << "\n";
    
	return 0;
}

Measured memory_bytes: 1024
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


N = I()
s = S()

inf = 10**9+7

counts = collections.Counter(s)
result = 1
for i in counts.values():
    result *= i+1
result -= 1
print(result%inf)
exit()

Measured memory_bytes: 6728
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long int temp,i,t,m,x,y,n,j=1,k,sum=0,max=0;
    cin>>n;
    long long int a[n],b[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    b[0]=0;
    b[1]=abs(a[1]-a[0]);
    for(i=2;i<n;i++)
    {
        b[i]=min((b[i-2]+abs(a[i]-a[i-2])),(b[i-1]+abs(a[i]-a[i-1])));
        //cout<<b[i]<<" ";
    }
    cout<<b[n-1];
    
   return 0;
}

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

int arr[ (int) 1e5 + 99 ];

int main() {
	
//	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	int n, m;
	while ( cin >> n >> m ) {
		memset( arr, 0, sizeof (arr) );
		int take[ n+5 ];
		
		for (int i = 0; i < n; ++i) cin >> take[i];
		
		for (int i = 1; i < (int) 1e5 + 5; ++i) {
			for (int j = 0; j < n; ++j) {
				if ( i-take[j] >= 0 and arr[ i-take[j] ] == 0 ) {
					arr[i] = 1;
				}
			}
		}
		
//		for (int i = 0; i < 100; ++i) cout << arr[i]; cout << '\n';
		
		if ( arr[m] == 1 ) cout << "First\n";
		else if ( arr[m] == 0 ) cout << "Second\n";
	}
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include<functional>
#include <tuple>
#include <map>
#include<set>
#include <cmath>
#include <stack>
#include<cstdio>
#include<stdio.h>
using namespace std;

int main() {
	int k, n, mx=0;
	cin >> k >> n;
	vector<int> a(n);
	cin >> a[0]>>a[1];
	mx = max(a[0], a[1] - a[0]);
	for (int i = 2;i < n;i++) {
		cin >> a[i];
		if (a[i] - a[i-1] > mx)mx = a[i] - a[i-1];
	}
	mx = max(mx, k + a[0] - a[n-1]);
	cout << k -  mx << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<iostream>
#include<fstream>
#define ll long long
using namespace std;

int main(){
    int N;  cin >> N;
    vector<ll> s(N);
    for(int i=0; i<N; i++) cin >> s[i];

    ll ans = 0;
    for(int C=1; C<=N-2; C++){
        ll score = 0;
        int x = 0;
        set<int> st;
        while(N-1-x*C>0){
            int A = N - 1 - x*C;
            if(st.find(x*C) != st.end() || st.find(N-1-x*C) != st.end() || x*C == N-1-x*C || A < C){
                break;
            }
            score += s[x*C];
            score += s[N-1-x*C];
            st.insert(x*C);
            st.insert(N-1-x*C);
            ans = max(ans, score);
            x++;
        }
    }
    cout << ans << endl;
}


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

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

ll pow(ll a, ll n, ll m) {
	ll ret = 1LL;
	for (; n > 0LL; n >>= 1LL, a = a * a % m) {
		if (n % 2LL == 1LL) {
			ret = ret * a % m;
		}
	}
	return ret;
}

int main() {
    ll N;
    cin>>N;
    vector<ll> v(N);
    for(ll i = 0; i < N; i++) cin>>v[i];
    vector<ll> d(N-1);
    for(ll i = 0; i < N-1; i++) d[i]=v[i+1]-v[i];
    ll ans = 0LL;
    ll P = 1;
    for(ll i = 1;i < N; i++) P = (P*i)%mod;
  	ll Q = P;
    for(ll i = 0; i < N-1; i++){
        ans=(ans+(d[i]*P)%mod)%mod;
        P=(P+Q*pow(i+2LL,mod-2,mod))%mod;
    }
    cout<<ans<<endl;
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
const int intinf = numeric_limits<int>::max();

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

void solve()
{
    int N, R;
    cin >> N >> R;

    int ans = (N >= 10) ? R : R + 100 * (10 - N);

    cout << ans << endl;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <queue>
#include <string>
#include <set>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int> ;
using vl = vector<ll>;

int main(){
    int n;
    cin >> n;
    int tmp;
    map<int,int> mp;
    rep(i,n){
        cin >> tmp;
        mp[tmp]++;
    }

    vi v(3,0),v2(3,0);
    int i = 0;
    int size = mp.size();
    if(size == 3){
        for(auto e : mp){
            v[i] = e.first;
            v2[i] = e.second;
            i++;
        }
    }

    if(mp[0] == n){
        cout << "Yes" << endl;
        return 0;
    }else if(mp[0] * 3 == n && size == 2){
        cout << "Yes" << endl;
        return 0;
    }else if(size == 3){
        if((v2[0] == v2[1] && v2[1] == v2[2]) && ((v[0] ^ v[1]) ^ v[2]) == 0)  {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 7148
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;

const int MAX = 1255;

int main(){
	int a,b;
	bool flag = true;
	cin >> a >> b;
	for(int i=0;i < MAX;++i){
		if(int(i*0.08) == a && int(i*0.1) == b){
			cout << i << endl;
			flag = false;
			break;
		}
	}
	if(flag){
		cout << -1 << endl;
	}
	return 0;
}


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


using namespace std;

#define fastio() ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ll long long
#define mk make_pair
#define pb push_back
#define popb pop_back 
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define print_vec(vec) for(int i=0;i<sz(vec);i++) cout << vec[i] << " ";
#define FORin(vec) for(int& x : vec) cin>>x;


int st[100005];

void go(){
	int n;cin>>n;
	for(int i=0;i<n;i++) {
		int x;cin>>x;
		st[x-1]=i+1;
	}
	for(int i=0;i<n;i++) {
		cout << st[i] << " ";
	}
}
int main(){
   
   fastio();
   cin.tie(0);
   cout.tie(0);
   go();

   return 0;
}




Measured memory_bytes: 3952
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(a*n, b) << endl;
  return 0;
}

Measured memory_bytes: 3200
N = int(input())
t = 0
x = 0
y = 0
ans = 'Yes'
for _ in range(N):
    ti, xi, yi = map(int, input().split())
    if not (ti - t >= abs(xi - x) + abs(yi - y) and (ti - t) % 2 == (abs(xi - x) + abs(yi - y)) % 2):
        ans = 'No'
    t = ti
    x = xi
    y = yi
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
char a[100005];
int n,m,ans;
int main()
{
    cin>>a;
    for(int i=0;i<sizeof(a);i++)
       if(n==m)
	   {
	    	n++; 
			if(a[i]=='p') 
			  ans--;
	   }     
       else
	   {
	 		m++; 
	 		if(a[i]=='g') 
	 		  ans++;
	   }         
    cout<<ans<<endl;                   
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  string s;cin>>s;
  if(s.size()==2){
    cout<<s<<endl;
  }else{
    cout<<s[2]<<s[1]<<s[0]<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int A, B, C;
  cin >> A >> B >> C;

  if (A % 2 && B % 2 && C % 2) {
    int ans = LINF;
    chmin(ans, A * B);
    chmin(ans, C * B);
    chmin(ans, A * C);
    cout << ans << endl;
  } else
    cout << 0 << endl;
}

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

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >>D;
    string messages = "No";
    while(0 < A && 0 < C) {
        C -= B;
        if(C <= 0) {
            messages = "Yes";
            break;
        }
        A -= D;
    }
    cout << messages << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main()
{
  long int a,b,c,d;
  int i;
  long int max=0;
  scanf("%ld %ld %ld %ld",&a,&b,&c,&d);
b+=a;
c+=b;
  for(i=0; i<d; i++){
    if(i<a)
      max++;
    else if(i<b)
      max+=0;
    else
      max--;
  }
    
  
  printf("%ld\n",max);
  return 0;
}

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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll a,b,c; cin>>a>>b>>c;
    if(a<c && c<b || b<c && c<a) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3548
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <utility>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
#define chmin(x,y) x=min(x,y);
int inf=1e9;
unsigned int xor128(){
	static unsigned int x=123456789,y=362436069,z=521288629,w=88675123;
	unsigned int t;
	t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}
struct node{	//node of RBST
	int val,mn,size;
	node *lch,*rch;
	node(int v){
		val=mn=v;
		size=1;
		lch=0,rch=0;
	}
};
typedef pair<node*,node*> Pnn;
node *root;
//すべての関数は操作した後の木の親のポインタを返す
node *update(node *x){
	x->size=1;
	x->mn=x->val;
	if(x->lch){
		x->size+=x->lch->size;
		chmin(x->mn,x->lch->mn);
	}
	if(x->rch){
		x->size+=x->rch->size;
		chmin(x->mn,x->rch->mn);
	}
	return x;
}
node *merge(node *x,node *y){
	if(x==0) return y;
	if(y==0) return x;
	int m=x->size,n=y->size;
	if(xor128()%(m+n)<m){
		x->rch=merge(x->rch,y);
		return update(x);
	}else{
		y->lch=merge(x,y->lch);
		return update(y);
	}
}
int count(node *x){
	if(x==0) return 0;
	return x->size;
}
Pnn split(node *x,int pos){		//[,pos),[pos,)
	if(x==0) return Pnn(0,0);
	if(pos<=count(x->lch)){
		Pnn tmp=split(x->lch,pos);
		x->lch=tmp.sc;
		return Pnn(tmp.fs,update(x));
	}else{
		Pnn tmp=split(x->rch,pos-count(x->lch)-1);
		x->rch=tmp.fs;
		return Pnn(update(x),tmp.sc);
	}
}
node *insert(node *x,int pos,int val){
	node *p = new node(val);
	Pnn tmp=split(x,pos);
	node *l=merge(tmp.fs,p),*r=tmp.sc;
	return merge(l,r);
}
node *erase(node *x,int pos){
	Pnn tmp=split(x,pos);
	node *l=tmp.fs,*r=split(tmp.sc,1).sc;
	return merge(l,r);
}
void showtree(node *c){
	if(!c) return;
	cout<<"(";
	showtree(c->lch);
	cout<<"-"<< c->val <<"-";
	showtree(c->rch);
	cout<<")";
}
void query0(int b,int c){
	Pnn x=split(root,c);
	Pnn y=split(x.fs,b);
	Pnn z=split(x.sc,1);
//	show(count(z.sc));
	node *t=merge(y.fs,z.fs);
	node *s=merge(y.sc,z.sc);
//	showtree(t);puts("");
//	showtree(s);puts("");
	root=merge(t,s);
}
void query1(int b,int c){
	Pnn x=split(root,b);
	Pnn y=split(x.sc,c+1-b);
//	show(count(y.fs));
	cout<<y.fs->mn<<endl;
	root=merge(x.fs,merge(y.fs,y.sc));
}
void query2(int b,int c){
	root=erase(root,b);
	root=insert(root,b,c);
}
int main(){
	int N,Q;
	cin>>N>>Q;
	rep(i,N){
		int a;
		scanf("%d",&a);
		root=insert(root,i,a);
	}
//	show(count(root));
//	showtree(root);puts("");
	rep(i,Q){
		int a,b,c;
		cin>>a>>b>>c;
		if(a==0) query0(b,c);
		if(a==1) query1(b,c);
		if(a==2) query2(b,c);
//		showtree(root);puts("");
	}
}

Measured memory_bytes: 13752
// 5/18
// ANT2-4-2. Map, Set
// 類題
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using LLP = pair<ll, ll>;
using Graph = vector<vector<int>>;

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

    set<int> s;
    rep(i, N) {
        int d;
        cin >> d;
        s.insert(d);
    }

    cout << s.size() << endl;
}


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

int main() {
	int H, W;
	while (1) {
		cin >> H >> W;
		if (H == 0 && W == 0)break;
		else {
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					printf("#");
				}
				printf("\n");
			}
		}
		printf("\n");

	}
	return 0;
}

Measured memory_bytes: 3008
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const int MAX=1e5+10;
const ll MOD=1e9+7;

int n,k;
vi G[MAX];
ll ans=1;
int used[MAX];
void dfs(int v, int d1, int d2){
  used[v]=true;
  ans=(ans*((ll)k-d1-d2))%MOD;
  int nb=d1;
  rep(i,sz(G[v]))if(!used[G[v][i]]){
    dfs(G[v][i], 1, nb);
    nb++;
  }
}

int main(){
  cin>>n>>k;
  rep(_,n-1){
    int u, v;
    cin>>u>>v;
    u--;v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(0,0,0);
  cout<<ans<<endl;
}

Measured memory_bytes: 9600
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
int p[200010];
vector<int> V[200010];
bool visited[200010];
bool isloop[200010];
int memo[200010];

int calc(int v) {
  if (memo[v] != -1) return memo[v];
  set<int> S;
  for (auto x : V[v]) {
    S.insert(calc(x));
  }
  for (auto i = 0; ; ++i) {
    if (S.find(i) == S.end()) {
      return (memo[v] = i);
    }
  }
}

int main () {
  cin >> N;
  for (auto i = 0; i < N; ++i) {
    cin >> p[i];
    p[i]--;
  }
  for (auto i = 0; i < N; ++i) {
    V[p[i]].push_back(i);
  }
  fill(visited, visited+200010, false);
  int now = 0;
  while (!visited[now]) {
    visited[now] = true;
    now = p[now];
  }
  fill(isloop, isloop+200010, false);
  while (!isloop[now]) {
    // cerr << "loop: " << now << endl;
    isloop[now] = true;
    now = p[now];
  }
  // cerr << "now = " << now << endl;
  fill(memo, memo+200010, -1);
  for (auto i = 0; i < N; ++i) {
    if (!isloop[i]) {
      calc(i);
      // cerr << "calc(" << i << ") = " << calc(i) << endl;
    }
  }
  vector<int> kouho;
  set<int> S;
  for (auto x : V[now]) {
    if (!isloop[x]) {
      // cerr << "x = " << x << endl;
      S.insert(calc(x));
    }
  }  
  for (auto i = 0; ; ++i) {
    if (S.find(i) == S.end()) {
      kouho.push_back(i);
      if (kouho.size() == 2) break;
    }
  }
  /*
  cerr << "kouho: ";
  for (auto x : kouho) {
    cerr << x << " ";
  }
  cerr << endl;
  */
  for (auto z : kouho) {
    for (auto i = 0; i < N; ++i) {
      if (isloop[i]) memo[i] = -1;
    }
    memo[now] = z;
    for (auto x : V[now]) {
      if (isloop[x]) calc(x);
    }
    /*
    for (auto i = 0; i < N; ++i) {
      if (isloop[i]) {
        cerr << "calc(" << i << ") = " << calc(i) << endl;
      }
    }
    */
    memo[now] = -1;
    // cerr << calc(now) << " " << z << endl;
    if (calc(now) == z) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << endl;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    string S;
    cin >> S;
    map<char, ll> cnt;
    REP(i, S.size()){
    	cnt[S[i]]++;
    }
    bool flag1, flag2;
    flag1 = ((cnt['N'] == 0) == (cnt['S'] == 0));
    flag2 = ((cnt['E'] == 0) == (cnt['W'] == 0));
    cout << (flag1 && flag2 ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    int stux[100];
    int stuy[100];
    int x[100],y[100];
    int ans;
    for(int i=0;i<n;i++){
        cin >> stux[i] >> stuy[i];
    }
    for(int i=0;i<m;i++){
        cin >> x[i] >> y[i];
    }
    for(int i=0;i<n;i++){
        long long temp=20000000100;
        for(int j=0;j<m;j++){
            if(abs(stux[i]-x[j])+abs(stuy[i]-y[j])<temp){
                temp = abs(stux[i]-x[j])+abs(stuy[i]-y[j]);
                ans=j+1;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
use proconio::*;

#[fastout]
#[allow(non_snake_case)]
fn main() {
    input! {
        X: usize,
    }
    let mut ans = 0;
    let mut m = 100;
    while X > m {
        ans += 1;
        m += ((m as f64) * 0.01) as usize;
    }
    println!("{}", ans);
}


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

int N, M;
int link[10][10];
int dp[1 << 10][10];
int main() {
    cin >> N >> M;
    memset(link, 0, sizeof(link));
    for(int i=0; i<M; i++) {
        int a, b; cin >> a >> b;
        a--; b--;
        link[a][b] = 1;
        link[b][a] = 1;
    }

    dp[1][0] = 1;
    for(int bit=1; bit<(1<<N); bit++) {
        for(int i=0; i<N; i++) {
            if(dp[bit][i] == 0) continue;
            for(int j=0; j<N; j++) {
                if(bit >> j & 1) continue;
                if(!link[i][j]) continue;
                int nbit = bit | (1 << j);
                dp[nbit][j] += dp[bit][i];
            }
        }
    }
    int ans = 0;
    for(int i=0; i<N; i++) {
        ans += dp[(1<<N)-1][i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAXN	3005
#define P	1000000007
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int n, m, tmpm, l[MAXN], r[MAXN], sum[MAXN];
int len[MAXN], tail[MAXN], head[MAXN];
long long fac[MAXN], inv[MAXN], dp[MAXN][MAXN];
char s[MAXN];
void update(long long &x, long long y) {
	x = (x + y) % P;
}
long long power(long long x, long long y) {
	if (y == 0) return 1;
	long long tmpmp = power(x, y / 2);
	if (y % 2 == 0) return tmpmp * tmpmp % P;
	else return tmpmp * tmpmp % P * x % P;
}
long long getc(long long x, long long y) {
	return fac[x] * inv[y] % P * inv[x - y] % P;
}
void init(int N) {
	fac[0] = 1;
	for (int i = 1; i <= N; i++)
		fac[i] = fac[i - 1] * i % P;
	inv[N] = power(fac[N], P - 2);
	for (int i = N - 1; i >= 0; i--)
		inv[i] = inv[i + 1] * (i + 1) % P;
}
int Sum(int l, int r) {
	return sum[r] - sum[l - 1];
}
int main() {
	read(n), read(tmpm);
	init(n);
	scanf("%s", s + 1);
	for (int i = 1; i <= n; i++)
		sum[i] = sum[i - 1] + (s[i] == '1');
	for (int i = 1; i <= tmpm; i++) {
		int x, y;
		read(x), read(y);
		if (x == l[m]) r[m] = max(r[m], y);
		else if (y > r[m]) {
			m++;
			l[m] = x;
			r[m] = y;
		}
	}
	for (int i = 1; i <= n; i++) {
		len[i] = r[i] - l[i] + 1;
		head[i] = min(l[i + 1] - l[i], len[i]);
		tail[i] = Sum(max(l[i], r[i - 1] + 1), r[i]);
	}
	dp[1][Sum(l[1], r[1])] = 1;
	for (int i = 2; i <= m; i++)
	for (int j = tail[i]; j <= len[i]; j++) {
		int unused = j - tail[i];
		if (unused && unused > r[i - 1] - l[i] + 1) continue;
		for (int k = 0; k <= head[i - 1]; k++)
			update(dp[i][j], dp[i - 1][k + unused] * getc(head[i - 1], k));
	}
	long long finalans = 0;
	for (int j = tail[m]; j <= len[m]; j++)
		update(finalans, dp[m][j] * getc(len[m], j));
	cout << finalans << endl;
	return 0;
}

Measured memory_bytes: 29440
import Foundation
func toTuple<T>(_ args: [T]) -> (T, T) { (args[0], args[1]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

let (a, b) = toTuple(readInts())
var ans = 0
for i in a...b {
  let fHalf = String(i).prefix(2)
  let lHalf = String(i).suffix(2).reversed()
  if String(fHalf) == String(lHalf) {
    ans += 1
  }
}
print(ans)

Measured memory_bytes: 13612
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void){
    int A,B,K, a, b;
    cin >> K;
    cin >> A >> B;

    a = A/K;
    b = B/K;
    if(b-a>0 || K==1 || A%K==0 || B%K==0)cout << "OK" << endl;

    //if(B-A+1 >= K || K==1 || (A==B && B==K)) cout << "OK" << endl;
    else cout << "NG" << endl;
    return 0;
    
}

Measured memory_bytes: 3636
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n; cin >> n;
	int sum = 0;
	list<int> res;
	int i = 1;
	while (sum < n)
	{
		sum += i;
		res.push_back(i);
		++i;
	}
	int m = sum - n;
	for (int x : res)
	{
		if (x == m)continue;
		cout << x << endl;
	}
}

Measured memory_bytes: 384
a = []
3.times do
    a << gets.split("\s").map(&:to_i)
end

a.flatten!

n = gets.to_i

n.times do
  b = gets.to_i
  if i = a.index(b)
    a[i] = -1
  end
end

if ((a[0] < 0 && a[1] < 0 && a[2] < 0) || (a[3] < 0 && a[4] < 0 && a[5] < 0) ||
  (a[6] < 0 && a[7] < 0 && a[8] < 0) || (a[0] < 0 && a[3] < 0 && a[6] < 0) ||
  (a[1] < 0 && a[4] < 0 && a[7] < 0) || (a[2] < 0 && a[5] < 0 && a[8] < 0) ||
  (a[0] < 0 && a[4] < 0 && a[8] < 0) || (a[2] < 0 && a[4] < 0 && a[6] < 0))
  print 'Yes'
else
  print 'No'
end


Measured memory_bytes: 1788
n,x = gets.split.map(&:to_i)
m = []
for i in 0..n-1 do
  m[i] = gets.to_i
end
#お菓子の元 残量
sum = m.inject(:+)
x -= sum
#作ったお菓子
count = m.size

min = m.min
while x >= min do
count += 1
x -= min
end

print count

Measured memory_bytes: 1788
#include <stdio.h>

int main(void){
    int N; 
    scanf("%d", &N);
    //105 = 3*5*7;
    //165 = 3*5*11;
    //195 = 3*5*13;
    //135 = 3*3*3*5;
    //189 = 3*3*3*7;
    int num[5] = {105, 135, 165, 189, 195};
    int ans = 0;
    for (int i = 0; i < 5; i++){
        if(N >= num[i]){ans += 1;}
        else break;
    }
    printf("%d\n", ans);
    return 0; 
}

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

using namespace std;

int main(){
    vector<int> nums(3);
    cin >> nums[0] >> nums[1] >> nums[2];
    sort(nums.begin(), nums.end());

    int sum = 0;
    for(int i = 0; i < 3; i++){
        sum += nums[i] - nums[max(0, i-1)];
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0; i < n; i++)
#define REPR(i, n) for(long long i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(long long i = m; i <= n; i++)
#define FORR(i, m, n) for(long long i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;



int main(){FIN

    ll x,y,z,k; cin>>x>>y>>z>>k;
    vll a(x), b(y), c(z);
    REP(i,x) cin>>a[i]; REP(i,y) cin>>b[i]; REP(i,z) cin>>c[i];
    VSORTR(a); VSORTR(b); VSORTR(c);
    vll d(0);
    REP(i,x){
        REP(j,y){
            d.push_back(a[i]+b[j]);
        }
    }
    VSORTR(d);
    vll e(0);
    ll mx_idx = min(ll(d.size()), k); 
    REP(i,mx_idx){
        REP(j,z){
            e.push_back(d[i]+c[j]);
        }
    }
    VSORTR(e);
    REP(i,k) cout<<e[i]<<endl;
    return 0;
}

Measured memory_bytes: 43404
#include <iostream>
using namespace std;
#define MAX 1000

int A[MAX];

void insertSort(int n){
  int k;
  for(int i=1;i<=n;i++){
    k=A[i];
    int j=i-1;
    while(j>0 && A[j]>k){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=k;
    for(int l=1;l<=n;l++){
      if(l!=1) cout<<' ';
    cout<<A[l];
    }
    cout<<endl;
  }
}
    

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

  insertSort(n);

  return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		double pos_p1x = scanner.nextDouble();	//座標の入力
		double pos_p1y = scanner.nextDouble();	//座標の入力
		double pos_p2x = scanner.nextDouble();	//座標の入力
		double pos_p2y = scanner.nextDouble();	//座標の入力
  		double root = 0.d;				//距離
  		double pos_x = 0;
  		double pos_y = 0;
  		
  		pos_x = (pos_p2x - pos_p1x);
  		pos_x *= pos_x;
  		pos_y = (pos_p2y - pos_p1y);
  		pos_y *= pos_y;
  		
  		if(( pos_x + pos_y ) != 0) {
  			root = Math.sqrt( ( pos_x + pos_y ) );
  		}
  		//結果出力
		System.out.println(root);
		
		
		scanner.close();
  }
}


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

using namespace std;

int main(){
    int N;
    int sum = 0;
    int per;
    int sul;

    cin >> N;
    vector<int> a(N);

    for(int i = 1 ; i <= N ; i++){
        cin >> a[i];
        sul = i % 2;
        per = a[i] % 2;

        if(sul == 1 && per == 1){
            sum ++ ;
        }
        
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3620
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 * Created by thompson on 08/09/2018.
 */
public class Main {
    static int N, X;
    static List<Integer> numbers = new ArrayList<>();

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

        N = sc.nextInt();
        X = sc.nextInt();

        for (int i = 0; i < N; i++) {
            numbers.add(sc.nextInt());
        }


        numbers.add(X);
        Collections.sort(numbers);

        List<Integer> list = new ArrayList<>();
        fillList(list);
        Collections.sort(list);

        //find
        int max = list.get(0);
        boolean firstTime = true;
        boolean find = false;

        for (; max >= 1; ) {
            for (int i = 0; i < list.size(); i++) {
                int number = list.get(i);
                if (number % max != 0)
                    break;

                if (i == list.size() - 1)
                    find = true;
            }

            if (find)
                break;

            if (firstTime) {
                firstTime = false;
                max = max / 2;
                continue;
            }

            max--;
        }

        System.out.println(max);
    }

    private static void fillList(List<Integer> list) {
        for (int i = 1; i < numbers.size(); i++) {
            list.add(numbers.get(i) - numbers.get(i - 1));
        }
    }
}


Measured memory_bytes: 62752
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <numeric>
using namespace std;
#define MAX_N 100

// Input
string S;

int main() {
  // for (int i = 0; i < MAX_N; i++) {
  //   S[i] = "";
  // }
  cin >> S;

  int half;
  int ct = 0;
  int n = (int)(S.length());
  for (int i = 0; i < n/2; i++) {
    if (S[i] != S[n-1-i]) {
      ct++;
    }
  }
  cout << ct << endl;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  ll n,m;
  cin>>n>>m;
  ll re=n*m;
  rep(_,2){
    if(n>2) MN(re,((n+2)/3-n/3)*m);
    reps(i,1,n){
      vector<ll> v{(n-i)*m,(m+1)/2*i,m/2*i};
      MN(re,*max_element(all(v))-*min_element(all(v)));
    }
    swap(n,m);
  }
  cout<<re<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
char c[210000];
int flag_b=-0x3f3f3f3f;
int flag_e;
int main() {
    scanf("%s", c);
    for(int i=0; i<strlen(c); i++){
        if(c[i]=='A'&&flag_b==-0x3f3f3f3f) flag_b=i;
        if(c[i]=='Z') flag_e=i;
    }
    printf("%d\n", flag_e-flag_b+1);
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
using namespace std;


typedef long long ll;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)

const int mod = 1000000007;


int main(){
  int n, C;
  cin >> n >> C;
  vector<ll> s(n), t(n), c(n);
  int ans = 0;
  rep(i, n){
    cin >> s[i] >> t[i] >> c[i];
  }

  vector<int> cnt(200001);

  for(int i = 1; i <= C; ++i){
    vector<int> time(200001);

    for(int j = 0; j < n; ++j){
      if(c[j] != i) continue;
      time[s[j] * 2 - 1]++;
      time[t[j] * 2]--;
    }

    int now = 0;
    for(int j = 0; j < time.size(); ++j){
      now += time[j];
      if(now > 0){
        cnt[j]++;
      }
    }
  }

  for(int i = 0; i < 200001; ++i){
    ans = max(ans, cnt[i]);
  }


  cout << ans << endl;
}


Measured memory_bytes: 4208