akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll=long long;  
using pLL = std::pair<ll, ll>;

int N;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int M,C;
    cin >> N >> M >> C;
    int a;
    //vector<vector<int>> a(N,vector<int>(M,0));
    vector<int> B(M);
    for(int i=0;i<M;++i){
        cin >> B[i];
    }
    int ans=0;
    for(int i=0;i<N;++i){
        int sum=C;
        for(int j=0;j<M;++j){
            cin >> a;
            sum+=a*B[j];
        }
        if(sum>0){
          ans++;  
        } 
    }
    
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/**
*    created: 25.07.2020 21:11:41
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int dx2[8]={0, 1, 0, -1, 1, 1,-1, -1};
const int dy2[8]={1, 0,-1, 0, 1, -1, 1, -1};
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

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

    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int now = 1000;
    int cnt = 0;
    rep(i,n) {
        if (i == 0) {
            if (a[1] >= a[0]) {
                cnt += now / a[0];
                now -= cnt * a[0];
            }
        }
        else if (i == n-1) {
            now += cnt * a[i];
        }
        else {
            if (a[i+1] > a[i] && a[i] <= a[i-1]) {
                cnt += now / a[i];
                now -= (now / a[i]) * a[i];
            }
            else if (a[i+1] < a[i] && a[i] >= a[i-1]) {
                now += cnt * a[i];
                cnt = 0;
            }
        }
    }
    cout << now << endl;
    return 0;
}

Measured memory_bytes: 3644
using System;
using System.Linq;

namespace ABC117C
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int[] NM = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            int N = NM[0];
            int M = NM[1];
            long[] X = Console.ReadLine().Split(' ').Select(b => long.Parse(b)).ToArray();

            if (N >= M)
            {
                Console.WriteLine(0);
                return;
            }

            long Long = X.Max() - X.Min();
            Array.Sort(X);
            long[] Distance = new long[M - 1];
            for (int i = 1; i < M; i++)
            {
                Distance[i - 1] = X[i] - X[i - 1];
            }
            
            Array.Sort(Distance);
            Array.Reverse(Distance);
            for (int i = 0; i < N - 1; i++)
            {
                Long -= Distance[i];
            }
            Console.WriteLine(Long);
        }
    }
}

Measured memory_bytes: 20576
#include <stdio.h>

#define EPS (1e-7)

typedef struct {
	double x,y,z;
} zahyo_t;

zahyo_t read_zahyo(void) {
	zahyo_t ret;
	scanf("%lf%lf%lf",&ret.x,&ret.y,&ret.z);
	return ret;
}

zahyo_t sub_zahyo(zahyo_t dest,zahyo_t src) {
	zahyo_t ret;
	ret.x=dest.x-src.x;
	ret.y=dest.y-src.y;
	ret.z=dest.z-src.z;
	return ret;
}

double zettaiti(double a) {
	return a<0?-a:a;
}

#define WIDTH 4
#define HEIGHT 3

int gausu(double matrix[HEIGHT][WIDTH]) {
	int i,j,k;
	for(i=0;i<HEIGHT;i++) {
		/* pipotto-sentaku */
		double hiscore=zettaiti(matrix[i][i]);
		int hiindex=i;
		double atai;
		for(j=i+1;j<HEIGHT;j++) {
			if(zettaiti(matrix[j][i])>hiscore) {
				hiscore=zettaiti(matrix[j][i]);
				hiindex=j;
			}
		}
		/* koukan */
		for(j=0;j<WIDTH;j++) {
			double tmp=matrix[i][j];
			matrix[i][j]=matrix[hiindex][j];
			matrix[hiindex][j]=tmp;
		}
		if(zettaiti(matrix[i][i])<EPS)return 0;
		/* syoukyo */
		atai=matrix[i][i];
		for(j=0;j<WIDTH;j++)matrix[i][j]/=atai;
		for(j=0;j<HEIGHT;j++) {
			double keisu=matrix[j][i];
			if(j==i)continue;
			for(k=0;k<WIDTH;k++)matrix[j][k]-=keisu*matrix[i][k];
		}
	}
	return 1;
}

#undef WIDTH
#undef HEIGHT

int main(void) {
	zahyo_t me;
	zahyo_t enemy;
	zahyo_t p1,p2,p3;
	zahyo_t vec1,vec2,vec3;
	double matrix[3][4];
	int gausu_ret;
	me=read_zahyo();
	enemy=read_zahyo();
	p1=read_zahyo();
	p2=read_zahyo();
	p3=read_zahyo();
	vec1=sub_zahyo(enemy,me);
	vec2=sub_zahyo(p2,p1);
	vec3=sub_zahyo(p3,p1);
	/* me+x*vec1 == p1 + y*vec2 + z*vec3 */
	/* [vec1 -vec2 -vec3]X = p1-me */
	matrix[0][0]=vec1.x;matrix[0][1]=-vec2.x;matrix[0][2]=-vec3.x;
	matrix[1][0]=vec1.y;matrix[1][1]=-vec2.y;matrix[1][2]=-vec3.y;
	matrix[2][0]=vec1.z;matrix[2][1]=-vec2.z;matrix[2][2]=-vec3.z;
	matrix[0][3]=p1.x-me.x;
	matrix[1][3]=p1.y-me.y;
	matrix[2][3]=p1.z-me.z;
#if 0
	{
		int i,j;
		for(i=0;i<3;i++) {
			for(j=0;j<4;j++) {
				printf("\t%f",matrix[i][j]);
			}
			puts("");
		}
	}
#endif
	gausu_ret=gausu(matrix);
#if 0
	{
		int i,j;
		for(i=0;i<3;i++) {
			for(j=0;j<4;j++) {
				printf("\t%f",matrix[i][j]);
			}
			puts("");
		}
	}
#endif
	puts((!gausu_ret || /* kai nasi */
		/* x==0 -> UAZ ga baria no heimenzyo -> tuburete mieru */
		/* UAZ-teki ni baria ga nai */
		(matrix[0][3]<EPS || matrix[0][3]>1.0+EPS) ||
		/* hou ga baria ni ataranai !(y>=0 && z>=0 && y+z<=1) */
		(matrix[1][3]+EPS<0.0 || matrix[2][3]+EPS<0.0 || matrix[1][3]+matrix[2][3]>1.0+EPS)
	)?"HIT":"MISS");
	return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int mod=998244353;
inline void add(int &a,int b){
    a+=b;
    if(a>=mod)a-=mod;
}
int C[4444][4444];
int po[4444];

int calc(int K,int N,int P){
    int ret=0;
    for(int i=0;i<=P;i++){
        int k=K-2*P+i;
        int n=N-i;

        if(k==0||n<0)continue;
        add(ret,C[n+k-1][n]*C[P][i]%mod*po[i]%mod);
    }
    return ret;
}

signed main(){
    for(int i=0;i<4444;i++){
        C[i][i]=C[i][0]=1;
        for(int j=1;j<i;j++)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
    }
    po[0]=1;
    for(int i=1;i<4444;i++)po[i]=po[i-1]*2%mod;

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

    for(int i=2;i<=2*K;i++){
        int ans=0;

        int p=K-abs(i-K-1);
        if(i&1){
            ans=calc(K,N,p/2);
        }
        else{
            rep(j,2){
                add(ans,calc(K-1,N-j,p/2));
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 152832
use strict;
use warnings;
package Scc;
sub new{
	return bless[map[],1..$_[1]],$_[0];
}
sub add_edge{
	my$self=shift;
	push@{$self->[$_[0]]},$_[1];
}
sub scc{
	my$self=shift;
	my$now_ord=0;
	my$group_num=0;
	my@low;
	my@ord=(-1)x@{$self};
	my@ids;
	my@visited;
	my$dfs;
	$dfs=sub{
		my$v=shift;
		$low[$v]=$ord[$v]=$now_ord++;
		push@visited,$v;
		for my$to(@{$self->[$v]}){
			if($ord[$to]==-1){
				$dfs->($to);
				$low[$v]=$low[$to]if$low[$v]>$low[$to];
			}
			else{
				$low[$v]=$ord[$to]if$low[$v]>$ord[$to];
			}
		}
		if($low[$v]==$ord[$v]){
			my$u=-1;
			while($u!=$v){
				$u=pop@visited;
				$ord[$u]=@{$self};
				$ids[$u]=$group_num;
			}
			$group_num++;
		}
	};
	for my$i(0..$#ord){
		$dfs->($i)if$ord[$i]==-1;
	}
	$_=$group_num-1-$_ for@ids;
	my@groups=map[],1..$group_num;
	for my$i(0..$#ids){
		push@{$groups[$ids[$i]]},$i;
	}
	return\@groups;
}
package main;
my($N,$M)=split$",<>;
my$scc=Scc->new($N);
for(1..$M){
	my($a,$b)=split$",<>;
	$scc->add_edge($a,$b);
}
my$groups=$scc->scc();
print scalar(@{$groups}),$/;
for my$L(@{$groups}){
	print scalar(@{$L}),$","@{$L}",$/;
}


Measured memory_bytes: 290088
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define reps(i,n) for(int i=1;i<=(int)n;i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    string s; cin >> s;
    if(SZ(s) < 4){
        cout << "No" << endl;
        return 0;
    }
    else{
    if(s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    }
    return 0;

}

Measured memory_bytes: 3592
#include<stdio.h>

void trace(int A[], int N) {
	int i;
	for (i = 0; i < N; i++) {
		if (i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

void insertionSort(int A[], int N) {
	int j, i, v;
	for (i = 0; i < N; i++) {
		v = A[i];
		j = i - 1;
		while (j >= 0 && A[j] >= v) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		trace(A, N);
	}
}

int main(){
	int N, i, j;
	int A[100];

	scanf("%d", &N);
	for (i = 0; i < N; i++) scanf("%d", &A[i]);

	insertionSort(A, N);

	return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>

using namespace std;
typedef long long ll;

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

  vector<vector<ll>> vec(n, vector<ll>(3));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> vec[i][j];
    }
  }
  
  ll ans = 0;
  for (int bit = 0; bit < (1 << 3); bit++) {
    vector<ll> b;
    for (int i = 0; i < n; i++) {
      ll tmp = 0;
      for (int j = 0; j < 3; j++) {
        if (bit & (1 << j)) {
          tmp += vec[i][j];
        } else {
          tmp -= vec[i][j];
        }
      }
      b.push_back(tmp);
    }
    sort(b.begin(), b.end(), greater<ll>());
    ll sum = 0;
    for (int i = 0; i < m; i++) {
      sum += b[i];
    }
    ans = max(ans, sum);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

#define MAXN 200000

int a, b, c, d;

int input() {
        if (scanf("%d %d %d %d", &a, &b, &c, &d) < 0) return 0;
        return 1;
}

void init() {
}

int solve() {
        return a!=c;
}

void output(int ans) {
        printf("%d\n", ans);
}

void cleanup() {
}

int main() {
        //int ca; scanf("%d", &ca);
        while (input()) {
                init();
                output(solve());
                cleanup();
                break;
        }
}

Measured memory_bytes: 128
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>

using namespace std;

const int N = 2e5 + 500;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;

typedef pair < int ,int > pii;
typedef long long int llint;

vector < int > sazv;
vector < pii > vl;

int l[N],r[N],fen[2 * N],dp[N],n;

void add(int i,int x){
    for(;i<N;i+=i&-i){
        fen[i] = max(fen[i],x);
    }
}

int query(int i){
    int ret = 0;
    for(;i>0;i-=i&-i)
        ret = max(ret,fen[i]);
    return ret;
}

void sazimanje(){
    for(int i = 1;i<=vl.size();i++){
        sazv.push_back(vl[i].second);
    }
    sort(sazv.begin(),sazv.end());
    sazv.erase(unique(sazv.begin(),sazv.end()),sazv.end());

    for(int i = 1;i<=vl.size();i++){
        vl[i].second = lower_bound(sazv.begin(),sazv.end(),vl[i].second) - sazv.begin() + 1;
    }
}

void nadilr(){
    for(int i = 0;i<2*N;i++) fen[i] = 0;
    for(int i = 1;i<vl.size();i++){
        add(N - vl[i].second , N - i);
        l[i] = min(N - query(N - vl[i].second), (int)vl.size() - 1 );
    }
    for(int i = 0;i<2*N;i++) fen[i] = 0;
    for(int i = vl.size() - 1;i>=1;i--){
        add(vl[i].second , i);
        r[i] = query(vl[i].second);
    }
    for(int i = 0;i<2*N;i++) fen[i] = 0;
    for(int i = 1;i<vl.size() ;i++){
        add(r[i] ,l[i] );
    }
}

int din(){
    dp[0] = 1;
    for(int i = 1;i<vl.size();i++){
        int lim = query(i - 1);
        dp[i] = 2 * dp[i - 1] % MOD;
        if(lim) dp[i] -= dp[lim-1];
        if(dp[i] < 0) dp[i] += MOD;
    }
    int finlim = query(vl.size());
    int sol = dp[vl.size() - 1] - dp[finlim - 1];
    if(sol < 0) sol += MOD;
    return sol;
}

int main(){
    scanf("%d",&n);
    for(int i = 0;i<n;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        vl.push_back(make_pair(x,y));
    }
    vl.push_back(make_pair(0,0));
    sort(vl.begin(),vl.end());
    sazimanje();
    nadilr();
    printf("%d\n",din());
}


Measured memory_bytes: 7536
#include <bits/stdc++.h>     // [PRIMES]               1777 ~2^10.80  
using namespace std;                     //                       10333 ~2^13.33
using ll=long long;                      // seq 1 128 | factor   100333 ~2^16.61
using vl=vector<ll>;                     //   | grep -v ' .* '  1300111 ~2^20.31
using vvl=vector<vl>;                    //                    10300777 ~2^23.30
using vb=vector<bool>;                   //                   100400999 ~2^26.58
using vs=vector<string>;                 //                  1300400999 ~2^30.28
using pll=pair<ll,ll>;                   //                 10200500333 ~2^33.25
const ll oo =0x3f3f3f3f3f3f3f3fLL;       //                100200400777 ~2^36.54
const double eps=1e-9;                   //               1200300700111 ~2^40.13
#define sz(c) ll((c).size())             //              10200300500777 ~2^43.21
#define all(c) begin(c),end(c)           //             100200300400777 ~2^46.51
#define mp make_pair                     //            1200300400600999 ~2^50.09
#define mt make_tuple                    //           10200300400600111 ~2^53.18
#define pb push_back                     //          100200300400600333 ~2^56.48
#define eb emplace_back                  //         1200300400500800999 ~2^60.06
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int toInt(char c) {
	return c - 'a';
}


int main() {
	vector< int > places[30];
		
	string s, t;
	cin >> s >> t;

	int nextEle[30][sz(s)];

	FOR(i, 0, s.size()) {
		places[toInt(s[i])].pb((int) i);
	}

	FOR(c, 0, 30) {
		if(sz(places[c]) == 0) continue;
	
		FOR(start, 0, sz(places[c]) - 1) {
			ll end = start + 1;
			FOR(i, places[c][start], places[c][end]) nextEle[c][i] = places[c][end];

		}
		
		FOR(i, 0, places[c][0]) nextEle[c][i] = places[c][0];
		FOR(i, places[c][sz(places[c]) - 1], sz(s)) nextEle[c][i] = places[c][0];
	}

	
	ll next = 0;
	ll output = 1;
	FOR(i, 0, sz(t)) {
		char c = t[i];		
		if (sz(places[toInt(c)]) == 0) {
			cout << -1 << endl;
			return 0;
		}
		
		if (i == 0) {
			ll old = 0;
			next = places[toInt(c)][0];

			output += next - old;				
		} else {
			ll old = next;
			next = nextEle[toInt(c)][next];

			output += next - old;
			if (old >= next) output += sz(s);
		}

	}

	cout << output << endl;	


} //cin.tie(0) bei schnellem Wechseln

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

#define MAXA 1000000000000000000

int main(void)
{
    int n;
    cin >> n;
    long long int ans = 1;
    for( int i = 0; i < n; i++) 
    {
        long long int tmp;
        cin >> tmp;
        if( tmp == 0)
        {
            ans = 0;
        }
        else
        {
            if( ans > MAXA / tmp ||  MAXA / tmp == ans && ans * tmp != MAXA) 
            {
                ans = MAXA + 1;
            }
            else
            {
                ans = ans * tmp;                
            }
            
        }
        
    }
    if( ans > MAXA ) ans = -1;
    cout << ans;
}




Measured memory_bytes: 3604
H, W = map(int, input().split())

s = [["."] * (W + 2) for i in range(H+2)]

for i in range(1, H + 1):
    ss = input()
    for j in range(1, W + 1):
        s[i][j] = ss[j-1]

#print(s)
f = 0

for i in range(1, H+1):
    for j in range(1, W+1):
        if s[i][j] == "#" and s[i+1][j] == "." and s[i-1][j] == "." and s[i][j+1] == "." and s[i][j-1] == ".":
            f =1
    if f == 1:
        break

if f == 0:
    print("Yes")
else:
    print("No")


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

using ll = long long;

int main() {
    int N, ans = 0;
    cin >> N;
    vector<int> L(N);
    rep(i, N) cin >> L[i];
    sort(L.begin(), L.end());
    rep(i, N - 2) {
        for (int j = i + 1; j < N - 1; j++) {
            int k = lower_bound(L.begin(), L.end(), L[i] + L[j]) - L.begin();
            ans += max(0, k - j - 1);
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
const int  M = 1e9 + 7;

vector<vector<double>> dp;

double f(int n, int heads, vector<double> &v)
{

if(n == 0)
{
if(2*heads > v.size())
return 1;
else
return 0;
}

if(dp[n][heads] != -1)
return dp[n][heads];
double t1 = (dp[n-1][heads + 1] == -1) ? f(n-1, heads + 1, v) : dp[n-1][heads+1];
double t2 = (dp[n-1][heads] == -1) ? f(n-1, heads, v) : dp[n-1][heads];

return dp[n][heads]=v[n-1] * t1  + (1-v[n-1])*t2;
}

int main()
{

#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif

int n, i, j, wt, m;

cin >> n;
vector<double> v(n);
for(i = 0; i < n; i++)
cin >> v[i];

dp.resize(n + 1);
for(i = 0; i <= n; i++)
dp[i].resize(n + 1, -1);

cout << setprecision(10) << f(n, 0, v);
}

Measured memory_bytes: 74468
px, py = map(int, input().split())
cx, cy, r = map(int, input().split())
dx, dy = px - cx, py - cy
s2 = dx ** 2 + dy ** 2
df = (s2 - r ** 2) ** 0.5
ix1, ix2 = (dx * r + dy * df) * r / s2, (dx * r - dy * df) * r / s2
iy1, iy2 = (dy * r - dx * df) * r / s2, (dy * r + dx * df) * r / s2
if (ix1, iy1) > (ix2, iy2):
    ix1, ix2 = ix2, ix1
    iy1, iy2 = iy2, iy1
print(ix1 + cx, iy1 + cy)
print(ix2 + cx, iy2 + cy)


Measured memory_bytes: 5640
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Map<String, Long>map =  new HashMap<>();
		long count=0;
		for(int i=0;i<n;i++) {
			char[] s= sc.next().toCharArray();
			Arrays.sort(s);
			String key=new String(s);
			if(map.containsKey(key)) {
				count+=map.get(key);
				map.put(key, map.get(key)+1);
			}else {
				map.put(key, (long)1);
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 52912
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=1<<30;

double a[1000005];
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		a[i]=a[i]+a[i-1];
	}
	double ans=0.0;
	double anss=0;
	for(int i=k;i<=n;i++){
		anss=max(anss,((a[i]-a[i-k])+k)/2);
	}
	
	printf("%.12lf",anss);
	
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define int long long 
#define pb push_back
#define mp make_pair
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define N 2005

int INF=1000000;
const int mod=1e9+7;
using namespace std;
int dp[N][N];



void need_for_speed(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


int32_t main(){
	need_for_speed();
    int n, m, k;
    cin>>n>>m>>k;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    int b[m];
    for(int i=0;i<m;i++) cin>>b[i];
    bool fl1=false, fl2=false;
    int op1=0, op2=0, ans=0;
    
    for(int i=1;i<n;i++){
        a[i] += a[i-1];
    }
    
    for(int i=1;i<m;i++){
        b[i] += b[i-1];
    }
    ans = lower_bound(b, b+m, k)-b;
    if(ans<m and b[ans]==k){
        ans++;
    }
    
    int i=0;
    while(i<n and a[i]<=k){
        int rem = k-a[i];
        if(rem==0){
            ans = max(ans, i+1);
            break;
        }
        if(rem<0){
            ans = max(ans, i);
            break;
        }
        int p = lower_bound(b, b+m, rem)-b;
        
        if(p<m and b[p]==rem){
            p++;
        }
        
        ans = max(i+1+p, ans);
        i++;
    }
    cout<<ans<<endl;;
        
    
    

        
        
    
    return 0;
}
    
 

Measured memory_bytes: 6684
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef pair<ll,ll> pll;
const ll inf = 99999999999;
const int nax = 1e5 + 7;
int n , q;
vector< int > graph[nax];
int l , timer;
vector< int > tin(nax), tout(nax);
vector<vector<int > >up(nax,vector< int > (30));
bool is_ancestor(int u , int v){
	return (tin[u] <= tin[v] && tout[u] >= tout[v]);
}
int lca(int u , int v){
	if(is_ancestor( u , v))
		return u;
	if(is_ancestor( v, u))
		return v;
	for(int i = l ; i >= 0 ; i--){
		if(!is_ancestor(up[u][i] , v))
			u = up[u][i];
	}
	return up[u][0];
}
void dfs(int u , int p){
	tin[u] = timer++;
	up[u][0] = p;
	for(int i = 1 ; i <= l ; i++)
		up[u][i] = up[up[u][i-1]][i-1];
	for(auto v : graph[u])
	{
		dfs(v , u);
	}
	tout[u] = timer++;
}
int main(){
	dhoom;
	cin >> n ;
	l = ceill(log2(n));
	for(int i = 0 ; i < n ; i++){
		int k;
		cin >> k;
		//cout << "hey" << endl;
		for(int j = 0 ; j < k ; j++){
			int r;
			cin >> r;
			graph[i].push_back(r);
		}
	}
	dfs(0,0);
	cin >> q;
	//up.assign(n + 1 , vector< int > (l+1));
//	cout <<"hey" << endl;
	while(q--){
		int u , v;
		cin >> u >> v;
		cout << lca(u , v) << endl;
	}
    return 0;
}




Measured memory_bytes: 28708
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        long a = sc.nextInt();	
	        long b = sc.nextInt();	
	        long c = sc.nextInt();	
	        long d = sc.nextInt();	
	        long ans=a*c;
	        ans=Math.max(ans,b*d);
	        ans=Math.max(ans,a*d);
	        ans=Math.max(ans,b*c);
	        
	        
	        
	        System.out.println(ans);
		 }
		 
	}

Measured memory_bytes: 35692
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<assert.h>
#include<ctime>
using namespace std;
#define LL long long
const int maxn = 2e5+10;
const int maxm = 1e5+10;
double pi = acos(-1.0);

//struct edge{
//    int from, to, cost, next;
//}e[maxn*2];
//int head[maxn], tot;
//inline void add(int a, int b, int c) {
//    e[tot].from = a, e[tot].to = b, e[tot].cost = c, e[tot].next = head[a], head[a] = tot++;
//}
//namespace fastIO {
//    #define BUF_SIZE 100000
//    //fread -> read
//    bool IOerror = 0;
//    inline char nc() {
//        static char buf[BUF_SIZE], *p1 = buf + BUF_SIZE, *pend = buf + BUF_SIZE;
//        if(p1 == pend) {
//            p1 = buf;
//            pend = buf + fread(buf, 1, BUF_SIZE, stdin);
//            if(pend == p1) {
//                IOerror = 1;
//                return -1;
//            }
//        }
//        return *p1++;
//    }
//    inline bool blank(char ch) {
//        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
//    }
//    inline void read(int &x) {
//        char ch;
//        while(blank(ch = nc()));
//        if(IOerror)
//            return;
//        for(x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0');
//    }
//    #undef BUF_SIZE
//};
//using namespace fastIO;
char s[maxn];
int cnt[1000];
int main(){
    long long q,  h, d, n;
    while(~scanf("%s", s)) {
        memset(cnt, 0, sizeof(cnt));
        int len = strlen(s);
        long long ans = 0;
        for(long long i = 0; i < len; i++) {
            ans = ans+i-cnt[s[i]];
            cnt[s[i]]++;
        }
        printf("%lld\n", ans+1);
    }
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int res = 0;
		
		for (int i = 0; i < n; i++) {
			int m = sc.nextInt();
			res ^= m;
		}
		
		String ans = (res == 0) ? "Yes" : "No";
		
		System.out.println(ans);
		sc.close();
	}

}

Measured memory_bytes: 48372
x, k, d = map(int, input().split())

if x > k*d or -x > k*d:
    print(abs(abs(x) -k*d))
else:
    num = abs(x) // d
    rest = k - num
    if rest%2 == 1:
        print(abs(abs(x)%d -d))
    else:
        print(abs(abs(x)%d))

Measured memory_bytes: 9164
//皆さん、第9回シンデレラガール総選挙は、トップでオンリーワンを目指す城ヶ崎美嘉に
//そしてボイスアイドルオーディションは、プログラミングが趣味の才女大石泉に、ぜひ投票をお願いします！
//#城ヶ崎美嘉を009のシンデレラに
//#大石泉の必勝プログラム
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	string s,t;cin>>s;cin>>t;
	if(t.substr(0,t.size()-1)==s) cout<<"Yes"<<endl;else cout<<"No"<<endl;
}


Measured memory_bytes: 3600
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int min = 1000000;
        int max = -1000000;
        long sum = 0;
        
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
        }
        
        for(int i = 0; i < n; i++){
            if(a[i] < min){
                min = a[i];
            }
            if(a[i] > max){
                max = a[i];
            }
            sum += a[i];
        }
        
        System.out.println(min + " " + max + " " + sum);
        
    }
}



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

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string s,t;

	cin >> s;
	cin >> t;

	sort(s.begin(),s.end());
	sort(t.rbegin(),t.rend());

	if(s<t)
	{
		cout << "Yes" << '\n';
	}
	else
	{
		cout << "No" << '\n';
	}
	
	return 0;	
}

Measured memory_bytes: 256
/**
 *    author:  tourist
 *    created: 17.11.2019 02:01:26       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = n - 1; i >= 0; i -= 2) cout << a[i] << " ";
  for (int i = n % 2; i < n; i += 2) cout << a[i] << " ";
  return 0;
}


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

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

Measured memory_bytes: 5080
var lines = [];

var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var v = [];
    for (var i = 0; i < 5; i++) {
        v[i] = Number(lines[i]);
    }
    var result = Infinity;
    var NextTime = Array(5);

    for (var i = 0; i < 5; i++) {
        if (v[i] % 10 === 0) { NextTime[i] = v[i]; }
        else { NextTime[i] = v[i] - v[i] % 10 + 10 }
    }

    for (var i = 0; i < 5; i++) {
        var Time = 0;
        for (var j = 0; j < 5; j++) {
            i === j ? Time += v[j] : Time += NextTime[j];
        }
        result = Math.min(result, Time);
    }
    console.log(result);
});

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

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ALL(a) begin(a), end(a)
#define SZ(a) ((int)(a).size())

#define REP(a, b) for (int a = 0; a < (b); a++)
#define FOR(a, b, c) for (int a = (b); a <= (c); a++)
#define REPD(a, b) for (int a = (b) - 1; a >= 0; a--)
#define FORD(a, b, c) for (int a = (b); a >= (c); a--)

#define MIN(a, b) (a) = min((a), (b))
#define MAX(a, b) (a) = max((a), (b))

#ifdef __DEBUG
#define debug if (true)
#else
#define debug if (false)
#endif

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T> using VVV = vector<VV<T>>;

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2> &p) {
  return is >> p.fi >> p.se;
}

const int N = 1e5 + 5;

int n, MOD;
int dp[N];
int ans[N];
vi pref[N], suff[N];
vi g[N];

int add(int a, int b) { if ((a += b) >= MOD) a -= MOD; return a; }
int mul(int a, int b) { return 1LL * a * b % MOD; }

void dfs(int u, int par) {
  REP(i, SZ(g[u])) if (g[u][i] == par) {
    swap(g[u][i], g[u].back());
    g[u].pop_back();
    break;
  }
  pref[u].resize(SZ(g[u]));
  suff[u].resize(SZ(g[u]));
  REP(i, SZ(g[u])) {
    int v = g[u][i];
    dfs(v, u);
    pref[u][i] = add(dp[v], 1);
    suff[u][i] = add(dp[v], 1);
  }
  FOR(i, 1, SZ(g[u]) - 1) pref[u][i] = mul(pref[u][i], pref[u][i - 1]);
  FORD(i, SZ(g[u]) - 2, 0) suff[u][i] = mul(suff[u][i], suff[u][i + 1]);
  dp[u] = SZ(g[u]) ? pref[u].back() : 1;
}

void solve(int u, int parDp) {
  ans[u] = mul(dp[u], add(parDp, 1));
  REP(i, SZ(g[u])) {
    int rem = mul(i > 0 ? pref[u][i - 1] : 1, i + 1 < SZ(g[u]) ? suff[u][i + 1] : 1);
    int v = g[u][i];
    solve(v, mul(rem, add(parDp, 1)));
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> MOD;
  if (MOD == 1) {
    REP(i, n) puts("0");
    return 0;
  }
  REP(i, n - 1) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    g[x].pb(y);
    g[y].pb(x);
  }
  dfs(0, -1);
  solve(0, 0);
  REP(i, n) printf("%d\n", ans[i]);
}


Measured memory_bytes: 25472
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}


int N;
vector<int> v;

int calc_cost(int m){
  int cost = 0;
  rep(i,N) cost += (m-v[i])*(m-v[i]);
  return cost;
}

int ternary_search(int s, int e){
  if(e-s<=2){
    int res = MAX_I;
    repp(i,s,e+1)res = min(res, calc_cost(i));
    return res;
  }
  int m1 = (2*s+e)/3, m2 = (s+2*e)/3;
  int c1 = calc_cost(m1);
  int c2 = calc_cost(m2);
  if(c1>c2) return ternary_search(m1,e);
  else return ternary_search(s,m2);
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  cin >> N;
  v.resize(N);
  rep(i,N) cin >> v[i];
  sort(all(v));
  cout << ternary_search(v[0],v[N-1]) << endl;
  return 0;
}


Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Usize1;

fn main() {
    input! {
        dd: usize,
        c: [i64; 26],
        s: [[i64; 26]; dd],
        t: [Usize1; dd],
    }

    let mut score = 0;

    // やらなかった残念
    let mut last = vec![0; 26];
    for d in 0..dd {
        // 実施特典
        score += s[d][t[d]];

        // 今回の記録
        last[t[d]] = d + 1;

        for i in 0..26 {
            score -= c[i] * (d + 1 - last[i]) as i64;
        }

        println!("{}", score);
    }
}


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

#define int long long

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

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n, x = 0;
	cin >> n;

	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		x ^= a[i];
	}

	for (int i = 0; i < n; ++i)
		cout << (x ^ a[i]) << ' ';

	return 0;
}

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
#define  B   begin()
#define  E   end()
const int N=5e7+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    ll t,i,j,n,m,l,r;
    string s;
    cin>>n;
    s+="7";
    r=0;
    for(i=1;i<N;i++)
    {
        r=(r*10+(s[i-1]-48))%n;
        if(r==0)
        {
            cout<<i<<"\n";
            return 0;
        }
        s+="7";
    }
    cout<<"-1\n";
    return 0;
}



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

using namespace std;

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

  if(a == "A"){
      cout << "T";
  }else if(a == "T"){ cout << "A";
  }else if(a == "C"){ cout << "G";
  }else if(a == "G"){ cout << "C";}

  return 0;
  }

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

int main(){
    ll n, k; cin >> n >> k;
    ll h[n];
    rep(i, n) cin >> h[i];

    ll dp[n];
    memset(dp, 1, sizeof(dp));
    dp[0] = 0;
    roop(i, 1, n){
        roop(j, 1, k+1){
            if(i - j >= 0) dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
        }
    }

    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
	int n,k,i,j,ar[200009];
    ll sum=0;
    scanf("%d %d",&n,&k);
    for(i=0; i<n; i++)
    {
    	scanf("%d",&ar[i]);
    }
    sort(ar,ar+n);

    for(i=0; i<n-k; i++)
    {
    	sum+=ar[i];
    }

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

    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>
#include<bitset>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
const int INF = 0x7fffffff;
using lll = long long;
using ull = unsigned long long;
using namespace std;


int main(){
  lll ii,jj,kk;
  vector<int> ret;
  int a;
  int pos;
  for(ii=0;ii<5;ii++){
    cin >> a;
    if(a == 0){
      pos = ii;
    }
  }

  cout << pos+1 << endl;
  
  return 0;
}


Measured memory_bytes: 3592
#include <iostream>

#define MAX_NM 100000

int main(){
	int n, m, s[MAX_NM + 1];
	unsigned long long ans = 0;
	std::cin >> n >> m;

	s[0] = 0;

	for(int i = 1; i < n; ++i){
		int in;
		std::cin >> in;
		s[i] = s[i - 1] + in;
	}

	int loc = 0;
	for(int i = 0; i < m; ++i){
		int in;
		std::cin >> in;
		ans += abs(s[loc + in] - s[loc]);
		loc += in;
	}

	std::cout << ans % 100000 << std::endl;

	return 0;
}

Measured memory_bytes: 1544
h, w = map(int, input().split())
result_img = ["#" * (w + 2)] 
for _ in range(h):
  base_pix = input()
  base_pix = "#" + base_pix + "#"
  result_img.append(base_pix)
result_img.append("#" * (w + 2))

for one_row in result_img:
  print(one_row)

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

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

	int q;
	cin >> q;

	for (int i = 0; i < q; i++)
	{
		int b, e, m;
		cin >> b >> m >> e;

		rotate(a.begin() + b, a.begin() + m, a.begin() + e);
	}

	bool sp = false;
	for (int i : a)
	{
		print((sp ? " " : "") << i);
		sp = true;
	}
	println("");
}


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

using namespace std;

vector<vector<long long int>> dp;
vector<int> weights, values;

long long int solve(int N, int W){
  if(W <= 0)
    return 0;
  if(N < 0)
    return 0;
  if(dp[N][W] == -1){
    if(W-weights[N] >= 0)
      dp[N][W] = max(solve(N-1,W), solve(N-1,W-weights[N]) + values[N]);
    else
      dp[N][W] = solve(N-1,W);
  }
  return dp[N][W];
}

int main(){
  int N, W;
  cin >> N >> W;
  weights = vector<int>(N);
  values = vector<int>(N);
  for(int i=0;i<N;i++)
    cin >> weights[i] >> values[i];
  dp = vector<vector<long long int>>(N+1, vector<long long int>(W+1, -1));
  cout << solve(N-1,W);
  return 0;
}

Measured memory_bytes: 80256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let x: u32 = read(); // (*)
    let ans = if x == 1 { 0 } else { 1 };
    println!("{}", ans);
}


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

int d[200000];

int main(){
	int n, k;
	cin >> n >> k;
	rep(i, 0, n){
		int a;
		cin >> a;
		d[a - 1]++;
	}
	sort(d, d + 200000);
	reverse(d, d + 200000);
	int ans = n;
	rep(i, 0, k){
		ans -= d[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
N,T = map(int,input().split())
keiro = [[int(v) for v in input().split()] for _ in range(N)]

ans = 10000

for row in keiro:
    c,t = row

    if t <= T:
        ans = min(ans,c)


if ans == 10000:
    print("TLE")

else:
    print(ans) 

Measured memory_bytes: 3060
def main():
    n, y = map(int, input().split())
    for i in range(n+1):
        for j in range(0, i+1):
            x = 10000*(n-i) + 5000*(i-j) + 1000*(j)
            if x == y:
                print("{} {} {}".format(n-i, i-j, j))
                return
    print("-1 -1 -1")

main()

Measured memory_bytes: 38896
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        a: [i32; 5],
        k: i32,
    }
    let mut v = a;
    v.sort();
    if v[4]-v[0]<=k {
        println!("Yay!");
    } else{
        println!(":(");
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
typedef long long ll;
const int MAX = 999999999;

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

    ll cnt = 0;
    while(x <= y){
        x *= 2;
        cnt ++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <queue>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;

    struct Product
    {
        int price;
        int ticket;
    };

    auto compare = [](const Product &a, const Product &b)
    {
        return a.price < b.price;
    };

    std::priority_queue<
        Product,
        std::vector<Product>,
        decltype(compare)> products(compare);
    for (int i = 0; i < N; ++i)
    {
        int price;
        cin >> price;
        products.push({ price, 0 });
    }

    for (int i = 0; i < M; ++i)
    {
        auto p = products.top(); // copy
        products.pop();
        ++p.ticket;
        p.price /= 2;
        products.push(p);
    }

    long total = 0;
    while (!products.empty())
    {
        total += products.top().price;
        products.pop();
    }

    cout << total << endl;

    return 0;
}


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

int main(){
  int H,N;
  cin >> H >> N;
  int64_t sum=0;
  for(int i=0;i<N;i++){
    int A;
    cin >> A;
    sum+=A;
  }
  if(sum>=H){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>

int main() {
    int a, b;
    std::cin >> a >> b;
    std::cout << a / b << " " << a % b << " ";
    std::cout << std::fixed << std::setprecision(8) << (double)a / (double)b << std::endl;
    return 0;
}


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



int main()
{
	int a,b,c;
	scanf("%d%d",&a,&b);
	if(a!=1&&b!=1) printf("1");
	else if(a!=2&&b!=2) printf("2");
	else printf("3");
	return 0;
 } 

Measured memory_bytes: 256
using System;
using System.Linq;
using static System.Console;
using static System.Math;
public class Hello{
    public static void Main(){
        var line = ReadLine().Split(' ').Select(int.Parse).ToArray();
        var s = line[0] * line[1];
        var rec = 2 * (line[0] + line[1]);
        WriteLine($"{s} {rec}");
    }
}


Measured memory_bytes: 16412
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ProblemA_Painting solver = new ProblemA_Painting();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemA_Painting {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int n = in.nextInt();
            int c = Math.max(a, b);
            out.println((n + c - 1) / c);
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23380
#include <iostream>

using namespace std;


int main(){
    int n, b, f, r, v, population[4][3][10] = {0};
    cin >> n;

    for(int i = 0; i < n; ++i){
        cin >> b; cin >> f; cin >> r; cin >> v;
        population[b - 1][f - 1][r - 1] += v;
    }

    for(int i = 0; i < 4; ++i){
        for(int j = 0; j < 3; ++j){
            for(int k = 0; k < 10; ++k){
                cout << " " << population[i][j][k];
            }
            cout << endl;
        }
        if(3 != i) {
            cout << "####################" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3076