akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Integer[] A = new Integer[N];
    Integer[] B = new Integer[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
      B[i] = A[i];
    }
    sc.close();

    Arrays.sort(B, Collections.reverseOrder());

    for (int i = 0; i < N; i++) {
      if (A[i] == B[0]){
        System.out.println(B[1]);
      } else {
        System.out.println(B[0]);
      }
    }
    
  }
  
}

Measured memory_bytes: 96788
n,m=[int(_) for _ in input().split()]
H=[int(_) for _ in input().split()]
Hlist=[set() for a in range(n)]
count=0
for a in range(m):
    a,b=[int(_) for _ in input().split()]
    Hlist[a-1].add(b-1)
    Hlist[b-1].add(a-1)
for i,j in enumerate(Hlist):
    flag=1
    for a in j:
        if H[a]>=H[i]:
            flag=0
    if flag==1:
        count+=1
    flag=1
print(count)

Measured memory_bytes: 107452
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int n,W;
    cin>>n>>W;
    vector<ll> w(n,0),v(n,0);
    rep(i,n) cin>>w[i]>>v[i];
    ll dp[110][100010];//i-1個目までの品物で、価値がjとなるような
                        //重さの最小値
    for(int i=0;i<110;i++){
        for(int j=0;j<100010;j++){
            dp[i][j]=INF;
        }
    }
    dp[0][0]=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<100010;j++){
            if(j-v[i]>=0){
                dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
            }
            else dp[i+1][j]=dp[i][j];
        }
    }
    ll ans=0;
    for(int j=0;j<100010;j++){
        if(dp[n][j]<=W) ans=j;
    }
    /*
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++) cout<<dp[i][j]<<" ";
        cout<<endl;
    }
    */
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 86272
import math

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

    stock_n=0
    money_n=1000

    for i in range(N-1):
        if A[i+1]>A[i] and stock_n==0:
            stock_n=money_n//A[i]
            money_n=money_n%A[i]
        elif A[i+1]<A[i] and stock_n!=0:
            money_n+=stock_n*A[i]
            stock_n=0

    if stock_n!=0:
        money_n+=stock_n*A[N-1]

    print(money_n)



if __name__=="__main__":
    main()

Measured memory_bytes: 62212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define interval pair<ll, ll>

const int N = (1e5) + 5;
const ll oo = 0;
interval I[N];
int n, m;

bool cmp(const interval &i, const interval &j) {
	return i.second < j.second;
}

int intervalScheduling(interval I[], int n) {
	sort(I, I + n, cmp);
	int cnt = 0;
	ll last = -oo;
	for (int i = 0; i < n; ++i) {
		if (last <= I[i].first) {
			++cnt;
			last = I[i].second;
		}
	}
	return cnt;
}

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 0; i < m; ++i) {
		scanf("%lld %lld", &I[i].first, &I[i].second);
	}
	int mx = intervalScheduling(I, m);
	printf("%d\n", mx);
	return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
#define ll long long int
#define all(x) x.begin(), x.end()
#define pb push_back
#define se second
#define fi first
using namespace std;
typedef pair<ll,ll> pll;

const ll N = 202;
const ll inf = 1e18;
ll mat[N][N],dis[N][N];
ll R[10];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll n,m,r; cin>>n>>m>>r;
    for(ll i=0;i<N;i++){
        for(ll j=0;j<N;j++) dis[i][j]=inf;
    }
    for(ll i=0;i<=n;i++) dis[i][i]=0;
    for(ll i=0;i<r;i++) cin>>R[i];
    for(ll i=0;i<m;i++){
        ll u,v,w; cin>>u>>v>>w;
        dis[u][v]=min(dis[u][v],w);
        dis[v][u]=min(dis[v][u],w);
    }
    for(ll k=1;k<=n;k++){
        for(ll i=1;i<=n;i++){
            for(ll j=1;j<=n;j++){
                dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
            }
        }
    }
    ll permut[r];
    for(ll i=0;i<r;i++) permut[i]=R[i];
    sort(permut,permut+r);
    ll ans = inf;
    do{
        ll val=0;
        for(ll i=1;i<r;i++){
            ll u,v;
            u=permut[i-1]; v=permut[i];
            val += dis[u][v];
        }
        ans=min(ans,val);
    }while(next_permutation(permut,permut+r));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define INF 1e9+7
#define roop(i,m,n) for(int i=m;i<n;i++)
#define mroop(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;

//(int)'a'は97 (int)'A'は65
//おまじない



int main() {

	char ori[3][4];
	char bori[3][4];

	roop(i, 0, 2) {
		roop(j, 0, 3) {
			cin >> ori[i][j];
			bori[1-i][2-j] = ori[i][j];
		}
	}

	roop(i, 0, 2) {
		roop(j, 0, 3) {
			if (ori[i][j] != bori[i][j]) {
				NO;
				return 0;
			}
		}
	}

	YES;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=998244353;
int main(){
    ll n;cin>>n;
    vector<double>x(n);
    vector<double>y(n);
    rep(i,n)cin>>x[i]>>y[i];
    double sum=0;
    rep(i,n){
        REP(j,i+1,n){
            sum+=(double)sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
        }
    }
    sum*=(double)2;
    sum/=(double)n;
    cout<<setprecision(16)<<sum<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
 
const ll mod = 1e9 + 7;
 
vector<string> g;
 
int main() {
    
    ll n, k;
    cin >> n >> k;
    
    ll ret = 0;
    for (ll i = k; i <= n + 1; ++i)
    {
        ll min = ((i - 1) * i) / 2ll;
        ll max = ((2ll * n + 1 - i) * i) / 2ll;
        ret += (max - min + 1ll) % mod;
        ret %= mod;
    }
    
    
    cout << ret << endl;
 
    
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
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 <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/

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

    int N;
    cin >> N;

    int ct = 0;
    rep(i, N)
    {
        int a;
        cin >> a;

        if (!(i % 2) && a % 2)
            ct++;
    }


    cout << ct << endl;
}


Measured memory_bytes: 3648
import java.io.*;

class Main
{
public static void main(String[] args) throws IOException
 {
  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

  String str = br.readLine();

  int x=Integer.parseInt(str),h=x/3600,m,s;
  x%=3600;

  m=x/60;
  x%=60;

  s=x;

  System.out.println(h+":"+m+":"+s);
}
 }

Measured memory_bytes: 24312
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

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 n;
int d[13];
bool cclock[24];

int main(){
	cin>>n;
	REP(i,n){
		int t;
		cin>>t;
		d[min(t,24-t)]++;
	}
	d[0]++;
	REP(i,13){
		if(d[i]>=3){
			cout<<0<<endl;
			return 0;
		}
		if(d[0]>=2||d[12]>=2){
			cout<<0<<endl;
			return 0;
		}
	}
	//cout<<endl;
	cclock[0]=true;
	if(d[12])cclock[12]=true;
	bool q=false;
	for(int i=1;i<12;i++){
		if(d[i]){
			if(d[i]>1){
				cclock[i]=true;
				cclock[24-i]=true;
			}else{
				if(q)cclock[i]=true;
				else cclock[24-i]=true;
				q=!q;
			}
		}
	}
	//cout<<endl;
	int ans=24;
	for(int i=0;i<24;i++){
		for(int j=0;j<24;j++){
			if(i!=j){
				if(cclock[i]&&cclock[j]){
					ans=min(ans,abs(i-j));
					ans=min(ans,24-abs(i-j));
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    cin>>n>>s;
    ll a[26];
    for(int i=0;i<26;i++){
        a[i]=1;
    }
    for(int i=0;i<n;i++){
        a[s[i]-'a']++;
    }
    ll ans=1;
    for(int i=0;i<26;i++){
        ans*=a[i];
        ans%=mod;
        //cout << ans<<endl;
    }    
    cout << ans-1<<endl;
    return 0;
}



Measured memory_bytes: 512
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n, d = Is()
X = LIR(n)
ans = 0
for i, j in combinations(range(n), 2):
    tmp = 0
    for l in range(d):
        tmp += (X[i][l]-X[j][l])**2
    if sqrt(tmp) % int(sqrt(tmp)) == 0:
        ans += 1
print(ans)


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);

/* -----  2019/06/22  Problem: ABC 131 F / Link: http://abc131.contest.atcoder.jp/tasks/abc131_f  ----- */

struct UnionFind {
	vector<int> data;
	int sz;
	UnionFind(int n) { data.assign(n, -1); sz = n; }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
			sz--;
		}
		return x != y;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
	int size(int x) { return -data[root(x)]; }
	int allsz() { return sz; }
};


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

	int N; cin >> N;
	VI x(N), y(N);
	map<int, int>xp;
	map<int, int>yp;
	UnionFind uf(N);
	FOR(i, 0, N) {
		cin >> x[i] >> y[i];
		if (xp.find(x[i]) == xp.end()) {
			xp[x[i]] = i;
		}
		else {
			uf.unionSet(i, xp[x[i]]);
		}
		if (yp.find(y[i]) == yp.end()) {
			yp[y[i]] = i;
		}
		else {
			uf.unionSet(i, yp[y[i]]);
		}
	}

	VVI comp(uf.allsz());
	map<LL, int>smap;
	map<LL, int>umap;
	int idpoint = 0;
	FOR(i, 0, N) {
		int r = uf.root(i);
		if (umap.find(r) == umap.end()) {
			umap[r] = idpoint++;
		}
	}
	FOR(i, 0, N) {
		smap[i] = umap[uf.root(i)];
	}
	FOR(i, 0, N) {
		comp[smap[i]].push_back(i);
	}
	auto solve = [&](vector<int> &a) {
		if ((int)a.size() < 3)return 0LL;
		LL ret = 0;
		set<int>xs, ys;
		FOR(i, 0, (int)a.size()) {
			xs.insert(x[a[i]]);
			ys.insert(y[a[i]]);
		}
		ret = (LL)xs.size() *(LL)ys.size() - (int)a.size();
		return ret;
	};
	long long ans = 0;
	for (auto it : comp) {
		ans += solve(it);
	}
	cout << ans << endl;

	return 0;
}


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

#define ll long long
#define endl "\n"
#define deb(x) cerr << #x << ":" << x << "\n"

void solve()
{
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	ll ans=0;
	ans+=(min(a,k));
	k-=min(a,k);
	ans+=(min(b,k)*0);
	k-=min(b,k);
	ans+=min(c,k)*-1;
	cout<<ans<<endl;
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	while (t--)
		solve();
	return 0;
}

Measured memory_bytes: 3648
from sys import stdin

s = stdin.readline().rstrip()
N = len(s)

if N == 1:
    print(1)
    exit()
elif N == 2:
    if s[0] == s[1]:
        print(1)
        exit()
    else:
        print(2)
        exit()

dp = [0]*N
dp[0] = 1
if s[0] == s[1]:
    dp[1] = 1
else:
    dp[1] = 2
for i in range(2,N):
    if s[i] == s[i-1]:
        dp[i] = dp[i-3] + 2
    else:
        dp[i] = dp[i-1] + 1

print(dp[N-1])

Measured memory_bytes: 11240
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		//		new Main().solveB();
		new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();
			for (int i = 1; i < 4; i++) {
				if (numA * numB * i % 2 != 0) {
					System.out.println("Yes");
					return;
				}
			}

			System.out.println("No");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			String[] wk = new String[numN];

			Set<String> wkSet = new HashSet<String>();
			for (int i = 0; i < wk.length; i++) {
				String wkI = scanner.next();
				wk[i] = wkI;
				if (wkSet.contains(wk[i])) {
					System.out.println("No");
					return;
				}
				wkSet.add(wk[i]);
				if (i != 0) {
					String wkIm1 = wk[i - 1];
					if (wkIm1.charAt(wkIm1.length() - 1) != wkI.charAt(0)) {
						System.out.println("No");
						return;
					}

				}
			}

			System.out.println("Yes");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private long maxKouyakusu(long[] wk) {

		long res = 0;
		for (int i = 0; i < wk.length; i++) {
			if (i == 0) {
				res = wk[i];
				continue;
			}
			res = maxKouyakusu(res, wk[i]);
		}
		return res;

	}

	private long maxKouyakusu(long i1, long i2) {

		long w1 = Math.min(i1, i2);
		long w2 = Math.max(i1, i2);

		while (w2 > 0) {
			long temp = w1 % w2;
			w1 = w2;
			w2 = temp;
		}

		return w1;

	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numX = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			numX = scanner.nextInt();
			long[] wk = new long[numN + 1];

			wk[0] = numX;
			for (int i = 1; i < wk.length; i++) {
				wk[i] = scanner.nextInt();
			}

			Arrays.sort(wk);
			long[] wkSa = new long[numN];
			for (int i = 0; i < wk.length; i++) {
				if (i != 0) {
					wkSa[i - 1] = wk[i] - wk[i - 1];
				}
			}

			System.out.println(maxKouyakusu(wkSa));

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 50392
#include <iostream>

using namespace std;
int r=10,sum=0;
int main()
{
    //freopen("B.INP","r",stdin);
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    for (int i=1;i<=5;i++)
    {
        int n;
        cin >> n;
        if (n%10!=0) {r=min(r,(n%10));sum+=(n-(n%10)+10);}
        else sum+=n;
    }
    cout << sum-10+r;

}


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

typedef long long ll;

int main(){
	ll N,A,B,C,D;
	scanf("%lld%lld%lld%lld%lld",&N,&A,&B,&C,&D);
	ll di=B-A;
	ll a,b,m;
	for(a=0;a<=N-1;a++){
		b=N-1-a;
		m=a-b;
		ll Min=(a-b)*C+b*(C-D);
		ll Max=(a-b)*C+a*(D-C);
		if(di<=Max&&di>=Min){
			printf("YES");
			return 0;
		}
	}
	printf("NO");
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int main(){
  int total_players;
  while(~scanf("%d",&total_players)){
    int cards[200][3];
    int scores[200];
    memset(cards,0,sizeof(cards));
    memset(scores,0,sizeof(scores));
    for(int player_id = 0;player_id < total_players; player_id++){
      for(int turn = 0; turn < 3; turn++){
	scanf("%d",&cards[player_id][turn]);
      }
    }
    for(int turn = 0; turn < 3; turn++){
      int freq[101];
      memset(freq,0,sizeof(freq));

      for(int player_id = 0;player_id < total_players; player_id++){
	freq[cards[player_id][turn]]++;
      }

      for(int player_id = 0;player_id < total_players; player_id++){
	if(freq[cards[player_id][turn]] == 1){
	  scores[player_id] += cards[player_id][turn];
	}
      }
    }

    for(int player_id = 0; player_id < total_players; player_id++){
      printf("%d\n",scores[player_id]);
    }
  }
}

Measured memory_bytes: 1192
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;
int main(){
  int A, B, C, K, ans=0;
  cin >> A >> B >> C >> K;
  if (K >= A){
    ans += A;
    K -= A;
  }else{
    ans += K;
    K = 0;
  }
  if (K >= B){
    K-= B;
  }else{
    K = 0;
  }
  if (K >= C){
    ans -= C;
  }else{
    ans -= K;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	string s;
	cin >> s;
	
	for(int i=0;i<s.size();i++){
		int v=(int)(s[i]-'A');
		v=(v+n)%26;
		cout << (char)('A'+v);
	}
	cout << "\n";
	return 0;
}

Measured memory_bytes: 256
import math

a, b, x = map(int, input().split())
t = 2 * b - (2 * x) / (a ** 2)
ans = 0
if t > b:
    t = 2 * x / (a * b)
    ans = math.degrees(math.atan2(b, t))
else:
    ans = math.degrees(math.atan2(t, a))
print(ans)


Measured memory_bytes: 9432
import functools

memo = {}
#@functools.lru_cache(maxsize=-1)
def L(i):
    if i==0:
        return 2
    if i==1:
        return 1
    if i in memo:
        return memo[i]
    memo[i] =  L(i-1)+L(i-2)
    return  memo[i]

for i in range(100):
    (L(i))

print(L(int(input())))

Measured memory_bytes: 4068
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
using namespace std;
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007


int main(int argc, char const *argv[]) {
  ll res=1e9;
  int D,G;
  std::vector<int> p,c;
  std::cin >> D >> G;
  p.resize(D); c.resize(D);
  for(int i=0; i<D; i++) std::cin >> p[i] >> c[i];

  for(int bit=0; bit < (1<<D); bit++){
    ll sum=0,num=0;
    for(int i=0; i<D; i++){
      if(bit&(1<<i)) sum+=c[i]+p[i]*100*(i+1),num+=p[i];//フラグが立っている問題を全て解く
    }
    if(sum>=G) res=min(num,res);//コンプリートボーナスのみで点数を上回ったらそれでOK
    else{//得点の大きいものからさらに解く
      for(int i=D-1; i>=0; i--){
        if(bit&(1<<i)) continue;//フラグが立っている問題はコンプリートしているので他の問題へ
        for(int j=0; j<p[i]; j++){
          if(sum>=G) break;
          sum+=100*(i+1);
          num++;
        }
      }
      res=min(res,num);
    }
  }

  std::cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
N = int(input())
arr = list(map(int,input().split()))

def insertionSort(arr, n):
    for i in range(1,n):
        v=arr[i]
        j=i-1
        while j>=0 and arr[j]>v:
            arr[j+1] = arr[j]
            j=j-1
        arr[j+1] = v
        print(' '.join(map(str, arr)))
print(' '.join(map(str, arr)))
insertionSort(arr, N)


Measured memory_bytes: 5604
#include <iostream>

using namespace std;

typedef long long ll;

ll dp[100005];

int main(int argc, char *argv[])
{
	int N, K, h[100005];

	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> h[i];
	}
	dp[0] = 0;
	for (int i = 1; i < N; i++) {
		int mn = 1000000000;
		int k = 0;
		for (int j = 1; j <= K && i - j >= 0; j++) {
			if (mn > dp[i - j] + abs(h[i] - h[i - j])) {
				mn = dp[i - j] + abs(h[i] - h[i - j]);
				k = j;
			}
		}

		dp[i] = mn;
	}
	cout << dp[N - 1] << endl;

	return 0;
}

Measured memory_bytes: 1408
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    var ans = 0L
    for (a in 1 until n) {
        for (b in 1 until n) {
            if (a * b >= n) break
            ans++
        }
    }
    println(ans)
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 35236
#include <cstdio>
#include <algorithm>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP2D(a, n, m) REP(i, n) REP(j, m) printf("%d%c", a[i][j], j + 1 == m ? '\n' : ' '); puts("")

typedef long long ll;

const int N_MAX = 100000;
const int A_I_MAX = 1000000000;
const int INF = 1e9;

int N;
int A[N_MAX];
ll dp[N_MAX + 1][2];

void solve() {
  dp[0][0] = 0;
  dp[0][1] = -INF;
  REP(i, N) {
    int q0 = A[i] / 2;
    int r0 = A[i] % 2;
    dp[i + 1][0] = max(dp[i][0] + q0, dp[i][1] + q0 + r0);
    if (A[i] > 0) {
      int q1 = (A[i] - 1) / 2;
      int r1 = (A[i] - 1) % 2;
      dp[i + 1][1] = max(dp[i][0] + q1, dp[i][1] + q1 + r1);
    } else {
      dp[i + 1][1] = -INF;
    }
  }
  // DUMP2D(dp, (N + 1), 2);
  ll ans = max(dp[N][0], dp[N][1]);
  printf("%lld\n", ans);
}

void input() {
  scanf("%d", &N);
  REP(i, N) scanf("%d", A + i);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int n;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	if(n % 2 == 0) cout << n << "\n";
	else cout << n * 2 << "\n";
	return 0;
}

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

#ifdef SG
	#include <debug.h>
#else
	template<typename T> struct outputer;
	struct outputable {};
	#define PRINT(...)
	#define OUTPUT(...)
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
	#define fbegin(...)
	#define fend
	#define pbegin(...)
	#define pend
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb emplace_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef int64_t ll;
typedef uint64_t ull;
typedef uint32_t ui;
typedef uint16_t us;
typedef uint8_t uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

struct Input {
	ll ql, qr;
	
	bool read () {
		if (!(cin >> ql >> qr)) {
			return 0;
		}
		++qr;
		return 1;
	}

	void init (const Input &input) {
		*this = input;
	}
};

struct Data: Input {
	ll ans;
	
	void write () {
		cout << ans << endl;
	}
};


namespace Main {
	
	struct Solution: Data {
		
		ll rec2 (ll n, ll l, ll r) {
			debug(mt(n, l, r, float(l) / n, float(r) / n));
			if (l >= r) {
				return n;
			}
			ll m = n / 2;
			if (r <= m) {
				return rec2(m, l, r) + m;
			}
			if (l > m) {
				return n;
			}
			return n - r + rec2(m, l, m);
		}
		
		ll rec1 (ll n, ll l, ll r) {
			debug(mt(n, l, r, float(l) / n, float(r) / n));
			if (n == 1) {
				return 1;
			}
			ll m = n / 2;
			if (r <= m) {
				return rec1(m, l, r);
			}
			if (l >= m) {
				return rec1(m, l - m, r - m);
			}
			return (m - l) + rec2(m, r - m, l);
		}
		
		void solve () {
			//deepen(0);
			ans = rec1(1ll << 60, ql, qr);
		}
		
		void clear () {
			*this = Solution();
		}
	};
}


Main::Solution sol;

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);

	#ifdef SG
		freopen((problemname + ".in").c_str(), "r", stdin);
//		freopen((problemname + ".out").c_str(), "w", stdout);
		while (sol.read()) {
			sol.solve();
			sol.write();
			sol.clear();
		}
	#else
		sol.read();
		sol.solve();
		sol.write();
	#endif
	
	/*
	int t;
	cin >> t;
	forn (i, t) {
		sol.read();
		sol.solve();
		sol.write();
		sol.clear();
	}
	*/
	
	return 0;
}


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

int main(){
    vector<int> a(3);
    for(int i=0; i<(int)a.size(); i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    if(a[0] == 5 && a[1] == 5 && a[2] == 7){
        cout << "YES\n";
    }
    else{
        cout << "NO\n";
    }

}

Measured memory_bytes: 256
#if 1

#include <bits/stdc++.h>
using namespace std;
long long n,x,ans,m = 10000000000000000;

int main()
{
    cin >> n;
    for(int i = 1;i <= 5;i++)
    {
        cin >> x;
        m = min(m,x);
    }
    cout << (n/m)+((n % m) > 0)+4;
}

#endif // 1++

Measured memory_bytes: 384
/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define pp pop_back
#define mp make_pair
#define IO cin.tie(0),cout.tie(0)
#define ISWS ios::sync_with_stdio(0)
typedef long long Long;
void FastIO(){ISWS;IO;}

const int N = 1e7;

int main()
{
  FastIO();
  int tc, ca = 0;
  int n;
  cin >> n;
  string s;
  cin >> s;
  int L = 0;
  int R = n-1;
  int ans = 0;
  while (L < R){
    while (L < R && s[L]!='W')L++;
    while (L < R && s[R]!='R')R--;
    if (L < R){
      swap(s[L], s[R]);
      ans++;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3720
import java.util.Scanner;

// ALDS1_1_D
public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r, p = 0, max = 1 - 1000000000;
		for (int i = 0; i < n; i++) {
			r = sc.nextInt();
			if (i == 0) {
				p = r;
			} else {
				if (max < r - p) max = r - p;
				if (r < p) p = r;
			}
		}
		System.out.println(max);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 99068
L = 10**10

N = int(input())
x, y = zip(*(map(int, input().split()) for _ in range(N)))

result = 0
for i in range(N):
    for b in [-1, 1]:
        for s, t in [(y[i], -x[i]), (-y[i], x[i])]:
            s, t = L * s - b * t, b * s + L * t
            X = 0
            Y = 0
            for j in range(N):
                if x[j] * s + y[j] * t > 0:
                    X += x[j]
                    Y += y[j]
            result = max(result, (X**2 + Y**2)**0.5)
print(result)

Measured memory_bytes: 3188
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

inline int read()
{
	int res = 0; bool bo = 0; char c;
	while (((c = getchar()) < '0' || c > '9') && c != '-');
	if (c == '-') bo = 1; else res = c - 48;
	while ((c = getchar()) >= '0' && c <= '9')
		res = (res << 3) + (res << 1) + (c - 48);
	return bo ? ~res + 1 : res;
}

template <class T>
inline void write(T x)
{
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}

template <class T>
inline T Min(const T &a, const T &b) {return a < b ? a : b;}

template <class T>
inline T Max(const T &a, const T &b) {return a > b ? a : b;}

typedef long long ll;

const int N = 1e5 + 5;

int n, q, a[N];
ll sum[N], xsum[N][2];

int queryt(int pos, int st, int ed, bool is, int k)
{
	if (is) k++;
	int l = Max(1, k - (n - ed + 1)), r = Min(k, st);
	while (l <= r)
	{
		int mid = l + r >> 1;
		int x1 = st - mid + 1, x2 = ed + (k - mid) - 1;
		if (x2 == n || pos - a[x1] <= a[x2 + 1] - pos)
			l = mid + 1;
		else r = mid - 1;
	}
	return r;
}

ll query(int x)
{
	int pos = std::upper_bound(a + 1, a + n + 1, x) - a - 1;
	bool is = a[pos] == x;
	int st = pos, ed = is ? pos : pos + 1, l = 1, r = n;
	while (l <= r)
	{
		int mid = l + r >> 1;
		int tmp = queryt(x, st, ed, is, mid), L, R;
		L = st - tmp + 1; R = ed + (mid + is - tmp) - 1;
		if (R < n - mid + 1) l = mid + 1;
		else r = mid - 1;
	}
	if (!r) return xsum[n][n & 1];
	int tq = r;
	int tmp = queryt(x, st, ed, is, tq), L, R;
	L = st - tmp + 1; R = ed + (tq + is - tmp) - 1;
	if (R + 1 == n - tq + 1) return sum[n] - sum[R] + xsum[L - 1][L - 1 & 1];
	return sum[n] - sum[R] + xsum[L - 1][L & 1];
}

int main()
{
	int x;
	n = read(); q = read();
	for (int i = 1; i <= n; i++) a[i] = read();
	for (int i = 1; i <= n; i++)
	{
		sum[i] = sum[i - 1] + a[i];
		xsum[i][i & 1] = xsum[i - 1][i & 1] + a[i];
		xsum[i][(i & 1) ^ 1] = xsum[i - 1][(i & 1) ^ 1];
	}
	while (q--)
	{
		x = read();
		if (x <= a[1]) write(sum[n] - sum[n >> 1]), putchar('\n');
		else if (x >= a[n]) write(xsum[n][n & 1]), putchar('\n');
		else write(query(x)), putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int main() {
  string S;
  cin >> S;
  int N = S.size();
  bool ans = true;
  int i = 0, j = N-1;
  while(i < j) {
    if(S[i] != S[j]) ans = false;
    i++;
    j--;
  }
  i = 0, j = (N-1)/2-1;
  while(i < j) {
    if(S[i] != S[j]) ans = false;
    i++;
    j--;
  }
  i = (N+3)/2-1, j = N-1;
  while(i < j) {
    if(S[i] != S[j]) ans = false;
    i++;
    j--;
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstring>
#include <map>
#include <set>
#define int long long int
using namespace std;
const int cons = 1000000007;

int dp[103][100007];

signed main() {
 
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    #ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    #endif
    
    int n, ww, i, j;
    cin>>n>>ww;
    int w[n+1], v[n+1];
    for(i=1;i<=n;i++){
        cin>>w[i]>>v[i];
    }
    memset(dp, 0, sizeof(dp));
    for(i=1;i<=n;i++){
        for(j=0;j<=ww;j++){
            if(j-w[i]>=0)
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]]+v[i]);
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    cout<<dp[n][ww]<<endl;
}


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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

signed main()
{
    int r;
    cin >> r;
    cout << 3 * r * r << endl;
}

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

int main(){
    int n;
    cin >> n;
    int arr[n];
    for(int i=0; i<n; i++) cin >> arr[i];
    int toplam = 0;
    for(int i=0; i<n; i++){
        toplam += arr[i];
    }
    int cntr = 0;
    int a;
    for(int i=0; i<n; i++){
        cntr+=arr[i];
        if(cntr > toplam/2){
            a = i;
            break;
        }
    }
    int n_cntr = cntr-arr[a];
    int sonuc = min(abs(toplam-(2*cntr)), abs(toplam-(2*n_cntr)));
    cout << sonuc;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <chrono>
#include <random>

using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e9;
const int MB = 32;
const int MOD = 998244353;

void solve() {
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
   // freopen("C:\\Users\\Иван\\Desktop\\output.txt", "w", stdout);
    //int t;
    // cin >> t;
    int t = 1;
    while (t--) solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll MOD=998244353;

ll modpow(ll a, ll n){
  if(n==1) return a%MOD;
  if(n%2==1) return (a*modpow(a,n-1))%MOD;
  else{
    ll t=modpow(a,n/2)%MOD;
    return (t*t)%MOD;
  }
}
/*
2,3,3,4= 2*4 + 3*3 + (3+3-1)=8+9+5=22

2 1 3 4
2,1=0 2,2=2 2,3=4   2,4=8
3,1=1 3,2=5 3,3=19  3,4=65
      4+3-2 12+15-8 32+57-24

0 1 2 3 4 5
1 0 1 1 1 1
2 0 2 5 11
3 0 4 19
4 0 8 65
5 0 16

4+10-3
1*2 1*3 1*4?
2*4 4*9?
3*8 8*27?
4*16?
5*32?
6*64?

1*2
2*4
4*6
8*8
16*10
32*12
まあ一緒か
*/
int main(){
  ll A,B,C,D; cin>>A>>B>>C>>D;
  vector<vector<ll>> DP(3030,vector<ll>(3030,0)),MDP(3030,vector<ll>(3030,0));
  //DP[y][x]
  DP[B][A]=1;
  //初期いれ
  for(ll i=A+1; i<=C; i++) DP[B][i]=(DP[B][i-1]*B)%MOD;
  for(ll j=B+1; j<=D; j++) DP[j][A]=(DP[j-1][A]*A)%MOD;
  for(ll i=A+1; i<=C; i++){
    for(ll j=B+1; j<=D; j++){
      DP[j][i]=(DP[j-1][i]*i)%MOD+(DP[j][i-1]*j)%MOD-(DP[j-1][i-1]*(i-1)*(j-1))%MOD;
      DP[j][i]=(DP[j][i]+MOD)%MOD;
    }
  }
  cout<<DP[D][C]<<endl;
/*cout<<endl;
for(ll i=1; i<=D; i++){
for(ll j=1; j<=C; j++){
  cout<<DP[i][j]<<" ";
}
cout<<endl;
}*/
}

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

using namespace std;

int main(){
  int n,p;
  
  while(1)
    {
      cin >> n >> p;
      if(n + p == 0) break;
      
      int man[n];
      for(int i=0;i < n;i++)
	{
	  man[i] = 0;
	}
      int stone = p;
      int i=0;

      while(1){
	
	if(stone == 0 && man[i] == 0)
	  {
	    i++;
	  }
	else if(stone == 0 && man[i] != 0)
	  {
	    stone = man[i];
	    man[i] = 0;
	    i++;
	  }
	else if(stone != 0)
	  {
	    man[i]++;
	    stone--;
	    i++;
	  }
	
	if(i == n) i = 0;

	if(man[i] == p)
	  {
	    cout << i << endl;
	    break;
	  }
      }
    }
  return 0;
}



Measured memory_bytes: 3080
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int C = sc.nextInt();
        double S, L, h;
        S = a * b * Math.sin(Math.toRadians(C)) / 2;
        L = a + b + Math.sqrt(a*a + b*b - 2*a*b*Math.cos(Math.toRadians(C)));
        h = 2 * S / a;
        System.out.println(S);
        System.out.println(L);
        System.out.println(h);
    }
}


Measured memory_bytes: 26288
/*---------------------------------- NEVER GIVE UP --------------------------------------------*/

/*

Some people think that if their opponent plays a beautiful game, it’s OK to lose. I don’t. You have to be merciless
-- MAGNUS CARLSEN

*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef double ld;
typedef pair<ll,ll> pii;
typedef tree<ll, null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define debug1(x) cerr<<#x<<" : "<<x<<endl
#define debug2(x,y) cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define debug3(x,y,z) cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define fastt ios_base::sync_with_stdio(false); cin.tie(NULL) ; cout.tie(NULL)

const ll modd=1e9+7;
const ll inf=1e18;

ll poww(ll a,ll b){
  ll ans=1;
  while(b){
    if(b&1LL) ans=(ans*a);
    a=(a*a);
    b=b>>1LL;
  }
  return ans;
}

/*    
         -> mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
         -> cout<<"Case #"<<casee<<": "<<ans<<endl; 

*/

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

int main(){
   fastt;
   
   ll arr[] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
   ll k;
   cin >> k;
   
   cout << arr[k-1] << endl;
 
   return 0;
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template<typename T>
ostream& operator << (ostream& os, vector<T> v)
{
  os << "(";
  each (i, v) os << i << ",";
  os << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    const int m = n + 1;
    int t[m];
    int x[m];
    int y[m];
    t[0] = x[0] = y[0] = 0;
    for (int i = 0; i < n; ++i) {
      cin >> t[i + 1] >> x[i + 1] >> y[i + 1];
    }
    bool f = true;
    for (int i = 0; i + 1 < n + 1; ++i) {
      int md = abs(x[i] - x[i + 1]) + abs(y[i] - y[i + 1]);
      int z = abs(t[i] - t[i + 1]);
      if (z < md) f = false;
      else {
        f = f && ((z - md) % 2 == 0);
      }
    }
    cout << (f ? "Yes" : "No") << endl;
  }
  
  return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
#include <stdlib.h>
#define MAX 100001
int n;
char AC[MAX];
int AI[MAX],O[MAX];
int partition(int *,int,int);
void quickSort(int *,int,int);

int main(){
    int i, j=0,r,p,state=0;
    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf(" %c%d",&AC[i],&AI[i]);
        O[i]=i;
    }
    quickSort(AI,0,n-1);
    for(i=0;i<n;i++){
        for(j=i+1;i<n;j++){
            if(AI[i]==AI[j]){
                if(O[i]>O[j]){
                printf("Not stable\n");
                state=1;
                break;
                }
            }else break;
        }
        if(state==1)break;
    }
    if(state==0)printf("Stable\n");
    // for(i=0;i<n;i++)printf("%d",O[i]);
    for(i=0;i<n;i++)printf("%c %d\n",AC[i],AI[i]);

    return 0;
}

void quickSort(int AI[],int p,int r){
    int q,i;
    if(p<r){
        q=partition(AI,p,r);
        quickSort(AI,p,q-1);
        quickSort(AI,q+1,r);
    }
    // for(i=0;i<n;i++)printf("%d",O[i]);
    // for(i=0;i<n;i++)printf("%c %d\n",AC[i],AI[i]);
}


int partition(int AI[],int p,int r){
  int x=AI[r],temp;
  char tempc;
  int  i=p-1,j;
  for(j=p;j<r;j++){
    if(AI[j]<=x){
      i++;
      temp=AI[i];
      AI[i]=AI[j];
      AI[j]=temp;
      tempc=AC[i];
      AC[i]=AC[j];
      AC[j]=tempc;
      temp=O[i];
      O[i]=O[j];
      O[j]=temp;
    }
  }
    temp=AI[i+1];
    AI[i+1]=AI[r];
    AI[r]=temp;
    tempc=AC[i+1];
    AC[i+1]=AC[r];
    AC[r]=tempc;
    temp=O[i+1];
    O[i+1]=O[r];
    O[r]=temp;
  
  return i+1;
}



Measured memory_bytes: 2572
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    if (B * 2 >= A) {
      System.out.println(0);
    } else {
      System.out.println(A - B * 2);
    }
  }
}

Measured memory_bytes: 20948
s = list(input())
K = int(input())
list_s = []
for j in range(1,K+1):
    for i in range(len(s)-j+1):
        list_s.append(''.join(s[i:i+j]))
set_s = set(list_s)
sorted_s = sorted(set_s)
print(sorted_s[K-1])

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

typedef long long int lli;
#define int lli
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<lli> vli;
typedef vector<pii> vii;

const int MOD   = 1e9 + 7;
const double PI = acos(-1.0);
const int xd[4] = {1, 0, -1, 0}, yd[4] = {0, 1, 0, -1};
const int INF   = 1e18;

#define fastio            ios_base::sync_with_stdio(false);cin.tie(0)
#define sz(a) int((a).size())
#define rsz resize
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define f first
#define s second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define endl "\n"
#define spc " "
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template <typename T> T lcm(T a, T b){return (a*b)/gcd(a,b); }

void solve(){
    int x, y;
    cin >> x >> y;
    int t1 = y/2 - x;
    int t2 = 2*x - y/2;
    if(y%2 == 1 || t1 < 0 || t2 < 0){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }

}

signed main(){
    fastio;

    solve();

    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fr(a,b) for(int i = a; i < b; i++)
#define mod 1000000007
#define printDouble(x) cout << fixed << setprecision(10) << x
#define triplet pair<int,pair<int,int>>
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

/*E(x,y,z) = (1 + p1*E(x-1,y,z) + p2*E(x+1,y-1,z) + p3*E(x,y+1,z-1))/(1-p0)
E(x,y,z) = (n + x*E(x-1,y,z) + y*E(x+1,y-1,z) + z*E(x,y+1,z-1))/(x+y+z)*/
double dp[301][301][301];
double solve(int x, int y, int z, int& n)
{
    if(x == 0 && y == 0 && z == 0)
        return 0;

    if(dp[x][y][z] > -0.9)
        return dp[x][y][z];

    double t1 = (x == 0) ? 0 : x * solve(x-1, y, z, n);
    double t2 = (y == 0) ? 0 : y * solve(x+1, y-1, z, n);
    double t3 = (z == 0) ? 0 : z * solve(x, y+1, z-1, n);

    double exp_val = n + t1 + t2 + t3;

    return dp[x][y][z] = exp_val / (x+y+z);
}

int main(){
    memset(dp, -1, sizeof dp);
    int n, x = 0,y = 0, z = 0;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int sushi;
        cin >> sushi;
        if(sushi == 1)
            x++;
        else if(sushi == 2)
            y++;
        else z++;
    }
    printDouble(solve(x,y,z,n));
    return 0;
}


Measured memory_bytes: 213376