akhauriyash/Code-Regression huggingface dataset:
A, B = map(int, input().split(" "))
_min = int(A / 0.10)
_max = int(B / 0.08)
flg = True
for i in range(_min-3, _max+3):
  if int(i *  0.08) == A and int(i * 0.10) == B:
    print(i)
    flg = False
    break
if flg:
  print(-1)

Measured memory_bytes: 3060
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	std::string a, b;
	std::cin >> a >> b;
	if (a=="D" && b=="D")
		std::cout << "H\n";
	else if (a == "H" && b=="H")
		std::cout << "H\n";
	else
		std::cout << "D\n";
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N,K;cin >> N >> K;
    cout << N-K+1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int R;
	cin>>R;
	if(R<1200)
		cout<<"ABC";
	if(R>=1200&&R<2800)
		cout<<"ARC";
	if(R>=2800)
		cout<<"AGC"; 
	return 0;
}

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

int main()
{
	int n;
	int a[100000];
	cin >> n;
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	int tmp = a[0];
	for (int i = 1; i < n; i++)
		tmp ^= a[i];
	if (!tmp)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}


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

int main(){
	int N, M;
  	int a, b;
  	bool exist_route = false;
  
  	cin >> N >> M;
  	vector<bool> pass(N+1, false);
  
  	for (int i=0; i<M; i++){
      cin >> a >> b; 
      if( a == 1){
        if(pass[b]){
        	exist_route = true;
        }
      	pass[b] = true;
      }
      else if( b == N ){
        if(pass[a]){
        	exist_route = true;
        }
      	pass[a] = true;
      }
    }
  

	if( exist_route){
      cout << "POSSIBLE";
    }  
  	else{
        cout << "IMPOSSIBLE";
    }
  
}

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

typedef long long ll;
typedef pair<int,int> pint;
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) 
#define repi(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,v.size()) {cin >> v[i];}
//最終奥義
#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());
signed main(void){
  int n,m;cin >> n >> m;
  multiset<int> s;
  rep(i,n){
    int t;cin >> t;
    s.insert(t);
  }
  rep(i,m){
    int t=*s.rbegin();
    auto itr=s.find(t);
    s.erase(itr);
    s.insert(t/2);
  }
  cout << accumulate(all(s),0LL) << endl;



}


Measured memory_bytes: 4992
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val diceNum = sc.nextLine().split(" ")
  val cmds = sc.nextLine().toList.map(_.toString)

  val dice = new Dice(diceNum)
  cmds.foreach(dice.roll)

  println(dice.getCurrentPositionMap.get(Position.TOP).get)

  class Dice(val num: Array[String]) {
    val initNumber = num.map(_.toInt)
    private val controller = createPositionController

    def roll(cmd: String): Unit = {
      controller(cmd)
    }

    def getCurrentPositionMap = controller("0")

    def createPositionController: (String) => scala.collection.mutable.Map[String, Int] = {
      val current = scala.collection.mutable.Map(
        Position.TOP -> initNumber(DiceLabel._1),
        Position.BOTTOM -> initNumber(DiceLabel._6),
        Position.EAST -> initNumber(DiceLabel._3),
        Position.WEST -> initNumber(DiceLabel._4),
        Position.SOUTH -> initNumber(DiceLabel._2),
        Position.NORTH -> initNumber(DiceLabel._5)
      )
      (cmd: String) => {
        cmd match {
          case "E" =>
            val tmp = current.get(Position.EAST).get
            current.update(Position.EAST, current.get(Position.TOP).get)
            current.update(Position.TOP, current.get(Position.WEST).get)
            current.update(Position.WEST, current.get(Position.BOTTOM).get)
            current.update(Position.BOTTOM, tmp)
            current
          case "W" =>
            val tmp = current.get(Position.WEST).get
            current.update(Position.WEST, current.get(Position.TOP).get)
            current.update(Position.TOP, current.get(Position.EAST).get)
            current.update(Position.EAST, current.get(Position.BOTTOM).get)
            current.update(Position.BOTTOM, tmp)
            current
          case "S" =>
            val tmp = current.get(Position.SOUTH).get
            current.update(Position.SOUTH, current.get(Position.TOP).get)
            current.update(Position.TOP, current.get(Position.NORTH).get)
            current.update(Position.NORTH, current.get(Position.BOTTOM).get)
            current.update(Position.BOTTOM, tmp)
            current
          case "N" =>
            val tmp = current.get(Position.NORTH).get
            current.update(Position.NORTH, current.get(Position.TOP).get)
            current.update(Position.TOP, current.get(Position.SOUTH).get)
            current.update(Position.SOUTH, current.get(Position.BOTTOM).get)
            current.update(Position.BOTTOM, tmp)
            current
          case "0" => current
        }
      }
    }

    object DiceLabel extends Enumeration {
      val _1 = 0
      val _2 = 1
      val _3 = 2
      val _4 = 3
      val _5 = 4
      val _6 = 5
    }

  }

  object Position extends Enumeration {
    val TOP = "TOP"
    val BOTTOM = "BOTTOM"
    val EAST = "EAST"
    val WEST = "WEST"
    val SOUTH = "SOUTH"
    val NORTH = "NORTH"
  }

}

Measured memory_bytes: 45292
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <string>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int h,w; cin >> h >> w;
    int dh[8] = {1, 1, 1, 0, -1, -1, -1, 0}, dw[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
    char map[h][w], out_map[h][w] = {'0'};
    for(int i = 0; i<h; ++i)for(int j = 0; j<w; j++)cin >> map[i][j];

    for(int i = 0; i<h; ++i){
        for(int j = 0; j<w; ++j){
            int count = 0;
            if(map[i][j] == '#')out_map[i][j] = '#'; 
            
            else{
                for(int d = 0; d<8; d++){
                    int y = dh[d]+i, x = dw[d]+j;
                    if(y>=0 && y<=h-1 && x>=0 && x<=w-1)
                    if(map[y][x] == '#')++count;
                }
                out_map[i][j] = count+'0';
            }
            
        }
    }
    for(int i = 0; i<h; ++i){for(int j = 0; j<w; j++)cout << out_map[i][j]; cout << endl;}
}

Measured memory_bytes: 256
N, L = list(map(int, input().split()))

apples = [0] * N

ate_apple = 100
apple_pie = 0

for i in range(N):
  apples[i] = L + i
  apple_pie += apples[i]
  if abs(ate_apple) > abs(apples[i]):
    ate_apple = apples[i]

print(apple_pie - ate_apple)


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

using namespace std;
int main() {
	int n, limit; cin >> n >> limit;
	vector<long long>dp(n * 1000 + 1); for (int i = 1; i <= n * 1000; i++)dp[i] = 1145141919810931;
	for (int i = 0; i < n; i++) {
		int w, v; cin >> w >> v;
		for (int j = n * 1000; j >= v; j--)dp[j] = min(dp[j], dp[j - v] + w);
	}
	long long ret = 0;
	for (long long i = 0; i <= n * 1000; i++)
		if (dp[i] <= limit)	ret = max(ret, i);
	cout << ret << endl;
	return 0;
}

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


int L;
int N,M;
int main() {
    cin>>L;

    int tmp=L;
    int len=0;
    vector<int> bitpos;
    while(tmp>0) {
        if(tmp&1) bitpos.push_back(len);
        tmp/=2;
        len++;
    }
    reverse(bitpos.begin(), bitpos.end());

    N=len;
    M=2*(len-1)+bitpos.size()-1;

    cout<<N<<" "<<M<<endl;
    for(int i=1;i<=N-1;i++) {
        cout<<i<<" "<<i+1<<" "<<(1<<(N-1-i))<<endl;
        cout<<i<<" "<<i+1<<" "<<0<<endl;
    }

    int d = (1<<N-1);
    for(int i=1;i<bitpos.size();i++) {
        int pos = bitpos[i];
        cout<<1<<" "<<N-pos<<" "<<d<<endl;
        d+=(1<<pos);
    }
}


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

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

    int sum=0;
    for(int i=0; i<N.size(); ++i){
        sum += (int)(N[i]-'0');
    }
    if(sum%9==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }

int main() {  
    ll a, b;
    cin >> a >> b;
    ll n = gcd(a, b);
    ll ret = 1;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            ret++;
            while (n % i == 0) {
                n /= i;
            }
        }
    }
    if (n != 1) ret++;

    cout << ret << "\n";
    return 0;

}




Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f;
	scanf("%d",&a);
	b=a/3600;
	e=a-3600*b;
	c=e/60;
	f=e-60*c;
	d=f/1;
	printf("%d:%d:%d\n",b,c,d);
	
	
	
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 2756
#include<stdio.h>
int main()
{
	int A,B,C,D;
	int i,n;
	scanf("%d%d%d%d",&A,&B,&C,&D);
	n=0;
	for(i=A;i<B;i++)
	{
		if(i>=C&&i<D)
		{
			n++;
		}
	}
	printf("%d\n",n);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    vector<int> S(n+1);
    for (int i = 0; i < n; ++i) {
        S[i+1] = S[i] + v[i];
    }
    int ans = INF<int>;
    for (int l = 0; l < n; ++l) {
        for (int r = l+1; r <= n; ++r) {
            if(r-l == n) continue;
            int m = S[r] - S[l];
            int M = m;
            if(l) {
                if(S[l]-S[0] < m) continue;
                vector<int> dp(l+1, INF<int>);
                dp[0] = 0;
                for (int i = 1; i <= l; ++i) {
                    for (int j = 0; j < i; ++j) {
                        if(S[i]-S[j] >= m) dp[i] = min(dp[i], max(dp[j], S[i]-S[j]));
                    }
                }
                M = max(M, dp[l]);
            }
            if(r != n) {
                if(S[n]-S[r] < m) continue;
                vector<int> dp(n+1, INF<int>);
                dp[r] = 0;
                for (int i = r+1; i <= n; ++i) {
                    for (int j = r; j < i; ++j) {
                        if(S[i]-S[j] >= m) dp[i] = min(dp[i], max(dp[j], S[i]-S[j]));
                    }
                }
                M = max(M, dp[n]);
            }
            ans = min(ans, M-m);
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3200
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,k;
	cin >> n >> k;
	string s;
	cin >> s;
	rep(i,0,n){
		if(i==k-1){
			s[i]=s[i]+32;
		}
	}
	cout << s;
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


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

constexpr int32_t MOD = 1e9 + 7; //10^9
constexpr int32_t MAX = 1e5+1;

template<int32_t MAX> struct cominit{
    int64_t Fac[MAX], Finv[MAX], Inv[MAX];
    constexpr cominit(): Fac(), Finv(), Inv(){
        Fac[0] = Fac[1] = 1;
        Finv[0] = Finv[1] = 1;
        Inv[1] = 1;
        for (int i = 2; i < MAX; i++){
            Fac[i] = Fac[i - 1] * i % MOD;
            Inv[i] = MOD - Inv[MOD%i] * (MOD / i) % MOD;
            Finv[i] = Finv[i - 1] * Inv[i] % MOD;
        }        
    }
    
};

//#define int int64_t
signed main()
{
    constexpr auto com = cominit<MAX>();
	int n, m; cin >> n >> m;
    if(abs(n-m)>=2){
        cout << 0 << endl;
    }
    else{
        if(n>m || m > n){
            cout << com.Fac[n]*com.Fac[m]%MOD << endl;
        }
        else
        {
            cout << (com.Fac[n]*com.Fac[m]%MOD)*2%MOD << endl;
        }
        
    }
}


Measured memory_bytes: 2560
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
using namespace std;

int main() {
	// your code goes here
	string a,b;
	cin>>a>>b;
	ll int n=a.length(),s=b.length();
	vector<vector<ll int>> dp(n+1,vector<ll int> (s+1));
	ll int i,j;
for(i=0;i<=n;i++)
{
    dp[i][0]=0;
}
for(i=0;i<=s;i++)
{
    dp[0][i]=0;
}
	for(i=1;i<=n;i++)
	{
	    for(j=1;j<=s;j++)
	    {
	        if(a[i-1]==b[j-1])
	        dp[i][j]=1+dp[i-1][j-1];
	        else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
	    }
	}
	string temp="";
	vector<vector<pair<ll int,ll int>>> bt(n+1,vector<pair<ll int,ll int>> (s+1));
	for(i=0;i<=n;i++)
	for(j=0;j<=s;j++)
	{
	    if(i==0||j==0)
	    bt[i][j].first=0,bt[i][j].second=0;
	    else if(a[i-1]==b[j-1])
	     bt[i][j].first=i-1,bt[i][j].second=j-1;
	    else if(dp[i-1][j]>dp[i][j-1])
	    bt[i][j].first=i-1,bt[i][j].second=j;
	     else if(dp[i-1][j]<=dp[i][j-1])
	    bt[i][j].first=i,bt[i][j].second=j-1;
	    
	}
	ll int sx=n,sy=s;
while(sx>0&&sy>0)
{
    if(a[sx-1]==b[sy-1])
    temp+=a[sx-1],sx--,sy--;
    else if(dp[sx-1][sy]>dp[sx][sy-1])
    sx--;
    else sy--;
}
reverse(temp.begin(),temp.end());
cout<<temp<<"\n";
	return 0;
}


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

const ll INF = 1LL << 60;
const int MOD = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, b, e) for (int i = (b); i <= (e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

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

    int L[M], R[M];
    int maxL = 0, minR = 200000;
    REP(i, M) {
        cin >> L[i]; cin >> R[i];
        maxL = max(L[i], maxL);
        minR = min(R[i], minR);
    }

    int ans = max(minR - maxL + 1, 0);
    cout << ans << endl;

    return 0;
}


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

N, A, B = map(int, input().split())
ans = []
if (A + B) % 2 == 0:
    ans.append((B - A) // 2)
if A > N - B:
    ans.append(N - A)
    ans.append(((B - A) // 2) + N - B + 1)
if A <= N - B:
    ans.append(B - 1)
    ans.append(((B - A) // 2) + A)

print(min(ans))

Measured memory_bytes: 3064
//#include<bits\stdc++.h>
#include<iostream>
#include<math.h>
#include<stdlib.h>
using namespace std;


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(b);i>=(int)(a);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(b);i>=(long long int)(a);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define b begin()
#define e end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;



int arr[g_size];





int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	int n,m,T,res;

	int maxi=mx,mini=-mx,count=0;

    	int i,j,k;

	string s1,s2;

	char s[100000];

	int ara1[n_size],ara2[n_size];

	cin>>n;

	cout<<(n*800)-(n/15)*200<<endl;



}


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


int main()
{
    long long int x,a,b;
    scanf("%ld",&x);
a = 100;
b = 0;
    while(1)
    {
        a = a*1.01;
        b++;
    if(a>=x)
        break;
    }
    printf("%ld",b);
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()

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

	ll N;
	ll ans = 0;

	cin >> N;
	vector<ll> a(N+1);
	a[0] = -1;
	rep(i, N) cin >> a[i+1];

	ll M = 0;
	vector<ll> b(N+1);
	b[0] = -1;
	rep(i, N) b[i+1] = -1;
	ll c = 1;
	ll sum = 0;
	ll m = 0;
	for (int i = N; i >= 1; i--) {
		sum = 0;
		for (int j = 2 * i; j <= N; j += i) {
			sum += b[j];
		}
		b[i] = (a[i] + sum) % 2;
		m += b[i];
	}

	cout << m << "\n";
	rep(i, N+1) {
		if(b[i]==1) cout << i << " ";
	}
	return 0;
}


Measured memory_bytes: 3968
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100111;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main(){
	int n,x,l,now=0;
	cin>>n>>x;
	int ans=1;
	rep(i,0,n){
		cin>>l;
		now+=l;
		if(now<=x)ans++;
	}
	print(ans);
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;while(t--)
#define pb push_back
#define nl cout<<endl
#define MOD 1000000007
#define loop(i,start,end) for(int i=start;i<end;i++)
#define N 100001
#define all(v) v.begin(),v.end()
#define oa(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";nl
#define ov(a) for(int i=0;i<a.size();i++)cout<<a[i]<<" ";nl
#define vinn(n,v) int n;cin>>n;vector<int>v(n);loop(i,0,n)cin>>v[i];
#define vinm(n,m,v) int n,m;cin>>n>>m;vector<int>v(n);loop(i,0,n)cin>>v[i];
#define debug(x) cerr<<#x<<" : "<<x<<endl;
mt19937 rd(time(0)); // i = rd%n
signed main() 
{
    fastio();

    int n,m;
    cin>>n>>m;
    vector<int>v(n);
    double tot=0;
    loop(i,0,n)cin>>v[i],tot+=v[i];
    tot/=(4*m);
    int c = 0;
    loop(i,0,n)
    {
        if(v[i]>=tot)c++;
    }
    if(c>=m)cout<<"Yes";
    else
    cout<<"No";



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
  string S;
  cin >> S;
  if (S.find("7") != string::npos){
    cout << "Yes"<< endl;
  }else{
    cout << "No"<< endl;
  }
}

Measured memory_bytes: 3628
def hantei(a):
  if a == 'r':
    return p
  elif a == 's':
    return r
  else:
    return s

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

ans = 0

for i in range(k):
  flag = True
  last1 = 'a'
  last2 = 'b'
  
  for j in range(i, n, k):
    if last1 != t[j]:
      ans += hantei(t[j])
      
    elif last1 == last2 and last1 == t[j]:
      ans += hantei(t[j])
      last1 = 'y'
    
    last2 = last1
    last1 = t[j]
    
    
print(ans)

Measured memory_bytes: 3316
#include <stdio.h>

int main(void){
	int stick[50];
	int n = 0;
	int k = 0;
	int num = 0;
	scanf("%d%d",&n,&k);
	
	for(int i = 0;i < n;i++){
		scanf("%d",&stick[i]);
	}
	
	//printf("s1=%s\n",stick);
	int tmp;
	for(int i = 0;i < n;++i){
		for(int j = 0;j < n;++j){
			if(stick[i] > stick[j]){
				tmp = stick[i];
				stick[i] = stick[j];
				stick[j] = tmp;
			}
		}
	}
	/*for(int i = 0;i<n;i++){
		printf("%d",stick[i]);
	}*/
	//printf("s2=%s\n",stick);
	for(int i = 0;i < k;i++){
		num = num + stick[i];
	}
	printf("%d",num);
}

Measured memory_bytes: 128
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let r: u32 = read();
    if r < 1200 {
        println!("ABC");
    } else if r < 2800 {
        println!("ARC");
    } else {
        println!("AGC");
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 200'000;
const int LOGN = 18;

int n, m, k;

void solve(int test)
{
  string s;
  cin >> s;
  if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
    cout << "Bad\n";
  }
  else {
    cout << "Good\n";
  }
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 256
N, K =map(int, input().split())
A = input()

tmp = A[0]
cnt = 1
for i in range(1,N):
	if A[i] == tmp:
		continue
	else:
		tmp = A[i]
		cnt += 1

ans = N - (cnt - (2*K))

print(min(N-1, ans))

Measured memory_bytes: 3316
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
namespace Not_Sure
{
//	struct edge{int u,v,w;edge(int a=0,int b=0,int c=0){u=a,v=b,w=c;}};
//	bool operator < (edge x,edge y){return x.w<y.w;}
	inline void check_min(int a,int &b){if(a<b)b=a;}
	inline void check_max(int a,int &b){if(a>b)b=a;}
	const int N=17,M=N*N*2,INF=2147483647;
	inline bool inset(int S,int p){return S&(1<<(p-1));}
	int begin[N],next[M],to[M],w[M];
	int f[1<<N][N];
	int n,m,e,S;
	void add(int x,int y,int z,bool k=1)
	{
		to[++e]=y;
		next[e]=begin[x];
		begin[x]=e;
		w[e]=z;
		if(k)add(y,x,z,0);
	}
	void initialize()
	{
		scanf("%d%d",&n,&m);S=1<<n;
		for(int i=1,u,v,k;i<=m;i++)
			scanf("%d%d%d",&u,&v,&k),add(u,v,k);
		for(int i=0;i<S;i++)
			for(int j=1;j<=n;j++)
				f[i][j]=INF;
	}
	int val[N],res[1<<N];
	void get_val(int k)
	{
		memset(val,0,sizeof(val));
		for(int p=1;p<=n;p++)
			if(!inset(k,p))
				for(int i=begin[p];i;i=next[i])
					if(inset(k,to[i]))val[p]+=w[i];
	}
	int lowbit(int x){return x&(-x);}
	int bit(int x)
	{
		int ret=0;
		while(x)x>>=1,ret++;
		return ret;
	}
	int calc(int nk,int T)
	{
		if(nk==T)
		{
			int ret=0,tmp=nk;
			for(;nk;nk-=lowbit(nk))
				ret+=val[bit(lowbit(nk))];
//			for(int i=1;i<=n;i++)
//				if(inset(nk,i))ret+=val[i];
			return res[tmp]=ret;
		}
		else 
		{
			int h=lowbit(T^nk);
			return res[nk]=res[nk|h]-val[bit(h)];
		}

//		int ret=0;
//		for(int p=1;p<=n;p++)
//			if(inset(nk,p))
//				ret+=val[p];
//		return ret;
	}
	void solve()
	{
		initialize();
		int T=(S-1)^1,g,cost,sum;
		f[1][1]=0;
		for(int k=T;k;k=(k-1)&T)
			f[k|1][1]=0;
 
		for(int k=0;k<S;k++)
			for(int i=1;i<=n;i++)
			{
				if(f[k][i]==INF)continue;
//				printf("f[%d][%d] = %d\n",k,i,f[k][i]);
				int dk=(S-1)^k;
				get_val(k);
				for(int u=begin[i],j;u;u=next[u])
				{
					j=to[u];
					if(inset(k,j))continue;
					sum=0;
					for(int o=begin[j];o;o=next[o])
						if(inset(k,to[o]))sum+=w[o];
					sum-=w[u];
 
					T=dk^(g=1<<(j-1));
					check_min(f[k][i]+sum,f[k|g][j]);
 
					for(int nk=T;nk;nk=(nk-1)&T)
					{
						cost=calc(nk,T)+sum;
						check_min(f[k][i]+cost,f[k|nk|g][j]);
					}
				}
			}
		printf("%d\n",f[S-1][n]);
	}
}
int main()
{
//	freopen("in","r",stdin);
	Not_Sure::solve();
	return 0;
}


Measured memory_bytes: 3968
package main

import (
	"fmt"
)

func main() {
	cache := map[int]struct{}{}
	var n int
	fmt.Scanf("%d\n", &n)
	result := "YES"
	for i := 0; i < n; i ++ {
		var v int
		fmt.Scanf("%d", &v)
		if _, exists := cache[v]; exists {
			result = "NO"
			break
		}
		cache[v] = struct{}{}
	}
	fmt.Println(result)
	
}

Measured memory_bytes: 10240
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
Arr.forEach(function(v){
   var arr=v.split(" ").map(Number);
   var m=Math.max(arr[0],arr[1]);
   var n=Math.min(arr[0],arr[1]);
   while(n!=0){
      var N=n;
      n=m%n;
      m=N;
   }
   console.log(m);
});

Measured memory_bytes: 7648
import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * n
def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]
    

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
        

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    unite(a, b)

ans = len([i for i in root if i < 0]) - 1
print(ans)

Measured memory_bytes: 75756
n, l = gets.chomp.split(' ').map(&:to_i)
reserved = 0
1.upto(n) do |i|
  reserved += i + l - 1
end

apple_pie = 0
1.upto(n) do |i|
  now = 0
  1.upto(n) do |j|
    next if i == j
    now += j + l - 1
  end
  if (reserved - now).abs < (reserved - apple_pie).abs
    apple_pie = now
  end
end
puts apple_pie

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

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

constexpr int MOD = int(1e9 + 7);
constexpr int INF = int(1e9 + 1);
constexpr ll LLINF = ll(4 * 1e18 + 1);
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<pii> a;
    for(int i = 0; i < n; ++i){
        int t;
        cin >> t;
        a.push_back({t, 0});
    }
    for(int i = 0; i < n; ++i){
        int t;
        cin >> t;
        a.push_back({t, 1});
    }
    sort(begin(a), end(a));

    int cnt_pc = 0, cnt_power = 0;
    ll ans = 1;
    for(int i = 0; i < 2 * n; ++i){
        if(a[i].second == 0){
            if(cnt_power == 0){
                ++cnt_pc;
            }
            else{
                ans *= cnt_power;
                ans %= MOD;
                --cnt_power;
            }
        }
        if(a[i].second == 1){
            if(cnt_pc == 0){
                ++cnt_power;
            }
            else{
                ans *= cnt_pc;
                ans %= MOD;
                --cnt_pc;
            }
        }
    }
    
    cout << ans << "\n";
    
    return 0;
}

Measured memory_bytes: 2548
n,x=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
for i in range(n-1):
	if a[i+1]+a[i]>x:
		cnt+=a[i+1]+a[i]-x
		a[i+1]=max(0,x-a[i])
print(cnt)

Measured memory_bytes: 14060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, n) for (int i = 1; i < (int)(n); ++i)
using namespace std;
using lint = int64_t;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    
    vector<int> S(1000010, 0);
    rep(i, N) ++S[A[i]];
    int ans = 0;
    rep(i, N) {
        bool flag = true;
        for (int j = 1; j * j <= A[i]; ++j) {
            if (A[i] % j == 0) {
                if (j == A[i]) {
                    if (S[j] - 1) flag = false;
                } else {
                    if (S[j]) flag = false;
                }
                if (A[i] / j == A[i]) {
                    if (S[A[i] / j] - 1) flag = false;
                } else {
                    if (S[A[i] / j]) flag = false;
                }
            }
        }
        if (flag) ++ans;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 7948
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
#define rep(i,x) for(int i = 0;i<x;i++)
#define REP(i,x) for(ll i = 1;i<=x;i++)
#define mp make_pair
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const dou pi = 3.14159265358;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
template<class T>
T gcd(T a,T b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
template<class T>
T lcm(T a,T b){
    return a / gcd(a,b) * b;
}

//素数判定O(sqrt(N))
template<class T>
inline bool isp(T n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logm)
ll modpow(ll n,ll m,ll MOD){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}
ll mypow(ll n,ll m){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n);
        m >>= 1;
        n *= n;
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;ll K;
    cin >> S >> K;
    ll s = S.size();
    ll memo[s + 1][2][105] = {};//memo[i][j][k]:i桁目まで j:未満である k:0でない数の数
    memo[0][0][0] = 1;
    rep(i,s){
        ll d = S[i] - '0';
        rep(j,2){
            rep(k,103){
                for(ll x = 0;x <= (j ? 9:d);x++){
                    memo[i + 1][j || x < d][k + (x ? 1:0)] += memo[i][j][k];
                }
            }
        }
    }
    cout << memo[s][0][K] + memo[s][1][K] << endl;
}

Measured memory_bytes: 3752
using System;

class MainClass
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string[] haveCards = new string[n];
        string[] allCards = new string[52];

        for (int i = 0; i < n; i++)
            haveCards[i] = Console.ReadLine();

        //Input all cards state
        for (int i = 0; i < 52; i++)
        {
            if (0 <= i && i <= 12)
                allCards[i] = "S " + (i + 1);
            else if (13 <= i && i <= 25)
                allCards[i] = "H " + (i - 12);
            else if (26 <= i && i <= 38)
                allCards[i] = "C " + (i - 25);
            else if (39 <= i && i <= 51)
                allCards[i] = "D " + (i - 38);
        }

        //Search NoHaveCards
        bool isHave = false;
        for (int i = 0; i < 52; i++)
        {
            for (int j = 0; j < n; j++)
            {
                if (allCards[i] == haveCards[j])
                    isHave = true;
            }
            if (isHave != true)
                Console.WriteLine(allCards[i]);
            isHave = false;
        }
    }
}

Measured memory_bytes: 9204
s=input()

if (s[0]=="A" and s[2:-1].count("C")==1):
  pos=s.index("C")
  check=s[1:pos]+s[pos+1::]
  if (check.islower()):
    print("AC")
  else:
    print("WA")
else:
  print("WA")

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

const int MAX_V = 100;
const long long INF = (1LL << 32);

long D[MAX_V][MAX_V];
int V;

void wf() {
  for (int k = 0; k < V; k++) {
    for (int i = 0; i < V; i++) {
      if (D[i][k] == INF) continue;
      for (int j = 0; j < V; j++) {
        if (D[k][j] == INF) continue;
        D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
      }
    }
  }
}

int main() {
  int e;
  cin >> V >> e;

  for (int i = 0; i < V; i++) {
    for (int j = 0; j < V; j++) {
      D[i][j] = ((i == j) ? 0 : INF);
    }
  }

  for (int i = 0; i < e; i++) {
    int s, t; cin >> s >> t;
    long d; cin >> d;

    D[s][t] = d;
  }

  wf();

  bool negative = false;

  for (int i = 0; i < V; i++) {
    if (D[i][i] < 0) negative = true;
  }

  if (negative) {
    cout << "NEGATIVE CYCLE" << endl;
    return 0;
  }

  for (int i = 0; i < V; i++) {
    for (int j = 0; j < V; j++) {
      if (j) cout << ' ';
      if (D[i][j] == INF) cout << "INF";
      else cout << D[i][j];
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1240
import std.stdio;
import std.string;
import std.conv;
import std.array;
import std.algorithm;



void main() {
    // 先月の取引を取り込む
    auto prevTradeList = inputTradeList();

    // 今月の取引を取り込む
    auto tradeList = inputTradeList();

    foreach (trade; tradeList.keys.sort()) {
        if (trade in prevTradeList) {
            writeln(join([trade.to!string, (prevTradeList[trade] + tradeList[trade]).to!string], " "));
        }
    }
}

/*
 * 標準入力から取引のデータを取り込み、リストに登録する。
 * 入力の長さが0の場合、終了と見なす。
 */
int[int] inputTradeList() {
    int[int] tradeList;

    foreach (input; stdin.byLine) {
        if (input.length == 0) break;

        auto trade = input.split(",").map!(to!int);
        tradeList = addTradeList(trade[0], tradeList);
    }

    return tradeList;
}

/*
 * 取引履歴を走査し、同じ取引が
 * 1. あれば、その取引のcountをインクリメント
 * 2. なければ、取引履歴に追加
 */
int[int] addTradeList(int tradeId, int[int] prevTradeList) {
    if (tradeId in prevTradeList) {
        prevTradeList[tradeId]++;
    } else {
        prevTradeList[tradeId] = 1;
    }

    return prevTradeList;
}

Measured memory_bytes: 1108
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	A, B := nextInt(), nextInt()
	fmt.Println(MaxOf(0, A-B*2))
}

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

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

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
main(){
  char bun[100000];
  int kazu,i;
  fgets(bun,sizeof(bun),stdin);
  kazu=strlen(bun);
  for(i=0;i<kazu;i++){
    if('a'<=bun[i] && bun[i]<='z'){
      bun[i]-='a'-'A';
    }
   }
  printf("%s",bun);
  return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// // descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

    string s, t;
    cin >> s >> t;
    ll dp[s.length() + 1][t.length() + 1];
    rep(i, 0, s.length() + 1) rep(j, 0, t.length() + 1) dp[i][j] = 0ll;

    rep(i, 0, s.length()) rep(j, 0, t.length()) {
        if(s[i] == t[j]) dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1]);
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j]);
    }

    string rsl = "";
    int i = (int)s.size(), j = (int)t.size();

    while(i > 0 and j > 0) {
        // (i - 1, j) -> (i, j) と更新されていた場合
        if(dp[i][j] == dp[i - 1][j]) --i;

        // (i, j - 1) -> (i, j) と更新されていた場合
        else if(dp[i][j] == dp[i][j - 1]) --j;

        // (i - 1, j - 1) -> (i, j)と更新されていた場合
        else {
            rsl = s[i - 1] + rsl;
            --i, --j;
        }
    }

    cout << rsl << endl;




}



Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mp make_pair
typedef pair<int,int> pii;
typedef priority_queue<int,vector<int>,greater<int> > small_heap;
typedef priority_queue<int> big_heap;
const int mod=1e9+7;
int n,k;
ll inv[100009];
ll a[100009],chafen[100009],sum[100009];
ll _power(ll a, int b)//计算a^b;
{
    ll ans=1, res=a;
    while(b){
        if(b&1) ans=ans*res%mod;
        res=res*res%mod;
        b>>=1;
    }
    return ans%mod;
}
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)inv[i]=_power(i,mod-2)%mod;
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
    }
    sort(a+1,a+n+1);
    ll small=0,big=a[k];
    ll p=1;
    for(int i=k+1;i<=n;i++){
        p=p*(i-1)%mod;
        p=p*inv[i-k]%mod;
        big=(big+a[i]*p%mod)%mod;
    }
    big-=a[n-k+1];p=1;
    for(int i=k+1;i<=n;i++){
        p=p*(i-1)%mod;
        p=p*inv[i-k]%mod;
        big=(big-a[n-i+1]*p%mod)%mod;
    }
    cout<<(big+mod)%mod<<endl;
    return 0;
}

Measured memory_bytes: 1792
import scala.collection.immutable.HashSet

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N, M = sc.nextInt()
  val pairs = HashSet.fill(M)(sc.nextInt() - 1 -> sc.next().toCharArray.head)
  val isMatched = (i: String) => pairs.forall { case (s, c) => i(s) == c }
  val range = if (N == 1) 0.to(9) else math.pow(10, N - 1).toInt.to(("9" * N).toInt)
  println(range.find(i => isMatched(i.toString)).getOrElse(-1))
}


Measured memory_bytes: 55724
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    ll pos = 0;
    bool is_ok = true;
    ll N = S.size();
    reverse(S.begin(), S.end());
    while(1){
        if(pos == N) break;
        if(pos + 5 > N){
            is_ok = false;
            break;
        }
        if(pos + 5 == N){
            string s1 = S.substr(pos,5);
            if(s1 == "maerd" || s1 == "esare"){
                pos += 5;
            }else{
                is_ok = false;
                break;
            }
        }else if(pos + 6 == N){
            string s1 = S.substr(pos,5);
            string s2 = S.substr(pos,6);
            if(s1 == "maerd" || s1 == "esare"){
                pos += 5;
            }else if(s2 == "resare"){
                pos += 6;
            }else{
                is_ok = false;
                break;
            }
        }else{
            string s1 = S.substr(pos,5);
            string s2 = S.substr(pos,6);
            string s3 = S.substr(pos,7);
            if(s1 == "maerd" || s1 == "esare"){
                pos += 5;
            }else if(s2 == "resare"){
                pos += 6;
            }else if(s3 == "remaerd"){
                pos += 7;
            }else{
                is_ok = false;
                break;
            }
        }
    }
    if(is_ok){
        print("YES");
    }else{
        print("NO");
    }
}


Measured memory_bytes: 512