akhauriyash/Code-Regression huggingface dataset:
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
typedef long long ll;
using namespace std;

int r, g, b;
const int INF = 10e8;
void CardEater(){

	int n;
	cin >> n;
	int rem = 0;
	map<int, int> m;
	int sum = 0;
	for (size_t i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		rem += (++m[a] > 1 ? 1:0);
		sum += (m[a] == 1 ? 1 : 0);
	}
	sum -= (rem % 2 != 0) ? 1 : 0;
	cout << sum << endl;
}

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



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

using namespace std;

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


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

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

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

ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1LL;
	while (n > 0) {
		if (n & 1) res = res * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}

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

	ll n;
	cin >> n;
	Array c(n, 0);
	REP(i, n) cin >> c[i];
	sort(all(c),greater<ll>());

	ll ans = 0;
	REP(i, n) {
		(ans += c[i] * (i + 2))%=MOD;
		//cout << ans << endl;
	}

	(ans *= mod_pow(4, n - 1, MOD))%=MOD;

	cout << ans << endl;

	return 0;
}

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

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

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

    int n;
    cin >> n;
    vector<int> a, b;
    for (int i = 0; i < n; ++i) {
        int tmp_a;
        cin >> tmp_a;
        a.push_back(tmp_a);
    }
    for (int i = 0; i < n; ++i) {
        int tmp_b;
        cin >> tmp_b;
        b.push_back(tmp_b);
    }

    ll sum = 0;
    ll neg = 0;
    vector<int> pos;
    int count = 0;
    for (int i = 0; i < n; ++i) {
        int diff = a[i] - b[i];
        sum += (ll) diff;
        if (diff >= 0) {
            pos.push_back(diff);
        } else {
            neg += (ll)diff;
            count++;
        }
    }

    if (sum < 0) {
        cout << -1 << '\n';
        return 0;
    }

    sort(pos.rbegin(), pos.rend());

    while (neg < 0 && !pos.empty()) {
        neg += (ll)pos.front();
        pos.erase(pos.begin());
        count++;
    }

    cout << count << '\n';

    return 0;
}


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

int main(){
  int k; cin >> k;
  int d[k]; rep(i, k) d[i] = INT_MAX;
  priority_queue<P, vector<P>, greater<P>> que;
  que.push(P(0, 1));
  d[1] = 0;
  while(!que.empty()){
    P p = que.top(); que.pop();
    if(p.first > d[p.second]) continue;
    int n = (p.second+1) % k;
    if(d[n] > d[p.second] + 1){
      d[n] = d[p.second] + 1;
      que.push(P(d[n], n));
    }
    int m = p.second * 10 % k;
    if(d[m] > d[p.second]){
      d[m] = d[p.second];
      que.push(P(d[m], m));
    }
  }
  cout << d[0] + 1 << endl;
}

Measured memory_bytes: 1404
#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 n;
    cin >> n;
    int hon[5] = {2, 4, 5, 7, 9};
    int pon[4] = {0, 1, 6, 8};
    int bon[1] = {3};
    int ishon = find(hon, hon + 5, n % 10) - hon;
    int ispon = find(pon, pon + 4, n % 10) - pon;
    int isbon = find(bon, bon + 1, n % 10) - bon;
    if (ishon < 5)
    {
        cout << "hon" << endl;
    }
    if (ispon < 4)
    {
        cout << "pon" << endl;
    }
    if (isbon < 1)
    {
        cout << "bon" << endl;
    }
}

Measured memory_bytes: 3572
#include <iostream>
#include <cstring>
#include <cassert>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <climits>
#include <cassert>
#include <ctime>
#include <bitset>
using namespace std;

int a, b,c;

int main() {
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  
  cin >> a >> b >> c;
  if (a + b >= c) {
    cout << "Yes";
  }else {
    cout << "No";
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[5];
    int i;
    for(i=1;i<=5;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll x,y,z;
  cin >> x >> y >> z;
  cout << (x-z)/(y+z) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int ar[100005][3] , dp[100005][3] , n ;
int vacation(int d , int c)
{
    if(d > n) return 0 ;
    if(c != -1 && dp[d][c] != -1) return dp[d][c] ;
    int k = 0 , p = 0 , q = 0 , r = 0 ;
    for(int i = 0 ; i < 3 ; i++)
    {
        if(i != c) p = ar[d][i] + vacation(d+1,i) ;
        k = max(p , k) ;
    }
    return dp[d][c] = k ;
}
int main()
{
    memset(dp,-1,sizeof(dp)) ;
    cin>>n ;
    for(int i = 1 ; i <= n ; i++)
    {
        for(int j = 0 ; j < 3 ; j++) cin>>ar[i][j] ;
    }
    int l = vacation(1,-1) ;
    cout<<l<<endl ;
}


Measured memory_bytes: 10368
Module Program
  Sub Main
    Dim s = GetInts()
    Dim a=s(0),b=s(1),c=s(2),d=s(3)
    Dim ans=If(d>=Math.Abs(c-a)Or(d>=Math.Abs(a-b)And d>=Math.Abs(b-c)),"Yes","No")
    Console.WriteLine(ans)
  End Sub
  
  '/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  Function Gets() As String()
    Gets = Console.ReadLine().Split(" "c)
  End Function
  Function GetInts() As Integer()
    Dim s = Gets(), r(UBound(s)) As Integer
    For i As Integer=0 To UBound(s): r(i)=s(i): Next i
    GetInts = r
  End Function
End Module

Measured memory_bytes: 20816
#include <iostream>
#include <string>
#include <vector>
#include <math.h> // double fmod(double x, double y);
#define rep(i, n) for(int i = 0; i < (int)n; i++)

 using namespace std;
 int main()
 {

   long n;
   cin >> n;
   int city[n+1];
   int yusya[n];
   rep(i,n+1){cin >> city[i];}
   rep(i,n){cin >> yusya[i];}



   long enemy = 0;

   rep(i,n)
   {
     if(city[i] >= yusya[i])
     {
       enemy += yusya[i];
     }
     if(city[i] < yusya[i])
     {
       int temp;
       enemy += city[i];
       temp = yusya[i] - city[i];
       if(temp <= city[i+1])
       {
         city[i+1] -= temp;
         enemy += temp;
       }
       else if(temp > city[i+1])
       {
         enemy += city[i+1];
         city[i+1] = 0;
       }
     }
   }

   cout << enemy << endl;
  }




Measured memory_bytes: 1024
#include <stdio.h>
void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}
int main(void){
    int N,i,num[100];
    int alice=0,bob=0;
    scanf("%d",&N);
    for(i=0;i<N;i++)scanf("%d",&num[i]);
    
    quick_sort(num,0,N-1);
    //for(i=0;i<N;i++)printf("%d ",num[i]);
    for(i=0;i<N;i++){
         //printf("%d ",num[N-i]);
        if(i%2==0) alice+=num[N-i-1];
        else bob += num[N-i-1];
    }
    
    printf("%d",alice-bob);
    
    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
	ll r=1;
	a=a%m;
	while(b>0)
	{
	if(b&1)
		r=(r*a)%m;
	b=b/2;
	a=(a*a)%m;
	}
	return r%m;
}

int main() {
   ll n; cin>>n;
   vi arr(n);
   rep(i,0,n)cin>>arr[i];
   ll ans = 0,p = 1;
   rep(i,0,n)
   {
       if(arr[i]==p)
       {
           p++;
           ans++;
       }
   }
   if(ans==0)cout<<-1<<endl;
   else cout<<n-ans<<endl;
   return 0;
}
/*

*/


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const int mod = 1000000007;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> imos(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    imos[a]++;
    imos[b]++;
  }
  int cur = 0;
  bool ans = true;
  rep(i, n) {
    if (cur % 2) ans = false;
    cur += imos[i];
  }
  if (ans) cout << "YES" << endl;
  else cout << "NO" << endl;

}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,res=0;
    string s;
    cin>>n>>s;
    vector<vector<ll>> v(10);
    for(ll i=0;i<n;i++)
    v[ll(s[i]-'0')].push_back(i);
    for(ll a=0;a<=9;a++)
    for(ll b=0;b<=9;b++)
    for(ll c=0;c<=9;c++){
        ll x=(-1);
        auto it=upper_bound(v[a].begin(),v[a].end(),x);
        if(it==v[a].end())
        continue;
        x=(*it);
        it=upper_bound(v[b].begin(),v[b].end(),x);
        if(it==v[b].end())
        continue;
        x=(*it);
        it=upper_bound(v[c].begin(),v[c].end(),x);
        if(it==v[c].end())
        continue;
        res++;
    }
    cout<<res;
}


Measured memory_bytes: 768
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }
void rec(int s, int n, int f);


int ans[12][333];
void rec(int n, int s, int f)
{
    if(n == 11) return;
    ans[n][s]++;
    
    n++;
    rep(i, 10)
        if(!(f >> i & 1))
           rec(n, s + i * n, f | 1 << i);
}

int main()
{
    int n, s;
    rec(0, 0, 0);
    while(cin >> n >> s)
        cout << (s > 330 || n > 10 ? 0 : ans[n][s]) << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  int count = 0;
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N; i++) {
    if (((i+1) % 2 == 1) && (A.at(i) % 2 == 1)) {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(){

  int n, r, p, c, d[50], e[50];

  while(cin >> n >> r && n && r){
    for(int i=0; i<n; i++)
      d[i] = n - i;
      for(int i=0; i<r; i++){
        cin >> p >> c;
        for(int j=0; j<p-1; j++)
          e[j] = d[j];
          for(int j=0; j<c; j++)
          d[j] = d[j+p-1];
          for(int j=0; j<p-1; j++)
          d[j+c] = e[j];
      }
      cout << d[0] << endl;
  }
  return 0;
}

Measured memory_bytes: 3068
fun main() {
    val (a, b) = nextList()
    println(a.toLong().times(b.replace(".", "", true).toLong()).div(100))
}

// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)

// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }

// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

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

int main(){
  string s;
  cin>>s;
  int dp[200000][2]={0};
  dp[0][0]=1;
  if (s[0]==s[1]) dp[1][1]=1;
  for (int i(0);i<s.size();i++){
    if (s[i]!=s[i+1] && i <= s.size()-2) dp[i+1][0] = max(dp[i+1][0],dp[i][0]+1);
    dp[i+1][0] = max(dp[i+1][0],dp[i][1]+1);
    if (i == 0){
      dp[i+2][1] = max(dp[i+2][1],dp[i][0]+1);
      continue;
    }
    if (i <= s.size()-3&& s[i-1]+s[i] != s[i+1]+s[i+2]){
      dp[i+2][1] = max(dp[i+2][1],dp[i][1]+1);
    }
    dp[i+2][1] = max(dp[i+2][1],dp[i][0]+1);
  }
  cout << max(dp[s.size()-1][0],dp[s.size()-1][1]) << endl;
  return 0;
}


Measured memory_bytes: 2180
#include <iostream>
#include <algorithm>

using namespace std;



int main() {
	int n,a, b, c;
	cin >> n >> a >> b >> c;
	int tp[105] = {0};
	for (int i = 0; i < n; i++) {
		cin >> tp[i];
	}
	for (int i = 0; i < n -1; i++) {
		for (int j = n - 1; j > i; j--) {
			if (tp[j] > tp[j - 1]) {
				int swap = tp[j];
				tp[j] = tp[j - 1];
				tp[j - 1] = swap;
			}
		}
	}
	
	double spr = 0;
	for (int i = 0; i <= n; i++) {
		double dol = a + b*i;
		double cal = c;
		for (int j = 0; j < i; j++) {
			cal += tp[j];
		}
		double now = cal / dol;
		if (now > spr) {
			spr = now;
		}
	}
	int d = spr;
	cout << d << endl;
	return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b; cin >> a >> b;
	int c = b;
	int cnt = 0;
	while(c!=0){
		c = c/10;
		cnt++;
	}
	int aa = a;
	for(int i=1;i<=cnt;i++){
		aa *= 10;
	}
	for(int i=1;i<=320;i++){
		int x = i*i;
		if(aa+b==x){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

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

int main(){
	int h,w;
    cin >> h >> w;
	char c[51][51];
	int check[51][51];
	queue<pair<int,int>> que;
    int i,j;
    int ans=0;
    for(i=1;i<h+1;i++)for(j=1;j<w+1;j++){cin >> c[i][j]; check[i][j]=1e9; if(c[i][j]=='#')ans++;}
    for(i=1;i<h+1;i++)c[i][0]='#';
    for(j=1;j<w+1;j++)c[0][j]='#';
	check[1][1]=1;
    que.push(pair<int,int> (1,1));
	while(!que.empty()){
		int x = que.front().first;
		int y = que.front().second;
		int dx[4] = {1,-1,0,0};
		int dy[4] = {0,0,1,-1};
		que.pop();
		for(i=0;i<4;i++){
			if(c[x+dx[i]][y+dy[i]]=='.' && check[x+dx[i]][y+dy[i]]>check[x][y]+1){
				check[x+dx[i]][y+dy[i]]=check[x][y]+1;
				que.push(pair<int,int> (x+dx[i],y+dy[i]));
			}
		}
	}
    if(check[h][w]==1e9)cout << -1 << endl;
    else cout << h*w-check[h][w]-ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll dp[200001][2][100];
int main(){
    string s;
    ll d,x,mod=1e9+7;
    cin>>s>>d;
    dp[0][1][0]=1;
    rep(i,s.size())rep(j,2)rep(k,d){
        if(j==0) x=9;
        else x=s[i]-'0';
        rep(l,x+1) (dp[i+1][j&&l==x][(k+l)%d]+=dp[i][j][k])%=mod;
    }
    cout<<(dp[s.size()][0][0]+dp[s.size()][1][0]-1+mod)%mod<<"\n";
}

Measured memory_bytes: 16640
#include <iostream>
#include <string>
#include <vector>
std::string  S,T,U;
int A,B;
 
int main(void){
    std::cin >> S >> T;
    std::cin >> A >> B;
    std::cin >> U;
 
    if(S == U){
        A = A - 1;
    }
 
    if(T == U){
        B = B - 1;
    }
 
    std::cout << A << " " << B;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int i = 0; i <n; i++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;

using namespace std;
int main(){
    int d,n;cin>>n>>d;
    std::vector<vector<int>> a(n,std::vector<int>(d) );
     for (int i = 0; i < n; ++i) {
                for (int j = 0; j <d; ++j) {
                        std::cin >> a[i][j] ;
                }
        }
    int ans=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            double k=0;
            for(int l=0;l<d;l++){
                k+=(a[i][l]-a[j][l])*(a[i][l]-a[j][l]);
            }
            if(ceil(sqrt(k))==floor(sqrt(k)))ans++;
        }
        
    }
        std::cout << ans << std::endl;
}


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

using namespace std;

int main (void) {
    int N;
    cin >> N;
    vector<long long> A(N);
    for ( int i=0; i<N; i++ ) {
        cin >> A.at(i);
        if ( A.at(i) == 0 ) {
            cout << 0 << endl;
            return 0;
        }
    }

    long long ans = 1;
    double temp;
    for ( int i=0; i<N; i++ ) {
        temp = (double)ans * A.at(i);
        if ( temp > 1000000000000000000 ) {
            cout << "-1" << endl;
            return 0;
        }
        ans *= A.at(i);
        if ( ans > 1000000000000000000 ) {
            cout << "-1" << endl;
            return 0;
        }
    }

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


Measured memory_bytes: 4052
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <vector>

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

/**
 * Dijkstra's algorithm.
 * First, call add_edge() to add edges.
 * Second, call solve() to calculate the length of the shortest path from source to each vertex.
 * Header requirement: algorithm, queue, vector
 * Verified by AtCoder ARC026-C (http://arc026.contest.atcoder.jp/submissions/604231)
 */
 template<class Len = int>
class Dijkstra {
private:
  int n;
  std::vector<std::vector<std::pair<int, Len> > > edges;
public:
  /**
   * n: the number of vertices
   */
  Dijkstra(int n) : n(n), edges(n) {}
  /*
   * from: the source of edge to add
   * to: the target of edge to add
   * cost: the cost of edge to add
   */
  void add_edge(int from, int to, Len cost) {
    edges[from].push_back(std::pair<int, Len>(to, cost));
  }
  /*
   * This function returns an array consisting of the distances from vertex source.
   */
  std::vector<Len> solve(int source) {
    const Len inf = 1e16;
    typedef std::pair<Len, int> pi;
    std::vector<Len> d(n, inf);
    std::priority_queue<pi, std::vector<pi>, std::greater<pi> > que;
    que.push(pi(0, source));
    while (!que.empty()) {
      pi p = que.top(); que.pop();
      int idx = p.second;
      if (d[idx] <= p.first) {
	continue;
      }
      d[idx] = p.first;
      for(int j = 0; j < edges[idx].size(); ++j) {
	que.push(pi(p.first + edges[idx][j].second, edges[idx][j].first));
      }
    }
    return d;
  }
};


using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, s, t;
  cin >> n >> m >> s >> t;
  s--, t--;
  VI d(n);
  REP(i, 0, n) {
    cin >> d[i];
  }
  Dijkstra<ll> dijk(n);
  REP(i, 0, n - 1) {
    dijk.add_edge(i + 1, i, 0);
  }
  REP(inmulieribus, 0, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    dijk.add_edge(a, b, d[b]);
  }
  cout << dijk.solve(s)[t] << "\n";
}

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

int main() {
	int ten[5],goukei = 0;
	for(int i = 0; i < 5; i++){
		cin >> ten[i];
		if(ten[i] < 40){
			ten[i] = 40;
		}
		goukei = goukei + ten[i];
	}
	cout << goukei / 5 << endl;

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
 int SumOfDigits(int n){
    int sum = 0;
    while(n>0){
      sum += n%10;
      n/=10;}
    return sum;}
int main(){
  int n, a, b, sum =0, res = 0;cin>>n>>a>>b;  
  for(int i=0;i<=n;++i){int num = SumOfDigits(i);if(a<=num&&num<=b)res+=i;}
  cout<<res<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
    int MAX = 0;
    int c[3][3];
    for (int i=0; i<3; ++i) {
        for (int j=0; j<3; ++j) {
            cin>>c[i][j];
            MAX = max(c[i][j], MAX);
        }
    }
    MAX += 1;

    bool hit = false;

    for (int a1=0; a1<MAX; ++a1) {
        if (a1 > c[0][0] || a1 > c[0][1] || a1 > c[0][2]) {
            break;
        }
        for (int a2=0; a2<MAX; ++a2) {
            if (a2 > c[1][0] || a2 > c[1][1] || a2 > c[1][2]) {
                break;
            }
            for (int a3=0; a3<MAX; ++a3) {
                if (a3 > c[2][0] || a3 > c[2][1] || a3 > c[2][2]) {
                    break;
                }
                for (int b1=0; b1<MAX; ++b1) {
                    if (b1 > c[0][0] || b1 > c[1][0] || b1 > c[2][0]) {
                        break;
                    }
                    for (int b2=0; b2<MAX; ++b2) {
                        if (b2 > c[0][1] || b2 > c[1][1] || b2 > c[2][1]) {
                            break;
                        }
                        for (int b3=0; b3<MAX; ++b3) {
                            if (b3 > c[0][2] || b3 > c[1][2] || b3 > c[2][2]) {
                                break;
                            }
                            if (
                                c[0][0] == a1 + b1 &&
                                c[0][1] == a1 + b2 &&
                                c[0][2] == a1 + b3 &&
                                c[1][0] == a2 + b1 &&
                                c[1][1] == a2 + b2 &&
                                c[1][2] == a2 + b3 &&
                                c[2][0] == a3 + b1 &&
                                c[2][1] == a3 + b2 &&
                                c[2][2] == a3 + b3
                            ) {
                                hit = true;
                                goto LABEL;
                            }
                        }
                    }
                }
            }
        }
    }

    LABEL:
    if (hit) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 

int ds(int x){
    int ans = 0;
    while(x>=10){
        ans+=x%10;
        x/=10;
    }
    return ans+x;
}

int main(void){
    int n,a,b;
    cin>>n>>a>>b;
    int ans = 0;
    for(int i=1;i<=n;i++){
        int x = ds(i);
        if(a<=x){
            if(x<=b)ans+=i;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

int main() {
    int N, M;
    long long int x[1000];
    long long int y[1000];
    long long int z[1000];

    cin >> N >> M;
    for (int i = 0; i < N; ++i) {
       cin >> x[i] >> y[i] >> z[i];
    }

    long long int S[8];

    for (int i = 0; i < 8; ++i) {
        long long int A[1000];
        for (int k = 0; k < 1000; ++k) {
            A[k] = 0;
        }

        int xi, yi, zi;

        if(i<4){
           xi = 1;
        } else{
            xi = -1;
        }
        if((i%4)<2){
            yi = 1;
        } else{
            yi = -1;
        }
        if(i%2==0){
            zi = 1;
        } else{
            zi = -1;
        }

        for (int j = 0; j < N; ++j) {
            long long int score = x[j]  * xi + y[j] * yi + z[j] * zi;
            A[j] = score;
        }

        sort(A, A+N, greater<long long int>());

        S[i] =0;
        for (int j = 0; j < M; ++j) {
            S[i] += A[j];
        }
    }


    long long int highScore = 0;
    for (int l = 0; l < 8; ++l) {
        if(highScore < S[l]){
            highScore = S[l];
        }
    }
    cout << highScore << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll bin_pow(ll a,ll b,ll m)
{
    ll res=1;
    a%=m;
    while(b>0)
    {
        if(b&1)
            res=res*a%m;
        b>>=1;
        a=a*a%m;
    }
    return res;
}
bool miller_rabin(ll d,ll n)
{
    ll a=2+rand()%(n-4);
    ll x=bin_pow(a,d,n);
    if(x==1 || x==n-1)
        return true;
    while(d!=n-1)
    {
        x=(x*x)%n;
        d*=2;
        if(x==1)
            return false;
        if(x==n-1)
            return true;
    }
    return false;
}
bool prime(ll n,ll k)
{
    if(n==1 || n==4)
        return false;
    if(n<=3)
        return true;
    ll d=n-1;
    while(d%2==0)
        d/=2;
    for(int i=0; i<k; i++)
    {
        if(!miller_rabin(d,n))
            return false;
    }
    return true;
}
uint64_t negabinary(int64_t num) {
    const uint64_t mask = 0xAAAAAAAAAAAAAAAA;
    return (mask + num) ^ mask;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,mx=0;
    cin>>n>>m;
    vector<ll>v;
    for(ll i=1;i*i<=m;i++){
        if(m%i==0){
            v.push_back(i);
            if(i*i!=m)v.push_back(m/i);
        }
    }
    for(auto x: v){
        if(m/x>=n)mx=max(mx,x);
    }
    cout<<mx<<endl;
}


Measured memory_bytes: 3656
import java.util.*;

public class Main {

	static class Item implements Comparable<Item> {
		public int cost;
		public int id;

		public Item(int id, int cost) {
			this.id = id;
			this.cost = cost;
		}

		@Override
		public int compareTo(Item that) {
			return this.cost - that.cost;
		}
	}

	static void printArray(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i] + ", ");
		}
		System.out.println();
	}

	static void fill(int color, int[] C, int i, ArrayList<Item>[] edge) {
		C[i] = color;
		if (edge[i] != null) {
			for (Item item : edge[i]) {
				if (C[item.id] == 0) {
					fill(color, C, item.id, edge);
				}
			}
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		@SuppressWarnings("unchecked")
		ArrayList<Item>[] edge = new ArrayList[N + 1];
		for (int i = 0; i < M; i++) {
			int src = sc.nextInt();
			int dst = sc.nextInt();
			int cost = sc.nextInt() % 2 + 2;
			if (edge[src] == null) {
				edge[src] = new ArrayList<Item>();
			}
			edge[src].add(new Item(dst, cost));
			if (edge[dst] == null) {
				edge[dst] = new ArrayList<Item>();
			}
			edge[dst].add(new Item(src, cost));
		}

		int color = 0;
		int[] C = new int[N + 1];
		for (int i = 1; i <= N; i++) {
			if (C[i] == 0) {
				fill(++color, C, i, edge);
			}
		}
		System.out.println(color);
	}
}


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

int main()
{
    int S, A, B;

    cin >> S;

    A = S % 100;
    B = S / 100;

    if( ( A > 0 && A <= 12 ) && ( B > 0 && B <= 12 ) )
        cout << "AMBIGUOUS" << endl;
    else if( A > 0 && A <= 12 )
        cout << "YYMM" << endl;
    else if( B > 0 && B <= 12 )
        cout << "MMYY" << endl;
    else
        cout << "NA" << endl;

    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define sl(x) scanf("%lld",&x)
#define pl(x) printf("%lld\n",x)
using namespace std;
const int N = 1e6+5;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
typedef long long ll;

int main()
{
	ll n;
	sl(n);
	if(n < 1000)
	cout<<"ABC"<<endl;
	else
	cout<<"ABD"<<endl;
}

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

int H,W,N,sx,sy;
int direction[4] = {};
string S,T;
int main(){
    cin >> H >> W >> N;
    cin >> sx >> sy;
    cin >> S >> T;
    for(int i=1;i<=N;i++){
        if(S[i-1]=='U') direction[0]++;
        if(S[i-1]=='L') direction[1]++;
        if(S[i-1]=='D') direction[2]++;
        if(S[i-1]=='R') direction[3]++;
        if(sx-direction[0]<=0 || H-sx-direction[2]+1<=0 
        || sy-direction[1]<=0 || W-sy-direction[3]+1<=0){
            cout << "NO" << endl;
            return 0;
        }
        if(T[i-1]=='U') direction[2] = max(direction[2]-1,-sx+1);
        if(T[i-1]=='L') direction[3] = max(direction[3]-1,-sy+1);
        if(T[i-1]=='D') direction[0] = max(direction[0]-1,sx-H);
        if(T[i-1]=='R') direction[1] = max(direction[1]-1,sy-W);
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 776
#include <stdio.h>

int main(){
	int y,m,d;
	while(scanf("%d %d %d",&y,&m,&d)!=EOF){
		if(y<1868||(y==1868&&m<9)||(y==1868&&m==9&&d<8)){
			printf("pre-meiji\n");
		}else{
			if(y<1912||(y==1912&&m<7)||(y==1912&&m==7&&d<30)){
				printf("meiji %d ",y-1867);
			}else{
				if(y<1926||(y==1926&&m<12)||(y==1926&&m==12&&d<25)){
					printf("taisho %d ",y-1911);
				}else{
					if(y<1989||(y==1989&&m<1)||(y==1989&&m==1&&d<8)){
						printf("showa %d ",y-1925);
					}else{
						printf("heisei %d ",y-1988);
					}
				}
			}
			printf("%d %d\n",m,d);
		}
	}
	return 0;
}

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

template<typename T>
ostream& operator<<(ostream &os, vector<T> &v){
	string sep = " ";
	if(v.size()) os << v[0];
	for(int i=1; i<v.size(); i++) os << sep << v[i];
	return os;
}

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

#ifdef DBG
void debug_(){ cout << endl; }
template<typename T, typename... Args>
void debug_(T&& x, Args&&... xs){
	cout << x << " "; debug_(forward<Args>(xs)...);
}
#define dbg(...) debug_(__VA_ARGS__)
#else
#define dbg(...)
#endif

int main() {
	ios_base::sync_with_stdio(false);
	cout << setprecision(20) << fixed;

	int n, m;
	ll k;
	cin >> n >> m >> k;
	vector<ll> a(n), b(m);
	cin >> a >> b;

	vector<ll> ca(n+1), cb(m+1);
	for(int i=1; i<=n; i++) ca[i] = a[i-1] + ca[i-1];
	for(int i=1; i<=m; i++) cb[i] = b[i-1] + cb[i-1];

	int ans = 0;
	for(int i=0; i<=n; i++){
		if(ca[i]>k) break;
		int j = lower_bound(cb.begin(), cb.end(), k-ca[i]+1) - cb.begin();
		if(j==0){
			if(ca[i]<=k) ans = max(i, ans);
		}
		dbg(i, j, ca[i], cb[j-1]);
		if(ca[i]+cb[j-1]<=k) ans = max(ans, i+j-1);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 9596
from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 200010
MOD = 10**9+7
spf = [i for i in range(MAXN)]
spf[0]=spf[1] = -1
def sieve():
    for i in range(2,MAXN,2):
        spf[i] = 2
    for i in range(3,int(MAXN**0.5)+1):
        if spf[i]==i:
            for j in range(i*i,MAXN,i):
                if spf[j]==j:
                    spf[j]=i
def fib(n,m):
    if n == 0:
        return [0, 1]
    else:
        a, b = fib(n // 2)
        c = ((a%m) * ((b%m) * 2 - (a%m)))%m
        d = ((a%m) * (a%m))%m + ((b)%m * (b)%m)%m
        if n % 2 == 0:
            return [c, d]
        else:
            return [d, c + d]
 
def charIN(x= ' '):
    return(sys.stdin.readline().strip().split(x))
 
def arrIN(x = ' '):
    return list(map(int,sys.stdin.readline().strip().split(x)))
 
def ncr(n,r):
    num=den=1
    for i in range(r):
        num = (num*(n-i))%MOD
        den = (den*(i+1))%MOD
 
    return (num*(pow(den,MOD-2,MOD)))%MOD
 
def flush():
    return sys.stdout.flush()
 
'''*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*'''
n,k = arrIN()
a = arrIN()
dp = [MAX]*(n)
dp[0] = 0
dp[1] = abs(a[1]-a[0])+dp[0]
for i in range(2,n):
    for j in range(1,k+1):
        dp[i] = min(dp[i],abs(a[i]-a[i-j])+dp[i-j])
print(dp[n-1])

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

int main() {
    int N;
    cin >> N;
    set<int> set;
    for (int i = 0; i < N; i++)
    {
        int d;
        cin >> d;
        set.insert(d);
    }
    
    cout << set.size() << endl;
}

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

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline T gcd(T m, T n) {
  if (n == 0)
    return m;
  else
    return gcd(n, abs(m) % abs(n));
}

#define IOS ios::sync_with_stdio(false), cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<int>()
#define MAX(a) *max_element(all(a))

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vc = vector<char>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vvi;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

int main() {
  IOS;
  constexpr char endl = '\n';

  string s;
  cin >> s;

  string res = (s == "ABC") ? "ARC" : "ABC";

  cout << res << endl;
}


Measured memory_bytes: 3580
#include<stdio.h>

int binarySearch(int,int [],int);

int A[1000001],n;

int main(){
  int i,q,key;
  int count = 0;

  scanf("%d",&n);
  for(i = 0;i < n;i++)
    scanf("%d",&A[i]);
  
  scanf("%d",&q);
  for(i = 0;i < q;i++){
    scanf("%d",&key);
    if(binarySearch(n,A,key) != 0)
      count++;
  }
  printf("%d\n",count);

  return 0;
}

int binarySearch(int n,int A[],int key){
  int left = 0;
  int right = n;
  int mid;

  while(left < right){
    mid = (left + right) / 2;
    if(key == A[mid])
      return 1;
    if(key > A[mid])
      left = mid + 1;
    else if(key < A[mid])
      right = mid;
  }
  return 0;
}



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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,m,n) for(int i=m;i<(int)(n);i++)
#define INF 999999999

    /*Solve*/
int main(){
    int a,b;
    cin >> a >> b;
    if(a <= 0 && b >=0){cout << "Zero";
    }else if((a > 0 && b > 0) || ((a < 0 && b < 0) && (b-a)%2==1)){cout << "Positive";
    }else{cout << "Negative";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 300005
using namespace std;
int n,m,tot,num;
int vis[N];
int Next[N],head[N],vet[N],a[N],b[N],c[N];
void add(int x,int y){
	Next[++num]=head[x];
	head[x]=num;
	vet[num]=y;
}
void dfs(int x,int last){
	vis[x]=1;
	b[++tot]=x;
	c[tot]=a[x];
	for (int i=head[x];i;i=Next[i]){
		if (vis[vet[i]]==1) continue;
		if (vet[i]==last) continue;
		dfs(vet[i],x);
	}
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	int ans=0;
	for (int i=1;i<=n;i++)
	if (!vis[i]){
		tot=0;
		dfs(i,0);
		sort(b+1,b+tot+1);
		sort(c+1,c+tot+1);
		int pt=1;
		for (int j=1;j<=tot;j++){
			while (c[pt]<b[j]&&pt<=tot) pt++;
			if (pt>tot) break;
			if (c[pt]==b[j]) ans++;
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 9216
from collections import Counter
N=int(input())
s=[0]*N

for i in range(N):
    s[i]=input()
M=int(input())
t=[0]*M
for j in range(M):
    t[j]=input()

c=dict(Counter(s))
d=dict(Counter(t))
maxi=0
#print(c)
#print(d)

for item in c:
    if item in d:
        tmp = c[item]-d[item]
    else:
        tmp = c[item]
    maxi=max(maxi, tmp)
   
print(maxi)

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

int main(){
    int x;
    cin>>x;
    cout<<x*x*x<<endl;
    return 0;
}


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

namespace ABC113C
{
    class Int
    {
        public Int(int i)
        {
            this.i = i;
        }
        public int i;
    }

    class Program
    {
        static void Main()
        {
            string[] s = Console.ReadLine()?.Split(' ');
            int n = int.Parse(s?[0]);
            int m = int.Parse(s[1]);

            var indices = new System.Tuple<int, int, Int>[m];
            var int3List = new List<System.Tuple<int, int, Int>>();
            Int[] ints = new Int[m]; 

            for (int i = 0; i < m; ++i)
            {
                s = Console.ReadLine()?.Split(' ');

                ints[i] = new Int(0);
                var int3 = new System.Tuple<int, int, Int>(int.Parse(s[0]), int.Parse(s[1]), ints[i]);

                indices[i] = int3;
                int3List.Add(int3);

            }

            IOrderedEnumerable<System.Tuple<int, int, Int>> table =
                int3List.OrderBy(selector => selector.Item1)
                    .ThenBy(selector => selector.Item2);

            int index = 0;
            int prevKen = -1;
            foreach (var int3 in table)
            {
                if (int3.Item1 != prevKen)
                {
                    index = 1;
                }
                else
                {
                    ++index;
                }

                int3.Item3.i = index;

                prevKen = int3.Item1;
            }

            foreach (var data in indices)
            {
                Console.WriteLine("{0:D6}{1:D6}", data.Item1, data.Item3.i);
            }
        }
    }
}


Measured memory_bytes: 31816
#include <iostream>
#include <cstdio>
//#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
//#include <stack>
//#include <limits>
#include <sstream>
//#include <functional>
#include <complex>
using namespace std;

#define len(array)  (sizeof (array) / sizeof *(array))
#define rep(i, s, e) for(int i = s;i < e;i++)
#define rrep(i, e, s) for(int i = e;s <= i;i--)
#define vrange(v) v.begin(), v.end()
#define vrrange(v) v.rbegin(), v.rend()
#define vsort(v) sort(vrange(v))
#define vrsort(v) sort(vrrange(v))
#define arange(a) a, a + len(a)
#define asort(a) sort(arange(a))
#define arsort(a, t) sort(arange(a), greater<t>())
#define afill(a, v) fill(arange(a), v)
#define afill2(a, v, t) fill((t *)a, (t *)(a + len(a)), v)
#define fmax(a, b) (a < b? b : a)
#define fmin(a, b) (a > b? b : a)
#define fabs(a) (a < 0? -a : a)
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-10;
//const int dx[] = {1, -1, 0, 0, 1, -1, -1, 1};
//const int dy[] = {0, 0, 1, -1, -1, -1, 1, 1};
//const int weight[] = {0,1,10,100,1000,10000,100000,1000000,10000000};
//priority_queue< int, vector<int>, greater<int> > q;


// http://d.hatena.ne.jp/otaks/20100929

typedef complex<double> p;
//XY座標
#define X real()
#define Y imag()

// 三角形クラス
class Triangle{

private:
  //三角形の3点の座標
  p a, b, c;
  //三角形の3辺の長さ
  double ab, bc, ca;
  //三角形の3角の大きさ(ラジアン)
  double A, B, C;


public:
  //コンストラクタ(3つの点と辺と角度を初期化)
  Triangle(p p1, p p2, p p3){
	a = p1;
	b = p2;
	c = p3;
	ca = abs(c-a);
	bc = abs(b-c);
	ab = abs(a-b);
	A = LawOfCosines(bc,ca,ab);
	B = LawOfCosines(ca,ab,bc);
	C = LawOfCosines(ab,bc,ca);
  }

  //余弦定理から3つの角度を求める関数
  double LawOfCosines(double a,double b, double c){
	return acos( (b*b+c*c-a*a) / (2.0*b*c) );
  }
  //2つのdouble型の数値が等しいかどうか
  bool equal(double a, double b){
	return (abs( a-b ) < EPS)? true : false ;
  }

  //double circumscribedCircleRadius(){//外接円の半径を返す
  double getCR(){
	return ( bc / (2*sin(A)));
  }
  //p circumscribedCircle(){//外心(外接円の中心)の座標を返す
  p getCC(){ // get a circumcenter
	double sA = sin(2.0*A);
	double sB = sin(2.0*B);
	double sC = sin(2.0*C);
	double deno = sA + sB + sC;
	return p((a.X * sA + b.X * sB + c.X * sC) / deno, (a.Y * sA + b.Y * sB + c.Y * sC) / deno );
  }
};

void doIt(){
  int n;
  double x1, y1, x2, y2, x3, y3, px, py, r;
  cin >> n;
  while(n--){
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	Triangle t = Triangle(p(x1, y1), p(x2, y2), p(x3, y3));
	p cc = t.getCC();
	printf("%.3f %.3f %.3f\n", cc.X, cc.Y, t.getCR());
  }
}

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

Measured memory_bytes: 1336
#include<iostream>
using namespace std;
int N;
double gailv;
int main() {
	double jishu;
	scanf("%d",&N);
	if(N%2==0)
	jishu=N/2*1.0;
	else
	jishu=(N+1)/2*1.0;
	gailv=jishu/N*1.0;
	printf("%.10f",gailv);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define pll pair<ll,ll>
#define pii pair<int,int>
#define F first
#define S second
const int maxn = 2e5 + 5;
int v1[maxn], v2[maxn];
int a, b, m;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    while(cin >> a >> b >> m) {
        int tot = 0;
        int mi = 1e9;
        f1(a) {
            cin >> v1[i];
            mi = min(mi,v1[i]);
        }
        tot += mi;
        mi = 1e9;
        f1(b) {
            cin >> v2[i];
            mi = min(mi,v2[i]);
        }
        tot += mi;
        for (int i = 0 ; i < m ; i++) {
            int x , y, d;
            cin >> x >> y >> d;
            tot = min(tot,v1[x]+v2[y]-d);
        }
        cout << tot << '\n';
    }
}


Measured memory_bytes: 1024
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
typedef unsigned long long ULL;
using namespace std;

const LL INF = 999999999999;
const int maxN = 100000 + 24;
int A, B, Q;
LL a[maxN], b[maxN];

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	while (scanf("%d%d%d", &A, &B, &Q) == 3) {
		for (int i = 0; i < A; i++) scanf("%lld", &a[i]);
		for (int i = 0; i < B; i++) scanf("%lld", &b[i]);
		while (Q--) {
			LL ans = INF, pos, S[3], T[3]; scanf("%lld", &pos);
			int R = lower_bound(a, a+A, pos) - a, L = lower_bound(b, b+B, pos) - b;
			if (R == A) S[1] = INF;
			else S[1] = a[R];
			if (L == B) T[1] = INF;
			else T[1] = b[L];
			if (!R) S[2] = INF;
			else S[2] = a[R-1];
			if (!L) T[2] = INF;
			else T[2] = b[L-1];
			// printf("S[1] = %lld, S[2] = %lld, T[1] = %lld, T[2] = %lld\n", S[1], S[2], T[1], T[2]);
			for (int i = 1; i < 3; i++) {
				for (int j = 1; j < 3; j++) {
					LL t1 = abs(pos - S[i]) + abs(S[i] - T[j]), t2 = abs(pos - T[j]) + abs(T[j] - S[i]);
					ans = min(ans, min(t1, t2));
				}
			}
			printf("%lld\n", ans);
		}
	}

	return 0;
}
/*
    input:
    output:
    modeling:
    methods:
    complexity:
    summary:
*/

Measured memory_bytes: 2816
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int n;
int a[1000001];
int main() {
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	int sum=1;
	for (int i=1;i<=n;i++) sum*=3;
	int sum2=1;
	for (int i=1;i<=n;i++) if (a[i]%2==0) sum2*=2;
	sum-=sum2;
	printf("%d\n",sum); 
	return 0;
}

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

int main(){
  int k;
  cin>>k;
  string s="ACL";
  rep(i,k)cout<<s;
}

Measured memory_bytes: 3520
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	int N;
	cin >> N;
	int p[N];
	for(int i = 0; i < N; i++) cin >> p[i];

	int wrong = 0;
	for(int i = 0; i < N; i++)
		if(i + 1 != p[i]) wrong++;
	if(wrong <= 2)
		cout << "YES";
	else
		cout << "NO";
	return 0;
}

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

int N,A[110];

int main(){
	cin >> N;
	int free = 0;
	set<int> s;
	for(int i=0;i<N;i++){
		cin >> A[i];
		if(A[i]<3200) s.insert(A[i]/400);
		else free++;
	}
	int ma,mi;
	mi = s.size();
	if(s.size()==0) mi++;
	ma = s.size() + free;
	cout << mi << " " << ma << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int r,c;
  int i,j;
  scanf("%d %d",&r,&c);
  int a[r+1][c+1];
  for (i=0;i<r+1;i++){
    for(j=0;j<c+1;j++){
      if(i==r || j==c)
	a[i][j]=0;
      else
	scanf("%d",&a[i][j]);
    }
  }
  
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      a[i][c]+=a[i][j];
    }
  }
  for(j=0;j<c;j++){
    for(i=0;i<r;i++){
      a[r][j]+=a[i][j];
    }
  }
  for(i=0;i<r;i++){
    a[r][c]+=a[i][c];
      }
  for(i=0;i<r+1;i++){
    for(j=0;j<c+1;j++){
      if (j==c)
	printf("%d",a[i][j]);
      else
	printf("%d ",a[i][j]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 644