akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class ADDCCFinals {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int x, y; cin >> x >> y;
      int ans = 0;
      if (x == 1) {
        ans += 300000;
      } else if (x == 2) {
        ans += 200000;
      } else if (x == 3) {
        ans += 100000;
      }
      if (y == 1) {
        ans += 300000;
      } else if (y == 2) {
        ans += 200000;
      } else if (y == 3) {
        ans += 100000;
      }
      if (x == 1 && y == 1) {
        ans += 400000;
      }
      cout << ans << endl;

    }
};

signed main() {
  ADDCCFinals solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using lint = long long;
#define low lower_bound
#define upp upper_bound
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define Rep(i, n) for (int i = int(n); i >= 0; --i)
#define all(vec) (vec).begin(), (vec).end()
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>

struct edge { int to; double cost; };
using P = pair<lint, lint>;
using D = pair<double, double>;
using DI = pair<double, int>;
//const lint mod = 998244353LL;
const lint mod = 1000000007LL;
const lint inf = 3LL * mod * mod;

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

lint modpow(lint x, lint n, lint m) {
	lint ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (m <= ans) ans %= m;
		}
		x *= x;
		if (m <= x) x %= m;
		n >>= 1;
	}
	return ans;
}

lint fact[1000000];
void f_init(lint n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

lint inver[1000000]; bool inve[100000];
lint inv(lint x) {
	if (x == 0) return 0;
	else if (inve[x]) return inver[x];
	else {
		inve[x] = true;
		return inver[x] = modpow(x, mod - 2, mod);
	}
}

lint comb(lint n, lint r) {
	if (n < r) return 0;
	if (n == r) return 1;
	lint ans = fact[n] * inv(fact[n - r]) % mod * inv(fact[r]) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

lint nck[1010][1010];
void comb(lint n) {
	rep(i, n + 1) {
		rep(j, i + 1) {
			if (j == 0 || i == j) nck[i][j] = 1;
			else nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
}

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

lint lcm(lint a, lint b) { return a / gcd(a, b) * b; }

bool pri(lint p) {
	for (lint i = 2; i * i <= p; i == 2 ? ++i : i += 2) if (p % i == 0) return false;
	return p > 1;
}

map<lint, lint> factring(lint n) {
	map<lint, lint>ans;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

double dis(D a, D b) { return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second)); }

int n, ans;
string s;
int main() {
	cin >> n >> s;
	rep(i, 1000) {
		char a = '0' + i / 100, b = '0' + i % 100 / 10, c = '0' + i % 10;
		int p = n, q = n, r = 0;
		rep(j, n) {
			if (s[j] == a) p = min(p, j);
			if (s[j] == b) {
				if (p < j) {
					q = min(q, j);
				}
			}
			if (s[j] == c) r = max(r, j) ;
		}
		if (p < q && q < r) ++ans;
	}
	cout << ans << endl;
}

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

using namespace std;
#define         MAX         2*10000
#define         ll          long long
#define         input       freopen("input.txt","r",stdin)
#define         output      freopen("output.txt","w",stdout)
#define         inf         10000000


int main() {

    //input;
    //output;


    int n;
    cin>>n;
    map<string, int>m;
    string s;
    while(n--){
        s = "";
        cin>>s;
        m[s] = 1;
        

    }

    //cout<<cnt<<endl;

    cout<<m.size()<<endl;

    //map<string, int>::iterator it;

    //for(it=m.begin(); it!= m.end(); it++){

    //}




    return 0;
}


Measured memory_bytes: 19200
#!/usr/bin/env python3
def primes(n):
    m = 1303
    is_prime = [True] * (m + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(m**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, m + 1, i):
            is_prime[j] = False
    return [i for i in range(m + 1)
            if is_prime[i] and str(i).endswith("3")][:n]


print(*primes(int(input())))


Measured memory_bytes: 64160
package main

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

////////////////////////////////////////
///        templates                 ///
////////////////////////////////////////

var sc = bufio.NewScanner(os.Stdin)

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

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
        buf := make([]byte, 0, 1000000)
        for {
                l, p, e := rdr.ReadLine()
                if e != nil {
                        panic(e)
                }
                buf = append(buf, l...)
                if !p {
                        break
                }
        }
        return string(buf)
}

func strSprit(str string) []string {
        cols := strings.Split(str, " ")
        return cols
}

func parseInt(str string) int {
        n, _ := strconv.Atoi(str)
        return n
}

func intSprit(str string) []int {
        strs := strSprit(str)
        cols := make([]int, len(strs))
        for i, v := range strs {
                cols[i] = parseInt(v)
        }
        return cols
}

type SortSlice []int

func (s SortSlice) Len() int {
        return len(s)
}

func (s SortSlice) Swap(i, j int) {
        s[i], s[j] = s[j], s[i]
}

func (s SortSlice) Less(i, j int) bool {
        return s[i] < s[j]
}

func reverseString(str string) string {
        buf := []rune(str)
        for i, j := 0, len(buf)-1; i < j; i, j = i+1, j-1 {
                buf[i], buf[j] = buf[j], buf[i]
        }
        return string(buf)
}

////////////////////////////////////////
///        end templates             ///
////////////////////////////////////////

func main() {
        line := nextLine()
        spl := strSprit(line)

        A := parseInt(spl[0])
        B := parseInt(spl[1])

        maps := [100][100]bool{}

        w, h := 100, 100

        for i := 0; i < h; i++ {
                for j := 0; j < w; j++ {
                        if j == 0 || (i%2 == 1 && j != w-1) {
                                maps[i][j] = true
                        }
                }
        }

        a, b := 1, 1

        i := 2
        j := 2

        for a < A {
                maps[i][j] = true
                a++
                j += 2

                if j > 98 {
                        i += 2
                        j = 2
                }
        }

        i = 97
        j = 97

        for b < B {
                maps[i][j] = false
                b++
                j -= 2

                if j < 2 {
                        i -= 2
                        j = 97
                }
        }

        fmt.Println(h, w)

        for i := 0; i < h; i++ {
                for j := 0; j < w; j++ {
                        if maps[i][j] {
                                fmt.Print("#")
                        } else {
                                fmt.Print(".")
                        }
                }
                fmt.Println()
        }

}



Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
typedef pair<int, bool> sP;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;


void solve() {
	int n, k; cin >> n >> k;
	if (3 * n - 1 < k) {
		cout << -1 << endl; return;
	}
	int sup = (n + 1) / 2;
	if (k > sup) {
		cout << -1 << endl; return;
	}
	if (n % 2) {
		int d = n / 2;
		rep(i, d + 1) {
			cout << k + d + i << " " << k + 2 * n - 1 - 2 * i << " " << k + 3 * n - 1 - i << endl;
		}
		rep(i, d) {
			cout << k + i << " " << k + 2 * n - 2 - 2 * i << " " << k + 3 * n - 1 - (d + 1) - i << endl;
		}
	}
	else {
		int d = n / 2;
		
		rep(i, d) {
			cout << k + d + i << " " << k + 2 * n - 1 - 2 * i << " " << k + 3 * n - 1 - i << endl;
		}
		rep(i, d) {
			cout << k + i << " " << k + 2 * n - 2 - 2 * i << " " << k + 3 * n - 1 - d - i << endl;
		}
	}
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(7);
	//init();
	solve();
	//stop
		return 0;
}



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

void _150() {
    string s;
    cin >> s;

    if ((s == "AAA") || (s == "BBB"))
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
}

void _156() {
    int n, r;
    cin >> n >> r;

    if (n >= 10)
        cout << r << endl;
    else
        cout << r + 100 * (10 - n) << endl;
}

void _155() {
    int a, b, c;
    cin >> a >> b >> c;

    if ((a != b) && (a != c) && (b != c))
        cout << "No" << endl;
    else if ((a == b) && (b == c))
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
}

int main()
{
    // _150();
    _155();
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> v(n, 0);
    for (int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        ++v[a - 1];
        ++v[b - 1];
    }
    for (int i = 0; i < n; ++i)
    {
        cout << v[i] << endl;
    }
}

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

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")

typedef long long ll;
typedef long double ld;

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define fast() {ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
#define eb emplace_back
#define pb push_back
#define deb(a) cerr << #a << " = " << a << '\n';

int main()
{
    fast();
    ll x, now = 100, sch = 0;
    cin >> x;
    while(now < x) {
        now += now / 100;
        sch++;
    }
    cout << sch;
    return 0;
}


Measured memory_bytes: 3632
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin >> n;
	vector<ll> a(n+1), b(n); fore(e, a) cin >> e; fore(e, b) cin >> e;
	ll sm = accumulate(a.begin(), a.end(), 0ll);
	forl(i, 0, n) {
		if(a[i] < b[i]) { b[i] -= a[i]; a[i] = 0; }
		else { a[i] -= b[i]; b[i] = 0; }
		if(b[i]) a[i+1] = max(0ll, a[i+1]-b[i]);
	}
	ll fin = accumulate(a.begin(), a.end(), 0ll);
	println(sm-fin);
}


Measured memory_bytes: 1792
process.stdin.resume();
process.stdin.setEncoding('ascii');

var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;

process.stdin.on('data', function (data) {
    input_stdin += data;
});

process.on('SIGINT', function(){
    input_stdin_array = input_stdin.split("\n");
    main();
    process.exit();
});

process.stdin.on('end', function () {
    input_stdin_array = input_stdin.split("\n");
    main();    
});

function readLine() {
    return input_stdin_array[input_currentline++];
}

/////////////// ignore above this line ////////////////////

function reverse(cad){
	var ret='';
	for (var i = cad.length-1; i>=0; i--)
		ret+=cad[i];
	return ret;
}

function main() {
	var s = readLine().split(" ");
	var N = parseInt(s[0]), K = parseInt(s[1]), L = parseInt(s[2]);
	
	var G1=[0], G2=[0];
	var C1=[0], C2=[0];
	for ( var i=1; i <= N; i++ ){
		G1.push([]);
		C1.push(0);
		G2.push([]);
		C2.push(0);
	}
	
	for (var i=0; i < K; i++){
		s=readLine().split(" ");
		var a = parseInt(s[0]), b = parseInt(s[1]);
		G1[a].push(b);
		G1[b].push(a);
	}
	
	for (var i=0; i < L; i++){
		s=readLine().split(" ");
		var a = parseInt(s[0]), b = parseInt(s[1]);
		G2[a].push(b);
		G2[b].push(a);
	}
	
	function dfs(nod, G, C, color){
		C[nod] = color;
		for (var i=0; i < G[nod].length; i++){
			if (C[G[nod][i]] == 0){
				dfs(G[nod][i], G, C, color);
			}
		}
	}
	
	var col1=0, col2=0;
	for (var i=1; i <= N; i++){
		if (C1[i] == 0){
			col1++;
			dfs(i,G1,C1,col1);
		}
		if (C2[i] == 0){
			col2++;
			dfs(i,G2,C2,col2);
		}
	}
	
	var map = {}
	for (var i=1; i <= N; i++){
		var atrib = C1[i].toString() + "_" + C2[i].toString();
		if (map[atrib] == undefined){
			map[atrib] = 1;
		} else {
			map[atrib]++;
		}
	}
	
	var atrib = C1[1].toString() + "_" + C2[1].toString();
	var ans=map[atrib];
	for (var i=2; i <= N; i++){
		atrib = C1[i].toString() + "_" + C2[i].toString();
		ans += " " + map[atrib];
	}
	
	console.log(ans);
	
}


Measured memory_bytes: 145908
import java.io.File;
import java.io.IOException;
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		if(A == B) System.out.println(C);
		else if(B == C) System.out.println(A);
		else System.out.println(B);
	}
}

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

int main(){
  int n;
  cin >> n;
  char a[100],b[100],c[100];
  for(int i=0; i!=n; i++){
    cin >> a[i];
  }
  for(int i=0; i!=n; i++){
    cin >> b[i];
  }
  for(int i=0; i!=n; i++){
    cin >> c[i];
  }
  int ans = 0;
  for(int i=0; i!=n; i++){
    if(a[i] == b[i] && b[i] == c[i]){
      continue;
    }
    if(a[i] != b[i] && b[i] != c[i] && a[i] != c[i]){
      ans += 2;
      continue;
    }
    ans += 1;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <unordered_map>
// #include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x)  if(DEBUG_Switch) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
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;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
void pvarr_int(int *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%d%c", arr[i], i == n ? '\n' : ' ');}}
void pvarr_LL(ll *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%lld%c", arr[i], i == n ? '\n' : ' ');}}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0
char s[maxn];
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","r",stdin);
    cin >> s;
    int n = strlen(s);
    repd(i, 0, n - 1)
    {
        if (s[i] == '?')
        {
            s[i] = 'D';
        }
    }
    cout << s << endl;
    return 0;
}




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

int main() {
    int n; cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n-1; i++)
    {
        ans += (ll) i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        System.out.println(Math.min(A*N, B));
    }
}

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

using namespace std;

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

    vector<int> prime_num;
    for(int i = 2; i < 100004; i++){
        prime_num.push_back(i);
    }

    for(vector<int>::iterator i = prime_num.begin(); i != prime_num.end() ; i++){
        //cout << *i << endl;
        for(vector<int>::iterator j = i+1; j != prime_num.end() ; j++){
            //cout << *j << endl;
            if(*j % *i == 0){
                prime_num.erase(j);
            }
        }
    }

    int ans = 0;
    for(vector<int>::iterator i = prime_num.begin(); i != prime_num.end() ; i++){
        ans = *i;
        if(ans >= n) break;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 892
#include <iostream>
using namespace std;
int main() {
	int n,t[100],s=0,p,x;
	cin >> n;
	for(int i =0;i<n;i++){
		cin >> t[i];
		s += t[i];
	}
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> p >> x;
		cout << s - t[p-1] + x << endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if((a == b && a == 5) || (a == c && a == 5) || (b == c && b == 5))
	{
		if(a + b + c == 17)
		printf("YES\n");
	}
	else
		printf("NO\n");
		return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	string s="";
	string t="";
	for(int i=1;i<=a;i++)
	s+=b+'0';
	for(int i=1;i<=b;i++)
	t+=a+'0';
	if(s>=t)
	cout<<t;
	else
	cout<<s;
	return 0;
}

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

int main() {
	int n, m, x, a[101] = {}, b, c = 0, d = 0;
	cin >> n >> m >> x;
	
	for (int i = 0; i < m; i++)
	{
		cin >> b;
		a[b] = 1;
	}
	
	for (int i = 1; i < x; i++)
		c += a[i];
		
	for (int i = x+1; i <= n; i++)
		d += a[i];
		
	cout << min(c, d);
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N;
int C[505], S[505], F[505];

int main(void)
{
	cin >> N;
	for(int i = 1; i <= N; i++) cin >> C[i] >> S[i] >> F[i];
	
	for(int i = 1; i <= N; i++){
		int t = S[i];
		for(int j = i; j <= N-1; j++){
			t = (max(S[j], t) + F[j]-1) / F[j] * F[j];
			t += C[j];
		}
		cout << t << endl;
	}
	return 0;
}

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

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MX = 0; //最大値

#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define PB push_back
#define F first
#define S second

int main(){
    string n, s; cin >> n;
    s = n;
    reverse(ALL(s));
    if(s[0] == 's') cout << n + "es";
    else cout << n + "s";
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
int main(){
	char S[12];
		scanf("%[^\n]", S);
		for(int j=0;S[j] != '\0';j++){
			if(S[j] == 'B'){
				S[j] = '-';
				for(int i=j;S[i] == '-';i--)
					if(S[i-1]!='-'){
						S[i-1]='-';
						break;
					}
		        

			}
		}
		for(int i=0;S[i] != '\0';i++){
			if(S[i] !='-'){
				printf("%c", S[i]);
			}
		}
	
	return 0;
}

Measured memory_bytes: 1596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)

long long int gcd(long long int a, long long int b){
	if (b == 0)
		return a;
	else 
		return (gcd (b, a%b));

}
int main(){
	int n;
	cin >> n;
	long long int lcm = 1;
	vector<int>a(n);
	rep(i, n)
		cin >> a[i];
	long long int ans=0;
	lcm--;
	rep(i, n){
		ans += a[i]-1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>
 
using namespace std;
 
 
int main() {
	string s;
	cin >> s;
	string res = "No";
	for(int i = 0; i+1 < s.length(); i++) {
		if(s.substr(i,2) == "AC") {
			res = "Yes";
		}
	}
	cout << res << endl;
	return 0;
}




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

const int MAXN = 5e5+5;
string s;

int n, l[MAXN];
int dp[MAXN];

int main() {
	cin >> n >> s;
	for (int i = 0; i < n; ++i) {
		if (i == 0) {
			l[i] = (s[i] == '1');
		} else {
			if (s[i] == '0')
				l[i] = 0;
			else
				l[i] = l[i-1]+1;
		}
	}

	dp[0] = dp[1] = dp[2] = 0;

	for (int i = 2; i < n; ++i) {
		//case 1: you have 101111....1
		dp[i+1] = dp[i];
		int k = l[i];
		if (k <= i-1 && s[i-k] == '0' && s[i-k-1] == '1')
			dp[i+1] = max(dp[i+1], dp[i-k-1]+k);
		if (s[i] == '1' && s[i-1] == '0' && s[i-2] == '1') {
			k = l[i-2];
			dp[i+1] = max(dp[i+1], dp[i-k-1]+k);
			if (k >= 2)
				dp[i+1] = max(dp[i+1], dp[i-k]+k-1);
		}
	}

	cout << dp[n] << endl;
}

Measured memory_bytes: 4740
#include <array>
#include <vector>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <tuple>
#include <utility>
#include <limits>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)

int n;
int mat[100][100];
int d[100];
int f[100];

int dfs(int i, int t)
{
    d[i] = t++;

    REP(j, n) {
        if(mat[i][j] && !d[j]) {
            t = dfs(j, t);
        }
    }

    f[i] = t++;

    return t;
}

void solve()
{
    int t = 1;

    REP(i, n) {
        if(d[i]) continue;

        t = dfs(i, t);
    }
}

int main()
{
    cin >> n;

    REP(i, n) {
        REP(j, n) {
            mat[i][j] = 0;
        }
    }

    REP(_, n) {
        int u, k;
        cin >> u >> k;

        REP(_, k) {
            int v;
            cin >> v;
            mat[u-1][v-1] = 1;
        }
    }

    fill(begin(d), end(d), 0);
    fill(begin(f), end(f), 0);
    solve();

    REP(i, n) {
        cout << i+1 << " " << d[i] << " " << f[i] << "\n";
    }

    return 0;
}

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

#define file(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define go(x, i) for(register int i = head[x]; i; i = nxt[i])
#define For(i, a, b) for(register int i = (a), i##_end_ = (b); i <= i##_end_; ++ i)
#define FOR(i, a, b) for(register int i = (a), i##_end_ = (b); i >= i##_end_; -- i)
#define debug(x) cout << #x << " = " << x << endl
#define mem(a, b) memset(a, b, sizeof(a))
#define cpy(a, b) memcpy(a, b, sizeof(a))
#define min(a, b) (a < b ? a : b)
#define max(a, b) (b < a ? a : b)
#define inf (0x3f3f3f3f)
#define INF (1e18)
#define pb push_back
#define mp make_pair
#define x first
#define y second

typedef unsigned long long ull;
typedef unsigned int uint;
typedef long long ll;
typedef std::pair<ll, int> PLI;
typedef std::pair<int, int> PII;
typedef long double ldb;
typedef double db;

namespace IO {
#define getc() ((S_ == T_) && (T_ = (S_ = Ch_) + fread(Ch_, 1, Buffsize, stdin), S_ == T_) ? 0 : *S_ ++)
#define putc(x) *nowps ++ = (x)
	const uint Buffsize = 1 << 15, Output = 1 << 23;
	static char Ch_[Buffsize], *S_ = Ch_, *T_ = Ch_;
	static char Out[Output], *nowps = Out;
	inline void flush(){fwrite(Out, 1, nowps - Out, stdout); nowps = Out;}
	template<class T>inline void read(T &_) {
		_ = 0; static char __; T ___ = 1;
		for(__ = getc(); !isdigit(__); __ = getc()) if(__ == '-') ___ = -1;
		for(; isdigit(__); __ = getc()) _ = (_ << 3) + (_ << 1) + (__ ^ 48);
		_ *= ___;
	}
	template<class T>inline void write(T _, char __ = '\n') {
		if(!_) putc('0');
		if(_ < 0) putc('-'), _ = -_;
		static uint sta[111], tp;
		for(tp = 0; _; _ /= 10) sta[++ tp] = _ % 10;
		for(; tp; putc(sta[tp --] ^ 48)); putc(__);
	}
	template<class T>inline bool chkmax(T &_, T __) {return _ < __ ? _ = __, 1 : 0;}
	template<class T>inline bool chkmin(T &_, T __) {return _ > __ ? _ = __, 1 : 0;}
}

using namespace std;
using namespace IO;

const int N = 1e5 + 10;
int n, a[N], cnt[2][N];
PII mx[2], sndmx[2];

int main() {
#ifdef ylsakioi
	file("c");
#endif
	read(n);
	For(i, 1, n) {
		read(a[i]), ++ cnt[i & 1][a[i]];
		if(cnt[i & 1][a[i]] > mx[i & 1].x) {
			if(a[i] != mx[i & 1].y) sndmx[i & 1] = mx[i & 1];
			mx[i & 1] = mp(cnt[i & 1][a[i]], a[i]);
		}
		else if(cnt[i & 1][a[i]] > sndmx[i & 1].x) 
			sndmx[i & 1] = mp(cnt[i & 1][a[i]], a[i]);
	}
	int fuck;
	if(mx[0].y != mx[1].y) fuck = mx[0].x + mx[1].x;
	else fuck = max(mx[0].x + sndmx[1].x, mx[1].x + sndmx[0].x);
	cout << n - fuck << endl;
	return flush(), 0;
}


Measured memory_bytes: 1408
n = int(input())
lired = [list(map(int,input().split())) for _ in range(n)]
liblue = [list(map(int,input().split())) for _ in range(n)]
lired = sorted(lired,key = lambda x:-x[1])
liblue = sorted(liblue,key = lambda x:x[0])
li = list(range(n))
count = 0

for i in range(n):
  for j in li:
    if lired[i][0] < liblue[j][0] and lired[i][1] < liblue[j][1]:
      count += 1
      li.remove(j)
      break
print(count)


Measured memory_bytes: 3064
//##MohK 
// 8/2/2020 ..... 6,15 
#include <bits/stdc++.h>
using namespace std ;
using ll = long long ;
using ld = long double;
int main(){

    ll a,counter=0;
    cin>>a;
    int x[a];
    int y[a]={0};
    for(ll i=0;i<a;i++){
        cin>>x[i];
        y[i]=x[i];
    }
    sort(x,x+a);
    for(ll i=0;i<a;i++){
        if(x[i]==y[i])counter++;
    }
    if(counter>=a-2){
        cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;

    return 0 ;
}



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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int A=in(),B=in(),C=in();
	int D=(B+C)-A;
	out(max(D,0));
	return 0;
}


Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a,b,c = inpl()
x = [-INF] + inpln(a) + [INF]
y = [-INF] + inpln(b) + [INF]
z = inpln(c)

def f(x,y,q):
    res = INF
    qq = []
    cs = bisect.bisect_left(x,q)
    qq.append((x[cs],abs(q - x[cs])))
    qq.append((x[cs-1],abs(q - x[cs-1])))
    while qq:
        now, dist = qq.pop()
        cs = bisect.bisect_left(y,now)
        res = min(res,dist+abs(now - y[cs]))
        res = min(res,dist+abs(now - y[cs-1]))
    return res

for q in z:
    print(min(f(x,y,q),f(y,x,q)))



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

#define LL long long

const int MAXN = 200000 + 5;
const LL MOD = 1000000000 + 7;

vector <int> a[MAXN];
bool vis[MAXN];

int DFS(int v){
    int num = 1;
    vis[v] = true;
    for (int i = 0; i < a[v].size(); i ++){
        int w = a[v][i];
        if (!vis[w]){
            num += DFS(w);
        }
    }
    return num;
}

int main()
{
    int N, M, x, y, ans = 0;
    cin >> N >> M;
    for (int i = 1; i <= N; i ++){
        a[i].clear();
    }
    for (int i = 0; i < M; i ++){
        cin >> x >> y;
        a[x].push_back(y);
        a[y].push_back(x);
    }
    memset(vis, false, sizeof(vis));
    for (int v = 1; v <= N; v ++){
        int num = DFS(v);
        if (num > ans){
            ans = num;
        }
    }
    cout << ans;
    system("pause");
    return 0;
}

Measured memory_bytes: 24140
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

struct Dfs {
    n: usize,
    dp: Vec<Vec<Vec<Vec<i32>>>>,
}
impl Dfs {
    fn get_vec(&self, i1: usize, i2: usize, i3: usize) -> Vec<usize> {
        // 0123
        // ACGT
        // AGC   02 1
        if i2 == 0 && i1 == 2 {
            return vec![0, 2, 3];
        }
        // ACG   01 2
        if i2 == 0 && i1 == 1 {
            return vec![0, 1, 3];
        }
        // GAC   20 1
        if i2 == 2 && i1 == 0 {
            return vec![0, 2, 3];
        }
        // A?GC 0?2 1
        if i3 == 0 && i1 == 2 {
            return vec![0, 2, 3];
        }
        // AG?C 02? 1
        if i3 == 0 && i2 == 2 {
            return vec![0, 2, 3];
        }
        return vec![0, 1, 2, 3];
    }
    fn res(&mut self, idx: usize, i1: usize, i2: usize, i3: usize) -> i32 {
        if idx == self.n {
            // print!("{}{}{}, ", i3, i2, i1);
            return 1;
        }
        // println!("{}:{} /  {}{}{}", idx, self.n, i3, i2, i1);
        if self.dp[idx][i1][i2][i3] != -1 {
            return self.dp[idx][i1][i2][i3];
        }
        let v = match idx {
            0 | 1 => vec![0, 1, 2, 3],
            _ => self.get_vec(i1, i2, i3),
        };
        // println!("{} {}{}{} => {:?}", idx, i3, i2, i1, v);
        let m = (1000 * 1000 * 1000) + 7;
        let ans = v
            .into_iter()
            .fold(0, |s, i| (s + self.res(idx + 1, i, i1, i2)) % m);
        self.dp[idx][i1][i2][i3] = ans;
        return ans;
    }
}

fn main() {
    input! {
        n: usize,
    }
    let dp = vec![vec![vec![vec![-1; 10]; 10]; 10]; n];
    let mut dfs = Dfs { n: n, dp: dp };
    println!("{:?}", dfs.res(0, 9, 9, 9));
}


Measured memory_bytes: 4352
MOD=10**9+7
S=int(input())

def invmod(a):
  return pow(a,MOD-2,MOD)
  #return powmod(a,MOD-2)
def comb_mod(n,r):
  r=min(r,n-r)
  nPr=1
  fact_r=1
  for i in range(r):
    nPr*=n-i
    nPr%=MOD
    fact_r*=r-i
    fact_r%=MOD  
  return (nPr*invmod(fact_r))%MOD

limit=S//3
#print(limit)

answer=0
for i in range(1,limit+1):
  rest=S-3*i
  #print(i,rest)
  # deliver rest for i-term
  answer+=comb_mod(i+rest-1,rest)
  answer%=MOD
  
print(answer)

Measured memory_bytes: 9204
Scanf.scanf "%s %s" (fun s t ->
    Scanf.scanf " %d %d" (fun a b ->
        Scanf.scanf " %s" (fun u ->
            let a, b = if s = u then (a - 1, b) else (a, b - 1) in
            Printf.printf "%d %d\n" a b
        )
    )
)

Measured memory_bytes: 384
#include "stdio.h"
#include <stdlib.h>

typedef struct {
    long long int A;
    int B;
} choco_t;

int cmp( const void *p, const void *q ) {
    if (((choco_t*)p)->A >((choco_t*)q)->A ) {
      return 1;
    }
    return 0;
}

int main(){
    int N,M,i;
    scanf("%d%d",&N,&M);
    choco_t X[N];
    for (i = 0; i < N; i++) {scanf("%lld %d", &X[i].A,&X[i].B);}

    qsort(X, N, sizeof(choco_t), cmp );
    // for (i = 0; i < N; i++) {printf("%lld %d\n", X[i].A,X[i].B);}

    long long int ans=0;
    i=0;
    while (M>=X[i].B && M!=0 && i<N) {
      ans=ans+X[i].B*X[i].A;
      M=M-X[i].B;
      i++;
    }
    ans=ans+M*X[i].A;
    printf("%lld", ans);
    return 0;
  }


Measured memory_bytes: 3324
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll a,b,c,x,y,h1,h2,h3;
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>a>>b>>c>>x>>y;
	h1=x*a+y*b;
	h3=max(x,y)*c*2;
	if(x<y)
	{
		h2=c*x*2;
		y-=x;
		h2+=b*y;
	}
	else
	{
		h2=c*y*2;
		x-=y;
		h2+=a*x;
	}
	h2=min(h2,h3);
	cout<<min(h1,h2)<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int cnt[100001], chs[100000];
int main() {
    init();

    int n, m; cin >> n >> m;
    VI a(n); cin >> a;
    FOR(i, 0, n)++cnt[a[i]];

    int ans = 0;
    eFOR(i, 1, 100000) {
        ans += (cnt[i] >> 1);
        //<---mod--->
        chs[i % m] += (cnt[i] >> 1);
        cnt[i] &= 1;
        if (m <= i) {
            cnt[i % m] += cnt[i];
            cnt[i] = 0;
        }
    }

    ans += (cnt[0] >> 1);
    FOR(i, 1, m) {
        if ((i << 1) == m)ans += (cnt[i] >> 1);
        else {
            int h = min(cnt[i], cnt[m - i]);
            cnt[i] -= h;
            cnt[m - i] -= h;
            ans += h;
            while (2 <= cnt[i] && 1 <= chs[m - i]) {
                cnt[i] -= 2;
                --chs[m - i];
                ++ans;
            }
        }
    }

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

Measured memory_bytes: 1408
#include <iostream>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
#define INF 100000000
using namespace std;

const int SIZE = 1000000 + 1;
int N;
int dp1[SIZE], dp2[SIZE];

int main(void) {
  REP(i, 0, SIZE) dp1[i] = dp2[i] = INF;
  for(int i = 1, n; n = i * (i + 1) * (i + 2) / 6, n < SIZE; i++) {
    dp1[n] = 1;
    if(n % 2 == 1) dp2[n] = 1;
    for(int j = 1; j + n < SIZE; j++) {
      dp1[j + n] = min(dp1[j + n], dp1[j] + 1);
      if(n % 2 == 1) dp2[j + n] = min(dp2[j + n], dp2[j] + 1);
    }
  }

  while(cin >> N, N) cout << dp1[N] << " " << dp2[N] << endl;
}

Measured memory_bytes: 10816
fun main() {
    val S = readLine()!!
    var max = 0
    val l = listOf("A", "C", "G", "T")
    for (i in S.indices) {
        var ix = i
        var cnt = 0
        while (ix <= S.length-1 && S[ix].toString() in l) {
            cnt ++
            ix ++
        }
        if (cnt > max) {
            max = cnt
        }
    }
    println(max)
}

Measured memory_bytes: 37980
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007
using namespace std;

int main(){
    ll n,w;
    cin>>n>>w;
    ll A[n+1][2];
    for(ll i = 1; i <= n; i++){
        cin>>A[i][0]>>A[i][1];
    }
    ll dp[w+1];
    memset(dp,0,sizeof dp);
    for(ll i = 1; i <= n; i++){
        for(ll j = w; j >= 0; j--){
            if(j >= A[i][0]){
                dp[j] = max(dp[j],A[i][1] + dp[j-A[i][0]]);
            }
        }
    }
    ll ans = 0;
    for(ll i = 1; i <= w; i++){
        
        ans = max(ans,dp[i]);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1024
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		pr.println(Math.max(0, c - (a - b)));
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
//#define ll __int128
#define int ll
//#define int ll
//#define char ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(4) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

void smain() {
    int n;
    cin >> n;
    vl a(3 * n);

    fori (i, 3 * n) {
        cin >>  a[i];
    }
    sort(ALL(a));
    ll ans = 0;
    for (int i = 3 * n - 2, j = n; j--; i -= 2) {
        ans += a[i];
    }
    cout <<  ans;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
ll max(ll a, ll b){
    return a > b? a: b;
}
int main() {
    int n, W;
    cin >> n >> W;
    vector<ll> dp(W+1, 0);
    for(int i = 0; i < n; i++) {
        int wt, v;
        cin >> wt >> v;
        for(int w = W; w >= wt; w--) {
            dp[w] = max(dp[w], v + dp[w-wt]);
        }
    }
    ll ans = 0;
    for(ll a: dp){
        ans = max(ans, a);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k; cin >> n >> k;
  vector<int> A(n);
  vector<int> cnt(n);
  rep(i, n) {
    cin >> A[i];
    A[i]--;
    cnt[A[i]]++;
  }
  sort(all(cnt));
  cout << accumulate(cnt.begin(), cnt.begin()+n-k, 0) << endk;
  return 0;
}


Measured memory_bytes: 4724
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void){
	ll n;
	cin >> n;

	map<ll,ll> primes;
	ll cur = n;

	for(ll i = 2LL; i * i <= n; ++i){
		if(cur % i) continue;
		ll idx = 0LL;
		while(cur % i == 0){
			idx++;
			cur /= i;
		}
		primes[i] = idx;
	}

	if(cur != 1) primes[cur] = 1;

	ll amax = 1LL;
	for(auto &elem:primes){
		amax *= (elem.second + 1);
	}

	cout << primes.size() << " " << amax - 1 << endl;
	
	return 0;
}


Measured memory_bytes: 3128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long H = sc.nextInt();
		long W = sc.nextInt();
		if(H==1 || W==1) {
			System.out.println(1);
		} else if(H*W%2==0) {
			// 偶数の場合
			System.out.println(H*W/2);
		} else {
			System.out.println(H*W/2 + 1);
		}
	}
}

Measured memory_bytes: 21332