akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;


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


//vector<pair<int,int>> pairs;  pairs[i] = make_pair(value, value);
//sort(a.begin(),a+index_number);

//cin>>  cout<<'\n'

/*
vector<int> vec(100,-1);全ての値に-1をセット
vector<std::vector<int>> vec{{ 1, 2, 3 },{ 4, 5, 6 }};
vec.size() vec[i].size()
vec.emplace_back(20);追加
*/

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n,m;
    int ans = 0;

    cin >> n >> m;

    //string s; cin >> s; 

    if(m == 1)
        ans = 0;
    else{
        ans = abs(1-(n-(m-1)) );
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 
int dp[2][505][512]={};

int main(void){
    int n,x;
    cin>>n>>x;
    for(int i=0;i<=n;i++)dp[0][i][0]=1;
    for(int i=1;i<=x;i++){
        for(int j=0;j<=n;j++){
            for(int k=0;k<512;k++){
                dp[i%2][j][k]=(dp[(i+1)%2][j][k])%M;
                if(j!=0)dp[i%2][j][k]=(dp[i%2][j][k]+dp[(i+1)%2][j-1][k^i])%M;
            }
        }
        for(int j=2;j<=n;j++){
            for(int k=0;k<512;k++){
                dp[i%2][j][k]=(dp[i%2][j][k]+dp[i%2][j-2][k])%M;
            }
        }
    }
    cout<<dp[x%2][n][x]%M<<endl;
    return 0;
}


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

typedef long long i64;
#define put(n) cout<<(n)<<"\n"
#define FOR(i,num,N) for(int(i)=(num);(i)<(N);(i)++)
#define RFOR(i,num,N) for(int (i)=(num);(i)>(N);(i)--)
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()

int main(){
    vector<int> A(3);
    cin>>A[0]>>A[1]>>A[2];
    sort(all(A));
    int ans;
    ans = (A[2] - A[1]) + (A[1] - A[0]);
    put(ans);
}

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

int main() {
    int n;
    cin >> n;
    ll s=1000;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int f=1,k=-1;
    ll l;

    for(int i = 1; i < n; i++) {
        if(a[i-1]<a[i]){
                k=i;
                l=a[i-1];
                break;
        }
    }

    if(k==-1){
        cout << 1000 << endl;
        return 0;
    }

    for(int i = k+1; i < n; i++) {
        if(f==1){
            if(a[i]<a[i-1]){
                ll p=s;
                p /= l;
                s=s-p*l+p*a[i-1];
                f=-1;
                l=a[i];
            }
        }
        else{
            if(a[i]<=a[i-1]){
                l=a[i];
            }
            else{
                f=1;
            }
        }
    }

    if(f==1){
        ll p=s;
        p /= l;
        s=s-p*l+p*a[n-1];
    }

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3612
n, x, y = map(int, input().split())
ans = [0]*(n-1)

for i in range(1, n):
  for j in range(i+1, n+1):
    dis = min(j - i, abs(i - x) + abs(j - y) + 1)
    ans[dis-1] += 1
    
for i in range(n-1):
  print(ans[i])

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (ll i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr << #x << ": " << (x) << endl
#define int long long
using namespace std;
using II = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
template <class T = int> inline T in() { T x; cin >> x; return x; }
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, const vector<T>& d) { int n = d.size(); REP (i, n) s << d[i] << " "; return s; }
template <class T> ostream& operator<<(ostream &s, const vector<vector<T>>& dd) { for (vector<T> d: dd) s << d << endl; return s; }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
const int MOD = 1e9 + 7;
class Grid {
  // queryを計算しやすいようにaccの範囲外の値も便宜的に定義
  int point(int i, int j) {
    if (i + j < 0 || H + W - 1 <= i + j) return 0;
    if (i < 0 || j >= W) return 0;
    if (j < 0 && i + j < H) return acc[i + j][0];
    if (i >= H && i + j >= H) return acc[H - 1][i + j - (H - 1)];
    return acc[i][j];
  }
public:
  VVI& t; int H, W;
  VVI acc;
  Grid(VVI& tbl) : t(tbl), H(tbl.size()), W(tbl[0].size()) {
    set_acc();
  }
  VI& operator[](int i) {
    return t[i];
  }
  bool exist(int i, int j) {
    return 0 <= i && i < H && 0 <= j && j < W && t[i][j];
  }
  // 左下方向への累積和
  void set_acc() {
    acc = VVI(H, VI(W));
    REP (i, H) {
      REP (j, W) {
        int before = (i == 0 || j == W - 1) ? 0 : acc[i - 1][j + 1];
        acc[i][j] = before + t[i][j];
      }
    }
  }
  // 時計回りに90度回転
  void rotate() {
    VVI t2(W, VI(H));
    REP (i, H) {
      REP (j, W) {
        t2[j][H - i - 1] = t[i][j];
      }
    }
    t = t2;
    swap(H, W);
    set_acc();
  }
  // [i0, i1)の斜めのsum
  int query(int i0, int j0, int i1, int j1) {
    assert(i0 + j0 == i1 + j1);
    assert(i1 > i0);
    return point(i1 - 1, j1 + 1) - point(i0 - 1, j0 + 1);
  }
};

signed main() {
  int H, W; cin >> H >> W;
  VVI t(H, VI(W));
  REP (i, H) {
    REP (j, W) {
      t[i][j] = in<char>() == '#';
    }
  }
  Grid g(t);
  int ans = 0;
  int times = 4;
  while (times--) {
    REP (i, g.H) {
      REP (j, g.W) {
        if (!g.exist(i, j)) continue;
        REPI (k, 1, g.H + g.W - 1) {
          if (!g.exist(i + k, j - k)) continue;
          ans += g.query(i + k, j + k, i + 2 * k, j);
        }
      }
    }
    g.rotate();
  }
  cout << ans << endl;
}


Measured memory_bytes: 3140
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
vector<int> dx = {-1, -1, -1, 0, 0, 1, 1, 1};
vector<int> dy = {-1, 0, 1, -1, 1, -1, 0, 1};

const ll INF = 1e18;

int main () {

    int n; cin >> n;
    vector<ll> x(n), y(n), p(n);
    rep(i, n) cin >> x[i] >> y[i] >> p[i];
    
    vector<vector<ll>> ver(1<<n, vector<ll> (n)), hor(1<<n, vector<ll> (n));
    rep(i, 1<<n) {
        vector<int> c;//路線通す都市
        rep(j, n) {
            if ((i >> j) & 1) c.push_back(j);
        }
        rep(j, n) {
            {
                ll cost = abs(x[j]) * p[j];
                for (int q : c) {
                    cost = min(cost, abs((x[j] - x[q]) * p[j]));
                }
                ver[i][j] = cost;
            }
            {
                ll cost = abs(y[j]) * p[j];
                for (int q : c) {
                    cost = min(cost, abs((y[j] - y[q]) * p[j]));
                }
                hor[i][j] = cost;
            }
            
        }
    }

    vector<ll> ans(n+1, INF);
    for (int i = 0; i < (1 << n); i++) {
        int k = _popcnt32(i);//路線通す数
        for (int j = i; j >= 0; j--) {
            j &= i;//jが立ってるところに横を通す

            ll cost = 0;
            rep(l, n) {
                if (!((i >> l) & 1)){//lに路線がなかったら
                    cost += min(ver[j][l], hor[i-j][l]);
                }
            }
            ans[k] = min(ans[k], cost);
        }
        
    }
    for (int k = 0; k <= n; k++) cout << ans[k] << endl;
    return 0;
}

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

const int P = 1000003;
int fac[P], ifac[P];

int power(int a, int x) {
	int ans = 1;
	for (; x; x >>= 1, a = 1LL * a * a % P)
		if (x & 1) ans = 1LL * ans * a % P;
	return ans;
}

int main() {
	for (int i = fac[0] = 1; i < P; ++i) fac[i] = 1LL * fac[i - 1] * i % P;
	ifac[P - 1] = power(fac[P - 1], P - 2);
	for (int i = P - 1; i; --i) ifac[i - 1] = 1LL * ifac[i] * i % P;
	int Q, x, d, n;
	scanf("%d", &Q);
	while (Q--) {
		scanf("%d%d%d", &x, &d, &n);
		if (d == 0)
			printf("%d\n", power(x, n));
		else {
			int ans = power(d, n);
			x = 1LL * x * power(d, P - 2) % P;
			if (x == 0 || P - x < n)
				puts("0");
			else {
				ans = 1LL * ans * fac[x + n - 1] % P * ifac[x - 1] % P;
				printf("%d\n", ans);
			}
		}
	}
	return 0;
}


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

int main(){
  int nu=0;
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]!=s[s.size()-1-i]){
      nu++;
    }
  }
  for(int j=0;j<s.size()/2;j++){
    if(s[j]!=s[s.size()/2-1-j]){
      nu++;
    }
  }
  if(nu==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
  


Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(v) ((ll)v.size())
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define F first
#define S second
#define pii pair<ll,ll> 
const ll mod = 1000000007;
const ll mod1= 1000000009;
const ll base= 2323233;
const ll base1=3424424;
#define MAXN 2000002
int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);
   ll n,k;
   cin>>n>>k;
   string s;
   cin>>s;
   ll ans=0;
   ll len=1;
   ll kt=0;
   for(ll i=1;i<s.size();i++){
    if(s[i]!=s[i-1]) {
      ans+=len-1;
      len=0;
      kt++;
     }
     len++;
   }
   ans+=len-1;
   cout<<min(n-1,ans+2*k);

 }


Measured memory_bytes: 512
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#define Rint register int
#define mem(a,b) memset(a,(b),sizeof(a))
#define Temp template<typename T>
using namespace std;
typedef long long LL;
Temp inline void read(T &x){
    x=0;T w=1,ch=getchar();
    while(!isdigit(ch)&&ch!='-')ch=getchar();
    if(ch=='-')w=-1,ch=getchar();
    while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^'0'),ch=getchar();
    x=x*w;
}

int main(){
	for(Rint i=1;i<=3;i++){
		char ch=getchar();
		cout<<ch;
	}
	getchar();
	putchar('8');
	for(Rint i=1;i<=6;i++){
		char ch=getchar();
		cout<<ch;
	}
	cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define END return 0
typedef int64_t ll;
const int mod7 = 1e9 + 7;
const int mod9 = 1e9 + 9;
const int inf = 1 << 30;
const ll INF = 1LL << 60;
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a % b) : abs(a);}
template<typename T> T lcm(T a, T b) {return a / gcd(a, b) * b;}
template<typename T> bool chmax(T &a, T b) {if (a < b) {a = b; return true;} return false;}
template<typename T> bool chmin(T &a, T b) {if (a > b) {a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) {fill((T*)array, (T*)(array+N), val);}

int main() {
    int n;
    cin >> n;
    rep(i, n) {
        int a;
        cin >> a;
        if(a % 2 == 0)
            if(a % 3 != 0 && a % 5 != 0) {cout << "DENIED" << endl; END;}
    }
    cout << "APPROVED" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {
    int H, W;
    for (;;) {
        cin >> H >> W;
        if (H == 0 && W == 0) {
            break;
        }
        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < W; ++j) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;


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

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n, 0);
    FOR(i, 0, n) {
        cin >> a[i];
    }
    
    vector<ll> J(n);
    FOR(i, 0, n) {
        J[i] = i + 1  - a[i];
    }
    sort(J.begin(),J.end());
    
    map<ll, ll> mat;
    FOR(i, 0, n) {
        //cout << J[i] << ' ';
        mat[J[i]] = 0;
    }
     for(ll i : J){
        mat[i] += 1;
        //cout << i << "->" << "+1" << endl;
    }

    ll ans = 0;

    FOR(i, 0, n) {
        ans += mat[a[i] + i + 1];
    }
    cout << ans << endl;
}


Measured memory_bytes: 28888
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> V(N),C(N);
  int ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> V[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> C[i];
  }
  for (int i = 0; i < N; i++) {
    if (V[i] > C[i]) {
      ans += V[i] - C[i];
    }
  }
  cout << ans;
}

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

int main(){
    string w;
    cin >> w;
    vector<char> alpha;
    for(char c = 'a'; c <= 'z'; c++){
        alpha.push_back(c);
    }
    int t = alpha.size();
    vector<int> num(t, 0);

    for(char c : w){
        for(int i = 0; i < t; i++){
            if(c == alpha[i]){
                num[i] += 1;
                break;
            }
        }
    }

    bool f = true;
    for(int x : num){
        if(x%2 != 0){
            f = false;
            break;
        }
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3608
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   

int main(){
    std::ios::sync_with_stdio(false);
    string s;
    cin>>s;
    if(s[0]!='A'){
    	cout<<"WA"<<endl;
    	return 0;
    }
    int i;
    int cnt=0,val;
    f(i,2,s.length()-1){
    	if(s[i]=='C'){
    		val=i;
    		cnt++;
    	}
    	
    }
    if(cnt!=1){
    	cout<<"WA"<<endl;
    	return 0;
    }
    f(i,1,s.length()){
    	if(i!=val && s[i]<='Z'){
    		cout<<"WA"<<endl;
    		return 0;
    	}
    }
    cout<<"AC"<<endl;
    return 0;
    return 0;     
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split("");

		int a[] = new int[str.length + 1];

		for (int i = 0; i < str.length; i++) {
			if (str[i].equals("<")) {
				a[i + 1] = Math.max(a[i] + 1, a[i + 1]);
			}
		}
		for (int i = str.length - 1; i >= 0; i--) {
			if (str[i].equals(">")) {
				a[i] = Math.max(a[i], a[i + 1] + 1);
			}
		}

		long sum = 0;
		for (int i : a) {
			sum += i;
		}

		System.out.println(sum);
	}

	static long getSum(int s, int e) {
		long sum = 0;
		for (int i = s; i <= e; i++) {
			sum += i;
		}
		return sum;
	}
}

Measured memory_bytes: 80752
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<string>
#include<numeric>
#include<complex>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int h, w;
    cin >> h >> w;
    int cnt[26] = {0};
    rep(i, h) rep(j, w) {
        char tmp_c;
        cin >> tmp_c;
        ++cnt[tmp_c-'a'];
    }
    if ( h == 1 && w == 1 ) {
        cout << "Yes" << endl;
        return 0;
    }
    vector<int> reqs;
    rep(i, (h+1)/2) rep(j, (w+1)/2) {
        int i_rev = h - 1 - i;
        int j_rev = w - 1 - j;
        int req = ( i == i_rev ? 1 : 2 ) * ( j == j_rev ? 1 : 2 );
        reqs.push_back(req);
    }
    sort(reqs.begin(), reqs.end());
    reverse(reqs.begin(), reqs.end());
    for ( auto tmp_req : reqs ) {
        bool flg = false;
        for ( int j = 0; j < 26; ++j ) {
            if ( tmp_req <= cnt[j] ) {
                cnt[j] -= tmp_req;
                flg = true;
                break;
            }
        }
        if ( !flg ) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(x+r<=W && y+r<=H && x-r>=0 && y-r>=0) printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);
double PI = 3.14159265358979;
int n;

signed main(){
    int x;
    cin >> x;
    int n = 100;
    int cnt = 0;
    while(n < x){
        cnt++;
        n *= 1.01;
    }
    print(cnt);

    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}

//key以上の初めてのitr
int nibul(auto a,auto b){return lower_bound(All(a),b) - a.begin();}
//key以下の最後のitr
int nibuu(auto a,auto b){return upper_bound(All(a),b) - a.begin()-1;}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main(){
  int n,a;
  cin >> n;
  a = (n/15)*200;
  
  printf("%d\n",800*n-a);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include <string.h>
using namespace std;
int main(){
	string search,hoge,temp;
	int N,ans=0;
	cin>>search>>N;
	for(int i=0;i<N;i++){
		cin>>hoge;
		temp=hoge+hoge;
		if(temp.find(search)!=string::npos)ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1208
#include <iostream>
using namespace std;
int main(int argc, const char * argv[])
{
    int d,n,ans=1;
    cin>>d>>n;
    for(int i=0;i<d;i++)
        ans*=100;
    if(n==100)
        ans*=(n+1);
    else
        ans*=n;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
require 'date'
a,b = gets.split(" ").map(&:to_i)

d = Date.new(2018, a ,b)
e = Date.new(2018, 5 ,6)

count = 0
(1..12).each do |n|
    date = Date.new(2018,n,n)
    if d >= date
        count = count + 1
    end
end
puts count

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

int main()
{
    int n;
    cin>>n;
    vector<int> v;
    set <int> s;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        v.push_back(a);
        s.insert(a);
    }
    if(v.size()==s.size()) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 10356
#include<bits/stdc++.h>
using namespace std;
using ll=int64_t;
ll pw(ll x,ll y){
  ll z;
  if(y==0) return 1;
  else{
    z=pw(x,y/2)*pw(x,y/2);
    if(y%2==1) z*=x;
    return z;
  }
}
int main() {
  ll a,b,x,y,i,k,ans=0;
  cin>>a>>b;
  for(i=0;i<50;i++){
    k=pw(2,i);
    y=b/(2*k)*k;
    if(b%(2*k)>=k) y+=b%(2*k)-k+1;
    x=(a-1)/(2*k)*k;
    if((a-1)%(2*k)>=k) x+=(a-1)%(2*k)-k+1;
    if(y==0) break;
    else if((y-x)%2==1) ans+=k;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << "No"; return;}

void solve() {
    int n, ans = 0; cin >> n;
    vector <int> a(n - 1);
    loop(i, n - 1) {
        cin >> a[i];
        if (!i)
            ans += a[i];
        else
            ans += min(a[i], a[i - 1]);
        if (i == n - 2)
            ans += a[i];
    }
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int x,a,b,c;
    cin>>x;
    a=x/100;
    b=x/10%10;
    c=x%10;
    if(a==7||b==7||c==7)
    	cout<<"Yes";
    else
    	cout<<"No";
    return 0;
}

Measured memory_bytes: 3636
/* Akshat Sharma @akshat98 */
#include <iostream>
#include <bits/stdc++.h>
#define IOS  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define mp   make_pair
#define pb   push_back
#define F    first
#define S    second
#define ll   long long
#define MOD  1000000007
#define MAX  1000000001
#define vi   vector<int>
#define vl   vector<ll>
#define vpi  vector<pair<int,int> >
#define vpl  vector<pair<ll,ll> >
#define rep(i,a,b) for(i=a;i<b;i++)
#define reqp(i,a,b) for(i=a;i<=b;i++)
#define ren for(i=0;i<n;i++)
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef pair<int,int>pii;
typedef pair<ll,ll>pll;


int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input_file.txt", "r", stdin);
	//freopen("output_file.txt", "w", stdout);
	#endif
	int i,j,k,l,n,test_case,m,r;
	test_case=1;
	//cin>>test_case;
	while(test_case--){
		string str;
		cin>>str;
		for(auto it:str){
			if(it=='7'){
				cout<<"Yes\n";
				return 0;
			}
		}
		cout<<"No\n";


	}
	
	return 0;
}

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

const int n_MAX = 31;
const int mod = 10 * 365;

int main() {
  int count;
  int data[n_MAX];
  long long dp[n_MAX];

  for (int i = 0; i < n_MAX; ++i) {
    cin >> data[i];
    if (data[i] == 0) {
      count = i;
      break;
    }
  }

  for (int i = 0; i < n_MAX; ++i) {
    dp[0] = 1;
    dp[1] = 1;
    dp[2] = 2;
  }

  for (int i = 3; i < n_MAX; ++i) {
    dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
  }

  for (int i = 0; i < count; ++i) {
    int ans = 0;
    if (dp[data[i]] % mod == 0) {
      ans = dp[data[i]] / mod;
    } else {
      ans = (dp[data[i]] / mod) + 1;
    }
    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 3084
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

//greatest common divisor
unsigned long  gcd(unsigned long x, unsigned long y){
    if (y == 0){ 
        return x;
    }else if (x > y){
        return gcd(y, x % y);
    }else{
        return gcd(x, y % x);
    }
}



long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}
int dp[41][401][401];
int a[41];
int b[41];
int c[41];



int main(void){
    int n, ma, mb;
    int min = 1000000000;
    scanf("%d %d %d", &n, &ma, &mb);
    for (int i = 1; i <= n; i++){
        scanf("%d %d %d", &a[i], &b[i], &c[i]);
    }
    for (int i = 0; i < 41; i++){
        for (int j = 0; j < 401; j++){
            for (int k = 0; k < 401; k++){
                dp[i][j][k] = min;
            }
        }
    }
    dp[0][0][0] = 0;
    for (int i = 1; i <= n; i++){
        for (int j = 0; j < 401; j++){
            for (int k = 0; k < 401; k++){
                if (dp[i-1][j][k] != min){
                    if (dp[i][j+a[i]][k+b[i]] > dp[i-1][j][k] + c[i]){
                        dp[i][j+a[i]][k+b[i]] = dp[i-1][j][k] + c[i];
                    }
                    if (dp[i][j][k] > dp[i-1][j][k]){
                        dp[i][j][k] = dp[i-1][j][k];
                    }
                }
            }
        }
    }

    for (int i = 1; i < 401; i++){
        for (int j = 1; j < 401; j++){
            if (dp[n][i][j] < min && mb*i == ma*j){
                min = dp[n][i][j];
            }
        }
    }
    if (min == 1000000000){
        printf("-1\n");
    }else{
        printf("%d\n", min);  
    }
    



    return 0;

}


Measured memory_bytes: 25856
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;

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

    if(a%2 != b%2){
        cout << "IMPOSSIBLE" << endl;
    }
    else{
        cout << (a+b) / 2 << endl;
    }
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; 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)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  ll ans {a*c};
  maxs(ans, a*d);
  maxs(ans, b*c);
  maxs(ans, b*d);
  cout << ans << '\n';
}


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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

ll gauss(ll x, ll y) {
	if(x % y == 0) return x / y;
	return x / y + 1;
}

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

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

	ll x = 1, y = 1;
	rep(i, 0, N) {
		ll n = max(gauss(x, T[i]), gauss(y, A[i]));
		x = T[i] * n; y = A[i] * n;
	}
	cout << x + y << endl;



}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
char c;
int f=0,sum=0;
while(1){
scanf("%c",&c);
if(f==1&&c=='0')break;
if(c=='\n'){
f=1;
printf("%d\n",sum);
sum=0;
}else{
f=0;
sum+=c-'0';
}
}
return 0;
}

Measured memory_bytes: 536
#include "bits/stdc++.h"

using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    int x = N % 10;
    if(x == 3) cout << "bon" << endl;
    else if(x == 2 || x == 4 || x == 5 || x == 7 || x == 9) cout << "hon" << endl;
    else cout << "pon" << endl;
}


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

signed main(){
  int N,M;
  cin>>N>>M;
  int ans=M;
  if(N<13)ans/=2;
  if(N<=5)ans=0;
  cout<<ans<<endl;
}

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

namespace Atcoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            var r = Read().ToInt();
            var a = (int)(r / 500);
            var b = r - a * 500;
            var c = (int)(b / 5);
            var ans = a * 1000 + c * 5;
            Write(ans);
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static string[] ReadSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        public static void Write(object str)
        {
            Console.WriteLine(str);
            Read();
        }
    }
}


public static class Extentions
{
    public static int ToInt(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static decimal ToDecimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double ToDouble(this object obj)
    {
        return double.Parse(obj.ToString());
    }
}



Measured memory_bytes: 11220
n = int(input())

def make753(s):
    count = 0
    if int(s) >n:
        return 0
    if all(s.count(i) > 0 for i in '753'):
        count += 1
    for i in '753':
        count += make753(s + i)
    return count
        
print(make753('0'))

Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int, ii> iii;
typedef vector<pair<pair<int,int>,int>> viii;
typedef vector<pair<pair<ll,ll>,ll>> viiil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000
#define MOD 1000000007;

void solve() {
    int n, x;
    cin >> n >> x;
    viil c;
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        c.pb({a, b});
    }
    ll dp[n+1][x+1];
    memset(dp, 0, sizeof dp);
    dp[0][x] = 0;
    rep(i, n) {
        rep(j, x+1) {
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            if (j + c[i].first <= x) {
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][j + c[i].first] + c[i].second);
            }
        }
    }
    
    ll mx = 0;
    rep(i, x+1) {
        mx = max(mx, dp[n][i]);
    }
    
    cout << mx << endl;
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        //solve();
    }
}

int main() {
    //querySolve();
    solve();

}


Measured memory_bytes: 82536
#include <iostream>

using namespace std;

int main() {

    int N;
    cin >> N;
    int p[N];

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

    int c = 0;

    for (int i=0; i<N; i++) {
        if (p[i] != (i+1)) {
            c += 1;
        }
    }

    if ((c==0) | (c==2)) {
        cout << "YES";
    } else {
        cout << "NO";
    }


    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
n, *h = map(int, open(0).read().split())
for i in range(1, n):
    if h[-i] < h[-i - 1]:
        h[-1 - i] -= 1
        if h[-i] < h[-i - 1]:
            print("No")
            exit()
print("Yes")


Measured memory_bytes: 20152
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		int X = sc.nextInt();
		int A = sc.nextInt();
		if (X < A)
			System.out.println(0);
		else if (X >= A)
			System.out.println(10);

	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

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


Measured memory_bytes: 23124
fun main(args: Array<String>){
    val a = readLine()!!.toInt()
    val b = readLine()!!.toInt()
    val c = readLine()!!.toInt()
    val d = readLine()!!.toInt()
    println( (if (a < b) a else b ) + (if (c < d) c else d) )
}

Measured memory_bytes: 31548
N, K = map(int, input().split())
h = list(map(int, input().split()))
for j in range(K):
    h.append(0)
INF = float('inf')
dp = [INF] * (N+K)
dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        dp[i+j] = min(dp[i+j], dp[i] + abs(h[i]-h[i+j]))
print(dp[N-1])

Measured memory_bytes: 55008
using System;
class Program
{
	static void Main(string[] args)
	{
		string s = Console.ReadLine();
		if(s=="7 5 5" || s == "5 7 5"|| s == "5 5 7")
		{
				Console.WriteLine("YES");
		}else{
			Console.WriteLine("NO");
		}
	}
}

Measured memory_bytes: 2648
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
typedef long long ll;

const int maxn = 100001;
int n, k;
ll T[maxn];


int check(ll P)
{
    int i = 0;
    for (int j= 0; j < k; j++)
    {
        ll s = 0;
        while (s + T[i] <= P)
        {
            s += T[i];
            i++;
            if (i == n)
                return n;
        }
    }
    return i;
}

/*int check(ll P) // 计算k辆以内的卡车总共能装多少货物
{
    int j = 0;
    for (int i = 0; i < k; i++)
    {
        ll ans = 0;
        for (; ans + T[i] <= P; j++)
        {
            ans += T[j];
            if (j == n)
                return n;
        }
        j++;
    }
    return j;
}*/

int solve()
{
    ll left = 0;
    ll right = 100000 * 10000;
    ll mid;
    while (right > left)
    {
         mid=left+((right-left)>>1);
        int v = check(mid);
        if (v >= n)
        {
            right = mid;
           // cout << "right = mid\n";
        }
        else
        {
            left = mid + 1;
           // cout << "left = mid\n";
        }
    }
    return right;
}

int main()
{
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> T[i];
    ll ans =  solve();
    cout << ans << endl;
    return 0;
}





Measured memory_bytes: 3836
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
using namespace std;

typedef long long ll;

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

int n;
vector<int> v[1002];

int trans(int month,int day,int hour,int min){
  return min + hour * 60 + day * 1440 + month * 44640;
}

int main(){
  while(scanf("%d",&n),n){
    rep(i,1002) v[i].clear();

    rep(i,n){
      int month,day,hour,min;
      scanf("%d/%d %d:%d",&month,&day,&hour,&min);
      int res = trans(month,day,hour,min);

      char ch[2];
      int p;
      scanf("%s%d",ch,&p);
      v[p].push_back(res);
    }

    int ans[1002];
    memset(ans,0,sizeof(ans));

    for(int i=0;i<v[0].size();i+=2){
      for(int j=1;j<1000;j++){
        int sum = 0;
        for(int k=0;k<v[j].size();k+=2){
          int tmp = min(v[0][i+1],v[j][k+1]) - max(v[0][i],v[j][k]);
          //cout<<j<<","<<tmp<<endl;
          if(tmp > 0){
            sum += tmp;
          }
        }
        ans[j] += sum;
      }
    }
    int res = 0;
    rep(i,1002){
      res = max(res , ans[i]);
    }

    cout<<res<<endl;
  }
}

Measured memory_bytes: 0
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll n, m;
	cin >> n >> m;
	if(n % 3 == 0 || m % 3 == 0){
		cout << 0 << endl;
		return 0;
	}
	ll ans = 1e18;
	for(ll i = max(1LL, (n / 2) - 200); i <= min(n - 1, (n / 2) + 200); i++){
		for(ll j = 1; j < m; j++){
			ll a = 1LL * i * j;
			ll b = 1LL * (n - i) * j;
			ll c = 1LL * (m - j) * n;
			ans = min(ans, max({abs(a - b), abs(a - c), abs(b - c)}));
		}
	}
	swap(n, m);
	for(ll i = max(1LL, (n / 2) - 200); i <= min(n - 1, (n / 2) + 200); i++){
		for(ll j = 1; j < m; j++){
			ll a = 1LL * i * j;
			ll b = 1LL * (n - i) * j;
			ll c = 1LL * (m - j) * n;
			ans = min(ans, max({(ll)abs(a - b), (ll)abs(a - c), (ll)abs(b - c)}));
		}
	}
	ans = min(ans, min(m, n));
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
S = input()

# Sから文字を抜いていって、空文字列になればいいはず
S = S.replace("eraser", "")
S = S.replace("erase", "")
S = S.replace("dreamer", "")
S = S.replace("dream", "")

if (len(S) == 0) :
    print("YES")
else :
    print("NO")

Measured memory_bytes: 3188
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::vector<std::string> s(n);
	rep(i,n) std::cin >> s[i];
	std::map<std::string, int > map;
	std::set<std::string> set;
	rep(i,n) map[s[i]]++;
	int max = 0;
	for(auto x:map) {
		max = std::max(max,x.second);
	}
	for(auto x:map) {
		if(x.second==max) set.emplace(x.first);
	}
	for(auto x:set) {
		print(x);
	}
	return 0;
}


Measured memory_bytes: 36224
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>

using namespace std;

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

	string s;
	map<string, int> anagrams;
	for (int i = 0; i < n; i++) {
		cin >> s;
		sort(s.begin(), s.end());
		anagrams[s]++;
	}

	long long ans = 0;
	for (auto p: anagrams) {
		ans += 1LL * p.second * (p.second - 1) / 2;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*
x回で出来る配置：x+1回でも出来る
動かさない箇所を
*/

template<int MOD>
struct ModInt {
	static const int Mod = MOD;
	unsigned x;
	ModInt() : x(0) { }
	ModInt(signed sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	ModInt(signed long long sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	int get() const { return (int)x; }

	ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
	ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }

	ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
	ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
	ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
	ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }

	ModInt inverse() const {
		signed a = x, b = MOD, u = 1, v = 0;
		while (b) {
			signed t = a / b;
			a -= t * b; std::swap(a, b);
			u -= t * v; std::swap(u, v);
		}
		if (u < 0) u += Mod;
		ModInt res; res.x = (unsigned)u;
		return res;
	}
};
typedef ModInt<1000000007> mint;
mint modpow(ll _a, ll n) {
	mint a=_a;
	mint r=1;
	while(n){
		r*=((n%2)?a:1);
		a=a*a;
		n>>=1;
	}
	return r;
}


ll n,a,b;
mint ans=0;

void init(){
	cin>>n>>a>>b;
}

int main(void){
	init();
	ans=modpow(2,n);
	ans-=1;
	mint sum=1;
	rep(i,a){
		sum *= n-i;
		sum /= a-i;
	}
	ans-=sum;
	sum=1;
	rep(i,b){
		sum *= n-i;
		sum /= b-i;
	}
	ans-=sum;
	cout<<ans.get()<<endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;

int main () {
    int n;
    cin >> n;
    int res = 1000 * ((n - 1) / 1000 + 1);
    cout << res - n;
}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 3632
#include<cmath>
#include<stdio.h>
//using namespace std;

int main() {
  int a;
  scanf("%d",&a);
   
  int b = a/3600;
  int c = a-b*3600;
  int d = c/60;
  int e = c-d*60;
  printf("%d:%d:%d\n",b,d,e);
  
  
  //return 0;
}


Measured memory_bytes: 2740
import java.util.*;
public class Main {
	void doIt() {
		Scanner stdIn = new Scanner(System.in);
		while(true) {
			int team = stdIn.nextInt();  //チーム数
			int problem = stdIn.nextInt();//問題数
			int log = stdIn.nextInt(); //データセット数
			if(team + problem + log == 0) break;

			int[] correct = new int[team];
			int[][] wrong = new int[team][problem];
			long[][] penalty = new long[team][problem];

			for(int r = 0; r < log; r++) {
				int tId = stdIn.nextInt();
				int pId = stdIn.nextInt();
				int time = stdIn.nextInt();
				String judge = stdIn.next();

				if(judge.equals("CORRECT")) {
					correct[tId - 1]++;
					penalty[tId - 1][pId - 1] += time + (wrong[tId - 1][pId - 1] * 1200);
					wrong[tId - 1][pId - 1] = 0;
				} else {
					wrong[tId - 1][pId - 1]++;
				}
			}
			long[] Pscore = new long[team];
			for(int r = 0; r < penalty.length; r++) {
				for(int c = 0; c < penalty[r].length; c++) {
					Pscore[r] += penalty[r][c];
				}
			}
			
			Member[] mb = new Member[team];
			for(int r = 0; r < team; r++) {
				mb[r] = new Member(r + 1, correct[r], Pscore[r]);
			}
			Arrays.sort(mb);
			for(int r = 0; r < mb.length; r++) {
				System.out.println(mb[r].id + " " + mb[r].correct + " " + mb[r].penalty);
			}
		}
	}

	class Member implements Comparable<Member> {
		int id;
		int correct;
		long penalty;

		Member(int id, int correct, long penalty) {
			this.id = id;
			this.correct = correct;
			this.penalty = penalty;
		}

		public int compareTo(Member o) {
			if(this.correct < o.correct) {
				return(1);
			} else if(this.correct > o.correct) {
				return(-1);
			} else {//一致するとpenaltyの比較へ
				if(this.penalty > o.penalty) {
					return(1);
				} else if(this.penalty < o.penalty) {
					return(-1);
				} else {//一致するとidの比較へ
					if(this.id > o.id) {
						return(1);
					} else if(this.id < o.id) {
						return(-1);
					} else {
						return(0);
					}
				}
			}
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().doIt();
	}
}

Measured memory_bytes: 62236