akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,a,b,m1,m2;
    cin>>n>>a>>b;
    ll d=abs(b-a);
    if(d%2==0)
        cout<<d/2<<endl;
    else
    {
       /* m1=b-1;
        m2=n-a;
        m1=min(m1,m2);
        cout<<m1<<endl;*/
         cout <<( min(a - 1, n - b) + 1) + abs(a - b) / 2 << endl;
    }





    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 2000000000;
using namespace std;

int main(){

    int n;
    cin >> n;
    rep(i,n){
        map<string, bool> m;
        string s;
        string c[4];
        cin >> s;
        range(i,1,s.size()){
            c[0] = s.substr(0, i);
            c[2] = s.substr(i, s.size());

            c[1] = c[0]; c[3] = c[2];
            reverse(all(c[1]));
            reverse(all(c[3]));

            
            m[c[0] + c[2]] = 1;
            m[c[0] + c[3]] = 1;
            m[c[1] + c[2]] = 1;
            m[c[1] + c[3]] = 1;
            m[c[2] + c[0]] = 1;
            m[c[3] + c[0]] = 1;
            m[c[2] + c[1]] = 1;
            m[c[3] + c[1]] = 1;
        }

        //for(auto it: m){ cout << it.first << endl; }
        cout << m.size() << endl;
    }
}

Measured memory_bytes: 3140
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif
#define FILE_IO freopen("input.txt","r",stdin)
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
void solve(){
    string s;
    int cnt=0;
    cin>>s;
    for(auto it:s)cnt+=(it=='1');
    cout<<cnt<<endl;
 }
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
    IOS;
    solve();
    #ifdef LOCAL_DEFINE
    cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
    #endif
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int r, c,i,j,a[100+1][100+1]={0};
  cin >> r >> c ;
  for(i=0;i<r;i++)for(j=0;j<c;j++)
    cin >> a[i][j];
  
  for(i=0;i<r;i++)for(j=0;j<c;j++)
    a[i][c]+=a[i][j];
  
  for(j=0;j<c;j++)for(i=0;i<r;i++)
    a[r][j]+=a[i][j];
  
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      cout << a[i][j] << " ";
    }
   cout << a[i][c] << endl;
  }
  for(j=0;j<c;j++){
    cout << a[r][j] << " ";
    a[r][c]+=a[r][j];
  }
  cout << a[r][c] << endl;
} 

Measured memory_bytes: 1208
import time as ti


class MyQueue(object):
    """
    My Queue class

    Attributes:
        queue: queue
        head
        tail
    """

    def __init__(self):
        """Constructor
        """
        self.length = 50010
        self.queue = [0] * self.length
        # counter = 0
        # while counter < self.length:
        #     self.queue.append(Process())
        #     counter += 1
        self.head = 0
        self.tail = 0

    # def enqueue(self, name, time):
    def enqueue(self, process):
        """enqueue method

        Args:
            name: enqueued process name
            time: enqueued process time

        Returns:
            None
        """
        self.queue[self.tail] = process
        # self.queue[self.tail].name = name
        # self.queue[self.tail].time = time
        self.tail = (self.tail + 1) % self.length

    def dequeue(self):
        """dequeue method

        Returns:
            None
        """
        # self.queue[self.head].name = ""
        # self.queue[self.head].time = 0
        self.queue[self.head] = 0
        self.head = (self.head + 1) % self.length

    def is_empty(self):
        """check queue is empty or not

        Returns:
            Bool
        """
        if self.head == self.tail:
            return True
        else:
            return False

    def is_full(self):
        """chech whether queue is full or not"""
        if self.tail - self.head >= len(self.queue):
            return True
        else:
            return False


class Process(object):
    """process class
    """

    def __init__(self, name="", time=0):
        """constructor
        Args:
            name: name
            time: time
        """
        self.name = name
        self.time = time

    def forward_time(self, time):
        """time forward method

        Args:
            time: forward time interval

        Returns:
            remain time

        """
        self.time -= time
        return self.time


def time_forward(my_queue, interval, current_time,):
    """

    Args:
        my_queue: queue
        interval: time step interval
        current_time: current time
    """

    value = my_queue.queue[my_queue.head].forward_time(interval)
    if value <= 0:
        current_time += (interval + value)
        print my_queue.queue[my_queue.head].name, current_time
        my_queue.dequeue()

    elif value > 0:
        current_time += interval
        # name, time = my_queue.queue[my_queue.head].name, \
        #              my_queue.queue[my_queue.head].time
        my_queue.enqueue(my_queue.queue[my_queue.head])
        my_queue.dequeue()

    return current_time


my_queue = MyQueue()
n, q = [int(x) for x in raw_input().split()]
counter = 0
while counter < n:
    name, time = raw_input().split()

    my_queue.enqueue(Process(name, int(time)))
    counter += 1

# end_time_list = []
current_time = 0
while not my_queue.is_empty():
    current_time = time_forward(my_queue, q, current_time)

Measured memory_bytes: 26460
#include <iostream>
#include <map>

using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repr(i,a,b) for(int i=a; i<b; i++)

int main() {
  int A,B;
  cin >> A >> B;
  map<int, int> mp;
  repr(i,1,4) {
    mp[i] = 0;
  }

  mp[A]++;
  mp[B]++;

  for(auto tmp : mp) {
    // tmp.firstがkeyでtmp.secondがvalue
    if(tmp.second == 0) {
      cout << tmp.first << endl;
    }
  }


  return 0;
}

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

namespace ABC118B
{
    class Program
    {
        static void Main(string[] args)
        {
            var nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] a = new int[nm[1]];
            for(int i = 0; i < nm[0]; i++)
            {
                var line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                for(int j = 0;j < line[0]; j++)
                {
                    a[line[j + 1] - 1]++;
                }
            }
            var result = a.Where(x => x == nm[0]).Count();
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//二項係数の計算
int nCr(int A, int B) {
    ll ans = 1;
    for (int i = 0; i < B; i++) {
        ans *= A - i;
    }
    for (int i = 0; i < B; i++) {
        ans /= i + 1;
    }
    return ans;
}
int main() {
    string N;
    cin>>N;
    int a=N.size();
    int ans=0;
    for(int i=0; i<N.size(); i++){
        if(N.at(i)=='1'){
            ans+=1;
        }
        if(N.at(i)=='2'){
            ans+=2;
        }
        if(N.at(i)=='3'){
            ans+=3;
        }
        if(N.at(i)=='4'){
            ans+=4;
        }
        if(N.at(i)=='5'){
            ans+=5;
        }
        if(N.at(i)=='6'){
            ans+=6;
        }
        if(N.at(i)=='7'){
            ans+=7;
        }
        if(N.at(i)=='8'){
            ans+=8;
        }
        if(N.at(i)=='9'){
            ans+=9;
        }
        if(N.at(i)=='0'){
            ans+=0;
        }

    }
    if(ans%9==0){
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define INF 1000 * 1000;

int n, m;
int a[1000], b[1000], c[1000];
int g[100][100];

int main() {
  cin >> n >> m;
  rep(i, n)
    rep(j, n) {
      if (i == j)
        g[i][j] = 0;
      else
        g[i][j] = INF;
    }

  rep (i, m) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;

    g[a[i]][b[i]] = g[b[i]][a[i]] = c[i];
  }

  rep(k, n)
    rep(i, n)
      rep(j, n)
        g[i][j] = min(g[i][j], g[i][k] + g[k][j]);

  int count = 0;

  rep(i, m)
    count += g[a[i]][b[i]] < c[i];

  cout << count << endl;

  return 0;
}



Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef pair<string,ll> si;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
#define sort(a) sort(a.begin(),a.end());
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define mp make_pair
#define F first
#define S second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define nl "\n"
#define TC cin>>t;while(t--)
ll MOD = 1e9+7;
const ld PI = 3.1415926535898;
const ll LLMAX = LLONG_MAX;
const int N = 2e5+5;

ll power(int x, int y,int m) {
    ll temp;
    if( y == 0)
        return 1;
    temp = power(x, y/2,m)%m;
    if (y%2 == 0)
        return ((temp)*(temp))%m;
    else
        return (((x)%m)*((temp*temp)%m))%m;
}

int main()
{
	ios
	int n,k;
	cin>>n>>k;
	int a[k+1]={0};
	for(int i=k;i>=1;i--)
	{
		a[i]=power(k/i,n,MOD)%MOD;
		ll extra=0;
		for(int j=2*i;j<=k;j+=i)
		{
			extra+=a[j];
			extra%=MOD;
		}
		a[i]+=(MOD-extra)%MOD;
		a[i]%=MOD;
	}
	ll sum=0;
	for(int i=1;i<=k;i++)
	{
		sum+=(i%MOD)*(a[i]%MOD);
		sum%=MOD;
	}
	cout<<sum<<nl;	
}

Measured memory_bytes: 3992
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Net.WebSockets;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading;

class Test
{
    // Driver code 
    public static void Main()
    {

        //var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

        var s = Console.ReadLine();
        var t = Console.ReadLine();

        int n = s.Length;
        int m = t.Length;
        int ans = Int32.MaxValue;

        // Traverse the string S2 
        for (int i = 0; i < n - m + 1; i++)
        {
            int minRemovedChar = 0;
            for (int j = 0; j < m; j++)
            {
                if (t[j] != s[i + j])
                {
                    minRemovedChar++;
                }
            }

            // Take minimum of prev and  
            // current mis-match 
            ans = Math.Min(minRemovedChar, ans);

        }

        Console.WriteLine(ans);
    }
}






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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long

using namespace std;


int main() {

    int n; cin >> n;
    set<int> c;
    int p = 0;
    int l = 0;
    rep(i,n){
        int tmp; cin >> tmp;
        for(int j = 1; j <= 8; j ++){
            if(tmp < 400*j) {
                c.insert(j);
                break;
            }
            if(j == 8){
                p ++;
            }
        }
    }

    l = c.size();

    if(p == 0) {
        cout << l << " " << l;
    }
    else if(l == 8) cout << 8 << " " << 8 + p;
    else if(l == 0) {
        cout << 1 << " " << p;
    }else{
        cout << l << " " << l+p;
    }

    return 0;
}











Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define fo(a,b,c) for(int a=b;a<=c;a++)
#define go(a,b,c) for(int a=b;a>=c;a--)

const int maxn = 1e5+200;

int dp[maxn],a[maxn];

int main(){
    int n;scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    for(int i=n;i>=1;i--){
        if(a[i]>=a[i+1])dp[i]=dp[i+1]+1;
        else dp[i]=1;
    }
    int ans=0;
    for(int i=1;i<=n;i++)ans=max(ans,dp[i]-1);
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
int main(){
	int T=1;
	while(T--){
		int n;
		read(n);
		int s1=0,s2=0,s4=0;
		for(int i=1;i<=n;i++){
			int x;read(x);
			if(x%4==0) s4++;
			else if(x%2==0) s2++;
			else s1++;
		}
		if(s1>s4+1||s1==s4+1&&s2) puts("No");
		else puts("Yes");
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <algorithm>
#include <ctime>
#include <functional>
#include <iomanip>
using namespace std;

#define LL long long
LL N, A;

int main() {
    #ifdef LOCAL
    freopen("test.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
    #endif // LOCAL
    ios::sync_with_stdio(false);

    while(cin >> N >> A) {
        if(N % 500 <= A) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 10000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
typedef pair<P, int> PI;
typedef pair<int, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

#define S 23

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

int main() {
  int h, w;
  char s[S][S];
  int dist[S][S];
  int sx, sy, gx, gy;
  string pat;
  while(cin >> h >> w && h+w) {
    rep(i, h) rep(j, w) {
      dist[i][j] = INF;
      char c;
      cin >> c;
      s[i][j] = c;
      if(c != '#') {
        s[i][j] = '.';
        if(c == 'A') {
          sx = j; sy = i;
        } else if(c == 'B') {
          gx = j; gy = i;
        }
      }
    }
    cin >> pat;

    queue<P> que;
    que.push(P(sx, sy));
    dist[sy][sx] = 0;
    while(!que.empty()) {
      P e = que.front(); que.pop();
      int x = e.first, y = e.second;
      rep(k, 4) {
        int nx = x + dx[k], ny = y + dy[k];
        if(!(0 <= nx && nx < w && 0 <= ny && ny < h) || dist[ny][nx] < INF || s[ny][nx] == '#') {
          continue;
        }
        dist[ny][nx] = dist[y][x] + 1;
        que.push(P(nx, ny));
      }
    }

    int ans = INF;
    repl(i, 1, w*h*pat.length()) {
      int com = pat[(i-1)%pat.length()] - '0';
      int cy = 1 - (com - 1)/3, cx = ((com - 1)%3) - 1;
      if(0 <= gx + cx && gx + cx < w && 0 <= gy + cy && gy + cy < h) {
        gx += cx; gy += cy;
      }
      int t = dist[gy][gx];
      if(t <= i) {
        ans = i;
        cout << i SP gy SP gx << endl;
        break;
      }
    }
    if(ans == INF) {
      cout << "impossible" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1224
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.List
import Data.Ord

readInt = fromIntegral . fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

calc :: [Int] -> Int
calc = foldr (-) 0

main = do
  n <- getInt
  xs <- getIntList
  print $ calc (sortOn Down xs)

Measured memory_bytes: 508
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
S = list(input())
lens = len(S)
ans = [0] * lens
rl = 0
next = 0
for i in range(lens-1):
    if S[i] == 'R' and S[i + 1] == 'L':
        ans[i] += (next // 2 + 1)
        ans[i + 1] += ((next+1) // 2)
        rl = i
        next = 0
    elif S[i] == 'L':
        if (i - rl) % 2 == 0:
            ans[rl] += 1
        else:
            ans[rl + 1] += 1
    else:
        next += 1
if (lens - rl) % 2 == 0:
    ans[rl+1] += 1
else:
    ans[rl] += 1
print(" ".join(map(str, ans)))


Measured memory_bytes: 11176
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  string s;
  R s;
  ll n=s.size();
  ll d[n+1],M=MAX;
  d[0]=0;
  rep(i,n) {
    if(s[i]=='>') d[i+1]=d[i]-1;
    else d[i+1]=d[i]+1;
  }
  rep(i,n+1) M=min(M,d[i]);
  rep(i,n+1) d[i]-=M;
  ll a[n+1];
  rep(i,n+1) {
    ll x=MAX;
    REP(j,-1,2) {
      if(i+j>=0&&i+j<=n) x=min(x,d[i+j]);
    }
    if(x==d[i]) a[i]=0;
    else a[i]=d[i];
  }
  priority_queue<P,vector<P>,greater<P> > que;
  rep(i,n+1) {
    if(a[i]!=0) que.push(P(a[i],i));
  }
  while(!que.empty()) {
    P p=que.top();que.pop();
    ll k=p.S;
    ll x=0;
    REP(j,-1,2) {
      if(!j) continue;
      if(k+j>=0&&k+j<=n) {
        if(a[k]>a[k+j]) x=max(x,a[k+j]);
      }
    }
    a[k]=x+1;
  }
  ll ans=0;
  rep(i,n+1) ans+=a[i];
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 19216
fn main() {
    let mut n: Vec<u64> = Vec::new();
    for _ in 0..6 {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        n.push(buf.trim().parse().unwrap());
    }

    let mut min_size = n[1];
    for i in 2..6 {
        if n[i] < min_size {
            min_size = n[i]
        }
    }

    if n[0] <= min_size {
        println!("{}", 5);
        return;
    }

    let times: u64 = (n[0] as f64 / min_size as f64).ceil() as u64;

    println!("{}", times + 4);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
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()
{
    int N;
    cin >> N;
    string s, t;
    cin >> s >> t;
    int len = N * 2;
    for (int i=0; i<N; i++) {
        string n = s.substr(i);
        string m = t.substr(0, N-i);
        if (n == m) {
            len = N + i;
            break;
        }
    }

    cout << len << endl;
    return 0;
}

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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

ll gcd(ll a,ll b) {if (a==0) return b;return gcd(b%a,a);}

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    ll k,x; 
    cin >> k >> x;
    cout << (k*500 < x ? "No" : "Yes");
}
// Driver Function
int main()
{
    ll compte = 1;
    //test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cmath>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#define P pair<long long, long long>


using namespace std;
const long long int MOD=1e9+7;

int main(){
  long long n, k, h[200009];
  cin >> n >> k;
  for(int i=0;i<n;i++)cin >> h[i];
  sort(h, h+n);
  long long sm=0;
  for(int i=0;i<n-k;i++)sm+=h[i];
  cout << sm << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int t = 0;
vector<vector<int>> a(10010);
vector<int> d(10010);
vector<int> ans(10010);

void dfs(int n, int p)
{
	ans[n] = d[t];
	t++;
	for (auto& i : a[n]) {
		if (i == p) continue;
		dfs(i, n);
	}
}

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int b, c;
		cin >> b >> c;
		b--;
		c--;
		a[b].emplace_back(c);
		a[c].emplace_back(b);
	}
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> d[i];
		sum += d[i];
	}
	sort(d.rbegin(), d.rend());
	sum -= d[0];
	dfs(0, 0);

	cout << sum << endl;
	for (int i = 0; i < n; i++) {
		cout << ans[i] << (i == n - 1 ? "\n" : " ");
	}

	return 0;
}

Measured memory_bytes: 4464
const [n, as] = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\n/)
const length = Number(n) - 1
const arr = as.split(/\s/).map(Number).sort((a, b) => b - a)

let count = 0;
const acc = []
for (let i = 0; true; i++) {
  acc.push(arr[i])
  count++
  if (count === length) {
    break
  }
  if (i !== 0) {
    acc.push(arr[i])
    count++
  }
  if (count === length) {
    break
  }
}
console.log(acc.reduce((a, b) => a + b))

Measured memory_bytes: 59532
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // TODO 自動生成されたメソッド・スタブ
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();

        if(a<b && b<c){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


    }

}



Measured memory_bytes: 26388
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))

if n >= m:
    print(0)
    exit()

if n == 1:
    print(max(x)-min(x))
    exit()

d = []
for i in range(m-1):
    d.append(x[i+1]-x[i])

d.sort()
s = sum(d)
print(s-sum(d[-(n-1):]))


Measured memory_bytes: 13968
import sys
import os
import math

MOD = 10**9+7

def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    X, Y, Z = list(map(int, sys.stdin.readline().split()))
    print((X-Z)//(Y+Z))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import sys
  
for s in list(sys.stdin):
    a,b,e,c,d,f = list(map(float,s.split()))
    base = a*d-b*c
    x = e*d-b*f
    y = a*f-e*c
    print('%.3f %.3f' % (x/base+0,y/base+0))

Measured memory_bytes: 7352
#include<iostream>
#include<vector>

using namespace std;
int main() {
	int a;
	int N;
	vector<int> n;
	int key=0,score=0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a;
		n.push_back(a);
	}

	while (key != 1) {

		for (int i = 0; i < N; i++) {
			if (n[i] % 2 != 0) {
				key = 1;
			}
		}

		if (key == 0) {
			score++;
			for (int i = 0; i < N; i++) {
				n[i] = n[i] / 2;
			}
		}

	}

	cout << score << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int n,a[2000001];

void mH(int i){
  int l,r,la,m;
  l=2*i;
  r=2*i+1;

  if(l<=n&&a[l]>a[i]){
    la=l;
  }
  else{
    la=i;
  }
  if(r<=n&&a[r]>a[la]){
    la=r;
  }

  if(la!=i){
    m=a[i];
    a[i]=a[la];
    a[la]=m;
    mH(la);
  }
}

int main(){
  int i;

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }

  for(i=n/2;i>=1;i--){
    mH(i);
  }

  for(i=1;i<=n;i++){
    printf(" %d",a[i]);
  }
  printf("\n");

  return 0;
}



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

#define rep(i,n) for (int i=0; i<(n); i++)
const int INF =1001001001;
const ll BIG = 1000000007;



int main(){
    int n,m,x;
    cin >> n >> m >>x;
    vector<int> c(n);
    int a[n][m];
    rep(i,n){
        cin >> c[i];
        rep(j,m){
            cin >> a[i][j];
        }
    }
    int ans = INF;
    for(int i=1; i<(1<<n); i++){
        vector<int> xv(m,0);
        vector<int> s;
        int money = 0;
        for(int j=0; j<n; j++){
            if(i&(1<<j)){
                s.push_back(j);
                money += c[j];
                rep(k,m) xv[k] += a[j][k];
                }
        }
        bool ok = true;
        //cout << money <<endl;
        rep(k,m){
            if(xv[k]<x) ok = false;
        }
        if(ok) ans = min(ans, money);
    }
    if(ans==INF) ans = -1;
    cout << ans << endl;
    return 0;
}

/*
int main(){
    int n, m, x;
    cin >>n>>m>>x;

    vector<int> c_v(n);
    vector<vector<int>> a_v(n, vector<int>(m,0));
    
    int s;
    for (int i=0; i<n; i++){
        cin >> s;
        c_v[i] = s;
        for(int j=0; j<m; j++){
            cin >> s;
            a_v[i][j] = s;
        }
    }
    int money, ans;
    ans = INF;
    for (int bit=1; bit < (1<<n); bit++){
        money = 0;
        bool tmp;
        tmp = false;
        vector<int> S;
        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) { // i が bit に入るかどうか
                S.push_back(i);
            }
        }
        vector<int> x_v(m, x);
        for (int i = 0; i < (int)S.size(); ++i) {
            for (int j=0; j<m; j++){
                x_v[j] = x_v[j] - a_v[S[i]][j];
            }
            money += c_v[S[i]];
        }
        int i;
        for (int i=0; i<m; ++i) {
            if(x_v[i]>0) {
                tmp = true;
                break;
            }
        }
        if(tmp) continue;
        ans = min(money, ans);
    }
    if (ans == INF) ans = -1;
    cout << ans << endl;
    return 0;
}

int a[12][12];

int main(){
    int n,m,x;
    cin >> n>>m>>x;
    vector<int> c(n);
    rep(i, n) {
        cin >> c[i];
        rep(j, m) cin >> a[i][j];
    }
    int ans = INF;
    rep(s,1<<n){
        int cost = 0;
        vector<int> d(m);
        rep(i,n) {
            if(s>>i&1) {
                cost += c[i];
                rep(j,m) d[j] += a[i][j];
            }
        }
        bool ok = true;
        rep(j,m) if(d[j]<x) ok=false;
        if(ok) ans = min(ans, cost);
    }
    if(ans==INF) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}
*/

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

int main()
{
    int A, B, C;
    cin >> A >> B >> C;

    if ((A == B && A != C) || (A == C && A != B) || (B == C && B != A))
    {
        cout << "Yes";
    }else
    {
        cout << "No";
    }
    
    

    return 0;
}


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

int main() {
  std::string S, T;
  std::cin >> S >> T;

  uint32_t max_count = 0;
  for (size_t i = 0; i < S.size()-T.size()+1; i++)
  {
    uint32_t count = 0;
    for (size_t j = 0; j < T.size(); j++)
    {
      if(S[i+j] == T[j]) count++;
    }
    if(max_count < count) max_count = count;
  }
  

  std::cout << T.size() - max_count << std::endl;

  return 0;
}

Measured memory_bytes: 3628
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define dump(x)  cout << #x << " = " << (x) << endl;

#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
//             0123456789 - digits. check the limits, int vs long
const int MX = 100001;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;
    // freopen("ex.in","r",stdin);
    // freopen("ex.out","w",stdout);
    int n;
    cin >> n;
    bool can = false;
    for (int i = 1; i < 10; i++) {
        if (n % i == 0) {
            if (n / i < 10) can = true;
        }
    }
    if (can) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;
using li=list<int>;
using lil=list<ll>;
using lis=list<string>;
using fli=forward_list<int>;
using fll=forward_list<ll>;
using fls=forward_list<string>;
using si=stack<int>;
using sl=stack<ll>;
using ss=stack<string>;
using qi=queue<int>;
using ql=queue<ll>;
using qs=queue<string>;
using pqi=priority_queue<int>;
using pql=priority_queue<ll>;
using pqs=priority_queue<string>;
using dqi=deque<int>;
using dql=deque<ll>;
using dqs=deque<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (n); i < (a); i++)
#define repr(i, n) for(int i = (n); i >= 0; i--)
#define repr2(i, a, n) for(int i = (n); i >= (a); i--)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

template<typename T,typename U>
void Printarray2(T f,U n){
  for(int i=0;i<n;i++) cout<<f[i]<<endl;
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n,a,b;cin>>n>>a>>b;
  n*a<b ? cout<<n*a<<endl : cout<<b<<endl;
}

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

int main() {
  int A,B,C;
  cin>>A>>B>>C;
  if((A==B&&B==C)||(A!=B&&B!=C&&C!=A)){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define M 998244353
using namespace std;

ll power(ll a, ll b)
{
    if(b == 0)
        return 1;
    ll x = power(a,b/2);
    x = (x*x)%M;
    if(b%2)
        x = (x*a)%M;
    return x;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i,m = 0,ans = 1;
    cin>>n;
    ll d[n],f[n] = {0};
    for(i=0;i<n;i++)
        cin>>d[i];
    if(d[0] != 0)
    {
        cout<<0;
        return 0;
    }
    for(i=0;i<n;i++)
        f[d[i]]++;
    if(f[0] != 1)
    {
        cout<<0;
        return 0;
    }
    for(i=0;i<n;i++)
        m = max(m, d[i]);
    for(i=1;i<=m;i++)
        ans = (ans*power(f[i-1],f[i]))%M;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N;cin >> N;
    vector<int> d(N);
    rep(i,N)cin >> d[i];

    sort(all(d));
    int hal = (N/2) -1;


    int a = d[hal];
    int b = d[hal+1];
    int ans = b - a;

    cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
struct pos{
    int val;
    int th;
};
int n;
pos a[200010];
int map[200010];
bool cmp(pos a,pos b){
    if(a.val<b.val)
        return true;
    else return false;
}
int main(){
    cin>>n;
    for(int i=1; i<=n ;i++){
        scanf("%d",&a[i].val);
        a[i].th=i;
    }
    sort(a+1,a+n+1,cmp);

    for(int i=1; i<=n; i++){
        map[a[i].th] = i;
    }

    for(int i=1; i<=n; i++){
        if(map[i]<=n/2){
            printf("%d\n",a[n/2+1].val);
        }
        else
            printf("%d\n",a[n/2].val);
    }
    return 0;
}


Measured memory_bytes: 4480
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      String s = sc.next();
      boolean p = true;
      int n = 0;
      s = s.substring(0,s.length()-1);
      while(p){
        s = s.substring(0,s.length()-1);
      	n = s.length();
        if(n%2==0 && s.substring(0,n/2).equals(s.substring(n/2,n)) ) p = false;
      }
      System.out.println(s.length());
    }
}

Measured memory_bytes: 21716
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[] a = new long[n];
   
    for(int i = 0; i < n; i++){
      a[i] = sc.nextLong();
    }
    
    long ans = 0;
    for(int i = 1; i < n; i++){
      if(a[i-1] > a[i]){
        ans += a[i-1]-a[i];
        a[i] = a[i-1];
      }
    }
    
    
      System.out.println(ans);
    
  }
}

Measured memory_bytes: 61160
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
using namespace std;

int main()
{
    string n;
    while(cin >> n)
    {
        string ans = "";
        for(int i = 0; i < n.size(); i++)
        {
            if(n[i] == '1')
                ans += '9';
            else if(n[i] == '9')
                ans += '1';
            else
                ans += n[i];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
object Main extends App {
  import scala.annotation.tailrec
  import scala.io.StdIn._
  loop()
  @tailrec def loop(): Unit = {
    val n = readInt()
    if (n == 0) return
    val pipe = readLine.trim.split(' ').map(_.toInt).sum
    val joint = 0L +: readLine.trim.split(' ').map(_.toLong).sorted(Ordering.Long.reverse)
    for (i ← joint.indices.tail) joint(i) += joint(i - 1)
    println(joint.zipWithIndex.map { case (additional, count) ⇒ (pipe + additional) * (n - count) }.max)
    loop()
  }
}


Measured memory_bytes: 123820
m, d = map(int,input().split())

ans = 0
for i in range(1, m+1):
    for j in range(11, d+1):
        d1 = j // 10
        d2 = j % 10
        #print(d1, d2, i)
        if d1 >= 2 and d2 >= 2 and d1*d2 == i:
            ans += 1

print(ans)


Measured memory_bytes: 38896
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

using namespace std;


int main(){
    int a,b;
    cin >> a >> b;
    
    if(a > 9 || b > 9) {
        cout << "-1" << endl;
        return 0;
    }
    
    cout << a*b << endl;
    
    
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define semicolon ;
#define ryan bear
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
vector<pi>adj[100010];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int v,e;
    cin>>v>>e;
    vector<pi>p(v);
    vector<int>d(v);
    vector<int>cost(e,1000000000);
    for(int&t:d)
        cin>>t;
    for(int i=0;i<e;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[--u].eb(--v,i);
        adj[v].eb(u,i);
    }
    for(int i=0;i<v;i++)
        p[i].fi=d[i],p[i].se=i;
    sort(all(p));
    vector<int>col(v,0);
    for(pi&tt:p)
    {
        int i=tt.se;
        if(col[i]!=0)
            continue;
        for(pi&t:adj[i])
        {
            if(d[t.fi]<=d[i])
            {
                if(col[t.fi]==0)
                    col[t.fi]=1;
                col[i]=col[t.fi]==1?2:1;
                cost[t.se]=d[i];
                break;
            }
        }
        if(col[i]==0)
            return cout<<-1<<endl,0;
    }
    for(int i=0;i<v;i++)
        cout<<(col[i]==1?'B':'W');
    for(int i=0;i<e;i++)
        cout<<'\n'<<cost[i];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 12800
ans = []
while true
  m, f, r = gets.chop.split.map(&:to_i)
  break if m == -1 && f == -1 && r == -1
  a = [m, f, r].to_a
  ans << a
end
ans.each do |i, j, k|
  case
    when i == -1 || j == -1
      puts "F"
    when 80 <= i + j
      puts "A"
    when 65 <= i + j && i+j < 80
      puts "B"
    when 50 <= i + j && i+j < 65 || 50 <= k
      puts "C"
    when 30 <= i + j && i+j < 50
      puts "D"
    when i + j < 30
      puts "F"
  end
end

Measured memory_bytes: 8604
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long  n,d;
  cin>>n>>d;
  long long  count=0;
  while(n--){
    long long  x,y;
    cin>>x>>y;
   long double h=sqrt((x*x)+(y*y));
    long long  h1=ceil(h);
    if(h1<=d)
      count++;
  }
  cout<<count<<"\n";
  return 0;
}

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

int main() {
    unsigned long N, K;
    cin >> N >> K;
    long double ans = 0;
    for(unsigned long i = 1; i <= N; ++i){
        auto j =  i;
        long double p = 1;
        while(j < K){
            j *= 2;
            p /= 2;
        }
        ans += p;
    }
    printf("%.12Lf\n", ans / N);
    return 0;
}

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


int main() 
{
	int num;
	cin >> num;
	switch(num)
	{
		case 25:
			cout << "Christmas" << endl;
			break;
		case 24:
			cout << "Christmas Eve" << endl;
			break;
		case 23:
			cout << "Christmas Eve Eve" << endl;
			break;
		case 22:
			cout << "Christmas Eve Eve Eve" << endl;
			break;
		default:
			break;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef pair<l_l,ll> lll;
typedef vector<string> vs;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
const int mod = 998244353;
struct mint {
ll x;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
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];
}
};
int main(){
    ll n,m,k;cin>>n>>m>>k;
    combination c(220000);
    mint ans=0;
    mint col=m;
    for(int i=n-1;i>=0;i--){
        mint now=col;
        now*=c(n-1,i);
        if(i<=k)ans+=now;
        col*=m-1;
    }
    cout<<ans.x<<endl;
    return 0;
}

Measured memory_bytes: 6660
#include <iostream>
using namespace std;
using ll = long long;

int main()
{
  int n;
  cin >> n;
  if( n%10 == 3 ) cout << "bon" << endl;
  else if(n%10 == 2 || n%10 == 4 || n%10 == 5 || n%10 == 7 || n%10 == 9)cout <<"hon"<< endl;
  else cout << "pon" << endl;
  return 0;
}

Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define case(i) printf("Case #%d: ",i);
using namespace std;
typedef long long int ll;
typedef complex<double> com;
typedef pair<int, int> P;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 4e18;



int main(){
	int n; cin >> n;
	set<ll> st;
	rep(i, 0, n) {
		int p; cin >> p;
		if (st.count(p)) st.erase(p);
		else st.insert(p);
	}
	printf("%d", st.size());
	return 0;
}

Measured memory_bytes: 4864
while True:
    H,W = map(int,input().split())
    if H==W==0:
        exit()
    for i in range(H):
        if i % 2 == 0:
            for j in range(W):
                if j % 2 == 0:
                    print("#",end='')
                else:
                    print(".",end='')
        else:
            for j in range(W):
                if j % 2 == 1:
                    print("#",end='')
                else:
                    print(".",end='')
        print()
    print()


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

int main(){
   int A,B,C,X,m=0;
   cin>>A; 
   cin>>B; 
   cin>>C;
   cin>>X;
   int x=X/50,y,z;

   for(int a=0;a<=A;a++){
        y=x-10*a;
        if(y>=0){
           for(int b=0;b<=B;b++){
               z=y-2*b;
               if(z>=0&&C>=z){
                   m++;
               }
            }
        }    
   } 
    cout<<m<<endl;
    return 0;
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n,m,k;
    cin>>n>>m>>k;
    //vi a(m), b(m);
    vi rs(n,0);
    vector<vi> blocks(n);
    UnionFind uf(n);
    REP(i,m){
        int a,b;
        cin>>a>>b;
        a--; b--;
        rs[a] += 1;
        rs[b] += 1;
        uf.unite(a,b);
    }
    REP(i,k){
        int c,d;
        cin>>c>>d;
        c--; d--;
        blocks[c].emplace_back(d);
        blocks[d].emplace_back(c);
    }

    REP(i,n){
        //1…自分
        int ans = uf.size(i) - rs[i];
        ans -= 1;
        REP(j, blocks[i].size()){
            if(uf.find(i) == uf.find(blocks[i][j])) ans--;
        }
        cout << ans;
        if(i<n-1) cout<<" ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 6784
#include <stdio.h>

int main(){
  int A, B, C, D;
  scanf("%d %d %d %d", &A, &B, &C, &D);
  if(A*B <= C*D){
    printf("%d\n", C*D);
  }else{
    printf("%d\n", A*B);
  }
  return 0;
}


Measured memory_bytes: 128
n = int(input())
dic = {}
for _ in range(n):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 0

_max = 0
_list = sorted(dic.items(), key=lambda x:x[0])
for s, num in sorted(_list, key=lambda x:x[1], reverse=True):
    if num < _max:
        break
    else:
        _max = num
        print(s)

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

using namespace std;
const int maxn = 2000001;
int c[maxn], mark[maxn];
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
int main(){
	int n; cin >> n;
	assert(n >= 2);
	int a[n];
	memset(c, 0, sizeof c);
	bool not_pairwise = false;
	vector<int> v;

	for(int i = 0; i < n; i++) {
		cin >> a[i];
		v.push_back(a[i]);
	}

	
	for(int i = 0; i < n; i++) {
		c[v[i]]++;
	}
	
	int g = 1;
	for(int i = 0; i < n; i++) {
		if(i == 0) g = v[0];
		else g = __gcd(v[i], g);
		
	}
	memset(mark, 0, sizeof mark);
	if(!not_pairwise)
	{
		
		for(int i = 2; i < maxn; i++) {
			if(mark[i]) continue;
			int cnt = 0;
			for(int j = i; j < maxn; j+=i) {
				if(c[j]) cnt+=c[j];
				mark[j] = 1;
			}	
			if(cnt > 1) {
				not_pairwise = true;
			}
		}
	}
	string ans = "";
	if(!not_pairwise ) {
		ans =  "pairwise coprime\n";
	}else {
		if(g == 1 ) {
			ans =  "setwise coprime\n";
		}else ans = "not coprime\n";
	}
	// if(n==1) 
	// 	ans=="not coprime\n";
	
	cout << ans << endl;

	
	return 0;
}


Measured memory_bytes: 26808
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
int main() {
string s;
cin >> s;
ll minimum=754;
for(ll i=0;i<s.size()-2;i++){
    ll tmp=stoi(s.substr(i,3));
    minimum=min(minimum,abs(753-tmp));
}
cout << minimum << endl;
}


Measured memory_bytes: 256