akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

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

    int n; cin >> n;

    map<int, int> mp;

    reps(i, 2, n+1){
        int ntemp = i;

        int div = 2;
        while(ntemp > 1){
            if(ntemp % div != 0){
                div++;
                continue;
            }

            ntemp /= div;
            mp[div]++;
        }
    }

    // for(auto x : mp){
    //     cout << x.first << " " << x.second << endl;
    // }

    int ans = 0;

    for(auto x : mp){
        if(x.second >= 74){
            ans++;
        }
    }
    
    for(auto x1 : mp){
        for(auto x2: mp){
            if(x1.first >= x2.first) continue;

            if(x1.second >= 24 && x2.second >= 2){
                ans++;
            }
            if(x1.second >= 14 && x2.second >= 4){
                ans++;
            }
            if(x1.second >= 2 && x2.second >= 24){
                ans++;
            }
            if(x1.second >= 4 && x2.second >= 14){
                ans++;
            }
        }
    }

    for(auto x1 : mp){
        for(auto x2 : mp){
            if(x1.first >= x2.first ) continue;

            for(auto x3 : mp){
                if(x2.first >= x3.first) continue;

                // cout << x1.first << " ";
                // cout << x2.first << " ";
                // cout << x3.first << endl;
                // cout << " " << x1.second << " ";
                // cout << x2.second << " ";
                // cout << x3.second << endl;

                if(x1.second >= 4 && x2.second >= 4 && x3.second >= 2){
                    ans++;
                }
                if(x1.second >= 4 && x2.second >= 2 && x3.second >= 4){
                    ans++;
                }
                if(x1.second >= 2 && x2.second >= 4 && x3.second >= 4){
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
class Prpgram
{
    static void Main(string[] args)
    {
        string input = Console.ReadLine();
        string[] inputlist = input.Split(' ');

        int K = int.Parse(inputlist[0]);
        int X = int.Parse(inputlist[1]);

        if(500 * K >= X){

            Console.Write("Yes");

        }
        else
        {
            Console.Write("No");

        }
    }
}

Measured memory_bytes: 11092
/*
          , -- 、
        /;;;;;;', 　　　
        i二二二i
      , ' 　    ヽ ???
     i　ﾉﾉﾉﾉﾉﾍ .', 　　
     〉ﾘi' ﾟ ヮﾟﾉﾚく　 WAyon..........
  ○⊂}〈lﾄ--ｲl〉{つ● 　　
      ,ｒ/ー i-ヽヽ 　　　
     ｀｀i_ﾗi_ﾗ
*/

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const int INF=(int)1e12;
const int mod=(int)1e9+7;
#define all(a) (a).begin(),(a).end()
typedef vector<vector<int>> graph;

#define pb push_back

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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



signed main () {
    int n;cin >>n;
    vector<string> s(n);
    vector<int> cnt(4);
    rep(i,n){
        cin >>s[i];
        if(s[i]=="AC")cnt[0]++;
        else if(s[i]=="WA")cnt[1]++;
        else if(s[i]=="TLE")cnt[2]++;
        else cnt[3]++;
    }
    cout <<"AC x "<<cnt[0]<<endl;
    cout <<"WA x "<<cnt[1]<<endl;
    cout <<"TLE x "<<cnt[2]<<endl;
    cout <<"RE x "<<cnt[3]<<endl;
}





Measured memory_bytes: 6420
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  cout << 24 - n + 24 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
inline void add(int &x, int y) {
	x += y;
	if(x >= mod) x -= mod;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int h, w, k;
	cin >> h >> w >> k;
	vector<vector<int>> dp(h + 1, vector<int>(w));
	dp[0][0] = 1;
	for(int i = 1; i <= h; i++) {
		for(int j = 0; j < (1 << (w - 1)); j++) {
			bool valid = true;
			bitset<7> b(j);
			for(int l = 0; l < 6; l++) {
				if(b[l] && b[l + 1]) valid = false;
			}
			if(!valid) continue;
			vector<int> c(w);
			iota(c.begin(), c.end(), 0);
			for(int l = 0; l < w - 1; l++) {
				if((j >> l) & 1) swap(c[l], c[l + 1]);
			}
			for(int l = 0; l < w; l++) {
				add(dp[i][c[l]], dp[i - 1][l]);
			}
		}
	}
	cout << dp[h][k - 1] << endl;
	return 0;	
}


Measured memory_bytes: 256
import numpy as np 
N = int(input())
A = np.fromstring(input(), dtype = np.int64, sep = ' ')

res = 0
for bit in range(60):
  c = int((A & 1).sum())
  res += c * (N - c) * (1 << bit)
  A >>= 1

print(res % 1000000007)

Measured memory_bytes: 29124
#include <bits/stdc++.h>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy -2147382637
#define bql 2147483647
#define ll long long
#define ull unsigned long long
#define ld long double
#define il inline
#define sz(x) x.size()
#define maxn 100010
#define rp(i, l, r) for (int i = l; i <= r; i++)
#define rb(i, r, l) for (int i = r; i >= l; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;
ll max(ll a,ll b){if(a>b)return a;else return b;}
ll min(ll a,ll b){if(a<b)return a;else return b;}
ll lowbit(ll x){return x&(-x);}
ll prime(ll x){
   if(x<=1)return false;
   for(int i=2;i<=int(sqrt(x));i++){
	   if(x%i==0)return false;
   }return true;
}
bool cmp(ll a,ll b){return a>b;}
ll gcd(ll a,ll b){ll r;while(b>0){r=a%b;a=b;b=r;}return a;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline ll read() {
	char c = getchar(); ll w = 1; ll x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
	x *= w;
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
int main(){
	fast;
	string s;
	cin>>s;
	if(s=="Sunny")cout<<"Cloudy"<<endl;
	else if(s=="Cloudy")cout<<"Rainy"<<endl;
	else cout<<"Sunny"<<endl;
}/*『你强归你强，我永不示弱』*/




Measured memory_bytes: 256
code = r"""
# distutils: language=c++
# distutils: include_dirs=/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include
# cython: boundscheck=False
# cython: wraparound=False
from libcpp cimport bool
from libcpp.vector cimport vector
cdef extern from "/opt/atcoder-stl/atcoder/dsu.hpp" namespace "atcoder" nogil:
    cdef cppclass dsu:
        dsu(int n)
        int merge(int a, int b)
        bool same(int a, int b)
        int leader(int a)
        int size(int a)
        vector[vector[int]] groups()

from cython.parallel cimport prange
from libc.stdio cimport scanf, printf
cdef int i
cdef int N, Q
cdef int t, u, v
scanf("%d%d", &N, &Q)
cdef dsu *d = new dsu(N)
for i in prange(Q, nogil=1):
    scanf("%d%d%d", &t, &u, &v)
    if t == 0:
        d.merge(u, v)
    else:
        printf("%d\n", d.same(u, v))
"""
import os
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    open('solve.pyx', 'w').write(code)
    os.system('cythonize -i -3 -b -j 18 solve.pyx')
import solve

Measured memory_bytes: 10768
def f(n: int) -> bool:
    if n % 2 == 0:
        if n % 3 == 0 or n % 5 == 0:
            return True
        else:
            return False
    else:
        return True


N = int(input())
A = list(map(int, input().split()))

if all(map(f, A)):
    print("APPROVED")
else:
    print("DENIED")


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

using namespace std;
using ll = long long;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

void solve(std::string s){
  ll ans = 0;
  vector<ll> v(s.size(), 0);
  for(int i=0; i<s.size(); i++) {
    if(s[i]=='A')
      v[i] = 1;
  }
  for(int i=0; i<s.size(); i++) {
    if(s[i]=='A') {
      int j=i;
      while(j+2<s.size() and s[j+1]=='B' and s[j+2]=='C') {
	ans += v[i];
	j+=2;
      }
      if(s[j+1] == 'A')
	v[j+1] += v[i];
    }
  }
  std::cout << ans << std::endl;
}

int main(){
  std::string s;
  std::cin >> s;
  solve(s);
  return 0;
}


Measured memory_bytes: 2308
$0=0;$N=<>;$/=$";++${-$_}>2||$N%2==$_%2||$0>1||$_>$N-1 and $e=1 for<>;
if($e){
	print 0,v10;
}else{
	$x=1;
	$x*=2,$x%=1000000007for 1..$N>>1;
	print$x,v10
}


Measured memory_bytes: 32768
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nm[0];
        var m = nm[1];
        Console.WriteLine("Yes");

        List<int>[] graph = Enumerable.Repeat(0, n).Select(_ => new List<int>()).ToArray();
        for (int i = 0; i < m; i++)
        {
            var st = Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
            graph[st[0]].Add(st[1]);
            graph[st[1]].Add(st[0]);
        }

        int[] res = new int[n];
        res[0] = -1;
        Queue<int> stack = new Queue<int>();
        stack.Enqueue(0);
        while (stack.Count != 0)
        {
            var elem = stack.Dequeue();
            foreach (var item in graph[elem])
            {
                if (res[item] != 0) continue;
                res[item] = elem + 1;
                stack.Enqueue(item);
            }
        }


        Console.WriteLine(string.Join("\n", res.Skip(1)));
    }
}


Measured memory_bytes: 52816
#include<stdio.h>
#include<math.h>
#define PI 3.1415926535898


int a,b;
double x,y,c;

int main(){
	x=y=0.0;c=0.0;
	while(scanf("%d,%d",&a,&b)!=EOF){
		if(a==0 && b==0)break;
		x+=(double)a*sin(M_PI*c/180.0);
		y+=(double)a*cos(M_PI*c/180.0);
		c+=(double)b;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	
	return 0;
}

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;


int main() {

  ll N, Q;
  string S;
  cin >> N >> Q >> S;
  vector<ll> l(Q), r(Q), res(S.length());
  REP(i, Q){
    int l_, r_;
    cin >> l_ >> r_;
    l_--; r_--; 
    l[i] = l_;
    r[i] = r_;

  }



  int ans = 0;
  for(int j = 0; j+1 <  S.length(); j++){
    if(S[j] == 'A' && S[j+1] == 'C'){
      ans++;
    }
    res[j+1] = ans;
  }
  // REP(i, S.length()){
  //   cout << res[i] << " " ;
  // }
  REP(i, Q){
    cout << res[r[i]] - res[l[i]] << endl;
  }
    
  




}


/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 3456
#include<iostream>
#include<vector>
#include<climits>
#include<algorithm>
using namespace std;

#define NONE INT_MAX>>1
vector< vector<int> > WarshallFloyd(vector< vector<int> >A)
{
  for(int k=0;k<A.size();k++)
    for(int i=0;i<A.size();i++)
      for(int j=0;j<A.size();j++)
        A[i][j]=min(A[i][j],A[i][k]+A[k][j]);
  return A;
}

int main()
{
  int n,N;
  int a,b,c;
  while(cin>>n,n){
    vector< vector<int> > m(10,vector<int>(10,4000));
    N=0;
    for(int i=0;i<10;i++)m[i][i]=0;
    for(int i=0;i<n;i++){
      cin>>a>>b>>c;
      m[a][b]=m[b][a]=c;
      N=max(N,max(a,b));
    }
    N++;
    m=WarshallFloyd(m);

    int ans1=0;
    int ans2=INT_MAX;
    for(int i=0;i<N;i++){
      int sum=0;
      for(int j=0;j<N;j++){
	sum+=m[i][j];
      }
      if(ans2>sum){
	ans1=i;
	ans2=sum;
      }
    }
    cout<<ans1<<" "<<ans2<<endl;
  }
}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <vector>
#include <queue>
using namespace std;

const int maxn = 100007;

int n, x[maxn], d, ans;

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}

int main() {
	scanf("%d%d", &n, &x[0]);
	for(int i = 1;i <= n;i++) scanf("%d", &x[i]);
	sort(x, x + n + 1);
	for(int i = 1;i <= n;i++) d = x[i] - x[i - 1], ans = i == 1 ? d : gcd(d, ans);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main() {
	int a[100];
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	cout << a[n-1];
	for (int i = n-2; i >= 0; i--) {
		cout << ' ' << a[i] << flush;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define LL long long

int main(){
	// sengen
	int n;
	// nyuryoku
	cin >> n;
	int p[n];
	for(int i=0;i<n;i++){
		cin >> p[i];
	}
	// keisan
	int ans = 0;
	for(int i=0;i<n-2;i++){
		if(p[i] < p[i+1] && p[i+1] < p[i+2]){
			ans++;
		}
		if(p[i] > p[i+1] && p[i+1] > p[i+2]){
			ans++;
		}
	}
	// syutsuryoku
	cout << ans << endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique((c).begin(), (c).end()), (c).end());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


const int MOD = 1e9 + 7;


inline LL mod_add(LL a, LL b) {
    return (a + b) % MOD;
}

inline LL mod_sub(LL a, LL b) {
    return (a + MOD - b) % MOD;
}

inline LL mod_mul(LL a, LL b) {
    return ((a % MOD) * (b % MOD)) % MOD;
}

LL mod_bipow(LL x, LL y) {   // power using bisection method
    if (y == 0) return 1;
    else if (y == 1) return x % MOD;
    else if (y % 2 == 0) {
        LL val = mod_bipow(x, (LL)(y / 2));
        return mod_mul(val, val);
    } else {
        LL val = mod_bipow(x, (LL)(y / 2));
        return mod_mul(mod_mul(val, val), x);
    }
}

LL mod_inv(LL x) {   // compute x^{-1}=x^{MOD-2} (when MOD is a prime number) using Fermat theorem
    return mod_bipow(x, MOD - 2);
}

LL mod_div(LL a, LL b) {   // using a/b=a*b^{-1}
    return mod_mul(a, mod_inv(b));
}

void solve(LL H, LL W, LL A, LL B){
	LL n = H + W - 2;
	vector<LL> facts;   // k! for k=0,...,n
	facts.resize(n + 1);
	REP(i, n + 1) {
		if (i == 0) {
			facts[i] = 1;
		} else {
			facts[i] = mod_mul(facts[i - 1], i);
		}
	}
	vector<LL> inv_facts;   // (K!)^{-1} for k=0,...,n
	inv_facts.resize(n + 1);
	for (int i = n; i >= 0; i--) {
		if (i == n) {
			inv_facts[i] = mod_inv(facts[n]);   // =(n!)^{-1}
		} else {
			inv_facts[i] = mod_mul(inv_facts[i + 1], i + 1);   // (i!)^{-1}=((i+1)!)^{-1}*(i+1)
		}
	}

	vector<LL> J;
	J.resize(W);
	FOR(i, B, W) {
		J[i] = mod_mul(mod_mul(facts[H - A - 1 + i], inv_facts[H - A - 1]), inv_facts[i]);   // (0, 0) to (H-A-1, [B:W])
	}

	LL sum = 0;
	FOR(i, B, W) {
		sum = mod_add(sum, mod_mul(J[i], mod_mul(mod_mul(facts[W + A - 2 - i], inv_facts[W - 1 - i]), inv_facts[A - 1])));   // (H-A, [B:W]) to (H-1, W-1)
	}
	cout << sum << endl;
}


int main(){	
	LL W;
	LL B;
	LL A;
	LL H;
	scanf("%lld",&H);
	scanf("%lld",&W);
	scanf("%lld",&A);
	scanf("%lld",&B);
	solve(H, W, A, B);
	return 0;
}



Measured memory_bytes: 4096
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int A[3][3];
  rep(i,3) rep(j,3) cin >> A[i][j];
  int N, b[10];
  cin >> N;
  rep(i,N) cin >> b[i];
  rep(k,N) {
    rep(i,3) rep(j,3) {
      if (A[i][j] == b[k]) A[i][j] = 0;
    }
  }
  bool bingo = false;
  rep(i,3) {
    if (A[i][0] + A[i][1] + A[i][2] == 0) {
      bingo = true;
      break;
    }
    if (A[0][i] + A[1][i] + A[2][i] == 0) {
      bingo = true;
      break;
    }
  }
  if (A[0][0] + A[1][1] + A[2][2] == 0) bingo = true;
  if (A[0][2] + A[1][1] + A[2][0] == 0) bingo = true;
  if (bingo) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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


int main(){
  int n, y;
  cin >> n >> y;
  for(int i = 0; i <= n; i++) for(int j = 0; j <= n - i; j++){
    int k = n - i - j;
    if(y == 10000 * i + 5000 * j + 1000 * k){
      cout << i << " " << j << " " << k << endl;
      return 0;
    }
  }
  cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <stack>
#include <set>
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <typeinfo>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, a[100010], b[100010], c[100010], bc[100010] = {}, cnt = 0;
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < n; i++)cin >> b[i];
	for (int i = 0; i < n; i++)cin >> c[i];
	sort(a, a + n); sort(b, b + n); sort(c, c + n);
	for (int i = 0; i < n; i++) {
		while (a[cnt] < b[i]) {
			if (cnt == n)break;
			cnt++;
		}
		bc[i] = cnt;
	}
	cnt = 0;
	ll ans = 0, yojo = 0;
	for (int i = 0; i < n; i++) {
		while (b[cnt] < c[i]) {
			if (cnt == n)break;
			yojo += bc[cnt];
			cnt++;
		}
		ans += yojo;
	}
	cout << ans << endl;
	return 0;
}



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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int  long long
#define ll long long 
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define pie 3.14159265358
#define mod 998244353

bool sortbysec(const pair<int,int> &a, const pair<int,int> &b){ 
    return (a.second < b.second);}

ll fexp(ll a, ll b){ll ans = 1;while(b){if(b&1)ans=ans*a%mod; b/=2;a=a*a%mod;}return ans;}
ll inverse(ll a, ll p){return fexp(a, p-2);} 


void solve(){
    string s;cin>>s;
    int n=s.length();
    rep(i,0,n){
        if(s[i]=='?')cout<<"D";
        else cout<<s[i];
    }
    return;
}

signed main(){
    IOS;

    int n=1; 
    // cin>>n; 
    rep(i,0,n){
        solve();
        cout<<"\n"; 
    }

    return 0;
}



Measured memory_bytes: 3792
#!/usr/bin/env python3

def bfs(graph,start,end):
    queue = [start]
    visited = {}
    visited[start[0],start[1]] = 1
    while queue:
        i,j = queue.pop(0)
        if (i,j) == end:
            return visited[i,j]
        for di,dj in [(1,0),(-1,0),(0,1),(0,-1)]:
            if 0 <= i+di < len(graph) and\
                0 <= j+dj < len(graph[0]) and\
                graph[i+di][j+dj] != "#" and\
                (i+di,j+dj) not in visited:
                visited[i+di,j+dj] = visited[i,j] + 1
                queue.append((i+di,j+dj))
    return -1

def get_black_cnt(graph):
    return(sum([s.count("#") for s in graph]))


def solve(H,W,S):
    res = bfs(S,(0,0),(H-1,W-1))
    if res > 0:
        res = H*W-res-get_black_cnt(S)
    print(res)
    pass

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    H,W = list(map(int,input().split()))
    S = []
    for i in range(H):
        S.append(input())
    solve(H,W,S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
s = input()

if s == 'SUN':
    print(7)
elif s == 'MON':
    print(6)
elif s == 'TUE':
    print(5)
elif s == 'WED':
    print(4)
elif s == 'THU':
    print(3)
elif s == 'FRI':
    print(2)
else:
    print(1)


Measured memory_bytes: 3060
#include<stdio.h>

int main(){
	int a,b;
	scanf("%d", &a);
	scanf("%d", &b);
	if (a > b){
		printf("a > b\n");
	}
	else{
		if (a < b){
			printf("a < b\n");
		}
		else{
			printf("a == b\n");
		}
	}


	return 0;
}

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

using ll = long long;

int main() {
    string S;
    cin >> S;

    int len = S.size();

    // 1が独立

    ll ans = 0;
    for (int mask = 0; mask < (1 << len); mask++) {
        if (!((mask >> 0) & 1)) continue;
        vector<ll> numbers;
        ll num = 0;
        for (int idx = 0; idx < len; idx++) {
            if ((mask >> idx) & 1) {
                numbers.push_back(num);
                num = S[idx] - '0';
            } else {
                num *= 10;
                num += S[idx] - '0';
            }
        }
        numbers.push_back(num);

        ans += accumulate(numbers.begin(), numbers.end(), 0LL);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import sys

"""
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = read().rstrip().decode()
"""

N = int(input())
L = list(map(int,input().split()));
L.sort();

def solve():
    ret = 0
    for i in range(0,N-2):
      for j in range(i+1,N-1):
        for k in range(j+1,N):
          if L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k]:
            ret += 1
            #print(i,j,k)
    
    return ret

print(solve())

Measured memory_bytes: 9204
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main(){

int n;
double xa,ya,ra,xb,yb,rb,d;

cin>>n;
	
	for(int i=0;i<n;i++){
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		d=sqrt((xb-xa)*(xb-xa)+(yb-ya)*(yb-ya));
		if(d>ra+rb)cout<<0<<endl;
		else if(ra-rb>d)cout<<2<<endl;
		else if(rb-ra>d)cout<<-2<<endl;
		else cout<<1<<endl;
	}
	return 0;
}

Measured memory_bytes: 620
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Graph;

const double PI = 3.14159265358979323846;
const int mod = 1000000007;


int main(int argc, char *args[]) {
	int x; cin >> x;
	int ans = (x / 500) * 1000 + ((x % 500) / 5) * 5;
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define MAX 123456
typedef pair<int, int> pii;

int main()
{
    int N, L, x;
    cin >> N >> L;
    
    priority_queue<pii> pq;
    for (int i = 0; i < N; i++) {
        cin >> x;
        pq.push(pii(x, i + 1));
    }
    
    int dp[MAX] = {};
    while (!pq.empty()) {
        pii p = pq.top(); pq.pop();
        int f = p.first, s = p.second;
        dp[s] = max(dp[s-1], dp[s+1]) + (L - f);
    }

    cout << *max_element(dp + 1, dp + N + 1) << endl;
    return 0;
}

Measured memory_bytes: 4148
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
string S;
int K;
cin >> N >> K >> S;
if(S[K-1] == 'A'){
    S[K-1] = 'a';
}
else if(S[K-1] == 'B'){
    S[K-1] = 'b'; 
}
else if(S[K-1] == 'C'){
    S[K-1] = 'c';
}
cout << S << endl;
  
    return 0;
}

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

#define MAX_V 55
bool E[MAX_V][MAX_V];
bool reached[MAX_V];

void dfs(int v, int N) {
  reached[v] = true;
  for (int i = 0; i < N; i++) {
    if (!E[v][i] || reached[i]) continue;
    dfs(i, N);
  }
}

int main() {
  int N, M;
  cin >> N >> M;
  int a, b;
  vector<pair<int, int>> P(M);
  for (int i = 0; i < M; i++) {
    cin >> a >> b;
    a--; b--;
    P[i] = make_pair(a, b);
    E[a][b] = true;
    E[b][a] = true;
  }

  int ans = 0;
  for (auto p : P) {
    a = p.first; b = p.second;
    E[a][b] = false; E[b][a] = false;
    fill(reached, reached + MAX_V, false);
    dfs(0, N);
    for (int i = 0; i < N; i++) {
      if (!reached[i]) {
        ans++;
        break;
      }
    }
    E[a][b] = true; E[b][a] = true;
  }
  cout << ans << endl;
}

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

@SuppressWarnings("resource")
public static void main(String[] args) {
	Scanner sc =new Scanner(System.in);
	int K=sc.nextInt();
	long ans=0;
	for(long i=1;i<=K;i++) {
		for(long j=1;j<=K;j++) {
			for(long k=1;k<=K;k++) {
				ans+=gcd(gcd(i,j),k);
			}
		}
	}
	System.out.println(ans);
}

private static long gcd(long m, long n) {
    if(m < n) return gcd(n, m);
    if(n == 0) return m;
    return gcd(n, m % n);
}
}


Measured memory_bytes: 35764
import itertools
inf = float('inf')
a, b, c, d = map(int, input().split())

l1 = [a, b]
l2 = [c, d]

p = itertools.product(l1, l2)

max_num = -inf

for e1, e2 in p:
    max_num = max(max_num, e1*e2)
print(max_num)




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

#include <set>
#include <map>
#include <iomanip>

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()

using ll = long long;

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

	if (b <= 1)
	{
		cout << 0 << endl;
		return 0;
	}

	int sum = a;
	int ans = 1;
	while (sum < b)
	{
		sum += a - 1;
		ans++;
	}

	cout << ans << endl;

	return 0;
}

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

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long;
using pll = pair<ll, ll>;

template<typename T> T gcdraw(T a, T b)
{
    return a ? gcdraw(b%a, a) : b;
}

template<typename T> T gcd(T a, T b)
{
    const auto aa = abs(a), bb = abs(b);
    return aa > bb ? gcdraw(aa, bb) : gcdraw(bb, aa);
}

const ll MAXN = 1000001;
ll P[MAXN + 1];
bool B[MAXN + 1];

void makeLowestPrimeTable()
{
    for (ll i=2;i*i<=MAXN;++i)
    {
        if (P[i]) { continue; }
        for (ll j=i*2;j<=MAXN;j+=i) if(!P[j]) { P[j] = i; }
    }
}

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

    vector<ll> A(N);
    rep (i, N) { cin >> A[i]; }

    makeLowestPrimeTable();

    bool isPairwise = true;
    ll setwiseValue = A[0];

    for (ll i=0;i<N;++i)
    {
        for (ll x=A[i];x!=1;)
        {
            const auto p = P[x] ? P[x] : x;
            while ((x % p) == 0) { x /= p; }

            isPairwise &= !B[p];
            B[p] = true;
        }

        setwiseValue = gcd(setwiseValue, A[i]);
    }

    if (isPairwise)             { cout << "pairwise coprime" << endl; }
    else if (setwiseValue == 1) { cout << "setwise coprime" << endl; }
    else                        { cout << "not coprime" << endl; }

    return 0;
}


Measured memory_bytes: 19804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    ll a,b;
    cin>>a>>b;
    if (a!=1&&b!=1)cout<<1;
    else if (a!=2&&b!=2)cout<<2;
    else cout<<3;


}

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

using namespace std;

string a[32] = {"101", "000000", "000011", "10010001", "010001", "000001", "100101", "10011010", "0101", "0001", "110", "01001", "10011011", "010000", "0111", "10011000", "0110", "00100", "10011001", "10011110", "00101", "111", "10011111", "1000", "00110", "00111", "10011100", "10011101", "000010", "10010010", "10010011", "10010000"};
string b = " ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string c[32] = {"00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111", "01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111", "10000", "10001", "10010", "10011", "10100", "10101", "10110", "10111", "11000", "11001", "11010", "11011", "11100", "11101", "11110", "11111"};
string d = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";

int main(){
    string s;
    map<string, string> p, q;
    for(int i=0; i< 32; i++){p[a[i]] = b.substr(i, 1); q[d.substr(i, 1)] = c[i];}
    while(getline(cin, s)){
        string t, ret;
        for(int i=0; i< s.size(); i++) t += q[s.substr(i, 1)];
        for(int i=0; i< t.size(); i++){
            for(int j=min(8, (int)(t.size()-i)); 1 <= j; j--){
                if(p[t.substr(i, j)].size() != 0){
                    ret += p[t.substr(i, j)];
                    i += j-1;
                    break;
                }
            }
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 1256
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
#define inf 1e9
using namespace std;

const ll Mod = 998244353;
const int maxn = 1010000;

ll pw(ll x,ll k)
{
	ll re=1ll;
	for(;k;k>>=1,x=x*x%Mod) if(k&1)
		re=re*x%Mod;
	return re;
}
int n,m;
ll s[maxn],invs[maxn],inv[maxn];

void pre()
{
	s[0]=1ll;
	for(ll i=1;i<maxn;i++) s[i]=s[i-1]*i%Mod;
	invs[maxn-1]=pw(s[maxn-1],Mod-2);
	for(ll i=maxn-2;i>=0;i--) invs[i]=invs[i+1]*(i+1)%Mod;
}
ll C(const int i,const int j){return s[i]*invs[j]%Mod*invs[i-j]%Mod;}

int main()
{
	pre();
	scanf("%d%d",&n,&m);
	if(n<m) swap(n,m);
	ll ans=0;
	for(int i=1;i<=m;i++) (ans+=C(2*i,i)*C(n-i+m-i,n-i)%Mod)%=Mod;
	ll inv=pw(C(n+m,m),Mod-2);
	ans=ans*invs[2]%Mod*inv%Mod;
	(ans+=n)%=Mod;
	printf("%lld\n",ans);
	
	return 0;
}


Measured memory_bytes: 17792
#include <iostream>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <tuple>
using namespace std;
long long n, m, a[100009], b[100009], col[100009], g[100009], cnt; vector<long long>x[100009];
void dfs(int pos) {
	if (col[pos] >= 1)return;
	col[pos] = cnt; g[cnt]++;
	for (int i = 0; i < x[pos].size(); i++)dfs(x[pos][i]);
}
int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i]; x[a[i]].push_back(b[i]); x[b[i]].push_back(a[i]);
	}
	for (int i = 1; i <= n; i++) {
		if (col[i] == 0) { cnt++; dfs(i); }
	}
	long long W1 = n - g[col[1]], X1 = W1*(W1 - 1) / 2LL;
	for (int i = 0; i < m; i++) {
		if (col[a[i]] != col[1])X1--;
	}
	X1 += g[col[1]] * (g[col[1]] - 1) / 2;
	for (int i = 0; i < m; i++) {
		if (col[a[i]] == col[1])X1--;
	}

	long long W2 = n - g[col[2]], X2 = W2*(W2 - 1) / 2LL;
	for (int i = 0; i < m; i++) {
		if (col[a[i]] != col[2])X2--;
	}
	X2 += g[col[2]] * (g[col[2]] - 1) / 2;
	for (int i = 0; i < m; i++) {
		if (col[a[i]] == col[2])X2--;
	}
	cout << max(X1, X2) << endl;
	return 0;
}

Measured memory_bytes: 11904
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f3f3f3f3f
#define pi 3.1415926535898
#define N 200010
using namespace std;
const int mod=998244353;
int dp[3030][3030];
int a[N];
ll ans;
int main()
{
    int n,s;
    cin>>n>>s;
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    memset(dp,0,sizeof(dp));
    for(int i=1; i<=n; i++)
    {
        for(int j=0; j<=s; j++)
        {
            dp[i][j]=dp[i-1][j];
        }
        for(int j=a[i]; j<=s; j++)
        {
            dp[i][j]=(dp[i-1][j]+dp[i-1][j-a[i]])%mod;
        }
        dp[i][a[i]]=(dp[i][a[i]]+i)%mod;
        ans = (ans+dp[i][s])%mod;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 39512
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int res = 0;
        String s = sc.nextLine();

        for(int i=0; i<4; i++) {
            char c = s.charAt(i);
            if(c=='+') res++;
            else if(c=='-') res--;
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 20052
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N = 1e5 + 10;

int n, m, a[N], p[N], vis[N];
vector<int> vec;
LL x[N], k, d[N], res[N];

void dfs(int x) {
	vis[x] = 1;
	vec.push_back(x);
	if (!vis[p[x]]) dfs(p[x]);
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", &x[i]);
	}
	for (int i = 1; i < n; ++i)
		d[i] = x[i + 1] - x[i];
	scanf("%d%lld", &m, &k);
	for (int i = 1; i < n; ++i)
		p[i] = i;
	for (int i = 1; i <= m; ++i) {
		scanf("%d", &a[i]);
		swap(p[a[i] - 1], p[a[i]]);
	}
	for (int i = 1; i < n; ++i) {
		if (vis[i]) continue;
		vec.clear();
		dfs(i);
		int siz = vec.size();
		int del = k % siz;
		for (int j = 0; j < vec.size(); ++j) 
			res[vec[j]] = d[vec[(j + del) % siz]];
	}
	LL ans = x[1];
	printf("%lld\n", ans);
	for (int i = 1; i < n; ++i) {
		ans += res[i];
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 8440
#include<cstdio>
    #include<cmath>
    #include<cstring>
    #include<algorithm>
     
    int main()
    {
    	int X,Y,Z,S;
    	scanf("%d %d %d",&X,&Y,&Z);
    	S=(X-Z)/(Y+Z);
    	printf("%d",S);
    }

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <numeric>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    int count = 1;
    string p, q, s;
    int Pnum = 0, Qnum = 0;

    cin >> n;
    for(int i = 1; i <= n; ++i)
        s += to_string(i);

    for(int i = 0; i < n; ++i) {
        char buf;
        cin >> buf;
        p += buf;
    }

    for(int i = 0; i < n; ++i) {
        char buf;
        cin >> buf;
        q += buf;
    }

    do {
        if(!Pnum && s == p) Pnum = count;
        if(!Qnum && s == q) Qnum = count;
        if(Pnum && Qnum) break;
        ++count;
    } while(next_permutation(s.begin(), s.end()));

    cout << abs(Pnum - Qnum);
  	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int f[45]={0};
int makeFib(int n){
	int i;
	f[0]=1;
	f[1]=1;
	for(i=2;i<45;i++){
		f[i]=f[i-1]+f[i-2];
	}
	return f[n];
}
int main(void){
	int n;
	scanf("%d",&n);
	
	printf("%d\n",makeFib(n));
	
	
	return 0;
}

Measured memory_bytes: 1852
#import sys
#input = sys.stdin.readline
#template input
import bisect

def IT(): #整数1個
    return int(input())
def IL(): #整数複数
    return [int(_) for _ in input().split()]
def IS(): #文字列複数
    return [_ for _ in input().split()]
def ILS(n): #整数1つ　縦にズラーってなってるやつ
    return [int(input()) for _ in range(n)]
def SLS(n): #文字列　縦にズラーってなってるやつ
    return [input() for _ in range(n)]
def ILSS(n): #整数複数　縦にズラーってなってるやつ
    return [[int(_) for _ in input().split()] for j in range(n)]

#template technique
def bit_full_search(ss):
    n = len(ss)
    for i in range(1 << n):
        s = ""
        for j in range(n + 1):
            if ((1 & i >> j) == 1):
                s += ss[j]
        print(s)

def bit_full_search2(A):
    #https://blog.rossywhite.com/2018/08/06/bit-search/
    value = []
    for i in range(1 << len(A)):
        output = []

        for j in range(len(A)):
            if ((i >> j) & 1) == 1:
                #output.append(A[j])
                output.append(A[j])
        value.append([format(i, 'b').zfill(16), sum(output)])

    value.sort(key=lambda x:x[1])
    bin = [value[k][0] for k in range(len(value))]
    val = [value[k][1] for k in range(len(value))]
    return bin, val

def matching_bisect(list1_val, list2_val, n):
    #2分探索
    j = 0
    for i in range(len(list1_val)):
        j = bisect.bisect_left(list2_val, n - list1_val[i])
        if j < len(list2_val):
            if list1_val[i] + list2_val[j] == n:
                #ans = list2_bin[j] + list1_bin[i]
                break
    return j

"""ここからメインコード"""
def main():
    n, l, t = IL()
    xw = ILSS(n)

    first_ant_number = 1
    first_ant_direction = xw[0][1]
    first_ant_position0 = xw[0][1]
    if first_ant_direction == 1:
        first_ant_position = (xw[0][0] + t) % l
    else:
        first_ant_position = (xw[0][0] - t) % l

    for i in range(n):
        if xw[i][1] == 1:
            first_ant_number = i + 1
            first_ant_position0 = xw[i][0]
            first_ant_position = (xw[i][0] + t) % l
            first_ant_direction = xw[i][1]
            break

    for i in range(n):
        if first_ant_direction != xw[i][1]:

            if t <= ((xw[i][0] - first_ant_position0) % l )/ 2:
                hit_count = 0
            else:
                dt =((xw[i][0] - first_ant_position0) % l )
                hit_count = 1 + int((2 * t - dt - 0.001) // l)
            first_ant_number = (first_ant_number + hit_count) % n
            if first_ant_number == 0:
                first_ant_number = n

    ant_position = []
    for i in range(n):
        if xw[i][1] == 1:
            pos = (xw[i][0] + t) % l
        else:
            pos = (xw[i][0] - t) % l
        ant_position.append(pos)
    ant_position.sort()

    ans = [0 for i in range(n)]
    for i in range(n):
        if first_ant_position == ant_position[i]:
            start = i
            break
    for i in range(n):
        ans[(first_ant_number - 1 + i) % n] = ant_position[(start + i) % n]

    for i in range(n):
        print(ans[i])

main()



Measured memory_bytes: 24132
#include<bits/stdc++.h>
using namespace std;
int N, M, K;
int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a%b);
}
int main()
{
	scanf("%d%d%d", &N, &M, &K);
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= M; j++) {
			if (N*j + M*i == K + 2 * i*j) {
				printf("Yes\n");
				return 0;
			}
		}
	}
	printf("No\n");
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      long[] arr = new long[n];
      for(int i = 0; i < n; i++)
        arr[i] = sc.nextInt();

      int cnt = 0;
      for(long a : arr) {
        while(a % 2 == 0) {
          cnt++;
          a /= 2;
        }
      }

      System.out.println(cnt);
  }
}


Measured memory_bytes: 37908
import sys
for line in sys.stdin.readlines():
  l = [int(i) for i in line.split(',')]
  l.sort()
  n =sum([l.count(i) for i in l])
  if n == 17:
    print('four card')
  elif n == 13:
    print('full house')
  elif n == 11:
    print('three card')
  elif n == 9:
    print('two pair')
  elif n == 7:
    print('one pair')
  elif max(l)-min(l)==4 or (l[1] == 10 and l[0]==1):
    print('straight')
  else:
    print('null')

Measured memory_bytes: 7624
N = int(input())
balls = [list(map(int, input().split(" "))) for i in range(N)]
balls.sort()

if N == 1:
    print(1)
else:
    vec = []
    for i in range(N-1):
        for j in range(i+1, N):
            vec.append((balls[j][0] - balls[i][0], balls[j][1] - balls[i][1]))
    vec.sort()
    cntmax = 1
    cnt = 1
    prev = None
    for v in vec:
        if prev == v:
            cnt += 1
            cntmax = max(cnt, cntmax)
        else:
            cnt = 1
        prev = v
    print(N - cntmax)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main() {
	IOS;
	ll n,k;
	cin >> n >> k;
	vector<ll> h(n);
	REP(i, n) {
		cin >> h[i];
	}
	sort(all(h));
	chmin(k, n);
	
	ll res = 0;
	REP(i, n - k) {
		res += h[i];
	}
	put(res);
	return 0;
}


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

signed main() {
  int N, K; cin >> N >> K;
  vector<int> x(N);
  rep(i, N) cin >> x[i];
  
  int z = 0;
  while(z < N-1 && x[z] < 0) z++;
  
  if(z == 0) cout << x[K-1] << endl;
  else if(z == N-1) cout << -x[N-K] << endl;
  else {
    int ans = pow(10, 17);
    rep(i, K) {
      if(z-i >= 0 && z+K-i-1 <= N-1) {
        ans = min(ans, x[z+K-i-1]+abs(2*x[z-i]));
        ans = min(ans, 2*x[z+K-i-1]+abs(x[z-i]));
      }
    }
    cout << ans << endl;
  }

}

Measured memory_bytes: 1024
N, K = map(int, input().split())
R,S,P = map(int, input().split())
T = input()
point = {"r":P, "s":R, "p":S}
score = 0
flg = [0]*N #勝ちを譲った時flgを立てる
for i in range(K):
    score += point[T[i]]
for i in range(K,N):
    # K回前と同じ手かつ、K回前に譲っていなければ譲る必要がある flgを立てる
    if T[i] == T[i-K] and flg[i-K]==0:
        flg[i] = 1
    else:
        score += point[T[i]]
print(score)

Measured memory_bytes: 4084
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
typedef pair<pii, int>p;
const int maxn=1e5+100;
int n, m;
vector<p>Q;
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0);
    cin>>n>>m;
    for(int i=0; i<m; i++)
    {
        int a, b;
        cin>>a>>b;
        Q.pb({{a, 1}, i});
        Q.pb({{b, -1}, i});
    }
    sort(all(Q));
    int ans=0;
    set<int>now;
    for(int i=0; i<sz(Q); i++)
    {
        if(Q[i].x.y==-1&&now.count(Q[i].y))
        {
            while(sz(now))now.erase(now.begin());
            ans++;
        }
        if(Q[i].x.y==1)now.insert(Q[i].y);
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 4980
n=int(input())
a=[int(x) for x in input().split()]

a_i=[]
pl=0
mi=0
mi_cnt=0
pl_cnt=0
for i in range(n):
  a_i.append((a[i]-(i+1)))
  if a[i]-(i+1)<0:
    mi+=a[i]-(i+1)
    mi_cnt+=1
  else:
    pl+=a[i]-(i+1)
    pl_cnt+=1

a_i.sort()
if n%2==0:
  k=a_i[n//2-1]
  k1=a_i[n//2]
  k=(k+k1)//2
else:
  k=a_i[n//2]

ans=0
for i in a_i:
  ans+=abs(i-k)
print(ans)


Measured memory_bytes: 31000
#include<bits/stdc++.h>
using namespace std;
#define N 200010
 
int n,t,p[N],h[N],a[N];
vector<int> q,v[N],f;
 
void travel(int x){
	for (int i=0;i<(int)v[x].size();i++)
		if (!h[v[x][i]]) travel(v[x][i]);
	f.clear();
	for (int i=0;i<(int)v[x].size();i++)
		if (!h[v[x][i]]) f.push_back(a[v[x][i]]);
	f.push_back(-1);f.push_back(1e9);a[x]=-1;
	sort(f.begin(),f.end());
	for (int i=0;a[x]==f[i];)
		for (a[x]++;a[x]==f[i+1];) i++;
}

int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&p[i]);
	for (int i=1;i<=n;i++) v[p[i]].push_back(i);
	for (int i=t=1;i<=n;i++) t=p[t];
	for (;!h[t];t=p[t]) h[t]=1,q.push_back(t);
	for (int i=0;i<(int)q.size();i++) travel(q[i]);
	for (int i=1;i<(int)q.size();i++)
		if (a[q[i]]!=a[q[i-1]]) {printf("POSSIBLE\n");return 0;}
	printf(q.size()%2?"IMPOSSIBLE\n":"POSSIBLE\n");
	return 0;
}

Measured memory_bytes: 13688
n, m = map(int,input().split())

h = list(map(int,input().split()))

mj = []

for i in range(m):
    mj.append(list(map(int,input().split())))

cnt_w = [0 for _ in range(n)]
cnt = [0 for _ in range(n)]

for i in range(m):
    cnt[mj[i][0]-1] += 1
    cnt[mj[i][1]-1] += 1
    if h[mj[i][0]-1] > h[mj[i][1]-1]:
        cnt_w[mj[i][0]-1] += 1
    elif h[mj[i][0]-1] < h[mj[i][1]-1]:
        cnt_w[mj[i][1]-1] += 1

tower = 0
for i in range(n):
    if cnt[i] == cnt_w[i]:
        tower += 1
print(tower)



Measured memory_bytes: 32724