akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

struct e{
  vector<int> to;
};


vector<struct e> v(50+1); 
bool ans = false;
void solve(int goal,int here,bool f[] , bool f2,int from){  
  //printf("here:%d\n",here);

  if(!f[here]){
    f[here] = true;
  }
  else{
    if(here != goal){
      ret;
    }
  }

  if(f2 && here == goal){
    ans = true;
  }
  

  f2 = true;
  
  
  rep(i,0,v[here].to.size()){
    int next = v[here].to[i];
    //printf("next:%d\n",next);
    if(next != from)
      solve(goal , next , f , f2 , here);
  }
  
  ret;
}
int main(){
  int n,m;
  cin >> n >> m;
  
  rep(i,0,m){
    int a,b;
    cin >> a >> b;
    v[a].to.push_back(b);
    v[b].to.push_back(a);
  }
  int sum = 0;
  rep(i,1,n+1){
    bool f[n+1] = {};
    f[0] = true;
    ans = false;
    solve(i,i,f,false,i);
    
    int z;
    if(ans)
      z = 1;
    else
      z = 0;
    //printf("i:%d ans:%d \n",i,z);

    if(!ans){
      
      sum++;
    }
  }
  

  if(sum > m)
    P(m);
  else
    P(sum);
  ret 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<ll, ll>
#define nyan "(=^･ω･^=)"
#define read_input         freopen("in.txt","r", stdin)
#define print_output       freopen("out.txt","w", stdout)
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
	int h, w, n;
	int a[10005];

	cin >> h >> w;
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];

	int grid[h+1][w+1], k = 1;

	for(int i = 1; i <= h; i++) {
		if(i & 1) {
			for(int j = 1; j <= w; j++) {
				grid[i][j] = k;
				a[k]--; if(not a[k]) k++;
			}
		}
		else {
			for(int j = w; j >= 1; j--) {
				grid[i][j] = k;
				a[k]--; if(not a[k]) k++;
			}
		}
	}

	for(int i = 1; i <= h; i++) {
		for(int j = 1; j <= w; j++) {
			cout << grid[i][j] << " ";
		} cout << endl;
	}
    return 0;
}

Measured memory_bytes: 384
#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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
   int n;
   cin >> n;
   if(n==22){
       cout << "Christmas Eve Eve Eve" << endl;
   }if(n==23){
       cout << "Christmas Eve Eve" << endl;
   }if(n==24){
       cout << "Christmas Eve" << endl;
   }if(n==25){
       cout << "Christmas" << endl;
   }
}

Measured memory_bytes: 3604
class Node:
    def __init__(self, id):
        self.id = id
        self.left = None
        self.right = None
        self.sibling = None
        self.parent = None

def preorder_tree_walk(root):
    result = []
    result.append(root.id)
    if root.left != None:
        result.extend(preorder_tree_walk(root.left))
    if root.right != None:
        result.extend(preorder_tree_walk(root.right))
    return result

def inorder_tree_walk(root):
    result = []
    if root.left != None:
        result.extend(inorder_tree_walk(root.left))
    result.append(root.id)
    if root.right != None:
        result.extend(inorder_tree_walk(root.right))
    return result

def postorder_tree_walk(root):
    result = []
    if root.left != None:
        result.extend(postorder_tree_walk(root.left))
    if root.right != None:
        result.extend(postorder_tree_walk(root.right))
    result.append(root.id)
    return result

n = int(raw_input())
tree = [Node(i) for i in xrange(n)]
for i in xrange(n):
    line = map(int, raw_input().split())
    id, left_id, right_id = line[0], line[1], line[2]
    if left_id != -1:
        tree[id].left = tree[left_id]
        tree[left_id].parent = tree[id]
    if right_id != -1:
        tree[id].right = tree[right_id]
        tree[right_id].parent = tree[id]
    if left_id != -1 and right_id != -1:
        tree[left_id].sibling = tree[right_id]
        tree[right_id].sibling = tree[left_id]

# find root
root = None
for t in tree:
    if t.parent == None:
        root = t

print 'Preorder'
print ' ' + ' '.join(map(str, preorder_tree_walk(root)))
print 'Inorder'
print ' ' + ' '.join(map(str, inorder_tree_walk(root)))
print 'Postorder'
print ' ' + ' '.join(map(str, postorder_tree_walk(root)))

Measured memory_bytes: 6456
// [Tag]
// #

#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#include <deque>
#include <map>
using namespace std;

#define fi     	first    
#define se     	second  

/** Type Define **/
typedef long long int           ll;
typedef pair<int, int>          pii;
typedef pair<ll, ll>            pll;
typedef vector<string>          vs;
typedef vector<bool>            vb;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;
typedef unsigned char           uchar;
typedef unsigned int            ui;
typedef unsigned long long int  ull;

constexpr int               inf = 2123456789;
constexpr long long 		INF = 9123456789123456789;
constexpr long long         MOD = 1000000007LL;

template<class T>
using MaxHeap = priority_queue<T>;
template<class T>
using MinHeap = priority_queue<T, vector<T>, greater<T> >;


template<class T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i];
        if (i + 1 < vec.size())os << ' ';
    }
    return os;
}
template<class T>
istream& operator >> (istream& is, vector<T>& vec) {
    for (int i = 0; i < vec.size(); i++)is >> vec[i];
    return is;
}


/*************************************************/

int H, W, N;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(); cout.tie();
    /*INPUT*/
    cin >> H >> W >> N;

    int larger = max(H, W);
    int ans(0);
    while (N > 0) {
        N -= larger;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

int n, m, javi[2123][2123][5];
int mov[4][2] = {{-1, 0}, {+1, 0}, {0, -1}, {0, +1}};
char grid[2123][2123]; 

int dfs(int x, int y, int dir) {
	int fui = 1;
	
	if (javi[x][y][dir] != -1)
		return javi[x][y][dir];
	
	if (dir == 0) {
		for(int i = 0; i < 4; ++i) {
	        int viz_x = x + mov[i][0];
	        int viz_y = y + mov[i][1];
	 
	        if (viz_x < 0 || viz_x >= n || viz_y < 0 || viz_y >= m)
	            continue;
	 
	        if (grid[viz_x][viz_y] != '.')
	            continue;
	 
	        fui += dfs(viz_x, viz_y, i+1);
    	}
	}
	
	else {
		int viz_x = x + mov[dir-1][0];
	    int viz_y = y + mov[dir-1][1];
	 
	    if (!(grid[viz_x][viz_y] != '.') && !(viz_x < 0 || viz_x >= n || viz_y < 0 || viz_y >= m))	 
	    	fui += dfs(viz_x, viz_y, dir);
	}
	
	return javi[x][y][dir] = fui;
	
}

int main() {
	scanf("%d %d", &n, &m);
	
	for (int i=0; i<n; ++i) {
		for (int j=0; j<m; ++j) {
			scanf(" %c", &grid[i][j]);
		}
	}
	memset(javi, -1, sizeof javi);
	int resp = -1e9;
	for (int i=0; i<n; ++i) {
		for (int j=0; j<m; ++j) {
			if (grid[i][j] != '#') {
				resp = max(resp, dfs(i,j, 0));
			}
		}
	}
	
	printf("%d\n", resp);
	return 0;
}

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

  long N;
  std::cin >> N;
  
  std::vector<long> L(N);
  
  for (int i = 0; i < N; i++) {
    std::cin >> L[i];
  }
  
  long max;
  max = 0;
  for (int i = 0; i < N; i++) {
    if(max < L[i]){
		max=L[i];
	}
  }
  long sum;
  sum = 0;
  int flag;
  flag=0;
  for (int i = 0; i < N; i++) {
    if(L[i] != max || flag ==1){
	//if(L[i] != max){
		sum += L[i];		
		
	}
	else{
	flag=1;
	}
  }
  if(max<sum){
	printf("Yes\n");
  }
  else{
	printf("No\n");
  }
  
}

Measured memory_bytes: 256
#include<queue>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  string s,t;
  int i,j,k,q,a,b;
  cin >> s;
  scanf("%d\n",&q);
  for(i=0;i<q;i++){
    cin >> t;
    if(t=="print"){
      scanf("%d %d\n",&a,&b);
      string u=s.substr(a,b-a+1);
      cout << u << endl;
    }
    else if(t=="reverse"){
      scanf("%d %d\n",&a,&b);
      k=b;
      for(j=a;j<=k;j++){
        swap(s[j],s[k]);
        k--;
      }
    }
    else{
      scanf("%d %d",&a,&b);
      string u;
      cin >> u;
      k=a;
      for(j=0;j<b-a+1;j++){
        swap(u[j],s[k]);
        k++;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3256
#include <stdio.h>

int main(void) {

	int n,i;
	int a[100];

	scanf("%d", &n);

	for (i = 0; i < n; i++) {

		scanf("%d", &a[i]);

	}

	for (i = n-1; i >= 0; i--) {

		if (i == 0) {
			printf("%d", a[i]);
			break;
		}

		printf("%d ", a[i]);

		
	}
printf("\n");
	return(0);

}


Measured memory_bytes: 2044
/*  ***  In The Name of God ... ***  */ 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
 
#define int long long
#define all(v) v.begin() , v.end()

template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

const int N = 400 + 10 , mod = 1e9 + 7 ;

int n , C , a [ N ] , b [ N ] , t [ N ] [ N ] , sum [ N ] [ N ] , dp [ N ] [ N ] ; 

int32_t main()
{
	//ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> C ;
	for ( int i = 1 ; i <= n ; ++ i )
		cin >> a [ i ] ;
	for ( int i = 1 ; i <= n ; ++ i )
		cin >> b [ i ] ;
	for ( int i = 1 ; i < N ; ++ i ) {
		t [ i ] [ 0 ] = 1 ;
		for ( int j = 1 ; j < N ; ++ j ) {
			( t [ i ] [ j ] = t [ i ] [ j - 1 ] * i ) %= mod ; 
		}
	}
	for ( int i = 1 ; i <= n ; ++ i ) {
		for ( int j = 0 ; j <= C ; ++ j ) {
			for ( int k = a [ i ] ; k <= b [ i ] ; ++ k )
				sum [ i ] [ j ] += t [ k ] [ j ] , sum [ i ] [ j ] %= mod ; 
		}
	}
	dp [ 0 ] [ 0 ] = 1 ; 
	for ( int i = 1 ; i <= n ; ++ i ) {
		for ( int j = 0 ; j <= C ; ++ j ) {
			for ( int k = 0 ; k <= j ; ++ k ) {
				dp [ i ] [ j ] += ( dp [ i - 1 ] [ j - k ] * sum [ i ] [ k ] % mod ) ;
				dp [ i ] [ j ] %= mod ; 
			}
		}
	}/*
	for ( int i = 1 ; i <= n ; ++ i ) {
		for ( int want = 0 ; want <= C ; ++ want ) {
			cout << i << ' ' << want << ' ' << dp [ i ] [ want ] << '\n' ; 
		}
		}*/
	cout << dp [ n ] [ C ] % mod << '\n' ; 
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#undef int
#define INF 1000000009
#define INFL 1000000000000000018
#define mod 1000000007
#define pb push_back
typedef pair<int, int> PA;
typedef priority_queue<int> PQ;
typedef priority_queue<int, vector<int>, greater<int> >PQG;

int dp[100005][4];
string s;

signed main()
{
    dp[0][0] = 1;
    cin >> s;
    int n = s.size();
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 4; j++){
            dp[i + 1][j] = (dp[i][j] * (s[i] == '?' ? 3 : 1)) % mod;
            if(j > 0 && ("ABC"[j - 1] == s[i] || s[i] == '?')){
                dp[i + 1][j] = (dp[i + 1][j] + dp[i][j - 1]) % mod;
            }
        }
    }
    cout << dp[n][3] << endl;

    return 0;
}


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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  double ma = 0;
  int x = 0, y = 0;
  for (int i = 0; i * a * 100 <= f; i++)
  for (int j = 0; j * b * 100 <= f; j++) {
    int t = e * (i * a + j * b);
    for (int k = 0; k * c <= t; k++)
    for (int l = 0; l * d <= t; l++) {
      int water = i * a * 100 + j * b * 100;
      int sugar = k * c + l * d;
      int sum = water + sugar;
      if (sum > f || (k * c + l * d) > t) continue;
      double cal = double(sugar) / double(water + sugar);
      if (cal >= ma) ma = cal, x = sum, y = sugar;
    }
  }
  cout << x << ' ' << y << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


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

int main(){
    int n;
    scanf("%d",&n);
    vector<int> x(n),y(n);
    rep(i,n) scanf("%d",&x[i]);
    rep(i,n) scanf("%d",&y[i]);
    
    double l1=0,l2=0,l3=0,l_inf=0;
    
    rep(i,n) l1+=((x[i]-y[i])>0 ? x[i]-y[i] : y[i]-x[i]);
    rep(i,n) l2+=(x[i]-y[i])*(x[i]-y[i]);
    l2 = sqrt(l2);
    rep(i,n){
        int tmp = ((x[i]-y[i])>0 ? x[i]-y[i] : y[i]-x[i]);
        l3+=pow(tmp,3.0);
    }
    l3 = pow(l3,1.0/3.0);
    
    double mx=0;
    rep(i,n){
        double tmp = ((x[i]-y[i])>0 ? x[i]-y[i] : y[i]-x[i]);
        mx = max(mx,tmp); 
    }
    l_inf = mx;
    printf("%.5f\n%.5f\n%.5f\n%.5f\n",l1,l2,l3,l_inf);
    return 0;
}


Measured memory_bytes: 3396
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
#define minn(x,y) x=min(x,y)
#define maxx(x,y) x=max(x,y)
using namespace std;
int main()
{
	int i,j,k,n,m,x,y;
	scanf("%d%d%d",&n,&m,&y);
	x=n-m;
	if(x>y)
	{
		printf("0");
	}
	else
	{
		printf("%d",y-x);
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
k = int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
v=1
for i in range(n):
    v = min(v+k, 2*v)
print(v)


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

namespace TYC
{
	const int N = 2e5 + 5;

	int n, tot, C[N], Fa[N], M[N], R[N], Q[N][2];
	vector<int> E[N];
	struct node {  int ls, rs, v; } tr[N * 150];

	int add(const int p, const int x, const int w, const int l = 1, const int r = n)
	{
		int o = ++tot;
		tr[o] = tr[p];
		if (l == r)
			return tr[o].v += w, o;
		int mid = (l + r) >> 1;
		if (x <= mid)
			tr[o].ls = add(tr[p].ls, x, w, l, mid);
		else
			tr[o].rs = add(tr[p].rs, x, w, mid + 1, r);
		tr[o].v = tr[tr[o].ls].v + tr[tr[o].rs].v;
		return o;
	}

	int merge(const int x, const int y, const int l = 1, const int r = n)
	{
		if (!x || !y)
			return x + y;
		int o = ++tot;
		if (l != r)
		{
			int mid = (l + r) >> 1;
			tr[o].ls = merge(tr[x].ls, tr[y].ls, l, mid);
			tr[o].rs = merge(tr[x].rs, tr[y].rs, mid + 1, r);
		}
		tr[o].v = tr[x].v + tr[y].v;
		return o;
	}

	int del(const int p, const int v, const int l = 1, const int r = n)
	{
		if (r <= v)
			return 0;
		if (l == r)
			return p;
		int o = ++tot, mid = (l + r) >> 1;
		if (v <= mid)
		{
			tr[o].ls = del(tr[p].ls, v, l, mid);
			tr[o].rs = tr[p].rs;
		}
		else
		{
			tr[o].ls = 0;
			tr[o].rs = del(tr[p].rs, v, mid + 1, r);
		}
		tr[o].v = tr[tr[o].ls].v + tr[tr[o].rs].v;
		return o;
	}

	int query(const int o, const int x, const int l = 1, const int r = n)
	{
		if (!o) 
			return 0;
		if (l == r)
			return tr[o].v;
		int mid = (l + r) >> 1;
		if (x <= mid)
			return query(tr[o].ls, x, l, mid);
		else
			return tr[tr[o].ls].v + query(tr[o].rs, x, mid + 1, r);
	}

	void dfs(const int u, const int f)
	{
		Fa[u] = f;
		M[u] = max(M[f], f);
		for (int v : E[u])
			if (v != f)
			{
				dfs(v, u);
				R[u] = merge(R[u], R[v]);
			}
		Q[u][0] = query(R[u], M[u]) + 1;
		Q[u][1] = query(R[u], M[f]) + 1;
		int t = query(R[u], u) + 1;
		R[u] = del(R[u], u);
		R[u] = add(R[u], u, t);
	}

	void dfs(const int u)
	{
	// 	if (u > 1)
	// 	{
	// 		int f = Fa[u];
	// 		C[u] = C[f] + 1;
	// 		if (f > 1)
	// 			C[u] -= query(R[u], M[f]);
	// 		for (int v : E[u])
	// 			if (v != f)
	// 				C[u] += query(R[v], M[u]);
	// 	}
		if (u != 1)
		{
			C[u] = C[Fa[u]] + Q[u][0];
			if (u < M[u] && u < M[Fa[u]]) 
				C[u] -= Q[u][1];
		}
		for (int v : E[u])
			if (v != Fa[u])
				dfs(v);
	}

	void work()
	{
		scanf("%d", &n);
		for (int i = 1, u, v; i < n; i++)
		{
			scanf("%d%d", &u, &v);
			E[u].push_back(v);
			E[v].push_back(u);
		}
		for (int i = 1; i <= n; i++)
			sort(E[i].begin(), E[i].end());
		dfs(1, 0);
		dfs(1);
		cerr << tot << "\n";
		for (int i = 2; i <= n; i++)
			printf("%d ", C[i]);
	}
}

int main()
{
//	freopen("AGC029E.in", "r", stdin);
//	freopen("AGC029E.out", "w", stdout);
	TYC::work();
	return 0;
}

Measured memory_bytes: 141300
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var N = Number(lines[0].split(" ")[0])
    var M = Number(lines[0].split(" ")[1])
    var X = Number(lines[0].split(" ")[2])

    var A = lines[1].split(" ").map(i => Number(i));

    var left = 0; var right = 0;
    for (var i = 0; i < M; i++) {
        if (X < A[i]) { right++; }
        if (X > A[i]) { left++; }
    }

    console.log(Math.min(left, right));
});



Measured memory_bytes: 21320
#include<iostream>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<fstream>
#include<algorithm>
#include<utility>
using namespace std;
using ll = long long;

int main(){
    int n,r;
    cin >> n >> r;
    if(n>=10)   cout << r << endl;
    else    cout << r + 100 * (10-n) << endl;
    return 0;
}

Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}

void main()
{
  string x, y; readV(x, y);
  writeln(x > y ? ">" : x < y ? "<" : "=");
}


Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <functional>
#include <queue>
#include <string>
#include <map>
#include <vector>

using namespace std;

int main() {
  for (;;) {
    int n, B, y;
    cin >> n;
    if (!n) return 0;
    cin >> y;
    double m = 0;
    for (int i = 0; i < n; i++) {
      int b, t;
      double x, r;
      cin >> b >> r >> t;
      if (t == 1)
        x = 1 + y * r / 100;
      else
        x = pow(1 + r / 100, y);
      if (m < x) {
        m = x;
        B = b;
      }
    }
    cout << B << endl;
  }
}

Measured memory_bytes: 1232
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	N := nextInt()
	A := make([]int64, int(math.Pow(10, 5)))
	sum := int64(0)
	for i := 0; i < N; i++ {
		v := nextInt64()
		A[v-1] += 1
		sum += v
	}

	Q := nextInt()
	for i := 0; i < Q; i++ {
		b := nextInt64()
		c := nextInt64()
		sum = sum - b*A[b-1] + c*A[b-1]
		A[c-1] += A[b-1]
		A[b-1] = 0
		fmt.Println(sum)
	}
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}

func nextString() string {
	return nextReader()
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func Min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func Max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func MinA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Min(s, v)
	}
	return s
}

func MaxA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Max(s, v)
	}
	return s
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func maxInt() int {
	return math.MaxInt32
}


Measured memory_bytes: 5672
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
inline int read(){
	int res=0,sign=1;char ch;
	while((ch=getchar())<'0'||ch>'9')if(ch=='-')sign=-1;res=res*10+ch-48;
	while((ch=getchar())>='0'&&ch<='9')res=res*10+ch-48;
	return res*sign;
}
const int maxn=2*1e5+10;
int n,k;
int f[maxn];
long long sum,ans;
bool flag;
priority_queue<int> q;
int main(){
    n=read(),k=read();
    for(int i=1;i<=n;i++){
    	f[i]=read();
    	q.push(f[i]);
		sum+=f[i];
	}
	if(k>=n){puts("0");return 0;}
	if(k==0){printf("%lld",sum);return 0;}//特判 
	int t=0;
	for(int i=1;i<=n;i++){
		int a=q.top();
		q.pop();
		k--;
		sum-=a;
		if(k>0)continue;
		break;
	}	 
    printf("%lld",sum);
	return 0;
}


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

int main() {
  int n,q;

  cin >> n;
  int S[n+1];
  for(int k=0;k<n;k++){
    cin >> S[k];
  }
  cin >> q;
  int T[q];
  for(int l=0;l<q;l++){
    cin >> T[l];
  }

  int count=0;
  for(int j=0;j<q;j++){
    int i=0;
    S[n] = T[j];
    while(S[i] != T[j]){
      i++;
    }
    if(i != n) count += 1;
  }

  cout << count << endl;
    
  return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const ll mod=(1e9)+7;
const int maxn=(4e5)+10;
int n,op[maxn],cnt;
char s[maxn];
ll ans=1;
int main() {
	//freopen("1.txt","r",stdin);
	read(n); scanf("%s",s+1);
	for (int i=1;i<=2*n;i++) {
		if ((2*n-i+1)%2==0&&s[i]=='B') op[i]=1;
		else if ((2*n-i+1)%2==1&&s[i]=='W') op[i]=1;
		else op[i]=0;
	//	printf("%d %d\n",i,op[i]);
	}
	for (int i=1;i<=n;i++) ans=ans*i%mod;
	for (int i=1;i<=2*n;i++) {
		if (!op[i]) {
			if (!cnt) { ans=0; break; }
			ans=ans*cnt%mod; cnt--;
		} else cnt++;
	}
	if (cnt) ans=0;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n;
void out(ll x,ll y,ll z){
    printf("%lld %lld %lld\n",x,y,z);
    exit(0);
}
void f(){
    ll c,m;
    for(ll i=1;i<=3500;i++)
        for(ll j=1;j<=3500;j++){
            c=n*i*j;
            m=4*i*j-n*i-n*j;
            if(m>0&&c%m==0)out(i,j,c/m);
        }
}
int main(){
    cin>>n;
    if(n%2==0)out(n,n,n/2);
    if(n%3==0)out(n,n/3*2,n/3*2);
    if((n-3)%4==0)out((n+1)/4,(n+1)*(n+1)/4,(n+1)*(n+1)*n/4);//n-3是4的倍数
    if((n-1)%4==0)f();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  char a;
  cin>>a;
  if('a'<=a && a<='z'){
      cout<<'a'<<'\n';
  }
  else{
      cout<<'A'<<'\n';
  }
  return(0);
}


Measured memory_bytes: 3632
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
# def LIST(): return list(map(int, input().split()))
# def LIST(): return list(map(str, input().split()))
def LIST(): return list(input())

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()
S = LIST()
flag = False
if len(S) == A + B + 1:
    if S[A] == "-":
        for i in range(A):
            if S[i] != "-":
                for j in range(B):
                    if S[-1-j] != "-":
                        flag = True
if flag == True:
    print("Yes")
else:
    print("No")

# 15:51


Measured memory_bytes: 5192
#include <bits/stdc++.h>
using namespace std;
int xv[]={0,1,1,1,0,-1,-1,-1},yv[]={-1,-1,0,1,1,1,0,-1};

int main(){
    int n,m,ans=0;
    char in;
    pair<int,int> lc,go;
    int lv;
    cin>>n>>m;
    vector<vector<int>> mp;
    mp=vector<vector<int>>(n+2,vector<int>(m+2,-1));
    vector<vector<vector<int>>> bl;
    bl=vector<vector<vector<int>>>(n+2,vector<vector<int>>(m+2,vector<int>(4,0)));
    
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>in;
            if(in=='G'){
                mp[i][j]=0;
                go=make_pair(i,j);
            }
            else if(in=='.'){
                mp[i][j]=0;
            }
            else if(in=='^'){
                mp[i][j]=0;
                lv=0;
                lc=make_pair(i,j);
                bl[i][j][lv]++;
            }
            else if(in=='>'){
                mp[i][j]=0;
                lv=1;
                lc=make_pair(i,j);
                bl[i][j][lv]++;
            }
            else if(in=='v'){
                mp[i][j]=0;
                lv=2;
                lc=make_pair(i,j);
                bl[i][j][lv]++;
            }
            else if(in=='<'){
                mp[i][j]=0;
                lv=3;
                lc=make_pair(i,j);
                bl[i][j][lv]++;
            }
        }
    }
    int r,c;
    while(1){
        r=lc.first;
        c=lc.second;
        if(mp[r+yv[(2*lv+2)%8]][c+xv[(2*lv+2)%8]]==-1&&mp[r+yv[2*lv]][c+xv[2*lv]]==0){
            if(bl[r+yv[2*lv]][c+xv[2*lv]][lv]==4){
                cout<<"-1"<<endl;
                return 0;
            }
            bl[r+yv[2*lv]][c+xv[2*lv]][lv]++;
            lc=make_pair(r+yv[2*lv],c+xv[2*lv]);
        }
        else if(mp[r+yv[(2*lv+2)%8]][c+xv[(2*lv+2)%8]]==0&&mp[r+yv[(2*lv+3)%8]][c+xv[(2*lv+3)%8]]==-1){
            lv=(lv+1)%4;
            if(bl[r][c][lv]==4){
                cout<<"-1"<<endl;
                return 0;
            }
            bl[r][c][lv]++;
            lc=make_pair(r+yv[2*lv],c+xv[2*lv]);
            if(bl[lc.first][lc.second][lv]==4){
                cout<<"-1"<<endl;
                return 0;
            }
            bl[lc.first][lc.second][lv]++;
        }
        else if(mp[r+yv[2*lv]][c+xv[2*lv]]==-1){
            lv=(lv+3)%4;
            if(bl[r][c][lv]==4){
                cout<<"-1"<<endl;
                return 0;
            }
            bl[r][c][lv]++;
        }
        if(go==lc){
            for(int i=1;i<=n;i++){
                for(int j=1;j<=m;j++){
                    if(bl[i][j][0]||bl[i][j][1]||bl[i][j][2]||bl[i][j][3]){
                        ans++;
                    }
                    
                }
            }
            cout<<ans<<endl;
            return 0;
        }
    }
}



Measured memory_bytes: 3332
#include<iostream>
#define size(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
int main(void){
    int a,b,c;
    cin >> a >> b >> c;
  if(b >= c){
    cout << "delicious";
  }else{
    if(c - b > a){
      cout << "dangerous";
    }else{
      cout << "safe";
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 7;
int b[5];
int a[maxn];
int main(){
	int n;
	scanf("%d",&n);
	ll ans = 1;
	memset(b,0,sizeof(b));
	for(int i = 1;i <= n;i++) scanf("%d",&a[i]);
	for(int i = 1;i <= n;i++){
		int val = a[i];
		int cnt = 0;
		for(int j = 1;j <= 3;j++){
			if(b[j] == val){
				cnt++;
			}
		}
		ans = (ans * cnt) % mod;
		for(int j = 1;j <= 3;j++){
			if(b[j] == val){
				b[j]++;
				break;
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 640
N = int(input())
S= [input() for _ in range(N)]
nums = [0]*5
for s in S:
    if s[0] == 'M':
        nums[0] += 1
    elif s[0] == 'A':
        nums[1] += 1
    elif s[0] == 'R':
        nums[2] += 1
    elif s[0] == 'C':
        nums[3] += 1
    elif s[0] == 'H':
        nums[4] += 1
c = 0
for i in range(3):
    for j in range(i+1,4):
        for k in range(j + 1, 5):
            c += nums[i]*nums[j]*nums[k]
print(c)






Measured memory_bytes: 82676
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
ll n,k;
ll a[100000];
vector<P> v;
ll f;
ll ans=-1;
int main()
{
while(1){
	cin>>n>>k; if(!n) return 0;
	ans=-1;
	for(ll i=0;i<k;i++) cin>>a[i];
	sort(a,a+k);
	f=0;
	if(a[0]!=0) f=1;
	for(ll i=f;i<=n;i++){
		P p;
		p.first=a[i];
		while(i<n&&a[i]+1==a[i+1]) i++;
		p.second=a[i];
		v.push_back(p);
	}
	for(ll i=0;i<v.size();i++){
		ans=max(ans,v[i].second-v[i].first+1);
	}
	if(f==0) for(ll i=0;i<v.size()-1;i++){
		if(v[i].second+2==v[i+1].first) ans=max(ans,v[i+1].second-v[i].first+1);
	}
	cout<<ans<<endl;
}}

Measured memory_bytes: 4716
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int n;
vector<int> a;
int dfs(int i, bool y) {
  if (i == n) {
    if (y)
      return 1;
    else
      return 0;
  }

  int a1 = dfs(i + 1, y ? y : (a[i] - 1) % 2 == 0);
  int a2 = dfs(i + 1, y ? y : a[i] % 2 == 0);
  int a3 = dfs(i + 1, y ? y : (a[i] + 1) % 2 == 0);
  return a1 + a2 + a3;
}

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

  cin >> n;
  a.resize(n);
  rep(i, 0, n) cin >> a[i];

  cout << dfs(0, false) << endl;
}


Measured memory_bytes: 3616
data = input().split()

n = int(data[0])
a=[]
for i in range(n):
    line = input().split()
    tmp=[]
    tmp.append(int(line[1]) + int(line[0]))
    tmp.append(int(line[0]))
    tmp.append(int(line[1]))
    a.append(tmp)

res=0
a.sort(key=lambda x: x[0])
a.reverse()

flg=True

for e in a:
    if(flg):
        res +=e[1]
    else:
        res -=e[2]
    flg=not(flg)
    

print(res)


Measured memory_bytes: 26024
#include<stdio.h>
int main(){
	double a,b,r;
	
	scanf("%lf",&r);
	a=1.0*2*r*3.141592653589793238;
	b=1.0*r*r*3.141592653589793238;
	printf("%lf %lf\n",b,a);
	
return 0;
}

Measured memory_bytes: 648
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
 
int main()
{
 
long long n;
cin>>n;
if(n%2!=0){cout<<0;
    return 0;}
else{
 
    long long int s=10*5;
    long long res=n/10;
  while(s<=n)
  {
 
      res+=(n/s);
      s*=5;
 
  }
 
 
cout<<res;
 
 
 
}
 
    return 0;
}

Measured memory_bytes: 256
open System
open System.Collections.Generic

module InputUtility =
    let InputTokens = new Queue<string>()

    let EnsureInput () =
        if InputTokens.Count = 0 then
            let input = Console.ReadLine ()
            let s = input.Split ([|' '|], StringSplitOptions.RemoveEmptyEntries)
            if s.Length > 0 then
                for x in s do InputTokens.Enqueue(x)
                true
            else false
        else true

    let rec ReadNext () =
        if EnsureInput () then InputTokens.Dequeue ()
        else ReadNext ()

    let ReadNextInt () = ReadNext () |> int

    let Read2Int () = ReadNextInt (), ReadNextInt ()

    let ReadListOf f n =
        let rec loop acc = function
            | 0 -> List.rev acc
            | c -> loop ((ReadNext () |> f) :: acc) (c-1)
        loop [] n

    let MultipleCaseWithId f =
        let caseNum = ReadNextInt ()
        let rec loop index =
            if index = caseNum then ()
            else
                f index
                loop (index + 1)
        loop 0

    let MultipleCase f = MultipleCaseWithId (fun _ -> f ())

    let ReadList n =
        let rec loop acc = function
            | 0 -> List.rev acc
            | c -> loop (ReadNext () :: acc) (c-1)
        loop [] n

open InputUtility

module ABC064 =
    let private Insertion () =
        let n = ReadNextInt ()
        let s = ReadNext ()
        let quick () =
            let rec loop i c lr =
                if i = n then lr, c
                elif s.[i] = '(' then
                    loop (i + 1) (c + 1) lr
                elif c = 0 then
                    loop (i + 1) 0 (lr + 1)
                else
                    loop (i + 1) (c - 1) lr
            let l, r = loop 0 0 0
            String.replicate l "(" + s + String.replicate r ")"
        quick () |> printfn "%s"

    let Entry = Insertion

ABC064.Entry ()

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

int main(){
	int n,A,B;
	cin >> n >> A >> B;
	string s;
	cin >> s;
	int pass = 1;
	int kaigai = 1;
	rep(i,s.size()){
		if(s[i] == 'c'){
			cout << "No" << endl;
		} else if (s[i] == 'a'){
			if(pass <= A + B){
				cout << "Yes" << endl;
				pass++;
			}else{
				cout << "No" << endl;
			}
		} else if (s[i] == 'b'){
			if(pass <= A+B && kaigai <= B){
				cout << "Yes" << endl;
				pass++;
				kaigai++;
			}else{
				cout << "No" << endl;
			}
		}
	}
    return 0;
}



Measured memory_bytes: 896
#[macro_export]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
      a: i32,
      b: i32
  }
  
 match a-b {
    0 => println!("a == b"),
    n if n > 0  => println!("a > b"),
    n if n < 0  => println!("a < b"),
    _ => println!("")
 }
 
 
}


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

int main() {
  int n, t_n, ans=0, num=1;
  cin >> n;
  for(int i; i<n; i++){
    cin >> t_n;
    if(t_n==num){
      num+=1;
    }
    else{
      ans+=1;
    }
  }
  
  if(num==1){
    cout << -1 << endl;
  }
  else{
    cout << ans << endl;
  }
}

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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c>> d;
  if(a+b>c+d){
    cout << "Left" << endl;
  }
  else if(a+b<c+d){
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

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

using namespace std;

int main(){
	string s,t;
	
	cin>>s>>t;
	
	int sum=0;
	for(int j=0;j<s.size();j++){
		if(s[j]!=t[j])sum++;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3920
N = int(input())
A = []
B = []
su = []
for i in range(N):
    a, b = (int(i) for i in input().split())
    A.append(a)
    B.append(b)
    su.append( (a + b, a - b, a, b) )
su.sort()
su.reverse()

cc = 0
for i in range(N):
    if i < N-1 and su[i][0] == su[i+1][0]:
        cc += 1
    else:
        if cc:
            temp = []
            for j in range(i-cc, i+1):
                temp.append(su[j])
            temp2 = []
            for j in range(i-cc, i+1):
                if j % 2 == 0:
                    temp2.append(temp.pop(0))
                else:
                    temp2.append(temp.pop())
            for j in range(i-cc, i+1):
                su[j] = temp2[j-(i-cc)]
            cc = 0
ans = 0
for i in range(N):
    if i%2 == 0:
        ans += su[i][2]
    else:
        ans -= su[i][3]

print(ans)

Measured memory_bytes: 26564
List = list(input())
ans = []

for i in range(len(List)):
  if List[i] == '0': ans.append('0')
  elif List[i] == '1': ans.append('1')
  else:
    if ans == []: pass
    else: ans.pop(-1)
      
for i in range(len(ans)):
  print(ans[i], end = '')

Measured memory_bytes: 38256
p = (10 ** 9 + 7) * 2
N = int(input())
A = [int(x) for x in input().split()]
A2 = [(x ** 2) % p for x in A]
result = (((sum(A) % p) ** 2 - sum(A2) % p) % p) / 2
print(int(result))

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

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

  string s;
  cin >> s;

  map<int,int> mp;
  reverse(s.begin(), s.end());

  int k = 1, r = 0;
  for (int i = 0; i < s.size(); ++i) {
    int d = s[i] - '0';
    r = d * k + r;
    r %= 2019;

    ++mp[r];

    k *= 10;
    k %= 2019;
  }

  int ans = 0;

  for (auto e : mp) {
    int d = e.second;
    ans += (d * (d-1)) / 2;
  }

  cout << ans + mp[0] << '\n';

  return (0);
}

Measured memory_bytes: 3696
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> VI;
typedef pair<int,int> PII;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;

int main(){
    int data[10]={};
    int n;
    cin>>n;
    rep(i,n){
        double s;
        cin>>s;
        if(s>=185.0)data[6]++;
        else if(s>=180.0)data[5]++;
        else if(s>=175.0)data[4]++;
        else if(s>=170.0)data[3]++;
        else if(s>=165.0)data[2]++;
        
        else data[1]++;
    }

    for(int i=1;i<=6;i++){
        cout<<i<<":";
        rep(j,data[i]){
            cout<<"*";
        }
        cout<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1232
#include <iostream>
using namespace std;
int main() {
    string s; cin >> s;
    if (s == "RRR") cout << "3\n";
    else if (s == "RRS" || s == "SRR") cout << "2\n";
    else if (s == "SSS") cout << "0\n";
    else cout << "1\n";
}


Measured memory_bytes: 3100
x,y = map(int,input().split())

cnt = abs(abs(x) - abs(y))
if abs(x) < abs(y): 
    if x >= 0 and y >= 0: print(cnt)
    elif x < 0 and y < 0: print(cnt+2)
    else: print(cnt+1)
elif abs(x) > abs(y):
    if x >=0 and y > 0: print(cnt+2)
    elif x < 0 and y <= 0: print(cnt) 
    else: print(cnt+1)
elif abs(x) == abs(y):
    if x*y >= 0:print(cnt)
    else: print(cnt+1)

Measured memory_bytes: 38256
from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n,q = list(map(int, input().split()))
    elasped=0
    que=deque()
    for _ in range(n):
        pt=input().split()
        pt[1]=int(pt[1])
        que.append(pt)
    while que:
        p,t=que.popleft()
        elasped+=min(t,q)
        if t<=q:
            print(p,elasped)
        else:
            que.append([p,t-q])

main()



Measured memory_bytes: 17404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int n;
  cin >> n;
  //線形代数する
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> x(n);
  x[0] = a[0];
  for (int i = 0; i < n/2; i++) {
    x[0] += - a[2*i+1] + a[2*i+2];
  }
  printf("%d",x[0]);
  for (int i = 1; i < n; i++) {
    x[i] = - x[i-1] + 2 * a[i-1];
    printf(" %d",x[i]);
  }
  

  

}



Measured memory_bytes: 2048
N,M = map(int,input().split())
ks = [list(map(int,input().split())) for _ in range(M)]
P = list(map(int,input().split()))
ans = 0

for i in range(2**N):
  on_or_off = [0]*M
  for j in range(N):
    if (i>>j)&1:
      for k in range(M):
        if j+1 in ks[k][1:]:
          on_or_off[k] += 1
  cnt = 0
  for l in range(M):
    if on_or_off[l]%2 == P[l]:
      cnt += 1
  if cnt == M:
    ans += 1
print(ans)

Measured memory_bytes: 9056
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int n;
double f(int i, int k)
{
    double num;
    num =(log10(k) -log10(i))/ log10(2);
    num = num < 0 ? 0 : num;
    if (ceil(num) == floor(num))
        return pow(0.5, (static_cast<int>(num)))/n;
    else
        return pow(0.5, (static_cast<int>(num)+1)) / n;
}

int main()
{
    int k;
    cin >> n >> k;
    double sum = 0;
    for (int i = 1; i <= n; i++)
    {
        sum+=f(i, k);
    }
    cout << std::setprecision(13) << sum;
}

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

int N;
int P[8], Q[8], R[8];

bool array_equal(int A[8], int B[8], int len) {
  for (int i = 0; i < len; i++) if(A[i] != B[i]) return false;
  return true;
}

signed main() {
  cin >> N;
  for(int i=0; i<N; i++) cin >> P[i];
  for(int i=0; i<N; i++) cin >> Q[i];
  for(int i=0; i<N; i++) R[i] = i+1;

  int count = 0;
  int a,b;

  do {
    count++;
    if( array_equal(P, R, N)) a=count;
    if( array_equal(Q, R, N)) b=count;
  }while (next_permutation(R, R + N));
  
  int ans = a > b ? a - b : b - a;
  cout<< ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n-1); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define scout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int h,w; cin >> h >> w;
	vector<string> a(h);
	rep(i,h) cin >> a[i];
	cout << string(w+2,'#') << endl;
	rep(i,h) {
		cout << '#' << a[i] << '#' << endl;
	}
	cout << string(w+2,'#') << endl;
}

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

int main(void)
{
  char arr[5];
  int n;
  bool flag = false;

  fgets(arr, sizeof(arr), stdin);
  sscanf(arr, "%d", &n);

  for (int i=0; i*7 <= n; i++) {
    for (int j=0; (j*4 + i*7) <= n; j++) {

      if (n == j*4 + i*7) {
        flag = true;
        break;
      }
      
    }
  }

  if (flag == true) { 
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, a[214514], ans = inf, sum[214514];
signed main() {
	cin >> n;
	REP(i, n + 1) {
		cin >> a[i];
		sum[i] = sum[i - 1] + a[i];
	}
	for (int i = 2; i < n - 1; i++) {//中心
		int ng = 0, ok = i, mid;
		while (ok - ng > 1) {
			mid = (ok + ng) / 2;
			if (sum[mid] >= sum[i] - sum[mid]) {
				ok = mid;
			}
			else {
				ng = mid;
			}
		}
		int mi, ma;
		if (abs((sum[i] - sum[ok]) - sum[ok]) > abs((sum[i] - sum[ok - 1]) - sum[ok - 1])) {
			mi = min(sum[i] - sum[ok - 1], sum[ok - 1]);
			ma = max(sum[i] - sum[ok - 1], sum[ok - 1]);
		}
		else {
			mi = min(sum[i] - sum[ok], sum[ok]);
			ma = max(sum[i] - sum[ok], sum[ok]);
		}
		ng = i, ok = n;
		while (ok - ng > 1) {
			mid = (ok + ng) / 2;
			if (sum[mid] - sum[i] >= sum[n] - sum[mid]) {
				ok = mid;
			}
			else {
				ng = mid;
			}
		}
		if (abs(sum[ok] - sum[i] - sum[n] + sum[ok]) > abs(sum[ok - 1] - sum[i] - sum[n] + sum[ok - 1])) {
			mi = min({ mi,sum[ok - 1] - sum[i],sum[n] - sum[ok - 1] });
			ma = max({ ma,sum[ok - 1] - sum[i],sum[n] - sum[ok - 1] });
		}
		else {
			mi = min({ mi,sum[ok] - sum[i],sum[n] - sum[ok] });
			ma = max({ ma,sum[ok] - sum[i],sum[n] - sum[ok] });
		}
		ans = min(ans, ma - mi);
	}
	cout << ans << endl;
}

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

ll knapsack(vector<ll>& weights,vector<ll>& values,ll n,ll weight){
	vector<vector<ll>> dp(n+1,vector<ll>(weight+1,0));
	ll ans=0;
	// initialise the row 1
	for(int j=weights[1];j<=weight;++j)
		dp[1][j]=values[1];
	// filling the rest of the DP
	for(ll i=2;i<=n;++i){
		for(ll j=1;j<=weight;++j){
			ll option1=dp[i-1][j];// Dont choose ith element
			ll option2=0;
			// choose the element if possible
			if(j-weights[i]>0)
				option2=dp[i-1][j-weights[i]]+values[i];	
			// choose max of both available options
			dp[i][j]=max(option1,option2);
		}
	}
	// choose max of all the values after consider all the weights 
	for(int j=1;j<=weight;++j){
		ans=max(ans,dp[n][j]);
	}
	return ans;
}



int main(){
	ll n=0;cin>>n;
	ll weight=0;cin>>weight;
	vector<ll> weights(n+1);
	vector<ll> values(n+1);
	values[0]=weights[0]=0;
	for(int i=1;i<=n;++i){
		weights[i]=0;values[i]=0;
		cin>>weights[i];cin>>values[i];
	}
	cout<<knapsack(weights,values,n,weight)<<endl;
	return 0;
}

Measured memory_bytes: 80256