akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define ALL(a) (a).begin(), (a).end()
string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/

int main(void){
  long N, M;
  cin >> N >> M;
  long multi = pow(2, M);
  cout << multi*((N-M)*100+M*1900) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;

int main() {
  string O, E;
  cin >> O >> E;

  rep(i,0,E.size()-1) cout << O[i] << E[i];
  if (O.size() != E.size()) cout << O.back();
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
 {
 int n;
 cin>>n;
 map<long long int,long long int> mp;
 vector<long long int> v(n);
 for(long long int i= 0;i<n;i++)
 {
   cin>>v[i];   
   mp[i-v[i]]++;
 }
 long long int count = 0;
 for(long long int i = 0;i<n;i++)
   count += mp[i+v[i]];
 cout<<count; 
 return 0;
 }
 


Measured memory_bytes: 27304
#include <bits/stdc++.h>
using namespace std;typedef long long ll;typedef string str;
typedef vector<str> vst;typedef vector<ll> vll;
ll mod = 1000000007, INF = 10000000000000000;
ll gcd(ll a, ll b){if(b==0){return a;}return gcd(b, a%b);}
// for (ll i = 0; i < n; i++) {
// sort(.begin(),.end());
int main(){
  str s;
  cin >> s;
  ll n = s.size(), j = 0;
  vll a(n, -1);
  for (ll i = 0; i < n; i++) {
    if (s[i] == '0') {
      a[j] = 0;
      j++;
    }
    else if (s[i] == '1') {
      a[j] = 1;
      j++;
    }
    else {
      if (j == 0) {
        continue;
      }
      j--;
      a[j] = -1;
    }
  }
  
  for (ll i = 0; i < n; i++) {
    if (a[i] >= 0) {
      cout << a[i];
    }
  }
  cout << endl;
}

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

x = 0
y = sum(a)
res = 1000000000000000

for i in range(N-1):
  x += a[i]
  y -= a[i]
  if res > abs(x-y):
    res = abs(x-y)
print(res)

Measured memory_bytes: 23792
import sys
input = sys.stdin.readline
N = int(input())
A = [0 for _ in range(N)]
xy = [0 for _ in range(N)]
for i in range(N) :
    A[i] = int(input())
    xy[i] = [0 for _ in range(A[i])]
    for j in range(A[i]) :
        x, y = map(int, input().split())
        xy[i][j] = (x, y)

ans = 0
for i in range(2**N):
    pat = str("{:0>{}b}".format(i, N))
    flag = True
    for j in range(N):
        if pat[j] == "1":
            for t in range(A[j]) :
                man = xy[j][t][0] - 1
                tru = xy[j][t][1]
                if pat[man] != str(tru) :
                    flag = False
    if flag == True :
        ans = max(ans, pat.count("1"))

print(ans)


Measured memory_bytes: 3064
n = int(input())
ans = 0
for i in range(1, int(n**0.5)+1):
    if n%i==0:
        if i>1 and n//(i-1)==n%(i-1):
            ans += i-1
        if n//i>1 and n//(n//i-1)==n%(n//i-1):
            ans += n//i-1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        

fast();
//ll t;cin>>t;while(t--)
{
  ll n,ans=0;
  cin>>n;
  string s=to_string(n);
  if(s[0]!='9')
   {
    ll temp=(0+s[0]-'0');
  
    cerr<<temp<<endl;
    ans+=(temp-1);
   
  for(int i=1;i<s.length();i++)
  {
    ans+=9;
  }
  ll aise=0;
  while(n>0)
  {
      aise+=(n%10);
      n/=10;
  }
  cout<<max(ans,aise)<<endl;
}
else
{ 
  ll idx=-1;
  for(int i=0;i<s.length();i++)
  {
    if(s[i]=='9')
      continue;
    else
    {
      idx=i;
      break;
    }
  }
  if(idx==-1)
  {
    for(int i=0;i<s.length();i++)
    {
      ans+=9;
    }
  }
  else
  {
    for(int i=0;i<idx-1;i++)
    {
      ans+=9;
    }
    ans+=8;
    for(int i=idx;i<s.length();i++)
    {
      ans+=9;
    }
  }

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

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

typedef pair<long long, long long> pair_t;

bool comp(const pair_t &a, const pair_t &b) {
	return a.first < b.first;
}

void sort_vectors(vector<long long> &av, vector<long long> &bv)
{
	long long n = av.size();
	vector<pair_t> p(n);
	vector<long long> av2(n), bv2(n);
	for (int i = 0; i < n; i++)
		p[i] = make_pair(av[i], bv[i]);
	sort(p.begin(), p.end(), comp);
	for (int i = 0; i < n; i++) {
		av2[i] = p[i].first;
		bv2[i] = p[i].second;
	}
	av = av2;
	bv = bv2;
}


int main(void) {

	long long N ,K;
	cin >> N >> K;

	vector<long long> a(N), b(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
	}

	sort_vectors(a, b);

	long long count = 0;
	long long i = 0;
	long long answer = 0;

	while (count <= K) {
		count += b[i];
		if (count >= K) {
			answer = a[i];
			break;
		}
		i++;
	}

	cout << answer << endl;

	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define int long long int
#define endl "\n"
using namespace std;
int fact(int n)
 {
    int f=1;
    for(int i=1;i<=n;i++)
     {
        f=f*i;
     }
        return f;
 }
void solve()
{
    //Enter your code here Tanmay:)
    int n,k=0;
    cin>>n;
    int X[n],Y[n];
    int sz=fact(n)/(fact(n-2)*2);
    float dist[sz];
    //cout<<sz;
    for(int i=0;i<n;i++)
    {
        cin>>X[i]>>Y[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            dist[k++]=1.0*sqrt((X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j]));
        }
    }
    //cout<<dist[0];
    float sum=0.0;
    for(int i=0;i<sz;i++)
    {
        sum=sum+dist[i];
    }
    if(sz==1)
        sum=dist[0];
    //cout<<sum;
    cout<<setprecision(12)<<sum/((1.0*n)/2*1.0);
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

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

int main() {
    string s;
    cin>>s;
    int ans=1000,l=s.size();
    int a[l];
    for(int i=0;i<l;i++){
        if (s[i]=='1')a[i]=1;
        else if (s[i]=='2')a[i]=2;
        else if (s[i]=='3')a[i]=3;
        else if (s[i]=='4')a[i]=4;
        else if (s[i]=='5')a[i]=5;
        else if (s[i]=='6')a[i]=6;
        else if (s[i]=='7')a[i]=7;
        else if (s[i]=='8')a[i]=8;
        else if (s[i]=='9')a[i]=9;
    }
    //for(int i=0;i<l;i++){
    //    cout<<s[i];
    //}
    for(int k=0;k<l-2;k++){
        ans=min(ans,abs(753-(a[k]*100+a[k+1]*10+a[k+2])));
    //    cout<<ans;
    }
    cout<<ans;
	return 0;
}


Measured memory_bytes: 256
k=int(input())
num=[]
for i in range(k):
    if (len(num)==0):
        num=[1]
    elif (len(num)==1):
        num[0]+=1
        if num[0]==10:
            num=[1, 0]
    else:
        saved=False
        ind=0
        j=len(num)-1
        while(not saved and j>0):
            if (num[j]-num[j-1])<=0:
                if not saved and num[j]!=9:
                    ind=j
                    saved=True
                
            j-=1
        if num[ind]!=9:
            num[ind]+=1
            for j in range(ind+1, len(num)):
                num[j]=max(num[j-1]-1, 0)
        else:
            l=len(num)
            num=[1]+[0]*l

            
for i in num:
    print(i, end='')
print()
            


Measured memory_bytes: 3188
n = int(input())
a = list(map(int, input().split()))
a_cur = a[0]

m = 1000
s = 0

for i in range(1, n):
    a_next = a[i]
    if a_cur < a_next:
        # buy
        s += m // a_cur
        m -= m // a_cur * a_cur
    else:
        # sell
        m += s * a_cur
        s = 0
    a_cur = a_next
m += s * a_cur
print(m)

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

public class Solve
{
    public static void Main(string[] args)
    {
        new ABC_B();
    }
}
public class ABC_A
{
    public ABC_A()
    {
        var s = Ex.Read;
        if (s[2] == s[3] && s[4] == s[5])
        {
            Ex.Cw("Yes");
        }
        else Ex.Cw("No");
    }
}
public class ABC_B
{
    public ABC_B()
    {
        var x = Ex.ReadLong;
        long ans = 0;
        ans += (x / 500) * 1000;
        x %= 500;
        ans += (x / 5) * 5;
        Ex.Cw($"{ans}");
    }
}
public class ABC_C
{
    public ABC_C()
    {

    }
}
public class ABC_D
{
    public ABC_D()
    {

    }
}
public class ABC_E
{
    public ABC_E()
    {

    }
}
public class ABC_F
{
    public ABC_F()
    {

    }
}
public static class Ex
{
    public static void Cw(string s)
    {
        Console.WriteLine(s);
    }

    public static string Read { get { return Console.ReadLine().Trim(); } }
    public static int ReadInt { get { return int.Parse(Read); } }
    public static long ReadLong { get { return long.Parse(Read); } }
    public static double ReadDouble { get { return double.Parse(Read); } }
    public static string[] ReadArray() { return Read.Split(' '); }
    public static int[] ReadIntArray() { return Read.Split(' ').Select(s => int.Parse(s)).ToArray(); }
    public static long[] ReadLongArray() { return Read.Split(' ').Select(s => long.Parse(s)).ToArray(); }
    public static string[] ReadArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
    public static int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
    public static long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define int long long
using namespace std;
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 (a>b) { a=b; return 1; } return 0; }

using Graph=vector<vector<int>>;

class LowLink
{
 private:
    int N;
    Graph G,tree;
    vector<int> ord,low,articulation_points;
    vector<pair<int,int>> bridges;
 public:
    LowLink(Graph G):N(G.size()),G(G),ord(N,-1),low(N){
        tree.resize(N);
        for(int i=0;i<N;i++) if(ord[i]<0){
            dfs(i,-1); calc(i,-1);
        }
    }
    int dfs(int v,int p){
        static int K=0;
        low[v]=ord[v]=K++;
        for(int u:G[v]){
            if(ord[u]<0){
                chmin(low[v],dfs(u,v));
                tree[v].push_back(u);
            }else if(u!=p){
                chmin(low[v],ord[u]);
            }
        }
        return low[v];
    }
    void calc(int v,int p){
        bool is_articulation=false;
        for(int u:tree[v]){
            if(p!=-1 and low[u]>=ord[v]) is_articulation=true;
            if(low[u]>ord[v]) bridges.push_back(minmax(u,v));
            calc(u,v);
        }
        if(p==-1 and tree[v].size()>1) is_articulation=true;
        if(is_articulation) articulation_points.push_back(v);
    }
    vector<int> getArticulationPoints(){ return articulation_points; }
    vector<pair<int,int>> getBridges(){ return bridges; }
};

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

    int N,M; cin>>N>>M;
    Graph G(N);
    for(int i=0;i<M;i++){
        int a,b; cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    LowLink lowlink(G);
    auto ans=lowlink.getArticulationPoints();
    sort(ans.begin(),ans.end());
    for(int i:ans) cout<<i<<endl;
    return 0;
}


Measured memory_bytes: 7548
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
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; }
ll n, m,q;
vector<ll> a,b,c,d;
ll dfs(int k,vector<int>v,int mi){
    ll res=0;
    if(k==n){
        rep(i,q){
            if(v[b[i]]-v[a[i]]==c[i])res+=d[i];
        }
        return res;
    }
    else{
        for(int i=mi;i<=m;i++){
            vector<int> vv=v;
            vv.push_back(i);
            res=max(res,dfs(k+1,vv,max(mi,i)));
        }
        return res;
    }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>m>>q;
    a.resize(q);
    b.resize(q);
    c.resize(q);
    d.resize(q);
    ll sum=0;
    for (int i = 0; i < q; i++)
    {
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--;
        b[i]--;
        sum+=d[i];
    }
    vector<ll> ans(n);
    vector<int> v;
    cout<<dfs(0,v,1)<<"\n";
}


Measured memory_bytes: 3656
#include <iostream>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
#include <set>
#include <list>
#include <string>
#include <memory.h>
#include <bitset>
#include <stack>
#include <assert.h>
#include <ctime>
#include <unordered_set>
using namespace std;
#define ll long long
#define ppi pair<int, int>
#define mp make_pair
const int N = 2e5 + 11, K = 20;
const int mod = 1e9 + 7;
int arr[N];
int main()
{
#ifndef ONLINE_JUDGE
	//freopen("inp.txt", "r", stdin);
#endif
	ll n, k;
	cin >> n >> k;
	ll mn = n;
	if (n >= k)
		n -= (n / k) * k;
	mn = min(mn, n);

	for (int i = 0; i <=3; i++)
	{
		n = abs(n - k);
		mn = min(n, mn);
	}
	cout << mn;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)

int main() {
	for (string s1, s2; cin >> s1&&s1 != ".";) {
		cin >> s2;
		vector<string> a1, a2;
		string b1, b2; // " ??????
		{
			bool l = false;
			string tmp = "";
			rep(i, 0, s1.size()) {
				if (l) {
					if (s1[i] == '"') {
						l = false;
						a1.push_back(tmp);
						tmp = "";
						b1 += s1[i];
						continue;
					}
					tmp += s1[i];
				}
				else {
					b1 += s1[i];
					if (s1[i] == '"') {
						l = true;
					}
				}
			}
		}
		{
			bool l = false;
			string tmp = "";
			rep(i, 0, s2.size()) {
				if (l) {
					if (s2[i] == '"') {
						l = false;
						a2.push_back(tmp);
						tmp = "";
						b2 += s2[i];
						continue;
					}
					tmp += s2[i];
				}
				else {
					b2 += s2[i];
					if (s2[i] == '"') {
						l = true;
					}
				}
			}
		}
		int cnt = 0;
		if (b1 != b2) {
			cout << "DIFFERENT" << endl;
		}
		else {
			rep(i, 0, a1.size()) {
				if (a1[i] != a2[i])
					cnt++;
			}
			if (cnt == 0) {
				cout << "IDENTICAL" << endl;
			}
			else if (cnt == 1) {
				cout << "CLOSE" << endl;
			}
			else {
				cout << "DIFFERENT" << endl;
			}
		}
	}
}

Measured memory_bytes: 3100
N = int(input())
S = input()

cnt = [[0, 0] for _ in range(N)]

if S[0] == 'W':
    cnt[0][0] = 1

if S[-1] == 'E':
    cnt[-1][1] = 1

for i in range(1, N):
    cnt[i][0] += cnt[i - 1][0]
    if S[i] == 'W':
        cnt[i][0] += 1
    
for i in range(N - 2, -1, -1):
    cnt[i][1] += cnt[i + 1][1]
    if S[i] == 'E':
        cnt[i][1] += 1

count = float('inf')
for i in range(N):
    count = min(count, cnt[i][0] + cnt[i][1])

print(count - 1)

Measured memory_bytes: 53068
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define fi first 
#define se second
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
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;}
// ミント
const int mod = 1e9+7 ;
  //998244353;

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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//昆布
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n,int k){
    return fact[n]*ifact[n-k] ;
  }
  }  c(200000);
 
mint modpow(ll a,ll b){
 if(b==0) return 1 ;
 mint c= modpow(a,b/2) ;
 if(b%2==1) return c*c*a ;
 else return c*c ;
}

mint komb(ll n,ll m){
  mint x=1 ;mint y=1 ;
  rep(i,m){
    x*= n-i ;
    y*= i+1 ;
  }
  return x/y ;
}

 map<ll,ll> factor(ll n){  //素因数とオーダーをマップで管理
  map <ll,ll> ord ;  
  for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            int res=0;
            while(n%i==0){
                n/=i;
                res++;
            }
            ord[i]=res;
        }
    }
   if(n!=1) ord[n]++;
   return ord ;
 }
 


int main(){
  ll n ; cin>>n ;
  mint ans= modpow(9ll,n) ;
  mint bns= modpow(10ll,n) ;
  mint cns= modpow(8ll,n) ;
  mint d= (bns-ans)*2ll - (bns-cns) ;
  cout<<d<<endl ;
     return 0;
  }
   



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

int main(){
	
	int n;
	scanf("%d",&n);
	int h[n];
	int m[n];
	for(int i=0;i<n;i++){
		scanf("%d%d",&h[i],&m[i]);
	}

	int M;
	scanf("%d",&M);
	int k[M];
	int g[M];
	for(int i=0;i<M;i++){
		scanf("%d%d",&k[i],&g[i]);
	}
	
	int p[n+M];
	for(int i=0;i<n;i++){
		p[i] = h[i]*60+m[i];
	}
	for(int i=n;i<n+M;i++){
		p[i] = k[i-n]*60+g[i-n];
	}
	sort(p, p+n+M);

	int z=-114514;
	for(int i=0;i<n+M;i++){
		int min=p[i]%60;
		if(z!=p[i]){
		if(i==0){
		if(min<10) printf("%d:0%d", int(p[i]/60),min);
		if(min>=10) printf("%d:%d", int(p[i]/60),min);
		}else{
		if(min<10) printf(" %d:0%d", int(p[i]/60),min);
		if(min>=10) printf(" %d:%d", int(p[i]/60),min);	
		}
		}
		z=p[i];
	}		
	printf("\n");
}

Measured memory_bytes: 1212
import re


def get_char_list():
    return [chr(ord('a') + i) for i in range(26)]


def main():
    S = input()
    N = len(S)
    char_list = get_char_list()
    for c in char_list:
        for pattern in ['{}.{}'.format(c, c), '{}{}'.format(c, c)]:
            m = re.search(pattern, S)
            if m is not None:
                sp = m.span()
                print('{} {}'.format(sp[0] + 1, sp[1]))
                return
    print('{} {}'.format(-1,-1))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
#include<bits/stdc++.h>
    // #include<boost/multiprecision/cpp_int.hpp>
    // using boost::multiprecision::cpp_int; // use cpp_int as data type for large numbers 
    using namespace std;
    typedef long long ll;
    typedef long double ld;
    typedef unsigned long long ull;
    typedef vector<int> vi;
    typedef vector<long long> vll;
    typedef pair<ll,ll> pll;
     
    const ll mod = 1e9 + 7;
    const ld PI = 3.1415926535897932384626;
    const ld eps = 1e-9;                            
     
    #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define sidha(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
    #define ulta(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);--i)
    #define stl(container,itr) \
        for(auto itr = container.begin(); itr != container.end(); itr++)
    #define sab(v) v.begin(), v.end()
    #define rall(v) v.rbegin(), v.rend()            
    #define test ll t;cin>>t;while(t--)
    #define sz(v) ((int)(v).size())
    #define pb push_back
    #define mp make_pair
    #define fi first
    #define se second
    #define LOG2(X) (63ll - __builtin_clzll(X))
    #define endl '\n'
    #define modinv(x) power(x, mod-2)
    #define MAX 100005
     
    ll power(ll x, ll y) { 
        ll ans=1;
        x=x%mod;
        while(y>0) { 
            if (y&1) 
                ans=(ans*x)%mod; 
            y=y>>1;
            x=(x*x)%mod; 
        } 
        return ans; 
    }
    
    // vector<ll> arr[MAX];
    // ll visit[MAX];
    // void dfs(ll n){
    //     visit[n]=1;
    //     for(ll i=0;i<arr[n].size();++i){
    //         if(visit[arr[n][i]]==0) dfs(arr[n][i]);
    //     }
    // }
    
    // ll spf[MAX];
    // void sieve(){
    //     sidha(i,1,MAX)  spf[i]=i;
    //     for(ll i=4;i<MAX;i+=2)  spf[i]=2;
    //     for(ll i=3;i*i<=MAX;i++){
    //         if(spf[i]==i){
    //             for(ll j=i*i;j<MAX;j+=i){
    //                 if(spf[j]==j)   spf[j]=i;
    //             }
    //         }
    //     }
    // }

    int main()
    {
        boost;
        ll k,flag=0,i=1;
        cin>>k;
        ll visit[k]={0};
        ll mul=7;
        while(1){
            mul%=k;
            if(visit[mul]==1)   break;
            visit[mul]=1;
            if(mul%k==0){
                flag=1;
                break;
            }
            mul*=10;
            mul+=7;
            i++;
        }
        if(flag)    cout<<i;
        else    cout<<"-1";
        return 0;
    }
    

Measured memory_bytes: 11380
using System;
using System.Linq;

class E
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var h = read();
		var ps = new int[h[0]].Select(_ => read()).ToArray();

		var V = h[0] * 1000;
		var dp = Enumerable.Repeat(int.MaxValue, V + 1).ToArray();
		dp[0] = 0;
		foreach (var p in ps)
			for (int w, i = V; i >= 0; i--)
				if (dp[i] != int.MaxValue && i + p[1] <= V && (w = dp[i] + p[0]) <= h[1])
					dp[i + p[1]] = Math.Min(dp[i + p[1]], w);
		Console.WriteLine(Enumerable.Range(0, V + 1).Reverse().First(x => dp[x] != int.MaxValue));
	}
}


Measured memory_bytes: 15712
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return a;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }

int main() {
  int n; cin >>n;
  //1<=A,B<=N Aの末尾＝Bの先頭、Aの先頭＝Bの末尾となるA,Bの組み合わせ数 
  /*末尾0...一致する組み合わせ無し
    末尾1...先頭が1ならおｋ。なので数としては先頭1+末尾1-先頭も末尾も1。
    末尾k...先頭k+末尾k-先頭も末尾もk。
    で、先頭と末尾の組み合わせについて
    1,1と1,1...先頭も末尾も1、の数を二乗すれば出る
    1,2と2,1...先頭と末尾が1,2と2,1のやつを数を書けて2倍すればば出る
    i,iとi,i...先頭も末尾もi、の数を二乗
    i,jとj,i...先頭と末尾がi,jとj,iのやつを数を掛けて2倍すれば出る
    一般に、i,jとj,iの組み合わせは先頭と末尾がi,jとj,iのやつを数を掛けて、i==jならおｋ、i!=jなら2倍する
  */
  vector<vector<int>> vec(10, vector<int>(10, 0));
  vector<int> both(10);
  // vec[i][j]...先頭がiで末尾がjのやつ
  // both[i]...先頭も末尾もiのやつ
  for (int i=1; i<=n; i++){
    int tail = i%10;
    int tmp = i;
    while (tmp>=10) tmp/=10;
    int head = tmp;
    if (head==tail) both.at(head)++;
    vec.at(head).at(tail)++;
  }
  ll ans = 0;
  for (int i=1; i<10; i++){
    for (int j=i; j<10; j++){
      if (i==j){
        ans += vec.at(i).at(j) * vec.at(i).at(j);
      }else{
        ans += vec.at(i).at(j) * vec.at(j).at(i) * 2;
      }
    }
  }
  cout <<ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
#define vv(a,b) vector< vector<int> > v(a,vector<int>(b,0));
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int mod =1e9+1;

int main()
{
    int n;
    cin>>n;
    vector<P> red(n);
    vector<P> blue(n);
    vector<bool> select(n,false);
    rep(i,n)
    {
        cin>>red[i].first>>red[i].second;
    }
    rep(i,n)
    {
        cin>>blue[i].first>>blue[i].second;
    }
    sort(blue.begin(),blue.end());
    sort(red.begin(),red.end());

    int ans=0;
    rep(i,n)
    {
        int greed=-1;
        int ymax=0;
        rep(j,n)
        {
            if(blue[i].first>red[j].first)
            {
                if(blue[i].second>red[j].second && ymax<=red[j].second && !select[j])
                {
                    ymax=red[j].second;
                    greed=j;
                }
            }

        }
        if(greed!=-1)
        {
            select[greed]=true;
            //cout<<i<<" "<<greed<<endl;
            //cout<<i<<" "<<greed<<endl;
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


int main() {
    int a,b,k,x=0,d;
    
    cin>>a>>b>>k;
    
    for(d=a;d>=1;d--){
        if(a%d==0 && b%d==0){
            x++;
            if(x==k){
                cout<<d;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define F first
#define S second
using namespace std;

const int N=1e5+5;
int n, m, dist[N];

struct djknd
{
	int w, u, c;
};
struct djsrt
{
	bool operator()(const djknd &a, const djknd &b)
	{
		if(a.w==b.w) return a.u > b.u;
		return a.w > b.w;
	}
};
priority_queue< djknd, vector < djknd >, djsrt> pq;
set<int> opr8r[N];
bool vis[N];
map<int, vector<int> > adjm[N];
vector< pii > adj[N];
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	for(int i = 1; i <= n; i++) dist[i]=1e9;
	for(int i = 0 ; i < m; i++)
	{
		int u, v, c;
		cin >> u >> v >> c;
		adj[u].pb(mp(v, c));
		adj[v].pb(mp(u, c));
		adjm[u][c].pb(v);
		adjm[v][c].pb(u);
	}
	pq.push({0, 1, 0});
	dist[1]=0;
	while(pq.size())
	{
		if(dist[pq.top().u]!=pq.top().w || opr8r[pq.top().u].find(pq.top().c)!=opr8r[pq.top().u].end())
		{
			pq.pop();
			continue;
		}
		djknd curr = pq.top();
		pq.pop();
		if(curr.u==n)
		{
			cout << curr.w;
			return 0;
		}
		if(!vis[curr.u])
		{
			for(auto V: adj[curr.u])
			{
				dist[V.F]=min(dist[V.F], curr.w+1);
				pq.push({curr.w+1, V.F, V.S});
			}
			vis[curr.u]=true;
		}
		opr8r[curr.u].insert(curr.c);
		for(auto V: adjm[curr.u][curr.c])
		{
			if(opr8r[V].find(curr.c)==opr8r[V].end() && curr.w<=dist[V])	pq.push({curr.w, V, curr.c});
			dist[V]=min(dist[V], curr.w);
		}
	}
	cout << -1;
}

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


int main(){
    vector<int> v(3);
    rep(i,3) cin>>v[i];

    sort(v.begin(),v.end());
    
    int ans = 0;
    rep2(i,1,3){
        ans += v[i]-v[i-1];
    }
    
    cout<<ans<<endl;

    return 0;
}


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

int cnt = 0;
vector<int> G;

void insertionSort(vector<int> &a, int n, int g){
    for(int i = g; i < n; i++){
        int v = a.at(i);
        int j = i - g;
        while(j >= 0 && a.at(j) > v){
            a.at(j + g) = a.at(j);
            j = j - g;
            cnt++;
        }
        a.at(j + g) = v;
    }
}

void shellSort(vector<int> &a, int n){
    for(int h = 1; ; ){
        if(h > n) break;
        G.push_back(h);
        h = 3 * h + 1;
    }
    
    for(int i = G.size() - 1; i >= 0; i--){
        insertionSort(a, n, G.at(i));
    }
}

void printVec(vector<int> x, int n){
    for(int i = x.size() - 1; i > 0; i--){
        cout << x.at(i) << " ";
    }
    cout << x.at(0) << endl;
}

int main(){
    int n; cin >> n;
    vector<int> a(n);
    
    rep(i, n){
        cin >> a.at(i);
    }

    shellSort(a, n);

    cout << G.size() << endl;
    printVec(G, G.size());
    cout << cnt << endl;

    rep(i, n){
        cout << a.at(i) << endl;
    }
}


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

int main(){
  long long n,i;
  cin >> n;
  vector<long long> a(n);
  for(i=0;i<n;++i){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  long long amax=a[n-1];
  long long amin=a[0];
  long long calc=abs((amax/2+1)-a[0]);
  i=0;
  if(amax%2==0){
    while(i<n-1){
      if(calc>(abs(amax/2-a[i]))){
        calc=abs(amax/2-a[i]);
        amin=a[i];
      }
      ++i;
    }
  }else{
    i=0;
    while(i<n-1){
      if(calc>(abs((amax/2+1)-a[i]))){
        calc=abs(amax/2+1-a[i]);
        amin=a[i];
      }
      ++i;
    }
  }
  cout << amax << " " << amin << endl;
  return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S;
ll from[14];
ll to[14];
ll mo=1000000007;
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S;
	from[0]=1;
	FORR(c,S) {
		ZERO(to);
		FOR(i,10) {
			if(c!='?' && c!='0'+i) continue;
			FOR(j,13) {
				(to[(j*10+i)%13]+=from[j])%=mo;
			}
		}
		
		swap(from,to);
	}
	cout<<from[5]<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 512
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
----
local function array(n, default_val)
    local metatables = {}
    if default_val ~= nil then
        metatables[1] = {__index = function() return default_val end}
    end
    for i=2,n do
        metatables[i] = {__index = function(parent, k)
            local child = setmetatable({}, metatables[i-1])
            rawset(parent, k, child)
            return child
        end}
    end
    return setmetatable({}, metatables[n])
end
----
local N, K = read.nn()
local h = read.N(N)
local function diff(i, j)
    if j > N then
        return 10^20
    end
    return math.abs(h[i] - h[j])
end
local tbl = array(1, 10^20)
tbl[1] = 0
for i=1,N-1 do
    for k=1,K do
        tbl[i+k] = math.min(tbl[i+k], diff(i,i+k) + tbl[i])
    end
end
print(tbl[N])

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

int main() {
  string s;
  cin >> s;

  int count = 0;

  for (int i = 0; i < 3; i++){
    for (int j = i + 1; j < 4; j++){
      if (s.at(i) == s.at(j)){
        count++;
      }
    }
  }

  if (count == 2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		char[] c = s.toCharArray();
		int result = 700;
		for (int i = 0; i < c.length; i++) {
			String str = String.valueOf(c[i]);
			if (str.equals("o")) {
				result = result + 100;
			}
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll MAX = 510000;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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;}

int main()
{
    string s,t;
    cin >> s >> t;
    cin >> s >> t;
    int ans=0;
    REP(i,s.size()){
        if(s[i]!=t[i]){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3920
#include<iostream>

using namespace std;

int main(){
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  for(int i=0; i<k; i++){
    if(b <= a){
      b*=2;
    }else if(c <= a || c <= b){
      c*=2;
    }else{
      break;
    }
  }
  if(a < b && b < c){
      cout << "Yes" << endl;
      return 0;
  }else{
	cout << "No" << endl;
  	return 0;
  }
}

Measured memory_bytes: 3608
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,K;
	while(cin>>N>>K) {
		cout<<(K<=(N-N/2)?"YES":"NO")<<endl;
	}
	
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> b(n-1);
    rep(i, n-1) cin >> b[i];
    vector<int> a(n);
    a[0] = b[0];
    a[1] = b[0];
    for (int i = 1; i < n -1; i++){
        a[i+1] = b[i];
        if (a[i] > b[i]) a[i] = b[i];
    }

    int ans = 0;
    rep(i, n) ans += a[i];
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M 1000000007
#define pi ld(acos(-1.0))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(ll i=a;i<=(ll)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fi first
#define se second
#define ii pair<int,int>
#define bye(x) {cout<<x;return 0;}
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    cs
    int n,m,t=0,tt=0;cin>>n>>m;
    vector<ii> v(n+1);
    rep(i,m) {
        int x;string s;
        cin>>x>>s;
        if(v[x].se) continue;
        if(s=="WA") v[x].fi++;
        else v[x].se=1;
    }
    for(auto i:v) {tt+=i.se;if(i.se) t+=i.fi;}
    cout<<tt<<' '<<t;
}

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

int main(){

  int i, N, ans=0; cin>>N;
  int a[N];
  for(i=0; i<N; i++) cin>>a[i];
  for(i=0; i<N; i++) ans=ans^a[i];
  
  for(i=0; i<N; i++){
    cout<<(ans^a[i])<<" ";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 4380
#include<cstdio>
#include<cctype>
  
int main(){
    char c;
  
    while(1){
        scanf("%c", &c);
        if(isalpha(c)){
            if(islower(c)) printf("%c", toupper(c));
            else printf("%c", tolower(c));
        }
        else printf("%c", c);
          
        if(c == '\n')break;
    }

    return 0;
}


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

int main()
{
    int n,k;
    cin>>n>>k;
    int h[n+1];
    for(int i=1;i<=n;i++)
        cin>>h[i];
    long long cost[n+1];
    cost[n] = 0;
    for(int i=n-1;i>=1;i--)
    {
        cost[i] = INT_MAX;
        for(int j=1;j<=k;j++)
        if(i+j<=n)
        cost[i] = min(cost[i],abs(h[i]-h[i+j])+cost[i+j]);
    }
    cout<<cost[1];
    return 0;
}



Measured memory_bytes: 1408
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<iostream>
using namespace std;
const int M=1e6+7,inf=0x3f3f3f3f;
int read(){
	int ans=0,f=1,c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1; c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar();}
	return ans*f;
}
char s[M];
int ans,n,f[M][3],suml[M],sumr[M];
int main()
{
	n=read(); scanf("%s",s+1);
	f[1][1]=f[2][1]=-inf;
	f[1][0]=f[2][0]=0;
	int now=0;
	for (int i=1;i<=n;i++){
		if (s[i]=='1') now++;
		else suml[i]=now,now=0;
	}
	now=0;
	for (int i=n;i>=1;i--){
		if (s[i]=='1') now++;
		else sumr[i]=now,now=0;
	}
	f[0][0]=0;f[0][1]=f[0][2]=-inf;
	int last=0;
	for (int i=1;i<=n;i++)if(s[i]=='0'){
		f[i][0]=max(f[last][0],max(f[last][1],f[last][2]));
		if(suml[i]&&sumr[i]) f[i][1]=max(f[last][0]+suml[i],suml[i]>=1?f[last][1]+suml[i]-1:-inf);
		else f[i][1]=-inf;
		if(suml[i] && sumr[i]) f[i][2]=
		max(max(f[last][0]+sumr[i],suml[i]>=2?f[last][1]+sumr[i]:0),suml[i]>=1?f[last][2]+sumr[i]-1:-inf);
		else f[i][2]=-inf;
		ans=max(ans,max(f[i][0],max(f[i][1],f[i][2])));
		last=i;
	}
	printf("%d\n",ans);
	return 0;
}

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

int main (void)
{
    int n,m,i,j;
    scanf("%d %d",&n,&m);
    long a[n],b[n],c[m],d[m];
    for(i=0;i<n;i++)
    {
        scanf("%ld %ld",&a[i],&b[i]);
    }
    for(i=0;i<m;i++)
    {
        scanf("%ld %ld",&c[i],&d[i]);
    }
    for(i=0;i<n;i++)
    {
        long min=4000000000;
        int cp=0;
        for(j=0;j<m;j++)
        {
            long ksum=labs(c[j]-a[i])+labs(d[j]-b[i]);
            if(min>ksum)
            {
                min=ksum;
                cp=j;
            }
        }
        printf("%d\n",cp+1);
    }
    return 0;
}


Measured memory_bytes: 1728
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define ld long double
#define ff first
#define ss second

using namespace std;

int main() {
    unsigned int n;
    string it;

    ios::sync_with_stdio(0);

    cin >> n;
    vector <string> itens(n);

    for(size_t i = 0; i < n; i++) {
        cin >> itens[i];
    }
    
    sort(itens.begin(), itens.end());

    // for(size_t i = 0; i < n; i++) {
    //     cout << itens[i] << endl;
    // }

    bool s; size_t total_it = n;

    for(size_t i = 0; i < n - 1; i++) {
        s = binary_search(itens.begin() + i + 1, itens.end(), itens[i]);

        if(s) {
            total_it--;
        }
    }

    cout << total_it << endl;

    return 0;
}

Measured memory_bytes: 9524
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i=0; i<N; i++) cin >> A[i];
  // 累積和
  vector<ll> sum(N);
  sum[0] = A[0];
  for (int i=1; i<N; i++) sum[i] = sum[i-1]+A[i];
  vector<ll> ans;
  for (int i=0; i<N-1; i++) {
    if (sum[i]<N-i-1) continue;
    else ans.push_back(abs(2*sum[i]-sum[N-1]));
  }
  sort(ans.begin(), ans.end());
  cout << ans[0] << endl;
}

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

int main(){
    
    // #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif

    string s;
    cin>>s;
    string a = s.substr(0,2);
    string b = s.substr(2,2);
    int one = atoi(a.c_str());
    int two = atoi(b.c_str());
    bool f1 = false,f2 = false;
    if(one>0&&one<=12) f1 = true;
    if(two>0&&two<=12) f2 = true;
    if(f1&f2) cout<<"AMBIGUOUS";
    else if(f1) cout<<"MMYY";
    else if(f2) cout<<"YYMM";
    else cout<<"NA";

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    String o = sc.next();
    String e = sc.next();

    sc.close();

    String[] O = o.split("");
    String[] E = e.split("");

    int count = O.length + E.length;

    int i = 0;

    while (i < count) {
      if (i % 2 == 0){
        System.out.print(O[i/2]);
      } else {
        System.out.print(E[i/2]);
      }
      i++;
    }

    System.out.println("");

  }

}

Measured memory_bytes: 24916
/* author: Tarek */ 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
int main()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n,m;
cin>>n>>m;
if(n==m)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
 return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int i, N, B[100];
	scanf("%d", &N);
	for (i = 1; i < N; i++) scanf("%d", &(B[i]));
	
	int sum = B[1] + B[N-1];
	for (i = 1; i < N - 1; i++) {
		if (B[i] < B[i+1]) sum += B[i];
		else sum += B[i+1];
	}
	
	printf("%d\n", sum);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
#define all(x) (x).begin(),(x).end()
using namespace std;
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a*b/gcd(a,b);
}
signed main(){
	int a,b,ans=0;
	cin>>a>>b;
	for(int i=1;i<=a;i++){
		for(int j=1;j<=b;j++){
			if(j/10>=2&&j%10>=2&&(j/10)*(j%10)==i){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.awt.geom.*;
import java.io.*;
import java.util.*;

import javax.naming.BinaryRefAddr;

public class Main {
	//2015 cording
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0) break;
			int [] data = new int[n];
			int max = n;
			for(int i = 0 ; i  < n; i++){
				data[i] = sc.nextInt();
				max = Math.max(max, data[i]);
			}
			
			int [] hash = new int[max + 1];
			int count = 0;
			while(true){
				Arrays.fill(hash, 0);
				for(int i = 0 ; i < n; i++){
					hash[data[i]]++;
				}
				
				boolean flg = false;
				for(int i = 0 ; i < n; i++){
					if(data[i] != hash[data[i]]){
						flg = true;
					}
					data[i] = hash[data[i]];
				}
				if(! flg){
					System.out.println(count);
					for(int i = 0 ; i < n-1; i++){
						System.out.print(data[i] + " ");
					}
					System.out.println(data[n-1]);
					break;
				}
				count++;
				
			}
		}
	}
	
	public static void main(String [] args){
		new Main().doit();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    long long n, m;
    cin >> n >> m;
    long long x = min(n, m), y = max(n, m);
    //long long ans = n * m;
    long long ans;
    if (x==1 && y == 1)
    {
        ans = 1;
    }
    else if (x == 1 && y!= 1)
    {
        ans = y-2;
    }
    else
    {
        ans = (x-2LL)*(y-2LL);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256