akhauriyash/Code-Regression huggingface dataset:
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

class UnionFindTree {
public:
    this(size_t n) {
        parent = iota(n).array();
        rank = new size_t[](n);
    }
    size_t find(size_t n) {
        if(n == parent[n]) {
            return n;
        } else {
            parent[n] = find(parent[n]);
            return parent[n];
        }
    }
    void unite(size_t n, size_t m) {
        auto p1 = find(n);
        auto p2 = find(m);
        if(n == m) {
            return;
        }
        if(rank[p1] < rank[p2]) {
            swap(p1, p2);
        }
        if(rank[p1] == rank[p2]) {
            ++rank[p1];
        }
        parent[p2] = p1;
    }
private:
    size_t[] parent;
    size_t[] rank;
}
unittest {
    auto uft = new UnionFindTree(10);
    foreach(i; iota(10)) {
        assert(uft.find(i) == i);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0).drop(1)) {
        uft.unite(i, i-3);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0)) {
        assert(uft.find(0) == uft.find(i));
    }
    foreach(i; iota(10).filter!(a => a%3 != 0)) {
        assert(uft.find(0) != uft.find(i));
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

int test(int n) {
    long m = n | (n<<24);
    int ans = 24;
    foreach(i; iota(24)) {
        if(!(m & (1 << i))) {
            continue;
        }
        foreach(j; iota(1,24)) {
            if(m & (1 << (i+j))) {
                ans = min(ans, j);
                break;
            }
        }
    }
    return ans;
}

void main(){
    auto n = readLong();
    auto d = readLongs();

    auto s = redBlackTree!int;
    s.insert(1);
    foreach(di; d) {
        auto t = redBlackTree!int;
        foreach(si; s) {
            if(!(si & (1 << di))) {
                t.insert(si | (1 << di));
            }
            if(!(si & (1 << ((24-di)%24)))) {
                t.insert(si | (1 << ((24-di)%24)));
            }
        }
        s = t;
    }
    long ans;
    foreach(si; s) {
        ans = max(ans, test(si));
    }
    writeln(ans);
}



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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

ll n;

void func(ll cur, int use, ll &counter) {
    if (cur > n) return;
    if (use == 0b111) counter++;

    func(cur * 10 + 7, use | 0b001, counter);
    func(cur * 10 + 5, use | 0b010, counter);
    func(cur * 10 + 3, use | 0b100, counter);
}

int main() {
    cin >> n;
    ll ans = 0;
    func(0, 0, ans);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define INF 10000005;
using namespace std;
long long n, W, w[105], v[105], dp[105][100005];
int main(){
	cin >> n >> W;
	for(int i=1;i<=n;i++)
		cin >> w[i] >> v[i], dp[0][i]=0;
	for(int i=n;i<100005;i++) dp[0][i]=0;
	dp[0][0]=0;
	for (int j=1;j<=n;j++){ 
		for (int i=0;i<=W;i++){
			long long bo; 
			if (i-w[j]<0)  bo=-INF
			else bo=dp[j-1][i-w[j]]+v[j];
			dp[j][i]=max(dp[j-1][i], bo); 
		} 
	} 
	cout << dp[n][W];
} 

Measured memory_bytes: 80128
#include <cstdio>
using namespace std;
typedef long long ll;
const ll Mod = 1e9 + 7;
ll Ad(ll x, ll y) { return ((x + y) > Mod) ? (x + y - Mod) : (x + y); }
ll Dc(ll x, ll y) { return ((x - y) < 0) ? (x - y + Mod) : (x - y); }
ll Ml(ll x, ll y) { return (long long)x * y % Mod; }
ll ksm(ll x, long long y) {
	ll ret = 1;
	for (; y; y >>= 1, x = Ml(x, x))
		if (y & 1ll)
			ret = Ml(ret, x);
	return ret;
}
struct Matrix {
	ll r, c, A[2][2];
	Matrix() : r(0), c(0) {}
	Matrix(ll _r, ll _c, ll a00, ll a01, ll a10, ll a11) : r(_r), c(_c) {
		A[0][0] = a00;
		A[0][1] = a01;
		A[1][0] = a10;
		A[1][1] = a11;
	}
	void Print() {
		printf("r : %lld c : %lld\n", r, c);
		for (ll i = 0; i < r; ++i) {
			for (ll j = 0; j < c; ++j)
				printf("%lld ", A[i][j]);
			printf("\n");
		}
	}
};
Matrix operator*(const Matrix &a, const Matrix &b) {
	Matrix ret;
	ret.r = a.r;
	ret.c = b.c;
	for (ll i = 0; i < ret.r; ++i)
		for (ll j = 0; j < ret.c; ++j) {
			ret.A[i][j] = 0;
			for (ll k = 0; k < a.c; ++k)
				ret.A[i][j] = Ad(ret.A[i][j], Ml(a.A[i][k], b.A[k][j]));
		}
	return ret;
}
void ksm(Matrix &ans, Matrix x, ll y) {
	for (; y; y >>= 1, x = x * x)
		if (y & 1) ans = ans * x;
}
ll eup, edown, H, W, ud, lr;
const ll NH = 1e3 + 5;
char base[NH][NH];
long long K;
int main() {
	scanf("%lld%lld%lld", &H, &W, &K);
	for (ll i = 1; i <= H; ++i) scanf("%s", base[i] + 1);
	for (ll i = 1; i <= W; ++i) if (base[1][i] == '#') ud += (base[1][i] == base[H][i]);
	for (ll i = 1; i <= H; ++i) if (base[i][1] == '#') lr += (base[i][1] == base[i][W]);
	if (ud && lr)
		printf("1\n");
	else if (ud || lr) {
		Matrix ans(1, 2, 1, 1, 0, 0);
		ll cnt = 0;
		for (ll i = 1; i <= H; ++i)
			for (ll j = 1; j <= W; ++j)
				cnt += (base[i][j] == '#');
		ll con = 0;
		if (ud) {
			for (ll i = 2; i <= H; ++i)
				for (ll j = 1; j <= W; ++j)
					if (base[i][j] == '#')
						con += (base[i][j] == base[i-1][j]);
		} else {
			for (ll i = 1; i <= H; ++i)
				for (ll j = 2; j <= W; ++j)
					if (base[i][j] == '#')
						con += (base[i][j] == base[i][j-1]);
		}
		Matrix b(2, 2, cnt, 0, Dc(0, con), ud | lr);
		ksm(ans, b, K-1);
		printf("%lld\n", ans.A[0][0]);
	} else {
		ll cnt = 0;
		for (ll i = 1; i <= H; ++i)
			for (ll j = 1; j <= W; ++j)
				cnt += (base[i][j] == '#');
		printf("%lld\n", ksm(cnt, K - 1));
	}
	return 0;
}

Measured memory_bytes: 4216
import sys
from itertools import product
from bisect import bisect_right as bi_r

shichigosan = set('357')

cand = []
for i in range(3, 10):
    for x in product('357', repeat=i):
        x = ''.join(x)
        if set(x) == shichigosan:
            cand.append(int(''.join(x)))

n = int(sys.stdin.readline().rstrip())

def main():
    return bi_r(cand, n)

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 4212
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
int a,n,b;
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>a>>n;
	while(n)
	{
		--n;
		cin>>b;
		a-=b;
	}
	if(a>0)
	{
		cout<<"No";
	}
	else
	{
		cout<<"Yes";
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a, b;
    cin >> a >> b;
    int ans = (a + b) / 2;
    cout << ans + ((a + b) % 2)   << endl;
    

        
    
        
    
   
    
    
    
    
    
}



Measured memory_bytes: 3628
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const a = parseInt(args[0][0], 10)
	const b = parseInt(args[0][1], 10)
	const c = parseInt(args[0][2], 10)
	console.log(a + b + c - Math.max(a, b, c))
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 21064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define C_MAX 30
#define N_MAX 100001

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

  bool r[N_MAX][C_MAX];

  REP(i, N_MAX){
    REP(j, C_MAX){
      r[i][j] = 0;
    }
  }

  int min_x = N_MAX;
  int max_y = 0;
  REP(i, n){
    int x, y, z;
    cin >> x >> y >> z;
    FOR(j, x - 1, y){
      r[j][z - 1] = 1;
    }
    min_x = min(min_x, x - 1);
    max_y = max(max_y, y);
  }

  int ans = 1;
  FOR(i, min_x, max_y){
    ans = max(ans, accumulate(r[i], r[i] + C_MAX, 0));
  }

  cout << ans << endl;

  return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
clock_t startTime;
long double getTime(){
	return (long double)(clock()-startTime)/CLOCKS_PER_SEC;
}

int main(){
	startTime=clock();
	int n;
	cin >> n;
	ll a[n];
	ll sum=0,sum1=0;
	FOR(i,n){
		cin >> a[i];
		sum1+= (i%2)? 2*a[i]: 0; 
		sum+=a[i];
	}
	ll x[n];
	x[0]=sum-sum1;
	cout << x[0]<<"\n";
	for(int i=1;i < n;i++){
			x[i]=-x[i-1]+2*a[i-1];
			cout << x[i]<<"\n";
	}

	return 0;
}

Measured memory_bytes: 5200
//abc160_b.cpp
//Sat Mar 28 21:02:20 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int ans = 0;
	int gohyaku = x/500;
	ans += gohyaku*1000;
	x = x%500;
	int goen = x/5;
	ans += goen*5;

	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vp;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
#define M 1000000007
//---------------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)

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

void Main(){
  string s;
  cin>>s;
  string t = s;
  map<char,int> m;
  if(s.length()==26){
    if(s=="zyxwvutsrqponmlkjihgfedcba"){
      cout<<-1<<endl; return;
    }
    next_permutation(s.begin(),s.end());
    rep(i,s.length()){
      if(s[i] != t[i]){
        s.erase(s.begin()+i+1,s.end());
        break;
      }
    }
  }else{
    rep(i,s.length()){
      m[s[i]]=i+1;
    }
    for(char i='a';i<='z';i++){
      if(m[i]==0){ s+=i; break;}
    }
  }
  cout<<s<<endl;
} int main(int argc,char** argv)
{fastio; myio; myloopset Main();}


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

int main() {
    int n;
    string w[100];
    set<string> s;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> w[i];
        s.insert(w[i]);
    }

    bool flg = true;

    if (s.size() != n)
        flg = false;

    for (int i = 0; i < n-1; i++) {
        if (w[i].substr((w[i].size()-1), 1) != w[i+1].substr(0,1)) {
            flg = false;
            break;
        }
    }

    if (flg)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
        
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
   string s;
   cin >> s;
   if(s=="hi"||s=="hihi"||s=="hihihi"||s=="hihihihi"||s=="hihihihihi") cout << "Yes" << endl;
   else cout << "No" << endl;
}

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

bool mentsu(vector<int>& cnt) {
    for(int i = 0; i + 2 < 9; ++i) {
        int r = cnt[i] % 3;
        if(cnt[i + 1] >= r && cnt[i + 2] >= r) {
            cnt[i + 1] -= r, cnt[i + 2] -= r;
        } else {
            return false;
        }
    }
    return cnt[7] % 3 == 0 && cnt[8] % 3 == 0;
}

bool check(vector<int> const& cnt) {
    for(int i = 0; i < 9; ++i) {
        if(cnt[i] < 2) continue;
        auto tmp = cnt;
        tmp[i] -= 2;
        if(mentsu(tmp)) {
            return true;
        }
    }
    return false;
}

int main() {
    string hand;
    while(cin >> hand) {
        vector<int> cnt(9), ans;
        for(auto c : hand) {
            cnt[c - '0' - 1]++;
        }

        for(int i = 1; i <= 9; ++i) {
            if(cnt[i - 1] >= 4) {
                continue;
            }
            cnt[i - 1]++;
            if(check(cnt)) ans.push_back(i);
            cnt[i - 1]--;
        }

        if(ans.empty()) {
            ans.push_back(0);
        }
        for(int i = 0; i < (int)ans.size(); ++i) {
            cout << ans[i] << " \n"[i + 1 == (int)ans.size()];
        }
    }
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
 
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define endl '\n'
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
 
const int MAXN = 2e5 + 5;

int N, A[105];
 
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> N;
	int ans = 1;
	for(int i=1; i<=N; i++) {
		cin >> A[i];
		if(A[i] % 2 == 0) {
			if(A[i] % 5 && A[i] % 3) ans = 0;
		}
	}
	if(ans) cout << "APPROVED";
	else cout << "DENIED";
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private static Scanner sc;

	public static void main(String[] args) throws Exception {
		sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Q = sc.nextInt();

		String[] S = sc.next().split("");

		int[][] questions = new int[Q][2];

		for (int i = 0; i < questions.length; i++) {
			questions[i][0] = sc.nextInt();
			questions[i][1] = sc.nextInt();

		}

		// あらかじめN字ごとのACの表れる回数を数えておく

		int[] arry = new int[S.length];

		for (int i = 0; i < S.length; i++) {
			if (i == 0) {
				arry[i] = 0;
			} else {
				if ("AC".equals(S[i - 1] + S[i])) {
					arry[i] = arry[i - 1] + 1;
				} else {
					arry[i] = arry[i - 1];
				}
			}
		}

		for (int i = 0; i < questions.length; i++) {
			System.out.println(arry[questions[i][1] - 1] - arry[questions[i][0] - 1]);
		}

	}
}


Measured memory_bytes: 110628
#include <iostream>
#include <cmath>
#include <cstdio>
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
    char s[4];
    for(int i=0;i<4;i++){
        cin>>s[i];
    }
    string ans="Good";
    for(int i=0;i<3;++i){
        if(s[i]==s[i+1]){
            ans="Bad";
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
from collections import Counter


N = int(input())

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

def judge_tri(a,b,c,dic):
    if a + b > c:
        return dic[a]*dic[b]*dic[c]
    else:
        return 0

count = Counter(L)
num_list = sorted(list(count.keys()))
num_tri = 0
if len(num_list) > 2:
    for i in range(len(num_list)-2):
        a = num_list[i]
        for j in range(i+1, len(num_list)-1):
            b= num_list[j]
            for k in range(j+1, len(num_list)):
                c = num_list[k]
                num_tri += judge_tri(a,b,c,count)
    print(num_tri)
else:
    print(0)








Measured memory_bytes: 68440
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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;
}

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void Dijkstra(Graph& G, ll s, Array& d) {//O(|E|log|V|)
	d.resize(G.size());
	REP(i, d.size())d[i] = INF;
	d[s] = 0;
	priority_queue<P, vector<P>, greater<P>> q;
	q.push(make_pair(0, s));
	while (!q.empty()) {
		P a = q.top();
		q.pop();
		if (d[a.second] < a.first)continue;
		REP(i, G[a.second].size()) {
			Edge e = G[a.second][i];
			if (d[e.to] > d[a.second] + e.cap) {
				d[e.to] = d[a.second] + e.cap;
				q.push(make_pair(d[e.to], e.to));
			}
		}
	}
}

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

	ll x;
	cin >> x;

	ll n = x / 11;
	n *= 2;

	if (x % 11!=0) {
		if (x % 11 <= 6) {
			n++;
		}
		else {
			n += 2;
		}
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
import math
from copy import deepcopy
from collections import deque
sys.setrecursionlimit(20000000)


def main():
    from collections import defaultdict
    S = input()
    ans = defaultdict(str)
    for s in S:
        if s in ans:
            ans[s] += 1
        else:
            ans[s] = 1

    if len(ans) == 2 and ans[S[0]] == 2:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()



Measured memory_bytes: 3444
import fractions
#import math
def lcm(x, y):
	return (x * y) // fractions.gcd(x, y);
	#return (x * y) // math.gcd(x, y);

s = input().split(" ");
a = int(s[0]);
b = int(s[1]);
c = int(s[2]);
d = int(s[3]);
num_c = b//c - (a-1)//c;
num_d = b//d - (a-1)//d; 
num_cd = b//lcm(c, d) - (a-1)//lcm(c,d);
print(b - a + 1 -(num_c + num_d - num_cd))

Measured memory_bytes: 5048
import math

a,b,x = map(int,input().split())

if x <= (a * a * b / 2):
  height = x / (a*b) * 2
  ans = math.degrees(math.atan(b/height))
else:
  joutei = x /(a**2) *2 - b
  ans = math.degrees(math.atan((b-joutei)/a))

print(ans)

Measured memory_bytes: 3060
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

/**
 * Segment Tree. This data structure is useful for fast folding on intervals of an array
 * whose elements are elements of monoid M. Note that constructing this tree requires the identity
 * element of M and the operation of M.
 * Verified by: yukicoder No. 259 (http://yukicoder.me/submissions/100581)
 */
struct SegTree<I, BiOp> {
    n: usize,
    dat: Vec<I>,
    op: BiOp,
    e: I,
}

impl<I, BiOp> SegTree<I, BiOp>
    where BiOp: Fn(I, I) -> I,
          I: Copy {
    pub fn new(n_: usize, op: BiOp, e: I) -> Self {
        let mut n = 1;
        while n < n_ { n *= 2; } // n is a power of 2
        SegTree {n: n, dat: vec![e; 2 * n - 1], op: op, e: e}
    }
    /* ary[k] <- v */
    pub fn update(&mut self, idx: usize, v: I) {
        let mut k = idx + self.n - 1;
        self.dat[k] = v;
        while k > 0 {
            k = (k - 1) / 2;
            self.dat[k] = (self.op)(self.dat[2 * k + 1], self.dat[2 * k + 2]);
        }
    }
    /* l,r are for simplicity */
    fn query_sub(&self, a: usize, b: usize, k: usize, l: usize, r: usize) -> I {
        // [a,b) and  [l,r) intersects?
        if r <= a || b <= l { return self.e; }
        if a <= l && r <= b { return self.dat[k]; }
        let vl = self.query_sub(a, b, 2 * k + 1, l, (l + r) / 2);
        let vr = self.query_sub(a, b, 2 * k + 2, (l + r) / 2, r);
        (self.op)(vl, vr)
    }
    /* [a, b] (note: inclusive) */
    pub fn query(&self, a: usize, b: usize) -> I {
        self.query_sub(a, b + 1, 0, 0, self.n)
    }
}


const MOD: i64 = 1_000_000_007;

fn solve() {
    let n: usize = get();
    let ni = n as i64;
    let mut dp = vec![0; n + 1];
    let mut acc = vec![0; n + 1];
    dp[0] = 1;
    dp[1] = ni;
    acc[0] = 1;
    acc[1] = 1 + ni;
    for i in 2 .. n + 1 {
        let mut tot = (ni - 1) * (ni - 1) % MOD;
        tot += dp[i - 1];
        if i >= 3 {
            tot = (tot + acc[i - 3]) % MOD;
        }
        tot += (n + 1 - i) as i64;
        dp[i] = tot % MOD;
        acc[i] = (acc[i - 1] + tot) % MOD;
    }
    println!("{}", dp[n]);
}

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


Measured memory_bytes: 24956
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

using namespace std;

int main(void) {
  int vs[2];
  REP(i, 2) {
    cin >> vs[i];
  }
  int res = -100; 
  REP(i, 2) {
    REP(j, 2) {
      int cur = vs[i] + vs[j];
      if(i == j) {
        --cur;
      }
      res = max(res, cur);
    }
  }
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>

#define pb push_back
#define mp make_pair

using namespace std;

template<typename T>inline void upmin(T &x,T y) { y<x?x=y:0; }
template<typename T>inline void upmax(T &x,T y) { x<y?x=y:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;

const int N=1000;

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

int a[N];
int main()
{
	int mx=0,mi=0,i,t,n=gi();
	for (i=1;i<=n;i++) a[i]=gi(),mx=max(mx,a[i]),mi=min(mi,a[i]);
	cout<<n*2-1<<endl;
	if (mx>-mi) {
		for (i=1;i<=n;i++) if (a[i]==mx) t=i;
		for (i=1;i<=n;i++) printf("%d %d\n",t,i);
		for (i=1;i<n;i++) printf("%d %d\n",i,i+1);
	} else {
		for (i=1;i<=n;i++) if (a[i]==mi) t=i;
		for (i=1;i<=n;i++) printf("%d %d\n",t,i);
		for (i=n-1;i;i--) printf("%d %d\n",i+1,i);
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;

itn N, M, A[101010], B[101010];

int gcd(int a, int b) {
    while (b) {
        int c = b;
        b = a % b;
        a = c;
    }
    return a;
}
int lcm(int a, int b) {
    if (!a || !b)
        return 0;
    return a * b / gcd(a, b);
}


void solve() {
    int ans = 0;
    int t = 1;
    FOR(i, N) {
        t = lcm(t, B[i]);
    }
    bool flag = true;
    FOR(i, N) {
        if ((t / B[i]) % 2 == 0)
            flag = false;
    }
    if (flag) {
        ans = M / t;
        ans = (ans + 1) / 2;
    } else {
        ans = 0;
    }
    chmax(ans, 0ll);
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    FOR(N) {
        cin >> A[i];
        B[i] = A[i] / 2;
    }
    solve();
    return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <array>
#include <assert.h>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;


int main() {
    cout << setprecision(30);
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    ll n, d;
    cin >> n >> d;
    d = 2 * d + 1;
    cout << ((n + d - 1) / d) << endl;

    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(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define rFORq(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int x; SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long x; SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
////////////////////////////////////////////////////////////////////
const ll p = 1000000007;
int main(){
    int H,W,K; SCD3(H,W,K);
    static ll dp[102][10] = {};

    dp[0][1] = 1;

    FORq(i,0,H){
        FORq(j,1,W){
            ll X,Y,Z;
            X=0;Y=0;Z=0;

            REP(k,(1<<W-1)){
                bitset<7> bs(k);
                bool skip = false;
                REP(i,6){
                    if ((bs[i] == bs[i+1]) and (bs[i])) skip = true;
                }

                if (skip) continue;
                
                if ((bs[j-2]) && (j != 1)) X++;
                else if (bs[j-1]) Z++;
                else Y++;

                //cout << bs << endl;
            }

            //printf("(i,j) = (%d,%d) , X = %lld, Y = %lld, Z = %lld\n",i,j,X,Y,Z);

            dp[i+1][j-1] = (dp[i+1][j-1] + (X * dp[i][j]) % p) % p;
            dp[i+1][j] = (dp[i+1][j] + (Y * dp[i][j]) % p) % p;
            dp[i+1][j+1] = (dp[i+1][j+1] + (Z * dp[i][j]) % p) % p;

        }
    }

    PRINTLLD(dp[H][K]);

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a;
	cin>>a;
	int minn=1000000;
	while(a>=100){
		minn=min(minn,(int)abs(a%1000-753));
		a/=10;
	}
	cout<<minn<<endl;
}

Measured memory_bytes: 256
n = input()

sgs = ['7', '5', '3']
cands = {3:[]}
for i in sgs:
    for j in sgs:
        for k in sgs:
            cands[3].append(i+j+k)
for d in range(4, 10):
    cands[d] = []
    for cand in cands[d-1]:
        for i in sgs:
            cands[d].append(cand+str(i))
# print(cands)
ans = 0
for d, value in cands.items():
    for v in value:
        if int(v) <= int(n) and len(set(list(v))) == 3:
            ans += 1
print(ans)


Measured memory_bytes: 5228
#include "bits/stdc++.h"
using namespace std;

//23
typedef long long ll;
			
int main() {
	ll a, b;
	cin >> a >> b;
	if (b % 2) {
		cout << (a/b) * (a / b) * (a / b);
	}else {
		ll p = (a - (b / 2)) / b; //
		if (a >= b / 2) p++;	
		ll e = (a / b) * (a / b) * (a / b);
		cout << (p * p * p) + e;
	}
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <stdlib.h>

int main() {
    int N;
    scanf("%d", &N);
    int *A = malloc((1+N) * sizeof(int));
    int *ans = malloc((1+N) * sizeof(int));
    for (int i = 1; i <= N; i++) {
        scanf("%d", &A[i]);
        ans[A[i]] = i;
    }
    for (int i = 1; i <= N; i++) {
        printf("%d", ans[i]);
        if (i != N)
            printf(" ");
        else
            printf("\n");
    }
    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>


using namespace std;

typedef long long ll;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
typedef pair<ll, ll> pll;


int main() {
	int n, k;
	cin >> n >> k;
	vector<pll> p(n);
	vector<ll>	x(n);
	vector<ll> y(n);
	for (int i = 0; i < n; i++) {
		
		cin >> x[i] >> y[i];
		p[i] = make_pair(x[i], y[i]);
	}

	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	ll ans = BIG_NUM * 5;

	for (int xi = 0;xi + k <=n;xi++) {
		for (int xj = xi + k - 1;xj < n;xj++) {
			ll dx = x[xj] - x[xi];


			for (int yi = 0;yi + k <=n;yi++) {
				for (int yj = yi + k - 1;yj < n;yj++) {
					ll dy = y[yj] - y[yi];

					int cnt = 0;
					for (int i = 0; i < n;i++) {
						if (x[xi] <= p[i].first &&p[i].first <= x[xj]
							&& y[yi] <= p[i].second && p[i].second <= y[yj]) {

							cnt++;
						}
					}
					if (cnt >= k) {
						ans = min(ans, dx*dy);
					}
						
				}
			}
		}
	}
	cout << ans << endl;
}



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

int main()
{
  int r, g, b;
  cin >> r >> g >> b;
  int n = 100*r + 10*g + b;
  if (n % 4 == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  
  return 0;
}

    

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

#define MAX 50

int N, A, B;
long long v[MAX];

long long C[MAX + 1][MAX + 1];

int main() {
	cin >> N >> A >> B;
	for( int i = 0; i < N; i++ ) {
		cin >> v[i];
	}

	for( int i = 0; i <= 50; i++ ) {
		for( int j = 0; j <= i; j++ ) {
			if( j == 0 || j == i ) {
				C[i][j] = 1;
			}
			else {
				C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
			}
		}
	}

	sort( v, v + N, greater<long long>() );
	double ave = 0;
	for( int i = 0; i < A; i++ ) {
		ave += v[i];
	}
	ave /= A;

	long long ans = 0;
	if( v[0] == v[A - 1] ) {
		int X = 0;
		for( int i = 0; i < N; i++ ) {
			if( v[i] == v[A - 1] ) {
				X++;
			}
		}
		for( int i = A; i <= B; i++ ) {
			ans += C[X][i];
		}
	}
	else {
		int X = 0;
		int Y = 0;
		for( int i = 0; i < N; i++ ) {
			if( v[i] == v[A - 1] ) {
				X++;
				if( i < A ) {
					Y++;
				}
			}
		}
		ans = C[X][Y];
	}

	cout << fixed << setprecision(5) << ave << endl;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    int aa = 1;
    int bb = 1;
    if (a.equals("D")) aa = -1;
    if (b.equals("D")) bb = -1;
    if (aa * bb > 0) {
      System.out.println("H");
    } else {
      System.out.println("D");
    }
  }
}


Measured memory_bytes: 22868
import sys
input = sys.stdin.readline

k, n = map(int, input().split())
a = list(map(int, input().split()))
a.append(k)
a[n] += a[0]
memo = [0] * n
for i in range(n):
    memo[i] = a[i + 1] - a[i]
print(sum(memo) - max(memo))


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

const int N = 200010;

typedef pair<int, int> P;

int A[N], n;

inline bool check(int mid) {
    set<P> s;
    for (int i = 2; i <= n; i++) if (A[i] <= A[i - 1]) {
        while (s.size() && s.rbegin() -> first > A[i]) s.erase(*s.rbegin());
        for (int j = A[i]; ; j--) {
            if (!j) return false;
            if (s.size() && j == s.rbegin() -> first) {
                if (s.rbegin() -> second < mid - 1) {
                    auto t = *s.rbegin(); s.erase(t), t.second++;
                    s.insert(t); break;    
                } else s.erase(*s.rbegin());
            } else {
                if (mid == 1) return false;
                s.insert(P(j, 1)); break;
            }
        } 
    }
    return true;
}

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &A[i]);
    int l = 1, r = n, mid, ans = -1;
    while (l <= r) {
        mid = (l + r) >> 1;
        if (check(mid)) r = mid - 1, ans = mid;
        else l = mid + 1;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 1024
// C program to convert a number from any base
// to decimal
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define pb push_back
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define fore(i, l, n) for(int i = l; i < n; i++)

using namespace std;
using mii=map<int, int>;
using mll=map<ll, ll>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;

int main()
{
    fastIO
    int n;
    cin >> n;
    vector<int> arr(n, 0);

    fore(i, 0, n)
        cin >> arr[i];

    sort(arr.begin(), arr.end());

    ll ans = 0;

    for(int i = 0; i < n; i++)
    {
        for(int j = i + 1; j < n; j++)
        {
            int num = arr[i] + arr[j];
            auto it = upper_bound(arr.begin(), arr.end(), num - 1);
            it--;

//            if(*it >= num)
//                it--;

            ll ind = it - arr.begin();
//            cout << *it << " "<< ind << " ind\" << num << " " << j<< endl;

            if(ind <= j)
                continue;
            else
                ans += (ind - j);
        }
//        cout << "=============="<<endl;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
 int sv, hw, i, length, res, sum = 0;
 int a[10000];
 scanf("%d%d", &sv, &hw); 
 for(i = 0; i < hw; ++i){
    scanf("%d",&a[i]);
    sum = sum + a[i];
 }
 res = sv - sum;
 if(res < 0){
   printf("-1");
 } else {
   printf("%d",res);
 }
 return 0;
}

Measured memory_bytes: 1740
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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; }

typedef long long ll;
typedef pair<ll, ll> p;
int d;
vector<ll> c(26);
vector<vector<ll>> s;
vector<ll> t;

ll score(){
  ll res = 0;
  vector<ll> last(26);
  rep(i, d){
    int num = t[i];
    res += s[i][num];
    last[num] = i + 1;
    for (int j = 0; j < 26; ++j) {
      res -= c[j] * ((i+1) - last[j]);
    }
    cout << res << endl;
  }
  return res;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> d;
  rep(i, 26) cin >> c[i];
  s = vector<vector<ll>> (d, vector<ll>(26));
  for (int i = 0; i < d; ++i) {
    ll maxv = LLONG_MIN;
    ll contest = -1;
    for (int j = 0; j < 26; ++j) {
      cin >> s[i][j];
      if(maxv < s[i][j]){
        maxv = s[i][j];
        contest = j + 1;
      }
    }

    cout << contest << endl;
  }
  // t = vector<ll> (d);
  // rep(i, d) cin >> t[i], t[i]--;


  // score();
  // cout << score() << endl;
}


Measured memory_bytes: 3752
#include <stdio.h>
#include <stdlib.h>

int main() {
    int X, A, B;
    scanf("%d%d%d", &X, &A, &B);
    if (A >= B) printf("delicious\n");
    else if (X + A >= B) printf("safe\n");
    else printf("dangerous\n");

    return 0;
}

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

#define mp make_pair
#define pb push_back
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repn(i, n) for(int i = 1; i < n; ++i)
#define repm(i, n, m)  for(int i = n; i < m; ++i)
#define Repm(i, n, m)  for(int i = n; i <= m; ++i)
#define mod 1000000000+7

int culc(int n){
    int c = 0;  
    while(n > 0){
        c += n%10;
        n /= 10;
    }
    return c;
}

int main(){
    int n, a, b; cin >> n >> a >> b;
    int count = 0;
    Repm(i, 1, n){
        int c = culc(i);
        if(c >= a && c <= b)    count += i;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int>a(n);
    vector<int>p(n);
    vector<int>q(n);
    for(int i = 0;i < n;i++)cin >> p[i];
    for(int i = 0;i < n;i++)cin >> q[i];
    for(int i = 0;i < n;i++)a[i] = i + 1;
    int i = 1;
    int cnt1 = 0,cnt2 = 0;
    do{
        int flag = 1;
        for(int i = 0;i < n;i++)
        {
            if(a[i] != p[i])
            {
                flag = 0;
                break;
            }
        }
        int flag2 = 1;
        for(int i = 0;i < n;i++)
        {   
            if(a[i] != q[i])
            {
                flag2 = 0;
                break;
            }
        }
        if(flag)cnt1 = i;
        if(flag2)cnt2 = i;
        i++;
    }
    while (next_permutation(a.begin(),a.end()));
    cout << abs(cnt2 - cnt1);
    return 0;
}

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  string s;
  void solve() {
    cin >> s;
    int l = s.size();
    for (int i = 0; i < 8; ++i) {
      string tmp = s;
      tmp.erase(tmp.begin() + i, tmp.begin() + i + (l - 7));
      DBG(tmp)
      if (tmp == "keyence") {
        cout << "YES" << endl;
        return;
      }
    }
    cout << "NO" << endl;
  }
};

}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);

  Problem::Solver sol;
  sol.solve();
  return 0;
}


Measured memory_bytes: 256
a,b = map(int,input().split())
m = 1
d = 1
tkhs = 0
while m < a:
    while d <= 31:
        if d == m :
            tkhs += 1
        d += 1
    m += 1
    d = 1
while d <= b:
    if d == m :
        tkhs += 1
    d += 1
print(tkhs)

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

int main() {
    unsigned h {}, n {};
    cin >> h >> n;

    unsigned total {};
    while (n--) {
        unsigned val {};
        cin >> val;

        total += val;
    }

    cout<<((total >= h) ? "Yes" : "No")<<endl;
    return 0;
}

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

int main () {
    
    int H, W;
    
    while (1) {
        cin >> H >> W ;
        if ( H == 0 && W == 0 ) break;
        
        for (int i = 0 ; i < H ; i++) {
            for (int j = 0; j < W; j++) {
                if ( i == H-1 || i == 0 || j == W-1 || j == 0) {
                    cout << "#" ;
                } else {
                    cout << "." ;
                }
            }
            cout << endl;
        }
        cout << endl;

    }
    
    return 0;
}


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

int main()
{
    string s;
    cin >> s;
    int t = 0;

    if(s[1] == '9' || s[0] == '9'){
        t = 1;
    }
    if(t == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)

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

cnt = 1
ans = 0
for x in a:
    if x == cnt:
        cnt += 1
    else:
        ans += 1
if cnt == 1: ans = -1
print(ans)

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> t chmax(t&a,u b){if(a<b)a=b; return a;};
template<class t, class u> t chmin(t&a,u b){if(a>b)a=b; return a;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, W;
  IN(N,W);
  vll w(N), v(N);
  REP(i,N) IN(w[i], v[i]);

  vll dp(W+1, 0);
  vll dp_copy;

  REP(i,N){
    dp_copy = dp;
    REP(j,W+1){
      if(w[i]+j>W) break;
      ll new_weight = w[i]+j;
      chmax(dp[new_weight], dp_copy[j]+v[i]);
    }
  }

  vec_print(dp);

  OUT(dp[W]);

  return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>

using namespace std;

const int INF = (1<<30) - 1;


int main(){
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    int n, m, a;
    while(cin>>n>>m>>a, n|m|a){
        int h, q, p;
        vector<pair<int, int>> v(m);
        for(int i=0; i<m; i++){
            cin >> h >> q >> p;
            v[i].first = -h;
            v[i].second = q;
        }
        sort(v.begin(), v.end());
        
        for(auto p: v){
            if(a == p.second)
                a = p.second+1;
            else if(a == p.second+1)
                a = p.second;
        }
        cout << a << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1204