akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N,M;
  cin >> N >> M;
  vi h(N);
  rep(i,N) {
    cin >> h[i];
  }
  vvi G(N);
  rep(i,M) {
    int a,b;
    cin >> a >> b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  int ans = 0;
  rep(i,N) {
    bool ok=true;
    for(int j:G[i]) {
      if(h[i]<=h[j]) {
        ok=false;
      }
    }
    if(ok) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8716
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
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; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }

int main() {
    SS(int,n,m);
    vector<vector<int>> graph(n);
    rep(i,m){
        SS(int,a,b);
        graph[a-1].push_back(b-1);
        graph[b-1].push_back(a-1);
    }
    vector<int>depth(n,-1);
    queue<int> st;
    vector<int>res(n);
    st.push(0);
    depth[0]=0;
    while(!st.empty()){
        ll now = st.front();st.pop();
        for(auto a : graph[now]){
            if(depth[a]==-1||depth[a]>depth[now]+1){
                st.push(a);
                depth[a]=depth[now]+1;
                res[a]=now;
            }
        }
    }
    p("Yes");
    rep(i,n-1)p(res[i+1]+1);
}

Measured memory_bytes: 10604
n,m = map(int,input().split())
s = [0]*m
for i in range(m):
    s[i] = list(map(int,input().split()))
p = list(map(int,input().split()))
ans = 0

for i in range(2**n):
    sw = [0]*m
    for k in range(m):
        num = 0
        for j in range(n):
            if (i>>j)&1:
                if j+1 in s[k][1:]:
                    num += 1
        if num%2 == p[k]:
            sw[k] = 1
    if 0 in sw:
        pass
    else:
        ans += 1
print(ans)

Measured memory_bytes: 3064
import java.util.*;

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

        int box[] = new int[30];
        int x=0;       
        int w  = sc.nextInt();
        int n  = sc.nextInt();
        
        for(int i=0;i<w;i++){
            box[i] = i + 1;
        }

        for(int i=0;i<n;i++){
            String str = sc.next();
            String[] ab = str.split(",",0);

            int a = Integer.parseInt(ab[0]) - 1;
            int b = Integer.parseInt(ab[1]) - 1;
            x = box[a];
            box[a] = box[b];
            box[b] = x;
        }

        for(int i=0;i<w;i++){
            System.out.println(box[i]);
        }

        sc.close();
    }
}


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

int main() {
    int N, M;

    cin >> N;
    vector<string> blues(N);
    for(int i=0; i<N; i++) {
        cin >> blues[i];
    }

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

    set<string> card_types;
    for(int i=0; i<N; i++) {
        card_types.insert(blues[i]);
    }
    for(int i=0; i<M; i++) {
        card_types.insert(reds[i]);
    }

    int max = -1000;
    int sum;
    for(string select_card : card_types) {
        sum = 0;
        for(int i=0; i<N; i++) {
            if(blues[i] == select_card) {
                sum += 1;
            }
        }
        for(int i=0; i<M; i++) {
            if (reds[i] == select_card) {
                sum -= 1;
            }
        }

        if (sum > max) {
            max = sum;
        }
    }

    if (max < 0) {
        max = 0;
    }

    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<cmath>
#include<string>
#include<stdio.h>
int main()
{
  float a,b,R;
  float c;
	R=4500;
	while(scanf("%f",&a)!=EOF)
	{
		cin>>b;
		c=b*2-a;
		cout<<c;
	}
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS * max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x * x + y * y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;



int main()
{
	int N, K;
	cin >> N >> K;
	string s;
	cin >> s;

	vector <ll> a;
	if (s[0] == '0')
	{
		a.push_back(0);
	}

	int num = 0;
	for (int i = 0; i < N; ++i)
	{
		if (i > 0 && s[i] != s[i - 1])
		{
			a.push_back(num);
			num = 1;
		}
		else
		{
			num++;
		}
	}
	a.push_back(num);

	if (s[N - 1] == '0')
	{
		a.push_back(0);
	}

	vector <ll> sum(SZ(a) + 1);
	for (int i = 0; i < SZ(a); ++i)
	{
		sum[i + 1] = sum[i] + a[i];
	}

	ll ret = 0;
	for (int i=1;i<SZ(sum);i+=2)
	{
		if (i - (2 * K + 1) >= 0)
		{
			amax(ret, sum[i] - sum[i - (2 * K + 1)]);
		}
		else
		{
			amax(ret, sum[i]);
		}
	}
	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 2164
#include <bits/stdc++.h> 
using namespace std;
int n,sum=0;
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j){
			int x=gcd(i,j);
			for(int k=1;k<=n;++k)sum+=gcd(x,k);
		}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
int n,d;
int main()
{
    cin>>n>>d;
    int cnt=0;
    int mx=0;
    while(mx<n){
        mx=(mx+2*d+1);
        cnt++;
    }
    cout<<cnt<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
int main() {
  int k,s;
  cin >> k >> s;
  int ans=0;
  rep(i,k+1) {
    rep(j,k+1) {
      int l=s-(i+j);
      if(l>=0 && l<=k) ans++;
    }}
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

map<string,bool> words;
string start;

void answer(string s){
	printf("?%s\n", s.c_str() ); fflush(stdout);
	words[s] = true;
}

bool ask(){
	char str[100];
	scanf("%s", str);
	string s( str );
	
	if( words.count(s) || s[0] != 'a' ){
		printf("!OUT\n"); fflush(stdout);
		return false;
	}else{
		words[s] = true;
		start.clear();
		start.push_back( s[ s.size()-1 ] );
	}
	
	return true;
}

string to_s(int n){
	char c1 = (n%26) + 'a';
	char c2 = n/26 + 'a';
	string s;
	s.push_back( c2 );
	s.push_back( c1 );
	return s;
}

int main(){
	int n=0;

	answer( "a" );
	while( ask() ){
		string s;
		s.push_back( start[0] );
		s += to_s( n++ );
		s.push_back( 'a' );
		answer( s );
	}
}

Measured memory_bytes: 0
def bisect_left_reverse(a, x):
    if a[0] <= x:
        return 0
    if x < a[-1]:
        return len(a)
    ok = len(a) - 1
    ng = 0
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if a[mid] <= x:
            ok = mid
        else:
            ng = mid
    return ok
def bisect_right_reverse(a, x):
    if a[0] < x:
        return 0
    if x <= a[-1]:
        return len(a)
    ok = len(a) - 1
    ng = 0
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if a[mid] < x:
            ok = mid
        else:
            ng = mid
    return ok
  
n = int(input())
data = [int(input())]

for i in range(n-1):
  a = int(input())
  idx = bisect_right_reverse(data, a)
  if idx == len(data):
    data.append(a)
  else:
    data[idx] = a

print(len(data))
    
    

Measured memory_bytes: 79420
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define MOD 1000000007
int a[21][21],dp[1<<21][21],am;
int n;
int bitmask_dp(int mask,int x)
{
	am=(1<<n)-1;
	if(mask==am)
	return 1;
	if(x==n)
	return 0;
	if(dp[mask][x]!=-1)
	return dp[mask][x];
	int ways=0;
	for(int i=0;i<n;i++)
	{
		if(a[x][i]==1&&(mask&(1<<i))==0)
		{
			int nm=mask|(1<<i);
			ways=(bitmask_dp(nm,x+1)+ways)%MOD;
		}
	}
	dp[mask][x]=ways;
	return ways;
}
signed main()
{
	int i,j;
	cin>>n;
	for(i=0;i<n;i++)
	for(j=0;j<n;j++)
	cin>>a[i][j];
	memset(dp,-1,sizeof(dp));
	am=(1<<n)-1;
	cout<<bitmask_dp(0,0)<<"\n";
}

Measured memory_bytes: 344448
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end() //使うときはsort(all())という感じで
using ll = long long;
#define PI 3.14159265359

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<vector>
#include <cmath>
#include <time.h>
using namespace std;

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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define C getchar()
#define ll long long
using namespace std;
ll read()
{
	ll x=0,l=1;char c=C;
	for (;c<'0'||c>'9';c=C) if (c=='-') l=-1;
	for (;c>='0'&&c<='9';c=C) x=(x<<1)+(x<<3)+(c^48);
	return x*l;
}
ll n,x,a,d,ans; 

void opp()
{
	while (a&&d)
		if (a>d) {ans+=a/d*d*2;a%=d;}
			else {ans+=d/a*a*2;d%=a;}
}

int main()
{
	a = ( ans=n=read() ) - ( d=x=read() );
	if (!a||!d) {printf("%lld",n*3);return 0;}
	opp();
	printf("%lld",ans-a-d);
	return 0;
}

Measured memory_bytes: 256
import numpy as np
import sys
input = sys.stdin.buffer.readline

n = int(input())
a = np.array(list(map(int, input().split())))
b = np.array(list(map(int, input().split())))

c = a - b
m = np.sum(c[c < 0])
p = np.sort(c[c >= 0])[::-1]
cnt = n - p.size

if cnt == 0:
    print(0)
    exit()

for i in p:
    m += i
    cnt += 1
    if m >= 0:
        print(cnt)
        exit()
print(-1)

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

char mat[100][100];
int dx[4] = { 0, -1, 0, 1 };
int dy[4] = { -1, 0, 1, 0 };
int res = 0;
int row, col;
char a;

void dfs(int x, int y)
{
	a = mat[x][y];
	mat[x][y] = '.';
	int xx, yy;
	for (int i = 0; i < 4; i++)
	{
		xx = x + dx[i];
		yy = y + dy[i];
		if (xx >= 0 && xx < row && yy >= 0 && yy < col && mat[xx][yy] == a)
			dfs(xx, yy);
	}
}

int main() {

	while (true)
	{
		res = 0;
		scanf("%d %d", &row, &col);
		if (row == 0)
			break;
		getchar();
		for (int i = 0; i < row; i++)
		{
			for (int j = 0; j < col; j++)
				scanf("%c", &mat[i][j]);
			getchar();
		}
		for (int i = 0; i < row; i++)
			for (int j = 0; j < col; j++)
				if(mat[i][j] != '.')
				{
					res++;
					dfs(i, j);
				}
		printf("%d\n", res);
	}
	return 0;
}


Measured memory_bytes: 3428
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using V = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

void solve()
{
    IN(a, b, c, k);
    if (a + b < k)
        cout << a - (k - a - b) << endl;
    else if (a < k)
        cout << a << endl;
    else
        cout << k << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

void C()
{
	map<string, bool> dictionary;
	int N;
	scanf("%d", &N);
	char command[20],data[20];
	for (int i = 0; i < N; i++)
	{
		scanf("%20s", command);
		scanf("%20s", data);

		if (command[0] == 'i')
		{
			string key = data;
			dictionary[key] = true;
		}
		else if (command[0] =='f')
		{
			string key = data;
			if (dictionary.find(key) == dictionary.end())
			{
				cout << "no" << endl;
			}
			else
			{
				cout << "yes" << endl;
			}
		}
	}

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

Measured memory_bytes: 31364
using System;

class Program
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine();
        var ans = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == '1')
            {
                ans++;
            }
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11092
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

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

ll nCr(ll n,ll r){
  if(r == 1) return n;
  else if(r == 0) return 1;
  else return nCr(n-1,r-1)*n/r;
}

int main(){
  ll n; string s; cin >> s; n = s.size(); vl num(n+1);
  
  if(s[0] == '<') num[0] = 0;
  
  for(ll i=0; i < n; i++){
    if(s[i] == '>' && s[i+1] == '<'){
      num[i+1] = 0;
    }
    else if(s[i] == '<'){
      num[i+1] = num[i] + 1;
    }
    
  }
  
  
  for(ll i=n-1; i >= 0; i--){
    if(s[i] == '>'){
      if(num[i] <= num[i+1] + 1) num[i] = num[i+1] + 1;
    }
  }
 
  
  ll ans = 0;
  rep(i,n+1){
    ans += num[i];
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 4868
n = int(input())
t = list(map(int, input().split()))
m = int(input())
p = []
x = []
for i in range(m):
    tmpp, tmpx = map(int, input().split())
    tmpp -= 1
    p.append(tmpp)
    x.append(tmpx)
    
_sum = sum(t)

for i in range(m):
    print(_sum - (t[p[i]]-x[i]))
    

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

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

int ud(int x, int y) {
    return (x + y - 1) / y;
}

int main() {
#ifdef BZ
    freopen("in", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n, k;
    cin >> n >> k;
    int pos = -1;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        if (x == 1) {
            pos = i;
        }
    }

    int ans = 1e9 + 7;
    for (int l = 0; l < k - 1; l++) {
        int gl = pos - 1 - l;
        int gr = (n - pos) - (k - 1 - l);
        ans = min(ans, 1 + ud(gl, k - 1) + ud(gr, k - 1));
    }

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


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main ()
{
	int n,i;
	char s[101];
	scanf("%s",s);
	n=strlen(s);
	for(i=0;i<n;i++)
	{
		s[i]='x';
	}
	puts(s);
	return 0;
}

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

#define M 100000
int N,mat[M][3],dp[M][3];

inline int sol (int i, int j)
{
	if(i>=N) return 0;
	if(dp[i][j]!=-1) return dp[i][j];
	
	int ma=-1;
	for(int k=0; k<3; k++) if(k!=j) ma=max(ma,sol(i+1,k));
	return dp[i][j]=ma+mat[i][j];
}

int main ()
{
	cin >> N;
	for(int i=0; i<N; i++) for(int j=0; j<3; j++) cin >> mat[i][j];
	for(int i=0; i<M; i++) for(int j=0; j<3; j++) dp[i][j]=-1;
	for(int j=0; j<3; j++) dp[N-1][j]=mat[N-1][j];
	cout << max(sol(0,0),max(sol(0,1),sol(0,2)));
}

Measured memory_bytes: 7296
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))

a, b, c, k = inpl()
ans = 0
if k < a:
    print(k)
    exit()
if k < a + b:
    print(a)
    exit()
print(a-(k-a-b))


Measured memory_bytes: 68872
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

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

ll n;
ll x[55],y[55];

int main(){
	cin>>n;
	REP(i,n){
		cin>>x[i]>>y[i];
	}
	map<Pi,ll> m;
	for(ll i=0;i<n;i++){
		for(ll j=0;j<n;j++){
			if(i!=j){
			ll a1=x[j]-x[i];
			ll a2=y[j]-y[i];
			
			m[Pi(a1,a2)]++;
			}
		
		}
	}
	ll ans=0;
	for(auto it=m.begin();it!=m.end();it++){
		//cout<<it->second<<endl;
		if(it->second>ans)ans=it->second;
	}
	cout<<n-ans<<endl;
	return 0;
}

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

struct item {
    lint r = 0;
    lint c = 0;
    lint v = 0;
    item() {}
    item(lint _r, lint _c, lint _v) : r(_r), c(_c), v(_v) {}
};

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

lint r, c, k;

int main() {
    cin >> r >> c >> k;
    vector<vector<lint>> items(r + 1, vector<lint>(c + 1, 0));
    for (int i = 0; i < k; i++) {
        lint tr, tc, tv;
        cin >> tr >> tc >> tv;
        items[tr][tc] = tv;
    }
    //[0,i),[0,j)までk個拾った時
    vector<vector<vector<lint>>> dp(r + 1, vector<vector<lint>>(c + 1, vector<lint>(4, 0)));
    //配る
    for (int x = 1; x <= r; x++) {
        for (int y = 1; y <= c; y++) {
            for (int z = 0; z <= 3; z++) {
                chmax(dp[x][y][z], dp[x - 1][y][3]);
                chmax(dp[x][y][z], dp[x][y - 1][z]);
            }
            for (int z = 3; z >= 1; z--) {
                chmax(dp[x][y][z], dp[x][y][z - 1] + items[x][y]);
            }
        }
    }
    cout << dp[r][c][3] << endl;
}

Measured memory_bytes: 706500
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  cout << (n - 1) / 2 << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;
typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};

bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

vector<Weight> dijkstra(const Graph &g, int s) {
  vector<Weight> dist(g.size(), INF);
  dist[s] = 0;
  priority_queue<Edge> Q; // "e < f" <=> "e.weight > f.weight"
  for (Q.push(Edge(-2, s, 0)); !Q.empty(); ) {
    Edge e = Q.top(); Q.pop();
    if (dist[e.dst] < e.weight) continue;
    FOR(f,g[e.dst]) {
      if (dist[f->dst] > e.weight+f->weight) {
        dist[f->dst] = e.weight+f->weight;
        Q.push(Edge(f->src, f->dst, e.weight+f->weight));
      }
    }
  }
  return dist;
}
int main() {
  int n,m;
  while(cin>>n>>m,n||m) {
    Graph g(n*3);
    REP(i,m) {
      int a, b, c;
      cin >> a >> b >> c;
      a--; b--;
      int a1 = a*3, b1 = b*3;
      int a2 = a1+1, b2 = b1+1;
      int a3 = a2+1, b3 = b2+1;
      g[a1].push_back(Edge(a1,b1,c));
      g[b1].push_back(Edge(b1,a1,c));
      g[a1].push_back(Edge(a1,b2,0));
      g[b1].push_back(Edge(b1,a2,0));
      g[a2].push_back(Edge(a2,b3,0));
      g[b2].push_back(Edge(b2,a3,0));
      g[a3].push_back(Edge(a3,b3,c));
      g[b3].push_back(Edge(b3,a3,c));
    }
    vector<int> dist = dijkstra(g,0);
    int t = (n-1)*3;
    cout << min(dist[t], dist[t+2]) << endl;
  }
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void){
  char buf[128];
  int a, b, c;
  int min;
  fgets(buf, 128, stdin);
  sscanf(buf, "%d %d %d", &a, &b, &c);

  min = a + b;
  if (min > a + c){
    min = a + c;
  }
  if (min > b + c){
    min = b + c;
  }
  printf("%d\n", min);

  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll a,b,k,d,x;
    cin>>k;
    cin>>a>>b;
    x = a;
    d = a%k;

    if(d==0)
    {
        cout<<"OK\n";
    }
    else
    {
        d = a/k;
        d += 1;
        x = d*k;
        if(x >= a && x <= b)
        {
            cout<<"OK\n";
        }
        else
        {
            cout<<"NG\n";
        }

    }

}


Measured memory_bytes: 3596
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int N, K, C;
string S;

int main() {

	cin >> N >> K >> C;
	cin >> S;

	vector<int> can1;
	vector<bool> worked(N);
	rep(i, N) {
		if (S[i] == 'o') {
			can1.push_back(i);
			worked[i] = true;
			i += C;
		}
	}

	if (can1.size() > K) {
		return 0;
	}

	vector<int> counter(N), maxim(N);
	rep(i, N) {
		if (i - C - 1 < 0) {
			if (S[i] == 'o') {
				counter[i] = 1;
			}
			else {
				counter[i] = 0;
			}
		}
		else {
			if (S[i] == 'o') {
				counter[i] = maxim[i - C - 1] + 1;
			}
			else {
				counter[i] = maxim[i - C - 1];
			}
		}
		if (i)
			maxim[i] = max(maxim[i - 1], counter[i]);
		else
			maxim[i] = counter[i];
	}

	vector<int> can2;
	rep(i, N) {
		int ri = N - 1 - i;

		if (S[ri] == 'o') {
			can2.push_back(ri);
			i += C;
		}
	}

	sort(all(can2));

	rep(i, K) if (can1[i] == can2[i]) cout << can1[i] + 1 << endl;



	return 0;
}


Measured memory_bytes: 4988
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int len=0;
/*void dfs(int i,bool *vis,int *d,vector<int>list[]){
	vis[i]=true;
  	for(int x:list[i]){
    	//if(!vis[x]){
          	d[x]=d[i]+1;
        	dfs(x,vis,d,list);
       // }
    }
len = max(len,d[i]);

}*/
int lp(int i,vector<int>indegree[],int *d){
	if(d[i]!=-1)
      return d[i];
  if(indegree[i].size()==0)
  {
    d[i]=0;
    return d[i];
  }
  else{
  	int maxp=0;
    for(int x:indegree[i]){
    	maxp=max(maxp,lp(x,indegree,d));
    }
    d[i]=maxp+1;
    return d[i];
  
  }

}
int main(){
	int n,m;
  cin>>n>>m;
  int d[n+1];
    memset(d,-1,sizeof(d));

  vector<int>indegree[n+1];
  while(m--){
  int x,y;
    cin>>x>>y;
    indegree[y].push_back(x);
  }
	
  for(int i=1;i<=n;i++){
  	len=max(len,lp(i,indegree,d));
    }
    
  
  cout<<len<<endl;
}


Measured memory_bytes: 12160
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}

//combination(Nが小さい時はこれを使う)
const int MAX = 300000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight_sum(int n) {
	int sum = 0;
	rep(i, 20)sum += (n % (int)pow(10, i + 1)) / (pow(10, i));
	return sum;
}
int a[11111];
signed main() {
	int n, m;
	cin >> n >> m;
	rep(i, m)cin >> a[i];
	int memo = 0;
	rep(i, m)memo += a[i];
	if (memo > n)puts("-1");
	else cout << n - memo << endl;
	ggr
}


Measured memory_bytes: 3656
'''

sekai_no_owari
 愛

''' 

def findTrailingZeros(n): 
      
    # Initialize result 
    count = 0
  
    # Keep dividing n by 
    # powers of 5 and 
    # update Count 
    i=10
    while (n/i>0): 
        count += n//i 
        i *= 5
  
    return int(count) 

n = int(input())
if n%2 != 0:
    print(0)
else:
    print(findTrailingZeros(n))

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

int main() {
  string s; cin >> s;
  int left = 0;
  int right = s.size() - 1;
  int cnt = 0;
  while (left < right) {
    if (s.at(left) == s.at(right)) {
      left++;
      right--;
    }
    else if (s.at(left) == 'x' && s.at(right) != 'x') {
      cnt++;
      left++;
    }
    else if (s.at(left) != 'x' && s.at(right) == 'x') {
      cnt++;
      right--;
    }
    else { cout << -1 << endl; return 0; };
  }
  cout << cnt << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<string>s(n);
    for(int i = 0; i < n; i++)  cin >> s.at(i);
    vector<vector<char>>ss(n,vector<char>(10));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 10; j++){
            ss.at(i).at(j) = s.at(i).at(j);
        }
    }
    for(int i = 0; i < n; i++){
        sort(ss.at(i).begin(),ss.at(i).end());
    }
    sort(ss.begin(),ss.end());
    vector<int64_t>cnt(1,1);
    for(int i = 0; i < n-1; i++){
        if(ss.at(i) == ss.at(i+1))
            cnt.at(cnt.size()-1)++;
        else cnt.push_back(1);
    }
    int64_t ans = 0ll;
    for(int64_t c : cnt){
        ans += c*(c-1)/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 13948
#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

bool used1[1 << 18], used2[1 << 18];
//頂点fromから頂点toへのコストcostの辺
struct edge { ll from, to, cost; };
edge es[345678]; //辺
ll d[345678]; //最短距離
//Vは頂点数、Eは辺数
//s番目の頂点から各頂点への最短距離を求める
void Bellman_Ford(ll V, ll E, ll s) {
	for (int i = 0; i <= V; i++) d[i] = INF;
	d[s] = 0;
	for (int z = 0; z <= V; z++) {
		bool flag = false;
		for (int i = 0; i < E; i++) {
			edge e = es[i];
			if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				if (used1[e.to] == true && used2[e.to] == true) { flag = true; }
			}
		}
		if (flag == false) { break; }
		if (z == V) {
			d[V] = INF; break;
		}
	}
}


ll test[12345678], a[1234567], b[1234567], c[1234567];
signed main() {
	ll n, m, ppp; cin >> n >> m >> ppp;
	rep(h, m) {
		cin >> a[h] >> b[h] >> c[h]; c[h] -= ppp;
		es[h] = { a[h], b[h], 0 - c[h] };
	}
	used1[1] = true;
	rep(h, n) {
		rep(i, m) {
			if (used1[a[i]] == true) { used1[b[i]] = true; }
		}
	}
	used2[n] = true;
	rep(h, n) {
		rep(i, m) {
			if (used2[b[i]] == true) { used2[a[i]] = true; }
		}
	}
	Bellman_Ford(n, m, 1);
	if (d[n] == INF) { cout << "-1\n"; }
	else { cout << max((ll)0, 0 - d[n]) << endl; }
	return 0;
}

Measured memory_bytes: 3912
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {  
	ll kazu=1;
	while(1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁


/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	vector<vector<ll>> c(3);
	for (int i = 0;i < 3;i++) {
		c[i].resize(3);
		for (int j = 0;j < 3;j++) cin >> c[i][j];
	}
	bool ok = false;
	if (c[0][0] + c[0][1] - c[0][2] * 2== c[1][0] + c[1][1] - c[1][2] * 2) {
		if (c[1][0] + c[1][1] - c[1][2] * 2== c[2][0] + c[2][1] - c[2][2] * 2) {
			if (c[0][0] + c[0][1] - c[0][2] * 2 == c[2][0] + c[2][1] - c[2][2] * 2) ok = true;
		}
	}
	if (ok) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll iv(ll i) {
	if (i == 1) { return 1; }
	return MOD - iv(MOD%i)*(MOD / i) % MOD;
}

int main() {

	COMinit();

	ll N, A, B, C;
	cin >> N >> A >> B >> C;


	ll pa[MAX], pb[MAX], pab[MAX];
	pa[0] = 1;
	pb[0] = 1;
	pab[0] = 1;
	repn(i, MAX) {
		pa[i] = pa[i - 1] * A%MOD;
		pb[i] = pb[i - 1] * B%MOD;
		pab[i] = pab[i - 1] * (A + B) % MOD;
	}

	ll si = 0;

	rep(i, N) {
		ll X = (pa[N] * pb[i] + pa[i] * pb[N]) % MOD;
		X = X * pab[N - 1 - i]%MOD;
		X = X * COM(N + i - 1, i) % MOD;
		//cout << X << endl;
		X = X * (N + i) % MOD;
		si = (si + X) % MOD;
	}

	si = si * (A+B+C) % MOD;

	ll bo = pab[2*N-1] * (A+B) % MOD;

	//cout << si << " " << bo<<endl;

	ll ans = si * iv(bo) % MOD;
	cout << ans;


	system("PAUSE");
}


Measured memory_bytes: 47352
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

const double PI = acos(-1);

double solve(double A, double B, double H, double M) {
    double angle = M * PI / 30 - (H * 60 + M) * PI / 360;
    return sqrt(A * A + B * B - 2 * A * B * cos(angle));
}

int main() {
    double A, B, H, M;
    cin >> A >> B >> H >> M;
    cout << setprecision(10) << solve(A, B, H, M) << endl;
    return 0;
}

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

const int MAX_N = 200;
int n, tmp;
int Arr[MAX_N];
int cnt[MAX_N];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &Arr[i]);
	for (int i = 0; i < n; i++)
		tmp = max(tmp, Arr[i]);
	for (int i = 0; i < n; i++)
		cnt[Arr[i]]++;

	bool ans = true;
	if (tmp & 1) {
		if (cnt[(tmp >> 1) + 1] != 2)
			ans = false;

		for (int i = (tmp >> 1) + 1; i <= tmp; i++)
			if (cnt[i] < 2)
				ans = false;

		for (int i = 0; i < n; i++)
			if (!((tmp >> 1) + 1 <= Arr[i] && Arr[i] <= tmp))
				ans = false;
	}
	else {
		if (cnt[tmp >> 1] != 1)
			ans = false;

		for (int i = (tmp >> 1) + 1; i <= tmp; i++)
			if (cnt[i] < 2)
				ans = false;

		for (int i = 0; i < n; i++)
			if (!((tmp >> 1) <= Arr[i] && Arr[i] <= tmp))
				ans = false;
	}
	if (ans)
		printf("Possible\n");
	else
		printf("Impossible\n");
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll n;
vector<string> vs;


ll calc(int &i,int op){
    // cout << "!" << i << endl;
    ll res = INF;
    ll d = -1;
    while(i < vs.size()){
        // cout << i << " " << res << " " << d <<  endl;
        if(d > (ll)vs[i].size())break;
        d = max(d,(ll)vs[i].size());
        if(vs[i].back() >= '0' && vs[i].back() <= '9'){
            if(op == -1 || res == INF)res = (vs[i].back() - '0');
            else if(op == 0)res += (vs[i].back() - '0');
            else if(op == 1)res *= (vs[i].back() - '0');
            i++;
        }
        else if(vs[i].back() == '+'){
            if(op == -1 || res == INF) res = calc(++i,0);
            else if(op == 0)res += calc(++i,0);
            else if(op == 1)res *= calc(++i,0);
        }
        else if(vs[i].back() == '*'){
            if(op == -1 || res == INF) res = calc(++i,1);
            else if(op == 0)res += calc(++i,1);
            else if(op == 1)res *= calc(++i,1);
        }
    }
    // cout << "!!" << i << " " << res << endl;
    return res;
}

int main(){
    while(cin >> n && n){
        vs.clear();
        vs.resize(n);
        rep(i,n)cin >> vs[i];
        int i = 0;
        cout << calc(i,-1) << endl;
    }

}


Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;

int main()
{
    int n;
    cin >> n;
    vec<int> a(n),b(n),c(n-1);
    for (auto &&e : a)
    {
        cin >> e;
        e--;
    }
    for (auto &&e : b)
    {
        cin >> e;
    }
    for (auto &&e : c)
    {
        cin >> e;
    }
    int ans = 0;
    ans += b.at(a.at(0));
    for (int i = 1; i < n; i++)
    {
        ans += b.at(a.at(i));
        if (a.at(i-1) + 1 == a.at(i))
        {
            ans += c.at(a.at(i-1));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
import math

N = 1000000
primes = [1] * (N//2)
primes[0] = 0

for i in range(3,int(math.sqrt(N)),2):
    if primes[i//2]:
        primes[(i*i)//2::i] = [0] * len(primes[(i*i)//2::i])

for i in sys.stdin:
    n = int(i)
    if n == 1:
        print(0)
    elif n == 2:
        print(1)
    else:
        print(sum(primes[0:(n+1)//2])+1)

Measured memory_bytes: 17012
# -*- coding: utf-8 -*-


def converter(a, b):
    larger = max(a, b)
    smaller = min(a, b)
    if larger == 0 or smaller == 0:
        return larger
    else:
        return converter(smaller, larger % smaller)        


def main():
    a, b = [int(x) for x in raw_input().strip().split(' ')]
    print converter(a, b) 


if __name__ == '__main__':
    main()

Measured memory_bytes: 6432
#include<stdio.h>
#include<stdlib.h>
int aqwertysc(const void *ascqwerty, const void *bscqwerty) {
  return *(int *)ascqwerty - *(int *)bscqwerty;  
}
int main(void)
{
  int koma,targ;
  scanf("%d%d",&koma,&targ);
  int x[targ],i;
  for(i=0;i<targ;i++)
  {
    scanf("%d",&x[i]);
  }
  qsort(x, sizeof(x) / sizeof(int), sizeof(int), aqwertysc);
  
  int sub[targ-1],sum=0,k;
  for(i=0;i<targ-1;i++)
  {
    sub[i]=x[i+1]-x[i];
  }
  qsort(sub, sizeof(sub) / sizeof(int), sizeof(int), aqwertysc);
  
  int mini,ans;
  if((targ-koma)>0)
  {
    mini=targ-koma;
    for(i=0;i<mini;i++)
    {
      sum=sum+sub[i];
    }
    ans=sum;
  }
  else ans=0;
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 1396
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#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 FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
LL mypow(LL x,LL y){
    x%=MOD;
    LL res=1%MOD;
    while(y){
        if(y&1)res=res*x%MOD;
        y>>=1;
        x=x*x%MOD;
    }
    return res;
}
LL fac[SIZE],AA[SIZE];
int main(){
    fac[0]=1;
    REPP(i,1,SIZE)fac[i]=fac[i-1]*i%MOD;
    int n;
    R(n);
    int lt=-1;
    LL an=0;
    LL now=0;
    REP(i,n){
        int x;
        R(x);
        if(lt!=-1){
            ADD(now,fac[n-1]*mypow(i,MOD-2));
            ADD(an,now*(x-lt));
        }
        lt=x;
    }
    W(an);
    return 0;
}


Measured memory_bytes: 9856
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	
	int n;
	cin >> n;
	int a[16] = {400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000};
	for(int i = 0; ; i++)
	{
		if(n >= a[i] and n < a[i + 1])
		{
			cout << 8 - i;
			break;
		}
	}

	return 0;
}



Measured memory_bytes: 3628
n, m, x = map(int, input().split())

c = [0] * n
a = [[0] * m for _ in range(n)]

for i in range(n):
    tmp = list(map(int, input().split()))
    c[i] = tmp[0]
    for j in range(m):
        a[i][j] = tmp[1 + j]

ans = float("inf")
for mask in range(1 << n):
    sum = 0
    skill = [0] * m
    for j in range(n):
        if (mask >> j) & 1 == 1:
            for k in range(m):
                skill[k] += a[j][k]
            sum += c[j]

    flag = True
    for i in range(m):
        if skill[i] < x:
            flag = False
            break

    if flag is True:
        ans = min(ans, sum)

if ans != float("inf"):
    print(ans)
else:
    print(-1)

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

int main(void){
   long double a,b,c;
   cin>>a>>b>>c;
   long double eps=1.0E-14;
   if(sqrt(a)+sqrt(b)+eps<sqrt(c)){
      cout<<"Yes"<<endl;
   }else{
      cout<<"No"<<endl;
   }
   return 0;
}


Measured memory_bytes: 3768
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define int long long
#define endre getchar();getchar();return 0
#define INF 1000000007
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return (kai(n - 1)*n) % INF;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int mystoi(string s) {
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		cnt += (int)(s[i] - '0') * pow(10, s.size() - i - 1);
	}
	return cnt;
}

signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << b + min(a + b + 1, c) << endl;
	endre;
}


Measured memory_bytes: 256