akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int shichigosanjudgement(ll a){
    int x3=0;
    int x5=0;
    int x7=0;
    while(1){
        int y=a%10;
        if(y==3)x3=1;
        if(y==5)x5=1;
        if(y==7)x7=1;
        if(y!=3&&y!=5&&y!=7) {return 0;break;}
        a=(a-y)/10;
        if(a==0)break;
    }
    if(x3==1&&x5==1&&x7==1)return 1;
    else return 0;
}
int Count(ll a,ll b){
    int count=0;
    for(int i=a;i<b+1;i++){
        count+=shichigosanjudgement(i);
    }
    return count;
}
int main(void){
    ll N;cin>>N;
    if(N<300000000)cout<<Count(1,N)<<endl;
    if(300000000<=N&&N<500000000)cout<<8334+Count(300000000,N)<<endl;
    if(500000000<=N&&N<700000000)cout<<8334+6050+Count(500000000,N)<<endl;
    if(700000000<=N)cout<<8334+6050+6050+Count(700000000,N)<<endl;
}

Measured memory_bytes: 256
n,k=map(int,raw_input().split())
cnt=[0]*(10**5+1)
for i in xrange(n):
    a,b=map(int,raw_input().split())
    cnt[a]+=b
for i in xrange(10**5+1):
    if k-cnt[i]<=0:
        print i
        break
    k-=cnt[i]


Measured memory_bytes: 4868
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
#include <chrono>
#include <fstream>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    int n, x;
    cin >> n >> x;
    vector<ll> a(n);
    cin >> a;
    ll sum = 0;
    rep(i, n) sum += a[i];
    if (sum == x) cout << n << endl;
    else {
        sort(a.begin(), a.end());
        ll s = 0;
        int i = 0;
        while (i < n && s + a[i] <= x) {
            s += a[i];
            i++;
        }
        cout << min(n - 1, i) << endl;
    }
}

Measured memory_bytes: 3628
from collections import defaultdict

H, W = map(int, input().split())
pict = defaultdict(lambda: "#")
for i in range(H):
    S = input()
    for j in range(len(S)):
        pict[i, j] = S[j]

ans = "Yes"
for i, j in pict.keys():
    if pict[i, j] == "#" and (
        (i - 1 >= 0 and pict[i - 1, j] != "#")
        and (j - 1 >= 0 and pict[i, j - 1] != "#")
        and (i + 1 < H and pict[i + 1, j] != "#")
        and (j + 1 < W and pict[i, j + 1] != "#")
    ):
        ans = "No"
        break

print(ans)


Measured memory_bytes: 39664
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> Q;

ll mod = 1000000007;
int r, D, x;
ll ans;
vector<P> vec;

int po(int x, int y)
{
	if (y == 0) return 1;
	return po(x, y - 1) * x;
}

int main()
{
	cin >> r >> D >> x;
	for (int i = 1; i <= 10; i++)
	{
		x = r * x - D;
		cout << x << endl;
	}
	cin >> x;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define vi vector <int>
#define vll vector<ll>
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define INF 1000000000//000000000
#define pi atan(1)*4
#define MOD 1000000000+7L
#define eps 0.0000006
#define MAX_V 10000
 
using namespace std;
 
int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	
	int n,k;

	cin >> n >> k;

	int a[n],dp[n];


	for (int i = 0; i < n; ++i){
		cin >> a[i];
		dp[i] = INF;
	}
	dp[0] = 0;
	
	for (int i = 1; i < n; ++i){
		for(int j = i-1; j >= (i-k) && j >= 0; j--) dp[i] = min(dp[j]+abs(a[j]-a[i]),dp[i]);
	}

	cout << dp[n-1] << '\n';

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 1000000;

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

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/


int prime[100000];
bool is_prime[1000000];


void sieve(void)
{
	int p = 0;
	
	REP(1000000) is_prime[i] = true;
	is_prime[0] = is_prime[1] = false;
	for (int i=2; i<1000000; i++)
	{
		if (is_prime[i])
		{
			prime[p++] = i;
			for (int j=2*i; j<1000000; j+=i) is_prime[j] = false;
		}
	}
}


int main()
{
	int n, s;
	
	sieve();
	
	while (cin >> n, n)
	{
		s = 0;
		REP(n)
		{
			s += prime[i];
		}
		cout << s << endl;
	}
	
	return 0;
}

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

int func(vector<vector<int> > &);
void turn(vector<vector<int> >&,int);
int count(vector<vector<int> >&);
int H,W;
int main(){
    while(cin>>H>>W&&H){
        vector<vector<int> > map(W,vector<int>(H));
        for(int y=0;y<H;++y){
            for(int x=0;x<W;++x){
                int d;
                cin>>d;
                map[x][y]=d==1;
            }
        }
        cout<<func(map)<<endl;
    }
    return 0;
}

void turn(vector<vector<int> >&map,int num){
    for(int i=0;i<H;++i){
        if((1<<i)&num){
            for(int x=0;x<W;++x){
                map[x][i]=!map[x][i];
            }
        }
    }
}

int func(vector<vector<int> >&map){
    int ans=0;
    for(int i=0;i<(1<<H);++i){
        turn(map,i);
        ans = max(ans,count(map));
        turn(map,i);
    }
    return ans;
}

int count(vector<vector<int> >&map){
    int res = 0;
    for(int x=0;x<W;++x){
        int c = 0;
        for(int y=0;y<H;++y){
            c += map[x][y]?1:0;
        }
        res+=max(c,H-c);
    }
    return res;
}


Measured memory_bytes: 3640
#include <iostream>

int main() {
  int H, W, A, B;
  std::cin >> H >> W >> A >> B;
  
  for (int y = 0; y < H; ++y) {
    for (int x = 0; x < W; ++x) {
      if ((x < A) ^ (y < B)) {
        std::cout << '1';
      } else {
        std::cout << '0';
      }
    }
    std::cout << '\n';
  }
  
  return 0;
}


Measured memory_bytes: 1280
#include <iostream>

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

int cnt = 0;

void bubbleSort(int *A, int n) {
  rep(i, n) {
    for (int j = n - 1; j > i; --j) {
      if (A[j] < A[j - 1]) {
        int temp = A[j];
        A[j] = A[j - 1];
        A[j - 1] = temp;
        cnt++;
      }
    }
  }
}

int main() {
  int n;
  std::cin >> n;
  int A[n];
  rep(i, n) std::cin >> A[i];

  bubbleSort(A, n);

  rep(i, n) {
    std::cout << A[i];
    if (i == n - 1)
      std::cout << '\n';
    else
      std::cout << ' ';
  }

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


Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

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

vector< vector<int> > g;
int n, m;

vector<bool> visited;
vector<int> matching;

bool augment(int left) {
  if (left < 0)
    return true;
  if (visited[left])
    return false;
  visited[left] = true;
  REP(i, g[left].size()) {
    int right = g[left][i];
    if (augment(matching[right])) {
      matching[right] = left;
      return true;
    }
  }
  return false;
}
int match() {
  matching.assign(m, -1);
  int matches = 0;
  REP(left, n) {
    visited.assign(n, false);
    if (augment(left))
      matches++;
  }
  return matches;
}

int main() {
  int N; cin >>N;
  vector<int> a(N),b(N),c(N),d(N);
  REP(i,N) {
    cin>>a[i]>>b[i];
  }
  REP(i,N) {
    cin>>c[i]>>d[i];
  }
  n = m = N;
  g = vector< vector<int> > (N);
  REP(i,N) {
    REP(j,N) {
      if(a[i] < c[j] && b[i] < d[j]) {
        g[i].push_back(j);
      }
    }
  }
  int ans = match();
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;

const int INF=1e9;
const int MOD=1e9+7;

int main(){
    int N; cin >> N;
    int a[N],b[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    for(int i=0;i<N;i++){
        cin >> b[i];
    }
    ll sa=0; ll sb=0;
    for(int i=0;i<N;i++){
        if(a[i]<b[i]) sb+=(b[i]-a[i])/2;
        if(a[i]>b[i]) sa+=a[i]-b[i];
    }
    if(sb>=sa){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}
    


Measured memory_bytes: 3696
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X;
    cin >> X;
    X -= 400;
    ll num = X / 200;
    ll ans = 8 - num;
    cout << ans << endl;
}


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

int main(){
    int a,b,c,d,x;
    int ans=0;
    cin>>a>>b>>c>>x;
    for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
    for(int k=0;k<=c;k++){
    if(i*500+j*100+k*50==x){
        ans++;
    }
    }
    }
    }
    cout<<ans<<endl;
    return 0;
    }


Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var n string

	fmt.Scanf("%s", &n)

	var answer int = 0
	str_n := strings.Split(n, "")
	for _, str := range str_n {
		i, _ := strconv.Atoi(str)
		answer += i
	}

	if answer % 9 == 0 {
		fmt.Print("Yes")
	} else {
		fmt.Print("No")
	}
}

Measured memory_bytes: 6552
import math

n,k = map(int, input().split())

c = 10**9+7

def cmb(n,r):
    return math.factorial(n) // (math.factorial(n-r)*math.factorial(r))


for i in range(k):
    try:
        print(((cmb(k-1,i)*cmb(n - k+1,i+1))%c))
    except:
        print(0)


Measured memory_bytes: 3316
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)(n),(int)(n))
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int a[LIMIT2]={0};
  char s[LIMIT1];
  
  scanf("%lld",&n);
  scanf("%s",s);
  for(i=0;i<n-2;i++){
    if(strncmp(&s[i],"ABC",3)==0) result++;
  }
  printf("%lld",result);
  return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
int n;
  cin >> n;
  vector<int> a(n,0);
  for(int i=0;i<n;i++)
    cin >> a[i];
  vector<int> dp(n,INT_MAX);
  dp[0]=0;
  for(int i=0;i<n;i++)
  {
    for(int j:{i+1,i+2})
    {
      if(j<n)
      dp[j]=min(dp[j],dp[i]+abs(a[i]-a[j]));
    }
  }
  cout<< dp[n-1];
}

Measured memory_bytes: 1024
#ifdef OJ_MISC_OFFLINE

#include "prolog.h"

#else
#define LOG
#define PRINT
#define LCERR
#include <iostream>
auto optimize_cpp_stdio = []() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::setvbuf(stdout, nullptr, _IOFBF, BUFSIZ);
    return 0;
}();
#endif

#include <algorithm>
#include <array>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

namespace {

using namespace std;

class Solution {
public:
    int synthetic_kadomatsu(const vector<int>& bam, const array<int, 3>& targets) {
        int min_mp_cost = 1000000007;
        array<vector<int>, 3> groups;
        dfs(0, bam, targets, groups, min_mp_cost);
        return min_mp_cost;
    }

    void dfs(size_t d, const vector<int>& bam, const array<int, 3>& targets,
             array<vector<int>, 3>& groups, int& min_mp_cost) {
        if (d == bam.size()) {
            min_mp_cost = min(min_mp_cost, evaluate(groups, targets));
            return;
        }
        for (size_t i = 0; i < 4; ++i) {
            if (i < 3) {
                groups[i].emplace_back(bam[d]);
            }
            dfs(d + 1, bam, targets, groups, min_mp_cost);
            if (i < 3) {
                groups[i].pop_back();
            }
        }
    }

    int evaluate(const array<vector<int>, 3>& groups, const array<int, 3>& targets) {
        int mp_cost = 0;
        for (size_t i = 0; i < 3; ++i) {
            if (groups[i].empty()) {
                return 1000000007;
            }
            mp_cost += (groups[i].size() - 1) * 10;
            int sum_group_i = accumulate(groups[i].begin(), groups[i].end(), 0);
            mp_cost += abs(sum_group_i - targets[i]);
        }
        return mp_cost;
    }

private:

};

int solve() {
    Solution solution;
    // handle IO here
    int N;
    cin >> N;
    array<int, 3> targets{};
    for (int i = 0; i < 3; ++i) {
        cin >> targets[i];
    }
    vector<int> bam(N);
    for (int i = 0; i < N; ++i) {
        cin >> bam[i];
    }
    cout << solution.synthetic_kadomatsu(bam, targets);
    return 0;
}

} // anonymous namespace

#ifdef OJ_MISC_OFFLINE

#include "epilog.h"

#else

int main() {
    return solve();
}

#endif


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>

const int ps[]={
  2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997
};
constexpr int psnum=168;
const char *ansstr[]={"pairwise","setwise","not"};

void doit(std::istream &sin, std::ostream &sout) {
  int n;
  sin >> n;
  std::vector<int> v(n);
  for ( auto &a: v ) {
    sin >> a;
  }
  std::unordered_map<int,int> c;
  int ans=0;
  for ( auto a: v ) {
    bool dobreak=false;
    for ( auto q: ps ) {
      if ( a==1 ) break;
      if ( a%q != 0 ) continue;
      a/=q;
      while ( a%q==0 ) a/=q;
      if ( c.find(q)==c.end() ) {
        c[q]=1;
      }
      else {
        ans=1;
        auto t=c[q];
        if ( t<n-1 ) {
          c[q]=t+1;
        }
        else {
          ans=2;
          dobreak=true;
          break;
        }
      }
    }
    if ( dobreak ) break;
    if ( a==1 ) continue;
    auto q=a;
    if ( c.find(q)==c.end() ) {
      c[q]=1;
    }
    else {
      ans=1;
      auto t=c[q];
      if ( t<n-1 ) {
        c[q]=t+1;
      }
      else {
        ans=2;
        break;
      }
    }
  }
  sout << ansstr[ans] << " coprime" << std::endl;
}

int main(void) {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  doit(std::cin,std::cout);
}


Measured memory_bytes: 10436
#include<iostream>
#include<algorithm>
#define MAX_N 300003
using namespace std;
typedef long long ll;

ll a[MAX_N];

int main() {
    ll N;
    cin >> N;
    for (int i = 0; i < 3 * N; i++) cin >> a[i];
    sort(a, a + 3 * N);
    ll ans = 0;
    for (int i = 3 * N - 2; i >= N; i -= 2) {
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    string a;
    cin >>a;
    vector<char>ans;
    for (int i = 0; i < 1 << 3; ++i) {
        ll sum=a[0]-'0';
        vector<char>now;
        for (int j = 0; j < 3; ++j) {
            if(i>>j&1){
                sum+=a[j+1]-'0';
                now.push_back('+');
            }
            else {
                sum-=a[j+1]-'0';
                now.push_back('-');
            }
        }
        if(sum==7){
            ans=now;
            break;
        }
    }
    for (int i = 0; i < 3; ++i) {
        cout <<a[i]<<ans[i];
    }
    cout <<a[3]<<"=7"<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
using namespace std;

int A, B, C;
int counter;

int main() {
  scanf("%d %d %d", &A, &B, &C);
  int sum = A + B + C;
  int max = sum / 3;
  while (1) {
    max = sum / 3;
    if (sum % 3 == 0 && max >= A && max >= B && max >= C) {
      break;
    }
    sum += 2;
    counter++;
  }
  printf("%d", counter);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

int main(){	
	long long N;
	scanf("%lld",&N);
	if (N == 3) {
		cout << "2 5 63\n";
		return 0;
	}
	if (N == 4) {
		cout << "2 5 20 63\n";
		return 0;
	}
	if (N == 5) {
		cout << "2 3 4 6 9\n";
		return 0;
	}
	if (N == 6) {
		cout << "2 3 4 6 9 12\n";
		return 0;
	}
	priority_queue<ll, vector<ll>, greater<ll> > que1, que2;
	repn(i,30000) {
		if (i%2 == 0) que1.push(i);
		if (i%3 == 0 && i%2 != 0) que2.push(i);
	}
	ll a, b;
	repn(i,5000) {
		b = i;
		a = N-b;
		if ((a%3 == 0 || a%3 == 2) && b%2 == 0 && a >= 2 && b >= 3 && a <= 15000) {
			// cout << a << " " << b << endl;
			break;
		}
	}
	ll c = 0;
	rep(i,a) {
		cout << que1.top();
		que1.pop();
		c++;
		if (c == N) {
			cout << endl; 
			return 0;
		} else cout << " ";
	}
	rep(i,b) {
		cout << que2.top();
		que2.pop();
		c++;
		if (c == N) {
			cout << endl; 
			return 0;
		} else cout << " ";
	}

	return 0;
}



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

int main(){
    ll N;
    cin >> N;
    ll ans;

    ll term10 = 1;
    rep(i, N){
        term10 = (term10 * 10) % MOD;
    }

    ll term9 = 1;
    rep(i, N){
        term9 = (term9 * 9) % MOD;
    }

    ll term8 = 1;
    rep(i, N){
        term8 = (term8 * 8) % MOD;
    }

    ans = (term10 - 2 * term9 + term8) % MOD;
    while (ans < 0){
        ans += MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

class UnionFindTree {
   public:
    vector<int> parent;
    vector<int> siz;

    UnionFindTree(int n) {
        siz.resize(n, 1);
        parent.resize(n);
        for (int i = 0; i < n; i++) {
            parent[i] = i;
        }
    }

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

    void unite(int x, int y) {
        int rx = root(x); int ry = root(y);
        if (rx == ry) return;
        if (siz[rx] < siz[ry]) swap(rx, ry);
        siz[rx] += siz[ry];
        parent[ry] = rx;
    }

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

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

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

    vector<pair<int, int>> edge(M);
    REP(i, 0, M) {
        int a, b; cin >> a >> b;
        edge[i] = {--a, --b};
    }

    int ans = 0;
    REP(i, 0, M) {
        UnionFindTree uft(N);
        REP(j, 0, M) {
            if (i == j) continue;
            uft.unite(edge[j].first, edge[j].second);
        }
        if (uft.size(0) != N) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#-*- coding:utf-8 -*-

if __name__ == "__main__":
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    if A <= B:
        train = A
    else:
        train = B
    if C <= D:
        bus = C
    else:
        bus = D
    print(train+bus)


Measured memory_bytes: 3316
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int> > Matrix;

ll nC2(int n){
    ll ans = (ll)n * (n - 1) / 2;
    return ans;
}

int main(){
    int n;
    cin >> n;
    vector<string> str(n);
    rep(i, n){
        string s;
        cin >> s;
        sort(ALL(s));
        str[i] = s;
    }

    sort(ALL(str));
    ll ans = 0;
    int c = 1;
    rep(i, n -1){
        if (str[i] == str[i+1]){
            c++;
        }else{
            if (c > 1) ans += nC2(c);
            c = 1;
        }
    }

    if (c > 1) ans += nC2(c);
    cout << ans << endl;

}

Measured memory_bytes: 5760
n = int(input())
l = [[] for i in range(n)]
A, B = 0, 0
for i in range(n):
    l[i] = list(map(int, input().split()))
    l[i].append(l[i][0]-l[i][1])
l.sort(key = lambda x: (x[0]+x[1]), reverse = True)
#print(l)
for i in range(n):
    if(i%2 == 0):
        A += l[i][0]
    else:
        B += l[i][1]
print(A - B)

Measured memory_bytes: 35404
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
    cin >> A[i];
}
sort(A.begin(),A.end());
for (int i = 0; i < N; i++) {
    if(A[i]==A[i+1]){
        cout<<"NO"<<endl;
        return 0;
    }
}
cout<<"YES"<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main()
{
  int N, T, A;
  cin >> N >> T >> A;
  int H[N];
  for (int i = 0; i < N; i++)
  {
    cin >> H[i];
  }
  int ans = -1;
  int sub = 1000000000;
  for (int i = 0; i < N; i++)
  {
    int tmp = abs(1000 * A - (1000 * T - H[i] * 6));
    if (tmp < sub)
    {
      ans = i;
      sub = tmp;
    }
  }
  cout << ans + 1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<bitset>
#include<queue>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

int main(){
  int n;
  cin >> n;
  map<int,int> m;
  ll sum = 0;
  rep(i,n) {
    int a;
    cin >> a;
    m[a]++;
    sum += a;
  }

  int q;
  cin >> q;
  rep(i,q){
    int b, c;
    cin >> b >> c;
    if (m.count(b)){
      sum += (c - b) * m.at(b);
      m[c] += m.at(b);
      m.erase(b);
    }
    cout << sum << endl;
  }
}


Measured memory_bytes: 6484
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
int main() {
	int n;
	cin >> n;
	int sum = n % 2 ? n : n + 1;
	printf("%d\n", (n - 1) * n / 2 - n / 2);
	rep(i, 0, n) {
		rep(i2, i + 1, n) {
			if (i + i2 + 2 == sum)continue;
			printf("%d %d\n", i + 1, i2 + 1);
		}
	}
	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);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if(a < b){
			if(b < c){
				System.out.printf("%d %d %d\n", a, b, c);
			}else if (c < a){
				System.out.printf("%d %d %d\n", c, a, b);
			}else{
				System.out.printf("%d %d %d\n", a, c, b);
			}
		}else{
			if(a < c){
				System.out.printf("%d %d %d\n", b, a, c);
			}else if (c < b){
				System.out.printf("%d %d %d\n", c, b, a);
			}else{
				System.out.printf("%d %d %d\n", b, c, a);
			}
		}
	}
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> c(10, vector<int>(10));

    for (int i=0; i<10; i++) {
        for (int j=0; j<10; j++) {
            c.at(i).at(j) = 0;
        }
    }

    for (int i=1; i<=n; i++) {
        int num = i;
        int head;
        int tail = i % 10;

        if (tail == 0) continue;

        while (num) {
            head = num;
            num = num / 10;
        }

        //cout << head << " " << tail << endl;

        c.at(head-1).at(tail-1)++;
    }

    long long ans = 0;
    
    for (int i=0; i<10; i++) {
        for (int j=0; j<10; j++) {
            ans += c.at(i).at(j) * c.at(j).at(i);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin

// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!
struct UnionFind {
  int n;
  std::vector<int> par;
  std::vector<int> rank;
  UnionFind(int n_) : par(n_), rank(n_,0), n(n_) { for(int i=0;i<n;++i) par[i] = i; }
  int root(int x) { return par[x] == x ? x : (par[x]=root(par[x])); }
  bool same(int x, int y) { return root(x)==root(y); }
  void unite(int x, int y) {
    x = root(x); y = root(y);
    if(x==y) return;
    if(rank[x] < rank[y]) par[x] = y;
    else {
      par[y] = x;
      if(rank[x]==rank[y]) rank[x]++;
    }
  }
};
// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int n, q; cin>>n>>q;
  UnionFind uf(n);
  int c, x, y;
  rep(i,q){
    cin>>c>>x>>y;
    if(c==0) uf.unite(x,y);
    else {
      cout << uf.same(x,y) << endl;
    }
  }
  return 0;
}



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

using namespace std;

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

    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define for0(n) for(i=0; i<(n); i++)
#define forn1 for(i=1; i<=n; i++)


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll _,i,j,n,a,b,e,k,u,t,x=1,m,y,q,f=1,c=0,d=0,l,p,z,o,r,g;
    string ss,s;
    cin>>a>>b;
    cout<<a*b<<endl;
}



Measured memory_bytes: 3612
H,N=list(map(int,input().split()))

A=[]
B=[]

dp=[[10**10]*(H+1) for _ in range(N+1)]
dp[0][0]=0

for _ in range(N):
    a,b=list(map(int,input().split()))

    A.append(a)
    B.append(b)

for i in range(N):
    for j in range(H+1):
        dp[i+1][j]=min(dp[i][j],dp[i+1][max(j-A[i],0)]+B[i])
        
print(dp[N][H])

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

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

bool check(vector<int> &psum, long long cost, long long a, long long b) {
	int n = psum.size();
	IFOR(i, 0, n - 1) {
		long long sumx = a * psum[n - i - 1] + i*b;
		if (sumx <= cost)
			return true;
	}
	return false;
}

int main() {
	long long n, a, b;
	cin >> n >> a >> b;
	vector<int> x(n);
	FOR(i, 0, n) {
		cin >> x[i];
	}
	RFOR(i, n - 1, 0) {
		x[i] -= x[0];
	}

	vector<int> diff(n);
	diff[0] = 0;
	FOR(i, 1, n) {
		diff[i] = x[i] - x[i - 1];
	}
	sort(diff.begin(), diff.end());
	vector<int> psum(n);
	partial_sum(diff.begin(), diff.end(), psum.begin());

	long long lb = 0, ub = b*(n - 1);
	while (ub - lb > 1) {
		long long half = (lb + ub) / 2;
		if (check(psum, half, a, b))
			ub = half;
		else
			lb = half;
	}
	cout << ub << endl;
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  for(int i=0; i<n; ++i){
    int year,many,m,max;    
    cin >> many;
    cin >> year;
    cin >> m;
    //cout << "dbg3" << endl;
    double way[m][3];
    for(int j=0; j<m; ++j){
      cin >> way[j][0] >> way[j][1] >> way[j][2];
      //  cout << "dbg2" << endl;
    }
    //cout << "dbg1" << endl;
    max = 0;
    int tmp_m;
    
    for(int j=0; j<m; ++j){

      if(way[j][0] == 0){
	tmp_m = many;
	int risi = 0;
	for(int k=0; k<year; ++k){
	  risi  += tmp_m * way[j][1];
	  tmp_m -= way[j][2];
	} 
	tmp_m += risi;
      }else if(way[j][0] == 1){
	tmp_m = many;
	for(int k=0; k<year; ++k){
	  tmp_m  = tmp_m * (1 + way[j][1]);
	  tmp_m -= way[j][2];
	}
      }
      if(max<tmp_m){
      max = tmp_m;
      }
    }
    cout << max << endl;;
  }
  return 0;
}
    

Measured memory_bytes: 3216
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
int main() {
	int N;	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	int ans = 0;
	while (true) {
		for (int i = 0; i < N; ++i) {
			if (a[i] % 2 != 0) {
				cout << ans << endl;
				cin >> N;
				return 0;
			}
			a[i] /= 2;
		}
		++ans;
	}
}

Measured memory_bytes: 256
#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 maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#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 vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int mod = 1000000007;

int main(){
    int n, k;
    cin >> n >> k;
    vi sunuke(n, 0);

    rep(i, k){
        int d;
        cin >> d;
        rep(j, d){
            int a;
            cin >> a;
            a--;
            sunuke[a]=1;
        }
    }
    int ans = 0;
    rep(i, n){
        if(sunuke[i]==0) ans++;
    }


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

Measured memory_bytes: 3628
#include <stdio.h>

#define SETMAX 3
#define RUNMAX 8

typedef struct _runner {
	int num;
	double rtime;
} runner_t;

void swap( runner_t * run1, runner_t * run2 )
{
	runner_t tmp;

	tmp.num = run1->num;
	tmp.rtime = run1->rtime;

	run1->num = run2->num;
	run1->rtime = run2->rtime;

	run2->num = tmp.num;
	run2->rtime = tmp.rtime;
}


void sort( runner_t * run, int arysize )
{
	int i, j;
	int n = sizeof( run ) / sizeof( runner_t );

	for ( i = 0 ; i < arysize; i++ ) {
		for ( j = i+1 ; j < arysize ; j++ ) {
			if ( run[i].rtime > run[j].rtime ) {
				swap( &run[i], &run[j] );
			}
		}
	}	
}


int main()
{
	runner_t run[SETMAX][RUNMAX];	
	runner_t third[(RUNMAX-2)*3];
	int i = 0, j = 0, k = 0;

	for ( i = 0 ; i < SETMAX ; i++ ) {
		for ( j = 0 ; j < RUNMAX ; j++ ) {
			scanf( "%d %lf", &run[i][j].num, &run[i][j].rtime );
		}
	}

	k = 0;
	for ( i = 0 ; i < SETMAX ; i++ ) {
		sort( run[i], RUNMAX );
		for ( j = 2 ; j < RUNMAX ; j++ ) {
			third[k].num = run[i][j].num;
			third[k].rtime = run[i][j].rtime;
			k++;
		}
	}


	sort( third, k );

	for ( i = 0 ; i < SETMAX ; i++ ) {
		for ( j = 0 ; j < 2 ; j++ ) {
			printf( "%d %.2lf\n", run[i][j].num, run[i][j].rtime );
		}
	}

	for ( i = 0 ; i < 2 ; i++ ) {
		printf( "%d %.2lf\n", third[i].num, third[i].rtime );
	}

	return 0;
}



Measured memory_bytes: 2040
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void solve()
{
    cout<<fixed<<setprecision(10);
    ld ans = 0;
    lli r;
    cin>>r;
    ans = 2 * 22 * r;
    ans /= 7;
    cout<<ans;
    cout<<'\n';
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 3796
n,k=list(map(int,input().split()))
h=[]
for i in range(n):
    h.append(int(input()))
h=sorted(h)

ans=10000000000
tmp=0
for i in range(n-k+1):
    tmp=h[i+k-1]-h[i]
    ans=min(tmp,ans)
    
print(ans)

Measured memory_bytes: 8276
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

 int main(){

 int n; cin>>n;
 map<string,int>s;
 vector<string>b(n);

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

 int maxim = 0;

 for(auto p:s){
    auto k = p.first;
    auto v = p.second;
    if(maxim < v)
        maxim = v;
 }

 for(auto p:s){
  auto k = p.first;
  auto v = p.second;

  if(v == maxim) cout<<k<<endl;

 }

  return 0;
 }

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

int main(void) {
    char b;
    cin >> b;
    if(b == 'A') {
        cout << 'T' << endl;
    } else if(b == 'T') {
        cout << 'A' << endl;
    } else if(b == 'C') {
        cout << 'G' << endl;
    } else if(b == 'G') {
        cout << 'C' << 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 str = sc.next();
		String ans="";
		for(int i=1;i<=str.length();i++)
			ans+=str.charAt(str.length()-i);
		System.out.println(ans);
		
	}
}

Measured memory_bytes: 17116
#include<stdio.h>
#include<stdbool.h>

int main(void){

	int N, M;
	int H[100001];
	int A[100001];
	int B[100001];
	bool t[100001];
	int ans = 0;

	scanf("%d %d", &N, &M);
	for(int i = 0; i < N; i++){
		scanf("%d", &H[i]);
	}
	for(int i = 0; i < M; i++){
		scanf("%d %d", &A[i], &B[i]);
	}

	for(int i = 0; i < N; i++){
		t[i] = true;
	}




	for(int i = 0; i < M; i++){
		if(H[A[i] - 1] <= H[B[i] - 1]){
			t[A[i] - 1] = false;
		}
		if(H[A[i] - 1] >= H[B[i] - 1])
			t[B[i] - 1] = false;
	}

	for(int i = 0; i < N; i++){
		if(t[i])
			ans++;
	}

	printf("%d\n", ans);

	return 0;

}


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

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

    int ans = 1000000;
    for(int i = 1; i <= 100; ++i)
    {
        int score = 0;
        for(int num : v)
        {
            score += (num-i)*(num-i);
        }
        ans = min(ans, score);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
dxdy = ((0,1),(0,-1),(1,0),(-1,0))
 
H, W = map(int,input().split())
S = []
 
S.append('.'*(W+2))
for h in range(H):
    s = input()
    S.append('.'+s+'.')
S.append('.'*(W+2))
 
#print (S)
 
for h in range(1,H+1):
    for w in range(1,W+1):
        if S[h][w] == '.':
            continue
        ok = False
        for dx,dy in dxdy:
            if S[h+dx][w+dy] == '#':
                ok = True
                break
        if ok == False:
            print ('No')
            exit()
print ('Yes')

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

int main(){
    int a, b, c;    cin >> a >> b >> c;
    if(a%2 or b%2 or c%2){
        cout << 0;  return 0;
    }
    if(a==b and b==c){
        cout << -1; return 0;
    }
    for(int i=0;sqrt(10000000000)>i;i++){
        int x=a, y=b, z=c;
        a=(y+z)/2;  b=(x+z)/2;  c=(x+y)/2;
        //cout << a << " " << b << " " << c << "\n";
        if(a==b and b==c){
            cout << -1; return 0;
        }
        if(a%2 or b%2 or c%2){
            cout << i+1;    return 0;
        }
    }
    cout << -1;
}


Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=10005;
char s[N],t[N],ans[N],mn,mx;int n,k;
bool cmp(char *s,char *t){
	fp(i,1,n)if(s[i]!=t[i])return s[i]<t[i];
	return false;
}
void solve(char *s,int k){
	R int now=n,len=0;
	while(now&&s[now]==mn)--now,++len;
	while(k&&len<n)len<<=1,--k;
	if(len>=n){
		fp(i,1,n)ans[i]=mn;
		printf("%s\n",ans+1);exit(0);
	}
	fp(i,1,len)t[i]=mn;fp(i,len+1,n)t[i]=s[now--];
	if(cmp(t,ans))fp(i,1,n)ans[i]=t[i];
}
int main(){
	scanf("%d%d%s",&n,&k,s+1);
	mn='z',mx='a';
	fp(i,1,n)cmin(mn,s[i]),cmax(mx,s[i]),ans[i]='z',s[(n<<1)-i+1]=s[i];
	if(mn==mx)return printf("%s\n",s+1),0;
	if(s[n]==mn)solve(s,k);
	fp(i,n,n<<1)if(s[i]==mn)solve(s+i-n,k-1);
	printf("%s\n",ans+1);
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
	
def main():
	N = int(input())
	MP = Graph()
	
	for i in range(N-1):
		u, v, w = map(int, input().split(" "))
		u -= 1
		v -= 1
		if w % 2 == 0:
			MP.add_edge(u, v, 0)
			MP.add_edge(v, u, 0)
		else:
			MP.add_edge(u, v, 1)
			MP.add_edge(v, u, 1)
	
	tmp = Dijkstra(MP, 0)
	
	for i in range(N):
		if i == 0:
			print(0)
			continue
			
		tmptmp = tmp.shortest_distance(i)
		if tmptmp % 2 == 0:
			print(0)
		else:
			print(1)
			
	#print("---")
	#print(tmp.shortest_distance(1))
	
class Graph(object):
    # 隣接リストによる有向グラフ
    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    # ダイクストラ法（二分ヒープ）による最短経路探索
    def __init__(self, graph, start):
        self.g = graph.graph

        # startノードからの最短距離
        # startノードは0, それ以外は無限大で初期化
        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        # 最短経路での1つ前のノード
        self.prev = defaultdict(lambda: None)

        # startノードをキューに入れる
        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            # 優先度（距離）が最小であるキューを取り出す
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        # startノードからgoalノードまでの最短距離
        return self.dist[goal]

    def shortest_path(self, goal):
        # startノードからgoalノードまでの最短経路
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]
        
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 62496
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    ret = (N - 1) * N // 2
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <queue>
#include <random>
#include <map>
#include <set>

#pragma warning(disable:4996)

using namespace std;

int main() {
  int v = 0;
  for (int i = 0; i < 3; ++i) {
    int vv;
    cin >> vv;
    v += vv*pow(10, 2 - i);
  }
  cout << (v % 4 == 0 ? "YES" : "NO") << endl;
  return 0;
}


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

int main(){
	/*input*/
	char s[3];
	for(int i = 0; i < 3; i++){
		cin >> s[i];
	}
	/*calculation*/
	int ans = 700;
	for(int i = 0; i < 3; i++){
		if(s[i] == 'o')ans+=100;
	}
	/*output*/
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    int n, t; cin >> n >> t;
    vector<P> ab;
    vector<int> a(n), b(n);
    for(int i=0; i<n; i++){
        cin >> a.at(i) >> b.at(i);
        ab.emplace_back(a.at(i), b.at(i));
    }

    vector<vector<int>> dp(n+1, vector<int>(6001, 0));
    sort(ab.begin(), ab.end());
    for(int i=0; i<n; i++){
        for(int j=0; j<=6000; j++){
            if(j-ab.at(i).first<0) {
                dp.at(i+1).at(j) = dp.at(i).at(j);
                continue;
            }
            if(j-ab.at(i).first<t) dp.at(i+1).at(j) = max(dp.at(i).at(j), dp.at(i).at(j-ab.at(i).first)+ab.at(i).second);
            else dp.at(i+1).at(j) = dp.at(i).at(j);
        
        }
    }

    int ans = 0;
    rep(i, 6001){
        ans = max(ans, dp.at(n).at(i));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 70784