akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define V vector
#define pb push_back
#define mp make_pair
#define endl "\n"
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define MOD 1000000007  //1e9+7

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void solve()
{
	int a,b; cin>>a>>b;
	if(a%2!=b%2){
		cout<<"IMPOSSIBLE"<<endl;
		return;
	}
	cout<<(a+b)/2<<endl;
}
	
int32_t main()
{
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    //int t; cin>>t;
    //while(t--)
    solve();
    return 0;
}

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

int H, W;
string S[12];
bool U[12]; int K; int P[12];
bool R;

void check() {
  string buf(W, ' ');
  unordered_multiset<string> ss;
  for(int i = 0; i < H; ++i) {
    for(int j = 0; j < W; ++j) buf[j] = S[i][P[j]];
    ss.insert(buf);
  }
  bool failed = false;
  while(!ss.empty()) {
    auto it = ss.begin(); string s = *it; ss.erase(it);
    string r = s; reverse(r.begin(), r.end()); it = ss.find(r);
    if(it == ss.end()) {
      if(r == s && !failed) failed = true; else return;
    }
    else ss.erase(it);
  }
  R = true;
}

void go() {
  if(K == W / 2) { check(); return; }
  int s; for(s = 0; ; ++s) if(!U[s]) break;
  P[K] = s; U[s] = true;
  for(int t = 0; t < W; ++t) if(!U[t]) {
    P[W - 1 - K] = t; U[t] = true; ++K; go(); --K; U[t] = false;
  }
  U[s] = false;
}

int main() {
  cin >> H >> W;
  for(int i = 0; i < H; ++i) cin >> S[i];
  if(W % 2 == 0) go();
  else {
    for(int m = 0; m < W; ++m) {
      P[W / 2] = m; U[m] = true; go(); U[m] = false;
    }
  }
  cout << (R ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

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

    cout << (x-a)%b;
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

n,m,d=map(int,input().split())
biau=0

ans1=float(m-1)/n
goukei=1/2*n*(n-1)

if d==0:
    print(ans1)
    exit()
else:
    ans1=float(((m-1)-ans1)/goukei*(n-d))


            
print(ans1)                  

Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
    int hotel[4][3][10],i,j,k,test,b,f,r,v;
    for(i=0;i<4;i++){
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                hotel[i][j][k]=0;
            }
        }
    }
    scanf("%d",&test);
    for(i=0;i<test;i++){
        scanf("%d %d %d %d",&b,&f,&r,&v);
        hotel[b-1][f-1][r-1]+=v;
    }
	for(i=0; i<4; i++)
	{
		if(i>0) printf("####################\n");
			 for(j=0;j<3;j++){
			
            for(k=0;k<10;k++){
                printf(" %d",hotel[i][j][k]);
            }
            printf("\n");
        }





	}
   
   
    return 0;
}



Measured memory_bytes: 2140
N = int(input())
list = [int(a) for a in input().split()]

A = sum(list)//N
ans = 0

for k in range(N):
    ans = ans + (list[k] - A) ** 2

for i in range(-100,100):
    sum_new = 0
    for j in range(N):
        sum_new = sum_new + (list[j] - i) ** 2
    if(ans > sum_new):
        ans = sum_new

print(ans)


Measured memory_bytes: 9180
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>
#include <iomanip>

using namespace std;

//typedefリスト
typedef vector<long long int> vint;
typedef vector<string> vstr;
typedef long long int llint;

int main(void) {
    int jur=0;
	string S;
	cin>>S;
	for(int i=1;i<4;i++){
	    if(S[i]==S[i-1])jur++;
	}
	if(jur)cout<<"Bad"<<endl;
	else cout<<"Good"<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <algorithm>
using namespace std;
//B - Polygon
int main(void){
    int n;
    std::cin >> n;
    std::vector<int> edge(n);
    for(int i=0;i<n;i++){
        std::cin >> edge[i];
    }
    sort(edge.begin(),edge.end());
    int sum=0;
    for (int i=0;i<n-1;i++) {
        sum+=edge[i];
    }
    if(edge[n-1]<sum){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define ALL(v) v.begin(), v.end()
const int INF = 1e9;
const int MAX = 2000000;
const int MOD = 1000000007;
using namespace std;
typedef long long ll;

/*DP使ったほうがよくない？？WOWWOW*/

int main(){
  int N; cin>>N;
  int A[N];
  double mother=0;
  for(int i=0; i<N; i++){
    cin>>A[i];
    double inv=1.0/A[i];
    mother+=inv;
  }
  double ans=1.0/mother;
  cout << fixed << setprecision(13)<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <string>
#include <cmath>

using ll = long long;
using namespace std;


int main() {
	ll n, m;
  	ll dp[100010];
  	cin >> n >> m;
  	ll broken[100010];
  
  	for(ll i=0;i<100010;i++) broken[i] = 1;
  
  	for(ll i=0;i<m;i++) {
    	ll t;
     	cin >> t;
      	broken[t] = 0;
    }
  	
  	dp[0] = 1;
  	dp[1] = broken[1];
  
  	for(ll i=2;i<100010;i++) {
      
    	dp[i] = (dp[i-1]*broken[i-1] + dp[i-2]*broken[i-2]) % 1000000007;
    }
  	
  	cout << dp[n] << endl;
}

Measured memory_bytes: 5192
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string.h>
#include <iomanip>
using namespace std;
#define int long long
#define ull unsigned long long
#define F first
#define S second
#define nl "\n"
#define ld long double
#define div 1000000007
#define pi 3.14159265358979323846
#define pb push_back

ull power(ull a,ull b)
{
    if(b==0)
        return 1;
    else if(b%2==0)
        return power(a*a,b/2);
    else
        return a*power(a*a,(b-1)/2);
}

void solve()
{
    ull n;cin>>n;
    long double x=n*25/26.0;
    x+=1;x=log(x)/log(26);
    x=ceil(x);int len=x;
    ull temp=26*(power(26,x-1)-1)/25;
    char ans[len];
    for(int i=0;i<len;i++)
    {
        for(char ch='a';ch<='z';ch++)
        {
            ull z=power(26,len-i-1);
            if(temp+z<n)
                temp+=z;
            else
            {
                ans[i]=ch;
                break;
            }
        }
    }
    for(int i=0;i<len;i++)
        cout<<ans[i];
    cout<<nl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);

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


Measured memory_bytes: 3680
// template version 1.9

// varibable settings {{{
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

#define int long long
const int INF=1e18;
const int MOD=1e9+7;
#define infile "../test/sample-1.in"
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;
// }}}

int n;

int calc(int r){
  if (n%r!=0) return 0;
  else{
    return n/r-1;
  }
}

int solve(){
  cin>>n;
  int res=0;
  int s = sqrt(n);
  dump(s);
  rep(i, 1, s+1){
    if (n/i == n%i) res+=i;
  }
  int r=n/(s+1);
  dump(r);
  while(r>0){
    int x = calc(r);
    if (x>=s+1) res += x;
    // dump(r, calc(r));
    r--;
  }
  cout << res << endl;
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
input=(input.trim()).replace(/([a-z])|([A-Z])/g,function(s,s1,s2){
if(s1)s=s1.toUpperCase();
if(s2)s=s2.toLowerCase();
return s;
});
console.log(input);

Measured memory_bytes: 8704
N,M=gets.chomp.split(" ").map(&:to_i).sort
diff = (N - M).abs
mod = 10**9 + 7
if diff > 1
    puts 0
    exit
end

ret = (1..N).inject(1){|i,j| i*j%mod }

if diff == 1
    puts ret*ret*M % mod
else
    puts ret*ret*2 % mod
end


Measured memory_bytes: 1916
#include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
using namespace std;
typedef long long int64;
inline int64 read(int f = 1, int64 x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int p[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37}, S = 127;
const int N = 1e5+5;
int64 qpow(int64 a, int64 b, int64 n)
{
    int64 ret = 1;
    for( ; b; b >>= 1, a = a*a%n) if(b&1) ret = a*ret%n;
    return ret;
}
int64 gcd(int64 a, int64 b) { return b?gcd(b, a%b):a; }
bool miller_rabin(int64 n)
{
    if(n == 1) return false;
    for(int i = 0; i < 12; ++i) if(n%p[i] == 0) return n == p[i];
    int64 r; int t;
    for(r = n-1, t = 0; ~r&1; r >>= 1, ++t);
    for(int i = 0; i < 12; ++i)
    {
        int64 x = qpow(p[i], r, n), xs;
        for(int j = 1; j <= t; ++j)
        {
            xs = x*x%n;
            if(xs == 1&&x != 1&&x != n-1) return false;
            x = xs;
        }
        if(x != 1) return false;
    }
    return true;
}
vector<int64> pd;
int n, c[N], ans;
int64 a[N], b[N];
map<int64, int> h, vis;
int main()
{
    n = read();
    for(int i = 1; i <= 2200; ++i) if(miller_rabin(i)) pd.push_back(i); 
    for(int i = 1; i <= n; ++i)
    {
        int64 x = read(), t; a[i] = b[i] = 1;
        for(int k = 0; k < pd.size(); ++k)
        {
            c[k] = 0; while(x%pd[k] == 0) ++c[k], x /= pd[k]; c[k] %= 3;
            if(c[k] == 2) a[i] *= pd[k]*pd[k], b[i] *= pd[k];
            else if(c[k] == 1) a[i] *= pd[k], b[i] *= pd[k]*pd[k];
        }
        t = sqrt(x);
        if(t*t == x) a[i] *= t*t, b[i] *= t;
        else a[i] *= x, b[i] *= x*x;
        ++h[a[i]];
    }
    for(int i = 1; i <= n; ++i)
    {
        if(vis[a[i]]||vis[b[i]]||a[i] == 1) continue;
        vis[a[i]] = 1; ans += max(h[a[i]], h[b[i]]);
    }
    printf("%d\n", ans+(h[1] != 0));
    return 0;
}

Measured memory_bytes: 26752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
void chmin(int &a, int b) {if(a > b) a = b;}
void chmax(int &a, int b) {if(a < b) a = b;}

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};


int main(){
    int n;
    cin >> n;
    vll a(n), b(n), c(n);
    rep(i,0,n) cin >> a[i];
    rep(i,0,n) cin >> b[i];
    rep(i,0,n) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    ll ans = 0;
    for(int i = 0 ; i < n ; i++){
        ll x = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
        ll y = c.end() - upper_bound(c.begin(), c.end(), b[i]);
        ans += x*y;
    }
    printf("%lld", ans);
}

Measured memory_bytes: 2688
import java.lang.Math.abs
import java.util.*


fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    val diff = abs(a-b)
    val ans = (diff * (diff-1) /2)-a
    println("$ans")
}


Measured memory_bytes: 29472
from math import ceil

A, B = map(int, input().split())

W = 52
R1 = ceil((A - 1) / ((W - 2) // 2))
R2 = ceil((B - 1) / (W // 2))
H = 1 + R1 * 2 + R2 * 2
print(H, W)

print('#' * (W - 1) + '.')

A -= 1
for i in range(R1):
    num = min(max(A, 0), (W - 2) // 2)
    print('#' + '.#' * num + '..' * ((W - 2) // 2 - num) + '.')
    print('#' * (W - 1) + '.')
    A -= (W - 2) // 2

B -= 1
for i in range(R2):
    num = min(max(B, 0), W // 2)
    print('.' * W)
    print('#.' * num + '..' * (W // 2 - num))
    B -= W // 2


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define x second
#define y first
using namespace std;

typedef complex<double> point;
typedef pair<int,int> P;
P a[100000];
vector<int> st;
bool ccw(point a,point b,point c){
  b-=a,c-=a;
  c*=conj(b);
  if(c.imag()<=0)return true;  
  return false;
}
 
void check(int i){
  while((int)st.size()>=2){
    int s=st[(int)st.size()-2];
    int e=st[(int)st.size()-1];
    point S=point(a[s].x,a[s].y);
    point E=point(a[e].x,a[e].y);
    point N=point(a[i].x,a[i].y);
    if(ccw(S,E,N))break;
    st.pop_back();
  }
  st.push_back(i);
}
 
int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;
  sort(a,a+n);
  for(int i=0;i<n;i++)check(i);
  for(int i=n-2;i>=0;i--)check(i);
  
  cout<<(int)st.size()-1<<endl;
  for(int i=(int)st.size()-1;i>0;i--)cout<<a[st[i]].x<<' '<<a[st[i]].y<<endl;
  return 0;
}

Measured memory_bytes: 2456
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
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();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
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;}

int main(){
  ll N,cnt=0;
  cin>>N;
  bool CAN=true;
  
  while(N>9){
    if(N%10!=9) CAN=false;
    N/=10;
    cnt++;
  }
  
  if(CAN) co(N+cnt*9);
  else co(N+cnt*9-1);
  return 0;
}

Measured memory_bytes: 256
W = input()
dic = {}
for w in W:
  if w in dic:
    dic[w] += 1
  else:
    dic[w] = 1
flg = True
for v in dic.values():
  if v % 2 != 0:
    flg = False
if flg:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include<cstdio>
#include<vector>
using namespace std;
int main(){
    for(;;){
        int a,b,n;
        scanf("%d%d",&a,&b);
        if(a==0&&b==0)break;
        vector<vector<int> > ps(a,vector<int>(b,0));
        scanf("%d",&n);
        int x,y;
        for(int ix=0;ix<n;ix++){
            scanf("%d%d",&x,&y);
            ps[x-1][y-1]=-1;
        }
        ps[0][0]=1;
        for(int i=0;i<a;i++){
            for(int j=0;j<b;j++){
                if(ps[i][j]!=-1){
                    if(i-1>=0&&ps[i-1][j]!=-1)ps[i][j]+=ps[i-1][j];
                    if(j-1>=0&&ps[i][j-1]!=-1)ps[i][j]+=ps[i][j-1];
                }
            }
        }
        printf("%d\n",ps[a-1][b-1]);
    }
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

#define LANG 1000000
bool visited[10000000] = {};
ll n, m;
vector<vector<ll>> c(10000000);

void dfs(ll x){
    visited[x] = true;
    rep(i, c[x].size()){
        if(visited[c[x][i]])continue;
        dfs(c[x][i]);
    }
}
int main(){
    ll n, m;
    cin >> n >> m;
    rep(i, n){
        ll k;
        cin >> k;
        rep(j, k){
            ll l;
            cin >> l;
            c[i].push_back(l+LANG);
            c[l+LANG].push_back(i);
        }
    }
    dfs(0);
    rep(i, n)if(!visited[i]){
        cout << "NO";
        return 0;
    }
    cout << "YES";
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,k,s;
    cin >> n >> k >> s;
    vector<int> ans(n,0);
    int t=n-k+1;
    if(k==0){
        rep(i,n){
            if(ans[i]==0 && s!=1000000000) ans[i]=s+1;
            else if(ans[i]==0 && s==1000000000) ans[i]=1;
        }
        rep(i,n) cout << ans[i] << "\n";
        return 0;
    }
    int x=s/t;
    int y=s-x*t;
    if(x==0){
        rep(i,k+s-1) ++ans[i];
        rep(i,n){
            if(ans[i]==0 && s!=1000000000) ans[i]=s+1;
            else if(ans[i]==0 && s==1000000000) ans[i]=1;
        }
    }else{
        rep(i,n){
            ans[i]+=x;
            if(i%t==0) ans[i]+=y;
        }
    }
    rep(i,n) cout << ans[i] << "\n";
    return 0;
}   

Measured memory_bytes: 3708
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	complex<double> a,b,c,p;
	while(cin>> a.real()>> a.imag()){
		cin>> b.real()>> b.imag();
		cin>> c.real()>> c.imag();
		cin>> p.real()>> p.imag();
		
		complex<double> B,C,P;
		B = b - a;
		C = c - a;
		P = p - a;
		double b1 = B.real();
		double b2 = B.imag();
		double c1 = C.real();
		double c2 = C.imag();
		double p1 = P.real();
		double p2 = P.imag();
		
		//p = xB+yC
		double x = (p1*c2-p2*c1) / (b1*c2-b2*c1);
		double y = (p2*b1-p1*b2) / (b1*c2-b2*c1);
		
		if(0<x && 0<y && 0<x+y && x+y<1){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(5);
	solve();

	return 0;
}

 

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int N;
  cin >> N;
  string ans;
  if (N < 1000)
    ans = "ABC";
  else
    ans = "ABD";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<deque>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

struct UnionFind{
    vector<int> par;

    //コンストラクタ
    UnionFind(int N) : par(N) {
        for(int i=0;i<N;i++) par[i]=-1;
    }

    int root(int x){
        if(par[x]<0) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x,int y){
        int rx = root(x);
        int ry = root(y);
        if(rx==ry) return;

        if(size(rx)<size(ry)) swap(rx,ry);

        par[rx] += par[ry];
        par[ry] = rx;
    }

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

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

};


int main(){
    ll n,m;
    cin >> n >> m;
    //構造体名 オブジェクト名
    UnionFind tree(n);
    vector<ll> a(m),b(m);
    rep(i,m){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());

    vector<ll> ans(m);
    ans[0] = (ll)n*(n-1)/2;
    for(int i=1;i<m;i++){
        ans[i] = ans[i-1];
        ll n1 = a[i-1];
        ll n2 = b[i-1];
        if(!tree.same(n1,n2)) ans[i] -= (ll)tree.size(n1)*tree.size(n2);
        tree.unite(n1,n2);
    }

    for(int i=m-1;i>=0;i--){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 4096
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100005;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,w;
    cin >> h >> w;
    ll n;
    cin >> n;
    vector<vector<ll>> ans(h,vector<ll>(w));
    ll x = 0,y = 0,a;
    rep(i,n){
        cin >> a;
        rep(j,a){
            ans[x][y] = i+1;
            if ((x%2 == 0 && y == w-1) || (x%2 == 1 && y == 0)) x++;
            else if (x%2 == 0) y++;
            else y--;
        }
    }
    rep(i,h){
        array_output(all(ans[i]));
    }
}




Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

void solve(ll n, string s, string t){
    string ans;
    rep(i,n) ans+=s[i],ans+=t[i];
    cout<<ans<<endl;
}

int main(){
    ll n;
    scanf("%lld",&n);
    string s;
    cin >> s;
    string t;
    cin >> t;
    solve(n, s, t);
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    string S;
    cin >> S;
    int ret = 0;
    const string ACGT = "ACGT";
    FOR(i, 0, S.size()) {
        FOR(j, i, S.size())
            if (ACGT.find(S[j]) != string::npos)
                ret = max(ret, j - i + 1);
            else
                break;
    }

    cout << ret << endl;

    return 0;
};


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
  int month[13];
  month[1] = 31;
  month[2] = 29;
  month[3] = 31;
  month[4] = 30;
  month[5] = 31;
  month[6] = 30;
  month[7] = 31;
  month[8] = 31;
  month[9] = 30;
  month[10] = 31;
  month[11] = 30;
  month[12] = 31;

  int m, d, days;
  while(cin >> m >> d) {
    if(m == 0) break;
    
    days = d;
    for(int j = 1; j < m; j++) {
      days = days + month[j];
    }
    if(days%7 == 0) {
      cout << "Wednesday" << '\n';
    } else if(days%7 == 1) {
      cout << "Thursday" << '\n';
    } else if(days%7 == 2) {
      cout << "Friday" << '\n';
    } else if(days%7 == 3) {
      cout << "Saturday" << '\n';
    } else if(days%7 == 4) {
      cout << "Sunday" << '\n';
    } else if(days%7 == 5) {
      cout << "Monday" << '\n';
    } else if(days%7 == 6) {
      cout << "Tuesday" << '\n';
    }
  }

  return 0;
}

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

typedef long long ll;
ll N,M;

const ll mod = 1000000007LL;
vector<ll> X;
vector<ll> Y;
vector<ll> ysum;
vector<ll> xsum;

void add( ll &a, ll b ) {
  if( b < 0 ) b += mod;
  a += b;
  a %= mod;
}
ll mult( ll a, ll b ){
  a %= mod; b %= mod;
  return a * b % mod;
}



int main(){
  cin >> N >> M;
  X.resize(N); Y.resize(M);
  for( auto &x : X ) cin >> x;
  for( auto &y : Y ) cin >> y;

  xsum.resize(N,0LL);
  ysum.resize(M,0LL);
  ll yres = 0LL;
  for(ll i=1;i<M;i++){
    add( ysum[i], ysum[i-1] );
    add( ysum[i], mult( Y[i]-Y[i-1], i ) );
    add( yres, ysum[i] );
  }
  ll res = 0LL;
  for(ll i=1;i<N;i++){
    add( xsum[i], xsum[i-1] );
    add( xsum[i], mult( X[i]-X[i-1], i ) );
    add( res, mult( xsum[i], yres ) );
  }
  cout << res << endl;
}


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

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

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x first
#define y second

const int MOD = 1e9 + 7;

void setIO() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}

//ctrl q is comment
//ctrl b is run
//ctrl s is compile
//shift r is search & replace
//shift d is delete a line

bool comp(pii a, pii b){
    return a.x == b.x ? a.y < b.y : a.x < b.x;
}
int main(){
    setIO();
        string s; cin >> s;
        if(s[0] - 'A' <= 26) cout << "A" << "\n";
        else  cout << "a" << "\n";
}



Measured memory_bytes: 3604
#include<cmath>
#include<iostream>
#include<cstdio>
#include<iomanip>
using namespace std;
int main(void){
   int n,m,l,i,j,k;
   cin >> n >> m >> l;
   long int A[100][100]={{0}},B[100][100]={{0}},C[100][100]={{0}};
    for(i=0;i<n;i++){
        for(k=0;k<m;k++){
            cin >> A[i][k];
        }
    }
    for(k=0;k<m;k++){
        for(j=0;j<l;j++){
            cin >> B[k][j];
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
            for(k=0;k<m;k++){
                C[i][j] += A[i][k]*B[k][j];
            }
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
            cout << C[i][j];
        if(j==l-1){
            cout << endl;
        }else{
            cout << " ";
        }
        }
    }
}



Measured memory_bytes: 3356
n,y=[int(x) for x in input().split()]
for i in range(y//10000,-1,-1):
    for j in range((y-10000*i)//5000,-1,-1):
        if (n-i-j)*1000==(y-i*10000-j*5000):
            print(i,j,n-i-j)
            exit()
print("-1 -1 -1")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int main(){
    string s; cin>>s;
    vector<int> cnt(3, 0);
    for(int i=0; i<s.size(); i++){
        cnt[s[i]-'a']++;
    }

    sort(cnt.begin(), cnt.end());

    if(cnt[0]==cnt[2] || cnt[0]+1==cnt[2]){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

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

using namespace std;

#define ll long long
#define pi pair<int, int>
#define pb push_back
#define fr first
#define sc second

const int mxn = 1e6 + 5;
const ll MOD =  1e9 + 7;
char arr[mxn];
int n, m, k, q;
string s, t;

void solve(){
    vector<string> v = {"AC", "WA", "TLE", "RE"};
    map<string, int> mp;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s;
        mp[s]++;
    }
    for (int i = 0; i < 4; i++) {
        cout << v[i] << " x " << mp[v[i]] << endl;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int T = 1;
    //cin >> T;
    while(T--) solve();
    return 0;
}


Measured memory_bytes: 3668
#include <iostream>

using namespace std;

int main()
{
    int x, y;
    cin >> x >> y;
    int g[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    string ans = (g[x] == g[y]) ? "Yes" : "No";
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>


using std::cout;
using std::cin;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


ll gcd(ll a, ll b) {
    while (b != 0) {
        auto tmp = a;
        a = b;
        b = tmp % a;
    }
    return a;
}

ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}

int isPrime(int a) {
    for (int i = 2; i * i <= a; ++i) {
        if (a % i == 0) {
            return 0;
        }
    }
    return 1;
}





void oneCase () {
    string line;
    cin >> line;
    sort(line.begin(), line.end());
    for (int pos = 1; pos < line.size(); ++pos) {
        if (line[pos] == line[pos - 1]) {
            cout << "no" << "\n";
            return;
        }
    }
    cout << "yes" <<   "\n";
}




int main() {
    int t = 1;
//    cin >> t;
    while (t > 0) {
        oneCase();
        --t;
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
 
public class Main
{
    public static void main(String[] args)
    {
        Scanner in=new Scanner(System.in);
        int r=in.nextInt();
        int c=in.nextInt();
        int k=in.nextInt();
        long[][] mat=new long[r][c];
        for(int i=1;i<=k;i++)
        {
            int rr=in.nextInt();
            int cc=in.nextInt();
            rr--;
            cc--;
            long v=in.nextLong();
            mat[rr][cc]=v;
        }
        long[][][] dp=new long[r][c][4];
        dp[r-1][c-1][0]=mat[r-1][c-1];
        dp[r-1][c-1][1]=mat[r-1][c-1];
        dp[r-1][c-1][2]=mat[r-1][c-1];
        dp[r-1][c-1][3]=0;
        for(int i=c-2;i>=0;i--)
        {
            dp[r-1][i][3]=dp[r-1][i+1][3];
            for(int j=2;j>=0;j--)
            {
                if(mat[r-1][i]>0)
                    dp[r-1][i][j]=Math.max(dp[r-1][i+1][j],dp[r-1][i+1][j+1]+mat[r-1][i]);
                else
                    dp[r-1][i][j]=dp[r-1][i+1][j];
            }
        }

        for(int i=r-2;i>=0;i--)
        {
            dp[i][c-1][3]=dp[i+1][c-1][3];
            for(int j=2;j>=0;j--)
            {
                dp[i][c-1][j]=dp[i+1][c-1][0]+mat[i][c-1];
            }
        }

        for(int i=r-2;i>=0;i--)
        {
            for(int j=c-2;j>=0;j--)
            {
                dp[i][j][3]=Math.max(dp[i+1][j][0],dp[i][j+1][3]);
                for(int l=2;l>=0;l--)
                {
                    if(mat[i][j]>0)
                        dp[i][j][l]=Math.max(mat[i][j]+dp[i+1][j][0],Math.max(mat[i][j]+dp[i][j+1][l+1],dp[i][j+1][l]));
                    else
                        dp[i][j][l]=Math.max(dp[i+1][j][0],dp[i][j+1][l]);
                }
            }
        }
        System.out.println(dp[0][0][0]);
    }
}


Measured memory_bytes: 740084
(defn incFirstP [p a b]
  (if (p b)
    (inc a)
    a))

(defn eqW [x]
  (= \W x))

(defn eqE [x]
  (= \E x))

(defn incW [a b]
  ((partial incFirstP eqW) a b))

(defn incE [a b]
  ((partial incFirstP eqE) a b))

(defn sumE [xs]
  (reduce incE 0 xs))

(defn decE [a b]
  (if (eqE b)
    (dec a)
    a))

(defn attension [n xs]
  (->> (map +
            (reductions incW 0 xs)
            (reductions decE (sumE xs) xs))
       (apply min)))

 (println (attension (Long/parseLong (read-line)) (read-line)))
 

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

using namespace std;

int main(){
	int s[10000];
	int n,q,t,j,cnt=0;
	
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&s[i]);
	}
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d",&t);
		j=0;
		s[n]=t;
		while(s[j]!=t){
			j++;
		}
		if(j!=n){
			cnt++;
		}
	}
	printf("%d\n",cnt);
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define long long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define debug(X) cerr<< #X << " = " <<X << endl
#define debug2(X,Y) cerr<< #X << " = " <<X << ","<<#Y<<" = "<<Y<<endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar
using namespace std;
const int N= 110;
const int M= 2010;
const long oo= 1e13;
int n,a[N];
long X= 0;
int newm= 0;
struct edge
{
	long v,f,c;
}e[M];
vector<int> adj[N];
int Now[N],ok[N],cnt,d[N];

void input()
{
    cin>>n;
    up(i,1,n) cin>>a[i];
}
void add_edge(int u,int v,long c)
{
    adj[u].push_back(newm);
    e[newm]= {v,0,c};
    adj[v].push_back(newm^1);
    e[newm^1]= {u,0,0};
    newm+= 2;
}
bool bfs(int s,int t)
{
    queue<int> q;
    fill(d+0, d+n+2, -1);
    d[s]= 0; q.push(s);
    while (!q.empty())
	{
        int u= q.front(); q.pop();
        if (u== t) return true;
        for (int id: adj[u])
		{
			int v= e[id].v;
			if (d[v]== -1 and e[id].f< e[id].c)
			{
				d[v]= d[u]+1; q.push(v);
			}
		}
	}
	return false;
}
long dfs(int u,long Min)
{
    if (u== n+1) return Min;
    if (ok[u]== cnt) return 0;
    else ok[u]= cnt;

    up(i,Now[u], (int)adj[u].size()-1)
    {
    	Now[u]= i;
    	int id= adj[u][i], v= e[id].v;
    	if (ok[v]!= cnt and d[v]== d[u]+1 and e[id].f< e[id].c )
		{
			if (long x= dfs(v,min(Min, e[id].c- e[id].f)))
			{
				e[id].f+= x; e[id^1].f-= x;
				return x;
			}
		}
    }
    return 0;
}
void solve()
{
    up(i,1,n)
     if (a[i]>=0) X+= a[i];

    up(i,1,n)
     if (a[i]<0) add_edge(0,i,-a[i]);
     else add_edge(i,n+1,a[i]);
	up(i,1,n)
	 up(j,2,n/i)
	  add_edge(i,i*j,oo);

	cnt= 0; long mincut= 0;
    while (bfs(0,n+1))
	{
        fill(Now+0,Now+n+2,0);
        while (long x= (cnt++,dfs(0,oo))) mincut+= x;
	}

	cout<<X- mincut;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);// don't use when interactive

    #ifdef I_Love_Pork
    #define TASK "tmp"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
	  #endif

    input();
    solve();

    return 0;
}


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

typedef long long ll;

ll a[100005];
ll siz[100005],sum[100005];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i <= n; i++)
	{
		cin >> a[i];
		if( i != 0 ) sum[i] = sum[i-1] + a[i];
	}
	if( n == 0 && a[0] == 1 )
	{
		cout << 1 << '\n';
		return 0;
	}
	if( a[0] != 0 || a[n] == 0 )
	{
		cout << -1 << '\n';
		return 0;
	}
	ll ans = 1;
	siz[0] = 2;
	int index = 0;
	ll help = 0;
	for (int i = 1; i <= n; )
	{
		if( a[i] == 0 )
		{
			i ++;
			continue;
		}
		if( index >= i )
		{
			cout << -1 << '\n';
			return 0;
		}
		ll t = min(a[i],siz[index]);
		ans += t * (ll)(i - index);
		help += t;
		a[i] -= t;
		siz[index] -= t;
		if( siz[index] == 0 )
		{
			index ++;
			siz[index] = help - sum[index];
		}
		if( a[i] == 0 ) i++;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 5404
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
    class Class34
    {
        static void Main()
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Dictionary<int, int> Table = new Dictionary<int, int>();

            for(int i = 0; i < N; i++)
            {
                if (Table.Keys.Contains(A[i]))
                {
                    Table[A[i]]++;
                }
                else
                {
                    Table[A[i]] = 1;
                }
            }
            int ans = 0;
            foreach(int i in Table.Keys)
            {
                if (i > Table[i])
                {
                    ans += Table[i];
                }
                else
                {
                    ans += Table[i] - i;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 26460
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=100010,mod=1000000007;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int n,x[maxn],fac[maxn],inv[maxn],ans;
int main(){
	n=read();
	FOR(i,1,n) x[i]=read();
	fac[0]=fac[1]=inv[1]=1;
	FOR(i,2,n){
		fac[i]=1ll*fac[i-1]*i%mod;
		inv[i]=mod-1ll*(mod/i)*inv[mod%i]%mod;
	}
	FOR(i,1,n-1) ans=(ans+1ll*(x[n]-x[i])*inv[n-i])%mod;
	FOR(i,2,n-1) ans=(ans+1ll*x[i]*(1-inv[i]+mod))%mod;
	FOR(i,1,n-2) ans=(ans-1ll*x[i]*(1-inv[n-i]+mod)%mod+mod)%mod;
	ans=1ll*ans*fac[n-1]%mod;
	printf("%d\n",ans);
}

Measured memory_bytes: 1408
class dice:
    def __init__(self,label):
        self.label = {i+1: l for i,l in enumerate(label)}
    def roll(self,op):
        l = self.label
        if   op=='N': self.label = {1:l[2], 2:l[6], 3:l[3], 4:l[4], 5:l[1], 6:l[5]}
        elif op=='E': self.label = {1:l[4], 2:l[2], 3:l[1], 4:l[6], 5:l[5], 6:l[3]}
        elif op=='W': self.label = {1:l[3], 2:l[2], 3:l[6], 4:l[1], 5:l[5], 6:l[4]}
        elif op=='S': self.label = {1:l[5], 2:l[1], 3:l[3], 4:l[4], 5:l[6], 6:l[2]}
    def yaw(self,op):
        l = self.label
        if   op=='CW' : self.label = {1:l[1], 2:l[3], 3:l[5], 4:l[2], 5:l[4], 6:l[6]}
        elif op=='CCW': self.label = {1:l[1], 2:l[4], 3:l[2], 4:l[5], 5:l[3], 6:l[6]}
    def get_label(self,i=0):
        if 1 <= i <= 6:
            return self.label[i]
        else:
            return [self.label[x] for x in range(1,7)] 


if __name__ == '__main__':
    d0 = dice(list(map(int,input().split())))
    d1 = dice(list(map(int,input().split())))
    result='No'
    if set(d0.get_label())==set(d1.get_label()):
        for i in range(6):
            for _ in range(4):
                if d0.get_label()==d1.get_label():
                    result='Yes'
                    break
                d0.yaw('CW')
            if d0.get_label()==d1.get_label():
                break
            if i < 4:
                d0.roll('E')
            if i >= 3:
                d0.roll('N')
            if i >= 4:
                d0.roll('N')
    print(result)

Measured memory_bytes: 7868
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll n;
  cin >> n;
  int dig=0;
  ll temp=n;
  while(temp){
    dig++;
    temp/=10;
  }
  ll ans=0;
  for(int bit=0;bit<(1<<(dig-1));bit++){
    ll temp=n;
    ll modulo=10;
    int p=0;
    while(temp){
      if(bit & (1<<p)){
        ans+=temp%modulo;
        temp/=modulo;
        modulo=10;
        p++;
      }
      else{
        modulo*=10;
        p++;
        if(modulo>temp){
          ans+=temp;
          temp/=modulo;
        }
      }
    }
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func main() {
	sc.Split(bufio.ScanWords)
	N, K := getInt(), getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}

	var dp [100001]int

	dp[0] = 0
	for i := 1; i <= K; i++ {
		for _, v := range a {
			if i >= v {
				if dp[i-v] == 0 {
					dp[i] = 1
				}
			}
		}
	}

	ans := "First"
	if dp[K] == 0 {
		ans = "Second"
	}

	out(ans)
}

/*
var dp [100001][2]int

func loop(k, j int, a []int) int {
	if dp[k][j] != -1 {
		return dp[k][j]
	}
	ret := 0
	for _, v := range a {
		if k-v >= 0 {
			if loop(k-v, (j+1)%2, a) == 0 {
				ret = 1
			}
		}
	}
	dp[k][j] = ret
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	N, K := getInt(), getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}

	for i := 0; i <= 100000; i++ {
		dp[i][0] = -1
		dp[i][1] = -1
	}

	ret := loop(K, 0, a)

	ans := "First"
	if ret == 0 {
		ans = "Second"
	}

	out(ans)
}
*/


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>
#include <set>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second



int main() {
	ll a, b, c, p = 1e18, k;
	cin >> a >> b >> c >> k;
	if (k % 2 == 1) {
		if (b - a > p)cout << "Unfair" << endl;
		else cout << b - a << endl;
	}
	else {
		if (a -b > p)cout << "Unfair" << endl;
		else cout << a - b << endl;
	}
	return 0;
}

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

string S;

int main() {
    cin >> S;

    bool f = false;
    for (int i = 0; i < S.length() - 1; i++) {
        if (S[i] == S[i+1]) {
            f = true;
            cout << i+1 << " " << i+2 << endl;
            break;
        }
        else if (i < S.length() - 2 && S[i] == S[i+2]) {
            f = true;
            cout << i+1 << " " << i+3 << endl;
            break;
        }
    }

    if (!f) cout << -1 << " " << -1 << endl;

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr double PI = 3.1415926535897932;
template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


int main() {
	init();

	int N;cin >> N;
	map<string, int>mp;
	rep(i, 0, N) {
		string s; cin >> s;
		mp[s]++;
	}
	string str[] = { "AC","WA","TLE","RE" };
	rep(i, 0, 4) {
		cout << str[i] << " " << "x" << " ";
		cout << mp[str[i]] << "\n";
	}


	return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define ll long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define MAX 1000000007
using namespace std;
int main()
{
 	speed_up
    string s;ll n,p;cin>>n;
    map<string,vector<pair<ll,ll>>> m;
    for(ll i=0;i<n;i++)
    {
    	cin>>s>>p;
    	m[s].pb(make_pair(p,i));
	}
	for(auto x:m)
	{
		vector<pair<ll,ll>> v =m[x.first];
		sort(v.begin(),v.end());reverse(v.begin(),v.end());
		for(ll i=0;i<v.size();i++)
		   cout<<(v[i].second+1)<<endl;
	}
	
    
	
	
	
 return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    string s,t;
    cin>>s>>t;
    int m=s.length(),n=t.length(),res=n,i,j,ctr;
    for(i=0;i<m-n+1;i++)
    {
        ctr=0;
        for(j=0;j<n;j++)
            if(s[i+j]!=t[j])
                ctr++;
        res=min(res,ctr);
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3596