akhauriyash/Code-Regression huggingface dataset:
/*
ID: toooooEasy or RafaelSaddatimov
PROG:
*/
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define MAX 505
#define MAXN 10001
#define LOGMAX 30
#define SQMAX 200
#define SZ (MAX / SQMAX + 1)
#define MOD 1000000007
#define INF 2000000009
#define EPS 1e-9
#define ll long long
#define F first
#define S second
#define all(a) a.begin(), a.end()
#define pb push_back
#define io ios_base::sync_with_stdio(false); cin.tie(0)
using namespace std;
int cnt[MAX][MAX];
int n, m, q;

int main() {
    scanf("%d%d%d", &n, &m, &q);
    for(int i=1; i<=m; ++i) {
        int u, v;
        scanf("%d%d", &u, &v);
        cnt[u][v] += 1;
    }
    for(int i=1; i<=n; ++i)
        for(int j=1; j<=n; ++j)
            cnt[i][j] += cnt[i][j - 1];
    while(q--) {
        int p, q;
        scanf("%d%d", &p, &q);
        int res = 0;
        for(int i=p; i<=q; ++i)
            res += cnt[i][q];
        printf("%d\n", res);
    }
}


Measured memory_bytes: 1920
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define all(x) begin(x),end(x)
using namespace std;
const int INF = 1e9;
template<class T=int> using V = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
//時間が厳しいとき使う
#define INI(...) int __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

void solve()
{
    IN(k, a, b);
    for (ll i = a; i <= b; ++i)
    {
        if (i % k == 0)
        {
            cout << "OK" << endl;
            return;
        }
    }
    cout << "NG" << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

bool ques(long n){
    cout<<"? "<<n<<endl;
    char ans;
    cin>>ans;
    return ans=='Y';
}

int main(){
    int d=1e9;
    if(ques(d)){
        while(d>1 && ques(d-1)) d/=10;
        cout<<"! "<<d<<endl;
    }else{
        while(d/=10,!ques(d));
        long l=d,r=d*10,m;
        while(l+1<r){
            m=(l+r)/2;
            if(ques(m*10)) r=m;
            else l=m; 
        }
        cout<<"! "<<r<<endl;
    }
}


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

int main() {
    ios_base :: sync_with_stdio(false);
    int n; cin >> n;

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

    int64_t ans = 0;
    
    set<int> s;

    for(int i = n - 1; i >= 0; --i) {
        s.insert(v[i] + (n - 1 - i));
        if(not s.empty() and (*s.begin()) - (n - 1 - i) == 0) {
            s.erase(s.begin());
        }
        if(not s.empty() and (*s.rbegin()) - (n - 1 - i) > v[i]) {
            ans = -1;
            break;
        }
        ans += s.size();
    }

    if(not s.empty())
        ans = -1;

    cout << ans << "\n";
}

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

using namespace std;

typedef long long ll;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define INF 1000000000

int main() {

	string s;
	int k;
	cin >> s >> k;
	int len = s.length();
	FOR(i, min(len,k)) {
		if (s[i] != '1') {
			cout << s[i] << endl;
			return 0;
		}
	}
	cout << '1' << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  ll n, m;
  cin >> n >> m;
  vi a(n), b(m);
  REP(i, n) { cin >> a[i]; }
  REP(i, m) { cin >> b[i]; }
  sort(ALL(a), greater<int>());
  sort(ALL(b), greater<int>());

  REP(i, n - 1) {
    if (a[i] == a[i + 1]) {
      cout << 0 << endl;
      return 0;
    }
  }
  REP(i, m - 1) {
    if (b[i] == b[i + 1]) {
      cout << 0 << endl;
      return 0;
    }
  }

  ll filled = 0;
  ll c = m * n;
  ll i = 0, j = 0;
  ll ans = 1;
  while (c > 0) {
    bool upa = false, upb = false;
    if (i < n - 1 && c <= a[i + 1]) {
      upa = true;
      i++;
    }
    if (j < m - 1 && c <= b[j + 1]) {
      j++;
      upb = true;
    }
    ll t = (i + 1) * (j + 1) - filled;
    if (upa) {
      t = j + 1;
    }
    if (upb) {
      t = i + 1;
    }
    if (upa && upb) {
      t = 1;
    }
    if (c <= min(a[i], b[j])) {
      ans = (ans * t) % MOD;
    } else {
      cout << 0 << endl;
      return 0;
    }
    filled++;
    c--;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll (i)=0; (i)<(n); (i)++)
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
#define MOD 998244353 //1000000007

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

    // solution comes here
    ll N;
    string S;
    cin >> N >> S;
    ll K = N/2;
    if( N%2 or S.substr(0,K)!=S.substr(K,K) ) cout << "No" << nl;
    else                                      cout << "Yes" << nl;
}

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

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N],col[N],dpos[2*N-1],dneg[2*N-1];

bool X[N][N];

void initialize(){
  for(int i=0;i<N;i++){row[i]=FREE;col[i]=FREE;}
  for(int i=0;i<2*N-1;i++){dpos[i]=FREE;dneg[i]=FREE;}
}

void printBoard(){
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(X[i][j]){
	if(row[i]!=j)return;
      }
    }
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      cout<<((row[i]==j)?"Q":".");
    }
    cout<<endl;
  }
}

void recursive(int i){
  if(i==N){
    printBoard();
    return;
  }

  for(int j=0;j<N;j++){
    if(NOT_FREE==col[j]||NOT_FREE==dpos[i+j]||NOT_FREE==dneg[i-j+N-1])continue;
    row[i]=j;
    col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;
    recursive(i+1);
    row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
  }
}

int main(){
  initialize();

  for(int i=0;i<N;i++)
    for(int j=0;j<N;j++)X[i][j]=false;
  int k;cin>>k;
  for(int i=0;i<k;i++){
    int r,c;cin>>r>>c;
    X[r][c]=true;
  }
  recursive(0);
  return 0;
}



Measured memory_bytes: 3116
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int r = scan.nextInt();
	int g = scan.nextInt();
	int b = scan.nextInt();
	if((10*g+b) %4 == 0){
	    System.out.println("YES");
	}
	else{
	    System.out.println("NO");
	}
	    
    }
}


Measured memory_bytes: 21844
#include<cstdio>

int GreatestCommonDivisor(int a, int b){
	int r = b;
	while(a % b != 0){
		r = a % b;
		a = b;
		b = r;
	}
	return r;
}

int main(){
	int N, answer;
	scanf("%d\n%d", &N, &answer);
	for (int i = 0; i < N - 1; ++i){
		int tmp;
		scanf("%d", &tmp);
		answer = GreatestCommonDivisor(answer, tmp);
	}
	printf("%d\n", answer);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);
    	int N=sc.nextInt();
    	
    	if(N<=999) {
    		System.out.println("ABC");
    		
    	}else {
    		System.out.println("ABD");
    	}

    }
}



Measured memory_bytes: 23124
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;
#define N 100009
#define LL long long
#define INF 0x3f3f3f3f
#define mymin(x,y) (x>=y?y:x)
#define mymax(x,y) (x>=y?x:y)
int main() {
	std::ios::sync_with_stdio(0); std::cin.tie(0);
	LL s;
	LL mod = pow(10, 9);
//	cout << mod;
	cin >> s;
	if(s % mod == 0){
		cout << "0 0 0 " << mod << " " << s / mod << " 0" << endl;
		return 0;
	}
	LL a = s % mod;
	LL b = s / mod + 1;
	cout << "0 0 1 " << mod << " " << b << " " << mod - a << endl; 
	return 0;
}


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

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "
#define cout(n) cout<<fixed<<setprecision(n)
int main(){
  int N;
  cin>>N;
  map<string,int> m;

  string in;
  FOR(i,0,N){
    cin>>in;
    m[in]++;
  }
  int M;
  cin>>M;
  FOR(i,0,M){
    cin>>in;
    m[in]--;
  }
  int max=0;
  for(auto i=m.begin();i!=m.end();i++){
    max=std::max(max,i->second);
  }
  cout<<max<<endl;

}


Measured memory_bytes: 256
// And Then the GOD Entered..   
#include<bits/stdc++.h>
 using namespace std;
 
typedef long long int ll;
#define endl "\n"
#define fi first
#define sec second 
#define pb push_back
#define test cout<<"debuged\n";
#define INF ll(1e18)
#define MOD 1000000007
#define debug(x) cout<<x<<"\n";
#define pll pair<ll,ll>
#define mp make_pair
#define Minato_Namikaze ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(v) v.begin(),v.end()
#define MAX 200015

struct node
{
    ll w;
    ll v;
    ll s;
};

ll n;
node a[MAX];
ll dp[1005][20005];

bool cmp(node &x, node &y)
{
    return (x.s + x.w) < (y.s + y.w);
}

ll solve(ll idx, ll wei)
{
    if(idx == n)
        return 0;
    ll &ans = dp[idx][wei];
    if(ans != -1)
        return ans;
    ans = solve(idx + 1, wei);
    if(a[idx].s >= wei)
        ans = max(ans, solve(idx + 1, wei + a[idx].w) + a[idx].v);
    return ans;
}

int main()
{
    Minato_Namikaze
 
    
    cin >> n;
    ll mx = -1;
    for(ll i = 0; i < n; ++i)
    {
        cin >> a[i].w >> a[i].s >> a[i].v;
        mx = max(mx, a[i].w);
    }
    sort(a, a + n, cmp);
    for(ll i = 0; i < n + 3; ++i)
        for(ll j = 0; j < 20001 + 3; ++j)
            dp[i][j] = -1;
    cout << solve(0,0); 
}

Measured memory_bytes: 157952
// 2_abc136_b
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 0;
    rep1(i, n){
        string s = to_string(i);
        if(s.length() % 2 == 1){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

const int MAXN = 1000010;

string s;

int prefix[MAXN];
int capacity[MAXN];

int cal(int maxPrefix) {
	int maxNumber = maxPrefix - prefix[s.size()];
	for (int i = s.size(); i > 0; i--) {
		maxNumber = min(maxNumber, maxPrefix - prefix[i]);
		capacity[i] = maxNumber / 2;
	}
	int curPrefix = 0;
	int tempMaxPrefix = 0;
	int tempMinPrefix = 0;
	int counts = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '1') {
			curPrefix++;
		}
		else if (s[i] == '0') {
			curPrefix--;
		}
		else {
			// ?
			if (capacity[i + 1] > counts) {
				curPrefix++;
				counts++;
			}
			else {
				curPrefix--;
			}
		}
		tempMaxPrefix = max(tempMaxPrefix, curPrefix);
		tempMinPrefix = min(tempMinPrefix, curPrefix);
	}
	return tempMaxPrefix - tempMinPrefix;
}

int main() {
	cin >> s;
	prefix[0] = 0;
	int maxPrefix = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '1') {
			prefix[i + 1] = prefix[i] + 1;
		}
		else {
			prefix[i + 1] = prefix[i] - 1;
		}
		maxPrefix = max(maxPrefix, prefix[i + 1]);
	}
	cout << min(cal(maxPrefix), cal(maxPrefix + 1)) << endl;
}

Measured memory_bytes: 11784
#include <bits/stdc++.h>
#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 rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

ll INF = 1000000000000000000LL;
int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i,n)cin >> a[i];
  sort(rng(a));
  ll ans = 1;
  rep(i,n){

    ll x = INF/ans;
    if(x<a[i]){
      cout<<-1<<endl;
      return 0;
    }
    ans*=a[i];
    if(ans == 0){
      cout<<0<<endl;
      return 0;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4052
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

void solve(){
  int n; cin >> n;
  int b[n - 1]; for(int i = 0; i < n - 1; i++) cin >> b[i];
  int a[n];
  a[0] = b[0];
  a[n - 1] = b[n - 2];
  for(int i = 0; i < n - 2; i++){
    if(b[i] < b[i + 1]) a[i + 1] = b[i];
    else a[i + 1] = b[i + 1];
  }
  int sum = 0;
  for(int i = 0; i < n; i++) sum += a[i];
  cout << sum << endl;
  return;
}

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


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func rsort(nums []int, n int) {
	for i := 1; i < n; i++ {
		v := nums[i]
		j := i - 1
		for j >= 0 && nums[j] < v {
			nums[j+1] = nums[j]
			j--
		}
		nums[j+1] = v
	}
}

func main() {
	nums := make([]int, 3)
	for i := range nums {
		fmt.Scan(&nums[i])
	}

	rsort(nums, 3)

	fmt.Println(nums[0]*10 + nums[1] + nums[2])
}


Measured memory_bytes: 512
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,x,y=n1()

a=[0]*n
for i in range(1,n+1):
    for j in range(i+1,n+1):
        if i<=x and j<=x:
            a[j-i]+=1
        elif i<=x and x<j<y:
            a[min(j-i,y-j+1+x-i)]+=1
        elif i<=x:
            a[j-y+1+x-i]+=1
        elif i<=y and j<=y:
            a[min(j-i,y-j+1+i-x)]+=1
        elif i<=y:
            a[min(j-i,j-y+1+i-x)]+=1
        else:
            a[j-i]+=1
for k in range(1,n):
    print(a[k])

Measured memory_bytes: 3444
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define ll long long

int compare(const void *a,const void *b){
  return *(int*)a-*(int*)b;
}

int main(){
  int n;
  scanf("%d",&n);
  int a[n+1],atmp[n+1];
  int b[200001]={};
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
    atmp[i]=a[i];}
  
  qsort(atmp,n,sizeof(int),compare);
  ll l=0,r=0;
  ll sum=0;
  while(r<n){
    while(atmp[r]==atmp[l] && r<n){
      r++;}
    b[atmp[l]]=r-l;
    sum += (ll)(r-l)*(r-l-1)/2;
    l=r;}
  //printf("%lld\n",sum);

  for(int i=0;i<n;i++){
    ll subtmp=(ll)b[a[i]];
    printf("%lld\n",sum-(subtmp-1));}

  return 0;
}


Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
struct fastio { fastio () { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } _io;
template<class T, class U> bool chmax(T& a, const U &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> bool chmin(T& a, const U &b) { if (a > b) { a = b; return 1; } return 0; }

constexpr size_t D = 365;
constexpr size_t type = 26;
constexpr int INF = (1 << 30);
constexpr int X = 100;

array<int, type> c;
array<array<int, type>, D> s;
array<int, D> ans;

void input () {
	int buff;
	cin >> buff;
	for (int i = 0; i < type; i++) {
		cin >> c[i];
	}
	for (int i = 0; i < D; i++) {
		for (int j = 0; j < type; j++) {
			cin >> s[i][j];
		}
	}
}

vector<pair<int, int>> next_contest (int day, const array<int, type> &last) {
	array<int, type + 1> l, r;
	l[0] = r[type] = 0;
	vector<pair<int, int>> score;
	for (int i = 0; i < type; i++) {
		l[i + 1] = l[i] + c[i] * (day - last[i]);
		r[type - i] = r[type - i + 1] + c[type - i] * (day - last[type - i]);
	}
	for (int i = 0; i < type; i++) {
		int val = s[day - 1][i] - (l[i] + r[i + 1]);
		score.emplace_back(val, i);
	}
	sort(score.begin(), score.end(), greater<>());
	return score;
}

struct contest {
	int day, value;
	array<int, type> last;
	array<int, D> con;
	contest () : value(0), day(0) {
		fill(last.begin(), last.end(), 0);
	}
	void update (int i, int val) {
		con[day++] = i;
		last[i] = day;
		value += val;
	}
	int prev () {
		if (day == 0) return -1;
		return (con[day - 1]);
	}
	bool operator< (const contest &rhs) const {
		return ((this->value) > rhs.value);
	}
};

int main() {
	input();
	vector<contest> dat;
	dat.push_back(contest());
	for (int day = 0; day < D; day++) {
		vector<contest> buff;
		
		for (int i = 0; i < dat.size(); i++) {
			vector<pair<int, int>> cd = next_contest(day + 1, dat[i].last);
			
			for (int j = 0; j < cd.size(); j++) {
				auto [v, id] = cd[j];
				contest c = dat[i];
				c.update(id, v);
				buff.push_back(c);
			}
			
		}
		
		sort(buff.begin(), buff.end());
		buff.resize(X);
		dat.swap(buff);
	}
	
	for (int i : dat[0].con) {
		cout << i + 1 << '\n';
	}
	
	return 0;
}
		

Measured memory_bytes: 17656
from scipy.ndimage import distance_transform_cdt
 
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
n = [[1 if x == "." else 0 for x in row] for row in a]
 
distance = distance_transform_cdt(n, metric='taxicab')
res = distance.max()
print(res)

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

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

    long long ans = 0;
    for (long long b = 1; b <= N; b++)
    {
        long long p = N / b, r = N % b;
        ans += p * max(0ll, b - K) + max(0ll, r - K + 1);
        if(K == 0) ans--;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

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

      double n = Double.parseDouble(sc.next());

      double x = n/1.08;

      int nnn = (int)x;

      for(int i=nnn;i<=nnn+1;i++){
        int yen = (int)(i*1.08);
        if(yen==(int)n){
          System.out.println(i);
          break;
        }
        else if(i==nnn+1){
          System.out.println(":(");
          break;
        }
      }

    }
}


Measured memory_bytes: 22612
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    ll n,w,valsum=0;
    cin>>n>>w;
    vector<ll>weights(n);
    vector<ll>values(n);
    for(int i=0;i<n;i++){
        cin>>weights[i]>>values[i];
        valsum+=values[i];
    }
    vector<ll>dp(valsum+2,1e18L+5);
    dp[0]=0;
    for(int j=0;j<n;j++){
        for(int i=valsum-values[j];i>=0;--i){
                    dp[i+values[j]]=min(dp[i+values[j]],dp[i]+weights[j]);
        }
    }
    ll ans=0;
    for(int i=0;i<=valsum;i++){
        if(dp[i]<=w)ans=max(ans,(ll)i);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1024
fun main(args: Array<String>) {
  val S = readString()
  val T = readString()
  println(if (T.substring(S.indices) == S) "Yes" else "No")
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 35668
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <utility>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

struct Node {int p, l, r;};
struct Node T[114514];
int n;

void preParse(int u){
	if(u == -1) return;
	printf(" %d", u);
	preParse(T[u].l);
	preParse(T[u].r);
}

void inParse(int u){
	if( u == -1) return;
	inParse(T[u].l);
	printf(" %d", u);
	inParse(T[u].r);
}

void postParse(int u){
	if( u == -1 ) return;
	postParse(T[u].l);
	postParse(T[u].r);
	printf(" %d", u);
}

int main(){
	int i, v, l, r, root;

	scanf("%d", &n);
	for(i = 0; i < n; i++){
		T[i].p = -1;
	}

	for(i = 0; i < n; i++){
		scanf("%d %d %d", &v, &l, &r);
		T[v].l = l;
		T[v].r = r;
		if(l != -1) T[l].p = v;
		if(r != -1) T[r].p = v;
	}

	for(i = 0; i < n; i++) if (T[i].p == -1) root = i;

	
	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n");
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");

	return 0;
}


Measured memory_bytes: 3192
#include <iostream>
#include <vector>

using namespace std;

long long solve(const vector<long long>& X, int L){
    const int N = X.size();
    int addIdx = 0;
    int progIdx = 0;
    int addMul = N;
    int subIdx = N-1;
    int subMul = N-1;
    long long cur = 0;
    while(addMul > 0){
        cur += min(2, addMul) * X[addIdx];
        ++addIdx;
        addMul -= 2;
    }
    --addIdx;
    while(subMul > 0){
        cur += min(2, subMul) * (L - X[subIdx]);
        --subIdx;
        subMul -= 2;
    }
    if(N > 1) ++subIdx;
    long long res = cur;
    for(int i=0;i<N-1;i++){
        if(addMul == 0){
            ++addIdx;
            addMul = -1;
        } else {
            addMul = 0;
        }
        cur += X[addIdx];
        cur -= 2 * X[i];
        cur -= L - X[subIdx];
        if(subMul == -1){
            ++subIdx;
            subMul = 0;
        } else {
            subMul = -1;
        }
        res = max(cur, res);
    }
    return res;
}

int main(){
    long long L, N; cin >> L >> N;
    vector<long long> X(N), Y(N);
    for(auto& x : X) cin >> x;
    for(int i=0;i<N;i++) Y[i] = L - X[N-1-i];
    cout << max(solve(X, L), solve(Y, L)) << endl;
}

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

int main() {
	int w; cin >> w; int n; cin >> n;
	vector<int> vec; vec.resize(w);	int a, b; char op;
	for (int i = 0; i < w; i++) vec[i] = i + 1;
	for (int i = 0; i < n; i++) {
		cin >> a >> op >> b; swap(vec[a - 1], vec[b - 1]);
	}
	for (int i = 0; i < w; i++) cout << vec[i] << endl;
	return 0;
}


Measured memory_bytes: 3044
def reachable(es, source):
	ret = {source}
	Q = [source]
	while Q:
		cur = Q.pop()
		for nxt in es[cur]:
			if nxt not in ret:
				Q.append(nxt)
				ret.add(nxt)
	return ret

def BellmanFord(V:int, es:list, source=0):
	INF = float("inf")
	D = [INF]*V
	D[source] = 0
	for _ in range(V):
		upd = False
		for f, t, c in es:
			tmp = D[f] + c
			if D[t] > tmp:
				D[t] = tmp
				upd = True
		if not upd:
			return D[-1]
	else:
		return None
	
def main():
	N,M,P,*L=map(int,open(0).read().split())
	fwd = [[] for _ in range(N)]
	bwd = [[] for _ in range(N)]
	tmp = []
	for a,b,c in zip(*[iter(L)]*3):
		fwd[a-1].append(b-1)
		bwd[b-1].append(a-1)
		tmp+=[(a-1,b-1,P-c)]
	judge = reachable(fwd,0) & reachable(bwd,N-1)
	ans = BellmanFord(N,[(a,b,c) for a,b,c in tmp if a in judge and b in judge])
	if ans==None:
		print(-1)
	else:
		print(max(0,-ans))

if __name__=="__main__":
	main()

Measured memory_bytes: 6124
import java.util.*;
//System.out.println("")

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashSet<Integer> set = new HashSet<>(n);
        for(int i=0; i<n; i++){
            int a = sc.nextInt();
            if(set.contains(a)){
                set.remove(a);
            }else{
                set.add(a);
            }
        }
        System.out.println(set.size());
    }
}

Measured memory_bytes: 63492
import random
class Dice:
    def __init__(self, ls):
        self.top,   self.bottom = ls[0], ls[5]
        self.right, self.left   = ls[2], ls[3]
        self.front, self.back   = ls[1], ls[4]
    def rot(self, d):
        if   d == "N":
            (self.top, self.back, self.bottom, self.front) = (
             self.front, self.top, self.back, self.bottom)
        elif d == "S":
            (self.top, self.back, self.bottom, self.front) = (
             self.back, self.bottom, self.front, self.top)
        elif d == "E":
            (self.top, self.right, self.bottom, self.left) = (
             self.left, self.top, self.right, self.bottom)
        elif d == "W":
            (self.top, self.right, self.bottom, self.left) = (
             self.right, self.bottom, self.left, self.top)
    def show(self):
        return (self.top, self.bottom, self.right,
                self.left, self.front, self.back)
S = set()
N = int(raw_input())
judge = True
for i in xrange(N):
    dice = Dice(map(int, raw_input().split()))
    s = set()
    for loop in xrange(1000):
        nums = dice.show()
        if nums in S:
            judge = False
            break
        s.add(nums)
        dice.rot("NSEW"[random.randint(0, 3)])
    if not judge:
        break
    S |= s
print "Yes" if judge else "No"

Measured memory_bytes: 10292
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::min;

int main() {
  int c[10][10];
  int H, W, A, MP_sum;
  cin >> H >> W;
  for (int i = 0; i <= 9; ++i) {
    for (int j = 0; j <= 9; ++j) {
      cin >> c[i][j];
    }
  }
  // Floyd–Warshall algorithm.
  for (int k = 0; k <= 9; ++k) {
    for (int i = 0; i <= 9; ++i) {
      for (int j = 0; j <= 9; ++j) {
          c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
      }
    }
  }
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      cin >> A;
      if (A != -1) MP_sum += c[A][1];
    }
  }
  cout << MP_sum << endl;
}


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

//ライブラリ始まり

//定数

//円周率
const double PI = 3.1415926535897932384;

//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 1000000000000000; // = 10^15

//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";

//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7

//データ構造

//Union_Find木
struct UnionFind {
  vector<int> UF; // UF.at(i) : iの親の番号
  UnionFind(int N) : UF(N) { // 最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) {
      UF.at(i) = i;
    }
  }
  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (UF.at(x) == x) {
      return x;
    }
    return UF.at(x) = root(UF.at(x));
  }
  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); // xの根をrx
    int ry = root(y); // yの根をry
    if (rx == ry) {
      return; // xとyの根が同じ(=同じ木にある)時はそのまま
    }
    UF.at(rx) = ry; // xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
  }
  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

//関数

//ctoi
int ctoi(char c){
  if (c == '0') {
    return 0;
  }
  if (c == '1') {
    return 1;
  } 
  if (c == '2') {
    return 2;
  } 
  if (c == '3') {
    return 3;
  }
  if (c == '4') {
    return 4;
  } 
  if (c == '5') {
    return 5;
  } 
  if (c == '6') {
    return 6;
  }
  if (c == '7') {
    return 7;
  } 
  if (c == '8') {
    return 8;
  } 
  if (c == '9') {
    return 9;
  }
  return -1;  
}

//素数判定
bool PN(int x) {
  if (x <= 1) {
    return false; // 1や0,-1は素数ではない
  }
  if (x == 2) {
    return true; // √2 + 1 > 2 なので下でやると 2 ％ 2 = 0 となり判定できない
  }
  for (int i = 2; i < sqrt(x) + 1; i++) {
    if (x % i == 0) {
      return false; // 割れたら素数じゃない
    }
  }
  return true;
}

//ライブラリ終わり

int main() {
  string S;
  cin >> S;
  int ans = 0;
  char N = S.at(0);
  for (int i = 1; i < int(S.size()); i++) {
    if (N != S.at(i)) {
      ans++;
      N = S.at(i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3728
from collections import Counter
from itertools import combinations
march = list("MARCH")
march = dict(zip(march, march))
N = int(input())
S = [march.get(input()[0], -1) for _ in range(N)]
cnt = Counter(S)
ans = 0
for comb in combinations("MARCH", 3):
    tmp = 1
    for c in comb:
        tmp *= cnt[c]
    ans += tmp
print(ans)


Measured memory_bytes: 4224
#include<iostream>

int main() {
	int n;
	std::cin >> n;
	int *a = new int[n];
	for (int i = 0; i < n; i++)std::cin >> a[i];

	int b, c, r, ans = (1 << 30) - 1;
	for (int i = 1; i < n; i++) {
		b = a[0];
		c = a[i];
		do {
			r = b % c;
			b = c;
			c = r;
		} while (r != 0);
		ans = ans > b ? b : ans;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
	int N;
	int c = 0;
	int flag = 1;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	while (flag)
	{
		for (int i = 0; i < N; i++)
		{
			if (A[i] % 2 == 0)
			{
				A[i] = A[i] / 2;
			}
			else
			{
				flag = 0;
				break;
			}
			if (i == N - 1) c++;
		}
	}
	cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] lines = line.split(" ");
		int N = Integer.parseInt(lines[0]);
		int K = Integer.parseInt(lines[1]);

		int[] fruit = new int[N];

		line = sc.nextLine();
		lines = line.split(" ");
		for(int i = 0; i < N; i++) {
			fruit[i] = Integer.parseInt(lines[i]);
		}
		Arrays.sort(fruit);

		int sum = 0;
		for(int i = 0; i < K; i++) {
			sum = sum + fruit[i];
		}

		System.out.println(sum);
	}

}


Measured memory_bytes: 36768
#include <bits/stdc++.h>
#define INF 0x3f3f3f
#define PB push_back
#define F first
#define S second
#define FOR(i,k) for(int i=0; i<k; i++)
#define RFOR(i,k) for(int i=k; i>=0; i--)
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
#define DEBUGV(x) cout<<#x<<": "; for(auto &d:x) cout<<d<<" "; cout<<endl
#define DEBUGM(x) for(auto &p:x) cout<<p.F<<":"<<p.S<<" "; cout<<endl;
#define OUT(x) cout<<(x)<<endl

using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VPII;
typedef vector<VI> VVI;
typedef map<char,int> MC;
typedef map<int,int> MI;
typedef map<string,int> MS;

template<typename T, typename U> void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> void amax(T &x, U y) { if(x < y) x = y; }
VPII neighbors = {{0,1}, {1,0}, {0,-1}, {-1,0}};
PII operator+(PII &l, PII &r) { return {l.F+r.F, l.S+r.S}; }
bool IsValid(PII p, int Y, int X) { 
  return p.F >=0 && p.F < Y && p.S >=0 && p.S < X; }
bool IsPrime(int n) {
  if (n <= 1)  return false;
  if (n <= 3)  return true;
  if (n%2 == 0 || n%3 == 0) return false;
  for (int i=5; i*i<=n; i=i+6)
    if (n%i == 0 || n%(i+2) == 0)
      return false;
  return true;
}

int main() {
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  float ab = (a + b)/2.0f;

  int res = 0;
  if(ab > c) {
    int minXY = min(x,y);
    x-=minXY;
    y-=minXY;
    res+=minXY*c*2;

    if(a > c*2) {
      res+=x*c*2;
      x=0;
    }
    if(b > c*2) {
      res+=y*c*2;
      y=0;
    }
  }
  res+=x*a+y*b;
  OUT(res);
}

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

int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<pair<int, int>> BA(N);
  for (int i = 0; i < N; i++) cin >> BA.at(i).second >> BA.at(i).first;
  sort(BA.begin(), BA.end());

  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += BA.at(i).second;
    if (sum > BA.at(i).first) {
      cout << "No" << "\n";
      return 0;
    }
  }

  cout << "Yes" << "\n";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
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; }

// union by size + path having
class UnionFind {
public:

    //素集合の要素の親（木構造の根）を配列*3で保持している．初期状態では頂点間の辺は存在せず，孤立した状態のため，自分自身を根として初期化している（par: parent の略）．
    vector <ll> par;

    // 各集合（木）の大きさ．根をたどるとその木の大きさが返されるように実装されている．この配列を用意しておくとある頂点の連結成分の大きさを簡単に求められる
    vector <ll> siz;

    // Constructor
    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);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        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)];
    }
};

int main(){
    ll n, m;
    cin >> n >> m;
    UnionFind uf(n);
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        uf.merge(a, b);
    }
    ll ans = 0;
    rep(i, n) {
        chmax(ans, uf.size(i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 6420
#ifdef __APPLE__
#include <cassert>
#include <iostream>
#include <iomanip>
#include <ctime>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <cctype>
#include <list>
#include <cmath>
#include <limits>
#include <bitset>
#include <numeric>
#include <climits>
#include <complex>
#else
#include<bits/stdc++.h>
#endif // __APPLE__
using namespace std;
typedef pair<int,int>   II;
typedef vector<II>     VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int LL;
typedef  unsigned long long int ULL;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define ALL(c) (c).begin(),(c).end()
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i,a,b) for(int i = (int)a; i < (int)b; i++)
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1)	{
cerr << name << " : " << arg1 << std::endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
     const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif





int main()
{
	//fr;fw;
	fast_io;
    LL x;
    cin>>x;
    int y=x%11;
    x/=11;
    if(y==0)
        cout<<x*2<<endl;
    else if(y==1 || y==6 || y== 4|| y==3)
        cout<<x*2+1<<endl;
    else
        cout<<x*2+2<<endl;



	return 0;
}






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

using pi = pair<int, int>;
using vi = vector<int>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvpi = vector<vpi>;
using pl = pair<long long, long long>;
using vl = vector<long long>;
using vpl = vector<pl>;
using vvl = vector<vl>;
using vvpl = vector<vpl>;

double dist(long long x, long long y) {
	return sqrt(x*x + y*y);
}

void resuelveCaso() {
	int n; double d; cin >> n >> d;
	long long x, y, c = 0;
	for(int i = 0; i < n; i++) {
		cin >> x >> y;
		if( dist(x,y) <= d ) c++;
	}
	cout << c << endl;
}

int main() {
	int T=1;
	for (int i = 1; i <= T; i++) {
		//cout << "Case #" << i << ": ";
		resuelveCaso();
	}
	return 0;
}




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

int main(){
  string s;
  cin >> s;
  
  for (int i = 0; i <= 4; i++) cout << s[i];
  cout << ' ';
  
  for (int i = 6; i <= 12; i++) cout << s[i];
  cout << ' ';
  
  for (int i = 14; i <= 18; i++) cout << s[i];
  cout << endl;
  
  
  
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <string> vs;
typedef vector <long long> vll;
typedef vector <pii> vpii;
typedef vector <vi> vvi;
typedef vector <vll> vvll;

#define forn(i, n) for((i) = 0; (i) < (n); (i)++)
#define form(i, m, n) for((i) = m; (i) < (n); (i)++)
#define vsort(v) sort((v).begin(), (v).end())

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s;
    cin >> s;

    if (s[0] >= 'A' && s[0] <= 'Z') cout << "A";
    else cout << "a";

    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

using ll = long long;
using P = pair<int , int>;
  
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  string s; ll k; cin >> s >> k;
  ll cnt = 0;
  int l = 0, r = 0;
  int j = 0;
  
  if(s[0] == s[s.size()-1]) {
    ++l;
    while(s[j] == s[++j]) ++l;
    j = s.size()-1;
    if(l == s.size()) {
      cout << s.size() * k / 2 << endl;
      return 0;
    }
    ++r;
    while(s[j] == s[--j]) ++r;
  }
  for(int i = l; i < s.size()-r; ++i) {
    bool b = s[i] == s[i-1];
    cnt += b;
    if(b) s[i] = '#';
  }
  cout << l/2 + cnt * k + (l + r) / 2 * (k - 1) + r/2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int ans=INT_MAX,v[100001],n;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
	}
	for(int i=0;i<n-1;i++)
	{
		if(ans==1) 
		{
			break;
		}
		if(v[i]%ans==0) 
		{
			continue;
		}
		for(int j=i+1;j<n;j++)
		{
			int large=max(v[i],v[j]);
			int small=min(v[i],v[j]);
			ans=min(__gcd(large,small),ans);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 640
import java.util.Scanner;
 
 
public class Main {
     
 
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int m = stdIn.nextInt();
         
        int[][] A = new int[n][m];
        int[] B = new int[m];
        int[] C = new int[n];
        for(int i = 0; i < n; i++) {
            for(int j = 0; j <  m; j++) {
                A[i][j] = stdIn.nextInt();
            }
        }
        for(int i = 0; i < m; i++) {
            B[i] = stdIn.nextInt();
        }
         
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < m; j++) {
                C[i] += A[i][j] * B[j];
            }
        }
         
        for(int i = 0; i < n; i++) {
            System.out.println(C[i]);
        }
    }
 
}


Measured memory_bytes: 40788
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
using namespace std;



int main(){
    string s,t;
    cin>>s>>t;
    int ans=0;
    pan(i,3){
        ans+= s[i]==t[i] ? 1:0;
    }
    cout<<ans;
}


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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int wsum[] = new int[n];
		wsum[0] = sc.nextInt();
		for(int i=1;i<n;i++) {
			wsum[i] = wsum[i-1]+sc.nextInt();
		}
		
		int sum = wsum[n-1];
		int min = sum;
		
		for(int i=0;i<n-1;i++) {
			if(min > zettaichi(sum - 2 * wsum[i]))
				min = zettaichi(sum - 2 * wsum[i]);
			else
				break;
		}
		
		System.out.print(min);
	}
	public static int zettaichi(int a) {
		if(a>=0)
			return a;
		else
			return -a;
	}
	
}

Measured memory_bytes: 21972
#include <stdio.h>
#define S 0
#define H 1
#define C 2
#define D 3

int main(){
  int n, num,i, j, card[4][13] = {};
  char moji;
  scanf("%d", &n);
  for(i = 0;i < n;i++){
    scanf(" %c %d", &moji, &num);
    switch(moji){
    case 'S': card[S][num] = 1; break;
    case 'H': card[H][num] = 1; break;
    case 'C': card[C][num] = 1; break;
    case 'D': card[D][num] = 1; break;
    }
  }
  for(i = 0;i < 4;i++){
    for(j = 1;j < 14;j++){
      if(card[i][j] != 1){
	switch(i){
	case S: putchar('S'); break;
	case H: putchar('H'); break;
	case C: putchar('C'); break;
	case D: putchar('D'); break;
	}
	printf(" %d\n", j);
      }
    }
  }
  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl
#define DOUBLE(d) cout << fixed << setprecision(15) << (d) << endl

struct UnionFind {
private:
    int N;
    vi parent;
    vi rank_;

    void init(int n) {
        N = n;
        parent.resize(0); parent.clear(); parent.resize(n);
        REP (i, N) parent[i] = i;
        rank_.resize(0); rank_.clear(); rank_.resize(n);
    }

public:
    UnionFind() { init(0); }
    UnionFind(int n) { init(n); }

    int root(int x) {
        return (parent[x] == x) ? x : parent[x] = root(parent[x]);
    }

    bool isSame(int x, int y) {
        return root(x) == root(y);
    }

    void merge(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;

        if (rank_[x] < rank_[y])
            parent[x] = y;
        else {
            parent[y] = x;
            if (rank_[x] == rank_[y]) rank_[x]++;
        }
    }
};

const int MAX = 1e5+10;

int N, M;
vi L[MAX];

bool solve() {
    UnionFind uf(N+M);
    REP (i, N) FORE (l, L[i]) uf.merge(i, l+N);
    REP (i, N) {
        if (!uf.isSame(0, i)) return false;
    }
    return true;
}

int main() {
    cin >> N >> M;
    REP (i, N) {
        int k; cin >> k;
        L[i] = vi(k);
        REP (j, k) { cin >> L[i][j]; L[i][j]--; }
    }
    YES(solve());
}

Measured memory_bytes: 8832
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int SIZE=100050;
//int arr[SIZE]={};
//ここまでテンプレ
int main(){
	char s[3];
	cin>>s;
	for(int i=0;i<strlen(s);i++){
		if(s[i]=='9'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
"""
<<全探索問題//ABC079C>>
1. itertools,evalsを用いた方法
2. bit全探索を用いた方法
"""

#1. itertoolsを用いた方法
"""
import itertools
s=input()
A,B,C,D=s
for i in itertools.product(['+','-'],repeat=len(s)-1):
    formula=''
    formula=A+i[0]+B+i[1]+C+i[2]+D
    if eval(formula)==7:
        print(formula+'=7')
        break
"""

#2. bit全探索を用いた方法
s=input()
N=len(s)-1
for i in range(2**N):
    list=['+']*N
    formula=''
    for j in range(N):
        if ((i>>j)&1):
            list[N-1-j]='-'
    for num,operator in zip(s,list+['']):
        formula+=(num+operator)
    if eval(formula)==7:
        print(formula+'=7')
        break
    


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

using namespace std;

using int64 = long long;
const int64 INF = 1LL << 62;

int main()
{
  int64 N, A[100000];

  cin >> N;
  int64 all = 0;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    all += A[i];
  }

  int64 add = N * (N + 1) / 2;
  if(all % add != 0) {
    cout << "NO" << endl;
    return (0);
  }
  all /= add;

  vector< int64 > sa(N);
  for(int i = 0; i < N; i++) {
    sa[i] = A[(i + 1) % N] - A[i];
  }

  // 全体を -1 してどこかの要素に +N する操作を all 回できる
  // どうせ -1 が all 回されるので最初に -all しておく

  for(int i = 0; i < N; i++) {
    sa[i] -= all;
  }

  // あとは自明なので
  for(int i = 0; i < N; i++) {
    if(sa[i] > 0 || sa[i] % N != 0) {
      cout << "NO" << endl;
      return (0);
    }
  }

  cout << "YES" << endl;
}

Measured memory_bytes: 1792