akhauriyash/Code-Regression huggingface dataset:
#define first f
#define second s
#define ll long long
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#include <bits/stdc++.h>
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
const int maxn=1e6+5;
const double PI=acos(-1);
const double e=2.718281828459;

char s[maxn];

int main()
{
    scanf("%s",s+1);
    int len=strlen(s+1);
    s[0]='0';
    int num=0;
    for(int i=len,j;i>=0;i--){
        j=s[i]-'0';
        if(j==5){
            if(i-1>=0&&s[i-1]>='5'){
                s[i-1]++;num+=(10-j);
            }
            else{
                num+=j;
            }
        }
        else if(j<5){
            num+=j;
        }
        else{
            s[i-1]++;
            num+=(10-j);
        }
    }
    cout<<num<<endl;
    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define int long long
#define ll int64_t
using namespace std;
 
bool cmp(pair<int,int> a , pair<int,int> b) {
	return (a.second < b.second);
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
	int n , x , l;
	cin >> n;
	vector<pair<int,int>> v;
	for(int i = 0; i < n; i++) {
		cin >> x >> l;
		v.push_back({x-l , x+l});
	}
	sort(v.begin(),v.end() , cmp);
	int cnt = 1 , last = 0;
	for(int i = 1; i < n; i++) {
		if(v[i].first < v[last].second) continue;
		cnt++;
		last = i;
	}
	cout << cnt << "\n";
		
    return 0;
}


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

class Abc155a
{
    static int[] n = new int[10];

    static void Solve()
    {
        var r = false;
        for (var i = 1; i <= 9; ++i) {
            if (n[i] == 2) {
                r = true;
                break;
            }
        }

        Console.WriteLine(r ? "Yes" : "No");
    }

    static void Scan()
    {
        var abc = Console.ReadLine().Split().ToList().ConvertAll(int.Parse);
        foreach (var i in abc)
            n[i]++;
    }

    static void Main()
    {
        Scan();
        Solve();
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
 
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (a+b > c+d) {
    cout << "Left";
  } else if (a+b < c+d){
    cout << "Right";
  } else {
    cout << "Balanced";
  }
}

Measured memory_bytes: 256
#define STOPIT
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) {}
#endif

void err() { std::cout << -1 << std::endl; exit(0); }
#define require(exp) do { if (!(exp)) { err(); } } while(false)

/*
11 乗ってそういうことだったのですね！！
1桁の場合は n==s ならば n+1 が候補です。
2桁の場合は、2桁目を全探索です。
3桁の場合は、基数を全探索です。
*/

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  lint n, s; std::cin >> n >> s;
  if (n < s) err();
  if (n==s) {
    std::cout << n+1 << std::endl;
    return 0;
  }

  lint inf = std::numeric_limits<lint>::max();
  lint ans = inf;
  lint m = std::sqrt(n);
  rep(q,1,m+2) {
    lint X = n - s;
    if (X % q) continue;
    lint x = X / q + 1;
    lint r = s - q;
    if (x <= q || r < 0 || x <= r) continue;
    debug(q,r,x);
    cmn(ans,x);
  }

  auto f = [&] (lint n, lint s) {
    lint ans = 0;
    while (n) {
      ans += n % s;
      n /= s;
    }
    return ans;
  };
  rep(x,2,m+1) {
    if (f(n,x) == s) {
      debug(x);
      cmn(ans,x);
    }
  }

  if (ans == inf) ans = -1;
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int h,w,m;
typedef pair<int,int> P;
//行与列
unordered_map<int,int> m1;
unordered_map<int,int> m2;
map<P,int> c;
int main() {
    vector<int> col,row;
    int ans = 0;
    int max1 = -1,max2 = -1;
    int index1,index2;
    cin >> h >> w >> m;
    
    int x,y = 0;
    for(int i = 0;i<m;i++){
        scanf("%d%d",&x,&y);
        if(!m1.count(x)){
            m1[x]= 1;
        }else{
            m1[x] += 1;
        }
        if(!m2.count(y)){
            m2[y] = 1;
        }else{
            m2[y] += 1;
        }
        max1 = max(max1,m1[x]);
        max2 = max(max2,m2[y]);
        c[make_pair(x,y)] = 1;
    }
    unordered_map <int,int>::iterator iter;
    for(iter = m1.begin(); iter != m1.end();iter++){
        if(iter->second == max1) row.push_back(iter->first);
    }
    for(iter = m2.begin(); iter != m2.end();iter++){
        if(iter->second == max2) col.push_back(iter->first);
    }
    // for(int i = 0;i<row.size();i++){
    //     cout << row[i] << " ";
    // }
    // cout << endl;
    for(int i = 0;i<row.size();i++){
        for(int j = 0;j<col.size();j++){
            int num;
            if(c[make_pair(row[i],col[j])] == 1) num = max1 + max2 -1;
            else num = max1 + max2;
            ans = max(ans,num);
            if(ans == max1 + max2) break;
        }
    }
    cout << ans << endl;

    
    return 0;
} 


Measured memory_bytes: 69972
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	string S; cin >> S;
	cout << S;
	if (S[S.length() - 1] == 's') {
		cout << "es" << endl;
	} else {
		cout << "s" << endl;
	}
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N[] = new int[100];
    int n = sc.nextInt();
    int m = 0;
    for (int i = 0; i < n; i++) N[i] = sc.nextInt();
    for (int i = 0; i < (n - 1); i++) {
      for (int j = (n - 1); j > i; j--) {
        if (N[j-1] > N[j]) {
          int t = N[j-1];
          N[j-1] = N[j];
          N[j] = t;
          m++;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      if (i == 0) System.out.printf("%d", N[i]);
      else System.out.printf(" %d", N[i]);
    }
    System.out.printf("\n");
    System.out.println(m);
  }
}



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

typedef long long ll;
typedef pair<int, int> pii;

const int N = 1e5 + 11;
const int M = 1e6 + 11;
const int MOD = 1e9 + 7;

int main(int argc, char **args){
    string s; cin>>s;
    if(s[2] == s[3] && s[4] == s[5] ) puts("Yes");
    else puts("No");
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
using namespace std; 
#define float double
const int  LMT =1000000000+5;
#define int long long 
#define lp(i,n) for( i=0;i<n;i++)
const int N=101,M=100001;
int n,w[N],v[N],i,j,wt;
int dp[N][M];bool vis[N][M];
int solve(int i,int val,int tw){
  if(val<=0)return 0;
  if(i>=n)return LMT;
  if(vis[i][val])return dp[i][val];
  vis[i][val]=true;
  dp[i][val]=min(w[i]+solve(i+1,val-v[i],tw),solve(i+1,val,tw));
  return dp[i][val];
}
int32_t main(){
  #ifndef ONLINE_JUDGE 
  freopen("input.txt", "r", stdin); 
  freopen("output.txt", "w", stdout); 
 #endif
  cin>>n>>wt;int ww=wt;
  int sm=0;
  for(int i=0;i<n;i++)for(int j=0;j<M;j++)dp[i][j]=0,vis[i][j]=0;
  lp(i,n){cin>>w[i]>>v[i];sm+=v[i];}
 int ans;
  for(int i=sm;i>=0;i--)
  {ans=solve(0,i,wt);if(ans<=ww){cout<<i<<endl;return 0;}}

 
} 

Measured memory_bytes: 91544
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String S = sc.nextLine();
		String T = sc.nextLine();
		int c = 0;
		for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i) != T.charAt(i))
				c++;
		}
		System.out.println(c);
	}

}


Measured memory_bytes: 33852
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>

void c(std::istream& in)
{
    int X, N;
    in >> X >> N;

    std::set<int> pSet;
    for (int i = 0; i < N; ++i)
    {
        int p;
        in >> p;
        pSet.insert(p);
    }

    auto itrL = pSet.lower_bound(X);
    if (itrL == pSet.end())
    {
        std::cout << X;
        return;
    }

    if (itrL == pSet.begin())
    {
        std::cout << *itrL - 1;
        return;
    }

    int diff = 0;
    while (true)
    {
        if (pSet.find(X - diff) == pSet.end())
        {
            std::cout << X - diff;
            return;
        }
        if (pSet.find(X + diff) == pSet.end())
        {
            std::cout << X + diff;
            return;
        }

        ++diff;
    }
}

int main(int, char* [])
{
    c(std::cin);
    return 0;
}



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

int main() {
    string s;
    cin >> s;
    cout << s.substr(0,3) << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <boost/math/common_factor.hpp>
using namespace std;
using s64 = int64_t;

int main() {
	s64 A, B, C, D;
	cin >> A >> B >> C >> D;
	
	bool turn = false;
	
	while(A > 0 && C > 0) {
		if(turn) {
			A -= D;
		} else {
			C -= B;
		}
		
		turn = !turn;
	}
	
	if(A > 0) {
		cout << "Yes";
	} else {
		cout << "No";
	}
	
	return 0;
}


Measured memory_bytes: 3600
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define eps 1e-10
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 4e4 + 10;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b,ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a,ll b){ if(a==0){return b;}else{ return gcd(b%a,a);}}

int w,h;
void solve()
{
	sa(w),sa(h);
	priority_queue< pair<int,int> > que;
	int ca=0,cb=0;

	repp(i,1,w)
	{
		int x;
		scanf("%d",&x);
		que.push( make_pair(-x,0) );
	}
	repp(i,1,h)
	{
		int x;
		scanf("%d",&x);
		que.push( make_pair(-x,1) );
	}
	w++,h++;
	ll res=0;
	while(!que.empty())
	{
		pair<int,int>t=que.top();
		que.pop();

		int k=-t.first;
		int g=t.second;
		if(g==0)
		{
			res+=1LL*k*(h-cb);
			ca++;
		}
		else
		{
			res+=1LL*k*(w-ca);
			cb++;
		}
		//cout<<res<<endl;
	}
	printf("%lld\n",res);
}

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


Measured memory_bytes: 2420
n,m=map(int,input().split())
city_list = [[] for _ in range(n)]

py = [list(map(int,input().split())) for _ in range(m)]

for ppyy in py:
  city_list[ppyy[0]-1].append(ppyy[1])

dict = {}
for index, ppyy in enumerate(city_list):
  ppyy.sort()
  for index2, pppyyy in enumerate(ppyy):
    dict[pppyyy] = (str(index+1).zfill(6)+str(index2+1).zfill(6))

for ppyy in py:
  print(dict[ppyy[1]])

Measured memory_bytes: 50260
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define int long long

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

   int n;
   cin >> n;
   n = (1 << n);
   vector<int> a(n);
   multiset<int> s;
   for (auto &t : a) {
      cin >> t;
      s.insert(t);
   }
   vector<int> cur = {*s.rbegin()};
   s.erase(--s.end());
   for (int l = 1; 2 * l <= n; l *= 2) {
      vector<int> add;
      for (int i = (int)cur.size() - 1; i >= 0; i--) {
         if (s.lower_bound(cur[i]) != s.begin()) {
            auto it = prev(s.lower_bound(cur[i]));
            add.push_back(*it);
            s.erase(it);
         } else {
            cout << "No" << endl;
            exit(0);
         }
      }
      for (auto t : add) {
         cur.push_back(t);
      }
      sort(cur.rbegin(), cur.rend());
   }
   cout << "Yes" << endl;
}

Measured memory_bytes: 17588
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, beg, end) for (int i = beg; i < end; i++)

const int N = 1000010;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    double x;
    cin >> x;
    x = (x/180)*M_PI;
    double a = 0;
    double b = 1;
    int n = 1;

    while (max(a, 0.0) - 0 > 0.0001 || max(b, 0.0)-0 > 0.0001)
    {
        a += sin(n*x);
        b += cos(n*x);
        n++;
    }

    cout << n << endl;




    return 0;
}

Measured memory_bytes: 4088
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

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

signed main()
{
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  
  int ans=a*x+b*y;
  chmin(ans,c*max(x,y)*2);
  if(x>=y) chmin(ans,a*(x-y)+c*2*y);
  if(x<y)  chmin(ans,c*2*x+b*(y-x));
  cout<<ans<<endl;
}


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

int div(int A, int B, int mod_p) {
  stack<int> q_stack;
  int a = B, b = mod_p, r;
  while (b) {
    q_stack.push(a / b);
    r = a % b; a = b; b = r;
  }
  long u = 1, v = 0;
  while (!q_stack.empty()) {
    int q = q_stack.top(); q_stack.pop();
    long u1 = v, v1 = u-q*v; u = u1 % mod_p; v = v1 % mod_p;
  }
  return (long)A * (u + mod_p) % mod_p;
}
 
int num_com(int n, int k, int mod_p) {
  int k2 = min(k, n - k);
  long nmr = 1, dnm = 1;
  for (int i = 1; i <= k2; i++) {
    nmr *= n + 1 - i; nmr %= mod_p;
    dnm *= i; dnm %= mod_p;
  }
  return div(nmr, dnm, mod_p);
}

map<int, int> fac(int x) {
  map<int, int> F;
  for (int i = 2; i <= x; i++) {
    if (i > x / i) break;
    if (x == 1) return F;
    if (x % i == 0) {
      F[i] = 0;
      while (x % i == 0) {
        F[i]++; x /= i;
      }
    }
  }
  if (x != 1) F[x] = 1;
  return F;
}

int main() {
  int DIV = 1e+9 + 7;
  int N, M; cin >> N >> M;
  map<int, int> F = fac(M);
  long prod = 1;
  for (auto it = F.begin(); it != F.end(); it++) {
    prod = prod * num_com(N + it->second - 1, it->second, DIV) % DIV;
  }
  cout << prod << endl;
}

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

int N,M;
int a[55],b[55],c[55],d[55];
int ans[55];
const int INF=1000000007;

int main(){

cin>>N>>M;

for(int i=0; i<N; i++) scanf("%d %d",&a[i],&b[i]);
for(int i=0; i<M; i++) scanf("%d %d",&c[i],&d[i]);

for(int i=0; i<N; i++){
	int Min=INF; int p;
	for(int j=0; j<M; j++){
		int mh=abs(a[i]-c[j])+abs(b[i]-d[j]);
		if(mh<Min){
			Min=mh; p=j+1;
		}
	}
	ans[i]=p;
}

for(int i=0; i<N; i++) printf("%d\n",ans[i]);

return 0;
 
}

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

//---------------------------------------------------------------
// ------ graph ------ //
using Weight = int;
using Flow = int;
struct Edge {
    int src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) { }
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) { }
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // pqが降順のため
        e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
using Edges = vector<Edge>;
struct Graph {
    vector<Edges> adj;
    Graph(int n) : adj(n) { }
    int size() { return adj.size(); }
    Edges operator [] (int v) { return adj[v]; }
    void add_edge(int a, int b, Weight w = 1) { // graph
        adj[a].emplace_back(a, b, w);
        adj[b].emplace_back(b, a, w);
    }
    void add_arc(int a, int b, Weight w = 1) {  // digraph
        adj[a].emplace_back(a, b, w);
    }
};
using Array = vector<Weight>;
using Matrix = vector<Array>;

// ------ Topological Sort (dfs) ------ //
bool tsort(Graph &g, vector<int> &ord) {
    int n = g.size();
    enum { YET, VISITED, DONE };
    vector<int> color(n, YET);
    static const function<bool(int)> dfs = [&](int v) {
        color[v] = VISITED;
        for (Edge &e : g[v]) {
            if (color[e.dst] == DONE) continue;
            if (color[e.dst] == VISITED) return false;
            if (!dfs(e.dst)) return false;
        }
        color[v] = DONE; ord.push_back(v);
        return true;
    };
    for (int i = 0; i < n; ++i) if (color[i] == YET && !dfs(i)) return false;
    reverse(ord.begin(), ord.end());
    return true;
}
//---------------------------------------------------------------

int main() {
    int V, E; cin >> V >> E;
    Graph g(V);
    for (int i = 0; i < E; i++) {
        int s, t; cin >> s >> t;
        g.add_arc(s, t);
    }
    vector<int> ord;
    if (tsort(g, ord)) {
        for (int i = 0; i < V; i++) cout << ord[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 4276
#include "bits/stdc++.h"
using namespace std;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int N = 1e5;
int A[N+6];

int main() {
	ios_base::sync_with_stdio(0);
	int a,b,n,m,T,cas=0;
	string s;
	cin>>n>>m;
	int cnt=0, pen=0;

	for(int i=0;i<m;++i) {
		cin>>a>>s;
		if(s=="WA" && A[a]!=-1) {
			A[a]++;
		}
		else if(s=="AC" && A[a]!=-1) {
			pen+=A[a];
			cnt++;
			A[a]=-1;
		}
	}
	cout<<cnt<<" "<<pen;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/agc036_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll S;
  cin >> S;

  ll x = 1e9, y = 1;
  ll y2 = S / x + 1;
  ll x2 = x - S % x;
  if (S == 1e18) {
    y2 = 1e9;
    x2 = 0;
  }
  printf("0 0 %lld %lld %lld %lld", x, y, x2, y2);
  return 0;
}

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

int main()
{
  int n,ans,x;
  ans=0;
  x=0;
  cin>>n;
  for(int i=1;i<=n;i++)
  {
    if(n%i==0)
      x++;
  }
  for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=n/i;j++)
    {
      ans++;
    }
  }
  ans-=x;
  cout<<ans<<endl;
}

Measured memory_bytes: 3632
#!/usr/bin/env python3

from itertools import permutations
import numpy as np

def main():
    n = int(input())
    x = []
    y = []
    for i in range(n):
        xi, yi = map(int, input().split())
        x.append(xi)
        y.append(yi)

    odrs = permutations(list(range(n)), n)
    dists = [getdist(list(o), x, y) for o in odrs]
    print(np.mean(dists))

def getdist(odr, x, y):
    xo = np.array(x)[odr]
    yo = np.array(y)[odr]
    dx = xo[1:] - xo[:-1]
    dy = yo[1:] - yo[:-1]
    return np.sum((dx ** 2 + dy ** 2) ** 0.5)

if __name__ == "__main__":
    main()


Measured memory_bytes: 15592
package main

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

var stdin = bufio.NewScanner(os.Stdin)

func main() {
	arr := scanArrayInt()
	a, b := arr[0], arr[1]
	tap := 0
	consent := 1
	for consent < b {
		consent = consent + a - 1
		tap++
	}
	fmt.Println(tap)
}

func scanArrayInt() []int {
	var ret = []int{}
	stdin.Scan()
	for _, s := range strings.Split(stdin.Text(), " ") {
		i, _ := strconv.Atoi(s)
		ret = append(ret, i)
	}
	return ret
}

Measured memory_bytes: 640
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
c=list(range(1,n+1))
num=[0]*n
for i in range(n):
    num[a[i]-1]=num[a[i]-1]+1
preans=reduce(lambda x,y:x+y*(y-1)/2,num,0)

for i in range(n):
    print(int(preans-num[a[i]-1]+1))

Measured memory_bytes: 26892
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    ll n;
    cin>>n;
    vi a(n);
    vi buka(n,0);
    rep(i,0,n-1){
        cin>>a[i];
        a[i]--;
        buka[a[i]]++;
    }
    rep(i,0,n)cout<<buka[i]<<endl;
    return 0;
}




Measured memory_bytes: 4840
s = input()
t = input()
sl = list(s)
tl = list(t)
sl_asc = sorted(sl)
tl_desc = sorted(tl, reverse=True)
s2 = ''.join(sl_asc)
t2 = ''.join(tl_desc)
if s2 < t2:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll k;
    cin >> k;
    queue<ll> que;
    rep(i, 1, 10) que.push(i);
    ll cnt = 0;
    while(true){
        cnt++;
        auto q = que.front();
        que.pop();
        // cerr << cnt << ": " << q << endl;
        if(cnt == k){
            cout << q << endl;
            break;
        }
        ll last = q % 10;
        if(cnt + que.size() > k) continue;
        if(last != 0) que.push(q * 10 + last - 1);
        que.push(q * 10 + last);
        if(last != 9) que.push(q * 10 + last + 1);
    }
    return 0;
}

Measured memory_bytes: 3888
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
limit = 0
ans = 0
count = 0
lim = 0
t = N - 1
for i in range(N):
    lim = 2
    if i == 0:
        lim = 1
    for j in range(lim):
        if t > 0:
            ans += A[i]        
            t -= 1


print(ans)



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

int main() {
  int N;
  cin >> N;
  bool res = false;
  for (int a = 0; a <= N/4; a++) {
    for (int b = 0; b <= N/7; b++) {
      int total = 4*a + 7*b;
      if (total == N) res = true;
    }
  }

  if (res) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
static const int MAX = 200000;

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

	if (a - b == b - c) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define INF_M 2147483647
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
 
int main() {
    int s1[1010][32];
    int s2[1010][32];
    string s;
    rep(i,0,1010) {
        memset(s1 + i, 0, sizeof(s1[i]));
        memset(s2 + i, 0, sizeof(s2[i]));
    }

    int a,b;
    while(getline(cin,s)) {
        if(s.empty()) break;
        sscanf(s.c_str(),"%d,%d",&a,&b);
        s1[a][b]++;
    }

    while(getline(cin,s)) {
        sscanf(s.c_str(),"%d,%d",&a,&b);
        s2[a][b]++;
    }

    rep(i,0,1010) {
        int x = 0, y = 0;
        rep(j,0,32) {
            if(s1[i][j] != 0) x++;
            if(s2[i][j] != 0) y++;
        }
        if(x != 0 && y != 0) {
            printf("%d %d\n",i,x+y);
        }
    }
    return 0;
}

Measured memory_bytes: 1488
N, K = gets.chomp.split.map(&:to_i)
A = gets.chomp.split.map(&:to_i)

digit_length = [K.to_s(2).size, A.max.to_s(2).size].max

ONE_COUNTER = Array.new(digit_length, 0)

A.each do |a|
  a.to_s(2).reverse.chars.each_with_index do |v, i|
    if v == '1'
      ONE_COUNTER[i] += 1
    end
  end
end

def dfs(pos, remain)
  return 0 if remain < 0

  value = 0

  if 2 ** (pos + 1) - 1 <= remain
    v = 0

    pos.downto(0) do |i|
      cnt = ONE_COUNTER[i]
      base = 2 ** i

      if cnt > N / 2
        value += cnt * base
      else
        value += (N - cnt) * base
      end
    end
  else
    base = 2 ** pos
    one_v = base * (N - ONE_COUNTER[pos])
    zero_v = base * ONE_COUNTER[pos]

    if remain - base >= 0
      value += [dfs(pos - 1, remain) + zero_v, dfs(pos - 1, remain - base) + one_v].max
    else
      value += dfs(pos - 1, remain) + zero_v
    end
  end

  value
end

puts dfs(digit_length - 1, K)



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

int a[100010];

int main()
{
  int x;
  for(int i = 1; i <= 3; i++) scanf("%d", &x), a[x]++;
  for(int i = 1; i <= 9; i++)
  {
    if(a[i] == 2)
    {
      printf("Yes");
      return 0;
    }
  }
  printf("No");
  return 0;
}


Measured memory_bytes: 384
N = int(input())
A = []
B = []
for i in range(N):
  a,b = map(int,input().split())
  A.append(a)
  B.append(b)

ans = 0
for i in range(N-1,-1,-1):
  A[i] += ans
  if A[i]%B[i] > 0:
    ans += B[i]-(A[i]%B[i])
print(ans)


Measured memory_bytes: 56792
a,b=[int(x) for x in input().rstrip().split()]

def gcd(m,n):
    x=max(m,n)
    y=min(m,n)

    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z
def lcm(m,n):
    return int(m*n/gcd(m,n))
print(lcm(a,b))

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	int a, b,c; cin >> a>>b;
	//string s; cin >> s;
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)cout << "Possible";
	else cout << "Impossible";
	


	cout << endl;
	return 0;
}

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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int m;
	cin >> m;
	int n = 1;
	for(; n * (n - 1) / 2 < m; ++n);
	if(n * (n - 1) / 2 != m){
		cout << "No" << endl;
		return 0;
	}
	vector<vector<int>> solution(n);
	for(int i = 0, k = 0; i < n; ++i){
		for(int j = i + 1; j < n; ++j, ++k){
			solution[i].push_back(k);
			solution[j].push_back(k);
		}
	}
	cout << "Yes" << endl;
	cout << n << endl;
	for(const auto& v : solution){
		cout << v.size();
		for(const auto& x : v){ cout << " " << x + 1; }
		cout << endl;
	}
	return 0;
}



Measured memory_bytes: 2304
/**
 *   created: 28 April 2019  23:46:46
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) (c).begin,(c).end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
// #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================
int main()
{
	optimizeIO();
	int tt=1;
	// cin>>tt;
	while(tt--){
		int n,k;
		cin>>n>>k;
		string s;
		cin>>s;
		k--;
		s[k] = s[k] + 'a'-'A';
		cout<<s;
	}
	return 0;
}





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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

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

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}


int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(c == -1 || d == -1) {
    c = b;
    d = a;
  }
  if(c > d) cout << "Alice" << endl;
  else if(c == d) cout << "Draw" << endl;
  else cout << "Bob" << endl;

}






Measured memory_bytes: 3212
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	int n, m, q;
	cin >> n >> m >> q;
	int cnt[510][510] = {};
	for(int i = 0; i < m; i++){
		int l, r;
		cin >> l >> r;
		cnt[1][r]++;
		cnt[l + 1][r]--;
		cnt[1][n + 1]--;
		cnt[l + 1][n + 1]++;
	}
	for(int i = 1; i <= n; i++){
		for(int j = 2; j <= n; j++){
			cnt[i][j] += cnt[i][j - 1];
		}
	}
	for(int j = 1; j <= n; j++){
		for(int i = 2; i <= n; i++){
			cnt[i][j] += cnt[i - 1][j];
		}
	}
	for(int i = 0; i < q; i++){
		int p, q;
		cin >> p >> q;
		cout << cnt[p][q] << endl;
	}
}

Measured memory_bytes: 1920
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        String[] days = {"MON","TUE","WED","THU","FRI","SAT", "SUN"};
        String s = scanner.nextLine();
        for (int i = 0; i < 7; i++) {
            if (s.equals(days[i])) {
                System.out.println(7 - ((i + 1) % 7));
            }
        }
    }

}



Measured memory_bytes: 22484
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int a[200001];
int main(){
    int n;
    cin>>n;
    ll sum1=0,sum2=0;
    rep(i,n){
        cin>>a[i];
        sum2+=a[i];
    }
    sum2-=a[0];
    sum1+=a[0];
    ll ans=abs(sum2-sum1);
    FOR(i,1,n-1){
        sum1+=a[i];
        sum2-=a[i];
        ans=min(ans,abs(sum2-sum1));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef unsigned long long ll;
int N, n;

int main(){
    cin >> N;
  	vector<ll> u(N), v(N);
	REP(i,N){
      cin >> v[i];
    }
  	REP(i,N){
      cin >> u[i];
    }
    ll ans = 0;
    REP(i,N){
        ll cand = 0;
        cand += accumulate(v.begin(), v.begin() + i+1, 0LL);
        cand += accumulate(u.begin() + i, u.end(), 0LL);
        ans = max(cand, ans);    
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;
int main()
{
	int n;
	int a[100010];
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int d=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==i)
		{
			if(i==n)
			{
				int t=a[i];
				a[i]=a[i-1];
				a[i-1]=t;
				d++;
			}
			else
			{
				int t=a[i];
				a[i]=a[i+1];
				a[i+1]=t;
				d++;
			}

		}
	}
	cout<<d<<endl;
	return 0;
}

Measured memory_bytes: 640
n=int(input())
h = list(map(int,input().split()))
m=0
count = 0

for i in range (n-1):
    if h[i]>=h[i+1]:
        count += 1
    else:
        m = max(m,count)
        count = 0
m = max(m,count)
print(m)


Measured memory_bytes: 63984
#include<stdio.h>
int main()
{
	int a,b,c,N;
	scanf("%d",&N);
	a=N/100;
	b=N%100/10;
	c=N%10;
	if(N==a+b*10+c*100)
	{ 
	printf("Yes");
	} 
	else
	{ 
	printf("No");
    } 
	return 0;
	
 } 

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

using namespace std;

// MACROS

#define ll long long
#define ull unsigned long long
#define ld long double

#define vi vector<int>
#define vll vector<ll>
#define vld vector<ld>
#define u_s unordered_set

#define pii pair<int,int>
#define pll pair<ll,ll>

#define FOR(i, n) for (ll (i) = 0; i < n; i++)
#define FORN(i, a, b) for (ll (i) = a; i < b; i++)
#define FORE(i, l) for (auto (i) : l)

#define pb push_back
#define pob pop_back
#define emp emplace
#define fi first
#define se second

#define all(n) (n).begin(), (n).end()
#define in(n) cin >> (n);
#define debug(n) cout << #n << ": " << n << '\n';

// FUNCTIONS

template< typename T >
inline T gcd(T a, T b) { if (b) return gcd(b, a % b); return a; }

template< typename T >
inline T ext_gcd(T a, T b, T & x, T & y) { if (a == 0) { x = 0; y = 1; return b; } T x1, y1; T g = ext_gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return g; }

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);	
    //cout << setprecision(15);
    ll n, m;
    cin >> n >> m;
    if (n == m) cout << "Yes\n";
    else cout << "No\n";
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define M_PI 3.1415926535897932384626433832795
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

#define MOD (1000000007)

ll combi(ll n, ll r)
{
	ll ret = 1;
	ll num = 1, den = 1, denf;

	r = min(r, n - r);

	for (ll i = n; i >= n - r + 1; i--) num = (num * i) % MOD;
	for (ll i = 1; i <= r; i++) den = (den * i) % MOD;

	denf = den;

	ret = den;
	rep(i, 9) {
		rep(j, 9) ret = (ret * den) % MOD;
		den = ret;
	}
	rep(i, 5) ret = (ret * denf) % MOD;

	ret = (ret * num) % MOD;

	return ret;
}

int main()
{
	int X, Y;
	int m, n;

	cin >> X >> Y;

	if ((2 * X - Y) % 3 == 0) n = (2 * X - Y) / 3;
	else {
		cout << 0 << endl;
		return 0;
	}
	m = X - n * 2;
	if (n < 0 || m < 0) {
		cout << 0 << endl;
		return 0;
	}

	cout << combi(n + m, n) << endl;

	return 0;
}


Measured memory_bytes: 256
string = input()
erase = 'erase'
eraser = 'eraser'
dream = 'dream'
dreamer = 'dreamer'
er = 'er'
a = 'a'
r = 'r'
while True:
    if string[:5] == dream:
        if string[5:7] == er:
            if string[7:8] == a:
                string = string[5:]
            else:
                string = string[7:]
        else:
            string = string[5:]
    elif string[:5] == erase:
        if string[5:6] == r:
            if string[6:7] == a:
                string = string[5:]
            else:
                string = string[6:]
        else:
            string = string[5:]
    elif string == '':
        print('YES')
        break
    else:
        print('NO')
        break

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

using namespace std;

typedef long long int ll;

int main(){
    int N,M;
    cin >> N >> M;
    int i,j;

    priority_queue<ll> A;

    for(i=0;i<N;i++){
        ll Ai;
        cin >> Ai;
        A.push(Ai);
    }

    /*  処理    */
    for(i=0;i<M;i++){
        ll max=A.top();
        A.pop();
        max/=2;
        A.push(max);
    }

    ll sum=0;
    for(i=0;i<N;i++){
        sum+=A.top();
        A.pop();
    }

    cout << sum << endl;

}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
string s; cin >> s;
int ans = 0;
for(int i = 0; i < 4; ++i)if(s[i]=='2')++ans;
cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
a_ls = list(map(int, input().split()))
csum = [0] * n
now = 0
for i in range(n):
    now += a_ls[i]
    csum[i] = now

mod = 10**9+7
ans = 0
for i in range(n):
    add = a_ls[i] * ((csum[-1] - csum[i])%mod)
    add %= mod
    ans += add
    ans %= mod
print(ans%mod)


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

int main(){
    int A, B;
    cin >> A >> B;
    if(A > B) cout << 2 * A -1 << endl;
    else if(A < B) cout << 2 * B - 1 << endl;
    else{
        cout << 2 * A << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;

public class Main {

	/** 車両を出す合図 */
	private static final String OUTPUT = "0";

	/**
	 * 入力値に従って車両を出し入れし、出ていく場合は車両番号を表示する。
	 *
	 * @param args
	 */
	public static void main(String[] args) throws IOException {

		Stack<String> stack = new Stack<String>();
		String line = null;
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		while ((line = reader.readLine()) != null) {

			if (OUTPUT.equals(line)) {
				// 車両を出す場合はスタック上の一番上にある車両を出力する
				System.out.println(stack.pop());

			} else {
				// スタックに車両を追加する
				stack.push(line);
			}
		}

		if (reader != null) {
			reader.close();
		}
	}

}

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

int main(){
    int n, ans = 0;
    cin >> n;
    vector<int> l(n);
    for(int i = 0; i < n; i++) cin >> l[i];
    sort(l.begin(), l.end());

    for(int i = 0; i < n - 2; i++){
        for(int j = i + 1; j < n - 1; j++){
            if (l[i] + l[j] > l[n - 1]) { ans += n - j - 1; }
			else if (l[i] + l[j] <= l[j + 1]) { }
			else {
				int left = n - 1;
				int right = j + 1;
 
				while (left != right + 1) {
					if (l[i] + l[j] > l[(left + right) / 2]) { right = (left + right) / 2; }
					else { left = (left + right) / 2; }
				}
				ans = ans + right - j;
			}
	    }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// int calc(int m, int a[], int n)
// {
// 	int sum = 0;
// 	int i;
// 	for(i=0;i<n;i++)
// 		sum+=m%a[i];
// 	return sum;
// }
// int maxinarr(int a[], int n)
// {
// 	int maxx = -1;
// 	int i;
// 	for(i=0;i<n;i++)
// 		if(maxx<a[i])
// 			maxx=a[i];
// 	return maxx;
// }
int main()
{
	int n;
	cin>>n;
	int i;
	int a[n];
	int sum=0;
	for(i=0;i<n;i++)
		cin>>a[i];
	for(i=0;i<n;i++)
		sum+=a[i]-1;
	cout<<sum<<endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
/*        string[] input = ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
//        int a = int.Parse(input[2]);
//        int b = int.Parse(input[3]);*/
//        string temp = ReadLine();
//        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        int c = int.Parse(ReadLine());
//        int d = int.Parse(ReadLine());
        string a = ReadLine();
//        string b = ReadLine();
//        string c = ReadLine();
        for(int i=0;i<a.Length-8;i++){
            Write(a[i]);
        }
        WriteLine();
    }
}

Measured memory_bytes: 11092
import math
n=int(input())
r=[list(map(int,input().split())) for i in range(n)]
c=0
for i in range(n-1):
    for j in range(i+1,n):
        l=(r[i][0]-r[j][0])**2 + (r[i][1]-r[j][1])**2
        c+=math.sqrt(l)
print(2*c/n)

Measured memory_bytes: 3060