akhauriyash/Code-Regression huggingface dataset:
#include <set>
#include <array>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <vector>
#include <tuple>
#include <string>
#include <math.h>
#include <time.h>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <limits>
#include <climits>
#include <numeric>
#include <functional>

#define lnd '\n'
// #define reverse(i, n) for(ll i = n-1; i >= 0; --i)
#define from(i, n) for (ll i = 0; i < n; ++i)
#define loop(i, n) for (ll i = 0; i < n; ++i)
#define REPN(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(s) (s).begin(), (s).end()
#define rALL(s) (s).rbegin(), (s).rend()
#define sz(s) (int)(s).size()
#define mk make_pair
#define pb push_back
#define sqr(s) ((s) * (s))

using namespace std;

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

template <class T>
T GCD (T a, T b) {
  if(a == 0) return b;
  return GCD(b%a, a);
}

template <class T>
T LCM(T a, T b){
  return a*b/GCM(a,b);
}

template <class T>
T modpow(T x, T p){
    T res = 1;
    while(p > 0){
        if(p&1) res *= x;
        x *= x;
        p /= 2;
    }
    return res;
}

template <class T>
void print(T a[], ll n){
    for (ll i = 0; i < n; i++) std::cout << a[i] << ' ';
    cout << endl;
}

template<class T>
void printc(T c){
    for(auto const& v: c) std::cout << v << ' ';
    cout << endl;
}

struct HASH{
  size_t operator()(const pair<long,long>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};

bool pair_sort(const pair<int, int> &p1, const pair<int,int> &p2){
    if(p1.first != p2.first) return p1.first < p2.first;
    else return p1.second < p2.second;
}

const int INF = std::numeric_limits<int>::max();
const ll M_INF = std::numeric_limits<ll>::min();

void solution();
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solution();
    return 0;
}

void solution(){
    int n;
    cin >> n;
    string s;
    cin >> s;
   
    long rc = 0, gc = 0, bc = 0;
    loop(i, n){
        if(s[i] == 'R') {
            rc++;
        }
        else if(s[i] == 'G') {
            gc++;
        }
        else {
            bc++;
        }
    }

    long total = rc*gc*bc;
    for(int i = 0 ; i < n; i++){
        for(int j = i+1; j < n; j++){
            int k = 2*j-i;
            if(k < n && s[i] != s[k] && s[i] != s[j] && s[j] != s[k]) total--;
        }
    }

    cout << total << endl;
}  


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

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

  char c = s[0];
  int cnt  = 1;
  for (int i = 1; i < n; i++)
  {
   	if (s[i] != c) 
    {
     cnt++;
      c = s[i];
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 512
import java.util.Arrays;
import java.util.Scanner;


public class Main {

	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			final int N = sc.nextInt();
			final int M = sc.nextInt();
			final int P = sc.nextInt();
			
			if(N == 0 && M == 0 && P == 0){
				break;
			}
			
			
			int[] count = new int[N];
			int sum = 0;
			
			for(int i = 0; i < N; i++){
				count[i] = sc.nextInt();
				sum += count[i];
			}
			
			if(count[M-1] == 0){
				System.out.println("0");
			}else{
				double money = sum * 100.0;
				money *= (100 - P);
				
				System.out.println((int)(money / (count[M-1] * 100)));
			}
		}
		
	}

}

Measured memory_bytes: 12000
N = int(input())
W = [input() for i in range(N)]
for i in range(N-1):
    if W[i][-1] != W[i+1][0] or W.count(W[i]) != 1 or W.count(W[i+1]) != 1:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 3064
import java.io.* ;
import java.util.* ;
public class Main
{
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    static void init(InputStream input)
    {
        reader = new BufferedReader(new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException
    {
        while (!tokenizer.hasMoreTokens())
        {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static long nextInt() throws IOException
    {
        return Long.parseLong(next());
    }

    public static int ri() throws IOException
    {
        return (int) nextInt();
    }

    public static long rl() throws IOException
    {
        return nextInt();
    }

    public static double rd() throws NumberFormatException, IOException
    {
        return Double.parseDouble(next());
    }

    static void print_a(int[] arr)
    {
        for (int i = 0; i < arr.length; i++)
        {
            print(arr[i] + " ");
        }
        println();
    }

    public static int[] ria(int n) throws IOException
    {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
        {
            a[i] = ri();
        }
        return a;
    }

    public static long[] rla(int n) throws IOException
    {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
        {
            a[i] = rl();
        }
        return a;
    }

    public static int p(int i)
    {
        return (int) Math.pow(2, i);
    }

    static PrintWriter writer;

    static void outit(OutputStream outputStream)
    {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    static void print(Object... objects)
    {
        for (int i = 0; i < objects.length; i++)
        {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    static void println(Object... objects)
    {
        print(objects);
        writer.println();
//        flush();
    }

    static void close()
    {
        writer.close();
    }

    static void flush()
    {
        writer.flush();
    }

    public static void main(String[] args) throws IOException
    {
        init(System.in);
        outit(System.out);
//        int t = (int) nextInt();
//        for (int i = 0; i < t; i++)
            output() ;
        flush();
        close();
    }
    static long [] a ;
    static long [] b ;
    static int n ;
    static int k ;
    static long p ;
    public static void output() throws IOException
    {
        int n = ri() ;
        long [] a = new long[n] ;
        long sum = 0 ;
        for (int i = 0; i <n ; i++)
        {
            a[i] = rl() ;
            sum+=a[i] ;
        }
        long ans = Long.MAX_VALUE ;
        long cum = 0 ;
        for (int i = 0; i <(n-1) ; i++)
        {
            cum+=a[i] ;
            ans = Math.min(Math.abs((sum-cum)-cum),ans) ;
        }
        println(ans) ;
    }
}

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

int main() {
  string s;
  cin >> s;
  map<char, int> mp;
  
  for(char x : s) ++mp[x];
  
  for(auto x : mp) {
    if(x.second != 1) {
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
    
  
  return 0;
}


Measured memory_bytes: 256
//#include<cstdio>
//#include<cassert>
//#include<iostream>
//#include<cstring>
//#include<algorithm>
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define MAX ((int)1e9 + 5)
#define MAXL ((ll)3e18 + 7)
#define MAX_X ((ll)1e5 + 2)
#define pi (2.0*acos(0))
#define M ((int)1e6 + 7)
#define MOD ((int)1e9 + 7)
#define NN ((int)3e6 + 7)
#define N ((int)1e5 + 5)
#define eps (0)
#define fastio ios_base::sync_with_stdio(false),cin.tie(NULL)
#define logn 29
#define endl "\n"
#define mp make_pair
#define BUCK 105
#define RIG ((idx<<1)|1)
#define LEF (idx<<1)
//#define int ll


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

/*fast io
ios_base::sync_with_stdio(false);
cin.tie(NULL);
*/




typedef tree < int,  null_type,  less < int >,  rb_tree_tag,  tree_order_statistics_node_update > o_set;
/// o_set s;
/// s.order_of_key(k) : Number of items strictly smaller than k .
/// *(s.find_by_order(k)) : K-th element in a set (counting from zero).


int arr[N];


int main()
{
    fastio;
    int n ;
    cin>>n;
    int m = n*(n-1)/2 - n/2 , sum;
    cout<<m<<endl;
    if(n&1) sum = n;
    else sum = n+1;
    for(int i = 1 ; i<n ; i++){
        for(int j = i+1 ; j<=n ; j++){
            if(i+j != sum) cout<<i<<" "<<j<<endl;
        }
    }
    return 0;
}


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

int main(){
	int a, b;

	cin >> a >> b;

	if(a > b){
		cout << "a > b" << endl;
	}else if(a < b){
		cout << "a < b" << endl;
	}else{
		cout << "a == b" << endl;
	}

	return 0;
}

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

int main() {
    int N, M, cnt = 0;
    cin >> N >> M;
    vector<pair<int, int>> gates(M);
    rep(i, M) {
        int l, r;
        cin >> l >> r;
        gates[i] = make_pair(l, r);
    }

    int minl=1, minr=N;
    rep(i, M) {
        if(gates[i].first > minl) minl = gates[i].first;
        if(gates[i].second < minr) minr = gates[i].second;
        if(minl > minr) {
            cout << 0 << endl;
            return 0;
        }
    }

    cout << minr - minl + 1 << endl;

    return 0;


}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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


    ll n;
    cin >> n;

    vpl r(n);
    map<pll, ll> m;
    vpl f;
    REP(i, n) {
        string s;
        cin >> s;

        ll k = s.size();
        ll p = k - 1;
        REP(i, k) {
            if (s[i] == '.')
                p = i;
        }

        ll num = 0;
        REP(i, k) {
            if (s[i] == '.')
                continue;
            num *= 10;
            num += s[i] - '0';
        }
        ll r2 = 0, r5 = 0;
        REP(i, k - p - 1) {
            if (num % 2 == 0)num /= 2;
            else r2 -= 1;

            if (num % 5 == 0)num /= 5;
            else r5 -= 1;
        }

        while (num % 2 == 0) {
            num /= 2;
            r2++;
        }
        while (num % 5 == 0) {
            num /= 5;
            r5++;
        }

        r[i].first = r2;
        r[i].second = r5;

        m[r[i]] += 1;
    }


    ll ans = 0;
    //  for(ll i=-10; i<=14; i++){
    //      for (ll j = -10; j <= 14; j++) {
    //          ll t = m[pll(i, j)];
    //          if (t == 0)
    //              continue;
    //
    //		  ll res = 0;
    //		  for (ll k = i; k <= 14; k++) {
    //              for (ll q = -10; q <= 14; q++) {
    //				  if (k + i < 0 || q + j < 0)
    //					  continue;
    //
    //
    //                  if (k == i && q < j)
    //                      continue;
    //				  if (k == i && q == j)
    //					  res += t * (t - 1) / 2;
    //				  else
    //					  res += t * m[pll(k, q)];
    //
    //
    //              }
    //          }
    //
    //		  ans += res;
    //
    //	  }
    //  }

    for (auto p1 : m) {
        ll res = 0;
        for (auto p2 : m) {
            if (p1.FI.FI + p2.FI.FI < 0 || p1.FI.SE + p2.FI.SE < 0)
                continue;
            if (p1.FI > p2.FI)
                continue;

			if (p1 == p2)
				res += p1.SE * (p1.SE - 1) / 2;
			else
				res += p1.SE * p2.SE;
        }

        ans += res;
    }

	cout << ans << endl;

}




Measured memory_bytes: 6320
function main()
	str = chomp(readline())
	str = reverse(str)
	strArr = ["dream", "dreamer", "erase", "eraser"]
	strArr = map(reverse, strArr)
	
	while(true)
		cnt = 0
		for s in strArr
			if startswith(str, s)
				str = str[length(s)+1:end]
				cnt += 1
			end
		end

		if cnt < 1
			break
		end
	end
	
	print(str == "" ? "YES" : "NO" )
end

main()

Measured memory_bytes: 211844
n = gets.chomp.to_i
a_arr = gets.chomp.split(" ").map(&:to_i)
b_arr = gets.chomp.split(" ").map(&:to_i)

count = 0
b_arr.each_with_index do |b, i|
  a = a_arr[i]
  if b <= a then
    count += b
  else
    count += a
    next_b = b - a
    next_a = a_arr[i+1]
    if next_b <= next_a then
      count += next_b
      a_arr[i+1] = next_a - next_b
    else
      count += next_a
      a_arr[i+1] = 0
    end
  end
end
puts count


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

int main()
{
        string S;
        cin >> S;
        for ( int i = 0; i < S.size() - 1; i++ ) {
                if ( S[i] == S[i + 1] ) { cout << i + 1 << " " << i + 2 << '\n'; return ( 0 ); }
                if ( i < S.size() - 2 && S[i] == S[i + 2] ) {
                        cout << i + 1 << " " << i + 3 << '\n'; return ( 0 );
                }
        }
        cout << "-1 -1" << '\n';

        return ( 0 );
}

Measured memory_bytes: 512
#include <iostream>
#include <limits>

static const uint32_t MAX_VALUE = 100100;
static const uint32_t MAX_N = 110;
static const uint64_t I = 1LL << 60;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  uint32_t N;
  uint64_t W;

  uint32_t v[MAX_N];
  uint64_t w[MAX_N];

  uint64_t dp[MAX_N][MAX_VALUE];

  std::cin >> N >> W;
  for (uint32_t i = 0; i < N; i++) {
    std::cin >> w[i] >> v[i];
  }

  for (uint32_t i = 0; i < MAX_N; i++) {
    for (uint32_t j = 0; j < MAX_VALUE; j++) dp[i][j] = I;
  }

  dp[0][0] = 0;

  for (uint32_t i = 0; i < N; i++) {
    for (uint32_t j = 0; j < MAX_VALUE - 1; j++) {
      if (j >= v[i]) {
        dp[i + 1][j] = std::min(dp[i][j - v[i]] + w[i], dp[i + 1][j]);
      }
      dp[i + 1][j] = std::min(dp[i][j], dp[i + 1][j]);
    }
  }

  uint64_t value = 0;
  for (uint32_t i = 0; i < MAX_VALUE; i++) {
    if (dp[N][i] > 0 && dp[N][i] <= W) {
      value = i;
    }
  }

  std::cout << value << std::endl;

  return 0;
}


Measured memory_bytes: 86400
#include<stdio.h>

int main() {


	int i, g, s;
	int n, y;
	int x = 0;


	scanf("%d%d", &n, &y);
	
	for(i=0;i<=n,y>=10000*i;i++)
	{
	for(g=0;g<=n-i,y>=10000*i+5000*g;g++)
	{
      s=n-(i+g);
      
      if(y==10000*i+5000*g+1000*s&&n==i+g+s)
      {
      printf("%d %d %d",i,g,s);
      x=1;
      goto end;
      }
      



	}
	}
	end:
	if(x==0)
	puts("-1 -1 -1");


	}

	
	

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    # 連結成分の数は，頂点すう - 辺数
    mod=10**9+7
    N=I()
    # 頂点が数えられる回数　Σ(i*(N-i+1))
    ans=N*(N+1)//2+(N*(N-1)*(N+1))//6
    for i in range(N-1):
        u,v=MI()
        if u>v:
            u,v=v,u
            
        #辺uvを含むくみが何通りあるか
        ans-=(u)*(N-v+1)

        
    print(ans)
                
        
    

main()


Measured memory_bytes: 73520
#include <bits/stdc++.h>
using namespace std;
  
int main() {
  int n,m;
  cin>>n>>m;
  priority_queue<long long>a;
  for(int i=0;i<n;i++){
    long long x;
    cin>>x;
    a.push(x);
  }
  for(int i=0;i<m;i++){
    long long x=a.top();
    a.pop();
    x/=2;
    a.push(x);
  }
  long long ans=0;
  for(int i=0;i<n;i++) {
    ans+=a.top();
    a.pop();
  }
  cout<<ans<<endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	string S, ans="NO", keyence = "keyence";
	cin >> S;
	int lk = (int)keyence.size();
	int ls = 0, lr=0;
	while(ls < lk && S[ls] == keyence[ls]) ++ls;
	
	reverse(keyence.begin(), keyence.end());
	reverse(S.begin(), S.end());
	if(ls != lk){
		while(lr < lk && S[lr] == keyence[lr]) ++lr;
		//cout << " " << lr << " " << l << endl;
		if(lr+ls >= lk) ans = "YES";
	}
	else ans = "YES";
	
	cout << ans;



}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans,a,b,c;
    cin >> a>>b>>c;
    ans=min(b/a,c);

    dbg{
        if(true)cout <<"YES"<<endl;
        else cout <<"NO"<<endl;
    }

    cout <<ans<<endl;

    return 0;

}

Measured memory_bytes: 256
var str1: String = readLine()!
var str1List: [Character] = []

var str2: String = readLine()!
var str2List: [Character] = []
var mc = 0

for c in str1 {
    str1List.append(c)
}

for c in str2 {
    str2List.append(c)
}

for i in 0 ..< str1List.count {
    if (str1List[i] != str2List[i]) {
        mc += 1
    }
}

print(mc)

Measured memory_bytes: 18236
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    int n;
    cin >> n;
    vi a(n);
    inrep(n,a);

    vi ans;

    while(sz(a) > 0){
	int f = 0;

	rrep(i,sz(a),0){
	  
	    if(a[i] == i+1){
		ans.pb(i+1);
		a.erase(a.begin()+i);
		f = 1;
		break;
	    }
	}
	if(f == 0){
	    P(-1);
	    ret 0;
	}
    }

    rrep(i,n,0)P(ans[i]);
    
    return  0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int A, B;

int main() {
    cin >> A >> B;
    int ans;
    if (A <= 5) ans = 0;
    else if (A <= 12) ans = B / 2;
    else ans = B;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	
	int dx = x2 - x1;
	int dy = y2 - y1;
	
	int x4 = x1 - dy;
	int y4 = y1 + dx;
	int x3 = x4 + dx;
	int y3 = y4 + dy;
	
	cout << x3 << " " << y3 << " " << x4 << " " << y4;
	
	return 0;
}



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

typedef long long ll;

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

	ll ans = 0;
	if(a>=2) ans += (a*(a-1))/2;
	if(b>=2) ans += (b*(b-1))/2;

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
s = input()
while s:
    flg = 0
    if s[-5:] in ['dream', 'erase']:
        s = s[:-5]
    elif s[-6:] == 'eraser':
        s = s[:-6]
    elif s[-7:] == 'dreamer':
        s = s[:-7]
    else:
        print('NO')
        exit()
print('YES')

Measured memory_bytes: 3232
/*input

*/


// assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;

// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll          long long int
#define pb          push_back
#define pii         pair<ll ,ll >
#define vpii        vector< pii >
#define vi          vector<ll >
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll )x.size()
#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 lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define debug(x)     cout << #x << " " << x << endl;
#define debug_p(x)   cout << #x << " " << x.F << " " << x.S << endl;
#define debug_v(x)   {cout << #x << " "; for (auto ioi : x) cout << ioi << " "; cout << endl;}
#define debug_vp(x)  {cout << #x << " "; for (auto ioi : x) cout << '[' << ioi.F << " " << ioi.S << ']'; cout << endl;}
#define debug_v_v(x) {cout << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cout << ioi2 << " "; cout << '\n';} cout << "*/" << #x << endl;}
const ll N = 1e7+5;
vi spd(N,-1);
void init()
{
	rep(i,2,N)
	{
		if(spd[i]==-1)
		{
			spd[i]=i;
			for(ll j=i*i;j<N;j+=i) if(spd[j]==-1) spd[j]=i;
		} 
	} 
	return ;
}

int solve()
{
	init();
	ll n;cin>>n;
	ll ans = 0;
	vi cnt(n+1,0);
	rep(i,1,n+1) for(ll j = i;j<=n;j+=i) cnt[j]++;
	rep(i,1,n+1) ans+=i*cnt[i];
	cout<<ans<<"\n";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	//cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 159416
function sadness(b, A){
  var result = 0;
  for(var i=0;i<A.length;i++){
    result += Math.abs(A[i]-(b+i+1))
  }
  return result;
}

function main(input){
  const lines = input.split('\n');
  const N = parseInt(lines[0]);
  const As = lines[1].split(' ').map(x => parseInt(x));

  const median_index = Math.floor(N/2);
  var sorted_A_diffs = [];
  for(var i=0;i<As.length;i++){
    sorted_A_diffs.push(As[i]-(i+1));
  }
  sorted_A_diffs.sort(function(a,b){return a-b;})
  const b = sorted_A_diffs[median_index];

//  console.log(N);
//  console.log(As);
//  console.log(sorted_A_diffs);
//  console.log([median_index,b, sorted_A_diffs[median_index+1]]);
//  console.log([sadness(b, As), sadness(sorted_A_diffs[median_index+1], As)]);
  
  var result = sadness(b, As)
  if((median_index+1)!=N){
    result = Math.min(result, sadness(sorted_A_diffs[median_index+1], As));
  }

  console.log(result);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 38004
#include<bits/stdc++.h>
using namespace std;
//LCS
string s;
string t;

long long dp[3001][3001];

long long LCS(int i, int j) {
    if(i>=0 && j>=0) {
        if (i == 0 || j == 0)
            return 0;
        
        if(dp[i][j] != -1) return dp[i][j];

        if (s[i-1] == t[j-1]) {
            dp[i][j] = 1 + LCS(i-1, j-1);
            return dp[i][j];
        }
        else {
            dp[i][j] = max(LCS(i, j-1), LCS(i-1, j));
            return dp[i][j];
        }
    }
    return 0;
}

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

    memset(dp, -1, sizeof(dp));
    int index = LCS(s.length(), t.length());

    char lcs[index+1]; 
    lcs[index] = '\0'; 
    
    int m = s.length(), n = t.length(); 
    while (m > 0 && n > 0) 
    { 
        if (s[m-1] == t[n-1]) 
        { 
            lcs[index-1] = s[m-1];
            m--; n--; index--; 
        }
        else if (dp[m-1][n] > dp[m][n-1]) 
            m--; 
        else
            n--; 
    } 
    
    cout << lcs << '\n'; 
}

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

using namespace std;

int main()
{
    
    int a,b,c;
    cin>>a>>b>>c;
    int d,e;
    d=b-a;
    e=c-b;
    if(d==e)
    cout<<"YES";
    else
    cout<<"NO";
    
   
    return 0;
}



Measured memory_bytes: 256
import sys

try:
    #d = int(input('D: '))
    #t = int(input('T: '))
    #s = int(input('S: '))
    nums = [int(e) for e in input().split()]
except ValueError:
    print('エラー：整数以外を入力しないでください')
    sys.exit(1)

if 1 <= nums[0] <= 10000 and 1 <= nums[1] <= 10000 and 1 <= nums[2] <= 10000:
    take_time = nums[0] / nums[2]
    if take_time <= nums[1]:
        print("Yes")
    else:
        print("No")
else:
    print('エラー：各入力は1～10000までの整数です')

Measured memory_bytes: 9068
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, a: "List[int]"):
    a.sort(reverse=True)
    print(sum(a[::2]) - sum(a[1::2]))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
    using namespace std;
  #define int long long int
    #define endl "\n"
    #define MOD 1000000007
    #define mod 1000000007
    #define M 1000000007
    
    #define pb push_back
    #define take(a,b,c) for(int b=0;b<c;b++) cin>>a[b]
  //  #define mp make_pair
  #define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);  
  #define mx 400005
  #define fiint(a,b) memset(a,b,sizeof(a))  
  #define bitcount __builtin_popcount
  #define fori(i,a,b) for(int i=a;i<b;i++)
  #define ford(i,a,b) for(int i=a;i>=b;i--)
  #define debug(x) cout<<x<<endl;
  #define cases(t) int t; cin>>t; while(t--)
  #define inf1 INT_MAX
  #define all(a) a.begin(),a.end()
  #define vec vector<int>
  #define pii pair<int,int>
  #define plii pair<int,int>
  #define pint pair<int,int>
  #define ff first
  #define ss second
  #define lb lower_bound
  #define ub upper_bound
  #define bs binary_search
  #define sz(x) (int)x.size()
#define PI                    3.14159265359

bool prime[10000001];

void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}

signed  main() 
{ 
	int n,k;cin>>n>>k;
	vec  dp(n);
	vec a(n);
	fori(i,0,n)
	dp[i]=1e9 + 5;
	fori(i,0,n)
	cin>>a[i];
	dp[0]=0;
	dp[ 1 ]= abs(a[1] - a[0]) ;
	fori(i,2,n)
		fori(j,1,k+1)
				if(i-j >= 0)
			dp[i] =   min(  dp[i-j] + abs(a[i]-a[i-j]) ,dp[i] ); 
	cout<<dp[n-1]<<endl;
}




 


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define erep(i, n) for (int i = 0; i <= (int)(n); i++)

int main() {
    int n, w; cin >> n >> w;
    vector<int> weights(n), values(n);
    rep (i, n) cin >> weights[i] >> values[i];

    vector< vector<ll> > dp(n + 1, vector<ll>(100010));
    erep (i, w) dp[0][i] = 0;

    rep(i, n) {
        erep(j, w) {
            if (j >= weights[i]) dp[i + 1][j] = max(dp[i][j - weights[i]] + values[i], dp[i][j]);
            else dp[i + 1][j] = dp[i][j];
        }
    }
    cout << dp[n][w] << endl;
}


Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll MOD=1e9+7 ;
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; }

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    
    int d,g;
    cin >> d >> g;
    g/=100;
    int ary[d][3];
    rep(i,d)
    {
        int p,c;
        cin >> p >> c;
        c /= 100;
        ary[i][0] = i;
        ary[i][1] = p;
        ary[i][2] = c;
    }
    ll ans = INF;
    rep(bit, pow(2,d))
    {
        ll nowpoints=0;
        ll now_count = 0;

        rep(i,d)
        {
            if ((bit>>i)&1)
            {
                nowpoints += ary[i][1] * (i+1) + ary[i][2];
                now_count += ary[i][1];
            }
        }
        // cout << now_count << " " << nowpoints << endl;
        if (nowpoints>=g)
        {
            ans = min(ans, now_count);
            // cout << ans << endl;
            continue;
        }
        // kokode 1tu dake dakara
        for (int i=d-1;i>=0;i--)
        {
            if (!((bit>>i)&1))
            {
                ll tmpnum = (g - nowpoints) / (i+1);
                if ((g-nowpoints)%(i+1)!=0) tmpnum++;
                if (tmpnum > ary[i][1]) continue;

                ans = min(ans, now_count+tmpnum);
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>

int main() {
  int A, B, C;
  scanf("%d%d%d", &A, &B, &C);
  if (A == 5) ((B == 5 && C == 7) || (B == 7 && C == 5)) ? printf("YES\n") : printf("NO\n");
  else if (A == 7) ((B == 5 && C == 5) || (A == 5 && C == 5)) ? printf("YES\n") : printf("NO\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    ll x; cin >> x;
    ll t = 0, pos = 0;
    while (pos < x) pos += ++t;
    cout << t << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;
import java.awt.geom.*;
import java.io.*;
    
    
public class Main {
	static int INF = 2 << 27;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if(n == 0) break;
			Data[] data = new Data[n];
			int[] time = new int[31];
			for(int i = 0; i < n; i++) {
				Data tmp = new Data();
				tmp.name = sc.next();
				tmp.m = sc.nextInt();
				tmp.d = new int[tmp.m];
				for(int j = 0; j < tmp.m ; j++) {
					tmp.d[j] = sc.nextInt();
					time[tmp.d[j]]++;
				}
				data[i] = tmp;
			}
			for(int i = 0; i < n; i++) {
				Data tmp = data[i];
				for(int j = 0; j < tmp.m; j++) {
					tmp.point += Math.max(1, n - time[tmp.d[j]]+1);
				}
			}
			Arrays.sort(data);
			
			System.out.println(data[data.length-1].point + " " + data[data.length-1].name);
			
			
			
			
			
			
			
			
			
		}
	}
	static class Data implements Comparable<Data> {
		String name;
		int m;
		int[] d = new int[m];
		int point;
		@Override
		public int compareTo(Data o) {
			if(this.point == o.point) return o.name.compareTo(this.name);
			return o.point - this.point;
		}
		
	}
}

Measured memory_bytes: 42276
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <fstream>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}

};
typedef vector<vector<Edge>> Graph;

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


signed main(void) {

	int n;
	cin >> n;
	cout << (n-1)/2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
string s;
int dp[N][15];
ll solve(int idx, ll sum){
    if(idx >= s.size())
        return sum == 5;
    if(dp[idx][sum] != -1)
        return dp[idx][sum];
    ll ans = 0;
    if(s[idx] != '?')
        ans = (ans + (solve(idx + 1, (((sum * 10) + s[idx] - '0') % 13))) % mod) % mod;
    else {
        for(int i = 0; i < 10; i++)
            ans = (ans + (solve(idx + 1, (((sum * 10) + i) % 13))) % mod) % mod;
    }
    dp[idx][sum] = ans;
    return dp[idx][sum];
}
int main()
{
    Hello
    cin >> s;
    memset(dp, -1, sizeof dp);
    cout << solve(0, 0);
    return 0;
}


Measured memory_bytes: 17292
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <iomanip>

using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }


int main() {
	string O,E;
	cin >> O >> E;
	if (O.length() == E.length()) {
		REP(i, O.length()) {
			cout << O[i] << E[i];
		}
	}
	if (O.length() > E.length()) {
		REP(i, E.length()) {
			cout << O[i] << E[i];
		}
		cout << O[O.length()-1];
	}
	if (O.length() < E.length()) {
		REP(i, O.length()) {
			cout << O[i] << E[i];
		}
		cout << E[E.length()-1];
	}


	return 0;
}

Measured memory_bytes: 256
#--b--#
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
L = list(map(int,input().split()))
cnt = 0

for i in range(1,len(L)-1):
    for j in range(0,i):
        for k in range(i+1,len(L)):
            a = L[i]
            b = L[j]
            c = L[k]
            if a+b>c and b+c>a and c+a>b and a!=b and b!= c and c!= a:
                cnt +=1
print(cnt)


Measured memory_bytes: 9472
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <cstring>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << max(a*b,c*d);
}


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

int main(){
    int n,m;
    cin>>n>>m;
    int arr[n+1];
    arr[0]=0;
    memset(arr, 0, sizeof(arr));
    
    for(int i=0;i<m;i++){
        int l,r;
        cin>>l>>r;
        arr[l]++;
        if(r+1<=n)
        arr[r+1]--;
    }
    
    for(int i=1;i<=n;i++)
    arr[i]+= arr[i-1];
    
    int count=0;
    for(int i=0;i<=n;i++)
    if(arr[i]==m)
    count++;
    
    cout<<count<<endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<stdbool.h>
#include<string.h>
#include<assert.h>
 
#define MAX_V 201
#define MAX_E 10001
#define TRUE 1
#define FALSE 0
#define UNUSED -1
 
int N, K, E; // E : the number of edges
int graph[MAX_V][MAX_E], size[MAX_V], match[MAX_V], used[MAX_V];
 
void add_edge(int s,int t) {
  graph[s][size[s]++] = t;
  graph[t][size[t]++] = s;
}
 
int dfs(int cur) {
  used[cur] = TRUE;
  int i, next, state;
  for(i=0;i<size[cur];++i) {
    next = graph[cur][i], state = match[next];
    if( state == UNUSED || ( !used[state] && dfs(state) ) ) {
      match[cur] = next;
      match[next] = cur;
      return TRUE;
    }
  }
  return FALSE;
}
 
int bmatch() {
  memset(match,UNUSED,sizeof match);
  int i, answer = 0;
  for(i=0;i<N;++i) {
    if( match[i] == UNUSED ) {
      memset(used, FALSE, sizeof used);
      if( dfs(i) ) {
    ++answer;
      }
    }
  }
  return answer;
}
 
int main() {
  int i,s,t;
  scanf("%d %d %d",&N,&K,&E);
  assert( N+K < MAX_V);
  assert( E < MAX_E );
  for(i=0;i<E;i++) {
    scanf("%d %d",&s,&t);
    assert( 0 <= s && s < N );
    assert( 0 <= t && t < K );
    add_edge(s,N+t);
  }
  int maxi = bmatch();
  //printf("answer = %d\n",maxi);
  printf("%d\n",maxi);
  return 0;
}

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

int main(){
  int n,a[5]={};
  cin>>n;
  while(n--){
    string s;
    cin>>s;
    if(s[0]=='M')a[0]++;
    if(s[0]=='A')a[1]++;
    if(s[0]=='R')a[2]++;
    if(s[0]=='C')a[3]++;
    if(s[0]=='H')a[4]++;
  }
  int cnt=0;
  for(int i=0;i<5;++i){
    if(a[i]!=0)cnt++;
  }
  if(cnt<3)cout << 0 << endl;
  if(cnt==3){
    long long ans=1;
    for(int i=0;i<5;++i){
      if(a[i]!=0)ans*=a[i];
    }
    cout << ans << endl;
  }
  if(cnt==4){
    long long ans=0,as=1;
    for(int i=0;i<5;++i){
        if(a[i]!=0){
            as*=a[i];
        }
    }
    for(int i=0;i<5;++i){
        if(a[i]!=0){
            ans+=as/a[i];
        }
    }
    cout << ans << endl;
  }
  if(cnt==5){
    long long ans=0;
    for(int i=0;i<5;++i){
        for(int j=i+1;j<5;++j){
                long long as=1;
                for(int k=0;k<5;++k){
                    if(k!=i&&k!=j){
                        as*=a[k];
                    }
                }
                ans+=as;
        }
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = str(input())
num = list(n)

for i in range(0, 3):
  if num[i] == '9':
    num[i] = 1
  if num[i] == '1':
    num[i] = 9

print(int(num[0])*100+int(num[1])*10+int(num[2]))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int i,n,k;
 cin>>n>>k;
 int a[n];
 for(i=0;i<n;i++)
 cin>>a[i];
 int dp[n];
 dp[0]=0;
 for(i=1;i<n;i++)
 {
 	int j;
 	dp[i]=INT_MAX;
 	for(j=1;j<=k && i-j>=0;j++)
 	{
 	 dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));	
	}
 }
 cout<<dp[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 1024
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];puts("");}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};//RDLU
#define yes puts("YES")
#define no puts("NO")

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

	int k,a,b;
	cin>>k>>a>>b;
	if(1+k<=a)cout<<1+k<<endl;
	else{
		k-=a-1;
		int out=a;
		out+=k/2*max(2ll,b-a);
		if(k%2)out++;
		cout<<out<<endl;
	}
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int min = (int)1e9;
		for(long x=1;x*x<=N;x++){
			if(N%x != 0) continue;
			var f = Math.Max(x.ToString().Length, (N/x).ToString().Length);
			min = Math.Min(min,f);
		}
		Console.WriteLine(min);
		
		
	}
	long N;
	public Sol(){
		N = rl();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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


int main() {
  int x, y;
  cin >> x >> y;
  int s = x + y/2;
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int n;
vector<string> vs;
vector<string> vt;
vector<int> cnt;
int cur;
ll dfs() {

	if (vt[cur] == "+") {
		ll res = 0;
		int tmp = cnt[cur];
		cur++;
		while (cur < vt.size() && tmp + 1 == cnt[cur]) {
			res += dfs();
			cur++;
		}
		cur--;
		return res;
	}
	else if (vt[cur] == "*") {
		ll res = 1;
		int tmp = cnt[cur];
		cur++;
		while (cur < vt.size() && tmp + 1 == cnt[cur]) {
			res *= dfs();
			cur++;
		}
		cur--;
		return res;
	}
	else {
		return stoll(vt[cur]);
	}
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	int kkt = 89;
	while (kkt) {
		cur = 0;
		scanf("%d", &n); if (n == 0) break;
		vs.resize(n); for (int i = 0; i < n; i++) cin >> vs[i];
		vt.resize(n), cnt.resize(n);
		for (int i = 0; i < n; i++) {
			int tmp = 0;
			string t;
			for (int j = 0; j < vs[i].size(); j++) {
				if (vs[i][j] == '.') tmp++;
				else t += vs[i][j];
			}
			vt[i] = t;
			cnt[i] = tmp;
		}
		cout << dfs() << "\n";
	}
	return 0;

}



Measured memory_bytes: 3272
#include <stdio.h>

int main(void)
{
	int soukei,s,a;
	soukei=0;
	for(s=1; s<11; s++){
	scanf("%d",&a);
	soukei=soukei+a;
	}
	printf("%d\n",soukei);
	
	return 0;
}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,L;
  cin >> N >> L;
  int sum;
  for(int i=1;i<=N;i++){
    sum += i+L-1;
  }
  if(-N<L and L<1) cout << sum << endl;
  else if(L > 0) cout << sum - L << endl;
  else cout << sum - (L + N -1) << endl; 
}


Measured memory_bytes: 256