akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
#include <iterator>
using namespace std;

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

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i, a, cont, next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i, a, b, step) repfn(i, a, i < b, i + step)
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

int main(int argc, char **argv)
{
  string s;
  while (cin >> s) {
    reverse(all(s));
    cout << s << endl;
  }
  return 0;
}

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

namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] hoge = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            if(hoge[0] == hoge[1])
            {
                Console.WriteLine(hoge[0] + hoge[1]);
            }
            else
            {
                Console.WriteLine((hoge.Max() * 2) - 1);
            }
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m ;
  cin >> n >> m ;
  vint num(m) ;
  vint dis(m-1) ;
  REP(i,m){
    cin >> num[i] ;
  }
  sort(ALL(num)) ;
  REP(i,m-1){
    dis[i] = num[i+1] - num[i] ;
  }
  
  sort(ALL(dis)) ;
  
  ll ans = 0 ;
  REP(i,m-n){
    ans += dis[i] ;
  }
  cout << ans <<endl ;
  
  
  
  
  return 0 ;
}




Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>

using namespace std;

int A,B,ans;
int data[4];

void solve(){
  for(int i = 1; i <= A; i++)
    if(A%i == 0)
      for(int j = 1; j <= B; j++)
	if(B%j == 0){
	  data[0] = i;
	  data[1] = A/i;
	  data[2] = j;
	  data[3] = B/j;
	  sort(data,data+4);

	  do{
	    int sum = 0;
	    for(int i = 1; i < 4; i++)
	      sum += (data[i]-data[i-1])*(data[i]-data[i-1]);
	    
	    if(ans == -1) ans = sum; 
	    else ans = min(ans,sum);
	  }while(next_permutation(data,data+4));
	}

  cout << ans << endl;
}

int main(){
  while(cin >> A >> B && A+B){
    ans = -1;
    solve();
  }

  return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (UB(c,x)-LB(c,x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DEL(v) decltype(v)().swap(v)
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
template<typename T1, typename T2> using P = pair<T1,T2>;
template<typename T> using V = vector<T>;
struct edge { int from, to; int cost; };
bool operator< (const edge &edge1, const edge &edge2) { return edge1.cost < edge2.cost; };
const double INF = 1e18;
const int MOD = 998244353;

template<typename T> ostream& operator << (ostream& s, const V<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}

int powM(int x, int n) {
   int res = 1;
   while (n > 0) {
      if ((n & 1) == 1) {
         res = mod(res * x);
      }
      x = mod(x * x);
      n >>= 1;
   }
   return res;
}

struct Point { int x, y; };
const Point operator- (const Point& p0, const Point& p1) { return (Point){ p0.x-p1.x, p0.y-p1.y }; };
const int operator* (const Point& p0, const Point& p1) { return p0.x*p1.y - p0.y*p1.x; };
bool isAligned(Point p0, Point p1, Point p) {
   return (p0-p)*(p1-p) == 0;
}
bool in(Point p0, Point p1, Point p) {
   return (p-p0).x*(p1-p).x >= 0 && (p-p0).y*(p1-p).y >= 0;
}

template<typename T1, typename T2> ostream& operator << (ostream& s, const P<T1,T2>& p) {
   s << "(" << p.first << "," << p.second << ")";
   return s;
}

signed main()
{
   int N; cin >> N;
   V<Point> p(N);
   REP(i, N) {
      cin >> p[i].x >> p[i].y;
   }

   int sum = 0;
   FOR(i, 0, N) {
      FOR(j, i+1, N) {
         int n = 2;
         FOR(k, 0, N) {
            if (i == k || j == k) continue;
            if (isAligned(p[i], p[j], p[k])) {
               if (!in(p[i], p[j], p[k])) {
                  n = -1; break;
               }
               n++;
            }
         }
         if (n != -1) {
            sum += powM(2,n) - n - 1;
         }
      }
   }

   int ans = mod(powM(2,N) - sum - N - 1);
   cout << ans << endl;

   return 0;
}


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

int main(){
    long long MOD = 1000000007;
    long long n;
    cin >> n;
    long long ans = 1;
    for(int i=0; i<n; i++) {
        ans = (ans * (i + 1) ) % MOD;
    }

    cout << ans << endl;

}

Measured memory_bytes: 3548
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    Int n;
    cin >> n;

    Int ans = 0;
    for (Int i = 0; i <= n; i++) {
        if (!(i % 3 == 0 || i % 5 == 0)) {
            ans += i;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int P = 1000000007;

ll powmod(ll n, ll k) {
    ll r = 1, t = n % P;
    for (; k != 0; k /= 2) {
        if (k & 1) r = r * t % P;
        t = t * t % P;
    }
    return r;
}

ll inv(int n) {
    int m = P, y = 0, v = 1;
    while (1) {
        int q = m / n;
        int r = m % n;
        if (r == 0) return v < 0 ? v + P : v;
        y -= v * q;
        swap(y, v);
        m = n;
        n = r;
    }
}

int comb2(int n, int k) {
    if (n < k || k < 0) return 0;
    ll t = 1;
    k = min(k, n - k);
    for (int i = 2; i <= k; i++) {
        t = (t * i) % P;
    }
    t = inv(t);
    for (int i = n - k + 1; i <= n; i++) {
        t = (t * i) % P;
    }
    return t;
}

vector<int> f0, f1;
void init(int n) {
    f0.resize(n + 1);
    f0[0] = 1;
    for (int i = 1; i <= n; i++) {
        f0[i] = (ll)f0[i - 1] * i % P;
    }
    f1.resize(n + 1);
    f1[n] = inv(f0[n]);
    for (int i = n; i > 0; i--) {
        f1[i - 1] = (ll)f1[i] * i % P;
    }
}
ll fact(int k) {
    return f0[k];
}
ll comb(int n, int k) {
    if (n < k || k < 0) return 0;
    return (ll)f0[n] * f1[k] % P * f1[n - k] % P;
}

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

    if (k < n - 1) {
        init(n);
        ll r = 0;
        for (int i = 0; i <= k; i++) {
            int m = n - i - 1;
            r += comb(n - 1, m) * comb(n, i) % P;
        }
        cout << r % P << endl;

    } else {
        cout << comb2(n + (n - 1), n) << endl;
    }

    //N-1回で全部できる 1回のときは場合分け なかった
    //2回以上N-2回以下はそれ以下でできたものはできる 0の個数がK個以下

    return 0;
}

Measured memory_bytes: 1792
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
	let M = parseInt(input[0][0], 10);
	let ans = -1;
	let tmp = 0;
	for (let i = 0; i < M; i++){
		ans += parseInt(input[i + 1][1],10);
		tmp += parseInt(input[i + 1][0],10) * parseInt(input[i + 1][1],10);
	}
	ans += Math.floor((tmp - 1) / 9);
	console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));




Measured memory_bytes: 77412
#include <iostream>

using namespace std;

int main(){
	
	cin.tie(0); ios_base::sync_with_stdio(0);
	int k,a,b;
	cin>>k>>a>>b;
	if(b/k>(a-1)/k)cout<<"OK\n";
	else cout<<"NG\n";
	
	return 0;
}

Measured memory_bytes: 3104
/**
 * @File   : atcoder.cpp
 * @Author : pasnger 
 * @Date   : 29/8/2020, 2:59:47 pm 
 */

#include<bits/stdc++.h>
using namespace std;
#define INF 1e17
#define int long long
#define f(i, a, b) for(int i=a; i<b; i++)
#define rf(i, a, b) for(int i=a; i>b; i--)
const int mod = 1e9+7;

#define deb(...) cerr << "[" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__) 
void DBG() {
  cerr << "]\n";
}
template<typename T, typename ...Args> void DBG(T first, Args... args) {
  cerr << first; if (sizeof...(args))cerr<<", "; DBG(args...);
}

int mul(int x,int y){
    int res = x*y;
    if(res >= mod)res%=mod;
    return res;
}

int add(int x, int y){
    int res = x+y;
    if(res >= mod)res-=mod;
    return res;
}
int sub(int x, int y){
    int res = x-y;
    if(res<0)res+=mod;
    return res;
}

/////////////////////////// GLOBAL ///////////////////////////

/////////////////////////// GLOBAL ///////////////////////////

void solve() {
  int n;
  cin>>n;
  int arr[n];
  f(i, 0, n) cin>>arr[i];
  int s[n];
  rf(i, n-1, -1){
    s[i] = (i!=n-1? add(s[i+1], arr[i]): (arr[i]));
  }

  int p = 0;
  f(i, 0, n){
    p = add(p, mul(arr[i], sub(s[i], arr[i])));
  }

  cout<<p%mod<<"\n";
}


int32_t main() {
  #ifndef ONLINE_JUDGE
  clock_t tStart = clock();
  freopen("in.txt", "r", stdin);
  //freopen("output.txt","w",stdout);
  #endif 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t=1;
  // cin >> t;
  for (int tt=1;tt<=t;tt++) {
    //cout << "Case #"<<tt<<": ";
    solve();
  }
  #ifndef ONLINE_JUDGE
    cerr << "\nRun Time -> "<<(double)(clock()-tStart)/CLOCKS_PER_SEC <<" sec\n";
  #endif
}


Measured memory_bytes: 6780
# string
# a, b, c = input().split()
# str_list = list(input().split())

# number
# a, b, c = map(int, input().split())
# num_list = list(map(int, input().split()))

# lows
# str_list = [input() for _ in range(n)]

# many inputs
# num_list = []
# for i in range(n): num_list.append(list(map(int, input().split())))

n = int(input())
if n % 9 == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9296
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
using namespace std;

#define REP(i,n) for(int i=0;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"

typedef long long ll;



int atcoder(){
    //入力
    int n;
    cin >> n;
    vector<ll> x;
    REP(i,n){
        ll tmp;
        cin >> tmp;
        x.push_back(tmp);
    }
    vector<ll> y=x;
    
    //処理
    sort(y.begin(),y.end());
    ll meds = y[n/2 -1];
    ll medl = y[n/2];

    //出力
    REP(i,n){
        if(x[i]<=meds) cout << medl << ENT;
        else cout << meds << ENT;
    }
    return 0;
}

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


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

int main() {
  long long X; cin >> X;
  for (long long a = -200; a <= 200; a++) {
    for (long long b = -200; b <= 200; b++) {
      if (pow(a, 5) - pow(b, 5) == X) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define MAGIC cin.tie(NULL); ios_base::sync_with_stdio(false)
#define endl '\n'
//#define ll long long
#define mod 1000000007
#define NCONS 100001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
#define int long long
//#define double long double
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
typedef long long ll;

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

#define YYYY cout << "YES" << endl
#define NNNN cout << "NO" << endl
#define yyyy cout << "Yes" << endl
#define nnnn cout << "No" << endl

int32_t main()
{
    MAGIC;
    int N; cin >> N;
    int ret = 1;
    for(int i = 1; i <= 3; i++)
        ret *= N;
  
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
//I am so vegetable
//#define err
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#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 _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = acos(-1.0);
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }

const int N = 2e5+5;
ll a[N],b[N];
signed main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
    #ifdef err
	double be = clock();
    #endif
    int n,m,k;cin>>n>>m>>k;
    _for(i,0,n){
        int x;cin>>x;
        a[i+1]=a[i]+x;
    }
    _for(i,0,m){
        int x;cin>>x;
        b[i+1]=b[i]+x;
    }
    int ans = 0;
    ll res;
    _for(i,1,n+1){
        res = k-a[i];
        if(res<0){
            if(i==1){
                int y = lower_bound(b,b+m+1,k)-b;
                if(y==m+1)y=m;
                else if(b[y]>k)--y;
                ans = max(ans,y);
                break;
            }
            else break;
        }else if(res==0)ans = max(i,ans);
        else{
            int y = lower_bound(b,b+m+1,res)-b;
            if(y==m+1)y=m;
            else if(b[y]>res)--y;
            ans = max(ans,y+i);
        }
    }
    _for(i,1,m+1){
        res = k-b[i];
        if(res<0){
            if(i==1){
                int y = lower_bound(a,a+n+1,k)-a;
                if(y==n+1)y=n;
                else if(a[y]>k)--y;
                ans = max(ans,y);
                break;
            }
            else break;
        }else if(res==0)ans = max(i,ans);
        else{
            int y = lower_bound(a,a+n+1,res)-a;
            if(y==n+1)y=n;
            else if(a[y]>res)--y;
            ans = max(ans,y+i);
        }
    }
    cout<<ans;
    #ifdef err
	double en = clock();
    cout<<"time: "<<fixed<<setprecision(8)<<en-be;
    #endif
	return 0;
}

Measured memory_bytes: 6740
def bubble_sort(arr)
  n = arr.length
  c = 0
  for i in 0..n - 1
    j = n - 1
    while j > i
      if arr[j-1] > arr[j]
        arr[j-1],arr[j] = arr[j],arr[j-1]
        c += 1
      end
      j -= 1
    end
  end
  [arr, c]
end

gets
a = gets.split.map(&:to_i)

arr,c=bubble_sort(a)
puts arr * ' '
puts c

Measured memory_bytes: 6104
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int N;
long long A[200010];
long long T[200010];

bool f(long long X) {
  for (int i=0; i<N; i++) {
    int j = i;
    j = lower_bound(T+j, T+i+N, X + (j > 0 ? T[j-1] : 0)) - T;
    if (j == i+N) continue;
    j++;

    j = lower_bound(T+j, T+i+N, X + (j > 0 ? T[j-1] : 0)) - T;
    if (j == i+N) continue;
    j++;

    if (T[i+N-1] - T[j-1] >= X) return true;
  }
  return false;
}

int main() {
  cin >> N;
  for (int i=0; i<N; i++) {
    long long a;
    cin >> a;
    A[i] = A[i+N] = a;
  }
  T[0] = A[0];
  for (int i=1; i<N+N; i++) {
    T[i] = T[i-1] + A[i];
  }

  long long lo = 0, hi = T[N+N-1];
  while (hi - lo > 1) {
    long long m = (lo + hi) / 2;
    if (f(m)) lo = m;
    else      hi = m - 1;
  }
  if (f(hi)) lo = hi;

  cout << lo << "\n";
  return 0;
}

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

using namespace std;

typedef long long int ll;

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

  int a, b, c;
  cin >> a >> b >> c;
  cout << max(0, c - (a - b)) << endl;
}


Measured memory_bytes: 3596
pr = [True] * 50001
for i in range(2,225):
    if pr[i]:
        for j in range(i * 2, 50001, i):
            pr[j] = False

prime = [2] + [i for i in range(3, 50001, 2) if pr[i]]

def gold_count(n):
    res = 0
    if pr[n - 2]:
        res += 1
    for i in range(3, n // 2 + 1, 2):
        if pr[i] and pr[n - i]:
            res += 1
    return res

while True:
    n = int(input())
    if n == 0:
        break
    print(gold_count(n))

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

const long long MOD = 1000000007;

void solve(long long N, std::vector<std::vector<int>> a) {
  vector<unordered_map<int, int64>> dp(N);
  for (auto i : a[0]) {
    dp[0][1 << i] = 1;
  }
  for (int i = 1; i < N; ++i) {
    for (auto&& stcnt : dp[i - 1]) {
      int state = stcnt.first;
      int64 cnt = stcnt.second;
      for (auto j : a[i]) {
        int sj = 1 << j;
        if (state & sj) continue;
        dp[i][state | sj] += cnt;
        dp[i][state | sj] %= MOD;
        // cerr << "dp[" << i << "][" << (state | sj)
        //      << "] = " << dp[i][state | sj] << endl;
      }
    }
  }
  int64 ans = 0;
  for (auto&& stcnt : dp[N - 1]) {
    ans = (ans + stcnt.second) % MOD;
  }
  cout << ans << endl;
}

int main() {
  int64 N;
  cin >> N;
  std::vector<std::vector<int>> a(N);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      int x;
      cin >> x;
      if (x) {
        a[i].push_back(j);
      }
    }
  }
  sort(a.begin(), a.end(),
       [](auto& v1, auto& v2) -> bool { return v1.size() < v2.size(); });
  solve(N, std::move(a));
}


Measured memory_bytes: 89588
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

template <ll mod> class ModInt {
    ll a;
public:
    constexpr ModInt(const ll a = 0) noexcept : a((a % mod + mod) % mod) {}
    constexpr ll &value() noexcept { return a; }
    constexpr ModInt operator + (const ModInt &rhs) const noexcept { return ModInt(*this) += rhs; }
    constexpr ModInt operator - (const ModInt &rhs) const noexcept { return ModInt(*this) -= rhs; }
    constexpr ModInt operator * (const ModInt &rhs) const noexcept { return ModInt(*this) *= rhs; }
    constexpr ModInt operator / (const ModInt &rhs) const noexcept { return ModInt(*this) /= rhs; }
    constexpr ModInt &operator += (const ModInt &rhs) noexcept {
        a += rhs.a;
        if (a >= mod) a -= mod;
        return *this;
    }
    constexpr ModInt &operator -= (const ModInt &rhs) noexcept {
        a += mod - rhs.a;
        if (a >= mod) a -= mod;
        return *this;
    }
    constexpr ModInt &operator *= (const ModInt &rhs) noexcept {
        a = a * rhs.a % mod;
        return *this;
    }
    constexpr ModInt pow(ll t) const noexcept {
        if (t == 0) return 1;
        auto ret = pow(t >> 1);
        ret *= ret;
        if (t & 1) ret *= *this;
        return ret;
    }
    constexpr ModInt inv() const noexcept { return pow(mod - 2); }
    constexpr ModInt operator /=(const ModInt &rhs) { return (*this) *= rhs.inv(); }
    constexpr bool operator == (const ModInt &rhs) const noexcept { return this->a == rhs.a; }
    constexpr bool operator != (const ModInt &rhs) const noexcept { return this->a != rhs.a; }
    friend constexpr ostream &operator << (ostream &os, const ModInt &rhs) noexcept { return os << rhs.a; }
    friend constexpr istream &operator >> (istream &is, ModInt &rhs) {
        is >> rhs.a;
        return is;
    }
};
using mint = ModInt<MOD>;

class Combination {
public:
    vector <mint> fac, inv, fiv;
    Combination(int N) : fac(N + 1), inv(N + 1), fiv(N + 1) {
        fac[0] = inv[0] = fiv[0] = fac[1] = inv[1] = fiv[1] = 1;
        for (ll i = 2; i <= N; i++) {
            fac[i] = fac[i - 1] * i; // n!
            inv[i] = inv[MOD % i] * (MOD - MOD / i); // n^-1
            fiv[i] = fiv[i - 1] * inv[i]; // (n!)^-1
        }
    }
    mint C(ll n, ll k) {
        if (k < 0 || n < k) return 0;
        return fac[n] * fiv[k] * fiv[n - k];
    }
    mint P(ll n, ll k) {
        if (k < 0 || n < k) return 0;
        return fac[n] * fiv[n - k];
    }
    mint H(ll n, ll k) {
        if (n == 0 && k == 0) return 1;
        return C(n + k - 1, k - 1);
    }
};

int main() {
    ll n, k;
    cin >> n >> k;
    Combination com(2005);
    cout << com.C(n + k - 1, n) << endl;
    return 0;
}


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

void solve(long long N, long long D, std::vector<long long> X, std::vector<long long> Y)
{
    long long cnt = 0;
    for (long long i = 0; i < N; i++)
    {
        //cout << (X[i] * X[i] + Y[i] * Y[i]) << " " << D * D << endl;
        if ((X[i] * X[i] + Y[i] * Y[i]) <= D * D)
        {
            cnt++;
        }
    }
    cout << cnt << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long D;
    cin >> D;
    std::vector<long long> X(N);
    std::vector<long long> Y(N);
    for (int i = 0; i < N; i++)
    {
        cin >> X[i];
        cin >> Y[i];
    }
    solve(N, D, std::move(X), std::move(Y));
    return 0;
}


Measured memory_bytes: 6484
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
#include<cstdlib>
#include<typeinfo>
#define int long long int 
using namespace std;
#define INF 1000000005

signed main()
{
std::string s;
std::cin >> s;
int l = s.length();
int num[10];
for(int i = 0; i < l; i++){
    num[i] = (int)(s[i] - '0');
}
int sum = 0;
int flag = 0;
while(flag < pow(2,l - 1)){
    int temp = 0;
    temp += num[0];
    for(int i = 0; i < l - 1; i++){
        if(!(flag & (1 << i)) ){
            temp = 10 * temp + num[i + 1];
        } else {
            sum += temp;
            temp = num[i + 1];
        }
    }
    sum += temp;
    flag++;
}

std::cout << sum << std::endl;
return 0;
}

Measured memory_bytes: 256
// AOJ 1243 Weather Forecast
// 2018/1/21

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int n, ans;
int date[367];
int cd[4];
char mk[367][10][8][8][8][8];
int pos[12] = {0,1,2,3,0,4,5,6,0,7,8,9};
int mv[9][2] = {{0,0},{0,1},{0,-1},{1,0},{-1,0},{0,2},{0,-2},{2,0},{-2,0}};

char check(int k, int x, int y, int *cd)
{
	int a, b, c, d;

	a = ((x - 1) << 2) + y;
	b = (x << 2) + y;
	c = ((x - 1) << 2) + y + 1;
	d = (x << 2) + y + 1;
	if (x < 1 || x > 3 || y < 1 || y > 3) return 0;
	if (cd[0] >= 7 || cd[1] >= 7 || cd[2] >= 7 || cd[3] >= 7) return 0;
	if (((1<<a) & date[k]) || ((1<<b) & date[k]) || ((1<<c) & date[k]) || ((1<<d) & date[k])) return 0;
	if (mk[k][pos[a]][cd[0]][cd[1]][cd[2]][cd[3]]) return 0;
    return 1;
}

void dfs(int k, int x, int y, int *cd)
{
	int i, j, t, x2, y2;
	int a[5];

	if (k == n) { ans = 1; return; }
	for (i = 0; i < 9; i++) {
		if (!k && i) break;
		t = k + 1;
		x2 = x + mv[i][0];
		y2 = y + mv[i][1];
		for (j = 0; j < 4; j++) a[j] = cd[j] + 1;
		if (x2 == 1 && y2 == 1) a[0] = 0;
		if (x2 == 1 && y2 == 3) a[1] = 0;
		if (x2 == 3 && y2 == 1) a[2] = 0;
		if (x2 == 3 && y2 == 3) a[3] = 0;
		if (check(t, x2, y2, a)) {
			mk[t][pos[((x2-1)<<2)+y2]][a[0]][a[1]][a[2]][a[3]] = 1;
			dfs(t, x2, y2, a);
		}
	}
}

int main ()
{
	int i, j;
	char buf[40], *p;

	while (fgets(buf, 10, stdin) && *buf != '0') {
		n = atoi(buf);

		memset(date, 0, sizeof(date));
		for (i = 1; i <= n; i++) {
			fgets(p=buf, 40, stdin);
			for (j = 1; j <= 16; j++) {
				while (*p < '0') p++;
				date[i] |= (*p++ & 0xf) << j;
			}
		}

		memset(mk, 0, sizeof(mk));
		memset(cd, 0, sizeof(cd));
		ans = 0;
		dfs(0, 2, 2, cd);
		putchar('0'+ans), putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 16288
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    int n;
    int sum = 0;
    int num;
    
    cin >> n;

    for (int i = 1; i <= n; i++) {
        sum += i;
        if (sum >= n) {
            num = sum-n;
            sum = i;
            break;
        }
    }

    for (int i = 1; i <= sum; i++) {
        if (i != num) {
            cout << i << endl;
        }
    }

    return (0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> x(m);
    for(int i=0;i<m;i++){
        cin>>x.at(i);
    }
    sort(all(x));
    vector<int> y(m-1);
    for(int i=0;i<m-1;i++){
        y.at(i)=x.at(i+1)-x.at(i);
    }
    sort(all(y));
    ll ans=0;
    for(int i=0;i<m-n;i++){
        ans+=y.at(i);
    }
    cout<<ans<<endl;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

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

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

#define MAX_N 3000003

inline int modPow(int x, int n) {
  if(n == 0) return 1;
  int res = modPow(x, n/2);
  (res *= res) %= mod;
  if(n&1) (res *= x) %= mod;
  return res;
}
inline int modInv(int a) {
  return modPow(a, mod-2);
}
inline int modComb(int n, int r) {
  static int fact[MAX_N], inv[MAX_N];
  if(fact[0] == 0) {
    fact[0] = inv[0] = 1;
    reps(i, 1, MAX_N) {
      fact[i] = fact[i-1]*i % mod;
      inv[i] = modInv(fact[i]);
    }
  }
  if(r < 0 || n < r) return 0;
  return fact[n]*inv[r]%mod*inv[n-r]%mod;
}
inline int Homo(int n, int r) {
  return modComb(n+r-1, r);
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int A, B, C, Sx, Sy;
  while(cin >> A >> B >> C >> Sx >> Sy, A || B || C || Sx || Sy) {
    if(Sx < Sy || (Sx == Sy && A < B)) swap(Sx, Sy), swap(A, B);
    int diff = Sx - Sy;
    int game = modComb(A+B+C, A)*modComb(B+C, B)%mod; // ????????????????????´????????°
    int score = 0; // ?????°????????????????????´????????°
    if(A == 0) {
      if(B == 0 && Sx == Sy) score = Homo(C, Sx);
    } else if(B == 0) {
      score = Homo(A, diff-A)*Homo(A+B+C, Sy)%mod; // Y????????????????????????????????????+1?????\???
    } else {
      reps(i, max(A, diff+B), Sx+1) {
	score += Homo(A, i-A)*Homo(B, i-diff-B)%mod*Homo(A+B+C, Sx-i)%mod;
	score %= mod;
      }
    }
    cout << game*score%mod << endl;
  }

  return 0;
}

Measured memory_bytes: 49900
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = 1e9;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
/*--------------------template--------------------*/

int main() {
    ll N, M;
    cin>>N>>M;
    vi v1(M),v2(M);
    REP(i,M)cin>>v1[i]>>v2[i];   
    REP(i,M){
        vector<vi> d(N,vi(N, INF));
        REP(j,M){
            if(i==j)continue;
            ll va=v1[j]-1;
            ll vb=v2[j]-1;
            d[va][vb]=1;
            d[vb][va]=1;
        }
        REP(l,N)REP(j,N)REP(k,N){
            d[j][k]=min(d[j][k],d[j][l]+d[l][k]);
        }
        bool ok=true;
        FOR(j,1,N){
            if(d[0][j]==INF){
                ok=false;
                break;
            }
        }
        if(!ok)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
int const INF = 1001001001;


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

int N; cin >> N;
vector<long long> A(N);
for (int i = 0; i < N; ++i) cin >> A[i];
sort(A.begin(), A.end(), greater<long long>());

if (N % 2 == 0) {
    long long res = 0;
    for (int i = 0; i < N/2 - 1; ++i) res += A[i] * 2;
    res += A[N/2 - 1];
    res -= A[N/2];
    for (int i = N/2 + 1; i < N; ++i) res -= A[i] * 2;
    cout << res << endl;
    }
    else {
    long long res1 = 0;
    for (int i = 0; i < N/2 - 1; ++i) res1 += A[i] * 2;
    res1 += A[N/2 - 1] + A[N/2];
    for (int i = N/2 + 1; i < N; ++i) res1 -= A[i] * 2;

    long long res2 = 0;
    for (int i = 0; i < N/2; ++i) res2 += A[i] * 2;
    res2 -= A[N/2] + A[N/2 + 1];
    for (int i = N/2 + 2; i < N; ++i) res2 -= A[i] * 2;
    cout << max(res1, res2) << endl;
    }

return 0;
}

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

int main()
{
double a , b , h , m ;
cin >> a >> b >> h >> m ;
ans=sqrt(a*a+b*b-2*a*b*cos((30*h+0.5*m-6*m)/360*2*3.14159265358));
cout<<fixed<<setprecision(12)<<ans<<endl;
return 0;
}

Measured memory_bytes: 4196
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <iterator>

int main(void){
    using namespace std;
    int n;
    cin >> n;

    vector<int> w(n);
    for (int i = 0; i < n;i++)
        cin >> w[i];

    for (int i = 1; i < n; i++)
        w[i] += w[i - 1];

    for (int i = 1; i < n - 1;i++)
        w[i] = abs(w[n - 1] - w[i] * 2);

    cout << *min_element(++w.begin(), w.end()) << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main{

	public static void main(String[] args) throws IOException {
		
		int N = readInt(), Y= readInt();
		
		for(int i = 0; i<=N; i++) {
			for(int j = 0; j<=N-i; j++) {
				if(1000*i + 5000*j + 10000*(N-i-j) == Y) { println((N-i-j) + " " + j + " " + i); exit();}
			}
		}
		println("-1 -1 -1");
		exit();
	}

	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}

	static long readLong() throws IOException {
		return Long.parseLong(next());
	}

	static float readFloat() throws IOException {
		return Float.parseFloat(next());
	}

	static boolean readBoolean() throws IOException {
		return Boolean.parseBoolean(next());
	}

	static short readShort() throws IOException {
		return Short.parseShort(next());
	}

	static byte readByte() throws IOException {
		return Byte.parseByte(next());
	}

	static int readInt() throws IOException {
		return Integer.parseInt(next());
	}

	static double readDouble() throws IOException {
		return Double.parseDouble(next());
	}

	static char readCharacter() throws IOException {
		return next().charAt(0);
	}

	static String readLine() throws IOException {
		return br.readLine().trim();
	}

	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	static void print(String s) {
		pr.print(s);
	}

	static void print(int s) {
		pr.print(s);
	}

	static void print(long s) {
		pr.print(s);
	}

	static void print(boolean s) {
		pr.print(s);
	}

	static void print(short s) {
		pr.print(s);
	}

	static void print(byte s) {
		pr.print(s);
	}

	static void print(double s) {
		pr.print(s);
	}

	static void print(char s) {
		pr.print(s);
	}

	static void print(float s) {
		pr.print(s);
	}

	static void println(String s) {
		pr.println(s);
	}

	static void println(int s) {
		pr.println(s);
	}

	static void println(long s) {
		pr.println(s);
	}

	static void println(boolean s) {
		pr.println(s);
	}

	static void println(short s) {
		pr.println(s);
	}

	static void println(byte s) {
		pr.println(s);
	}

	static void println(double s) {
		pr.println(s);
	}

	static void println(char s) {
		pr.println(s);
	}

	static void println(float s) {
		pr.println(s);
	}

	static void flush() {
		pr.flush();
	}

	static void exit() throws IOException {
		br.close();
		pr.close();
		System.exit(0);
	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 1000;

int w[MAX_N];
int a[MAX_N];
int pos[10001];		//?????????????????????????????????????????¢???????????????????????????
bool flag[MAX_N];	//???????????????i???????????°???????????????????????????????????????
vector<int> loop;

int main()
{
	int n,ans=0;
	cin >> n;
	rep(i,n){
		scanf("%d",&w[i]);
		a[i] = w[i];
		pos[w[i]] = i;
	}
	fill(flag,flag+n,false);
	sort(a,a+n);
	rep(i,n){
		loop.clear();
		int x = i;
		while(1){
			if(flag[x] == false){
				loop.push_back(w[x]);
				flag[x] = true;
				x = pos[a[x]];
			}else{
				break;
			}	
		}
		int suml = 0;
		int minl = INF;
		if(loop.size() >= 2){
			rep(j,loop.size()){
				suml += loop[j];
				minl = min(minl,loop[j]);
			}
			ans += min(suml+minl*(loop.size()-2),suml+minl+a[0]*(loop.size()+1));
		}
	}
	cout << ans << "\n";	
}

Measured memory_bytes: 3232
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long ll;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define FOR(i, start, end) for(ll i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

int main(void) {
    char c;
    scanf("%c", &c);

    if (c >= 'A' && c <= 'Z') {
        cout << "A" << endl;
    } else {
        cout << "a" << endl;
    }

    return 0;
}

Measured memory_bytes: 3000
#include <iostream>
#include<cstdio>
#include <cstring>	// require memset
#include <fstream>	// require freopen

using namespace std;

const int MaxW = 1500000;
int m, n;	// {IÌi 1  m  20, {Ìª 1  n  100
int w[100];

bool calc_m (int curr_w )
{
	int l[20];
	memset (l, 0, sizeof (l ) );

	int j = 0;
	for (int i = 0; i < n; i++ ){
		while (j < m && l[j] + w[i] > curr_w )
			j++;
		if (j == m )
			return false;
		l[j] += w[i];
	} // end for

	return true;
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.persistence", "r", stdin );

	for (;; ){// {IÌ ans  1500000
		scanf ("%d%d", &m, &n ); if (!m ) break;
		memset (w, 0, sizeof (w ) );

		for (int i = 0; i < n; i++ ){
			scanf ("%d", w+i );
		} // end for
		int l = w[0];
		int r = MaxW;
		int mid = 0;
		int res = MaxW;
		while (l <= r ){
			mid = (l+r)/2;
			if (calc_m (mid ) ){
				res = min (res, mid );
				r = mid-1;		
			}else{
				l = mid+1;
			} // end if
		} // end while
		cout << res << endl;
	} // end loop
		
	return 0;
}

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

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

  int64_t ans = n;
  for (int64_t i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ans = min(ans, i + n / i - 2);
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main(void){
  int c1,c2,c3;
  while(cin>>c1>>c2>>c3){
    map<int,int> deck;
    for(int i=1;i<=10;i++){
      deck[i]=1;
    }
    deck[c1]-=1;
    deck[c2]-=1;
    deck[c3]-=1;
    double prob=0;
    for(int i=1;i<=20-c1-c2;i++){
      prob+=(double)(deck[i])/7;
    }
    if(prob>=0.5){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3092
x1, y1, x2, y2 = map(int, input().split())
 
x3 = x2-(y2-y1)
y3 = y2+(x2-x1)
x4 = x3-(y3-y2)
y4 = y3+(x3-x2)
 
print(x3,y3,x4,y4)

Measured memory_bytes: 61612
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
//
int main() {
  int i,a,b;
  cin >> i;
  vector<int> c(i);
  //cerr << i << endl;
  for(int j = 0;j < i;j++){
    cin >> a >> b;
    //cerr << a << " " << b << endl;
    if(a == b){
      c.at(j) = a;
    } else {
      c.at(j) = 0;
    }
    cerr << c.at(j) << endl;
  }
  int s = 0;
  for(int k = 0;k < i;k++){

    if(c.at(k) != 0) s++;
    if(c.at(k) == 0) s = 0;
    if(s == 3){
      cout << "Yes" << endl;
      return 0;
    }
    
  }
  cout << "No" << endl;
  return 0;
  
}

Measured memory_bytes: 3504
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

//素因数分解
vector<pair<ll,int>> factorize(ll n) {
    vector<pair<ll,int>> res;
    ll N = n;
    for (ll i = 2; i * i <= N; i++) {
        if (n % i != 0) continue;
        res.emplace_back(i,0);
        while (n % i == 0) {
            n /= i;
            res.back().second++;
        } 
    }
    if (n != 1) res.emplace_back(n,1);
    return res;
}

int main() {
    int n; cin >> n;
    map<ll,ll> mp;
    for (int i = 2; i <= n; i++) {
        vector<P> p = factorize(i);
        rep(j,p.size()) {
            mp[p[j].first] += p[j].second;
        }
    }
    ll ans = 1;
    for (pair<ll,ll> p : mp) {
        ans *= p.second+1;
        ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def resolve():
    s=input()
    nen=int(s[:4])
    getu=0
    if s[5]==0:
        getu=int(s[6])
    else:
        getu=int(s[5:7])

    if nen>2019:
        print('TBD')
    elif nen==2019 and getu>=5:
        print('TBD')
    else:
        print('Heisei')
resolve()

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

int main() {
  int a,b,c,d,e,f,g;
  cin>>a>>b>>c>>d>>e>>f;
  g=min(a,min(b,min(c,min(d,e))));
  a-=g;
  b-=g;
  c-=g;
  d-=g;
  e-=g;
  if(f<a||f<b||f<c||f<d||f<e){
    cout<<":("<<endl;
  }
  else{
    cout<<"Yay!"<<endl;
  }
}

Measured memory_bytes: 256
#include <utility>
#include <cstdio>
int main(int argc, char **argv) {
    int a,b;
    for(int i=1;;i++){
        scanf("%d %d",&a,&b);
        if(a==0 && b==0) break;
        if(a>b) std::swap(a,b);
        printf("%d %d\n",a,b);
    }
}



Measured memory_bytes: 2592
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
    # combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
# mod = 998244353
INF = 1<<50

def readInt():
    return list(map(int,input().split()))

def main():
    x,k,d = readInt()
    count = abs(x) // d
    mn = 0
    if count>k:
        mn = abs(x) - (d * k)
        print(mn)
        return
    else:
        mn = abs(x) % d
    ans = INF
    if (k-count)%2==0:
        ans = mn
    else:
        ans = abs(mn-d)
    print(ans)
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 9208
#include<bits/stdc++.h>
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define N 200005
#define M 1000000007
#define mod 998244353
using namespace std;


int main()
{
    __

    ll r,c;

    cin >> r >> c;

    if(r==1 || c==1) cout << 1;

    else if((r*c)%2) cout << ((r*c)/2)+1;

    else cout << ((r*c)/2);

    return 0;
}


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


int main(){
  int N;
  cin >> N;
  int ans = 0;
  int pre = 0;
  int cur;
  for(int ii=0; ii<N; ii++){
    cin >> cur;
    if(pre > cur) ans += pre-cur;
    pre = cur;
  }
  ans += pre;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back
#define REP(i,a,b) for(int i=a; i<=b; i++)
#define MOD 1000000007

bool all(string &t,char c) {
	for(char ch:t)if(ch!=c)return false;
	return true;
}

void solve(int test_case) {//209
	string s;
	cin>>s;
	int cnt = INT_MAX;
	vi arr(26,0);
	for(char c:s)arr[c-'a']++;
	for(char c='a';c<='z';c++) {
		if(arr[c-'a']>0) {
			int nc = 0;
			string t=s;
			while(!all(t,c)) {
				nc++;
				string u;
				for(int i=0;i<(int)t.length()-1;i++) {
					if(t[i]==c||t[i+1]==c)u+=c;
					else u+=t[i];
				}
				t=u;
			}
			cnt=min(cnt,nc);
		}
	}
	cout<<cnt;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	//prefill();
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3596
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String s=sc.nextLine();

int a=Integer.parseInt(s);
       s=sc.nextLine();
      
int b=Integer.parseInt(s);


int[] data={1,2,3};
for(int i=0;i<3;i++){
if(data[i]==a)data[i]=0;
if(data[i]==b)data[i]=0;

}

for(int i=0;i<3;i++){
if(data[i]!=0)
System.out.println(data[i]);
}



	}
}

Measured memory_bytes: 21972
board = [list(map(int,input().split())) for i in range(3)]
num = int(input())
for n in range(num):
    bi = int(input())
    for i in range(3):
        for j in range(3):
            if board[i][j] == bi:
                board[i][j] = 0

#横
for i in range(3):
    if board[i][0] == board[i][1] == board[i][2] == 0:
        print("Yes")
        exit()
#縦
for i in range(3):
    if board[0][i] == board[1][i] == board[2][i] == 0:
        print("Yes")
        exit()

if board[0][0] == board[1][1] == board[2][2] == 0:
    print("Yes")
    exit()
if board[0][2] == board[1][1] == board[2][0] == 0:
    print("Yes")
    exit()

print("No")

Measured memory_bytes: 9200
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var n float64
	var d float64
	scanner.Scan()
	input := scanner.Text()
	split := strings.Split(input, " ")

	n, _ = strconv.ParseFloat(split[0], 32)
	d, _ = strconv.ParseFloat(split[1], 32)

	output := n / (d*2.0 + 1.0)

	fmt.Println(int(math.Ceil(output)))
}

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

using namespace std;

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

	int n;
	cin>>n;
	vector<int>A(n),B(n);
	for(int i=0;i<n;++i)
		cin>>A[i]>>B[i];

	sort(begin(A),end(A));
	sort(begin(B),end(B));
	int ans=0;
	if(n&1)
	{
		ans=B[n/2]-A[n/2]+1;
	}
	else
	{
		ans=(B[n/2]+B[(n-2)/2])-(A[n/2]+A[(n-2)/2])+1;
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 4780
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N, X, T = map(int, input().split())
print((N + X - 1) // X * T)



Measured memory_bytes: 10832