akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define SORT(v) sort(all(v))
#define SORTD(v) sort(all(v), greater<int>())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<30
#define v(T) vector<T>
#define vv(T) v(v(T))
#define print(x) cout<<x<<endl
#define printv(v) for(auto i : v){cout<<i<<" ";}cout<<endl
#define printu(v) for(auto i : v){print(i);}
#define readv(v, n) for (int i=0;i<n;i++)cin >> v[i]
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

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 (b<a) { a=b; return 1; } return 0; }

int i, j, k;
#define mod 1000000007
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vi dp(n + 2);
	vi flg(n + 1);
	rep(i, m) {
		int k;
		cin >> k;
		flg[k] = 1;
	}
	dp[n] = 1;
	dp[n + 1] = 0;
	for (int i = n - 1; i >= 0; i--) {
		if (flg[i] == 1) {
			dp[i] = 0;
			continue;
		}
		dp[i] = (dp[i + 1] + dp[i + 2]) % mod;
	}
	print(dp[0]);
	return 0;
}

Measured memory_bytes: 1024
MOD=10**9+7
N=int(input())
ans=1
nine=1
eight=1
for i in range(N):
    ans*=10
    ans%=MOD
    nine*=9
    nine%=MOD
    eight*=8
    eight%=MOD
nine*=2
nine%=MOD
ans-=nine
ans%=MOD
ans+=eight
ans%=MOD
print(ans)

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

#define faster     ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define read       freopen("input.txt", "r", stdin);
#define write      freopen("output.txt", "w", stdout);
#define endd        '\n'
#define ll         long long
#define sq(a)      ((a) * (a))

using namespace std;
int main()
{
      faster;
      double pi = 2 * acos(0.0);
      ll int n,i,t,j,k,m=0,a=0,b=0,c=0,d=0,p=0,q,r,x=250,y=10,z,count=0;
      cin>>n>>a>>b;
      if(a==b)cout<<"1"<<endl;
      else if(b<a || n==1)cout<<"0"<<endl;
      else{
            p=(b-a)*(n-2);
            cout<<p+1<<endl;
      }
      return 0;
}
//Sheikh Tafsir Rahman
//CSE IUT

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

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	string s;
    int n;
    cin >> n;
    map<string,int> m;
    for (int i=0;i<n;i++)
    {
        cin >> s;
        m[s]++;
    }
    cout << m.size();
}



Measured memory_bytes: 19208
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<queue>
#include<vector>
#include<utility>
#include<functional>
typedef long long ll;
using namespace std;

int main(){
  double T,X;
  cin >> T >> X;
  cout << T/X << endl;
  return 0;
}

Measured memory_bytes: 256
if __name__ == "__main__":
    while True:
        n,m = list(map(int,input().strip().split()))
        if n ==0 and m ==0:break
        tarou = []
        hanako = []
        ans = (0,0)
        for _ in range(n): tarou.append(int(input()))
        for _ in range(m): hanako.append(int(input()))

        for i in range(n):
            for j in range(m):
                if sum(tarou[:i])+sum(tarou[i + 1:])+hanako[j] == sum(hanako[:j]) + sum(hanako[j+1:]) + tarou[i]:
                    if sum(ans) == 0:ans = (tarou[i],hanako[j])
                    elif sum(ans) > tarou[i]+ hanako[j]: ans = (tarou[i],hanako[j])
        if ans == (0,0):print(-1)
        else:print("%d %d" % (ans[0],ans[1]))

Measured memory_bytes: 7672
n = int(input())
a = w = t = r = 0
for i in range(n):
    s = str(input())
    if s == "AC":
        a += 1
    elif s == "WA":
        w += 1
    elif s == "TLE":
        t += 1
    elif s == "RE":
        r += 1
print("AC x " + str(a))
print("WA x " + str(w))
print("TLE x " + str(t))
print("RE x " + str(r))

Measured memory_bytes: 9208
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>

using namespace std;

int main()
 {
	 int n, big, min;
	 char c[9];

	 cin >> n;

	 for(int i = 0; i < n; i++){
		 cin >> c;

		 sort (c, c+8);

		 min = atoi(c);

		 sort (c, c+8, greater<int>());

		 big = atoi(c);

		 cout << big - min << endl;
	 }

	 return 0;
}

Measured memory_bytes: 1192
#!/usr/bin/env python3
import sys


def solve(S: str):
    return 'x' * len(S)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    print(solve(S))

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
typedef pair<ll, ll> Pair;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define FIND(x,key) x.find(key) != x.end()
#define IN_RANGE_V2(v,k,x,y) (0<=x+dx[k]&&x+dx[k]<v[y].size()&&0<=y+dy[k]&&y+dy[k]<v.size())
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define PRINT_ARRAY_V(a) REPALL(__i,a) {cout<<a[__i]<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};
//const VI dx = {1, 1, 0, -1, -1, -1, 0, 1};
//const VI dy = {0, 1, 1, 1, 0, -1, -1, -1};

void solve()
{
    ll b, c, d, n, m, l, r, k, x, y, z, ans = 0ll;
    string s, t;
    cin>>n;
    VLL a(n);
    ll sum = 0ll;
    REP(i,n) {
        cin>>a[i];
        sum |= a[i]&1;
    }
    if (sum == 0) {
        cout<<"second"<<endl;
    } else {
        cout<<"first"<<endl;
    }
}

int main()
{
    cout<<fixed<<setprecision(20);
    int __t = 1;
    //cin>>__t;
    REP(i,__t) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#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 show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;

const int INF = 1001001001;

#define MAX_N 2510
vector<int> to[MAX_N];
vector<int> rto[MAX_N];
bool reachableFrom1[MAX_N];
bool reachableToN[MAX_N];
bool ok[MAX_N];
int d[MAX_N];

void dfs(int v){
    if (reachableFrom1[v]) return;
    reachableFrom1[v] = true;
    for (int u: to[v]){
        dfs(u);
    }
}

void rdfs(int v){
    if (reachableToN[v]) return;
    reachableToN[v] = true;
    for (int u: rto[v]){
        rdfs(u);
    }
}


int main()
{
    int n, m, p;
    cin >> n >> m >> p;
    //tuple
    vector<tuple<int, int, int>> edges;
    rep(i, m){ 
        int tmpa, tmpb, tmpc;
        cin >> tmpa >> tmpb >> tmpc;
        tmpa--;
        tmpb--;
        tmpc -= p; tmpc = -tmpc;
        edges.emplace_back(tmpa, tmpb, tmpc);
        to[tmpa].push_back(tmpb);
        rto[tmpb].push_back(tmpa);
    }
    dfs(0);
    rdfs(n-1);

    rep(i, n) ok[i] = reachableFrom1[i]&reachableToN[i];

    vector<int> d(n, INF);
    d[0] = 0;
    bool upd = true;

    int step = 0;
    while(upd){
        upd = false;
        rep(i, m){
            int a,b,c;
            //tuple unpack
            tie(a, b, c) = edges[i];
            if (!ok[a]) continue;
            if (!ok[b]) continue;
            int newD = d[a] + c;
            if (newD < d[b]){
                upd = true;
                d[b] = newD;
            }
        }
        step++;
        if (step > n){
            puts("-1");
            return 0;
        }
    }
    int ans = -d[n-1];

    cout << max(0, ans) << endl;

}



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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    vector<ll> a(N);
    REP(i, N)
    {
        cin >> a[i];
    }

    bool isMake = true;
    ll kind = 0;
    map<ll, ll> countMap;
    REP(i, N)
    {
        if (countMap.find(a[i]) == countMap.end())
        {
            countMap[a[i]] = 1;
            kind++;
        }
        else
        {
            countMap[a[i]]++;
        }
        if (kind >= 4)
        {
            isMake = false;
            break;
        }
    }

    if (isMake)
    {
        if (kind == 1)
        {
            if (countMap[0] != N)
            {
                isMake = false;
            }
        }
        else if (kind == 2)
        {
            if ( !(N % 3 == 0 && countMap[0] == N / 3) )
            {
                isMake = false;
            }
        }
        else if (kind == 3)
        {
            if (N % 3 != 0)
            {
                isMake = false;
            }
            vector<ll> numV;
            REPV(it, countMap)
            {
                numV.push_back(it->first);
            }
            ll a = numV[0], b = numV[1], c = numV[2];
            if ( !(countMap[a] == countMap[b] && countMap[a] == countMap[c]) )
            {
                isMake = false;
            }
            if ((a ^ b) != c)
            {
                isMake = false;
            }
        }
    }

    string ans = isMake ? "Yes" : "No";

    cout << ans << endl;
}


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

using namespace std;

const int MAXN = 200200;

int main() {
   ios_base::sync_with_stdio(false);
   int N;
   cin >> N;
   vector<int> dp(N + 1);
   for (int i = 0; i < N; ++i) {
      int x;
      cin >> x;
      dp[x] = dp[x - 1] + 1;
   }
   cout << N - *max_element(dp.begin(), dp.end()) << "\n";
   return 0;
}


Measured memory_bytes: 1024
n = int(input())
lst = list(map(int,input().split()))
cnt = 0

for i in range(n-2):
  if lst[i] < lst[i+1] < lst[i+2]  or \
     lst[i] > lst[i+1] > lst[i+2]:
    cnt += 1
    
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int a, b ,c ,d; cin >> a >> b >> c >> d;
  
  cout << max(max(max(a*c,a*d),b*c),b*d) << endl;
    

}


Measured memory_bytes: 3632
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

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

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

    // input
    ll A, B, C;
    cin >> A >> B >> C;
    
    if(A+B>=C){
        p(C+B);
    }else{
        p(A+2*B+1);
    }

    return 0;
}

Measured memory_bytes: 256
def main():
    a, b, c, x, y = (int(i) for i in input().split())
    ans = a*x + b*y
    cur = 2*c*min(x, y) + (a*(x-y) if x > y else b*(y-x))
    ans = min(ans, cur)
    cur = 2*c*max(x, y)
    ans = min(ans, cur)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define pb push_back
#define pf push_fron
#define INF 1000000000
typedef long long ll;


int main() {
	/*cin.tie(0);
	ios::sync_with_stdio(false);*/
	
	ll n, k, cnt = 0;
	cin >> n >> k;
	if (k == 0) {
		cout << n * n << endl;
		return 0;
	}

	for (ll i = 1; i <= n; i++) {
		cnt += ((n+1) / i)*(i - min(k, i)) + (n+1) % i - min(k, (n+1)%i);
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
fn main() {
    let mut v: Vec<f64> = vec![0.0; 5];
    for i in 0..5 {
        let x = read::<f64>();
        v[i] = x;
    }

    let mut mi = usize::max_value();
    for i in 0..5 {
        let mut sum = 0;
        for j in 0..5 {
            if i == j {
                sum += v[j] as usize
            } else {
                let tmp = v[j] / 10.0;
                sum += (tmp.ceil() * 10.0) as usize;
            }
        }
        if mi > sum {
            mi = sum;
        }
    }
    println!("{}", mi);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {

	ll a, b, k; cin >> a >> b >> k;

	ll n = max(a, b);
	ll i = 1;
	ll order = 0;
	vector<ll> p;
	
	for (ll i = 1; i <= n; i++) {	
		if (a % i == 0 && b % i == 0) {
			order++;
			p.emplace_back(i);
		}	
	}

	sort(p.begin(), p.end(), greater<ll>());

	cout << p[k - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long int max(long long int a,long long int b){
  if(a>b)
    return a;
  else
    return b;
}



void solve(){
  int n;
  cin>>n;
  int dig = n%10;
  if(dig==2||dig==4||dig==5||dig==7||dig==9){
    cout<<"hon";
  }

  else if(dig==0||dig==1||dig==6||dig==8){
    cout<<"pon";
  }

  else{
    cout<<"bon";
  }
}

int main(){
  solve();  
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(_v) for(auto _x:_v){cout<<_x<<" ";}cout<<endl
#define printVS(_vs) for(auto _x : _vs){cout << _x << endl;}
#define printVV(_vv) for(auto _v:_vv){for(auto _x:_v){cout<<_x<<" ";}cout<<endl;}
#define printP(_p) cout << _p.first << " " << _p.second << endl
#define printVP(_vp) for(auto _p : _vp) printP(_p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int n, k;
    cin >> n >> k;
    if (n < 3) {
        cout << 0 << endl;
        return 0;
    }
    n -= 2;

    vvi a(11, vi(7));
    int cnt = 0;
    rep(i, 11) {
        rep(j, 7) {
            a[i][j] = (7 * i + j + 1) % 11;
            if (i < 11 && j < 5 && (9 * a[i][j] + 72) % 11 == k) {
                cnt++;
            }
        }
    }

    cnt *= n / 11;

    rep(i, n % 11) {
        rep(j, 7) {
            if (i < 11 && j < 5 && (9 * a[i][j] + 72) % 11 == k) {
                cnt++;
            }
        }
    }
    cout << cnt << endl;

}


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

int main()
{
	ll a;
	string b;
	cin >> a >> b;

	ll c=0;
	c += a*(b[0]-'0')*100;
	
	c += a*(b[2]-'0')*10;
	c += a*(b[3]-'0');
	cout<<c/100<<endl;
}


Measured memory_bytes: 3628
import collections
n, k = map(int,input().split())
a = list(map(int, input().split()))
c = collections.Counter(a)
ans = 0
cnt = 0
if len(set(a)) <= k:
    print(ans)
    exit()
for  tuple in c.most_common():
    ans += tuple[1]
    cnt += 1
    if cnt == k:
      print(n-ans)
      exit()

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

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  if (c <= a + b) {
    cout << "No" << endl;
    return 0;
  }
  c -= a + b;
  a *= b;
  if (4*a < c*c) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
def cd(n):
  ls = []
  for i in range(1,int(n**(1/2))+1):
    if n % i == 0:
      ls += [i, n//i]
  return ls

ans = len(set(cd(N-1))) - 1
for j in set(cd(N)):
  a = N
  if not j == 1:
    while a % j == 0:
      a //= j    
    if a % j == 1:
      ans += 1
print(ans)

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

int main() {
	int a, b;
	cin >> a >> b;
	int c[100][100], d[100];
	for (int i = 0; i < a; i++) {
		for (int j = 0; j < b; j++) {
			cin >> c[i][j];
		}
	}

	for (int k = 0; k < b; k++) {
		cin >> d[k];
	}

	for (int l = 0; l < a; l++) {
		int e = 0;
		for (int m = 0; m < b; m++) {
			e += c[l][m] * d[m];
		}
		cout << e << endl;
	}
	return 0;
}


Measured memory_bytes: 3128
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;
int main() {
    int n;
    while(cin >> n){
    int a=0;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            for (int k=0; k<10; k++) {
                for (int l=0; l<10; l++) {
                    if (i+j+k+l==n) {
                        a++;
                    }
                }
            }
        }
    }
        cout<< a<< endl;
    }
}



Measured memory_bytes: 3044
/**
 *      ABC 78 C
 *      author  : kyomukyomupurin
 *      created : 2018-09-03 22:42:06
**/

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, M; cin >> N >> M;
    cout << pow(2, M) * ((N - M) * 100 + M * 1900) << endl;

    return 0;
}

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

typedef long long ll;
typedef vector<ll> v1;

typedef vector<vector<ll>> graph;

const ll INF = 1ll << 50;
const ll mod = 1000000007;

ll n,l;
string s[101];

int main(){
    cin >> n >> l;
    for(ll i = 0;i < n;i++) cin >> s[i];
    sort(s,s+n);
    for(ll i = 0;i < n;i++){
        cout << s[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define pb push_back
#define F first
#define S second

using namespace std;
using namespace __gnu_pbds;

const int N = 200005;
const int LIM = 1e9;
const ll INFLL = 1000000000000000000LL;

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int Q; cin >> Q;
    multiset<ll> data;
    bool start = false;
    int index = 0;
    int count = 0;
    ll ans = 0;
    auto it = data.begin();
    while(Q--) {
        int qType; cin >> qType;
        if (qType == 2) {
            cout << *it << " ";
            cout << ans << endl;
        } else {
            ll A, B; cin >> A >> B;

            if (start == false) {
                ans += B;
                data.insert(A); it = data.begin();
                start = true;
                count = 1;
            } else {
                ans += B;
                data.insert(A);
                if (A < *it) index++;
                count++;
                ans += abs(A - *it);
                int goal = count / 2; if (count % 2 == 0) goal--;
                if (index < goal) {
                    ll old = *it; it++;
                    ll newVal = *it;
                    ans += (index+1) * (newVal - old);
                    ans -= (count-index-1) * (newVal - old);
                    index++;
                } else if (index > goal) {
                    ll old = *it; it--;
                    ll newVal = *it;
                    index--;
                    ans -= (index+1) * (newVal - old);
                    ans += (count-index-1) * (newVal - old);
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 9600
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int> > edges(n);
    vector<int> cnt(n);
    for(int i=0; i<m; ++i){
        int x, y;
        cin >> x >> y;
        -- x;
        -- y;
        edges[x].push_back(y);
        ++ cnt[y];
    }

    queue<int> q;
    for(int i=0; i<n; ++i){
        if(cnt[i] == 0)
            q.push(i);
    }

    int ans = -1;
    while(!q.empty()){
        ++ ans;
        int x = q.size();
        while(--x >= 0){
            int curr = q.front();
            q.pop();
            for(int next : edges[curr]){
                if(--cnt[next] == 0)
                    q.push(next);
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6144
//s.empty() //emptyなら1を出力 入っていれば0を出力
/*//ABC018-B 部分的にreverseをかける解法
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  rep(i,n) cin>>a.at(i)>>b.at(i);
  rep(i,n)a.at(i)--;
  rep(i,n)b.at(i)--;
  string t;
  rep(i,n){
    t = s;
    for(int k=0;k<=b.at(i)-a.at(i);k++){
      t.at(a.at(i)+k) = s.at(b.at(i)-k);
    }
    s = t;
  }
  cout << s << endl;
}
*///ABC018-B
//  string s;
//  cin >> s;
//  cout << s.at(0) <<endl;
//  cout << s.at(0)-'0' <<endl;
//  Aが16？
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int kaijou(int n){
  int kaijou_sum = 1;
  if(n!=0){
    for(int i=1;i<=n;i++){
      kaijou_sum *= i;
    }
    return kaijou_sum;
  }
  else return 1;
}

int main() {
  int n;
  cin >> n;
  vector<double> x(n), y(n);
  rep(i,n)cin >> x.at(i) >> y.at(i);
  vector<int>a(n);
  rep(i,n) a.at(i)=i+1;
  double sum = 0;
  double kai = kaijou(n);
  map<vector<int>,int>mp;
  do{
    for(int i=0;i<n-1;i++){
      double xsa = x.at(a.at(i)-1) - x.at(a.at(i+1)-1);
      double ysa = y.at(a.at(i)-1) - y.at(a.at(i+1)-1);
      double distance = pow((pow(xsa,2)+pow(ysa,2)),0.5);
      sum += distance;
    }
  }
  while(next_permutation(a.begin(),a.end()));
  
  cout << fixed << setprecision(6) << sum/kai << endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<tuple<long long,long long,long long>> CAB(N);
  for(int i=0;i<N;i++){
    int a,b;
    cin >> a >> b;
    CAB.at(i)=make_tuple(a+b,a,b);
  }

  sort(CAB.begin(),CAB.end());
  reverse(CAB.begin(),CAB.end());
  long long ans=0;
  for(int i=0;i<N;i++){
    int c,a,b;
    tie(c,a,b)=CAB.at(i);
    if(i%2==0)  ans+=a;
    else  ans-=b;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define x3 dflgkg
#define y1 dskgj
#define y2 dskfj
#define y3 dfhgdh
#define SQ 320
#define PI 3.14159265359
#define MOD 998244353
typedef long long ll;
using namespace std;
ll n,i,j,k,x,y,z,m,q,h,r,timer,mx,l, cnt,s,col;
pii a[300500];
multiset<pii> f;
set<pii> fi,se;
ll Abs(ll x) {
    return x>0?x:-x;
}
int main() {
    //freopen("input.txt","r",stdin);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x >> y;
        a[i] = mp(x,y);
        f.insert(mp(x,y));
        fi.insert(mp(x,i));
        se.insert(mp(y,i));
    }
    x = 0;
    ll ans = 0;
    i = 0;
    while (!f.empty()) {
        i++;
        auto itr1 = fi.end();
        itr1--;
        auto itr2 = se.begin();
        ll max1 = 0;
        if ((*itr1).X-x > x-(*itr2).X || i == 1) {
            ll val = (*itr1).X-x;
            ans += max(0LL, val);
            if (val > 0)
                x = (*itr1).X;
            ll pos = (*itr1).Y;
            fi.erase(itr1);
            auto itr = f.find(a[pos]);
            f.erase(itr);
            se.erase(se.find(mp(a[pos].Y, pos)));
        } else {
            ll val = x-(*itr2).X;
            ans += max(0LL, val);
            if (val > 0)
                x = (*itr2).X;
            ll pos = (*itr2).Y;
            se.erase(itr2);
            auto itr = f.find(a[pos]);
            f.erase(itr);
            fi.erase(fi.find(mp(a[pos].X, pos)));
        }
    }
    ans += Abs(x);
    for (int i = 0; i < n; i++) {
        x = a[i].X;
        y = a[i].Y;
        f.insert(mp(x,y));
        fi.insert(mp(x,i));
        se.insert(mp(y,i));
    }

    x = 0;
    ll ans1 = 0;
    i = 0;
    while (!f.empty()) {
        i++;
        auto itr1 = fi.end();
        itr1--;
        auto itr2 = se.begin();
        ll max1 = 0;
        if ((*itr1).X-x > x-(*itr2).X && i != 1) {
            ll val = (*itr1).X-x;
            ans1 += max(0LL, val);
            if (val > 0)
                x = (*itr1).X;
            ll pos = (*itr1).Y;
            fi.erase(itr1);
            auto itr = f.find(a[pos]);
            f.erase(itr);
            se.erase(se.find(mp(a[pos].Y, pos)));
        } else {
            ll val = x-(*itr2).X;
            ans1 += max(0LL, val);
            if (val > 0)
                x = (*itr2).X;
            ll pos = (*itr2).Y;
            se.erase(itr2);
            auto itr = f.find(a[pos]);
            f.erase(itr);
            fi.erase(fi.find(mp(a[pos].X, pos)));
        }
    }
    ans1 += Abs(x);
    cout << max(ans, ans1) << endl;
    return 0;
}


Measured memory_bytes: 20608
using System;
using System.Linq;
using System.Collections.Generic;

public static class P {
    public static void Main() {
        String s=Console.ReadLine();
        int n=s.Length;
        char prv='$';
        int counter=0;
        int ans=0;
        for(int i=0;i<n;i++){
            if(s[i]!='A'&&s[i]!='C'&&s[i]!='T'&&s[i]!='G'){
                ans=Math.Max(ans,counter);
                counter=0;
            }else{
                counter++;
            }
            prv=s[i];
        }
        ans=Math.Max(ans,counter);
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int a,b,k;
  cin >> k >> a >> b;
  exrep(i,a,b){
    if(i%k==0){
      cout << "OK"<< endl;
      return 0;
    }
  }
  cout << "NG"<< endl;
  return 0;     
}


Measured memory_bytes: 3648
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();
        char[] postcode = sc.next().toCharArray();
        for (int i = 0; i < postcode.length; i++) {
            if(i == a && !String.valueOf(postcode[i]).equals("-")) {
                System.out.println("No");
                System.exit(0);
            }
            if(i != a && 0 > Character.getNumericValue(postcode[i]) || Character.getNumericValue(postcode[i]) > 9) {
                System.out.println("No");
                System.exit(0);
            }
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 21972
#include<stdio.h>
int main()
{
    long long int n,k; //n是总长，k是制约数目
    long long int r,s,p; //各自得分点
    long long int ans=0;
    char t[200000],ne[200000];
    scanf("%lld %lld",&n,&k);
    scanf("%lld %lld %lld",&r,&s,&p);
    scanf("%s",t);
    strcpy(ne,t);
    //printf("%s\n",ne);
    for(long long int i =0;i<n;i++)
    {
        if(ne[i]=='r')
            ne[i]='p';
        else if(ne[i]=='s')
            ne[i]='r';
        else
            ne[i]='s';
    }
    //printf("%s\n",ne);
    for(long long int i =k;i<n;i++)
    {
        if(ne[i]==ne[i-k])
        {
            if((i+k)<n)
        {
            if(ne[i]=='r')
            {
                if(ne[i+k]=='s')
                    ne[i]='p';
                else if(ne[i+k]=='p')
                    ne[i]='s';
                else
                    ne[i]='s';
            }
            else if(ne[i]=='s')
            {
                if(ne[i+k]=='r')
                    ne[i]='p';
                else if(ne[i+k]=='p')
                    ne[i]='r';
                else
                    ne[i]='r';
            }
            else if(ne[i]=='p')
            {
                if(ne[i+k]=='r')
                    ne[i]='s';
                else if(ne[i+k]=='s')
                    ne[i]='r';
                else
                    ne[i]='r';
            }
        }
            else
            {
                if(ne[i]=='r')
                {
                        ne[i]='s';
                }
                else if(ne[i]=='s')
                {
                        ne[i]='r';
                }
                else if(ne[i]=='p')
                {
                        ne[i]='r';
                }
            }
            
        }
    }
   //printf("%s\n",ne);
    for(long long int i =0;i<n;i++)
    {
        if(ne[i]=='r'&&t[i]=='s')
            ans+=r;
        else if(ne[i]=='s'&&t[i]=='p')
            ans+=s;
        else if(ne[i]=='p'&&t[i]=='r')
            ans+=p;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


int main(int argc, const char * argv[]) {
  int a, b; cin >> a >> b;
  int ans, cnt;
  ans = 0;
  cnt = 1;
  while(true){
    if (cnt >= b) break;
    cnt += a-1;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/* Author : Pranav Deshmukh
            PICT,Pune
   Purpose: Practice Atcoder
*/

#include<bits/stdc++.h>
using namespace std;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define int             long long
#define dip(type,var)   type var; cin>>var;
#define dipi(x)			int x; cin>>x;
#define w(x)            int x; cin>>x; while(x--)
#define mka(arr,n,type) type *arr=new type[n];
#define fo(i,n)			for(int i=0;i<n;i++)
#define mod             pow(10,9)+7
#define inf             1e18
#define pi 				3.141592653589793238
#define fo(i,n)        for(int i=0;i<n;i++)
#define endl			"\n"
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mimp             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >

void c_p_c()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main() {
	c_p_c();
	dipi(n);
	int ans = 0;
	if (n >= 500) {
		ans += (n / 500) * 1000;
		n = n % 500;
	}
	ans += (n / 5) * 5;
	cout << ans << endl;
}

Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <unordered_map>

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

using namespace std;

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



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n, k;
	cin >> n >> k;
	int x = 1, y = 0, sum = 0;
	while(1){
		if(sum + x > n) break;
		if(sum > k * x){
			x = sum / k;
			if(sum % k > 0) x++;
		}
		else sum += x, y++;
	}
	cout << y << endl;
	return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fr(i,n) for(i=0;i<n;i++)
#define rep(i,st,en) for(i=st;i<=en;i++)
#define repv(i,en,st) for(i=en;i>=st;i--)
#define fout cout<<fixed<<setprecision(7)
#define bi(n) __builtin_popcount(n)
#define bil(n) __builtin_popcountll(n)


typedef long long ll;
typedef pair<int,int> pii;
const int N = 3010;
ll mod = 1e9+7;
ll fmod(ll b,ll exp){
    ll res =1;
    while(exp){if(exp&1ll)res=(res*b)%mod;
    b =(b*b)%mod;exp/=2ll;
    }
    return res;
}

string s,t;
string v;
int L[N][N];
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n,i,j,m;
    cin>>s;
    cin>>t;
     n = s.length();
     m = t.length();
    rep(i,0,n){
        rep(j,0,m)
        {
            if(!i || !j)L[i][j]=0;
            else if ( s[i-1] == t[j-1])L[i][j]= 1+L[i-1][j-1];
            else L[i][j]= max(L[i-1][j],L[i][j-1]);
        }
    }
    int ans = L[n][m];
    for(int i=n-1;i>=0;i--)
    {
        if(!ans)break;
        for(int j=m-1;j>=0;j--)
        {
            if(!ans)break;
            if(s[i]==t[j] && L[i+1][j+1]== ans)
            {
                v.pb(s[i]);
                ans--;
                break;
            }
        }
    }
    reverse(v.begin(),v.end());
    cout<<v<<"\n";
    
    return 0;
}


Measured memory_bytes: 35584
#include <iostream>
#include <cstdlib>
using namespace std;
int bio[1000000];
int main()
{
    int b;
    long long r = 1;
    cin >> b;
    int n[b];
    for(int i = 0; i < b; i++)
    {
        cin >> n[i];
        if(n[i] == 0)
        {
            if(b % 2 == 0)
            {
                r = 0;
            }
            else
            {
                 if(bio[0] == 1)
                 {
                     r = 0;
                 }
            }
            bio[0]++;
        }
        else
        {
            if(bio[n[i]] == 2)
            {
                r = 0;
            }
            else if(bio[n[i]] == 1)
            {
                r *= 2;
            }
            bio[n[i]]++;
        }
        r %= 1000000007;
    }
    for(int i = 0; i < b; i++)
    {
        if(n[i] != 0)
        {
            if(bio[n[i]] == 1)
            {
                r = 0;
            }
        }
    }
    cout << r << endl;
}


Measured memory_bytes: 1024
<?php
$line = readline();
readline_add_history($line);
$inputs = explode(" ", $line);
$a = intval($inputs[0]);
$b = intval($inputs[1]);
$d = floor($a / $b);
$r = $a % $b;
$f = $a / $b;

printf("%d %d %f\n", $d, $r, $f);

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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint po(mint a,int b){
    mint ans=1;
    rep(i,b){
        ans*=a;
    }
    return ans;
}

int main(){
int n; cin >> n;
mint ad=0; int jou=0;
vector<vector<ll>> a(n,vector<ll>(61));
vector<ll> len(n);
  rep(i,n){
    ll p; ll lee=0;
    cin >> p;
    rep(g,61){
    if(p%2) a[i][g]=1;
    else a[i][g]=0;
    p/=2;
    }
  }

vector<mint> zero(61,0); vector<mint> one(61,0);
rep(j,61){
    rep(i,n){
        if(a[i][j]==1) one[j]+=1;
        else zero[j]+=1;
    }
}

int y=0;
/*rep(i,n){
        while(ju){
     	   if(a[i][y]==0){
            ad+=po(2,y)*one[y];
            }
            else{
            ad+=po(2,y)*zero[y];
            }
        }
        y++;
        ju--;
        }
      y=0;
    }
}*/
rep(i,61){
    ad+=zero[i]*one[i]*po(2,i);
}
cout << ad.x << endl;
return 0;
}


Measured memory_bytes: 156928
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	 vector<long long int> a(3);
  	 cin>>a[0]>>a[1]>>a[2];
  	 vector<long long int> b(3);
  	 long long int count=0;
  	 if(a[0]%2==1||a[1]%2==1||a[2]%2==1){cout<<0<<endl;return 0;} 
  	 if(a[0]==a[1] && a[1]==a[2]){cout<<-1<<endl;return 0;} 
  	 while(true){
       if(a[0]%2==1||a[1]%2==1||a[2]%2==1){cout<<count<<endl;return 0;} 
       count++;
       b[0]=a[0];b[1]=a[1];b[2]=a[2];
       a[0]=(b[1]+b[2])/2;a[1]=(b[0]+b[2])/2;a[2]=(b[1]+b[0])/2;
     }
     
}

Measured memory_bytes: 256
function Main(input) {
    var len = input.split("\n")[0].length;
    var inp = input.split("\n")[0];
    if (len === 1) {
        console.log(inp);
        return;
    }

    var ans = 0;

    for (var i = 0; i <= Math.pow(2, len - 1) - 1; i++) {
        var tmp = '0000000000' + i.toString(2);
        var binary = tmp.substring(tmp.length - len + 1, tmp.length);

        var prev = 0;
        var list = [];
        for (var j = 0; j < binary.length; j++) {
            if (binary.charAt(j) === '0') {
                continue;
            }
            list.push(Number(inp.substring(prev, j + 1)));
            prev = j + 1
        }
        list.push(Number(inp.substring(prev, binary.length + 1)));
        var plus = 0;
        list.forEach(e => plus += e);
        ans += plus;

    }
    console.log(ans)

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require("fs").readFileSync("./input", "utf8"));

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

int main() {
  double n, t, a;
  cin >> n >> t >> a;
  vector<double>v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    v[i] = t - v[i] * 0.006;
  }
  double ans = 10000000;
  int place;
  for (int i = 0; i < n; i++) {
    if (ans > min(ans, abs(a - v[i]))) {
      place = i + 1;
    }
    ans = min(ans, abs(a - v[i]));
  }
  cout << place << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define mod_ceil(a, b) (a % b) ? a / b + 1 : a / b
using namespace std;

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

    ll h, w, K, ans = 0;
    cin >> h >> w >> K;
    char A[6][6];
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> A[i][j];
        }
    }

    for (int i = 0; i < 1 << h; i++)
    {
        for (int j = 0; j < 1 << w; j++)
        {
            vector<int> c_r(h, 0);
            vector<int> c_c(w, 0);
            for (int k = 0; k < h; k++)
            {
                if (i & (1 << k))
                {
                    c_r[k] = 1;
                }
            }
            for (int k = 0; k < w; k++)
            {
                if (j & (1 << k))
                {
                    c_c[k] = 1;
                }
            }
            ll count = 0;
            for (int row = 0; row < h; row++)
            {
                for (int col = 0; col < w; col++)
                {
                    if (!c_c[col] and !c_r[row])
                    {
                        if (A[row][col] == '#')
                        {
                            count++;
                        }
                    }
                }
            }
            if (count == K)
                ans++;
        }
    }
    cout << ans << endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> P(N);
  vector<int> Q(N);
  vector<int> X(N);
  rep(i, N) cin >> P[i];
  rep(i, N) cin >> Q[i];
  rep(i, N) X[i] = i + 1;

  map<vector<int>, int> D;
  int cnt = 1;
  do{
    D[X] = cnt;
    cnt++;
  }
  while (next_permutation(X.begin(), X.end()));
  cout << abs(D[P] - D[Q]) << endl;
}


Measured memory_bytes: 8672
#include<bits/stdc++.h>
#define ll               long long
#define mod              1000000007
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb                push_back
#define all(v)             v.begin(),v.end()
#define inp(V,n)      for(int i=0;i<n;i++){cin >> V[i];}
#define oup(V,n)     {for(int i=0;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
      return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
{
   return (a*b)/gcd(a, b);
}
bool sortByVal(const pair<ll,ll> &a,
               const pair<ll,ll> &b)
{
    return (a.second > b.second);
}
ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}
int main()
{
     fast;
     ll m,x,y,z,i,j,e=0,f=0,g=0,h=0,n,sum=0;
     double c=0,d=0;
     cin>>n>>m;
     vector<ll> a(n);
     for(i=0;i<n;i++){

        cin>>a[i];
        sum+=a[i];
     }
     d=4*m;
     c=sum/(d);
     for(i=0;i<n;i++)
     {
         if(a[i]>=c)
         {
             e++;
         }
     }
     if(e>=m)
     {
         cout<<"Yes"<<endl;
     }
     else
        cout<<"No"<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	long long int N,ans=0;
	cin>>N;
	ans+=N/11*2;
	N=N%11;
	if(N>6)ans+=2;
	else if(N!=0)ans+=1;
	cout<<ans;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
a,c = [], []
for _ in range(M):
	ta, _ = map(int, input().split())
	tc = 0
	tmp = list(map(int, input().split()))
	for t in tmp:
		tc += 1 << (t-1)

	a.append(ta)
	c.append(tc)

inf = float('inf')

DP = [[inf] * (1 << N) for _ in range(M)]
for i in range(M):
	DP[i][0] = 0
DP[0][c[0]] = a[0]

for i in range(1, M):
	for s in range(1 << N):
		DP[i][s] = min(DP[i][s], DP[i-1][s])
		DP[i][s | c[i]] = min(DP[i][s|c[i]], DP[i-1][s|c[i]], DP[i-1][s]+a[i])

ans = DP[M-1][(1 << N)-1]
if ans == inf:
	print(-1)
else:
	print(ans)

Measured memory_bytes: 192132
#include<iostream>
#include<algorithm>
#include<cstdio>

using namespace std;

typedef long long ll;

const int mod = 1e9 + 7;

ll quick_pow(ll base, ll index, ll p) {
	ll res = 1;
	while (index) {
		if (index & 1)res = res * base % p;
		base = base * base % p;
		index >>= 1;
	}
	return res;
}

int n;

int main()
{
	cin >> n;
	ll res = quick_pow(10, n, mod);
	res -= 2 * quick_pow(9, n, mod);
	res += quick_pow(8, n, mod);
	res %= mod;
	if (res < 0)res += mod;
	cout << res << endl;
	return 0;
}

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

#define op() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define lo(i, a, b) for(int i=a; i<b; i++)
#define nl cout<<"\n";
#define sp cout<<" ";

int main()
{
    op();
    int a,b,c,r;
    cin>>a>>b>>c;
    if(a-b>0)
    {
        if(a-b>=c)
        {
            r=0;
        }
        else
        {
            r=c-(a-b);
        }
    }
    else
        r=c;
    cout<<r;
    nl;
    return 0;
}


Measured memory_bytes: 256