akhauriyash/Code-Regression huggingface dataset:
#include <array>
#include <iostream>
#include <map>
#include <vector>

//! @brief Regard Map of {key, count} to record count of key, initialize with 0 if key not found, then add
//! adding to key's count.
template <typename Map, typename Value = typename Map::mapped_type>
Value &
MapAddCount(Map &map, typename Map::key_type key, Value adding)
{
    auto [it, flag] = map.try_emplace(key, 0);
    (void)flag;
    auto &count = it->second;
    count += adding;
    return count;
}

inline constexpr std::size_t BufferSize = 1024;

int
main()
{
    std::ios::sync_with_stdio(false);

    std::size_t valueCount;
    std::cin >> valueCount;

    std::vector<int> values(valueCount);

    for (std::size_t i = 0; i<valueCount; ++i)
    {
        std::cin >> values[i];
    }

    std::size_t operationCount;
    std::cin >> operationCount;

    std::vector<int> oldValues(operationCount);
    std::vector<int> newValues(operationCount);

    for (std::size_t i = 0; i<operationCount; ++i)
    {
        std::cin >> oldValues[i];
        std::cin >> newValues[i];
    }

    long long sum = 0;
    std::map<int, int> valueCounts;
    for (auto &value : values)
    {
        MapAddCount(valueCounts, value, 1);
        sum += value;
    }

    for (std::size_t i = 0; i<operationCount; ++i)
    {
        auto oldValue = oldValues[i];
        auto newValue = newValues[i];

        auto findOldValue = valueCounts.find(oldValue);
        if (findOldValue==valueCounts.end())
        {
            std::cout << sum << "\n";
            continue;
        }

        auto count = findOldValue->second;
        sum -= static_cast<long long>(oldValue)*count;
        sum += static_cast<long long>(newValue)*count;

        MapAddCount(valueCounts, newValue, count);
        valueCounts.erase(oldValue);
        std::cout << sum << "\n";
    }
}


Measured memory_bytes: 7472
//marico el que lo lea
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <assert.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;

void fastIO() {
	std::ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
}

#define FOR(i,f,t) for(int i=f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=f; i>(int)t; i--)
#define FORE(i,c) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define all(obj) obj.begin(), obj.end()
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define ms2(obj, val, sz) memset(obj, val, sizeof(obj[0])*sz)

#define fst first
#define snd second

template<typename T, typename U> inline void mnze(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void mxze(T &x, U y) { if(x < y) x = y; }

void _scan( int &x ) { scanf("%d",&x); }
void _scan( long long &x ) { scanf("%lld",&x); }
void _scan( double &x ) { scanf("%lf",&x); }
void _scan( char &x ) { scanf(" %c",&x); }
void _scan( char *x ) { scanf("%s",x); }
void scan() {}
template<typename T, typename... U>
void scan( T& head, U&... tail ) { _scan(head); scan(tail...);}

template<typename T> void _dbg(const char* sdbg, T h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename T, typename... U> void _dbg(const char* sdbg, T h, U... t) {
	while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(_i, (x)) cerr <<*_i <<", "; cerr <<"\n"; }}
#define debuga(x, sz) {{cerr <<#x <<" = "; FOR(_i, 0, sz) cerr << x[_i] <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debuga(x, sz)
#define cerr if(0)cout
#endif

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

const int MAXN = 102;

int N, a[MAXN];

int main(){
    scan(N); FOR(i,0,N) scan(a[i]);
    sort(a, a+N);
    bool pos=true;
    int r=a[0], d=a[N-1];
    if(a[0]==a[1]){
        if(d%2 == 0) pos=false;
        if(d!=2*r -1) pos=false;
    }else{
        if(d%2) pos=false;
        if(d!=2*r) pos=false;
    }
    if(N>2 && a[2]==r) pos=false;
    if(d < 2 && N>2) pos=false;
    FOR(i,0,N-1) if(a[i+1]-a[i] > 1) pos=false;
    if(a[N-1]!=a[N-2]) pos=false;
    printf(pos ? "Possible" : "Impossible");
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    char x, y;
    scanf("%c %c", &x, &y);
    if (x < y)
    {
        printf("<\n");
    }
    else if (x > y)
    {
        printf(">\n");
    }
    else
    {
        printf("=\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#define MAX 101
using namespace std;

typedef map<string,vector<int> > P;

int main()
{
    P p;
    string str[MAX];
    int i = 0;
    while (cin >> str[i]) {
        int t;
        cin >> t;
        p[str[i]].push_back(t);
        i++;
    }
    for (int k = 0; k < i; k++) {
        sort(p.at(str[k]).begin(), p.at(str[k]).end());
    }
    sort(str, str + i);
    string s = str[0];
    for (int k = 0; k < i; k++) {
        s = str[k];
        cout << s << endl << p[s][0];
        for (int j = 1; j < p[s].size(); j++) {
            cout << " " << p[s][j];
        }
        cout << endl;
        while (i > k && str[k] == s) k++;
        k--;
    }

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

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

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

int main()
{
  int h, w; cin >> h >> w;
  vector<vector<int>> a(h, vector<int>(w));
  rep(i, h) rep(j, w) cin >> a[i][j];
  vector<tuple<int, int, int, int>> ans;
  for(int k = 0; k < h*w-1; ++k) {
    int i = k/w;
    int j = k%w;
    if(i%2==1) j = w-1-j;
    if(a[i][j]%2 == 0) continue;
    int ni = (k+1)/w;
    int nj = (k+1)%w;
    if(ni%2==1) nj = w-1-nj;
    ++a[ni][nj];
    ans.push_back(make_tuple(i+1, j+1, ni+1, nj+1));
  }
  cout << ans.size() << endl;
  for(auto x : ans) cout << get<0>(x) << " " << get<1>(x) << " " << get<2>(x) << " " << get<3>(x) << endl;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------

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

    ll n, k;
    cin >> n >> k;
    vll a(n);
    REP(i,n) cin >> a[i];

    ll hog = 0;

    ll pre = a[hog];

    for(ll i=k;i<n;i++){
        if(pre<a[i]){
            yes();
        }
        else{
            no();
        }
        hog++;
        pre = a[hog];
    }

    
    return 0;
}



Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define all(a) (a).begin(),(a).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=10000000000000000;
 
 
int main(){
    string s;
    cin >> s;
    int ans=s.size();
    int l=s.size();
    rep(i,s.size()-1){
        if (s.at(i)!=s.at(i+1)){
            ans=min(ans,max(i+1,l-i-1));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
/**


  ######                                                                     ######   #     #  #######
  #     #    ##    #####   #    #  #    #  #    #  #   ####   #    #  #####  #     #  #     #       #
  #     #   #  #   #    #  #   #   #   #   ##   #  #  #    #  #    #    #    #     #  #     #      #
  #     #  #    #  #    #  ####    ####    # #  #  #  #       ######    #    ######   #######     #
  #     #  ######  #####   #  #    #  #    #  # #  #  #  ###  #    #    #    #   #    #     #    #
  #     #  #    #  #   #   #   #   #   #   #   ##  #  #    #  #    #    #    #    #   #     #   #
  ######   #    #  #    #  #    #  #    #  #    #  #   ####   #    #    #    #     #  #     #  #######



**/
/*

    BismiLLAHIR RAHMANIR RAHIM
    It's not how you look or who you are underneath, it's what you do that defines you

                                ------********-------

    Status : ;
    TC: xxx/xxx;
    DOS: ;
    OJ: ;

*/

#include <bits/stdc++.h>

using namespace std;

#define test        cout<<"thiq ase boss"<<endl;
#define PB          push_back
#define PF          push_front
#define PII         pair <int,int>
#define MII         map <int,int>
#define MSI         map <string,int>
#define MIS         map <int,string>
#define MLI         map <long long int,int>
#define MIL         map <int,long long int>
typedef long long int           LL;
typedef vector <string>         VS;
typedef vector <int>            VI;
typedef vector <char>           VC;
typedef vector <LL>             VLL;

const int INF = 1e9;
const int MX = 1e9;
const double PI = acos(-1);

/* Functions */

int main() {
    #ifdef LU_SERIOUS
        freopen("get.txt","r",stdin);
    #endif // LU_SERIOUS
    int t,cs=0,n,l,r,i,j,x,y,h,w;
    bool pr;
    string s,a,b,c,d,cns;
    while (cin >> s) {
        pr = 1;
        a = "dream"; b = "dreamer"; c = "eraser"; d = "erase";
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        reverse(c.begin(),c.end());
        reverse(d.begin(),d.end());
        cns = "";
        for (i = s.size() - 1; i >= 0; i--) {
            cns += s[i];
            if (cns == a) cns = "";
            if (cns == b) cns = "";
            if (cns == c) cns = "";
            if (cns == d) cns = "";
            else if (cns.size() > 7) {
                pr = 0;
                break;
            }
        }
        if (pr) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}



Measured memory_bytes: 512
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	void doIt() {
		sA();
	}
	
	void sA() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(b % a == 0) {
			System.out.println(a + b);
		}
		else System.out.println(b - a);
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
}


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

using namespace std;
#define ll long long int

ll arr[123456];
ll dp[123456];

int main() {
    int n;
    int k;
    cin >> n >> k;

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

    dp[0] = 0;

    for (int i = 1; i < n; i++) {
        dp[i] =  dp[i-1] + abs(arr[i] - arr[i-1]);
        for (int j = 2; j <= k; j++) {
            if (i >= j) {
                dp[i] = min(dp[i], dp[i-j] + abs(arr[i] -arr[i-j]));
            }
        }
    }

    cout << dp[n-1] << endl;

    return 0;
}
    

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
using namespace std;
const int INF = (1e9);

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> H(N), dp(N,INF);
  for(int i = 0; i < N; ++i) cin >> H[i];
  dp[0] = 0;
  for(int i = 1; i < N; ++i){
    for(int j = 1; j <= K; ++j){
      if(j > i) break;
      dp[i] = min(dp[i],dp[i-j]+abs(H[i]-H[i-j]));
    }
  }
  cout << dp[N-1] << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#define N 500005
using namespace __gnu_pbds;
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
LL z = 1;
int read(){
	int x, f = 1;
	char ch;
	while(ch = getchar(), ch < '0' || ch > '9') if(ch == '-') f = -1;
	x = ch - '0';
	while(ch = getchar(), ch >= '0' && ch <= '9') x = x * 10 + ch - 48;
	return x * f;
}
int ksm(int a, int b, int p){
	int s = 1;
	while(b){
		if(b & 1) s = z * s * a % p;
		a = z * a * a % p;
		b >>= 1;
	}
	return s;
}
int a[N];
int f[N];
struct node{
	int a, b;
}d[N];
void work(node &t, int x){
	if(t.a == x || t.b == x) return;
	if(a[t.a] < a[x]) t.b = t.a, t.a = x;
	else if(a[t.b] < a[x]) t.b = x;
}
int main(){
	int i, j, t, n, m;
	n = read();
	for(i = 0; i < (1 << n); i++) a[i] = read(), d[i].a = i;
	for(i = 1; i < (1 << n); i++){
		for(j = 0; j < n; j++){
			if(1 << j & i){
				t = i ^ (1 << j);
				work(d[i], d[t].a);
				work(d[i], d[t].b);
			}
		}
		f[i] = a[d[i].a] + a[d[i].b];
	}
	for(i = 1; i < (1 << n); i++){
		f[i] = max(f[i], f[i - 1]);
		printf("%d\n", f[i]);
	}
	return 0;
}


Measured memory_bytes: 9984
/**
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define ll long long int
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
#define nl cout<<"\n";
using namespace std;
const ll c=1e9+7;
int main()
{
IOS
ll n;
cin>>n;
vector<ll> v(1000000),a(n);
ll sum=0;
for(ll i=0;i<n;i++)
{
    cin>>a[i];
    v[a[i]]++;
    sum+=a[i];
}
ll q;
cin>>q;
while(q--)
{
   ll x,y;
   cin>>x>>y;
   v[y]+=v[x];
   sum+=(y-x)*v[x];
   v[x]=0;
   cout<<sum;
   nl
}
return 0;
}



Measured memory_bytes: 11908
a,b,c,d = map(int,input().split())
A = c - a 
B = d - b 

ans = ''

ans +='R'*A + 'U'*B
ans +='L'*A + 'D'*B
ans +='L'+'U'*B+'U'+'R'*A +'R'+'D'
ans +='R'+'D'*B+'D'+'L'*A +'L'+'U'
print(ans)
# print('UURDDLLUUURRDRDDDLLU')

Measured memory_bytes: 3060
fun main(args: Array<String>) {
    val (A, B) = listOfInt()
    var ans = 0
    var sum = 1
    while (sum < B) {
        sum += (A - 1)
        ans++
    }
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }

Measured memory_bytes: 35984
from collections import defaultdict as dd

s = raw_input().strip()
n = len(s)
x, y = map(int, raw_input().strip().split())

stx = 0
while stx < n and s[stx] == "F":
    stx += 1

sty = 0

X, Y = range(2)

x_blocks = []
y_blocks = []
curr = 0
cdi = X

for i in xrange(stx, n):
    ch = s[i]
    if ch == "F":
        curr += 1
    else:
        if curr != 0:
            if cdi == X:
                x_blocks.append(curr)
            else:
                y_blocks.append(curr)
        curr = 0
        cdi = (cdi + 1) % 2
if curr != 0:
    if cdi == X:
        x_blocks.append(curr)
    else:
        y_blocks.append(curr)

curr = dd(int)
curr[stx] = 1

for xb in x_blocks:
    nxt = dd(int)

    for key in curr.iterkeys():
        nxt[key + xb] += 1
        nxt[key - xb] += 1

    curr = nxt

if x not in curr:
    print "No"
    exit()

curr = dd(int)
curr[sty] = 1

for yb in y_blocks:
    nxt = dd(int)

    for key in curr.iterkeys():
        nxt[key + yb] += 1
        nxt[key - yb] += 1

    curr = nxt

if y not in curr:
    print "No"
else:
    print "Yes"




Measured memory_bytes: 3664
#include<stdio.h>
#define MAX 10000
#define NIL -1

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

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

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

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

int main() {
    int i, v, l, r, root;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        T[i].p = NIL;
    }
    
    for (i = 0; i < n; i++) {
        scanf("%d %d %d", &v, &l, &r);
        T[v].l = l;
        T[v].r = r;
        if (l != NIL) T[l].p = v;
        if (r != NIL) T[r].p = v;
    }
    
    for (i = 0; i < n; i++) if (T[i].p == NIL ) root = i;
    
    printf("Preorder\n");
    preParse(root);
    printf("\n");
    printf("Inorder\n");
    inParse(root);
    printf("\n");
    printf("Postorder\n");
    postParse(root);
    printf("\n");
    
    return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define MSET(x,y) memset(x,y,sizeof(x))
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 100005
#define ll long long
#define ld long double
#define INF 1e18
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
ll MOD = 1000000007;
string yes = "YES\n";
string no = "NO\n";
#define PI 3.1415926535 
 
 
int32_t main() {
    fastio;
    ll n;
    cin>>n;
    vector<ll> a;
    for(ll i=0;i<1000;i++) {
        ll rem = n%26;
        a.PB(rem);
        n-=rem;
        if(rem == 0) n -= 26;
        n /= 26;
        if(n == 0) break;
    }
    reverse(a.begin(), a.end());
    for(ll i=0;i<a.size();i++) {
        char ch = 'a' + (a[i]-1+26)%26;
        cout<<ch;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3640
import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            StringBuilder sb = new StringBuilder();
            int i=1;
            while(true){
                int data = Integer.parseInt(br.readLine());
                if(data == 0){
                    break;
                }else{
                    sb.append("Case ").append(Integer.toString(i++)).append(": ").append(Integer.toString(data)).append("\n");
                }
            }
            System.out.print(sb);
        }
        catch(Exception e){
            System.out.println(e);
        }
    }
}

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> s(n);
    vector<int> c(n, -1);
    rep(i, m){
        int ss, cc;
        cin >> ss >> cc;
        if(ss == 1 && cc == 0 && n != 1){
            cout << -1 << endl;
            return 0;
        }
        if(c[ss-1] != -1 && cc != c[ss-1]){
            cout << -1 << endl;
            return 0;
        }
        c[ss-1] = cc;
    }
    int ans = 0;
    rep(i, n){
        if(i == 0 && c[i] == -1 && n != 1){
            c[i] = 1;
        }else if(i == 0 && c[i] == -1 && n == 1){
            c[i] = 0;
        }else if(i > 0 && c[i] == -1){
            c[i] = 0;
        }
    ans += pow(10, n-1-i) * c[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// need
#include <iostream>
#include <algorithm>
// data structure
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
//#include <deque>
#include <valarray>
#include <unordered_map>
#include <array>
// stream
//#include <istream>
#include <sstream>
//#include <ostream>
#include <fstream>
// etc
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
//#include <chrono>
#include <random>
#include <numeric>
using namespace std;

int main()
{
  int N, count;
  string A, B, C;
  cin >> N >> A >> B >> C;
  count = 0;
  for(int i = 0; i < N; i++){
    if(A[i] == B[i]){
      if(B[i] != C[i])
        count++;
    }
    else if(B[i] == C[i]){
      if(C[i] != A[i])
        count++;
    }
    else if(C[i] == A[i]){
      if(A[i] != B[i])
        count++;
    }
    else
      count += 2;
  }
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
int main() {
	map<long long, long long> wow;
	int n;
	cin >> n;
	REP(i, n) {
		int tmp;
		cin >> tmp;
		wow[tmp]++;
	}
	long long ans = 0;
	for (auto i = wow.begin();i != wow.end();++i) {
		if (i->first <= i->second) {
			ans += i->second - i->first;
		}
		else ans += i->second;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6272
#include<stdio.h>

int main(){


  char w1[3],w2[3];
  int  c=0,i=0,s=0;

  scanf("%s",w1);
  scanf("%s",w2);

  if(w1[0] == w2[0]){
    c = c + 1;
  }
  if(w1[1] == w2[1]){
    c = c + 1;
  }
  if(w1[2] == w2[2]){
    c = c + 1;
  }

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

  return 0;

}


Measured memory_bytes: 128
using System;

class Program {
    private static int Main() {
        var input = Console.ReadLine();
        
        double r = double.Parse( input );

        var area = r * r * Math.PI;
        var length = 2 * r * Math.PI;

        var output = string.Format( "{0} {1}", area, length );
        Console.WriteLine( output );

        return 0;
    }
}

Measured memory_bytes: 5744
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

LL dp[2010][2010];

int main() {
	int n, m; cin >> n >> m;
	vector<int> s(n+1);

	for (int i = 1; i < n+1; i++) {
		cin >> s[i];
	}
	vector<int> t(m+1);

	for (int i = 1; i < m+1; i++) {
		cin >> t[i];
	}

	for (int i = 0; i < n+1; i++) {
		dp[i][0] = 1;
	}

	for (int i = 0; i < m+1; i++) {
		dp[0][i] = 1;
	}

	for (int i = 1; i < n+1; i++) {
		for (int j = 1; j < m+1; j++) {
				
			dp[i][j] = dp[i - 1][j]+dp[i][j-1];
			dp[i][j] %= MOD;

			if (s[i] != t[j]) {
				dp[i][j] -= dp[i - 1][j - 1];
				dp[i][j] += MOD;
				dp[i][j] %= MOD;
			}
			
		}
	}

	cout << dp[n][m] << endl;

	return 0;
}

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

int main()
{
  int x;
  cin >> x;
  
  if(x==0){
    cout << 1 << endl;
  }
  if(x==1){
    cout << 0 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3600
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;

double cos_theorem(double A, double B, double angle) {
  double C = 0;
  C = sqrt(A * A + B * B - 2 * A * B * cos(angle));

  return C;
}

int main() {
  double A, B, H, M;
  cin >> A >> B >> H >> M;

  // それぞれの角度
  double h_angle = 0.5 * (60 * H + M);
  double m_angle = 6 * M;

  // 角度の差の絶対値
  double angle_diff = fabs(m_angle - h_angle);
  if (angle_diff > 180) angle_diff = 360 - angle_diff;
  angle_diff = angle_diff * M_PI / 180;
  // cout << angle_diff << endl;

  // 余弦定理
  cout << fixed << setprecision(15) << cos_theorem(A, B, angle_diff) << endl;
}

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

int main(){
  int a, b, c, x;
  cin >> a >> b >> c >> x;

  int left, res = 0;

  for (int i=0; i<=a; i++)  {
    left = x - i * 500;
    if (left < 0) break; 

    for (int j=0; j<=b; j++){
      for (int k=0; k<=c; k++) {
        if (left == j*100 + k*50) res++;
      }
    }
  }

  cout << res << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const int N=100100;
inline int read(){
	int x=0,f=0,c=getchar();
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';c=getchar())
	x=(x<<1)+(x<<3)+c-'0';return f?-x:x;
}
inline void write(ll x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);putchar(x%10+'0');
}
int n,q[N],sm,sum,i;
int main(){
	//freopen("1.out","w",stdout);
	n=read();
	if(n==3){puts("2 5 63");return 0;}
	for(i=2;sm<n;i++){
		if(i%2==0||i%3==0){
			q[++sm]=i;sum+=i;
		}
	}
	if(sum%2||sum%3){
		sum-=q[sm];sm--;
		sum-=q[sm];sm--;
		for(i=q[sm]+1;sm<n-1;i++)
		if((i%2==0||i%3==0)&&((sum+i)%2==0)){
			q[++sm]=i;sum+=i;
		}
		for(i=q[sm]+1;sm<n;i++)
		if((i%2==0)&&((sum+i)%3==0)){
			q[++sm]=i;sum+=i;
		}
	}
	for(i=1;i<=n;i++)printf("%d ",q[i]);
	puts("");
	return 0;
}


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

signed main(){
    // cout << fixed << setprecision(10) << flush;

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    while(1){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main(){

    int N, H;
    cin >> N >> H;

    vector < pair<int, int> > AB(N);
    for (int i = 0; i < N; i++){
        int A, B;
        cin >> A >> B;
        AB[i].first = A;
        AB[i].second = B;
    }

    sort(AB.begin(), AB.end(), greater< pair<int, int> >() );
    int A = AB[0].first;

    vector <int> B(N);
    for (int i = 0; i < N; i++){
        B[i] = AB[i].second;
    }
    
    sort(B.begin(), B.end(), greater<int>());

    int last = N;
    for (int i = 0; i < N; i++){
        if (A >= B[i]){
            last = i;
            break;
        }
    }
    
    int sum = 0;
    int ans = 0;
    bool f = false;
    for (int i = 0; i < last; i++){
        sum += B[i];
        ans ++;
        if (sum >= H){
            f = true;
            break;
        }
    }
    
    if (f == false){
        int rest = H - sum; 
        if (rest % A == 0){
            ans += rest / A;
        }else{
            ans += rest / A + 1;
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
fun main(args: Array<String>) {
    val l = readLine()!!.split(" ").map{ it.toLong() }
    val h = l[0]
    val w = l[1]
    if (h == 1L || w == 1L) {
        println(1)
        return
    }
    val cOdd: Long
    val cEven: Long
    if (h % 2L == 0L) {
        cOdd = h/2L
        cEven = cOdd
    } else {
        cOdd = (h+1L)/2L
        cEven = cOdd - 1L
    }
    if (w % 2L == 0L) {
        println((cOdd+cEven)*w/2L)
    } else {
        println((cOdd+cEven)*(w-1)/2L + cOdd)
    }
}

Measured memory_bytes: 36184
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

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

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	x := nextInt()
	y := nextInt()
	z := nextInt()
	fmt.Println(z, x, y)
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		String n = sc.next();
		int san = n.charAt(0) - 48;
		int ok = san * 100 + san * 10 + san;
		if (Integer.parseInt(n) <= ok) {
			out.println(ok);
		} else {
			san = san + 1;
			ok = san * 100 + san * 10 + san;
			out.println(ok);
		}

		out.flush();

	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int N,K; cin >> N >> K;
    vector<int> A;
    REP(i,N){
        int a; cin >> a;
        if(a < K) A.push_back(a);
    }

    N = A.size();
    sort(ALL(A));
    int ng = (int)A.size();
    int ok = -1;

    while(abs(ok-ng)>1){
        //cout << ng << ", " << ok << endl;
        int mid = (ok+ng)/2;


        vector<vector<int>> dp(N+1, vector<int>(K, 0));
        dp[0][0] = 1;
        REP(i,N){
            REP(j,K){
                dp[i+1][j] |= dp[i][j];//縦の更新は常に

                if(j+A[i]<K && i!=mid){
                    dp[i+1][j+A[i]] |= dp[i][j];
                }
            }
        }
        REP(j,K-1) dp[N][j+1] += dp[N][j];
        int itr = lower_bound(ALL(dp[N]), dp[N][K-1]) - dp[N].begin();

        //cout << " " << itr << ", " << A[mid] << endl;
        if(itr + A[mid] < K){//ここに条件をかく
            ok = mid;
        }else{
            ng = mid;
        }
    }

    //cout << ng << ", " << ok << endl;
    cout << ok+1 << endl;
    return 0;
}

Measured memory_bytes: 101280
#include<bits/stdc++.h>
using namespace std;
string calc(int n){
  string s;int x=1;
  while(n){
    char c='0'+n%4;s=c+s; n/=4;
  }return s;
}
int main(){
  int n;
  while(cin>>n,n!=-1){
    if(n==0) cout << 0 << endl;
    else cout << calc(n) << endl;
  }
}


Measured memory_bytes: 3024
#include<bits/stdc++.h>
using namespace std;
int n;string s,t;
int main()
{
	cin>>n>>s>>t;
	for (int i=n;i>=0;i--){
		bool check=1;
		for (int p=0;p<i;p++)
			if (s[n-i+p]!=t[p]) check=0;
		if (check) return printf("%d\n",n*2-i),0;
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
int main() {
	string s;
	cin >> s;
	map<int, int> wow;
	int tmp = 0;
	REP(i, s.length()) {
		if (wow[s[i]] == 0) tmp++;
		wow[s[i]]++;
	}
	int minnest = 100000;
	int maxe = 0;
	for (int i = 'a';i <= 'c';++i) {
		maxe = max(maxe, wow[i]);
		minnest = min(minnest, wow[i]);
	}
	if (abs(maxe - minnest) <= 1) {
		cout << "YES" << endl;
	}
	else cout << "NO" << endl;
}

Measured memory_bytes: 512
n = int(input())
A = list(map(int, input().split()))
B = tuple(map(int, input().split()))

ans = 0
for i, b in enumerate(B):
    rem = max(0, b-A[i])
    ans += min(A[i], b)
    ans += min(A[i+1], rem)
    A[i+1] = max(0, A[i+1]-rem)

print(ans)


Measured memory_bytes: 98276
import bisect
import math
import sys
input = sys.stdin.readline


N = int(input())
A = list(map(int, input().split()))
A.sort()
A_set = []
num = []
a_cur = float('inf')
for a in A:
    if a != a_cur:
        A_set.append(a)
        num.append(1)
        a_cur = a
    else:
        num[-1] += 1

ans = 0
for i in range(len(A_set) - 1, -1, -1):
    if num[i] > 0:
        A_i = A_set[i]
        comp = 2 ** math.ceil(math.log(A_i + 1, 2)) - A_i
        j = bisect.bisect_left(A_set, comp, 0, i)
        while True:
            if A_set[j] == comp:
                if num[j] > 0:
                    if i != j:
                        ans += min(num[j], num[i])
                        num[j] = max(num[j] - num[i], 0)
                        break
                    elif num[j] >= 2:
                        add = num[j] // 2
                        ans += add
                        num[j] = num[j] % 2
                        break
                    else:
                        break
                else:
                    break
            else:
                break

print(ans)


Measured memory_bytes: 103120
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;

const long long MOD = 1000000007;
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
    int S;
    cin >> S;

    COMinit();

    int n = 1;
    long long ans = 0;
    while(S - 3 * n >= 0){
        ans += COM(S - 2 * n - 1, n - 1);
        ans = ans % MOD;
        n++;
    }
    cout << ans % MOD << endl;

}

Measured memory_bytes: 15560
N,M = map(int,input().split())
s = [[]for i in range(N)]
for i in range(M):
    a,b = map(int,input().split())
    s[a-1].append(b-1)
    s[b-1].append(a-1)
def func(x,n):
    if n == []:
        return 1
    r = 0
    for i in range(len(n)):
        if n[i] in s[x]:
            hoge = n.copy()
            a = hoge.pop(i)
            r += func(a,hoge)
    return r

print(func(0,list(range(1,N))))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll N;
    cin >> N;
    vec P(N);
    Rep (i, N) cin >> P[i];

    ll ans = 0;
    ll tmp = N+1;
    Rep (i, N) {
        if (tmp > P[i]) {
            ans++;
            tmp = P[i];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
s_l = list(input())
n = len(s_l)

# 公式解説参照
dp_dict = {0:1}
t = 0
x = 1
for i in range(n):
    a = int(s_l[-(i+1)])
    t = (t + a*x)%2019
    x = x*10 %2019
    dp_dict[t] = dp_dict.get(t,0) + 1

ans = 0
for val in dp_dict.values():
    ans += val*(val-1)//2

print(ans)


Measured memory_bytes: 10596
#include<iostream>
#include<bits/stdc++.h>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <stdio.h>
#include <map>
typedef long long ll;
using namespace std;
typedef pair<string,int> PAIR;


int main()
{
	int node[150];
	int n;
	cin>>n;
	int sum = 0;
	for(int i=0;i<n;i++)
	{
		int t;
		cin>>t;
		sum+=t;
		node[i]=t;
	}
	double t = 1.0*sum/n;
	int index1 = t;
	int index2 = t;
	if(index1!=t) index2 = t+1; 
	
	int ans1 = 0;
	int ans2 = 0;
	for(int i=0;i<n;i++)
	{
		ans1+=(node[i]-index1)*(node[i]-index1);
		ans2+=(node[i]-index2)*(node[i]-index2);
	}
	cout<<min(ans1,ans2)<<endl;
 } 

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//#pragma GCC target("avx2")  //Enable AVX
#include<bits/stdc++.h>
using namespace std;

#define all(a) begin(a),end(a)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

const int mod=1e9+7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int mul(int a,int b){
  return ((a)*1ll*(b))%mod;
}

void add(int &a,int b){
  a+=b;
  if(a>=mod)a-=mod;
}

int sub(int a,int b){
  a-=b;
  if(a<0){
    a+=mod;
  }
  return a;
}

int powz(int a,int b){
  int res=1;
  while(b){
    if(b&1){
      res=mul(res,a);
    }
    b/=2;
    a=mul(a,a);
  }
  return res;
}

template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
  input>>x.F>>x.S;
  return input;
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}

template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}

template<typename T>
vector<pair<T,int>> getvec(int n){
  vector<pair<T,int>>a(n);
  for(int i=0;i<a.size();i++){
    cin>>a[i].F;
    a[i].S=i;
  }
  return a;
}

const int N=200005;

void solve(){
  ll X;
  cin>>X;
  ll cr=100;
  ll ans=0;
  while(cr<X){
    ans++;
    cr+=cr/100;
  }
  cout<<ans;
}

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc=1;
  //cin>>tc;
  for(int _=0;_<tc;_++){
    // cout<<"Case #"<<_+1<<": ";
    solve();
    if(_!=tc-1){
      cout<<'\n';
    }
  }
}



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

int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  ll e=0;
  for(ll i=1;i<n;i++){
    if(s.at(i)=='E')
    e++;
  }
  ll w=0;
  vector<ll> a(n);
  a.at(0)=e;
  for(int i=1;i<n;i++){
    if(s.at(i-1)=='W')
    w++;
    if(s.at(i)=='E')
    e--;
    a.at(i)=w+e;
  }
  sort(a.begin(),a.end());
  cout << a.at(0) << endl;
}


Measured memory_bytes: 6164
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
    long long int i, j, k, n, l, r , d, ans=0, po=0;
    scanf("%lld %lld %lld", &l, &r, &d);
    printf("%lld", r/d - (l-1)/d);
    
}

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



int main(){
  int N;
  cin>>N;
  
  vector<int> vec(N);
  vector<int> vec2(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  for(int i=0;i<N;i++){
    cin>>vec2.at(i);
  }
  int deka=0;
  for(int i=0;i<N;i++){
    int sum=0;
    for(int j=0;j<=i;j++){
      sum+=vec.at(j);
    }
    for(int p=i;p<N;p++){
      sum+=vec2.at(p);
    }
    deka=max(deka,sum);
  }
  cout<<deka<<endl;
  
}

Measured memory_bytes: 3568
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int maxsize(0);
	vector<int> input;

	while (1)
	{
		int tmp;

		cin >> tmp;

		if (!tmp)
		{
			break;
		}

		input.push_back(tmp);

		(maxsize < tmp) ? (maxsize = tmp) : (0);
	}

	vector<int> prime, ans;

	for (int i(2); i <= maxsize; ++i)
	{
		for (vector<int>::iterator i2(prime.begin()), n2(prime.end()); i2 != n2; ++i2)
		{
			if ((i % *i2) == 0)
			{
				goto nx;
			}
		}

		prime.push_back(i);
		
		if (i != *prime.begin() && binary_search(prime.begin(), prime.end(), i - 2))
		{
			ans.push_back(i);
		}
		nx:;
	}

	for (vector<int>::iterator i(input.begin()), n(input.end()); i != n; ++i)
	{
		int out(*(--upper_bound(ans.begin(), ans.end(), *i)));

		cout << out - 2 << ' ' << out << endl;
	}	

	return 0;
}

Measured memory_bytes: 3192
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    ll ans=0;
    ans+=a[n-1];
    ll i=n-2;
    n-=2;
    while(n){
        if(n==1){
            ans+=a[i];
            n--;
        }else{
            ans+=2*a[i];
            n-=2;
            i--;
        }
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 4832