akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

 
int main(){
  priority_queue<int> q;
  rep(i,3){int k; cin >> k; q.push(k); }
  int n; cin >> n;
  rep(i,n){ int k=q.top()*2; q.pop(); q.push(k);}

  ll ans=0;
  rep(i,3){ans += q.top(); q.pop(); }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
from itertools import accumulate

n = int(input())
a = list(map(int, input().split()))

if n == 0:
    print(1 if a[0] == 1 else - 1)
    exit()

if a[0] != 0:
    print(-1)
    exit()

b = list(accumulate(a))
v = 1
cnt = 1
for i in range(n):
    if (v - a[i]) * 2 - a[i + 1] < 0:
        print(-1)
        exit()
    v = min((v - a[i]) * 2, b[-1] - b[i])
    cnt += v
print(cnt)

Measured memory_bytes: 20148
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a;
  string s;
  cin >> a >> s;
  if(a>=3200) {
    cout << s << endl;
  }
  else {
    cout << "red" << endl;
  }
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> exist(101, 0);
  rep(i, N) {
    int d;
    cin >> d;
    exist.at(d) = 1;
  }
  
  int cnt = 0;
  for (int i = 1; i <= 100; i++) {
    if (exist.at(i) == 1) {
      cnt++;
    }  
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void print() { cout << "\n"; }
template <class T> void print(const T &x) { cout << x << "\n"; }
template <class T, class... Args> void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
template <class T> void printVector(const vector<T> &v) {
    for(const T &x : v) {
        cout << x << " ";
    }
    cout << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, a, b;
    cin >> a >> b >> n;
    if(b == 1) {
        print(0);
    } else if(b - 1 <= n) {
        print(((a * (b - 1)) / b) - a * ((b - 1) / b));
    } else {
        print((a * n) / b - a * (n / b));
    }
}

Measured memory_bytes: 3636
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#define SIZE 200005

using namespace std;

char S[SIZE],T[SIZE];

int main()
{
	int H,W,N;
	scanf("%d %d %d",&H,&W,&N);
	int sr,sc;
	scanf("%d %d",&sr,&sc);sr--,sc--;
	scanf("%s",&S);
	scanf("%s",&T);
	int lx=0,rx=H-1,ly=0,ry=W-1;
	for(int i=N-1;i>=0;i--)
	{
		if(T[i]=='U')
		{
			rx++;
			rx=min(rx,H-1);
		}
		else if(T[i]=='D')
		{
			lx--;
			lx=max(lx,0);
		}
		else if(T[i]=='R')
		{
			ly--;
			ly=max(ly,0);
		}
		else
		{
			ry++;
			ry=min(ry,W-1);
		}
		if(S[i]=='U') lx++;
		else if(S[i]=='D') rx--;
		else if(S[i]=='R') ry--;
		else ly++;
		if(lx>rx||ly>ry)
		{
			puts("NO");
			return 0;
		}
	}
	if(!(lx<=sr&&sr<=rx)) puts("NO");
	else if(!(ly<=sc&&sc<=ry)) puts("NO");
	else puts("YES");
	return 0;
}


Measured memory_bytes: 512
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define rep(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define irep(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define rrep(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

const int MOD = 1e9 + 7;



int main() {
    int h, w;
    cin >> h >> w;
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n)
        cin >> a[i];

    vector<vector<int>> ans(h, vector<int>(w, 0));

    int nowcol = 0;

    rep(i, 0, h * w) {
        int nowh = i / w;
        int noww = i%w;
        if (nowh % 2)
            noww = (w - 1 - noww);
        if (a[nowcol] == 0)
            nowcol++;
        ans[nowh][noww] = nowcol+1;
        a[nowcol]--;
    }

    rep(i, 0, h) {
        rep(j, 0, w) {
            cout << (j == 0 ? "" : " ") << ans[i][j];
        }
        cout << endl;
    }
    return 0;
}

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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define FOR(n) for(int i = 0;i < n;i++)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK" << endl

const double PI = M_PI;
const long long INF = int(10e9-1);
const long long MOD = int(10e9+7);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t start = clock();
        solve();
        clock_t end = clock();
        const double time = static_cast<double>(end-start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

void solve(){
   GET(A);
   GET(B);
   ANS(C,((A==B&B==C)?"Yes":"No"));
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  auto k = readln.chomp.to!int;
  auto h = k / 2;
  if (k % 2) {
    writeln((h+1) * h);
  } else {
    writeln(h * h);
  }
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

const ll N = 3*MAX5;
// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, y, k, z, l;
string s, t, d, c;

// <------------- Implement Functions Here ----------> //




// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> m;
	m = m*m;
	ll cou = 0;
	for(ll i=0;i<n;i++) {
		cin>>x>>y;
		cou += (x*x + y*y  <= m);
	}
	cout<<cou;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


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

using namespace std;

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

    vector<vector<int>> abc(3, vector<int>(n));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < n; j++) {
            cin >> abc[i][j];
        }

        sort(abc[i].begin(), abc[i].end());
    }

    vector<vector<long long>> dp(3, vector<long long>(n, 0));
    for (int i = 0; i < n; i++) {
        dp[0][i] = i + 1;
    }

    for (int i = 1; i < 3; i++) {
        for (int j = 0; j < n; j++) {
            vector<int>::iterator p = lower_bound(abc[i - 1].begin(), abc[i - 1].end(), abc[i][j]);
            if (p != abc[i - 1].begin()) {
                dp[i][j] = dp[i - 1][p - abc[i - 1].begin() - 1];
            }
        }

        for (int j = 1; j < n; j++) {
            dp[i][j] += dp[i][j - 1];
        }
    }

    cout << dp[2][n - 1] << endl;
}


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

int dp[10005];
int M[10] = {0,2,5,5,4,5,6,3,7,6};
int a[10];

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

  for(int i = 0; i < m; i++) cin >> a[i];
  fill(dp,dp+n+1,-1);

  dp[0] = 0;
  
  for(int i = 0; i < n; i++) {
    if(dp[i] == -1) continue;
    for(int j = 0; j < m; j++) {
      dp[M[a[j]] + i] = max(dp[M[a[j]] + i],dp[i] + 1);
    }
  }
  sort(a,a+m,greater<int> ());

  int tmp = n;
  for(int i = 0; i < dp[n]; i++) {
    for(int j = 0; j < m; j++) {
      if(tmp - M[a[j]] < 0) continue;
      if(dp[tmp - M[a[j]]] == dp[tmp] - 1) {
	//	cout << tmp << endl;
	tmp -= M[a[j]];
	cout << a[j];
	break;
      }
    }
  }
  cout << endl;
}
  


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def assign_color():
    _color = 1
    for m in range(vertices_num):
        if vertices_status_list[m] == -1:
            graph_dfs(m, _color)
            _color += 1
    return None


def graph_dfs(vertex, color):
    vertices_stack = list()
    vertices_stack.append(vertex)
    vertices_status_list[vertex] = color

    while vertices_stack:
        current_vertex = vertices_stack[-1]
        vertices_stack.pop()
        for v in adj_list[current_vertex]:
            if vertices_status_list[v] == -1:
                vertices_status_list[v] = color
                vertices_stack.append(v)
    return None


def solve():
    for relation in relation_info:
        key, value = map(int, relation.split())
        adj_list[key].append(value)
        adj_list[value].append(key)

    assign_color()

    # print(adj_list)
    for question in question_list:
        start, target = map(int, question.split())
        if vertices_status_list[start] == vertices_status_list[target]:
            print("yes")
        else:
            print("no")
    return vertices_status_list


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices_num, relation_num = map(int, _input[0].split())

    relation_info = _input[1:relation_num + 1]

    question_num = int(_input[relation_num + 1])
    question_list = _input[relation_num + 2:]

    adj_list = tuple([[] for _ in range(vertices_num)])
    vertices_status_list = [-1] * vertices_num
    ans = solve()

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

int main() {
  int num,days,remain;
  cin >> num >> days >> remain;
  
  int ans = remain;
  for(int i = 0; i < num; i++) {
	int current; cin >> current;
    ans += (days / current);
    if(days % current != 0 ) {
      ans ++;
    }
  }
  cout << ans << endl;
  
  
  return 0;
}

Measured memory_bytes: 3592
#create date: 2020-09-13 22:30

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()
    amax = [0, 0]
    amin = [10**20, 10**20]
    for _ in range(n):
        x, y = na()
        amin[0] = min(amin[0], x+y)
        amax[0] = max(amax[0], x+y)
        amin[1] = min(amin[1], -x+y)
        amax[1] = max(amax[1], -x+y)
    print(max(amax[0]-amin[0], amax[1]-amin[1]))
if __name__ == "__main__":
    main()

Measured memory_bytes: 9216
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define PI 3.1415926535897932384
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	if(s[1]=='B') s[1]='R';
	else s[1]='B';
	cout<<s<<endl;
	return 0;
}


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

int main() {
  int A, B, C, X;
  cin >> A;
  cin >> B;
  cin >> C;
  cin >> X;

  int res;
  for(int i = 0; i <= A; ++i) {
    for(int j = 0; j <= B; ++j) {
      for(int k = 0; k <= C; ++k) {
        if(i*500+j*100+k*50 == X) ++res;
      }
    }
  }
  cout << res << endl;

}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] arges) {
		List<String> klist = new ArrayList<String>();
		int i = 0;
		Scanner sc = new Scanner(System.in);
		while (i < 1) {
			String line = sc.nextLine();
			klist.add(line);
			if (line.equals("0 0")) {
				break;
			}
		}

		for (String string : klist) {
			if (string.equals("0 0")) {
				break;
			}
			String[] k = string.split(" ");
			int v = Integer.parseInt(k[0]);// ???
			int v2 = Integer.parseInt(k[1]);// ?¨?

			for (int j = 0; j < v; j++) {
				int count = 0;
				if ((j + 1 )% 2 == 1) {
					while (count < v2) {
						if ((count + 1) % 2 == 1) {
							System.out.print("#");
							count++;
						} else {
							System.out.print(".");
							count++;
						}
					}
				} else {
					while (count < v2) {
						if ((count + 1) % 2 == 1) {
							System.out.print(".");
							count++;
						} else {
							System.out.print("#");
							count++;
						}
					}
				}
				System.out.println("");
			}
			System.out.println("");

		}
	}
}

Measured memory_bytes: 34928
function Main(input) {
    var S = input[0];

    if (S === 'Sunny') {
        console.log('Cloudy');
    } else if (S === 'Cloudy') {
        console.log('Rainy');
    } else if (S === 'Rainy') {
        console.log('Sunny');
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

Measured memory_bytes: 21064
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

ll division(ll a, ll b){
    if (a >= 0)return a / b;
    else return -((-a + b-1)/b);
}

ll modulo(ll a, ll b){
    if (a >= 0)return a % b;
    else return (a % b + b)% b;
}

int main(){
    ll n, x, d;
    cin >> n >> x >> d;

    if (d == 0){
        if (x == 0){
            cout << 1LL << endl;
            return 0;
        }
        else{
            cout << n+1 << endl;
            return 0;
        }
    }
    if (d < 0){
        d *= -1;
        x *= -1;
    }
    map<ll, vector<P>> M;
    for(ll i = 0; i <= n; i++){
        ll p = division(x*i, d);
        ll q = modulo(x*i, d);
        ll l = p + i * (i-1)/2;
        ll r = p + (n-1)*i - i*(i-1)/2;
        M[q].emplace_back(l, r);
    }

    ll ans = 0;
    for(auto it = M.begin(); it != M.end(); ++it){
        vector<P> v = it->second;
        sort(v.begin(), v.end());
        ll fin = -(1LL << 60);
        for(ll i = 0; i < v.size(); i++){
            ll l = v[i].first;
            ll r = v[i].second;
            if (fin < l){
                ans += r - l + 1;
                fin = r;
            }
            else if (l <= fin && fin < r){
                ans += r - fin;
                fin = r;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 25456
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  int num = 0;
  for (int i = 1; i < N; i++){
    if(S.at(i) == 'E'){
      num++;
    }
  }
  ans = num;
  for (int i = 0; i < N-1; i++){
    if(S.at(i) == 'W'){
      num++;
    }
    if(S.at(i+1) == 'E'){
      num--;
    }
    ans = min(ans, num);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 900
n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0

for i in range(1, n):
  if a[i-1] + a[i] > x:
    tmp = a[i]
    a[i] = max(x-a[i-1], 0)
    ans += tmp - a[i]
  if a[i] == 0 and a[i-1] > x:
    tmp = a[i-1]
    a[i-1] = x
    ans += tmp - a[i-1]
print(ans)

Measured memory_bytes: 14252
# -*- coding: utf-8 -*-
import sys
lines = sys.stdin.readlines()
l = 0
while not ("-" in lines[l]):
 s = lines[l].replace('\n','')
 n = int(lines[l+1])
 l += 2
 t = sum(map(int, lines[l:l+n])) % len(s)
 print s[t:]+s[:t]
 l += n

Measured memory_bytes: 6456
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <functional>
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
// constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll H,W;
  cin >> W >> H;
  ll W_sum = 0;
  vector<ll> p(W);
  for(int i=0; i<W; i++){
    cin >> p[i];
    W_sum += p[i];
  }
  vector<ll> q(H);
  ll H_sum = 0;
  for(int i=0; i<H; i++){
    cin >> q[i];
    H_sum += q[i];
  }
  sort(p.begin(),p.end());
  vector<ll> S_p(W+1,0);
  for(int i=0; i<W; i++){
    S_p[i+1] = S_p[i] + p[i];
  }
  ll ans = W_sum + H_sum;
  for(int i=0; i<H; i++){
    ll num = lower_bound(p.begin(),p.end(),q[i]) - p.begin();
    // cout << num << "\n";
    ans += S_p[num];
    ans += (W-num)*q[i];
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 5572
#include <iostream>
#include <string>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> P;

struct L {
	P p, q;
	L(P p, P q) : p(p), q(q) {}
};

const double EPS = 1e-8;
const double PI  = acos(-1);

double dot(P a, P b) { return real(conj(a)*b); }
double cross(P a, P b) { return imag(conj(a)*b); }
double angle(P a, P b) { return arg(conj(a)*b); }

P footPerp(L l, P p) {
	return l.p + (l.q-l.p)*(dot(l.q-l.p, p-l.p) / (abs(l.q-l.p)*abs(l.q-l.p)));
}

double distLP(L l, P p){
	return abs(cross(l.q-l.p,p-l.p))/abs(l.q-l.p);
}

bool spIntersect(L l, P p){
	return abs(abs(l.p-p)+abs(l.q-p)-abs(l.p-l.q)) < EPS;
}

int main(){
	int N, A, B;
	P p[30], q[4];
	const string res[4] = {"Red", "Green", "Blue", "White"};
	while(cin >> N >> A >> B){
		for(int i=0;i<N;i++) cin >> p[i].real() >> p[i].imag();
		q[3] = P(A, (p[1]-p[0]).imag()/(p[1]-p[0]).real()*(A-p[0].real())+p[0].imag());
		q[0] = q[3] + (p[1]-p[0])/abs(p[1]-p[0]);
		q[2] = q[3] + (q[0]-q[3])*P(0,1);
		q[1] = q[2] + (q[3]-q[2])*P(0,1);
		int cur = 0;
		int last = 0;

		while(q[cur].real() < B){
			int next = (cur+1)%4;
			double rot = -0.5*PI;
			for(int i=last;i+1<N;i++){
				L l = L(p[i], p[i+1]);
				double dist = distLP(l, q[cur]);
				for(int j=1;j<=2;j++){
					if(distLP(l, q[cur]) < sqrt((double)j)+EPS){
						P f = footPerp(l, q[cur]);
						for(int k=-1;k<=1;k+=2){
							P c = f + k/abs(p[i+1]-p[i])*sqrt(j-dist*dist)*(p[i+1]-p[i]);
							if(spIntersect(l, c)){
								double tmp = angle(q[(cur+j)%4]-q[cur], c-q[cur]);
								if(tmp > EPS) continue;
								if(j==2 && tmp > -EPS) continue;
								if(tmp > rot){
									last = i;
									next = (cur+j)%4;
									rot = tmp;
								}
							}
						}
					}
				}
			}
			for(int i=1;i<=3;i++)
				q[(cur+i)%4] = q[cur] + (q[(cur+i)%4]-q[cur])*P(cos(rot), sin(rot));
			cur = next;
		}
		cout << res[cur] << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin >> N;
  vector<string> S(N);
  for(int i=0;i<N;i++){
    cin >> S[i];
  }
  sort(S.begin(),S.end());
  S.push_back("aaaaaaaaaaaa");
  int Max=1;
  int now=1;
  for(int i=1;i<=N;i++){
    if(S[i]==S[i-1]){
      now++;
    }
    else{
      Max=max(Max,now);
      now=1;
    }
  }
  for(int i=1;i<=N;i++){
    if(S[i]==S[i-1]){
      now++;
    }
    else{
      if(now==Max){
        cout << S[i-1] << endl;
      }
      now=1;
    }
  }
  return 0;
}

Measured memory_bytes: 16484
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <fstream>
#include <cmath>
#include <limits>
#include <chrono>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
#include <cassert>
#pragma warning (disable: 4996)
using namespace std;

using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

struct UnionFind {
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    if (n < 0)return 0;
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

ll merge_cnt(vector<ll>& a) {
    int n = a.size();
    if (n <= 1) { return 0; }

    ll cnt = 0;
    vector<ll> b(a.begin(), a.begin() + n / 2);
    vector<ll> c(a.begin() + n / 2, a.end());

    cnt += merge_cnt(b);
    cnt += merge_cnt(c);

    int ai = 0, bi = 0, ci = 0;
    while (ai < n) {
        if (bi < b.size() && (ci == c.size() || b[bi] <= c[ci])) {
            a[ai++] = b[bi++];
        }
        else {
            cnt += n / 2 - bi;
            a[ai++] = c[ci++];
        }
    }
    return cnt;
}

int main() {
    ll n;
    cin >> n;
    cout << 0 << endl;
    string s;
    cin >> s;
    if (s == "Vacant")return 0;
    else {
        ll ok = 0;
        ll ng = n;
        while (true) {
            ll mid = (ok + ng) / 2;
            cout << mid << endl;
            string t;
            cin >> t;
            if (t == "Vacant")return 0;
            if (!((t == s) ^ (ok % 2 == mid % 2))) {
                ok = mid;
                s = t;
            }
            else ng = mid;
        }
    }
}

Measured memory_bytes: 3808
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
N = int(input())
#開業されたN個要素を受け付ける
list = [int(input()) for i in range(N)]

list=sorted(list)
list.reverse()
#print(list)

ans = 0

for i, l in enumerate(list):
    if i==0:
        ans = l/2
    else:
        ans = ans + l

print(int(ans))


Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <set>
#include<malloc.h>
#include <map>
#include <vector>
#include <stack>
#include <queue>

#define ri(n) scanf("%d",&n)
#define oi(n) printf("%d\n",n)
#define rl(n) scanf("%lld",&n)
#define ol(n) printf("%lld\n",n)
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define rep1(i,l,r) for(int i=l;i<r;i++)
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int epg=10-8;
const int maxn=200000+10;
int a[maxn],d[maxn];
int n;
vector<int>g[maxn];
int ans[maxn];
int now;
void dfs(int u,int f)
{
    int tmp=lower_bound(d,d+n,a[u])-d;
    //cout<<tmp<<endl;
    int bf=now;
	ans[u]=max(now,tmp+1);
    now=max(now,tmp+1);
	int t=d[tmp];
    d[tmp]=a[u];
    
    for(int i=0;i<g[u].size();i++)
    {
        if(g[u][i]==f)
            continue;
        dfs(g[u][i],u);
    }
    d[tmp]=t;
    now=bf;
}
int main()
{
    //int n;
    	cin>>n;
    	d[0]=1e9;
        rep(i,1,n)
            scanf("%d",&a[i]),d[i]=1e9;
        rep(i,1,n-1)
        {
            int u,v;
            scanf("%d%d",&u,&v);
            g[u].push_back(v);
            g[v].push_back(u);
        }
        dfs(1,0);
        rep(i,1,n)
        printf("%d\n",ans[i]);
    
    return 0;
}

Measured memory_bytes: 31364
#include<iostream>
using namespace std;
main()
{
    double ret = 0;
    int n, k;
    cin >> n >> k;
    for( int i = 1; i <= n; i++ )
    {
        double tmp = i, idx = 1;
        while( tmp < k )
        {
            tmp *= 2;
            idx /= 2;
        }
        ret += idx;
    }
    printf( "%.13lf", ret / n );
    return 0;
}

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int a, b; cin >> a >> b;
	if (b % a == 0) cout << a + b << endl;
	else cout << b - a << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


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

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

    int a1 = a + b;
    int a2 = a + c;
    int a3 = b + c;

    int m = std::min(a1, std::min(a2, a3));
    cout << m << endl;
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N; cin >> N;
  ll N, M; cin >> N >> M;
  //vector<ll> a(N); rep(i, N) cin >> a[i];
  priority_queue<ll> a;
  rep(i, N) {
    ll a1;
    cin >> a1;
    a.push(a1);
  }
  rep(i, M) {
    ll a1;
    a1 = a.top();
    a.pop();
    a.push(a1 / 2);
  }
  ll ans = 0;
  while(!a.empty()) {
    ans += a.top();
    a.pop();
  }
  cout << ans << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 4300
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

constexpr int MOD = 1e9 + 7;
i64 mod_pow(i64 x, i64 n = MOD - 2) {
	i64 ret = 1;
	while(n) {
		if(n & 1) (ret *= x) %= MOD;
		(x *= x) %= MOD;
		n >>= 1;
	}
	return ret;
}

std::vector<i64> fact, inv;
i64 comb(int n, int r) {
	return fact[n] * inv[n - r] % MOD * inv[r] % MOD;
}

int main() {
	i64 h, w, k; scanf("%lld%lld%lld", &h, &w, &k);
	fact.resize(h * w + 1, 1); inv.resize(fact.size(), 1);
	for(i64 i = 0; i < (int)fact.size() - 1; i++) fact[i + 1] = (i + 1) * fact[i] % MOD;
	for(int i = 0; i < fact.size(); i++) inv[i] = mod_pow(fact[i]);
	
	i64 ans = 0;
	const i64 latte = comb(h * w - 2, k - 2);
	for(int loop = 0; loop < 2; loop++) {
		for(i64 d = 1; d < h; d++) {
			i64 A = h - d;
			ans += d * w % MOD * w % MOD * A % MOD;
			ans %= MOD;
		}
		std::swap(h, w);
	}
	(ans *= latte) %= MOD;
	
	printf("%lld\n", ans);
	return 0;
}


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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    
    string poor = "No";
    
    if ((a == b && b != c) || (a == c && a != b) || (b == c && a != b)) {
        poor = "Yes";
    }
    
    cout << poor << endl;
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include<bits/stdc++.h>

using namespace std;

int main()
{ int n;
cin>>n;
map <string, int> mp;
while(n--){
    string s;
    cin>>s;
    mp[s]++;
}
cout<<"AC x "<<mp["AC"]<<endl;
cout<<"WA x "<<mp["WA"]<<endl;
cout<<"TLE x "<<mp["TLE"]<<endl;
cout<<"RE x "<<mp["RE"]<<endl;





}


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

ll a, b, c, d;
map<ll, ll> memo;

ll solve(ll n) {
    if(n == 0) return 0;
    if(n == 1) return d;
    if(memo.count(n)) return memo[n];
    
    ll l2 = (n/2)*2;
    ll r2 = ((n+1)/2)*2;
    ll l3 = (n/3)*3;
    ll r3 = ((n+2)/3)*3;
    ll l5 = (n/5)*5;
    ll r5 = ((n+4)/5)*5;

    ll res = 1e18;
    if(n < res/d) res = n*d;
    res = min(res, llabs(l2-n)*d + a + solve(l2/2));
    res = min(res, llabs(r2-n)*d + a + solve(r2/2));
    res = min(res, llabs(l3-n)*d + b + solve(l3/3));
    res = min(res, llabs(r3-n)*d + b + solve(r3/3));
    res = min(res, llabs(l5-n)*d + c + solve(l5/5));
    res = min(res, llabs(r5-n)*d + c + solve(r5/5));

    memo[n] = res;

    return res;
}

int main() {
    int t;
    cin >> t;
    vector<vector<ll>> input(t, vector<ll>(5));
    rep(i, t) {
        rep(j, 5) {
            cin >> input.at(i).at(j);
        }
    }
    rep(i, t) {
        memo.clear();
        ll n = input.at(i).at(0);
        a = input.at(i).at(1);
        b = input.at(i).at(2);
        c = input.at(i).at(3);
        d = input.at(i).at(4);
        cout << solve(n) << endl;
    }
    return 0;
}

Measured memory_bytes: 4436
from itertools import permutations


def is_ok(a0, a1, a2):
    v = [False] * 4
    v[a0[0]] = True
    v[a0[1]] = True
    if a0[1] != a1[0]:
        return False
    v[a1[1]] = True
    if a1[1] != a2[0]:
        return False
    v[a2[1]] = True
    return all(v)


def main():
    p = []
    for _ in range(3):
        a, b = map(int, raw_input().split())
        p.append([a - 1, b - 1])
    for a0, a1, a2 in permutations(p):
        for i in range(8):
            if i & 1:
                b0 = a0
            else:
                b0 = a0[::-1]
            if i & 2:
                b1 = a1
            else:
                b1 = a1[::-1]
            if i & 4:
                b2 = a2
            else:
                b2 = a2[::-1]
            if is_ok(b0, b1, b2):
                print 'YES'
                return
    print 'NO'


if __name__ == '__main__':
    main()


Measured memory_bytes: 28524
#include <bits/stdc++.h>
#define write(x) printf("%d\n", x)
using namespace std;
typedef long long ll;
template <typename T>
void read(T &x)
{
	x = 0;
	char c;
	while (!isdigit(c = getchar()));
	do
	{
		x = (x << 1) + (x << 3) + (c ^ 48);
	}while (isdigit(c = getchar()));
}
int a[1005], b[1005];
int f[1005][20005];
int main()
{
	int H, n;
	read(H);read(n);
	for (int i = 1;i <= n;++i)
	{
		read(a[i]);read(b[i]);
	}
	memset(f[0], 0x3f, sizeof(f[0]));
	
	for (int i = 1;i <= n;++i)
		for (int j = H;j >= 0;--j)
		{
			f[i][j] = min(f[i][j + a[i]] + b[i], f[i - 1][j]);
		}
	write(f[n][1]);
	return 0;
}



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

int main()
{
	int n;
	cin >> n;
	vector<pair<int, int>> P;
	int in;
	for (int i = 1; i <= n; ++i)
	{
		cin >> in;
		P.push_back(make_pair(in, i));
	}
	sort(P.begin(), P.end());
	for (auto o : P)
	{
		cout << o.second << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1780
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), k = sc.nextInt();
        double ans = 0;
        for (int i = 1; i <= n; i++) {
            int cnt = 0;
            while (i * Math.pow(2, cnt) < k)
                cnt += 1;
            ans += (1/(double)n) * 1/(double)Math.pow(2, cnt);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21716
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <stack>

using namespace std;

int n, x, m[1005];
int mx = 1e7;

int main() {
    int sum = 0;
    int ans = 0;
    cin >> n>> x;
    for (int i = 0; i < n; i++) {
        cin>>m[i];
        mx = min(mx, m[i]);
    }
    sort(m,m+n);
    for (int i = 0; i < n; i++) {
        if (x-m[i]>=0) {
            ans++;
            x-=m[i];
        }
    }
    cout<<ans+x/m[0]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#define rep(i,n) for(int i =0;i<(int)(n);i++)
typedef long long ll;
using namespace std;
int main() {
	string s;
	cin >> s;
	ll k;
	cin >> k;
	bool flag = true;
	char ans;
	if (k < s.size()) {
		rep(i,k) {
			if (s[i] != '1') {
				flag = false;
				ans = s[i];
				break;
			}
		}
	}
	else if (k >= s.size()) {
		rep(i, s.size()) {
			if (s[i] != '1') {
				flag = false;
				ans = s[i];
				break;
			}
		}
	}
	if (flag) {
		cout << "1" << endl;
	}
	else {
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
*A, = map(int, input().split())

L = []
for i in range(N):
    v = A[i]
    L.append(v)
    for j in range(i+1, N):
        v += A[j]
        L.append(v)
ans = 0
for i in range(64):
    b = 1 << (63-i)
    c = 0
    R = []
    for j in range(len(L)):
        if b & L[j]:
            R.append(L[j])
    if len(R) >= K:
        L = R
        ans |= b
print(ans)

Measured memory_bytes: 67196
// #include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ll long long
#define pi pair<int,int>
#define vi vector<int>
int solve(){
  int x, y;
  cin>>x>>y;
  return y%2==0 && y/2>=x && 2*x>=y/2;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  // int t;
  // cin >> t;
  // for (int i = 1; i <= t; ++i) {
  //   cout << solve(i) << "\n";
  // }
  cout << (solve()?"Yes":"No") << "\n";

  return 0;
} 

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

using namespace std;

struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { 
        int rx = root(x); 
        int ry = root(y);
        if (rx == ry) return; 
        par[rx] = ry; 
    }

    bool same(int x, int y) { 
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

    UnionFind tree(N);

    for(int i = 0; i < M; i++) {
        int  x, y;
        cin >> x >> y;
        tree.unite(x-1, y-1); 
    }

    int cnt=0;
    for(int i=0;i<N;i++){
        if(!tree.same(0,i)){
            tree.unite(0, i);
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}

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

using namespace std;

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    c *= 2; // A,B1枚に必要な金額に直しておく
    int ans = a * x + b * y; // ABピザを買わない場合の値

    if (x > y) {
        ans = min({ans, c * y + a * (x - y), c * x});
    } else {
        ans = min({ans, c * x + b * (y - x), c * y});
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
 
using namespace std;
 
class Dice{
private:
  int D1;
  int D2;
  int D3;
  int D4;
  int D5;
  int D6;
 
public:
  Dice()
  {
  D1=1;
  D2=2;
  D3=3;
  D4=4;
  D5=5;
  D6=6;
  }
  Dice(int d1,int d2,int d3,int d4,int d5,int d6){
  D1=d1;
  D2=d2;
  D2=d2;
  D3=d3;
  D4=d4;
  D5=d5;
  D6=d6;
  }
 
  void roll(char dire){
  int dd1=D1;
  int dd2=D2;
  int dd3=D3;
  int dd4=D4;
  int dd5=D5;
  int dd6=D6;
   
  if(dire=='E')
    {
    D1=dd4;
    D3=dd1;
    D4=dd6;
    D6=dd3;
    }
  if(dire=='N')
  {
    D1=dd2;
    D2=dd6;
    D5=dd1;
    D6=dd5;
  }
  if(dire=='S')
  {
    D1=dd5;
    D5=dd6;
    D6=dd2;
    D2=dd1;
  }
  if(dire=='W')
  {
    D1=dd3;
    D3=dd6;
    D6=dd4;
    D4=dd1;
  }
   
  }
   
  int ue(){
  return D1;
  }
   
  int light(int up,int mae){
    int i;
    int j;
    int k;
    int l;
      for(i=0;i<4;i++)
      {
      roll('E');
     for(j=0;j<4;j++)
     {
      roll('S');
     for(k=0;k<4;k++)
     {
        roll('E');
        for(l=0;l<4;l++)
        {
        roll('S');
          if(up==D1 && mae==D2)
          return D3;
        }
     }
     }
    }
  }
   
   
  int check1(){
    return D1;
  }
  int check2(){
    return D2;
  }
  int check3(){
    return D3;
  }
  int check4(){
    return D4;
  }
  int check5(){
    return D5;
  }
  int check6(){
    return D6;
  }
 
 void in(int d1,int d2,int d3,int d4,int d5,int d6){
  D1=d1;
  D2=d2;
  D2=d2;
  D3=d3;
  D4=d4;
  D5=d5;
  D6=d6;
  }
};
 
int main()
{
  int di[100][6]={};
  int i;
  int j;
  int k;
  int l;
  int n;
  int a;
  int b;
  int ch=0;
   
  cin >> n;
   
  for(i=0;i<n;i++)
    {
      for(j=0;j<6;j++)
        cin >> di[i][j];
    }
     
     
     
    Dice dice[n];
     
  for(i=0;i<n;i++)
  {
     //Dice dice[i](di[i][0],di[i][1],di[i][2],di[i][3],di[i][4],di[i][5]);
     dice[i].in(di[i][0],di[i][1],di[i][2],di[i][3],di[i][4],di[i][5]);
  }
   
   
  for(a=0;a<n;a++)
  {
  for(b=a+1;b<n;b++)
  {
  for(i=0;i<4;i++)
  {
    dice[a].roll('E');
    for(j=0;j<4;j++)
    {
      dice[a].roll('S');
       
      for(k=0;k<4;k++)
      {
         dice[a].roll('E');
         for(l=0;l<4;l++)
         {
          dice[a].roll('S');
          if(dice[a].check1()==dice[b].check1() &&dice[a].check2()==dice[b].check2() &&dice[a].check3()==dice[b].check3()&&dice[a].check4()==dice[b].check4()&&dice[a].check5()==dice[b].check5() &&dice[a].check6()==dice[b].check6() )
              {
                 
                goto Exit;
              }
         }
          
      }
    }
  }
  }
  }
 
 
    cout <<"Yes\n";
    return 0;
Exit:;
    cout << "No\n";
   
   
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
#include <algorithm>
using namespace std;
 
#define ll long long int 
#define ull unsigned long long int
#define db double
#define ld long double
#define MOD 1000000007
#define inf (1LL << 62)
#define pi acos(-1.0)
#define si(a) scanf("%lld",&a)
#define sd(n) scanf("%lf", &n)
#define for1(i, stop) for(ll i = 1; i <= stop; i++)
#define for0(i, stop) for(ll i = 0; i < stop; i++)
#define rep1(i, start) for(ll i = start; i >= 1; i--)
#define rep0(i, start) for(ll i = (start-1); i >= 0; i--)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define pb(v,a) v.push_back(a)
#define pll pair <ll, ll>
#define mp make_pair
#define pbp(v,a,i) v.push_back(make_pair(a,i)) 
#define srt(v) sort(v.begin(),v.end())
#define rv(v) reverse(v.begin(),v.end())
#define ms(n, i) memset(n, i, sizeof(n))
#define debug printf("Debug\n");
#define en '\n'
 
 
 
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
 
int main()
{
	_fastio
	char a;
	cin>>a;
	if(a>='A' && a<='Z')
		cout<<'A'<<en;
	else
		cout<<'a'<<en;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int h, w;
string s[52];

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

bool flg[64][64];

int solve(){
  queue<int> q;
  q.push(1); q.push(1); q.push(1); flg[1][1] = true;
  while(!q.empty()){
    int i0 = q.front(); q.pop();
    int j0 = q.front(); q.pop();
    int t = q.front(); q.pop();
    if (i0==h && j0==w) return t;
    for(int i=0;i<4;i++){
      int i1 = i0 + dy[i], j1 = j0 + dx[i];
      if (s[i1][j1]=='.' && !flg[i1][j1]){
        q.push(i1); q.push(j1); q.push(t+1); flg[i1][j1] = true;
      }
    }
  }
  return -1;
}

int main(void){
  cin >> h >> w;
  for(int i=1;i<=h;i++){cin >> s[i]; s[i] = "#" + s[i] + "#";}
  for(int j=0;j<w;j++) {s[0] += '#', s[h+1] += '#';}
  int minLen = solve();
  if (minLen==-1) {cout << -1 << endl; return 0;}
  int numSharp = 0;
  for(int i=1;i<=h;i++)for(int j=1;j<=w;j++) if (s[i][j]=='#') numSharp++;
  cout << h * w - numSharp - minLen << endl;
  return 0;
}
  

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  int ans = 0;
  for(int i = 1; i <= n; i++){
		cin >> a[i-1];
		b[i-1] = i;
		if(b[i-1] != a[i-1]){
			ans++;
		}		  	
  }
  ans = max(ans, 0);
  if(ans > 2){
  	cout << "NO" << endl;
  	return 0;
  }
  cout << "YES" << endl;
  return 0;
}

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

int main() {
	// your code goes here
	int n,k;
  int count=0,m;
  	cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>m;
    if(m>=k)
      count++;
}
  cout<<count;
  return 0;
}

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

int main() {
    int N, W;
    cin >> N >> W;
    vector<ll> w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];

    vector<vector<ll>> dp(N + 1, vector<ll>(W + 1, 0));

    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            if (j - w[i] >= 0)
                dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
            else
                dp[i + 1][j] = dp[i][j];
        }
    }
    // for (auto v : dp) {
    //     for (ll a : v) {
    //         cout << a << " ";
    //     }
    //     cout << endl;
    // }
    cout << dp[N][W] << endl;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll inf=1000000000000000000;
ll mod=1000000007;
int main(){
  ll n;cin>>n;
  string s;cin>>s;
  ll cnt[26];
  fill(cnt,cnt+26,0);
  for(ll i=0;i<n;i++){
    ll u=s[i]-'a';
    cnt[u]++;
  }
  ll ans=1;
  for(ll i=0;i<26;i++){
    ans*=(cnt[i]+1);
    ans%=mod;
  }
  cout<<(ans-1+mod)%mod<<endl;
}

Measured memory_bytes: 512
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
txy = [list(map(int, readline().split())) for _ in range(n)]

t = txy[0][0]
d = abs(txy[0][1]) + abs(txy[0][2])

if t < d:
    print('No')
    exit()
for i in range(n-1):
    t = txy[i+1][0] - txy[i][0]
    d = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
    if t < d:
        print('No')
        exit()
    if t % 2 == 0 and d % 2 != 0:
        print('No')
        exit()
    if t % 2 != 0 and d % 2 == 0:
        print('No')
        exit()
print('Yes')

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


int main () {
    char N = '1';
    string S;
    unsigned long long K;
    cin >> S >> K;
    for (int i=0;i<K;i++){
        if (S[i]=='1') continue;
        else {
            N = S[i];
            break;
        }
    };
    cout << N << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=500010;

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

    ll n;
    cin>>n;
    n=n%10;
    if(n==3){
        cout<<"bon";
    }
    else if(n==0||n==1||n==6||n==8){
        cout<<"pon";
    }
    else{
        cout<<"hon";
    }

    return (0);
}


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

void solve(long long N, long long K) {
  N%K==0?cout<<0<<endl:cout<<1<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  solve(N, K);
  return 0;
}


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

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

int main()
{
	long long a, b, m;
	while (cin >> a >> b) {
		long long c = gcd(a, b);
		m = a*b/c;
		cout << c << " " << m << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>
#include <iostream>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <algorithm>
#include <math.h>
#include <queue>
#include <vector>
#include <string.h>
#define mem(x,b) memset(x,b,sizeof(x))
#define mp(a,b) make_pair(a,b)
#define debug(a) cout<<a<<endl
#define maxn 200005
using namespace std;
typedef long long ll;
typedef double db;
const int mod=1e9+7;
char s[maxn];
int main()
{
    int k;
    scanf("%d",&k);
    scanf("%s",s);
    if(strlen(s)>k){
    	s[k]='\0';
    	printf("%s",s);
    	printf("...\n");
    }else{
    	printf("%s\n",s);
    }
    
    return 0;
}


Measured memory_bytes: 3824