akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    uint64_t a,b,n,x;
    cin>>a>>b>>n;
    x=min(b-1,n);
    cout<<floor(a*x/b)-a*float(x/b);    
}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int N;
int b;
vector<int> A,B;

int main(){
  cin >> N;
  rep(i,0,N){
    cin >> b;
    b--;
    B.push_back(b);
  }

  int u = -1;
  rep(i,0,N){
    u = -1;
    rep(j,0,B.size()){
      if(B[j] == j)u = j;
    }
    if(u == -1)break;
    else{
      B.erase(B.begin()+u);
      A.push_back(u);
    }
  }

  if(u == -1){
    cout << -1 << endl;
  }else{
    reverse(A.begin(),A.end());
    rep(i,0,N){
      cout << A[i]+1 << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}
void comb(vector<vector<long long int>> &v)
{
	for (size_t i = 0; i < v.size(); i++)
	{
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (size_t k = 1; k < v.size(); k++)
	{
		for (size_t j = 1; j < k; j++)
		{
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}
ll repeat_squaring(ll n, ll p, ll m)
{
	if (p == 0)
		return 1;
	if (p % 2 == 0)
	{
		ll t = repeat_squaring(n, p / 2, m);
		return t * t % m;
	}
	return n * repeat_squaring(n, p - 1, m);
}

int main()
{
	str s;
	cin >> s;
	int ans = 0, ans2 = 0;
	char x = '1';
	rep(i, s.size())
	{
		if (s[i] == x)
		{
			ans++;
		}
		else
		{
			ans2++;
		}
		if (x == '1')
		{
			x = '0';
		}
		else
		{
			x = '1';
		}
	}
	cout << min(ans, ans2) << endl;
	return 0;
}

Measured memory_bytes: 512
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n\r\t', '', _, String).

get_chars(Xs) :-
    get_string(S),
    string_chars(S, Xs).

get_numbers(0, []).
get_numbers(N, [X|Xs]) :- 
    get_number(X), 
    N2 is N - 1, 
    get_numbers(N2, Xs).

put_numbers([]).
put_numbers([X|Xs]) :-
    writeln(X),
    put_numbers(Xs).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)
    length(S, L),
    sub_string

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==

    between(L,U,X): L <= X <= U
    nth0(I, Xs, Y), nth1(I, Xs, Y): (Xs,Y) -> I, (I, Xs) -> Y 

    sort(Key, Order, List, Sorted): Keyは通常0?, Orderは=なしが重複削除，=は重複保持
    \+ P(X) : not P(X)

    sum_list(Xs, Sum)

    orは!忘れに注意(末尾再帰なら直前)
*/


f(A, B, K, A2, B2) :- K =< A, A2 is A - K, B2 is B, !.
f(A, B, K, A2, B2) :- A2 is 0, B2 is max(0, A + B - K).

main :-
    get_number(A, B, K),
    f(A, B, K, A2, B2),
    writeln(A2),
    writeln(B2).

    % statistics(inferences, IC), writeln(IC).


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

using namespace std;

int main()
{
    string str;
    cin >> str;
    int len = str.length();
    if(len & 1)
    {
        str.erase(len-1);
        len--;
    }
    else
    {
        str.erase(len-2,2);
        len -= 2;
    }
    for(;;)
    {
        int mid = len/2, ok = 1;
        for(int i = 0; i < mid; i++)
            if(str[i] != str[mid+i])
            {
                ok = 0;
                break;
            }
        if(ok)
        {
            cout << mid*2;
            return 0;
        }
        else
        {
            str.erase(len-2, 2);
            len -= 2;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto X = readln.split.map!(to!long).array;
    auto G = new Tuple!(int, long)[][](N);
    auto E = new Tuple!(int, int, long)[](M);
    foreach (i; 0..M) {
        s = readln.split.map!(to!int);
        G[s[0]-1] ~= tuple(s[1]-1, s[2].to!long);
        G[s[1]-1] ~= tuple(s[0]-1, s[2].to!long);
        E[i] = tuple(s[0]-1, s[1]-1, s[2].to!long);
    }

    E.sort!"a[2] < b[2]";
    auto uf = new UnionFind(N, X);

    foreach (e; E) {
        uf.unite(e[0], e[1]);
        int u = uf.find(e[0]);
        if (uf.weights[u] >= e[2]) {
            uf.unused_edges[u] = 0;
        }
    }

    int u = uf.find(0);
    uf.unused_edges[u].writeln;
}



class UnionFind {
    int N;
    int[] table;
    long[] weights;
    long[] unused_edges;

    this(int n, long[] X) {
        N = n;
        table = new int[](N);
        fill(table, -1);
        weights = new long[](N);
        foreach (i; 0..N) weights[i] = X[i];
        unused_edges = new long[](N);
    }

    int find(int x) {
        return table[x] < 0 ? x : (table[x] = find(table[x]));
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (table[x] > table[y]) swap(x, y);
        unused_edges[x] += 1;
        if (x == y) return;
        weights[x] += weights[y];
        unused_edges[x] += unused_edges[y];
        table[x] += table[y];
        table[y] = x;
    }
}


Measured memory_bytes: 26872
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

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

    int N, M;
    cin >> N >> M;

    set<int> from;
    set<int> to;
    int f, t;

    for (int i=0; i<M; i++) {
      cin >> f >> t;

      if (f == 1) {
        from.insert(t);
      }
      if (t == N) {
        to.insert(f);
      }
    }

    for(auto i=from.begin(); i != from.end(); ++i) {
      if (to.find(*i) != to.end()) {
        cout << "POSSIBLE" << endl;
        return 0;
      }
    }

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


Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main(){
  int n,k;
  vector<int> l;
  cin >> n >> k;
  int tmp_l;
  for(int i = 0; i < n; i++){
    cin >> tmp_l;
    l.push_back(tmp_l);
  }
  sort(l.rbegin(), l.rend());
  int ret = 0;
  for(int i = 0; i < k; i++){
    ret += l[i];
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

int main(void)
{
    string s;
    cin >> s;
    s[3]='8';
    pr(s);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define ZERO (1e-10)
#define INF int(1e9+1)
#define CL(A,I) (memset(A,I,sizeof(A)))
#define DEB printf("DEB!\n");
#define D(X) cout<<"  "<<#X": "<<X<<endl;
#define EQ(A,B) (A+ZERO>B&&A-ZERO<B)
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
#define IN(n) int n;scanf("%d",&n);
#define FOR(i, m, n) for (int i(m); i < n; i++)
#define F(n) FOR(i,0,n)
#define FF(n) FOR(j,0,n)
#define FT(m, n) FOR(k, m, n)
#define aa first
#define bb second
void ga(int N,int *A){F(N)scanf("%d",A+i);}
#define CC(X) ((X)*(X-1)/2)
int N,K,L;
vii o;
int main(void){
    scanf("%d%d",&N,&K),L=CC(N-1);
    if(L<K)return puts("-1"),0;
    FT(1,N)o.PB({k,N});
    FT(1,N)FOR(i,k+1,N)if(L>K)--L,o.PB({k,i});
    printf("%lu\n",o.size());
    for(auto&h:o)printf("%d %d\n",h.aa,h.bb);
    return 0;
}


Measured memory_bytes: 384
#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();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    ll ans = 0;
    rep(r, N+1)
    {
        rep(g, N+1)
        {
            int b = (N - r * R - g * G) / B;
            if ((N - r * R - g * G) % B == 0 and b >= 0)
            {
                ans++;
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
import math
import time
from collections import defaultdict,deque
from sys import stdin,stdout
from bisect import bisect_left,bisect_right
a,b,c,k=map(int,stdin.readline().split())
if(k<=a):
    print(k)
elif(k<=a+b):
    print(a)
else:
    print(a-(k-a-b))


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

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

  while (true) {
    string s = to_string(N);
    char c = s[0];
    bool ok = true;
    for (int i = 1; i < 3; i++) {
      if(c != s[i]) ok = false;
    }
    if (ok) break;
    N++;
  }
  cout << N << endl;
  return 0;
}

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

typedef pair<double,double>P;
#define X first
#define Y second

P sub(P a,P b){
	return P(a.X-b.X,a.Y-b.Y);
}

int chk(P a,P b,P c,P p){
	P ab=sub(b,a);
	P bp=sub(p,b);
	P bc=sub(c,b);
	P cp=sub(p,c);
	P ca=sub(a,c);
	P ap=sub(p,a);
	double c1 = ab.X * bp.Y - ab.Y * bp.X;
	double c2 = bc.X * cp.Y - bc.Y * cp.X;
	double c3 = ca.X * ap.Y - ca.Y * ap.X;
	if( ( c1 > 0 && c2 > 0 && c3 > 0 ) || ( c1 < 0 && c2 < 0 && c3 < 0 ) ) {
		//三角形の内側に点がある
		return 1;
	}
	return 0;
}

int main(){
	
	int n;cin>>n;
	while(n--){
		P a,b,c,d,e;
		cin>>a.X>>a.Y>>b.X>>b.Y>>c.X>>c.Y>>d.X>>d.Y>>e.X>>e.Y;
		if(chk(a,b,c,d)+chk(a,b,c,e)==1)cout<<"OK\n";
		else cout<<"NG\n";
		
	}
	return 0;
}


Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	ll x, y; cin >> x >> y;
	ll po = 1;
	for(ll i = 1;;++i){
		po *= 2;
		if(po > y / x){
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
static const int MAXN = 2e5 + 4;
static const int ALPHA = 26;

int n;
char s[MAXN];

int f[MAXN];
int nxt[MAXN][ALPHA];

int cur[ALPHA];

int main()
{
    scanf("%s", s);
    n = strlen(s);
    for (int i = 0; i < n; ++i) s[i] -= 'a';

    f[n] = 0;
    for (int i = 0; i < ALPHA; ++i) nxt[n][i] = -1;
    for (int i = 0; i < ALPHA; ++i) cur[i] = n;

    for (int i = n - 1; i >= 0; --i) {
        memcpy(nxt[i], cur, sizeof cur);
        f[i] = MAXN;
        for (int j = 0; j < ALPHA; ++j)
            f[i] = std::min(f[i], f[cur[j]] + 1);
        cur[s[i]] = i;
    }
    //for (int i = 0; i <= n; ++i) printf("%d%c", f[i], i == n ? '\n' : ' ');

    int ans = MAXN;
    for (int j = 0; j < ALPHA; ++j)
        ans = std::min(ans, f[cur[j]] + 1);

    while (ans > 0) {
        for (int i = 0; i < ALPHA; ++i)
            if (f[cur[i]] == ans - 1) {
                putchar(i + 'a');
                memcpy(cur, nxt[cur[i]], sizeof cur);
                --ans;
                break;
            }
    }
    putchar('\n');

    return 0;
}


Measured memory_bytes: 21504
#include<iostream>
#include<algorithm>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  int N, L; std::cin >> N >> L;
  int sum = N*(L-1) + N*(N+1)/2;
  int i = std::min(N, std::max(1-L, 1));
  fin(sum - (L+i-1));
  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
s = list(input())
r = []
num = 1

# 文字列を固まりごとのリストに変換
for i in range(0, n-1):
  if s[i] == s[i+1]:
    num += 1
  else:
    r.append(num)
    num = 1
r.append(num)

# 幸福の最大値を算出
for j in range(k):
  if len(r) == 2:
    r[0] = r[0] + r[1]
    r.pop(1)
  elif len(r) == 1:
    pass
  else:
    r[0] = r[0] + r[1] + r[2]
    r.pop(2)
    r.pop(1)

ans = sum(r) - len(r)
print(ans)

Measured memory_bytes: 4772
import collections
s=[input() for _ in range(int(input()))]
t=[input() for _ in range(int(input()))]
cs=collections.Counter(s)
ct=collections.Counter(t)
ans=0
for k,v in cs.items():
    mp=0
    if k in ct:
        mp=ct[k]
    ans=max(ans, v-mp)
print(ans)


Measured memory_bytes: 3316
use std::io;
use std::str::FromStr;
use std::cmp::min;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn main() {
    let a: u64  = input();
    let b: u64 = input();
    let c: u64 = input();
    let d: u64 = input();
    println!("{}", min(a, b) + min(c, d));
}


Measured memory_bytes: 2148
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    if (A >= 13) {
        cout << B << endl;
    } else if (A >= 6) {
        cout << B / 2 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a=a%b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/
vi to[101010];

signed main(){
  int n,m;
  cin>>n>>m;
  // vi x(m),y(m);
  // rep(i,m) cin>>x[i]>>y[i];

  vi vol(n,1),red(n,0);
  red[0]=1;
  rep(i,m){
    int x,y;
    cin>>x>>y;
    x--;y--;
    vol[x]--;vol[y]++;
    if(red[x]) red[y]=1;
    if(vol[x]==0) red[x]=0;

  }
  int ans=0;
  rep(i,n){
    if(red[i]) ans++;
  }
  cout<<ans<<endl;
  // rep(i,n)cout<<vol[i]<<endl;
  
  return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b)
{
    return b ? gcd(b, a % b) : a;
}
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const string YES = "Yes";
const string NO = "No";

void func(long long A, long long B, long long C)
{
    if (A == B && B == C)
    {
        cout << "No" << endl;
    }
    else if (A != B && B != C && A != C)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
}

int main()
{
    // cout << fixed << setprecision(5);

    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    func(A, B, C);
    return 0;
}


Measured memory_bytes: 384
x = int(input())

dp = [0 for _ in range(100000 + 1)] #0:"No", 1:"Yes"
dp[0] = 1
for i in range(100, 106):
    dp[i] = 1
for i in range(106, x + 1):
    if dp[i-100] == 1 or dp[i-101] == 1 or dp[i-102] == 1 or dp[i-103] == 1 or dp[i-104] == 1 or dp[i-105] == 1:
        dp[i] = 1
print(dp[x])


Measured memory_bytes: 3864
#include<bits/stdc++.h>
using namespace std;
int x[10000][1440],y[10000],n,m,r,q,i,j,a,b,c,d,s;
int main(){
while(true){
memset(x,0,sizeof(x));cin>>n>>m>>r;if(n==0){break;}
for(i=0;i<r;i++){cin>>a>>b>>c>>d;
if(d==1){y[c]++;for(j=a;j<1440;j++){x[c][j]=1;}}
else{y[c]--;if(y[c]==0){for(j=a;j<1440;j++){x[c][j]=0;}}}}
cin>>q;for(i=0;i<q;i++){s=0;cin>>a>>b>>c;for(j=a;j<b;j++){if(x[c][j]==1){s++;}}
cout<<s<<endl;}}}

Measured memory_bytes: 57456
#include <stdio.h>

int A, B;

int main () {

        scanf("%d %d", &A, &B);

        if (A == B)
                printf("%d\n", A + B);
        else if (A > B)
                printf("%d\n", 2 * A - 1);
        else
                printf("%d\n", 2 * B - 1);

        return 0;
}


Measured memory_bytes: 128
/*
                                Bismillahi-r-Rahmani-r-Rahim
                                        RhIeyAaD
                                    IIT-7th Batch,JU
*/
#include<bits/stdc++.h>
using namespace std;

#define pf(a)           printf("%lld\n", a)
#define sf(a)           scanf("%lld", &a)
#define line(a)         getline(cin,(a))
#define ll              long long int
#define MAX             2134567891
#define MID(l,r)        (l+r)>>1
#define fr(i,n)         for(i=0;i<n;i++)
#define rep(i,n)        for(i=1;i<=n;i++)
#define per(i,a,n)      for(i=n;i>=a;i--)
#define FOR(i,a,n)      for(i=a;i<=n;i++)
#define ALL(n)          n.begin(),n.end()
#define mem(x,n)        memset(x,n,sizeof(x))
#define T_C(t)          printf("Case %lld: ",t)
#define TC(t)           printf("Case %lld:\n",t)
#define ans(t,c)        printf("Case %lld: %lld\n",t,c)
#define SETP(n)         cout<<setprecision(n)<<fixed
#define READ            freopen("F:\\Project\\Test_Case.txt","r",stdin)
#define WRITE           freopen("F:\\Project\\Output_Test.txt","w",stdout)
#define IO              ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define PAIR            pair<ll,ll>
#define MP              make_pair
#define pb(a)           push_back(a)
#define ff              first
#define ss              second
#define MOD             1000000007///10^9
#define p6              1000007 ///10^6->6 zero after 1 **
#define hlw             printf("hlw\n");
#define SN              4*p6
#define NN              111
#define N               p6

ll x[N],y[N],z[N],n;
string s,S;
vector<ll>v;
//map <ll,ll> mp;
long long nCr(int n, int r) {
    if(n<r)return 0;
    if(n==r)return 1;
    if(r==1)return n;
    return nCr(n-1,r)+nCr(n-1,r-1);
}
int main()
{
    //IO;
    //while(1)
    //READ;WRITE;
{
    ll a=0,b=0,c=0,d,e,f,g,i,j,k,l,m,p,q,r,u,w,t,tc,in,mod,loc,diff,val,sz,lo,hi,mid,mn=MAX,mx=0,sum=0,ans=0;
    cin>>n>>m;
    cout<<nCr(n,2)+nCr(m,2)<<endl;
}
    return 0;
}

/*

*/
/// Check for constraint 0 or 1?
/// long long or double? sqrt or division will work fine??


Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var a = int.Parse(spl[1]);
        var b = int.Parse(spl[2]);

        var ary = ToIntArray(input.ReadLine(), n);

        long sum = 0;
        for(int i=1; i<n; i++) {
            var aa = (ary[i]-ary[i-1]) * (long)a;
            if(aa > b) sum += b;
            else sum += aa;
        }

        return  sum;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


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

using namespace std;

#ifdef KACTL
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define sz(x) (int)(x).size()
#endif
#define all(x) begin(x), end(x)

using ll = int64_t;
using ld = long double;
using pii = pair<int32_t, int32_t>;
using vi = vector<int32_t>;

ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}

void check(const vi& a) {
    ll sum = accumulate(all(a), 0LL);
    int g = 0;
    for (int x : a) {
        g = gcd(x, g);
        assert(gcd(sum - x, x) != 1);
        assert(2 <= x and x <= 30000);
    }

    vi b(all(a));
    sort(all(b));
    b.erase(unique(all(b)), end(b));
    assert(a.size() == b.size());
}

void big() {
    // need to add a multiple of 3 number of twos
    // need to add a multiple of 2 number of 3s
    // six counts for both

    vi ans = {2, 3, 5, 25, 55};
    ll v = 2 + 3 + 5 + 25 + 55;
    int twos = 0;
    int threes = 0;
    for (int i = 4; i <= 29996; ++i) {
        if (i % 2 > 0 and i % 3 > 0) continue;

        ans.push_back(i);
        twos += i % 2 == 0;
        threes += i % 3 == 0;
        twos -= i % 6 == 0;
        threes -= i % 6 == 0;
        v += i;
    }

    for (int x : ans) {
        assert(gcd(x, v - x) != 1);
    }

    int os = ans.size();
    sort(all(ans));
    ans.erase(unique(all(ans)), end(ans));
    assert(ans.size() == os);
    assert(os == 20000);

    check(ans);

    for (int x : ans) {
        cout << x << ' ';
    }
    cout << '\n';
}

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

    // let the total sum be S
    // then you have gcd(x_i, S - x_i) != 1 <=> gcd(x_i, S) != 1
    // however you have gcd(x_1, x_2, ...) = 1
    //
    // pick some S which is not coprime with and choose N of them that sum with it
    // x - totient(x) <= n
    // then fix with knapsack dp?

    // 2 5 63
    // gets you 70
    // keep adding multiples of 2?
    
    int n;
    cin >> n;

    if (n == 20000) {
        big();
        return 0;
    }

    vi ans = {2, 3, 25};
    n -= 3;

    int b = 0;
    vi legits;
    for (int j = 1; j < 15; ++j) {
        if (j % 2 == 0 or j % 3 == 0) {
            legits.push_back(j);
        }
    }

    b = 0;
    while (b < 30000 and n >= 2) {
        for (int x : legits) {
            if (n < 2) break;
            if (b + x == 2 or b + x == 3 or b + 30 - x == 25) continue;
            if (b + 30 - x >= 30000) continue;

            ans.push_back(b + x);
            ans.push_back(b + 30 - x);

            n -= 2;
        }

        b += 30;
    }

    b = 0;
    while (b + 45 <= 30000 and n >= 2) {
        ans.push_back(b + 15);
        ans.push_back(b + 45);

        n -= 2;
        b += 60;
    }

    b = 30;
    while (b <= 30000 and n > 0) {
        ans.push_back(b);
        --n;
        b += 30;
    }

    check(ans);
    sort(all(ans));
    for (int x : ans) {
        cout << x << ' ';
    }
    cout << '\n';
    assert(n == 0);

    return 0;
}


Measured memory_bytes: 512
/*
Task:
Author: John_05
State: Unknown
Lang: C++
Solution:
*/
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int INF=2e9+10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair

ll read() {
	ll xx=0,ww=1;
	char ch=getchar();
	while(ch>'9'||ch<'0') {
		if(ch=='-') ww=-ww;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') {
		xx=10*xx+ch-48;
		ch=getchar();
	}
	return xx*ww;
}

ll a,b,A,B,ca[100];

ll power(int x){
	ll res=1;
	for(int i=1;i<=x;i++) res*=2;
	return res;
}

void worka(ll x) {
	if(x==1) {
		ca[0]++;
		return ;
	}
	ll y=x;
	int cnt=0;
	while(y) {
		if(y&1) ca[cnt]++;
		cnt++;
		y/=2LL;
	}
	worka(x/2LL);
}


void workb(ll x) {
	if(x==1) {
		ca[0]--;
		return ;
	}
	ll y=x;
	int cnt=0;
	while(y) {
		if(y&1) ca[cnt]--;
		cnt++;
		y/=2LL;
	}
	workb(x/2LL);
}

int main() {
	a=read();
	b=read();
	A=max(a,b)+1;
	B=min(a,b);
	for(int i=0; i<65; i++) {
		ll x=power(i);
		if(x>A) break;
		ll ans=A/(x*2);
		if(A-ans*x*2>x) ca[i]+=A-ans*x*2-x;
		ca[i]+=ans*x;
	}
//	for(int i=0;i<65;i++) printf("%lld ",ca[i]);
//	puts("");
	for(int i=0; i<65; i++) {
		ll x=power(i);
		if(x>B) break;
		ll ans=B/(x*2);
		if(B-ans*x*2>x) ca[i]-=B-ans*x*2-x;
		ca[i]-=ans*x;
	}
	ll tot=0;
//	for(int i=0;i<65;i++) printf("%lld ",ca[i]);
//	puts("");
	for(int i=0; i<65; i++) if(ca[i]%2) tot+=power(i);
	printf("%lld\n",tot);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    int r, g, b, n;
    cin>>r>>g>>b>>n;
    int ans = 0;
    rep(i, 3001){
        rep(j, 3001){
            int k = n-(r*i+g*j);
            if(k%b == 0 && k>=0) ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


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

    int n2 = N%100;
    int n1 =N%10;
    n2 = n2/10;
    int n3 = N- 10*n2 -n1;

    n3 = n3/100;

   
    if (n3 ==7 || n2 ==7 || n1==7){

       

        cout << "Yes" << endl;

    }
    else{
        cout << "No" << endl;
    }


    return 0;


}

Measured memory_bytes: 3608
#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>;
 
int main() {
  int n,k;
  cin >> n >>k;
  int d;
  int f;
  set<int> a;
  for(int i=0;i<k;i++){
    cin >> d;
    for(int j = 0;j<d;j++){
      cin >> f;
      a.insert(f);
    }
  }
  
  cout << n-a.size() << endl;
    
    

  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007
using namespace std;

int main(void){
	int N,K;
	string S;

	cin>>N>>K>>S;
	if(S[K-1]=='A')S[K-1]='a';
	if(S[K-1]=='B')S[K-1]='b';
	if(S[K-1]=='C')S[K-1]='c';
	cout<<S<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 110000000000
#define MAX 100000
typedef long long ll;
typedef pair<ll,int> P;

int main(){
  int r;
  cin>>r;
  cout<<r*r*3<<endl;
}


Measured memory_bytes: 256
s = input()
n = len(s)

ans = 0


for bit in range(1 << (n-1)):
    f = s[0]
    for i in range(n - 1):
        if bit & (1 << i):
            f += "+"
        else:
            f += "-"
        f += s[i+1]
    if  eval(f) == 7:
        print(f+"=7")
        break


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

int main(){
  long double a,b,h,m,ans=0,tanshin,choshin,kakudo;cin>>a>>b>>h>>m;
  tanshin=h*360.0/12.0+m*30.0/60.0;
  choshin=m*360.0/60.0;

  kakudo=abs(tanshin-choshin);
  if(kakudo>180.0) kakudo=360.0-kakudo;
  ans=a*a+b*b-2*a*b*cos(kakudo*3.14159265359/180.0);
  cout<<fixed<<setprecision(12)<<sqrt(ans);
}

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

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int x;
		int n=sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		x=n*a;
		if(x>b) {
			x=b;
		}
		System.out.println(x);

	}

}


Measured memory_bytes: 22868
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

int frq[1000007];
int main(){
	Lancer();
	ll n,sum=0;
	cin >> n;
	vector<int> vec(n);
	for (int i = 0; i < n; i++)
		cin >> vec[i];
	sort(vec.begin(), vec.end());
	for (int i = 0; i < n - 1; i++)
		sum += vec[i];
	if (vec[n - 1] < sum)cout << "Yes";
	else cout << "No";
	cout << endl;
	return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	string s[3];
	rep(i, 3) cin >> s[i];
	rep(i, 3) cout << (char)toupper(s[i][0]);
}

Measured memory_bytes: 256
//LongestPath
import java.io.*;
import java.util.*;
public class Main{
static int n,m;
static int[] b=new int[10005];
static ArrayList<Integer> adj[];
static int[] dist;
static int[] indegree;
public static void dfs(int node,boolean[] vis){	
	vis[node]=true;	
	for(Integer children:adj[node]){
		dist[children]=Math.max(dist[children],dist[node]+1);
		indegree[children]--;
		if(!vis[children]&&indegree[children]==0){
			dfs(children,vis);
		}
	}
	
}
public static int solve(){
	int ans=0;	
	boolean[] vis=new boolean[n+1];
	for(int i=1;i<=n;i++){	
		if(!vis[i]&&indegree[i]==0){
			dfs(i,vis);				
		}						
	}	
	for(int i=1;i<=n;i++){ans=Math.max(ans,dist[i]);}
	return ans;
}
public static void main(String[] args) throws IOException{
		// BufferedReader br = new BufferedReader(new
  //      FileReader("sampleinp.txt"));
    	BufferedReader br = new BufferedReader( 
                             new InputStreamReader(System.in)); 
		String str[]=br.readLine().split(" ");
	 	StringBuilder ans=new StringBuilder();
	 	n=Integer.parseInt(str[0]);
	 	m=Integer.parseInt(str[1]);
	 	adj=new ArrayList[n+1];
	 	dist=new int[n+1];
	 	indegree=new int[n+1];
	 	for(int i=1;i<=n;i++){adj[i]=new ArrayList<>();}
	 	for(int i=1;i<=m;i++){
	 		str=br.readLine().split(" ");
	 		int u=Integer.parseInt(str[0]);
	 		int v=Integer.parseInt(str[1]);
	 		adj[u].add(v);
	 		indegree[v]++;
	 	}
	 		
	 	ans.append(solve());
		// PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter("sampleout.txt")));
  //       pw.write(ans.toString());
  //       pw.flush();
	 	System.out.println(ans.toString());

    }
}

Measured memory_bytes: 71172
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	int H,W,D,Q;
	cin >> H >> W >> D;
	vector<vi> B(H*W,vi(2));
	for(int i=1; i<=H; i++){
		for(int j=1; j<=W; j++){
			int A;
			cin >> A;
			A--;
			B[A][0]=i;
			B[A][1]=j;
		}
	}
	cin >> Q;
	vi L(Q),R(Q);
	for(int i=0; i<Q; i++){
		cin >> L[i] >> R[i];
		L[i]--;
		R[i]--;
	}

	vi dp(H*W,0);
	for(int i=0; i<H*W-D; i++){
		dp[i+D]=dp[i]+abs(B[i+D][0]-B[i][0])+abs(B[i+D][1]-B[i][1]);
	}

	for(int i=0; i<Q; i++){
		int ans=0;
		if(R[i]>0){
			ans=dp[R[i]]-dp[L[i]];
		}else{
			ans=dp[R[i]];
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 7168
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <set>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<int, PII> PPII;
typedef pair<int, PPII> PPPII;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int main(void){
	int N, M;
	string flag[2];
	string base[1010];
	ll res = 0;

	cin >> M >> N;
	REP(i, M){
		cin >> base[i];
	}
	REP(i, 2){
		cin >> flag[i];
	}

	REP(i, M-1){
		REP(j, N-1){
			bool ok = true;
			REP(a, 2){
				REP(b, 2){
					if(flag[a][b] != base[i+a][j+b]){
						ok = false;
					}
				}
			}
			if(ok)
				res++;
		}
	}
	int mp = 0;
	REP(i, M){
		REP(j, N){
			char ch[] = {'J', 'O', 'I'};
			char org = base[i][j];
			REP(k, 3){
				base[i][j] = ch[k];
				
				int cnt = 0;
				FOR(a, max(i-1, 0), i+1){
					FOR(b, max(j-1, 0), j+1){
						bool ok = true;
						REP(c, 2){
							REP(d, 2){
								if(flag[c][d] != base[a+c][b+d]){
									ok =false;
								}
							}
						}
						if(ok) cnt++;
					}
				}
				if(mp < cnt && ch[k] != org)
					mp = cnt;
				base[i][j] = org;
			}
		}
	}
	cout << res + mp << endl;
}

Measured memory_bytes: 4004
class Line
	require 'matrix'
	#ax+by = c   (a > 0 or (a == 0 && b > 0))
	def self.through_two_points(x1, y1, x2, y2)
		a = y1 - y2
		b = x2 - x1
		c = a * x1 + b * y1
		new(a, b, c, x1, y1, x2, y2)
	end

	def cross_point(l)
		m = Matrix[
			[@a, @b],
			[l.a, l.b],
		];
		v = Vector[@c, l.c]
		return (m.inv * v).to_a
	end

	private_class_method :new

	def initialize(*args)
		@a, @b, @c, @x1, @y1, @x2, @y2 = args	
	end

	def *(x)
		if x.class == Array
			line_point(x)
		elsif x.class == Line
			cross_point(x)
		end
	end

	def line_point(point)
		x3, y3 = point
		v0 = Vector[@x1, @y1]
		v1 = Vector[@x2 - @x1, @y2 - @y1]
		v2 = Vector[x3 - @x1, y3 - @y1]
		v3 = 2 * v1 * v1.inner_product(v2) / v1.r ** 2 - v2 + v0
		v3.to_a
	end

	attr_reader :a, :b, :c, :x1, :y1, :x2, :y2
end

class Array
	def *(x)
		if x.class == Array
			point_point(x)
		elsif x.class == Line
			x * self
		end
	end

	def point_point(a)
		x1, y1 = self
		x2, y2 = a
		Line.through_two_points(x1, y1, x2, y2)
	end
end

loop do
	exp = gets.chomp
	break if exp == ?#
	exp.gsub!(/\((-?\d+,-?\d+)\)/, '[\1]')
	exp.gsub!(?@, ?*)
	puts eval(exp).map(&:to_f).join " "
end

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

using namespace std;

int main() {

	while (1) {
		int N, Q; cin >> N >> Q; if (N==0 && Q==0) break;
		
		vector<int> date(100, 0);
		
		for (int i=0; i<N; i++) {
			int M; cin >> M;
			for (int j=0; j<M; j++) {
				int d; cin>>d;
				date[d]++;
			}
		}
		
		int best_d = 0, max_m = 0;
		for (int i=0; i<100; i++) {
			if (max_m < date[i]) {
				max_m = date[i];
				best_d = i;
			}
		}
		
		if (max_m >= Q) cout << best_d << endl;
		else cout << 0 << endl;
	}	
	
	return 0;
}

Measured memory_bytes: 1196
#!/usr/bin/env python

from collections import deque
import itertools as ite
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N = input()
ls = []
for loop in range(N):
	x, y = map(int, raw_input().split())
	ls += [(x, y)]
ans = 0
for i in range(N):
	for j in range(i + 1, N):
		dx = ls[i][0] - ls[j][0]
		dy = ls[i][1] - ls[j][1]
		cnt = 0
		for k in range(N):
			for l in range(N):
				if ls[k][0] - ls[l][0] == dx and ls[k][1] - ls[l][1] == dy:
					cnt += 1
		ans = max(cnt, ans)
print N - ans

Measured memory_bytes: 33256
/**
 * 
 * AOJ No. 0014 Integral
 * 
 * @author 		yuichirw <y.iky917@gmail.com>
 * @accepted	2010-11-09
 * @see			http://rose.u-aizu.ac.jp/onlinejudge/ProblemSet/description.jsp?id=0014&lang=jp
 */

import java.util.*;
public class Main {
	
	static Scanner sc = new Scanner(System.in);
	static int d;
	
	static boolean read() {
		if(!sc.hasNextInt()) return false;
		d = sc.nextInt();
		return true;
	}
	
	static int solve() {
		int ans,n;
		/*
		ans = 0; n = 600 / d;
		for(int x = d; x < 600; x += d) {
			ans += d * ((x * x));
		}
		return ans;
		*/
		ans = 0;
		for(int i = 1; i * d < 600; i++) {
			int x = i * d;
			int y = x * x;
			ans += y * d;
		}
		return ans;
	}
	
	
	public static void main(String[] args) {
		while(read()) {
			System.out.println(solve());
		}
	}

}

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

const int W = 100, H = 100;

int board[W][H];

int main(){
	int w, h, x, y, n, a;
	while(cin >> n, n){
		cin >> w >> h;
		a = 0;
		for(int i = 0;i < W;++i){
			for(int j = 0;j < H;++j){
				board[i][j] = 0;
			}
		}
		for(int i = 0;i < n;++i){
			cin >> x >> y;
			++board[x - 1][y - 1];
		}
		cin >> x >> y;
		for(int i = 0;i <= w - x;++i){
			for(int j = 0;j <= h - y;++j){
				int t = 0;
				for(int k = 0;k < x;++k){
					for(int l = 0;l < y;++l){
						t += board[i + k][j + l];
					}
				}
				a = max(a, t);
			}
		}
		cout << a << endl;
	}
	return 0;
}

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

int N,A[100000];

int main(){
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    sort(A,A+N);
    int ans=N;
    for(int i=0;i<N-1;i++){
        if(A[i]==A[i+1]){
            ans=ans-2;
            A[i]=0;
            A[i+1]=0;
        }
    }
    cout<<ans<<endl;
}

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

using namespace std;
const int maxn = 1e5+15;
int head[maxn],cnt,n,u,v,w,color[maxn];
struct edge{
	int to,nxt,w;
}e[maxn<<1];
inline void add(int _u,int _v,int _w){
	e[++cnt].to = _v;
	e[cnt].w = _w;
	e[cnt].nxt = head[_u];
	head[_u] = cnt;
}
void dfs(int u,int fa){
	for(int i = head[u]; i ; i= e[i].nxt){
		int v = e[i].to;
		if(v == fa) continue;
		if(e[i].w & 1) color[v] = color[u] ^1;
		else color[v] = color[u];
		dfs(v,u); 
	}
}
int main(){
	cin >> n;
	int m = n-1;
	while(m--){
		cin >> u >> v >> w;
		add(u,v,w);
		add(v,u,w);
	}
	color[1] = 0;
	dfs(1,0);
	for(int i = 1;i <= n; ++i) cout << color[i] << '\n';
	return 0;
}

Measured memory_bytes: 5632
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

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



int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, k;
	cin >> n >> k;
	n %= k;
	if(n)puts("1");
	else puts("0");
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
//F6編譯，右上三角形執行，ctrl+c強制停止執行  F5開啟exe
#define ll long long
#define maxn 8005
#define mod 1000000000
using namespace std;

typedef pair<int, int> P;

int n, m, x;
int money[12];
int a[12][12];
int tot[12];

int main()
{
    cin >> n >> m >> x;
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &money[i]);
        for (int j = 0; j < m; j++)
            scanf("%d", &a[i][j]);
    }

    int ans = INT_MAX;
    for (int S = 0; S < (1 << n); S++)
    {
        bitset<20> b = S;
        memset(tot, 0, sizeof(tot));
        int cnt = 0;
        for (int j = 0; j < n; j++)
        {
            if (b[j])
            {
                for (int k = 0; k < m; k++)
                    tot[k] += a[j][k];
                cnt += money[j];
            }
        }
        bool ok = 1;
        for (int j = 0; j < m; j++)
            if (tot[j] < x)
                ok = 0;
        if (ok)
            ans = min(ans, cnt);
    }
    if (ans == INT_MAX)
        printf("-1\n");
    else
        printf("%d\n", ans);

    return 0;
}

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

typedef struct P {
	int p, d;
	bool operator<(const P &r) {
		return d < r.d;
	}
} P;
int n;;

int main(){
	int p, d1, d2;
	while (cin >> n && n != 0) {
		P m = { 0,-1 };
		P t;
		for (int i = 0; i < n; i++) {
			cin >> p >> d1 >> d2;
			t = { p,d1 + d2 };
			if (m < t) {
				m = t;
			}
		}
		cout << m.p << " " << m.d << endl;
	}

	return 0;
}

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=10005,M=998244353;
char s1[N],s2[N];
int dp[N][N/2],A,B;
signed main(){
	scanf("%s%s",s1+1,s2+1);
	int n=strlen(s1+1);
	for (int i=1;i<=n;i++)
		if (s1[i]=='1'&&s2[i]=='1')A++;
		else if (s1[i]=='1'&&s2[i]=='0')B++;
	dp[0][0]=1;
	for (int i=0;i<=A;i++)
		for (int j=0;j<=B;j++){
			if (i==0&&j==0)continue;
			if (i)(dp[i][j]+=dp[i-1][j]*i*j)%=M;
			if (j)(dp[i][j]+=dp[i][j-1]*j*j)%=M;
		}
	int ans=0,s=1;
	for (int i=0;i<=A;i++)(ans+=dp[A-i][B]*s)%=M,(s*=(A-i)*(A+B-i)%M)%=M;
	printf("%lld\n",ans);
}


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

long long int MOD = 1000000007;
long long int dp[100001];

int main() {
  int N;
  cin >> N;
  
  int color[3] = {0, 0, 0};
  int A;
  dp[0] = 1;
  for (int i = 0; i < N; i++) {
    cin >> A;
    int count = 0;
    for (int j = 0; j < 3; j++)
      if (color[j] == A) {
        count++;
        if (count == 1)
          color[j]++;
      }
    if (count == 1)
      dp[i+1] = dp[i];
    else if (count == 2)
      dp[i+1] = (dp[i] * 2) % MOD;
    else if (count == 3)
      dp[i+1] = (dp[i] * 3) % MOD;
  }
  cout << dp[N] << endl;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int a = sc.nextInt();
        int p = sc.nextInt();
        System.out.println((a*3+p)/2);
    }
}


class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 21076
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
using namespace std;
long long MOD = 1e9 + 7;

string a, b;
int N;

int main() {
	cin >> a >> b;
	N = stoi(a + b);
	int n = 1;
	for (; n * n <= N; n++) {
	}
	if ((n-1) * (n-1) == N)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256