akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 200010;
int n, a[N];
char s[N];
int main() {
	scanf("%s", s);
	int len = strlen(s);
	
	int now = 0;
//	while (s[now + 1] == s[now]) now++;
	int cnt = 1;
//	if (now == len - 1) {
//		puts("1");
//		return 0;
//	}
//	if (now != 1) {
//		cnt++; now++;
//	}
	for (int i = now + 1; i < len; ++i)
		if (s[i] == s[i - 1]) {
			if (i + 1 == len) break;
			if (i + 2 == len) {
				cnt++; break;
			}
			i += 2, cnt += 2;
		}
		else
			cnt++;

	printf("%d\n", cnt);
}

Measured memory_bytes: 384
n, a, b = gets.chomp.split(" ").map(&:to_i)
result = 0

n.times do |i|
  s = (i + 1).to_s.split("").map(&:to_i).inject(:+)
  if s >= a && s <= b
    result += (i + 1)
  end
end

puts result

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

int main() {
  int N;
  cin >> N;
  string result;
  if (N % 10 == 7) {
    result = "Yes";
  } else if ((N / 10) % 10 == 7) {
    result = "Yes";
  } else if ((N / 100) % 10 == 7) {
    result = "Yes";
  } else {
    result = "No";
  }
  cout << result << endl;
  return 0;
}

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

int main() {
  int N, sum = 0;
  cin >> N;
  
  for (int i = 0; i < N; i++){
   int A,count = 0;
   cin >> A;
    if (A%2 != 0){
      break;
    }
   while (A%2 == 0){
     A /= 2;
     count++;
   }
   if (sum == 0 || sum > count){
     sum = count;
   }
 }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <cstdio>

#define N 32

using namespace std;

static int l;

int maxValue (
  int a
  )
{
  int s[ 10 ] = { 999999999 };
  int p, i;
  int res = 0;

  while ( a )
  {
    ++s[ a % 10 ];
    a /= 10;
  }

  p = 9;
  for ( i = 0; i < l; ++i )
  {
    for ( ; s[ p ] == 0; --p ) ; 
    res = res * 10 + p;
    --s[ p ];
  }

  return ( res );
}

int minValue (
  int a
  )
{
  int s[ 10 ] = { };
  int p, i;
  int res = 0;

  while ( a )
  {
    ++s[ a % 10 ];
    a /= 10;
  }

  p = 1;
  for ( i = 0; i < l; ++i )
  {
    for ( ; s[ p ] == 0; ++p ) ; 
    if ( p >= 10 ) break ;
    res = res * 10 + p;
    --s[ p ];
  }

  return ( res );
}

int
main (
  )
{
  int i, j;

  for ( ; ; )
  {
    int a[ N ];

    scanf ( "%d%d", &a[ 0 ], &l );
    if ( !( a[ 0 ] | l ) ) break ;

    for ( i = 1; ; ++i )
    {
      a[ i ] = maxValue ( a[ i - 1 ] ) - minValue ( a[ i - 1 ] );
      for ( j = 0; j < i; ++j )
      {
        if ( a[ j ] == a[ i ] ) break ;
      }
      if ( j != i )
      {
        printf ( "%d %d %d\n", j, a[ i ], i - j );
        break ;
      }
    }
  }

  return ( 0 );
}

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

int main() {
  int n,k;
  cin >> n >> k;
  
  vector<int> x(n);
  vector<int> result(n-k+1);
  
  for(int i=0 ; i<n ; i++){
    cin >> x.at(i);
  }
  
  for(int i=0 ; i<n-k+1 ; i++){
    if(x.at(i)<=0 && x.at(i+k-1)<=0) result.at(i)=-x.at(i);
    if(x.at(i)>=0 && x.at(i+k-1)>=0) result.at(i)=x.at(i+k-1);
    if(x.at(i)<=0 && x.at(i+k-1)>=0){
      if(-x.at(i) > x.at(i+k-1)) result.at(i)=x.at(i+k-1)*2-x.at(i);
      else result.at(i)=x.at(i+k-1)-x.at(i)*2;
    }
  }
  
  sort(result.begin(),result.end());
  cout << result.at(0) << endl;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    vector<int> b(n),a(n);
    b[0]=100010;
    repi(i,1,n){
        cin>>b[i];
        a[i-1]=min(b[i],b[i-1]);
    }
    a[n-1]=b[n-1];
    ll sum=0;
    rep(i,n) sum+=a[i];
    cout<<sum;
}

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

int main() {
  long N, C;
  cin >> N >> C;
  long x[N+1], v[N+1];
  x[0] = 0;
  v[0] = 0;
  for (int i=1; i<=N; i++)
    cin >> x[i] >> v[i];
  long val = 0, rl[N+1], lr[N+1], mrl = 0, mlr = 0, ans = 0;
  rl[0] = 0;
  lr[0] = 0;
  for (int i=1; i<=N; i++) {
    val += v[i];
    if (mrl < val - 2*x[i])
      mrl = val - 2*x[i];
    rl[i] = mrl;
    if (mlr < val - x[i])
      mlr = val - x[i];
    lr[i] = mlr;
  }
  val = 0;
  ans = mlr;
  for (int i=N; i>0; i--) {
    val += v[i];
    ans = max(ans, lr[i-1]+val+2*x[i]-2*C);
    ans = max(ans, rl[i-1]+val+x[i]-C);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3328
sd = input()
t = input()

n = len(sd)
m = len(t)

for i in reversed(range(n - m + 1)):
    t_kamo = sd[i:i+m]
    for j in range(len(t)):
        if t_kamo[j] == "?":
            continue
        elif t_kamo[j] == t[j]:
            continue
        else:
            break
    else:
        ans = (sd[:i] + t + sd[i+m:]).replace("?", "a")
        print(ans)
        exit()

print("UNRESTORABLE")


Measured memory_bytes: 38384
#include<iostream>
#include<fstream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<set>
#include<map>
#include<bitset>
#include<ctime>
#include<queue>
using namespace std;
#define int long long
#define pii pair <int, int>
#define XX first
#define YY second

// constants:
const int mn = 200005;
const int mod = 1000000007;
const long long inf = 4444444444444444444;
const int sminf = 1111111111;
const bool is_multitest = 0;
const bool is_interactive = 0;

// i/o methods:
const bool input_from_file = 0;
const bool output_to_file = 0;
#define filename ""
#define in_extension "inp"
#define out_extension "out"

// data preprocessing: (e.g.: divisor generating, prime sieve)
void preprocess()
{
    
}

// global variables:
int a, b;
// main solution goes here:
void execute(int test_number)
{
    cin>>a>>b;
    for (int i = 20*b; i< 20*(b+1); i+=2) {
        if (i >= 25 * a && i < 25* (a+1)) {
            cout<<i/2;
            return;
        }
    }

    cout<<-1;
    return;
}
// REMEMBER TO CHOOSE TEST METHODS
// PLEASE REMOVE cout AND cerr DEBUG LINES BEFORE SUBMITTING PROBLEMS
// Solution by low_



















signed main()
{
#ifdef lowie
    if (!is_interactive)
    {
        freopen("test.inp", "r", stdin);
        freopen("test.out", "w", stdout);
    }
#else
    if (input_from_file) freopen(filename"."in_extension, "r", stdin);
    if (output_to_file) freopen(filename"."out_extension, "w", stdout);
#endif
    if (!is_interactive)
    {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }

    preprocess();
    int ntest;
    if (is_multitest) cin >> ntest;
    else ntest = 1;

    for (int testno = 1; testno <= ntest; testno++)
    // use for instead of while to serve facebook hacker cup test format
    {
        execute(testno); // only start coding in this function, not in main
    }
}
// Template by low_
// Contact me via mail: ttuandung1803@gmail.com
// ...or codeforces: www.codeforces.com/profiles/low_
// ...or if you're interested in food: www.instagram.com/lowie.exe/

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#include <list> 
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll getDigit(ll n) {
	ll cnt = 0;
	while (n != 0) {
		n /= 10;
		cnt++;
	}
	return cnt;
}
typedef pair<double, long long> pair_t;
bool comp(const pair_t& a, const pair_t& b) {
	if (a.first == b.first)return  a.second > b.second;
	else {
		return a.first > b.first;
	}
}

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


Measured memory_bytes: 256
n=int(input())
 
def is_prime(n):
    if n < 2:
      return False
    else:
      for i in range(2, n):
        if i * i > n:
            break
        elif n % i == 0:
            return False
    return True

for i in range(n,n+400):
  if is_prime(i):
    print(i)
    break

Measured memory_bytes: 2940
#include <stdio.h>
#include <string.h>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

typedef long long ll;

//scanf("%d", &n);
//scanf("%c", &c);
//scanf("%lf", &d);

#define NUM (5*100000)

#define CALC(n) (((n)*((n)+1))/2)

void solve(){
    char s[NUM-1];
    scanf("%s", s);

    int N = strlen(s);

    ll sum = 0;
    ll a = 0;
    ll cnt = 0;

    char l = s[0];
    if(l == '>') { a = 1; }
    rep(i, N){
        if(l != s[i]){
            //printf("%ld, %ld\n", a, cnt);
            sum += CALC(cnt-1);

            if(a){
                sum += max(a, cnt);
                a = 0;
            }else{
                a = cnt;
            }

            l = s[i];
            cnt = 1;
        }else{
            cnt++;
        }
    }

    //printf("%ld, %ld\n", a, cnt);
    sum += CALC(cnt-1);
    sum += max(a, cnt);

    printf("%lld\n", sum);
}

int main(int argc, char** argv){
    solve();
    return 0;
}


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

int main()
{
  int an = 0;
  int bn = 0;
  int cn = 0;
  string a, b, c;

  cin >> a >> b >> c;

  int sSize = a.size() + b.size() + c.size();
  char next = 'a';

  for(int i = 0; i < sSize; i++){
    if(next == 'a'){
      if(an == a.size()){
        cout << 'A' << endl;
        break;
      }

      next = a[an];
      an++;
    }

    else if(next == 'b'){
      if(bn == b.size()){
        cout << 'B' << endl;
        break;
      }

      next = b[bn];
      bn++;
    }

    else{
      if(cn == c.size()){
        cout << 'C' << endl;
        break;
      }

      next = c[cn];
      cn++;
    }
  }

  return 0;

}

Measured memory_bytes: 256
import sys
from math import factorial
input = sys.stdin.readline
N, M, K = map(int, input().split())
MOD = 998244353
inv = [1] * N
FAC = factorial(N - 1) % MOD
if M == 1:
    print(1 if K == N - 1 else 0)
else:
    res = 0
    for i in range(1, N):
        inv[i] = (inv[i - 1] * pow(i, MOD - 2, MOD)) % MOD
    for k in range(K + 1):
        # k個の○とN-k-1個の|を並べる順列
        # punc = (N-1)!/k!/(N-k-1)!
        # punc = factorial(
        #     k + (N - k - 1)) // factorial(k) // factorial(N - k - 1)
        punc = FAC
        # punc *= pow(factorial(k), MOD - 2, MOD)
        punc *= inv[k]
        punc = punc % MOD
        # punc *= pow(factorial(N - k - 1), MOD - 2, MOD)
        punc *= inv[N - k - 1]
        punc = punc % MOD
        color = M * pow(M - 1, N - k - 1, MOD)
        res += ((punc % MOD) * color) % MOD
        res = res % MOD
    print(res % MOD)


Measured memory_bytes: 86084
import bisect

N = int(input())
L = list(map(int, input().split()))
assert len(L) == N

L.sort()

n = 0
# Choose two edges
for i in range(N):
    for j in range(i + 1, N):
        a = L[i] + L[j]
        k = bisect.bisect_left(L, a, lo=j + 1)
        #   assert all(v < a for v in L[:k]) and all(v >= a for v in L[k:])
        # the number of candidates of the third edge
        n += k - (j + 1)

print(n)

Measured memory_bytes: 43996
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
void solve1(string& s, char c) {
	s[s.find('#')] = c;
}
void solve2(string& s) {
	for (int i = s.size() - 1; i >= 0; i--) {
		if (s[i] == '#' && (i == s.size() - 1 || s[i + 1] != 'A') && (i == 0 || s[i - 1] != 'A')) {
			s[i] = 'B'; return;
		}
	}
	solve1(s, 'B');
}
vector<int> dist(string s) {
	vector<int> ret(s.size(), 999999999);
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != '#') {
			for (int j = 0; j < s.size(); j++) {
				ret[j] = min(ret[j], abs(i - j));
			}
		}
	}
	return ret;
}
void solve3(string &s) {
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != '#') {
			if (i < s.size() - 1 && s[i + 1] == '#') {
				s[i + 1] = 'C'; return;
			}
			if (i > 0 && s[i - 1] == '#') {
				s[i - 1] = 'C'; return;
			}
		}
	}
	s[s.size() / 2] = 'C';
}
void solve4(string &s) {
	vector<int> ret = dist(s);
	s[max_element(ret.begin(), ret.end()) - ret.begin()] = 'D';
}
int N, Q;
int main() {
	while (cin >> N >> Q, N) {
		string s(N, '#'), t;
		while (Q--) {
			cin >> t;
			if (t == "A") solve1(s, 'A');
			if (t == "B") solve2(s);
			if (t == "C") solve3(s);
			if (t == "D") solve4(s);
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 3052
#include <stdio.h>

int main(){
	int n;
	int min = 0, max = 0;
	double som = 0;
	scanf("%d", &n);
	
	int a[n];
	
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	
	for(int i = 0; i < n; i++){
		if(a[i] < min || min == 0)
			min = a[i];
		
		if(a[i] > max || max == 0)
			max = a[i];
		
		som += (double)a[i];
	}
	
	printf("%d %d %.0lf\n", min, max, som);
	return 0;
}

Measured memory_bytes: 1100
#include <vector>
#include <bitset>
#include <iostream>

using B = std::bitset<32>;

int main()
{
  int N;
  std::cin >> N;
  int S[500000];
  for(int i = 0; i < N; ++i) {
    char c;
    std::cin >> c;
    S[i] = 1 << (c - 'a');
  }
  int Q;
  std::cin >> Q;
  while (Q--) {
    int q;
    std::cin >> q;
    if (q == 1) {
      int i;
      char c;
      std::cin >> i >> c;
      S[i - 1] = 1 << (c - 'a');
    } else {
      int r, l;
      std::cin >> r >> l;
      --r;
      int res{};
      for (int i = r; i < l; ++i) {
          res |= S[i];
      }
      B ans(res);
      std::cout << ans.count() << '\n';
    }
  }
  return 0;
}

Measured memory_bytes: 2304
//From Naruto to Hokage
//#include <RJ>
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=1005;
// ll n,m;
ll cnt=0;
// vi a[N],in(N,0);
vector<pii> order;
set<pii> nextnode;
ll in[N][N];
vector<pii> v[N][N];
ll ans[N][N];
ll n;
ll fin;
void topsort()
{
    rep(i,1,n)
    rep(j,i+1,n)
    if(!in[i][j])
        nextnode.insert({i,j}),ans[i][j]=1;
    while(!nextnode.empty())
    {
        pii cur=*nextnode.begin();
        nextnode.erase(cur);
        order.pb(cur);
        cnt++;
        for(auto i:v[cur.F][cur.S])
        {
            ans[i.F][i.S]=max(ans[i.F][i.S],ans[cur.F][cur.S]+1);
            fin=max(ans[i.F][i.S],fin);
            in[i.F][i.S]--;
            if(!in[i.F][i.S])
                nextnode.insert(i);
        }
    }
    if(cnt!=(n*(n-1))/2) //Failed
    {
        fin=-1;
    }
}
ll x;
void solve(){
    cin>>n;
    ll temp[n];
    rep(i,1,n){
        rep(j,1,n-1){
            cin>>x;
            temp[j]=x;
        }
        rep(j,2,n-1){
            in[min(i,temp[j])][max(i,temp[j])]++;
            v[min(i,temp[j-1])][max(i,temp[j-1])].pb({min(i,temp[j]),max(i,temp[j])});
        }
    }
    // memset(ans,0,sizeof(ans));
    topsort();
    cout<<fin;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 73964
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  double r;
  cin >> r;
  cout << fixed << setprecision(10) << 2*r*pi << endl;
}

Measured memory_bytes: 3780
#include<stdio.h>
int main(void){
int a,b;
scanf("%d %d",&a ,&b);
if(a<b)printf("a < b\n",a,b);
if(a>b)printf("a > b\n",a,b);
if(a==b)printf("a == b\n",a,b);
return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n,h;cin >>h>>n;
    vector<pair<int,int>>magic(n);
    for (int i = 0; i < n; ++i) {
        int a,b;cin >>a>>b;
        magic[i]={a,b};
    }
    vector<int>dp(h+1,INF);
    dp[0]=0;
    for (int i = 0; i < n; ++i) {
        int damage,cost;
        damage=magic[i].first;
        cost=magic[i].second;
        for (int j = 0; j <=h; ++j) {
            int k = min(j + damage, h);
            dp[k]=min(dp[k],dp[j]+cost);
        }
    }
    cout <<dp[h]<<endl;
    return 0;
}

Measured memory_bytes: 3680
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const double EPS = 1.0e-7;
const double PI = acos(-1.0);

class Point
{
public:
    double y, x;
    Point(){
        y = x = 0.0;
    }
    Point(double y0, double x0){
        y = y0;
        x = x0;
    }
    Point operator+(const Point& p) const{
        return Point(y + p.y, x + p.x);
    }
    Point operator-(const Point& p) const{
        return Point(y - p.y, x - p.x);
    }
    Point operator*(double a) const{
        return Point(y * a, x * a);
    }
    Point operator/(double a) const{
        return Point(y / a, x / a);
    }
    double length() const{
        return sqrt(y * y + x * x);
    }
    double dist(const Point& p) const{
        return sqrt(pow(y - p.y, 2) + pow(x - p.x, 2));
    }
    double dot(const Point& p) const{
        return y * p.y + x * p.x; // |a|*|b|*cosθ
    }
    double cross(const Point& p) const{
        return x * p.y - y * p.x; // |a|*|b|*sinθ
    }

    double angle() const{
        return atan2(y, x);
    }
    Point rotate(double theta) const{
        return Point(sin(theta) * x + cos(theta) * y, cos(theta) * x - sin(theta) * y);
    }
    bool operator==(const Point& p) const{
        return abs(y - p.y) < EPS && abs(x - p.x) < EPS;
    }
    bool operator<(const Point& p) const{
        return y < p.y - EPS || (y < p.y + EPS && x < p.x - EPS);
    }
};

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<Point> p1(n), p2(n);
        for(int i=0; i<n; ++i)
            cin >> p1[i].x >> p1[i].y;
        for(int i=0; i<n; ++i)
            cin >> p2[i].x >> p2[i].y;

        // 原点が重心となるように平行移動
        Point center(0, 0);
        for(int i=0; i<n; ++i)
            center = center + p1[i];
        center = center / n;
        for(int i=0; i<n; ++i)
            p1[i] = p1[i] - center;
        sort(p1.begin(), p1.end());

        center = Point(0, 0);
        for(int i=0; i<n; ++i)
            center = center + p2[i];
        center = center / n;
        for(int i=0; i<n; ++i)
            p2[i] = p2[i] - center;

        // p1[0] と p2[i] が重なるように回転
        double ret = DBL_MAX;
        for(int i=0; i<n; ++i){
            double theta = p1[0].angle() - p2[i].angle();
            if(theta < 0)
                theta += 2 * PI;
            if(theta > 2*PI)
                theta -= 2 * PI;

            vector<Point> p3(n);
            for(int j=0; j<n; ++j)
                p3[j] = p2[j].rotate(theta);
            sort(p3.begin(), p3.end());

            if(p1 == p3)
                ret = min(ret, min(theta, 2*PI - theta));
        }

        printf("%.10f\n", ret);
    }
}

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

int main(){
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  
  vector<int> x(N);
  vector<int> y(M);
  
  rep(i,N) cin >> x[i];
  rep(i,M) cin >> y[i];
  
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  
  if(x[N-1] < y[0]){
    if(X<y[0] && y[0]<=Y){
      cout << "No War" << endl;
      return 0;
    }
  }
  cout << "War" << endl;
 
  return 0;
}


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

using namespace std;

#define MOD (int)(1e9+7)
#define INF 1e9

#define rep(i,n) for(int i=0;i<n;i++)
#define repx(i,x,n) for(int i=x;i<n;i++)
#define repr(i,n) for(int i=n;i>=0;i--)
#define all(a) a.begin(),a.end()

typedef long long ll;

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

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

	bool flag = false;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= M; j++) {
			if (i*M + j*N - 2 * i*j == K)flag = true;
		}
	}

	cout << (flag ? "Yes" : "No") << endl;
	return 0;
}



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

#define REP(i, n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define FOR(i, l, r) for(int i = l; i < r; i++)
#define RFOR(i, l,r) for(int i= (l)-1; i>= (r) ; i--)

const char surt[] = {'S','H','C','D'};

bool fun(pair<char, int> a, pair<char, int> b)
{
    if(a.first == 'L')
        return false;
    else if(b.first == 'L')
        return true;
    else if(a.first == b.first)
        return a.second < b.second;
    else REP(i, 4)
    {
        if(surt[i] == a.first)
            return true;
        if(surt[i] == b.first)
            return false;
    }
    return false;
}

// a[l,m) and a[m,r) are sorted
void merge(vector<pair<char,int> >& a, int l, int m, int r)
{
    int f = m-l, g = r-m;
    vector< pair<char, int> > x(f+1), y(g+1);
    REP(i, f)
        x[i] = a[l+i];
    REP(i, g)
        y[i] = a[m+i];
    x[f] = pair<char, int>('L', 14);
    y[g] = pair<char, int>('L', 14);
    int k = 0, h = 0;
    FOR(i, l, r)
    {
        if(fun(x[k], y[h]))
            a[i] = x[k++];
        else
            a[i] = y[h++];
    }
}

void msort(vector< pair<char, int> >& a,int l, int r)
{
    if(r - l <= 1)
        return;

    int d = (l+r) /2;
    msort(a, l, d);
    msort(a, d, r);
    merge(a, l, d, r);
}

int main()
{
    vector< pair<char, int> > a(52);
    int n;
    cin >> n;
    REP(i, n)
        cin >> a[i].first >> a[i].second;
    msort(a, 0, n);
    int k = 1, s = 0, i = 0;
    while(k <= 13 || s < 3)
    {
        if(k > 13) { k = 1; s++; }
        if(i >= n || a[i] != pair<char,int>(surt[s], k))
            cout << surt[s] << ' ' << k << '\n';
        else
            i++;
        k++;
    }
    return 0;
}

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

const ll INF=1LL << 58;
ll N,n_minus,n_plus,ma,mi;
vector<ll> a;
vector<PLL> ops;
signed main() {
    cin>>N;
    a.resize(N);
    ma = 0;
    mi = 0;
    rep(i,0,N){
        cin>>a[i];
        if (a[i]>=0) n_plus++;
        else n_minus++;

        if (a[i] > a[ma]) ma = i;
        if (a[i] < a[mi]) mi = i;
    }

    if (n_plus > 0 && n_minus > 0){
        if (a[ma] > -a[mi]){
            rep(i,0,N) {
                a[i] += a[ma];
                ops.push_back(PLL(ma, i));
                n_plus = N;
                n_minus = 0;
            }
        }else{
            rep(i,0,N) {
                a[i] += a[mi];
                ops.push_back(PLL(mi, i));
                n_plus = 0;
                n_minus = N;
            }
        }
    }

    if (n_plus > 0){
        rep(i,1,N){
            ops.push_back(PLL(i-1,i));
            a[i] += a[i-1];
        }
    } else {
        for (ll i=N-2; i>=0; i--){
            ops.push_back(PLL(i+1,i));
            a[i] += a[i+1];
        }
    }
    cout<<ops.size()<<endl;
    for(auto e: ops)
        cout<<e.first+1<<" "<<e.second+1<<endl;

    // cout<<"res: ";
    // for(auto e: a) cout<<e<<" ";
    // cout<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#define maxn 100010
using namespace std;
int main(){
  int n;
  int a[maxn];
  int sum1=0;
  int sum2=0;
  cin>>n;
  for(int i=0;i<n;i++){
  	cin>>a[i];
  }
  for(int i=n-1;i>0;i--){
    if(a[i-1]>a[i]){
       a[i-1]-=1;
	   if(a[i-1]>a[i]){
	   	printf("No\n");
	   	break;
	   }
	   else
	   	sum1++;	
	}
	else sum2++;	
  }
 if(sum1+sum2==n-1) 
    printf("Yes\n");
  return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(void){
    int i,n,money=100000;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        money*=1.05;
        money+=999;
        money-=money%1000;
    }
    printf("%d\n",money);
    return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n)    for (ll (i) = 0;   (i) < (n); ++(i))
#define FOR(i, a, b) for (ll (i) = (a); (i) < (b); ++(i))

const int MOD = (int)1e9 + 7;

int N;
string S;

ll dp[3030][3030];
ll frm[3030];

signed main() {

    cin >> N >> S;

    REP(i, N) dp[1][i] = 1;
    FOR(i, 1, N) {  // dp[i] -> dp[i + 1]
        bool isless = S[i - 1] == '<';
        int mx_i = N - i;
        frm[0] = 0;
        REP(j, mx_i + 1) (frm[j + 1] = frm[j] + dp[i][j]) %= MOD;;
        REP(j, mx_i) {
            if (isless) dp[i + 1][j] = (frm[j + 1] - frm[0] % MOD + MOD) % MOD;
            else        dp[i + 1][j] = (frm[mx_i + 1] - frm[j + 1] % MOD + MOD) % MOD;
            dp[i + 1][j] %= MOD;
        }
    }
    cout << dp[N][0] << endl;

    // REP(i, N + 1) {
    //     REP(j, N + 1) cout << dp[i][j] << ' ';
    //     cout << endl;
    // }

}

Measured memory_bytes: 71936
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define fast ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define F(i,a,b) for(int i= (int)(a); i<(int)(b);i++)
#define FI(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define what_is(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pii pair<int,int>
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
const int N = 1e6+7 ;
string s ;

int main(){fast ;
	vector<int> a(5) , b(5) ;
	F(i,0,5){
		cin >> a[i] ;
		if(a[i]%10)
			b[i] = 10 * (a[i]/10 + 1) ;
		else
			b[i] = a[i] ;
	}
	int ans = INT_MAX ;
	int sm = accumulate(all(b),0) ;
	F(i,0,5)
		ans = min(ans, sm-b[i]+a[i]) ;
	cout << ans << endl ;
}




Measured memory_bytes: 256
#include<iostream>

using namespace std;

//??\?????????
void swap(int *a, int *b){
	int temp = *a;
	*a = *b;
	*b = temp;
}

int main(){
	int str,mt[10];
	int i;
	
	for(i=0;i<10;i++){
		cin >> str;
		mt[i]=str;
	}
	
	// ????????????
	int num = 1;
	while(num<=3){
		str = mt[num-1];
		for(i=num;i<10;i++){
			if(str<mt[i]){
				str = mt[i];
				swap(mt[num-1],mt[i]);
			}
		}
		num++;
	}
	
	cout << mt[0] << "\n";
	cout << mt[1] << "\n";
	cout << mt[2] << "\n";
	
	return 0;
}

Measured memory_bytes: 1164
# ABC164b


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    def dump(*args):
        sys.stderr.write(str(args))

    a, b, c, d = map(int, input().split())

    turn = 0
    while a > 0 and c > 0:
        if turn == 0:
            c -= b
        else:
            a -= d
        #print(a, c)
        turn = 1 - turn
    if a > 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 61820
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#define MAX(a,b) ((a>b)?a:b)
using namespace std;
struct ds{
    double L;
    double a;
    double b;
};    

int main(){
    auto f = [](double x,double y,double z){return x*x+y*y+z*z;};
    int i,j,N,M;
    vector<ds> cls;
    cin>>N>>M;
    for(i=0;i<N;i++){
        struct ds buf;
        cin>>buf.L>>buf.a>>buf.b;
        cls.push_back(buf);
    }
    vector<int> tg(N,0);
    vector<ds> q;
    for(i=0;i<M;i++){tg[N-1-i]=1;}
    double r,m=0.0;
    do{
        r=0.0;
        for(i=0;i<N;i++){
            if(tg[i]){q.push_back(cls[i]);}
        }
        for(auto a=q.begin();a!=q.end();a++){
            for(auto b=a+1;b!=q.end();b++){
                r+=f(a->L - b->L,a->a - b->a, a->b - b->b);
            }
        }
        m=MAX(m,r);
        q.clear();
    }while(next_permutation(tg.begin(),tg.end()));
    cout<<fixed;
    cout<<m<<endl;    
    return 0;
}



Measured memory_bytes: 3292
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

const int MAX_N = 100050;
int N;
int a[MAX_N];

int main(int argc, char **argv) {
    std::cin >> N;
    for (int i = 1; i <= N; i++) {
        std::cin >> a[i];
    }

    std::sort(a + 1, a + 1 + N);

    int max = a[N];

    int id1 = max / 2;
    int id2 = (max % 2 == 0) ? id1 : id1 + 1;

    int tmp_dist = id1;
    int ret = a[1];
    int min_dist = std::min(abs(a[1] - id1), abs(a[1] - id2));
    for (int i = 1; i < N; i++) {
        int tmp = std::min(abs(a[i] - id1), abs(a[i] - id2));
        if (tmp < min_dist) {
            ret = a[i];
            min_dist = tmp;
        }
    }
    
    std::cout << max << " " << ret << std::endl;
    

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
using namespace std;

int main(){
	int n, s;
	while(1){
		cin>>n;
		if(n == 0) break;

		vector<int> score;
		double m = 0, a = 0;
		
		for(int i=0;i<n;i++){
			cin>>s;
			score.push_back(s);
			m += s;
		}
		m /= n;

		for(int i=0;i<n;i++){
			a += pow(score[i]-m, 2);
		}
		a /= n;

		printf("%.8lf\n", sqrt(a));
	}
	return 0;
}

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

int main() {
	long long a,c,b;cin>>a>>b>>c;
	if((a%2)*(b%2)*(c%2)==0){
		cout<<0<<endl;
		return 0;
	}
	if(a>b){
		if(a>c){
			cout<<b*c<<endl;
		}else{
			cout<<a*b<<endl;
		}
	}else{
		if(b>c){
			cout<<a*c<<endl;
		}else{
			cout<<a*b<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main{
        public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int [] numbers = new int [3];
        for (int i = 0; i < 3; i++) {
            numbers[i] = in.nextInt();
            
        }
        Arrays.sort(numbers);
        System.out.println(numbers[0]+numbers[1]);
    }
}

Measured memory_bytes: 22356
def main():

    R, G, B, N = map(int, input().split())

    ans = 0

    for i in range((N//R)+1):
        r = i
        for j in range(((N-R*r)//G)+1):
            g = j
            if (N-R*r-G*g) % B == 0 and N-R*r-G*g >= 0:
                ans += 1

    print(ans)

if __name__=='__main__':
    main()

Measured memory_bytes: 3060
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
Z=list(map(int,input().split()))
if(X[0]-X[1]==Y[0]-Y[1] and X[0]-X[1]==Z[0]-Z[1] and X[2]-X[1]==Y[2]-Y[1] and X[2]-X[1]==Z[2]-Z[1]):
  print("Yes")
else:
  print("No")

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

int main() {
  long long n,m,x;
  cin>>n>>m>>x;
  vector<long long>c(n);
  vector<vector<long long>>a(n,vector<long long>(m));
  for(long long i=0;i<n;i++){
    cin>>c.at(i);
    for(long long j=0;j<m;j++){
      cin>>a.at(i).at(j);
    }
  }
  long long ans=10000000;
  for(long long i=0;i<(1<<n);i++){
    long long cost=0;
    vector<long long>X(m);
    bool test=true;
    for(long long j=0;j<n;j++){
      if(i>>j&1){
        cost+=c.at(j);
        for(long long k=0;k<m;k++){
          X.at(k)+=a.at(j).at(k);
        }
      }
    }
    for(long long l=0;l<m;l++){
      if(X.at(l)<x){
        test=false;
      }
    }
    if(test){
      ans=min(ans,cost);
    }
  }
  if(ans==10000000){
    cout<<"-1"<< endl;
  }
  else{
    cout<<ans<< endl;
  }
}
    
    
    

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;

  if (a == 1){
    a = 14;
  }
  if (b == 1){
    b = 14;
  }

  if (a > b){
    cout << "Alice" << endl;
  }
  else if (a < b){
    cout << "Bob" << endl;
  }
  else {
    cout << "Draw" << endl;
  }
}

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

int main(){
  long long a,b,x;
  cin >> a >> b >> x;
  long long ans=0;
  if(a%x == 0)ans++;
  b = b/x;
  a = a/x;
  ans += b-a;
  cout << ans << endl;
}


Measured memory_bytes: 256
// Problem : A - Poor
// Contest : AtCoder - AtCoder Beginner Contest 155
// URL : https://atcoder.jp/contests/abc155/tasks/abc155_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

void solve(){
    int a;
    set<int> s;
    for(int i=0;i<3;i++) cin>>a, s.insert(a);
    if(sz(s) == 2) cout<<"Yes\n";
    else cout<<"No\n";
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

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

int n,m,t,s,r,ans;
int ff[222];

int main()
{
    int i,j,k,l;
    scanf("%d",&n);
    for(i=1;i<=2*n;i++)scanf("%d",&ff[i]);
    sort(ff+1,ff+n+n+1);
    for(i=1,j=2;i<=n;i++,j+=2)ans+=min(ff[j-1],ff[j]);
    printf("%d\n",ans);
    return 0;
}


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

int N;
long long g[300][300];

// O(V^3)
long long warshall_floyd(int n) {
    long long ret = 0;

    // check
    for(int k = 0; k < n; ++k)
        for(int i = 0; i < n; ++i)
            for(int j = 0; j < n; ++j) 
                if(g[i][j] > g[i][k] + g[k][j]) return -1;

    // calc
    for(int k = 0; k < n; ++k) 
        for(int i = 0; i < n; ++i) 
            for(int j = 0; j < n; ++j) {
                if(g[i][j] == 0 || g[i][k] == 0 || g[k][j] == 0) continue;
                if(g[i][j] == g[i][k] + g[k][j]) g[i][j] = 0; 
            }

    for(int i=0; i < n; ++i) 
        for(int j=0; j < n; ++j) 
            ret += g[i][j];

    return ret / 2;
}

int main() {
    cin >> N;
    for(int i=0; i < N; ++i) 
        for(int j=0; j < N; ++j) cin >> g[i][j];

    cout << warshall_floyd(N) << '\n';
    return 0;
}

Measured memory_bytes: 896
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);


    int t;
    cin >> t;
    while (t-- > 0) {
        int n;
        cin >> n;
        vector<int> K(n);
        vector<int> L(n);
        vector<int> R(n);
        for (int i = 0; i < n; ++i) {
            cin >> K[i] >> L[i] >> R[i];
        }


        vector<pair<int,int>> A;
        vector<pair<int,int>> B;

        long long res = 0;
        for (int i = 0; i < n; ++i) {
            if (L[i] < R[i]) {
                res += L[i];
                A.emplace_back(n - K[i], R[i] - L[i]);
            } else if (L[i] > R[i]) {
                res += R[i];
                B.emplace_back(K[i], L[i] - R[i]);
            } else {
                res += L[i];
            }
        }

        auto calc = [&](vector<pair<int,int>>& A) {
            sort(A.begin(), A.end());

            priority_queue<int, vector<int>, greater<int>> pq;
            long long res = 0;
            for (auto& p : A) {
                int k = p.first;
                int v = p.second;
                pq.push(v);
                while (pq.size() > k) {
                    pq.pop();
                }
            }

            while (!pq.empty()) {
                res += pq.top();
                pq.pop();
            }
            return res;
        };

        res += calc(A);
        res += calc(B);

        cout << res << '\n';

    }

    return 0;
}

Measured memory_bytes: 7976
#include <bits/stdc++.h>
using namespace std;
const int maxN = 1010;
char a[maxN];
bool check(int l,int r)
{
    while(l<r)
    {
        if(a[l]!=a[r])return 0;
        l++;r--;
    }
    return 1;
}
int main()
{
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)a[i+1]=s[i];
    int N = s.size();
    if( check(1,N) && check(1,(N-1)/2) && check((N+3)/2,N) )puts("Yes");
    else puts("No");
}


Measured memory_bytes: 256
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;

std::string S;

int main()
{
  std::cin >> S;

  if( S.size() & 1 )
  { puts("No"); return 0; }

  bool fl = true;

  rep( i, S.size() )
  {
    if( i & 1 )
      fl &= S[i] == 'i';
    else
      fl &= S[i] == 'h';
  }

  puts( fl ? "Yes" : "No" );

  return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] ab = scanner.nextLine().split(" ", 2);
        int a = Integer.parseInt(ab[0]);
        int b = Integer.parseInt(ab[1]);

        if (a == 1) {
            a = 14;
        }
        if (b == 1) {
            b = 14;
        }

        if (a == b) {
            System.out.println("Draw");
        }
        else if (a > b) {
            System.out.println("Alice");
        }
        else {
            System.out.println("Bob");
        }
    }
}


Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define all(c) (c).begin(), (c).end()
typedef pair<int,int> ii;

void show(int x, int n) {
  cout << "(";rep(i, n) {cout << (x-(x/8)*8) << ","; x>>=3; }cout << ") ";
}

int dijk(int n, const vector<vector<int> > &c) {
  int start = 0; rep(i, n) start=(start<<3)+i;
  vector<bool> cost(16777216, false);
  priority_queue<pair<int, int> > pq;
  pq.push(ii(0, start));
  
  int r = -1;
  
  while(!pq.empty()) {
  	int cur = pq.top().second;
	int dist = pq.top().first; pq.pop();
	if(cost[cur]) continue;
	// show(cur,n); cout << dist << endl;
	cost[cur] = true;
	r = max(r, -dist);
	for(int i=0; i<n; i++) {
		for(int j=i+1; j<n; j++) {
			int x, y;
			x = (cur>>(i*3))&7, y = (cur>>(j*3))&7;
			cur = cur -(x<<(i*3)) -(y<<(j*3)) +(x<<(j*3)) +(y<<(i*3));
			if(!cost[cur]) pq.push(ii(dist-c[i][j], cur));
			x = (cur>>(i*3))&7, y = (cur>>(j*3))&7;
			cur = cur -(x<<(i*3)) -(y<<(j*3)) +(x<<(j*3)) +(y<<(i*3));
		}
	}
  }
  
  return r;
}

int main() {
	int n;
	
	while(cin >> n) {
		vector<vector<int> > c(n, vector<int>(n));
		rep(i, n) rep(j, n) cin >> c[i][j];
		cout << dijk(n, c) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 6316
use std::io;

fn main() {
    let vec = read_vec::<i32>();

    let h: i32 = vec[0];
    let a: i32 = vec[1];

    let mut ans: i32 = h / a;
    if h % a != 0 {
        ans = ans + 1;
    }
    println!("{}", ans);
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut line = String::new();
    io::stdin().read_line(&mut line)
        .ok()
        .expect("Faild to read Vec");
    line.trim().split_whitespace()
        .map(|i| i.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#define NUMBER '0'
#define MAXOP 100

struct Node{
  double data;
  struct Node *next;
};

typedef struct Node Node;


Node *create_node(double new_data){
  Node *new_node = (Node *) malloc(sizeof(Node));
  if (!new_node){
    fprintf(stderr, "could not allocate a node. \n");
    exit(1);
  }
  new_node->data = new_data;
  new_node->next = NULL;
  return new_node;
}


void push(Node **head, double new_data){
  Node *new_node = create_node(new_data);
  new_node->next = *head;
  *head = new_node;
}


double pop(Node **head){
  Node *temp = *head;
  *head = (*head)->next;
  return temp->data;
  free(temp);
}


void clear_list(Node *head){
  while(head){
    Node *target = head;
    head = head->next;
    free(target);
  }
}


#define BUFSIZE  100

char buf[BUFSIZE];
int bufp = 0;

int mygetch(void){
  return (bufp > 0) ? buf[--bufp] : getchar();
}


void myungetch(int c){
  if (bufp >= BUFSIZE)
    printf("ungetch: too many cahracters\n");
  else
    buf[bufp++] = c;
}


int mygetop(char *s){
  char i, c;
  while((s[0] = c = mygetch()) == ' ' || c == '\t')
    ;
  s[1] = '\0';
  if (!isdigit(c) && c != '.')
    return c;
  i = 0;
  if (isdigit(c))
    while (isdigit(s[++i] = c = mygetch()))
      ;
  if (c == '.')
    while (isdigit(s[++i] = c = mygetch()))
      ;
  s[i] = '\0';
  if (c != EOF)
    myungetch(c);
  return NUMBER;
}

/*
int mygetop(char *s){
  char c;

  if (isdigit(c = s[0])) {
    return NUMBER;
  }
  else if (c == '-' && isdigit(s[1])){
    return NUMBER;
  }
  else
    return c;
}
*/



int main(){

  Node *head = NULL;
  int type;
  double op;
  char s[MAXOP];

  while((type = mygetop(s)) != EOF){
    switch(type){
    case NUMBER:
      push(&head, atof(s));
      break;
    case '+':
      push(&head, pop(&head) + pop(&head));
      break;
    case '*':
      push(&head, pop(&head) * pop(&head));
      break;
    case '-':
      op = pop(&head);
      push(&head, pop(&head) - op);
      break;
    case '\n':
      printf("%.8g\n", pop(&head));
      clear_list(head);
      break;
    default:
      printf("error: unknown command %c\n", type);
      break;
    }
  }
  return 0;
}





Measured memory_bytes: 2044
import itertools
import math

n = int(input())
x = [list(map(int, input().split())) for i in range(n)]
lis = [x for x in range(n)]
p_lis = itertools.permutations(lis)
s = 0

for i in p_lis:
    for j in range(n-1):
        r = ((x[i[j+1]][0] - x[i[j]][0])**2 + (x[i[j+1]][1] - x[i[j]][1])**2) **0.5
        s += r
ans = s/math.factorial(n)
print(ans)

Measured memory_bytes: 40684
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

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

int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	int kkt = 89;
	while (kkt) {
		ll w, d; scanf("%lld %lld", &w, &d); if (w == 0 && d == 0) break;
		ll res = 0;
		ll res2 = 0;
		multiset<ll> ms;
		vector<ll> h(w); for (int i = 0; i < w; i++) scanf("%lld", &h[i]), res += h[i], ms.emplace(h[i]);
		vector<ll> t(d); for (int i = 0; i < d; i++) scanf("%lld", &t[i]);
		for (int i = 0; i < d; i++) {
			auto itr = ms.find(t[i]);
			if (itr == ms.end()) res += t[i];
			else ms.erase(itr);
		}
		cout << res << "\n";
	}
	return 0;

}


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) x.begin(),x.end()
#define f for
#define tn return
#define bk break
#define cn continue
#define ve vector
#define st string
#define ch char
#define ft first
#define sec second


void solve()
{
	int n,k;
	cin>>n>>k;
	vector<ll> V(n);
	for(int j=0;j<n;j++)
	cin>>V[j];
	
	double val=0;
	for(int j=0;j<k;j++)
	val+=log(V[j]);
	double temp=val;
	for(int j=k;j<n;j++)
	{
		temp=val;
		val-=log(V[j-k]);
		val+=log(V[j]);
		if(val>temp)
		cout<<"Yes"<<endl;
		else
		cout<<"No"<<endl;
	}
}


int main()
{
	fastio
	solve();
}

Measured memory_bytes: 4748