akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

const long long MAX_V = 1010101;

struct edge {
  long long to, cost;
};

using Pll = pair<long long, long long>;

long long V;
vector<edge> Graph[MAX_V];
long long dist[MAX_V];

void dijkstra(long long s) {
  priority_queue<Pll, vector<Pll>, greater<Pll>> que;
  // fill(dist, dist + V, INF);
  // 1-indexedの場合
  fill(dist + 1, dist + 1 + V, INF);
  dist[s] = 0;
  que.push(Pll(0, s));

  while (!que.empty()) {
    auto elem = que.top();
    que.pop();

    auto cv = elem.second;

    if (elem.first > dist[cv]) {
      continue;
    }

    for (auto e : Graph[cv]) {
      if (dist[e.to] > dist[cv] + e.cost) {
        dist[e.to] = dist[cv] + e.cost;
        que.push(Pll(dist[e.to], e.to));
      }
    }
  }
}

ll N, M;

int main() {
  cin >> N >> M;
  V = N;
  repe(i, 1, M) {
    ll a, b;
    cin >> a >> b;

    Graph[a].push_back(edge{b, 1});
    Graph[b].push_back(edge{a, 1});
  }

  dijkstra(1);

  cout << "Yes" << endl;
  repe(i, 2, N) {
    for (auto e : Graph[i]) {
      if (dist[e.to] == dist[i] - 1) {
        cout << e.to << endl;
        break;
      }
    }
  }
}


Measured memory_bytes: 40036
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
#define mp make_pair
#define pb push_back
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
#define Sort(v) sort(all(v))
#define Rev(v) reverse(all(v))
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector<vector<type>>name(h,vector<type>(w));in(name)
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
template<class T>bool chmax(T &a, const T &b) {if(a<b){a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a){a=b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    bool f = true;
    rep(i,sz(s)){
        if(s[i]!=t[i]) f=false;

    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3620
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from collections import Counter,defaultdict,deque
# from itertools import permutations, combinations
# from heapq import heappop, heappush
# # input = sys.stdin.readline
# sys.setrecursionlimit(10**8)
# mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
al = inpl()
bl = inpl()
cl = inpl()
ans = 0
pre = -1
for a in al:
    ans += bl[a - 1]
    if(pre == a - 1):
        ans += cl[pre - 1]
    pre = a
print(ans)

Measured memory_bytes: 74568
#include <iostream>
#include <algorithm>
#include <vector>
#define fflush(stdout) flush
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


int main(void) {
	int n, wn, i, j, k, l, m[4] = {};
	ll w, v, vs[4][103] = {}, wb, w1, w2, w3, rw, ans, s;
	vector<ll> vt[4];

	scanf("%d%d", &n, &wn);
	for (i = 0; i < n; i++) {
		scanf("%lld%lld", &w, &v);
		if (i == 0) {
			wb = w;
		}
		vt[w - wb].push_back(v);
		m[w - wb]++;
	}

	for (i = 0; i < 4; i++) {
		for (j = 1; j <= m[i]; j++) {
			vs[i][j] = vt[i][j - 1];
		}
	}

	for (i = 0; i < 4; i++) {
		sort(vs[i] + 1, vs[i] + m[i] + 1, greater<ll>());
	}

	for (i = 0; i < 4; i++) {
		for (j = 1; j <= m[i]; j++) {
			vs[i][j] += vs[i][j - 1];
		}
	}

	ans = 0;
	for (i = 0; (wb + 1) * i <= wn; i++) {
		if (i > m[1]) break;
		w1 = (wb + 1) * i;
		for (j = 0; (wb + 2) * j + w1 <= wn; j++) {
			if (j > m[2]) break;
			w2 = (wb + 2) * j;
			for (k = 0; (wb + 3) * k + w1 + w2 <= wn; k++) {
				if (k > m[3]) break;
				w3 = (wb + 3) * k;
				l = min((ll)m[0], (wn - w1 - w2 - w3) / wb);
				s = vs[0][l] + vs[1][i] + vs[2][j] + vs[3][k];
				ans = max(ans, s);
			}
		}
	}

	printf("%lld\n", ans);

	return 0;
}

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

int main()
{
    ll a;
    cin >> a;

    cout << a + a * a + a * a * a << endl;
    return 0;
}


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

using namespace std;

int main() {
  int r;
  cin >> r;
  if (r < 1200) {
    cout << "ABC" << endl;
  } else if (r < 2800) {
    cout << "ARC" << endl; 
  } else {
    cout << "AGC" << endl; 
  }
}

Measured memory_bytes: 768
def get_dist(p1, p2):
    x1, y1 = p1
    x2, y2 = p2
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5

def solve():
    from itertools import combinations
    from math import factorial
    from sys import stdin
    f_i = stdin
    
    N = int(f_i.readline())
    points = tuple(tuple(map(int, f_i.readline().split())) for i in range(N))
    s = sum(get_dist(p1, p2) for p1, p2 in combinations(points, 2))
    print(s * 2 / N)

solve()

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

int main(){
  long long N,D;
  std::cin >> N >> D;
  
  int ans = 0;
  
  for(int i = 0;i < N ;i++){
    long long x,y;
    std::cin >> x >> y;
    
    if(x * x + y * y <= D * D){
      ans++;
    }
  }

    
    std::cout << ans << std::endl;
  
}

Measured memory_bytes: 3592
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int N;
        cin >> N;
        set<string> okid;
        for(int i = 0; i < N; ++i){
            string tmp;
            cin >> tmp;
            okid.insert(tmp);
        }
        int M;
        cin >> M;
        bool close = true;
        for(int i = 0; i < M; ++i){
            string tmp;
            cin >> tmp;
            if(okid.count(tmp)){
                if(close){
                    cout << "Opened by " << tmp;
                }else{
                    cout << "Closed by " << tmp;
                }
                close = !close;
            }else{
                cout << "Unknown " << tmp;
            }
            cout << endl;
        }
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}



Measured memory_bytes: 3252
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
 size_t strlen(const char *s);
#define rep(i,n) for(long long int i=0;i<n;i++)
#define sz(x) ((int)(x).size())

using namespace std;
struct ToUpper {
    char operator()(char c) { return toupper(c); }
};
struct ToLower {
    char operator()(char c) { return tolower(c); }
};
const int N=200010;
const int P=1000000007;
using ll = long long;

//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
//小さい方
long long int min(long long int a,long long int b){
	if(a>b){
		return b;
	}else{
		return a;
	}
}
//大きい方
long long int max(long long int a,long long int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ

/*
	memset(b, '\0', sizeof(b));
初期化*/

/*
	char s[N];
	strlen(s)
*/

/*
	if(  <  )puts("Yes");
	else puts("No");
*/

/*文字列比較
if(strcmp(name[i],s)==0)
*/

/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/

/*添字1がa個、2がb個
  vector<vector<ll>> map(a,vector<ll>(b));
*/

int main(){
  string s,t;
  cin>>s>>t;
  ll ans=0;
  rep(i, sz(s)){
    if(s.at(i)!=t.at(i)){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
int main()
  {string S; cin >> S;
  puts(S[0] == 'A' and count(begin(S) + 2, end(S) - 1, 'C') == 1 and count_if(begin(S), end(S), [](auto c){return isupper(c);}) == 2 ? "AC" : "WA");}

Measured memory_bytes: 3620
#include<cstdio>
#include<functional>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	int h,w,x,y,a,b;
	scanf("%d %d %d %d",&h,&w,&x,&y);
	a=h*w;
	b=x+y;
	if(a%2==1 && b%2==1)	printf("No\n");
	else printf("Yes\n");
	return 0;
}


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

using namespace std;
using ll = long long;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  int res = 0;
  for(int i = 1; i <= n; ++i) {
    string a = to_string(i);
    res += ((int) a.size()) % 2 == 1;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvld;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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


class R
{
public:
    string city;
    int score;
    int num;

    R(string city, int score, int num)
    {
        this->city = city;
        this->score = score;
        this->num = num;
    }

    bool operator<(R& r)
    {
        if (this->city != r.city)
        {
            return this->city < r.city;
        }
        else
        {
            return this->score > r.score;
        }
    }
};
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N;
    cin >> N;

    vector<R> v;
    rep(i, N)
    {
        string s;
        int p;
        cin >> s >> p;
        v.emplace_back(s, p, i + 1);
    }

    sort(all(v));

    for (auto x : v)
    {
        cout << x.num << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i < (n); i++)
#define ll long long
#define MOD 1000000007
using namespace std;
#define N 100000

main () {
  int n;
  scanf("%d", &n);

  //入力された値をカウントするためのマップ
  map<int, int> o_map;
  map<int, int> e_map;

  rep(i,n) {
    int v;
    map<int, int>& c_map = (i%2==0) ? o_map : e_map;
    cin >> v;
    auto itr = c_map.find(v);
    if (itr != c_map.end()) itr->second++;
    else c_map[v] = 1;
  }

  //構築されたマップから、カウント降順に並びなおすためのvector
  struct data {
    int key;
    int count;
  };
  vector<data> o_data;
  vector<data> e_data;

  for (auto& itr: o_map) {
    o_data.push_back({itr.first, itr.second});
  }
  for (auto& itr: e_map) {
    e_data.push_back({itr.first, itr.second});
  }

  sort(o_data.begin(), o_data.end(),
      [](const data &x, const data &y){return x.count > y.count;});
  sort(e_data.begin(), e_data.end(),
      [](const data &x, const data &y){return x.count > y.count;});

  //デバッグコード
#if 0
  cout << "Odds" << endl;
  for (auto& ptr: o_data) {
    cout << ptr.key << ": " << ptr.count << endl;
  }

  cout << "Evens" << endl;
  for (auto& ptr: e_data) {
    cout << ptr.key << ": " << ptr.count << endl;
  }
#endif

  // max_argが異なる場合は、単純に残りを書き換えるだけでよい
  if (o_data[0].key != e_data[0].key) {
    cout << n - o_data[0].count - e_data[0].count << endl;
  }
  // max_argが等しい場合は、片方をあきらめる。
  // 書き換えが少ない方を選べばよい。
  else {
    int i = n - o_data[0].count - e_data[1].count;
    int j = n - o_data[1].count - e_data[0].count;
    cout << min(i, j) << endl;
  }

  return 0;
}


Measured memory_bytes: 6136
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         998244353 
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
 
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}
void solve(){   
    int n,A = 0;
    cin >> n;
    vector<int>v(n+5);
    FOR(i,1,n+1){
        int x;
        cin >> x;
        v[i] = x;
        A ^= x;
    }
    FOR(i,1,n+1){
        v[i] = A^v[i];
        cout << v[i] << " ";
    }
}

signed main()
{
    showoff;
    int T = 1;
    //cin >> T;
    FOR(t,1,T+1){   
        solve();
        //cout << "\n";
    }
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...


Measured memory_bytes: 4756
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

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

// value


void solve() {

	int N, A, B;
	cin >> N >> A >> B;

	cout << min(N * A, B) << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n;cin>>n;
    int cnt[n]={};
    rep(i,n-1){
        int t;cin>>t;t--;
        cnt[t]++;
    }
    rep(i,n) cout<<cnt[i]<<endl;
    return 0;
}


Measured memory_bytes: 4412
#include <iostream>
#include <string>

using namespace std;


int main() {
	int a, b;

	cin >> a >> b;
	long double i;
	for (i = 1; i <= 10000; i++) {
		if ((int)(i * (long double)0.08) == a && (int)(i * (long double)0.1) == b) {
			break;
		}
	}

	if (i == 10001) cout << -1;
	else {
		cout << (int)i;
	}





	return 0;
}

Measured memory_bytes: 256
// fuck rating
// experience matters

#include <bits/stdc++.h>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double
#define pb push_back
#define mkpr make_pair
#define fi(i,a,b) for (int i=a;i<b;i++)
#define vll vector<ll>
#define vch vector<char>
#define vst vector<string>
#define vpll vector<pll>
#define vii vector<int>
#define vvl vector<vector<ll>>
#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define mxe(v) *max_element(v.begin(),v.end())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define mll map<ll, ll>
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)
#define nl "\n"
#define sp " "
#define sz(x)  (int)x.size()

using namespace std;

double PI = (acos(-1));
ll md = 1000000007;
//ll md = 998244353;
ll pw(ll a, ll b){ll c=1,m=a;while (b){if (b&1)c=(c*m);m=(m*m);b/=2;}return c;}
ll pwmd(ll a, ll b){ll c = 1, m = a;while (b){if (b & 1)c = ((c * m)) % md;m = (m * m) % md;b /= 2;}return c;}
ll modinv(ll n){return pwmd(n, md - 2);}
ll nc2(ll n){return (1ll * n * (n - 1)) / 2;}
ll nsum(ll n){return (1ll * n * (n + 1)) / 2;}
bool prime(ll a){for(int i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ceel(ll a,ll b){if(a%b==0) return a/b;else return a/b+1;}


#define MAX_SIZE 1005
void Sieve(vector<int> &primes){bool IsPrime[MAX_SIZE];memset(IsPrime, true, sizeof(IsPrime));
for (int p = 2; p * p < MAX_SIZE; p++){if (IsPrime[p] == true){
            for (int i = p * p; i < MAX_SIZE; i += p)IsPrime[i] = false;}}
    for (int p = 2; p < MAX_SIZE; p++)if (IsPrime[p])primes.push_back(p);}
        


vector<char> sml={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char> cap={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};



//---------VIPUL SHARMA----------\\


void solve(){
    ll n;
    cin>>n;
    vpll v;
    fi(i,0,n){
        ll x,y;
        cin>>x>>y;
        v.pb({x,y});
    }
    ll a=-2e10,b=-2e10,c=-2e10,d=-2e10;
    pll p,q,r,s;
    fi(i,0,n){
        if(v[i].ff+v[i].ss>a)p=v[i],a=p.ff+p.ss;
        if(-v[i].ff+v[i].ss>b)q=v[i],b=-q.ff+q.ss;
        if(v[i].ff-v[i].ss>c)r=v[i],c=r.ff-r.ss;
        if(-v[i].ff-v[i].ss>d)s=v[i],d=-s.ff-s.ss;
    }
    ll ans=-2e10;
    fi(i,0,n){
        ans=max(ans,abs(v[i].ff-p.ff)+abs(v[i].ss-p.ss));
        ans=max(ans,abs(v[i].ff-q.ff)+abs(v[i].ss-q.ss));
        ans=max(ans,abs(v[i].ff-r.ff)+abs(v[i].ss-r.ss));
        ans=max(ans,abs(v[i].ff-s.ff)+abs(v[i].ss-s.ss));
    }
    cout<<ans<<nl;
}



int main(){
    //vector<int> primes;
    //Sieve(primes);

    fast
    ll tests=1;
    //cin>>tests;
    while(tests--){
        solve();
    }
    
    return 0;
}










Measured memory_bytes: 7420
from collections import defaultdict

#素因数分解O(√n)
def primeFactor(n):
    res = defaultdict(lambda: 0)
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            res[i] += 1
            n = n // i
    if n != 1:
        res[n] = 1
    return res

import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

#重複組み合わせ
def combinations_with_replacement_count(n, r):
    return combinations_count(n + r - 1, r)

N, M = map(int, input().split())
mod = 10 ** 9 + 7

factors = primeFactor(M)

ans = 1
for v in factors.values():
    ans *= combinations_with_replacement_count(N, v)
    ans %= mod

print(ans)



Measured memory_bytes: 114908
// https://atcoder.jp/contests/abc080/tasks/abc080_c

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll N;
  cin >> N;

  VVL fs(N, VL(10));
  rep(i, N) rep(j, 10) { cin >> fs[i][j]; }

  VVL ps(N, VL(11));
  rep(i, N) rep(j, 11) { cin >> ps[i][j]; }

  ll res = -INF;

  rep(bit, 1 << 10) {
    if (bit == 0) continue;

    ll _res = 0;

    rep(i, N) {
      ll ct = 0;

      rep(j, 10) {
        ll open = (bit >> j) & 1;
        if (fs[i][j] && open) ct++;
      }

      _res += ps[i][ct];
    }

    chmax(res, _res);
  }

  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
 
using namespace std;
 
typedef unsigned long long ll;
typedef pair<int, int> pair_;
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
 
int main(){
   int n,m;
   cin >> n >>m;

   int total_n,total_m;

   total_n = n * (n-1) / 2;
   total_m = m * (m-1)/2;

   cout << total_m + total_n;
   
    return 0;
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
int a;
  int b;
  int c;
  cin >>a>>b>>c;
  if(b-a==c-b) {
cout <<"YES" << endl;
  }
else {
cout << "NO" << endl;
}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <cstring>

using namespace std;

int table[26][26];

int main(){
        while(true){
                int n;
                cin >> n;
                if(n == 0){ break; }
                memset(table, 0, sizeof(table));
                for(int i = 0; i < n; ++i){
                        string word;
                        cin >> word;
                        ++(table[word[0] - 'a'][word[word.size() - 1] - 'a']);
                }
                bool isNG = false;
                bool passed[26] = { false };
                for(int i = 0; i < 26; ++i){
                        int inCount = 0, outCount = 0;
                        for(int j = 0; j < 26; ++j){
                                inCount += table[i][j];
                                outCount += table[j][i];
                        }
                        if(inCount != outCount){
                                isNG = true;
                                break;
                        }
                        if(inCount == 0){ passed[i] = true; }
                }
                if(isNG){
                        cout << "NG" << endl;
                        continue;
                }
                queue<int> q;
                for(int i = 0; i < 26; ++i){
                        if(!passed[i]){
                                passed[i] = true;
                                q.push(i);
                                break;
                        }
                }
                while(!q.empty()){
                        int front = q.front();
                        q.pop();
                        for(int i = 0; i < 26; ++i){
                                if(table[front][i] && !passed[i]){
                                        passed[i] = true;
                                        q.push(i);
                                }
                        }
                }
                for(int i = 0; i < 26; ++i){
                        if(!passed[i]){
                                isNG = true;
                                break;
                        }
                }
                if(isNG){
                        cout << "NG" << endl;
                }else{
                        cout << "OK" << endl;
                }
        }
        return 0;
}

Measured memory_bytes: 916
goals = gets.split.map(&:to_i)[1..-1]

bamboos = $stdin.read.split.map(&:to_i)

ans = [0,1,2,3].product(*Array.new(bamboos.size-1, [0,1,2,3])).map do |arr|
  h = [0,0,0,0]
  mp = 0
  arr.each_with_index.map do |v, i|
    [v, i]
  end.group_by do |a|
    a[0]
  end.each do |v, a|
    h[v] = a.map{|i| bamboos[i[1]]}.inject(:+)
    mp += [(a.size-1)*10, 0].max if v < 3
  end
  if h[0..2].include?(0)
    nil
  else
    [0,1,2].map do |i|
      (goals[i] - h[i]).abs
    end.inject(:+) + mp
  end
end.compact.min

puts ans


Measured memory_bytes: 17184
import sys
input = sys.stdin.readline

def main():
    W, H, x, y = map(int, input().split())

    area = W * H / 2

    cenx = W / 2
    ceny = H / 2

    if x == cenx and y == ceny:
        print(area, '1')
    else:
        print(area, '0')

main()

Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {


    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int hei, wid;
		
		while(true){
			hei = scan.nextInt();//??????????????????
			wid = scan.nextInt();//?¨????????????????
			if(hei == 0 && wid == 0){//???????????????0???0????????\???????????????????????????
				break;
			}
			for(int cnt_hei = 0; cnt_hei < hei; cnt_hei++){//???#????????????
				for(int cnt_wid = 0; cnt_wid < wid; cnt_wid++){
					System.out.print("#");
				}
				System.out.println();
			}
			System.out.println();
		}
        scan.close();
    }

}

Measured memory_bytes: 33300
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Measured memory_bytes: 7668
#include<stdio.h>
    int main(void){
      int H,W,i,j,cou,cou2,S[5],Y,M;
      char A[1000];
      scanf("%d",&H);
      Y=H/100;
      M=H%100;
      if((M>0)&&(M<=12)&&(Y>0)&&(Y<=12)){
        printf("AMBIGUOUS");
      }else if((M>0)&&(M<=12)){
        printf("YYMM");
      }else if((Y>0)&&(Y<=12)){
        printf("MMYY");
      }else{
        printf("NA");
      }


     }
      

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

using namespace std;

typedef long long ll;

int main(){
	int n, m, c;
	cin >> n >> m >> c;
	int b[m];
	for(int i = 0; i < m; i++)cin >> b[i];
	int a;
	int ans = 0;
	for(int i = 0; i < n; i++){
		ll pre = 0;
		for(int j = 0; j < m; j++)cin >> a, pre += a*b[j];
		if(pre+c > 0)ans++;
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
class Main{
	public static void main(String[]args)throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb=new StringBuilder();
		
		while(true){
			String[] str=br.readLine().split(" ");
			int H=Integer.parseInt(str[0]);
			int W=Integer.parseInt(str[1]);
			
			if(H==0&&W==0) break;
			
			for(int i=0;i<H;i++){
				for(int j=0;j<W;j++){
					if(j%2==0){
						if(i%2==0){
							sb.append("#");
						}
						else{
							sb.append(".");
						}
					}
					else{
						if(i%2==0){
							sb.append(".");
						}
						else{
							sb.append("#");
						}
					}
				}
				sb.append("\n");
			}
			sb.append("\n");
		}
		System.out.print(sb);
	}
}

Measured memory_bytes: 25812
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1000000001;

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

int main() {
  int x, y, z;
  cin >> x >> y >> z;

  cout << z << " " << x << " " << y << endl;
  return 0;
}


Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let a = read!(i64);
    let s = rl();

    if a >= 3200 {
        println!("{}", s);
    } else {
        println!("red");
    }
}


Measured memory_bytes: 4352
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll mod=998244353;
ll n,ans=0,a[405][405],b[405],sum=0,i,j,k,u,fac[405],invfac[405],inv[405],dp[405][405],dp2[405][405],invv;
ll pow(ll a,ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
ll M(ll x){return x>=mod?x-mod:x;}
int main()
{
	scanf("%lld",&n);
	for(i=1;i<=n;i++)scanf("%lld%lld",&a[1][i],&b[i]),a[0][i]=1,sum+=a[1][i];
	for(i=2;i<=400;i++)for(j=1;j<=n;j++)a[i][j]=a[i-1][j]*a[1][j]%mod;
	fac[0]=1;
	for(i=1;i<=400;i++)fac[i]=fac[i-1]*i%mod;
	invfac[400]=pow(fac[400],mod-2LL);
	for(i=399;i>=0;i--)invfac[i]=invfac[i+1]*(i+1)%mod;
	for(i=1;i<=400;i++)inv[i]=pow(i,mod-2LL);
	dp[0][0]=1;
	for(i=1;i<=n;i++)
	{
		for(j=400;j>=0;j--)
		{
			if(j-a[1][i]<0)continue;
			for(k=400;k>=0;k--)
			{
				//printf("%lld %lld %lld\n",i,j,k);
				for(u=0;u<b[i]&&k-u>=0;u++)
				{
					dp2[j][k]=(dp2[j][k]+a[u][i]*invfac[u]%mod*(mod-1)%mod*dp2[j-a[1][i]][k-u])%mod;
					dp[j][k]=(dp[j][k]+a[u][i]*invfac[u]%mod*(mod-1)%mod*dp[j-a[1][i]][k-u])%mod;
				}
				if(k-(b[i]-1)>=0)dp2[j][k]=(dp2[j][k]+a[b[i]][i]*invfac[b[i]-1]%mod*(mod-1)%mod*dp[j-a[1][i]][k-(b[i]-1)])%mod;
				//if(j==1&&i==1&&k==0)printf("%lld\n",dp2[j][k]);
			}
		}
	}
	//printf("%lld\n",dp2[1][0]);
	for(i=1;i<=400;i++)
	{
		invv=inv[i];
		for(j=0;j<=400;j++,invv=invv*inv[i]%mod)
		{
			//if(i==1&&j==0)printf("#%lld\n",dp2[i][j]);
			//if(dp2[i][j])printf("%lld\n",dp2[i][j]);
			ans=(ans+sum*inv[i]%mod*dp2[i][j]%mod*fac[j]%mod*invv%mod*(j+1))%mod; 
		}
	}
	ans=M(mod-ans);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b,c;
  cin>>n;
  int d[n];
  for(int i=0;i<n;i++){
    cin>>a>>b>>c;
    if(a*a==(b*b+c*c)){
      d[i]=1;
    }
    else if(b*b==(a*a+c*c)){
      d[i]=1;
    }
    else if(c*c==(a*a+b*b)){
      d[i]=1;
    }
    else{
      d[i]=0;
    }
  }
  for(int i=0;i<n;i++){
    if(d[i]==1){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }
  }
}

Measured memory_bytes: 2952
#include<iostream>
using namespace std;
int a,b,ans;
int main()
{
	cin>>a>>b;
	if (a==0&&b==0)
	{
		cout<<"0"<<endl;
		return 0;
	}
	ans=(a-1)*(b-1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
    "fmt"
)

func f() {
    var s, t string
    fmt.Scan(&s)
    fmt.Scan(&t)
    
    for i, _ := range []byte(s) {
        if t[i:] + t[:i] == s {
            fmt.Println("Yes")
            return
        }
    }
    
    fmt.Println("No")
    return
}

func main() {
    f()
}

Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <string.h>

using namespace std;

int main(){
	int N;
	int a[(int)2e5];

	long long maxl = 0;

	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
		maxl += a[i];
	}
	long long add = a[0];
	maxl -= a[0];
	long long minl = abs(maxl - add);
	for (int i = 1; i < N-1; ++i) {
		maxl -= a[i];
		add += a[i];
		minl = min(minl, abs(maxl-add));
	}
	cout << minl << endl;

	return 0;
}


Measured memory_bytes: 1024
D = int(input())

C = list(map(int, input().split()))#下がりやすさ
S = [list(map(int, input().split())) for _ in range(D)]#増加分
T = [int(input()) for _ in range(D)]#コンテストの開催
Last = [-1] * 26

ans = 0

for i in range(D):
    t = T[i]
    ans += S[i][t-1]
    Last[t-1] = i 
    for k in range(26):
        ans -= C[k] * (i - Last[k])
    print(ans)

Measured memory_bytes: 68372
#include <iostream>

int main(void) {
    int k, a, b;

    std::cin >> k;
    std::cin >> a >> b;

    bool achieved = false;

    for (int i = a; i <= b; ++i) {
        if (i % k == 0) {
            achieved = true;
            break;
        }
    }

    if (achieved) {
        std::cout << "OK\n";
    } else {
        std::cout << "NG\n";
    }
}

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

using namespace std;

long long A[100010];

int main()
{
    int n;
    scanf("%d",&n);
    for ( int c=1 ; c<=n; c++ )
    {
        scanf("%lld",&A[c]);
    }
    long long mx = 2;
    long long xxx = 2;
    for ( int c=n ; c>=1 ; c-- )
    {
        long long mm = (mx-1) / A[c];
        mx = A[c]*(mm+1);
    }


    for ( int c=n-1 ; c>=1 ; c-- )
    {
        long long cal = xxx + A[c+1] - 1;
        long long mm = cal / A[c];
        xxx = mm * A[c];
    }


    long long mn = mx;
    for ( int c=1 ; c<=n ; c++ )
    {
        mn = (mn/A[c]) * A[c];
    }
    if ( mn != 2 )
    {
        printf("-1");
        return 0;
    }
    printf("%lld %lld",mx, xxx + A[1] - 1);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

struct Card {
  char suit, value;
};

bool operator==(const Card &lhs, const Card &rhs) {
  return lhs.suit == rhs.suit && lhs.value == rhs.value;
}

void dump(vector<Card> &C) {
  REP(i, C.size()) {
    if (i) cout << " ";
    cout << C[i].suit << C[i].value;
  }
  cout << endl;
}

void bubble_sort(vector<Card> &C) {
  REP(i, C.size()) {
    for (int j = C.size() - 1; j >= i; --j) {
      if (C[j].value < C[j - 1].value) {
        swap(C[j], C[j - 1]);
      }
    }
  }
}

void selection_sort(vector<Card> &C) {
  REP(i, C.size()) {
    auto minj = i;
    FOR(j, i, C.size()) {
      if (C[j].value < C[minj].value) minj = j;
    }
    swap(C[i], C[minj]);
  }
}

int main() {
  int N;
  cin >> N;
  vector<Card> C1(N);
  REP(i, N) cin >> C1[i].suit >> C1[i].value;
  auto C2 = C1;

  // bubble sort
  bubble_sort(C1);
  dump(C1);
  cout << "Stable" << endl;

  // selection sort
  selection_sort(C2);
  dump(C2);
  cout << (equal(C1.begin(), C1.end(), C2.begin()) ? "Stable" : "Not stable")
       << endl;
}


Measured memory_bytes: 3144
#include <stdio.h>

int main(){
  int n,i,zero=0,one=0,two=0;
  int a[100005],b[100005];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(a[i]%2!=0){
      b[i]=0;
      zero++;
    }else if(a[i]%4!=0){
      b[i]=1;
      one++;
    }else{
      b[i]=2;
      two++;
    }
  }
  if((one>0 && two>=zero) || (one==0 && two>=zero-1)){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
// #define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    int x;
    cin >> x;

    cout << 1-x << endl;

    return 0;
}


Measured memory_bytes: 3648
import java.io.*;

public class Main{
	public static void main(String[] args){
		BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
		String s;
		String[] t;
		int[] a=new int[2];
		double x;
		try{
			while((s=reader.readLine()) !=null){
				t=s.split(" ");
				for(int i=0;i<2;i++){
					a[i]=Integer.parseInt(t[i]);
				}
				x=(a[0]*a[1])/3.305785;
				System.out.println(x);
			}
		}catch(IOException e){
			System.out.println(e);
		}
	}
}

Measured memory_bytes: 17100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll h,w,dp[1005][1005];
char v[1005][1005];
int main(void){
    scanf("%lld%lld",&h,&w);
    for(int i=0;i<h;i++)scanf("%s",v[i]);
    dp[0][0]=1LL;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(v[i+1][j]!='#')dp[i+1][j]=(dp[i+1][j]+dp[i][j])%M;
            if(v[i][j+1]!='#')dp[i][j+1]=(dp[i][j+1]+dp[i][j])%M;
        }
    }
    printf("%lld\n",dp[h-1][w-1]);
}


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

struct L {
    int a, b, c;
    L(int a = 0, int b = 0, int c = 0): a(a), b(b), c(c) {}
};

// 上下左右に１マスずつ移動するための配列
// dx と dy は1つ要素がズレてるだけ．
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

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

    int n, m;
    cin >> n >> m;
    map<int , int> mapX, mapY;
    mapX[0] = 0;
    mapY[0] = 0;

    // 座標読み込み
    vector<L> lineH, lineV;
    REP(i, n) {
        int a, b, c;
        cin >> a >> b >> c;
        mapX[a] = 0;
        mapX[b] = 0;
        mapY[c] = 0;
        lineH.emplace_back(a, b, c);
    }
    REP(i, m) {
        int a, b, c;
        cin >> c >> a >> b;
        mapY[a] = 0;
        mapY[b] = 0;
        mapX[c] = 0;
        lineV.emplace_back(a, b, c);
    }

    vector<int> xs, ys; // 元の座標を求める用の座標
    // 圧縮用のマップ作成
    // 画像圧縮とは x が左から何本目ですか？が分かれば良い．
    for (auto& p : mapX) { // xs[mapX] とすると元のマップでの座標が分かる
        p.second = xs.size();
        xs.push_back(p.first);
    }
    for (auto& p : mapY) {
        p.second = ys.size();
        ys.push_back(p.first);
    }

    // 扱うグリッド．
    // 壁と普通の升目で2倍にする．
    int h = xs.size() * 2;
    int w = ys.size() * 2;

    vector<vector<int> > d(h, vector<int>(w)); // bfs 用の配列

    // それぞれの線を引いていく
    // 横線を引く
    REP(i, n) {
        int a = mapX[lineH[i].a] * 2;
        int b = mapX[lineH[i].b] * 2;
        int c = mapY[lineH[i].c] * 2;
        for (int x = a; x <= b; x++)
            d[x][c] = -1; // -1 は壁
    }
    // 縦線を引く
    REP(i, m) {
        int a = mapY[lineV[i].a] * 2;
        int b = mapY[lineV[i].b] * 2;
        int c = mapX[lineV[i].c] * 2;
        for (int y = a; y <= b; y++)
            d[c][y] = -1; // -1 は壁
    }

    // bfs 開始
    queue<P> q;
    int sx = mapX[0] * 2;
    int sy = mapY[0] * 2;
    d[sx][sy] = 1; // たどり着けのを1とする
    q.emplace(sx, sy);
    while(!q.empty()) {
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        // 上下左右を見る
        REP(v, 4) {
            int nextX = x + dx[v];
            int nextY = y + dy[v];
            if (nextX < 0 || nextX >= h) continue ;
            if (nextY < 0 || nextY >= w) continue ;
            if (d[nextX][nextY] != 0) continue ;
            d[nextX][nextY] = 1;
            q.emplace(nextX, nextY);
        }
    }

    ll ans = 0;
    // 全部のマスを確認する
    REP(x, h) REP(y, w) {
        if (d[x][y] != 1) continue ; // そのマスが到達不可能であれば無視する
        if (x == 0 || x == h - 1 || y == 0 || y == w -1) { // 端に到達すれば INF
            cout << "INF" << '\n';
            return 0;
        }
        // x か y が偶数なら壁なので飛ばす
        if (x % 2 == 0 || y % 2 == 0) continue ; // 今いるところが壁の行なら飛ばす
        ll ex = xs[x / 2 + 1] - xs[x / 2];  // xs[x / 2] が今いる場所の左下の元の座標
        ll ey = ys[y / 2 + 1] - ys[y / 2];
        ans += ex * ey;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 144456