akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

namespace A
{
    partial class Program
    {
        public IEnumerable<string> Solve()
        {
            var w = (double)Num; var h = (double)Num; var x = (double)Num; var y = (double)Num;

            var s = w * h / 2;
            var b = w / 2d == x && h / 2d == y;


            yield return s.ToString() + " " + (b ? "1" : "0");
        }
    }

    class StartingPoint
    {
        static void Main(string[] args)
        {
            if (args?.Any() == true)
            {
                var assembly = Assembly.GetExecutingAssembly();
                var resourceName = "AtCoder.Resources.In.txt";
                var stream = assembly.GetManifestResourceStream(resourceName);
                var streamReader = new StreamReader(stream, Encoding.UTF8);
                var str = streamReader.ReadToEnd();
                var textReader = new StringReader(str);
                Console.SetIn(textReader);
            }

            try
            {
                foreach (var s in new Program().Solve())
                {
                    Console.WriteLine(s);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                if (args?.Any() != true)
                    throw e;
            }

            if (args?.Any() == true)
                Console.ReadLine();
        }
    }

    partial class Program
    {
        long[] Nums(long count) => Enumerable.Range(0, (int)count).Select(_ => Num).ToArray();

        long Num => long.Parse(Str);

        StringBuilder sb = new StringBuilder();

        string Str => GetStr();
        string GetStr()
        {
            sb.Clear();

            int r = 0;
            bool? b = null;
            do
            {
                r = Console.Read();
                b = IsBreak(r);
            } while (b == true);

            if (b == null)
                throw new Exception("input error: unexpected end of stream");

            do
            {
                sb.Append((char)r);
                r = Console.Read();
                b = IsBreak(r);
            } while (b == false);

            return sb.ToString();
        }

        bool? IsBreak(int c)
        {
            switch (c)
            {
                case -1:
                    return null;
                case (int)' ':
                case (int)'\n':
                case (int)'\r':
                    return true;
                default:
                    return false;
            }
        }
    }
}

Measured memory_bytes: 13268
// ClassyNumbers
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
ll dp[ 10005 ][ 105 ][ 2 ];
string s;
ll d;
 
ll Solve(ll pos, ll sum, bool tight){
	if(pos == s.length())
		return sum == 0;
	if(dp[pos][sum][tight] != -1)
		return dp[pos][sum][tight];
 
	ll ans = 0;
	
	ll end = ((tight)?(s[pos]-'0'):9);
	for(ll i = 0; i<=end ;i++){
		ans =  (ans +Solve(pos+1,(sum+i)%d,tight&(i == end)))%mod;
	}
	return dp[pos][sum][tight] = ans;
}
 
 
int main(){
	
	cin>>s;
	cin>>d;
	memset(dp,-1,sizeof(dp));
 
	cout<<(Solve(0,0,1)-1+mod)%mod<<endl;
 
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

int n, r, w, ans;
string s;
// RW

int main() {
    cin >> n;
    cin >> s;
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'R')
            ++r;
        else
            ++w;
    }
    for (int i = 0; i < r; ++i) {
        if (s[i] != 'R')
            ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;


const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    int N; cin >> N;
    map<long long, int> m{};
    for(int i=0;i<N;i++){
        long long a; cin >> a;
        m[a]++;
    }
    long long ans =0;
    for(auto i=m.begin(); i!=m.end();i++){
        long long a=i->first; long long b=i->second;
        if(b>=a) ans+=b-a;
        else ans+=b;
    }
    cout << ans << endl;
}




Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int long long N,ans=0;
  cin >> N;
  map<string,int> S;
  for(int long long i=0;i<N;i++){
    string A;
    cin >> A;
    if(S.count(A))continue;
    else{
      S[A]=1;
      ans++;
    }
  }
  cout << ans << endl;
}


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

using namespace std;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x!=y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y];
			data[y] = x;
		}
		return x!=y;
	}
	
	bool sameSet(int x, int y) { return root(x) == root(y); }
	
	int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
	
	int size(int x) { return -data[root(x)]; }
};

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

int main() {
	int W, H; cin >> W >> H;
	vector<string> map;
	
	int tx = -1, ty = -1;
	
	for (int i=0; i<H; i++) {
		string str; cin >> str;
		map.push_back(str);
		
		for (int j=0; j<W; j++) {
			if (str[j]=='t') {
				tx = j;
				ty = i;
			}
		}
	}
	
	// i = y * H + x
	UnionFind uf(W*H+10);
	
	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			if (map[i][j]=='#') continue;
			
			for (int d=0; d<4; d++) {
				int x = j + dx[d], y = i + dy[d];
				if (!(0<=x && x<W && 0<=y && y<H)) continue;
				if (map[y][x]=='#') continue;
				uf.unionSet(i * W + j, y * W + x);
			}
		}
	}
	if (uf.sameSet(0, ty * W + tx)) {
		cout << 0 << endl; 
		return 0;
	}
	
	int N; cin >> N;
	for (int i=0; i<N; i++) {
		int x, y; cin >> x >> y;
		if (map[y][x]=='.') continue;
		
		map[y][x] = '.';
		for (int d=0; d<4; d++) {
			int _x = x + dx[d], _y = y + dy[d];
			if (!(0<=_x && _x<W && 0<=_y && _y<H)) continue;
			if (map[_y][_x]=='#') continue;
			uf.unionSet(y * W + x, _y * W + _x);
		}
		
		if (uf.sameSet(0, ty * W + tx)) {
			cout << i + 1 << endl;
			return 0;
		}
	}
	
	cout << -1 << endl;
	
	return 0;
}

Measured memory_bytes: 6148
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define int long long
signed main() {
	int n, k; cin >> n >> k;
	int ans = 0;
	for (int b = k + 1; b <= n; b++) {
		ans += (n / b * (b - k)) + max((int)0, (n%b) - (k == 0 ? 0 : k - 1));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
#define pi 3.1415926535
typedef long long ll;

int main(){
    int X;
    cin>>X;
    int ma=0;
    FOR(i,1,X+1){
        FOR(j,2,10){
            if(pow(i,j)>X){
                break;
            }
            ma=max(ma,(int)pow(i,j));
        }
    }
    cout<<ma<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
#define intt long long

int main() {
	int N; std::cin >> N;
	int min = 0;
	int max = 0;
	bool a = false;
	bool b = false;
	bool c = false;
	bool d = false;
	bool e = false;
	bool f = false;
	bool g = false;
	bool h = false;
	for (int i = 0; i < N; ++i) {
		int num; std::cin >> num;
		if (num < 400)
			a = true;
		if (num < 800 && 400 <= num)
			b = true;
		if (num < 1200 && 800 <= num)
			c = true;
		if (num < 1600 && 1200 <= num)
			d = true;
		if (num < 2000 && 1600 <= num)
			e = true;
		if (num < 2400 && 2000 <= num)
			f = true;
		if (num < 2800 && 2400 <= num)
			g = true;
		if (num <3200 && 2800 <= num)
			h = true;
		if (num >= 3200)
			++max;
	}
	if (a == true)
		++min;
	if (b == true)
		++min;
	if (c == true)
		++min;
	if (d == true)
		++min;
	if (e == true)
		++min;
	if (f == true)
		++min;
	if (g == true)
		++min;
	if (h == true)
		++min;

	std::cout << std::max(min, 1)  << " " << max + min << std::endl;

	return 0;
}

Measured memory_bytes: 3596
n, m = gets.split.map(&:to_i)
to = Array.new(100005){[]}
inf = 1000000000
m.times do |i|
  a, b = gets.split.map(&:to_i)
  a = a - 1
  b = b - 1
  to[a].push b
  to[b].push a
end

dist = Array.new(n, inf)
dist[0] = 0
pre = Array.new(n, -1)
q = Queue.new
q.push(0)

while(!q.empty?) do
  v = q.pop
  to[v].each do |u|
    if dist[u] == inf
      dist[u] = dist[v] + 1
      pre[u] = v
      q.push(u)
    end
  end
end

puts "Yes"
n.times do |i|
  if i > 0
    puts pre[i] + 1
  end
end


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

int main()
{
    string s;
    int sum,len,num;
    cin>>s;
    len = s.length();
    sum = 0;
    for(int i=0;i<len;i++){
        num = s[i]-48;
        sum+=num;
    }
    if(sum%9==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 3672
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
       Scanner scan= new Scanner(System.in);

       int r=scan.nextInt();
       int c=scan.nextInt();

       int a[][]=new int[r+1][c+1];
       int sum=0;

       for(int i=0;i<r;i++){
           int rsum=0;
           int nsum=0;
           for(int j=0;j<c;j++){
               a[i][j]=scan.nextInt();
               rsum+=a[i][j];
               a[r][j]+=a[i][j];
           }
           a[i][c]=rsum;
           a[r][c]+=rsum;
       }

       for(int i=0;i<r+1;i++){
           for(int j=0;j<c+1;j++){
               System.out.print(a[i][j]);
               if(j<c){
                   System.out.print(" ");
               }
           }
           System.out.println();
       }
    }
}



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

int main() {
  long long ai, ao, at, aj, al, as, az;
  cin>>ai>>ao>>at>>aj>>al>>as>>az;
  long long ans = ao;
  int mod_ai = ai % 2;
  int mod_aj = aj % 2;
  int mod_al = al % 2;
  if (mod_ai + mod_aj + mod_al == 0) {
    ans += ai + aj + al;
  } else if (mod_ai + mod_aj + mod_al == 1) {
    ans += (ai / 2 + aj / 2 + al / 2) * 2;
  } else if (ai > 0 && aj > 0 && al > 0) {
    ans += 3 + ((ai - 1) / 2 + (aj - 1) / 2 + (al - 1) / 2) * 2;
  } else {
    ans += (ai / 2 + aj / 2 + al / 2) * 2;
  }
  cout<<ans<<endl;
}

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

int main(void)
{
  int a, b, c;
  cin >> a >> b >> c;
  int sum = a + b + c;
  if(sum <= 21)
  {
    cout << "win" << endl;
  }else{
    cout << "bust" << endl;
  }
}

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

#define int long long

const int INF = LLONG_MAX/2;
const int MOD = 1000000000 + 7;
const int MAX_H = 100000, MAX_W = 100000;

int Pow(int x, int n)
{
	if (n == 0) return 1;
	return Pow(x*x % MOD, n/2)*((n&1) ? x : 1) % MOD;
}

int Inverse(int x)
{
	return Pow(x, MOD - 2);
}

int fac[MAX_W + MAX_H + 2];
int Factorial(int n)
{
	if (fac[0] == 0)
	{
		fac[0] = 1;
		for (int i = 1; i <= MAX_W + MAX_H + 1; i++) fac[i] = fac[i - 1]*i % MOD;
	}
	return fac[n];
}

int Combination(int n, int k)
{
	return (Factorial(n) * Inverse(Factorial(n - k)) % MOD)*Inverse(Factorial(k)) % MOD;
}

int H, W, A, B;

int CountWays(int x, int y)
{
	return Combination(x + y, x)*Combination(W - x - 1 + H - y - 1, W - x - 1) % MOD;
}

int Solve()
{
	int cnt = 0;
	for (int x = B - 1, y = H - A; x >= 0 && y < H; x--, y++)
	{
		(cnt += CountWays(x, y)) %= MOD;
	}
	return (CountWays(W - 1, H - 1) + MOD - cnt) % MOD;
}

signed main()
{
	cin >> H >> W >> A >> B;
	printf("%lld\n", Solve());
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 100005;
const int Q = 1e9 + 7;

int n , a[N];

int main() {
    scanf("%d" , &n);
    for (int i = 0 ; i < n ; ++ i) {
        scanf("%d" , &a[i]);
    }
    int res = 1;
    int x = 0;
    for (int i = 0 ; i + 1 < n ; ++ i) {
        int y = (a[i] + 1) / 2;
        ++ x;
        while (x > y) {
            res = (LL)res * (x --) % Q;
        }
    }
    ++ x;
    while (x) {
        res = (LL)res * (x --) % Q;
    }
    cout << res << endl;

}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main(void){
    long long N,i,a[50],n=1;
    cin >> N;
    if(N==0){
        cout << 0 << endl;
    }
    for(i=0;N!=0;i++){
        if(N%2==0){
            a[i]=0;
        }else{
            a[i]=1;
        }
        N=(N-a[i])*(-1)/2;
    }
    for(i--;i>-1;i--){
        cout << a[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
// Problem : C - Repsept
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define mod 1000000007
#define ss second
#define ff first
#define vpii vector<pii>
#define vvpii vector<vpii>
#define vvi vector<vi>
#define pb push_back
#define vs vector<string>
#define all(x) x.begin(),x.end()
#define mii map<int,int>
#define vd vector<double>
#define deb(x) cout<<#x<<" -> "<<x<<endl
const int inf=0x3f3f3f3f3f3f3f3f;
#define MAXN 1000005

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

void print(vi &v){
    for(int i=0;i<v.size();i++)cout<<v[i]<<" ";
    cout<<endl;
}

// <--------------------Code Begins Here-------------------->



int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    // cin>>t;
    while(t--){
        int n;
        cin>>n;
        int rem = 0;
	    int curr = 7 % n;
	    rem += curr;
	    rem %= n;
	    if(rem == 0) {
	    	cout<<1;
	    	return 0;
	    }
	    for(int i = 1; i < 1e7; i++) {
	    	curr = (curr * (10 % n)) % n;
	    	rem += curr;
	    	rem %= n;
		    if(rem == 0) {
		    	cout<<i + 1;
		    	return 0;
		    }
	    }
	    cout<<-1;
    }
    return 0;
}

Measured memory_bytes: 3648
import sys
N = input()
x = []
y = []
h = []
for i in range(N):
	_x, _y, _h = map(int, raw_input().split())
	x.append(_x)
	y.append(_y)
	h.append(_h)

for _x in range(101):
	for _y in range(101):
		candH = -1
		for i in range(N):
			if h[i] > 0:
				tmp = h[i] + abs(x[i] - _x) + abs(y[i] - _y)
				if candH == -1:
					candH = tmp
				elif candH == tmp:
					continue
				else:
					candH = -2
					break
		if candH == -2:
			continue
		for i in range(N):
			if h[i] == 0:
				dist = abs(x[i] - _x) + abs(y[i] - _y)
				if dist < candH:
					candH = -2
					break
					
		if candH == -2:
			continue
		print _x, _y, candH
		sys.exit()


Measured memory_bytes: 32620
import numpy as np
h,w=map(int,input().split())
a=[input() for _ in range(h)]
a=np.asarray([list(s) for s in a if s!='.'*w]).T

h=len(a[0])
a=np.asarray([x for x in a if ''.join(x)!='.'*h]).T

for x in a:
  print(''.join(x))

Measured memory_bytes: 12452
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    List<Point> red = new ArrayList<>();
    List<Point> blue = new ArrayList<>();
    for (int i=0; i<N; i++) {
      red.add(new Point(sc.nextInt(), sc.nextInt()));
    }
    for (int i=0; i<N; i++) {
      blue.add(new Point(sc.nextInt(), sc.nextInt()));
    }
    red.sort(Comparator.comparingInt(a -> a.y));
    blue.sort(Comparator.comparingInt(a -> a.x));
    int ans = 0;
    for (int i=0; i<N; i++) {
      Point blueI = blue.get(i);
      for (int j=red.size()-1; j>=0; j--) {
        Point redJ = red.get(j);
        if (redJ.x < blueI.x && redJ.y < blueI.y) {
          ans++;
          red.remove(redJ);
          break;
        }
      }
    }
    System.out.println(ans);
  }
  
  static class Point {
    int x;
    int y;
    Point (int x, int y) {
      this.x = x;
      this.y = y;
    }
  }
}


Measured memory_bytes: 27092
// D - Remainder Reminder
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	ll N,K; cin>>N>>K;
	ll cnt = 0;
	for(ll b=K+1; b<=N; ++b){
		ll p = N/b, r = N%b;
		cnt += p * max(0LL, b-K) + max(0LL, r-K + (K!=0));
	}
	cout<< cnt <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
vector<ll> L;
L.pb(2);
L.pb(1);
int n;
cin >> n;
if(n==1){
    cout << 1 << endl;
}
else{
    reps(i,n+1,2){
        L.pb(L[i - 1] + L[i - 2]);
    }
    cout <<L[n] <<endl;
}
//system("pause");
return 0;
}

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

int main() {
    int N,a,b,c,d;
    cin >> N;
    
    for (int i=0;i<N;i++) {
        string S;
        cin >> S;
        if (S=="P") {
            a+=1;
        }
        else if (S=="W") {
            b+=1;
        }
        else if (S=="G") {
            c+=1;
        }
        else if (S=="Y") {
            d+=1;
        }
    }
    if (d==0) {
        cout << "Three" << endl;
    }
    else if (d>=1) {
        cout << "Four" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=acos(-1);
const ll INF = 1LL<<62;
const ll MINF = -(1LL<<62);

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


vector<int> adj[300001];
int main() {
	IO;
	int n,m;
	cin>>n>>m;
	vector<int> h(n+1);
	for(int i=1;i<=n;++i) cin>>h[i];
	
	for(int i=0;i<m;++i) {
		int a,b;
		cin>>a>>b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	int ans=0;
	for(int i=1;i<=n;++i) {
		bool ok=true;
		for(auto j:adj[i]) {
			ok&=h[j]<h[i];
		}
		ans+=ok;
	}
	
	cout<<ans<<"\n";
	
	return 0;
}


Measured memory_bytes: 13492
#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include <cstdlib>
#include <typeinfo>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

template<class T>
void print(const T &value) {
    std::cout << value << std::endl;
}

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

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

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

//using Graph = vector<vector<pair<int, int>>>;
//Graph G(100100);

int mod9(int A) {
    int tmp = 0;
    while (A > 0) {
        tmp += A % 10;
        A /= 10;
    }
    return tmp;
}

//番号ズレ注意！！
int main() {
    int N, L;
    cin >> N >> L;
    string S[N];
    REP(i, N) {
        cin >> S[i];
    }
    sort(S, S + N);
    REP(i, N) {
        cout << S[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <stdint.h>
#include <algorithm>
#include <bitset>
#include <functional>
#include <iostream>
#include <string>
#include <vector>

int main(int argc, char *argv[]) {
  char a, b;
  std::cin >> a >> b;
  std::cout << ((a == b) ? "=" : (a < b) ? "<" : ">") << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#include <iomanip>
#include <limits>
#include <string>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
const long long INF = 1LL << 60;
ll mod=1e9+7;
using namespace std;

int main(){
	int n; cin >>n;
	vector<ll> a(n);
	cinf(n,a);
	ll mid=n/2;
	if(n%2==0) mid--;
	sort(a.begin(),a.end());
	vector<ll> v(n);
	v[mid]=a[0];
	for(int i=mid+2,j=1;i<n;i+=2,j+=2){
		v[i]=a[j];
	}
	for(int i=mid+1,j=n-1;i<n;i+=2,j-=2){
		v[i]=a[j];
	}
	for(int i=mid-2,j=2;i>=0;i-=2,j+=2){
		v[i]=a[j];
	}
	for(int i=mid-1,j=n-2;i>=0;i-=2,j-=2){
		v[i]=a[j];
	}
	ll cnt=0;
	for(int i=1;i<n;i++){
		cnt+=abs(v[i]-v[i-1]);
	}
	reverse(a.begin(),a.end());
	v[mid]=a[0];
	for(int i=mid+2,j=1;i<n;i+=2,j+=2){
		v[i]=a[j];
	}
	for(int i=mid+1,j=n-1;i<n;i+=2,j-=2){
		v[i]=a[j];
	}
	for(int i=mid-2,j=2;i>=0;i-=2,j+=2){
		v[i]=a[j];
	}
	for(int i=mid-1,j=n-2;i>=0;i-=2,j-=2){
		v[i]=a[j];
	}
	ll cnt1=0;
	for(int i=1;i<n;i++){
		cnt1+=abs(v[i]-v[i-1]);
	}
	cout << max(cnt,cnt1) << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
int main(void)
{
	int i;
	int j;
	
	for( i = 1; i < 10; i++ ) {
		for( j = 1; j < 10; j++ ) {
			printf("%dx%d=%d\n", i, j, i * j);
		}
	}
	
	return (0);
}

Measured memory_bytes: 0
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int xone = sc.nextInt();
		int yone = sc.nextInt();
		int xtwo = sc.nextInt();
        int ytwo = sc.nextInt();
		int xkyori = xtwo - xone;
		int ykyori = ytwo - yone;
		int xthree = xtwo - ykyori;
		int ythree = ytwo + xkyori;
		int xfour = xthree - xkyori;
		int yfour = ythree - ykyori;
		System.out.print(xthree + " " + ythree + " " + xfour + " " + yfour);

		
	}
}

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


int main()
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if (x + r > W) {
		cout << "No" << endl;
	}
	else if (x - r < 0) {
		cout << "No" << endl;
	}
	else if (y + r > H) {
		cout << "No" << endl;
	}
	else if (y - r < 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 3108
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main() {
	long n, d, x, y, a, count = 0;
	scanf("%ld", &n);
	scanf("%ld", &d);
	for (a = 0; a < n; a++) {
		scanf("%ld", &x);
		scanf("%ld", &y);
		if ( sqrt(x*x+y*y)<=d) {
			count++;
		}
	}
	printf("%ld\n",count);
	return 0;
	
}

Measured memory_bytes: 2096
// God put a smile upon your face <3

#include <bits/stdc++.h>

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

string s;

bool solve()
{
	for(auto it: s) for(auto jt: s) if(it != jt) return 1;

	return 0;
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> n >> m)
    {
		ans = -1;
		for(ll i = 1; i <= 1000000; i++)
		{
			ll x = i * 0.08;
			ll y = i * 0.1;

			if(x == n && y == m)
			{
				ans = i;
				break;
			}
		}

		cout << ans << "\n";
    }

}







Measured memory_bytes: 3588
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
t = sum(b)
ans = 0
j = m

for i in range(n+1):
    while j > 0 and t>k:
        j -= 1
        t -= b[j]
    if t>k: break
    ans = max(ans, i+j)
    if i==n: break
    t += a[i]

print(ans)


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

int main()
{
  int n;
  cin >> n;
  vector<int> p(n);
  for (auto&& e : p) {
    cin >> e;
  }
  int ans = 0;
  for (int i = 1; i < n - 1; i++) {
    if ((p[i - 1] < p[i] && p[i] < p[i + 1])
     || (p[i - 1] > p[i] && p[i] > p[i + 1])) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/*
  AOJ 1016
  Title:Fibonacci Sets
  @kankichi573
*/
#include <stdio.h>

int F[1001];
int V,d;

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}


void make_fib(int d)
{
  int i;

  F[0]=1;F[1]=2;
  for(i=2;i<=d;i++)
    F[i]=(F[i-1]+F[i-2])%1001;

}
main()
{
  int i,cnt;

  while(EOF!=scanf("%d %d",&V,&d))
    {
      make_fib(V);

      qsort(F,V+1,sizeof(int),compare_int);

      //     for(i=1;i<=V;i++)
      //	printf("%d:",F[i]);

      cnt=1;
      for(i=2;i<=V;i++)
	{
	  if(F[i]-F[i-1]>=d)
	    {
	      cnt++;
	      //printf("\n");
	    }
	  //printf("%d;",F[i]);
	}
      printf("%d\n",cnt);
    }
  return(0);
}

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

//D日目時点のスコアを計算
int score(int D, int c[], int s[][26], int t[]){
    int pen_day[26];
    for(int i=0; i<26; i++){
        pen_day[i]=1;
    }
    int score=0;
    
    for(int i=0; i<D; i++){
        int type=t[i]-1;
        pen_day[type]=0;
        //満足度増加
        score+=s[i][type];
        //満足度低下
        for(int j=0; j<26; j++){
            int dec=c[j]*pen_day[j];
            score-=dec;
        }
        //日数追加
        for(int j=0; j<26; j++){
            pen_day[j]++;
        }        
    }
    return score;
}

//満足度の変移
int hen_pen(int st, int end, int c[], int s[][26], int t[], int type1, int type2){
    int sum=0;
    int de_type1=0;
    int de_type2=0;
    int last1=0, last2=0;

    for(int i=st; i<=end; i++){
        if(t[i]==type1){
            de_type1++;
            last1=i;
        }
        if(t[i]==type2){
            de_type2++;
            last2=i;
        }
    }

    sum+=c[type1]*de_type1;
    sum+=c[type2]*de_type2;
    sum+=(end-last1)*c[type1];
    sum-=(last2-st)*c[type2];

    return sum;
}

void Greedy(int D, int c[], int s[][26]){
    int t[D], max_type=0, max_score=0;

    for(int i=0; i<D; i++){
        max_score=0;
        for(int j=0; j<26; j++){
            t[i]=j+1;
            int S=score(i+1, c, s, t);
            if(max_score < S){
                max_score = S;
                max_type=j+1;
            }
        }
        t[i]=max_type;
    }

    //局所探索
    int tmp;
    int roop_num=0;
    int MAX=max_score;
    while(1){
        int a=rand()%D;
        int b=rand()%D;

        if(a>b){
            tmp=a;
            a=b;
            b=tmp;
        }

        //t[a],t[b]を入れ替え
        tmp=t[a];
        t[a]=t[b];
        t[b]=tmp;

        //scoreを計算
        int now_score=score(b+1, c, s, t);
        if(MAX<now_score) MAX=now_score;
        else{
            tmp=t[a];
            t[a]=t[b];
            t[b]=tmp;  
        }
        roop_num++;
        if(roop_num==D*100) break;
    }

    for(int i=0; i<D; i++){
        printf("%d\n", t[i]);
    }
}

int main(void){
    int D, c[26], s[365][26];

    //入力
    scanf("%d", &D);
    for(int i=0; i<26; i++){
        scanf("%d", &c[i]);
    }
    for(int i=0; i<D; i++){
        for(int j=0; j<26; j++){
            scanf("%d", &s[i][j]);
        }
    }

   /*ここから処理*/
   /*
    int num=1;
    for(int i=0; i<D; i++){
        printf("%d\n", num);
        num++;
        if(num>26) num=1;
    }
    */

   Greedy(D, c, s);


    return 0;
}

Measured memory_bytes: 1728
#include <stdio.h>
#include <string.h>
int main(){
  int result=999;
  int i,tmp,n;
  char s[11];
  
  scanf("%s",s);
  n=strlen(s);
  for(i=0;i<n-2;i++){
    tmp=(s[i]-'0')*100;
    tmp+=(s[i+1]-'0')*10;
    tmp+=s[i+2]-'0';
    tmp=753-tmp;
    if(tmp<0) tmp=0-tmp;
    if(tmp<result) result=tmp;
  }
  
  printf("%d",result);
}

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

class C
{
	static void Main()
	{
		var M = 1000000007;
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var n = h[0];
		long c_ = 100 * ModInv(100 - h[3], M) % M, a = h[1] * c_ % M * ModInv(100, M) % M, b = h[2] * c_ % M * ModInv(100, M) % M;

		long e = 0, ncr = 1, pa = ModPow(a, n, M), pb = ModPow(b, n, M);
		for (var i = n; i < 2 * n; i++, ncr = ncr * (i - 1) % M * ModInv(i - n, M) % M, pa = pa * b % M, pb = pb * a % M) e = (e + i * ncr % M * (pa + pb)) % M;
		Console.WriteLine(c_ * e % M);
	}

	static long ModPow(long b, int i, int mod)
	{
		for (var r = 1L; ; b = b * b % mod)
		{
			if (i % 2 > 0) r = r * b % mod;
			if ((i /= 2) < 1) return r;
		}
	}
	static long ModInv(int x, int p) => ModPow(x, p - 2, p);
}


Measured memory_bytes: 11348
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


int main(){
  long n;
  long ans = 0;

  cin >> n;

  if(n % 2 == 0)
    ans = n;
  else
    ans = n * 2;

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


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  long long mod = 998244353;
  vector<vector<long long>> dp(c+1, vector<long long>(d+1));
  
  for (int i = a; i < c+1; i++){
    for (int j = b; j < d+1; j++){
      if (i == a && j == b){
        dp[i][j] = 1;
      }
      else if (i == a){
        dp[i][j] = dp[i][j-1]*i%mod;
      }
      else if (j == b){
        dp[i][j] = dp[i-1][j]*j%mod;
      }
      else{
        dp[i][j] = dp[i-1][j]*j%mod + dp[i][j-1]*i%mod + mod - dp[i-1][j-1]*(i-1)*(j-1)%mod;
        dp[i][j] %= mod;
      }
    }
  }
  
  cout << dp[c][d] << endl;
}



Measured memory_bytes: 73676
n = int(input())
a = list(map(int,input().split()))
if a.count(0) == n:
    print("Yes")
else:
  if n % 3 != 0:
    print("No")
  else:
    s = set(a)
    if len(s)>3 or len(s)==1:
      print("No")
    elif len(s)==2:
      if a.count(0) == n/3:
        print("Yes")
      else:
        print("No")
    else:
      l = list(s)
      if (l[0]^l[1] == l[2] and l[1]^l[2] == l[0] and l[2]^l[0] == l[1]) and (a.count(l[0])==n/3 and a.count(l[1])==n/3):
        print("Yes")
      else:
        print("No")

Measured memory_bytes: 60784
#include <bits/stdc++.h>
using namespace std;
int main() {
    int k;
    char s[106];
    cin>>k>>s;
    if (strlen(s)>k) {
        s[k]='.';
        s[k+1]='.';
        s[k+2]='.';
        s[k+3]='\0';
    }
    cout << s << endl;
    return 0;
}

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

main() {
  int N; cin >> N;
  map<int, int> mp;
  for (int i = 0; i < N; i++) {
    int D; cin >> D;
    mp[D] = (mp.find(D) == mp.end()) ? 1 : mp[D] + 1;
  }
  int M; cin >> M;

  bool ans = true;
  for (int i = 0; i < M; i++) {
    int T; cin >> T;
    if (mp.find(T) == mp.end() || mp[T] == 0) {
      ans = false;
    } else {
      mp[T]--;
    }
  }
  cout << ( (ans) ? "YES" : "NO" ) << endl;
}


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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll N;
    ll neg = 0;
    ll sum = 0;
    vector<ll> A;
    cin >> N;
    A.resize(N);
    for(ll i = 0;i < N;i++) {
        ll temp;
        cin >> temp;
        if(temp < 0) neg++;
        A[i] = abs(temp);
    }
    if(neg % 2) {
        sort(A.begin(), A.end());
        for(ll i = 1;i < N;i++) {
            sum += A[i];
        }
        sum -= A[0];
    } else {
        for(auto &i: A) sum += i;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 1024
import sys
input = sys.stdin.readline

N,x=list(map(int,input().split()))
a=list(map(int,input().split()))

ans=0
if N>2:
  for i in range(1,N-1):
    sum0=a[i-1]+a[i]
    sum1=a[i]+a[i+1]
    if i==1 and sum0>x:
      ans+=sum0-x
      a[1]-=sum0-x
      if a[1]<0:
        a[0]+=a[1]
        a[1]=0
        
      sum0=a[i-1]+a[i]
      sum1=a[i]+a[i+1]
    if (sum0<=x and sum1>x):
      ans+=sum1-x
      a[i+1]-=sum1-x
      if a[i+1]<0:
        a[i]+=a[i+1]
        a[i+1]=0

else:
  if a[0]+a[1]>x:
    ans=a[0]+a[1]-x
print(ans)
    

Measured memory_bytes: 14620
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<deque>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int m;cin >> m;
	
	cout << 48-m << endl;
	
	return 0;
}

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

long long n, a, b, s, x[100005];
int main()
{
    int i;
    cin >> n >> a >> b;
    for (i = 0; i < n; i++) scanf("%d", &x[i]);
    for (i = 1; i < n; i++) s += min((x[i] - x[i - 1]) * a, b);
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 1024
N=int(input())
la=list(map(int,input().split()))
lsum=[0]
for i in range(N):
    lsum.append(lsum[i]+la[i])
d={}
for ll in lsum:
    if ll in d:
        d[ll]+=1
    else:
        d[ll]=1
ans=0
for k in d:
    if d[k]>1:
        ans+=d[k]*(d[k]-1)/2
print(int(ans))


Measured memory_bytes: 41076
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;

unsigned long long int ans(unsigned long long int x, unsigned long long int y){
    long long int ans = 1;
    for(unsigned long long int i = 1; i<=y; i++){
        ans = ans *x;
    }
    return ans;
}

int main()
{
    unsigned long long int N;
    
    cin >> N;
    
//    if(N== 0){
//        cout << 0 << endl;
//        return 0;
//    }
    
    unsigned long long int n = 0;
    unsigned long long int total = 0;
    unsigned long long int count = 1;
    
    while(1){
        n = N/(2*(ans(5,count)));
        if(n == 0) break;
        total += n;
        count++;
    }
    if (N % 2 == 0){
        cout << total << endl;
    }
    else{
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n,y=map(int,input().split())
y//=1000
a=False
r=range
for i in r(n+1):
    for j in r(n-i+1):
        o=(n-i-j)
        if i*10+j*5+o==y and i+j<=n:
            print(i,j,o)
            a=True
    if a:break
if not a:print(-1,-1,-1)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
    int a,b,d,r;
    double f;
    
    scanf("%d %d", &a,&b);
    d=a/b;
    r=a%b;
    f=1.0*a/b;
    printf("%d %d %.6f\n",d,r,f);
    return 0;
}



Measured memory_bytes: 2068
#include <bits/stdc++.h>
#define lli long long int

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> v(2*n);
	for(int i=0;i<2*n;i++){
		cin >> v[i];
	}
	sort(v.begin(),v.end());
	int ans = 0;
	for(int i=0;i<n;i++){
		ans += v[i*2];
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
import scala.io.StdIn.readLine

object Main extends App {
  def evaluate(x:Double,y:Double) = {
                if(x<35.5 && y < 71.0) "AAA"
    else if(x<37.5 && y<77.0) "AA"
    else if(x<40.0 && y<83.0) "A"
    else if(x<43.0 && y<89.0) "B"
    else if(x<50.0 && y<105.0) "C"
    else if(x<55.0 && y<116.0) "D"
    else if(x<70.0 && y<148.0) "E"
    else "NA"
  }

  Iterator.continually(readLine).takeWhile(_!=null).map( _.split(" ").map(_.toDouble) ).foreach { n =>
        println(evaluate(n(0),n(1)))
  }
}

Measured memory_bytes: 43644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
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; }

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<pair<int, int>> cb(m);
    rep(i,m){
        int b, c;
        cin >> b >> c;
        cb[i] = make_pair(c, b);
    }

    sort(all(a));
    sort(rall(cb));

    int start = 0;
    rep(i,m){
        int c = cb[i].first;
        int b = cb[i].second;
        int cnt = 0;
        for(int j = start; j < n; j++){
            if (a[j] >= c || cnt == b) break;
            a[j] = c;
            start = j + 1;
            cnt++;
        }
    }

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

Measured memory_bytes: 4564
def resolve():
    n,k=map(int,input().split())
    a=sorted(list(map(int,input().split())))
    MOD=10**9+7
    ans=1
    if k==1:
        ans=a[-1]
    elif a[0]>=0 or (a[-1]<0 and k%2==1):
        for i in a[-k:]:
            ans=(ans*i)%MOD
    elif a[-1]<0 and k%2==0:
        for i in a[:k]:
            ans=(ans*i)%MOD
    else:
        ans=1
        if k%2==1 and n>=3:
            ans*=a[-1]
            ans%=MOD
            l,r=0,-2
            lm=a[0]*a[1]
            rm=a[-2]*a[-3]    
        else:
            l,r=0,-1
            lm=a[0]*a[1]
            rm=a[-1]*a[-2]
        for i in range(k//2):
            if lm>=rm:
                ans*=lm%MOD
                l+=2
                if l<=n-2:
                    lm=a[l]*a[l+1]
            else:
                ans*=rm%MOD
                r-=2
                if 1<=n+r:
                    rm=a[r]*a[r-1]
            ans%=MOD
    print(ans)

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 32044
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define mod 1000000007 //1e9+7
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 1001

struct BipartiteMatching{
  
  int V;
  vector<vector<int> > G;
  vector<int> match;
  vector<bool> used;
  
  BipartiteMatching(int n):
    V(n),G(n,vector<int>()),used(n,false){}
  
  void add_edge(int u, int v){
    G[u].push_back(v);
    G[v].push_back(u);
  }
  
  bool dfs(int v){
    used[v] = true;
    for(int i=0;i<G[v].size();i++){
      int u = G[v][i], w = match[u];
      if(w < 0 || (!used[w] && dfs(w))){
        match[v] = u;
        match[u] = v;
        return true;
      }
    }
    return false;
  }
  
  int solve(){
    int res = 0;
    match.assign(V,-1);
    for(int i=0;i<V;i++){
      if(match[i] < 0){
        used.assign(V,false);
        if(dfs(i)) res++;
      }
    }
    
    return res;
  }
  
};



int main(){
  int x,y,e;

  scanf("%d%d%d",&x,&y,&e);

  BipartiteMatching bip(x+y);

  for(int i=0;i<e;i++){
    int a,b;

    scanf("%d%d",&a,&b);

    bip.add_edge(a,b+x);
  }

  printf("%d\n",bip.solve());
  
  return 0;
}

Measured memory_bytes: 3380
a,b=map(int, input().split())
if (100*a)%8==0:
    min8=int(a/0.08)
else:
    min8=int((a/0.08)+1)
if (100*(a+1))%8==0:
    max8=int((a+1)/0.08)-1
else:
    max8=int((a+1)/0.08)
min10=int(b/0.1)
max10=int((b+1)/0.1)-1

for i in range(min8,max8+1):
    if min10<=i<=max10:
        print(i)
        exit()
print("-1")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw				"\n"


int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans=0;
	map<ll,ll>mp;
	cin>>n;
	for(m=1;;m++){
		cin>>n;
		if(mp[n])return cout<<m,0;
		mp[n]++;
		n=(n%2?3*n+1:n/2);
	}
	
}


Measured memory_bytes: 3612
// HEADERS //
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <climits>
#include <stack>
#include <unordered_map>
#include <bitset>
 
// MISCELLANEOUS //
#define fast_IO() ios_base::sync_with_stdio(false),cin.tie(NULL)
#define gcd __gcd
#define cnt_1 __buitlin_popcount
#define ll long long
#define endl "\n"
#define scn_I(x) scanf("%d",&x)
#define scn_L(x) scanf("%lld",&x) 
#define test(t) cin>>t; while(t--)
#define mem(v,x) memset(v,x,sizeof(v))
 
// LOOPS //
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define irep(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define srep(i,v) for(decltype(v.begin())i=v.begin();i!=v.end();i++)
 
// CONTAINERS //
// #define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define ii pair<int,int>
#define ff first
#define ss second
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define msi map<string,int>
#define mll map<ll,ll>
#define pb push_back
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define all(v) (v).begin(),(v).end()
#define present(v,x) (v).find(x)!=(v).end()
 
// DEBUGGING //
#define dbg() printf("\n**DEBUG**\n") 
#define chk(a) cerr<<endl<<#a<<":"<<a<<endl
#define chk2(a,b) cerr<<endl<<#a<<":"<<a<<"\t"<<#b<<":"<<b<<endl
 
// CONSTANTS //
#define PI acos(-1)
#define M 1000000007
 
// MAIN //
// using namespace __gnu_pbds; 
using namespace std;
int main()
{
  fast_IO();
  int N,W,w,v; 
  cin>>N>>W;
  ll dp[W+1]={0};
  rep(i,0,N)
  {
    cin>>w>>v;
    for(int j=W-w;j>=0;--j) dp[j+w]=max(v+dp[j],dp[j+w]);
  }
  cout<<dp[W];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
#define INF 1000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

bool dbgflag = false;

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

  ll x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector<ll> red(a), green(b), blue(c);
  for (int i = 0; i < a; i++) cin >> red[i];
  for (int i = 0; i < b; i++) cin >> green[i];
  for (int i = 0; i < c; i++) cin >> blue[i];

  sort(red.begin(), red.end());
  reverse(red.begin(), red.end());
  sort(green.begin(), green.end());
  reverse(green.begin(), green.end());
  sort(blue.begin(), blue.end());
  reverse(blue.begin(), blue.end());

  ll get_red = x-1, get_green = y-1;
  ll get_blue = 0;
  ll get;
  bool redf = true, greenf = true;

  while (1) {
    //cout << get_red << " " << get_green << " " << get_blue << endl;
    if ((redf) && (greenf)) {
      get = min(red[get_red], green[get_green]);
      if (get > blue[get_blue]) break;
      else if (get == red[get_red]) get_red--;
      else get_green--;
    }
    else if (redf) {
      get = red[get_red];
      if (get > blue[get_blue]) break;
      get_red--;
    }
    else if (greenf) {
      get = green[get_green];
      if (get > blue[get_blue]) break;
      get_green--;
    }
    else break;

    get_blue++;
    if (get_blue == c) break;
    if (get_red == -1) redf = false;
    if (get_green == -1) greenf = false;
  }

  //cout << get_red << " " << get_green << " " << get_blue << endl;
  ll yum = 0;
  for (int i = 0; i <= get_red; i++) yum += red[i];
  for (int i = 0; i <= get_green; i++) yum += green[i];
  for (int i = 0; i < get_blue; i++) yum += blue[i];

  cout << yum << endl;

}


Measured memory_bytes: 2560
#include<stdio.h>

int main(){
    int n;
    int p[100];
    int i, j, k;
    int ans =0;

    scanf("%d", &n);

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

    for(i=2; i<n; i++){
        if(p[i-2]<p[i-1] && p[i-1]<p[i]){
            ans +=1;
        }
        if(p[i]<p[i-1] && p[i-1] < p[i-2]){
            ans +=1;
        }
    }

    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128