akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define double long double
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = a; i < (int)(b); ++i)
#define all(x) x.begin(), x.end()
#define deb(x) cout << (#x) << " is " << (x) << endl;
const int mod = 1000 * 1000 * 1000 + 7;
using namespace std;

int32_t main() {
    int n;
    cin >> n;
    int a[n];
    FOR(i, 0, n) {
        cin >> a[i];
    }
    int d[n][n + 1];
    FOR(i, 0, n) {
        d[i][i + 1] = a[i];
    }
    FOR(len, 2, n + 1) {
        FOR(i, 0, n - len + 1) {
            d[i][i + len] = max(a[i] - d[i + 1][i + len], a[i + len - 1] - d[i][i + len - 1]);
        }
    }
    cout << d[0][n];
    return 0;
}

Measured memory_bytes: 49768
#include <stdio.h>

int main(){
  int n;
  scanf("%d\n",&n);
  int price[n];
  int max = 0,answer = 0;
  for(int i = 0; i < n; ++i){
    scanf("%d\n",&price[i]);
    if(max < price[i]) max = price[i];
    answer += price[i];
  }
  answer -= max / 2;
  printf("%d\n",answer);
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    int a[n];
    rep(i, n) {
        cin >> a[i];
    }

    int ans = 1;
    for(int i = 0; i <= n-3; i++) {
        if(a[i] < a[i+1]) {
            if(a[i+1] < a[i+2]) {
                continue;
            }
            else if(a[i+1] > a[i+2]) {
                ans++;
                i++;
            }
            else {
                a[i+1]--;
            }
        }
        else if(a[i] > a[i+1]) {
            if(a[i+1] > a[i+2]) {
                continue;
            }
            else if(a[i+1] < a[i+2]) {
                ans++;
                i++;
            }
            else {
                a[i+1]++;
            }
        }
    }

    cout << ans;

    cout << endl;
    return 0;
}

Measured memory_bytes: 640
package main

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

func main() {
	s := bufio.NewScanner(bufio.NewReader(os.Stdin))
	s.Split(bufio.ScanWords)

	n := nextInt(s)
	k := nextInt(s)
	x := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = nextInt(s)
	}

	fmt.Println(solve(x, n, k))
}

func solve(x []int, n int, k int) int {
	r := -1
	for i := 0; i < n-k+1; i++ {
		c := cost(x[i], x[i+k-1])
		if r == -1 || c < r {
			r = c
		}
	}
	return r
}

func cost(a int, b int) int {
	if a <= 0 && b <= 0 {
		return -a
	}

	if a >= 0 && b >= 0 {
		return b
	}

	if -a > b {
		return b*2 - a
	}

	return -a*2 + b
}

func nextInt(s *bufio.Scanner) int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=200010;
const ll mod=1e9+7;

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  int ans = 0;
  rep(i,k){
    ans += a[i];
  }
  cout << ans << ln;


  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define rev(r) reverse(r.begin(),r.end())
#define SORT(ar) sort(ar.begin(), ar.end())
#define sz(x) (int)(x).size()
#define len(x) (int)x.length()
#define in(a) scanf("%d",&a)
#define pr(x) printf("%d ",x)
#define endl '\n'
#define read(v,n) for(int h=0;h<n;h++) cin>>v[h];
#define fo(i,a,b) for(i=a;i<b;i++)
#define fi(i,a,b) for(i=a;i>=b;i--)
#define mo 1000000007
#define N 300007
ll dp[3000][3000];

int main()
{
    ll n,i,j,k;
    cin>>n;
    ll a[n];
    fo(i,0,n) cin>>a[i];
    fi(i,n-1,0)
    {
        fo(j,i,n)
        {
            if(j==i) dp[i][j]=a[i];
            else dp[i][j]=max(a[i]-dp[i+1][j],a[j]-dp[i][j-1]);
        }
    }
    cout<<dp[0][n-1]<<endl;
}


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

int main(){
	int a, b, ans = 0, minv =10;
	for(int i = 0; i < 5; ++i){
		cin >> a;
		b = a % 10;
		a = ((a + 9) / 10) * 10;
		ans += a;
		if(minv > b && b != 0) minv = b;
	}
	ans = ans - (10 - minv);
	cout << ans << endl;
}


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

int main () {
  int a, b, c, ans = 0;
  cin >> a >> b >> c;
  
  if(a==b && a!=c) ans = 1;
  if(b==c && b!=a) ans = 1;
  if(c==a && c!=b) ans = 1;
  
  if(ans == 0) cout << "No" << endl ;
  else cout << "Yes" << endl ;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; 
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int ll;
#define ull unsigned long long int
#define all(a) a.begin(),a.end()s
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define hell 1000000007
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vi>
#define mp make_pair
#define pb push_back
#define MAX 10000001
int main()
{
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])
        cout<<"Yes";
    else
        cout<<"No";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <fstream>
#include <cassert>
using namespace std;

//common

typedef int  i32;
typedef long long i64,ll;
typedef long double ld;

#define BR "\n"
#define ALL(c) (c).begin(),(c).end()
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,r) for(int i=(int)l;i<(int)(r);++i)
#define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

//config
//#define NDEBUG
//#define INF 1<<30
//#define EPS 1e-8
//const ll MOD =100000007;

//debug
#ifdef NDEBUG
#define DUMP(x)
#define DUMPLN(x)
#define DEBUG(x)
#define DEBUGLN(x)
#define LINE()
#define LINELN()
#define CHECK(exp,act)
#define STOP(e)
#else
#define DUMP(x)  cerr << #x << " = " << (x)
#define DUMPLN(x)  DUMP(x) <<endl
#define DEBUG(x) DUMP(x) << LINE() << " " << __FILE__
#define DEBUGLN(x) DEBUG(x)<<endl
#define LINE()    cerr<< " (L" << __LINE__ << ")"
#define LINELN()    LINE()<<endl
#define CHECK(exp,act)  if(exp!=act){DUMPLN(exp);DEBUGLN(act);}
#define STOP(e)  CHECK(e,true);if(!(e)) exit(1);
#endif

template<class T> inline string toString(const vector<T>& x) {
	stringstream ss;
	REP(i,x.size()){
		if(i!=0)ss<<" ";
		ss<< x[i];
	}
	return ss.str();
}

template<class T> inline string toString(const vector<vector<T> >& map) {
	stringstream ss;
	REP(i,map.size()){
		if(i!=0)ss<<BR;
		ss<< toString(map[i]);
	}
	return ss.str();
}
template<class K,class V>  string toString(map<K,V>& x) {
	string res;stringstream ss;
	for(auto& p:x)ss<< p.first<<":" << p.second<<" ";
	return ss.str();
}

string BITtoString(int bit){
    stringstream ss;
    while(bit!=0){ss<<(bit%2);bit/=2;}
    string res=ss.str();reverse(ALL(res));
    return res;
}

template<typename T,typename V> inline T pmod(T v,V MOD){
	return (v%MOD+MOD)%MOD;
}
#define nextInt(n) scanf("%d",&n)
#define defInt(n) int n;nextInt(n)
#define nextLong(n) scanf("%lld",&n)
#define defLong(n) ll n;nextLong(n)
#define nextDouble(n) scanf("%lf",&n)

ll INF=1LL<<58;

class Main{
public:

	bool isTop(int i){
		if(i-1>=0 && as[i-1]>=as[i])return false;
		if(i+1<N && as[i]<=as[i+1])return false;
		return true;
	}

	int N,L;
	vector<ll> as;
	void run(){
	//	ifstream cin("in");
	//	ofstream cout( "out" );
		nextInt(N);nextInt(L);
		as=vector<ll>(N);REP(i,N)nextLong(as[i]);
		
		priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> que;
		// end time, index

		REP(i,N)if(isTop(i)) que.push(make_pair(L-as[i],i));
		
		ll t=0;
		while(!que.empty()){
			pair<ll,int> task=que.top();que.pop();
			ll end=task.first;int i=task.second;
			t=end;
			as[i]=0;
			if(i-1>=0 && isTop(i-1)) que.push(make_pair(t+L-as[i-1],i-1));
			if(i+1<N && isTop(i+1)) que.push(make_pair(t+L-as[i+1],i+1));
		}

		cout <<t<<endl;
	}
};
int main(){
	cout <<fixed<<setprecision(3);	
	ios::sync_with_stdio(false);
	Main().run();
	return 0;
}

Measured memory_bytes: 2860
#include <stdio.h>
#include <string.h>

int main(){

   char s[100], p[100], q[200];
   char *ret;
   int i, j, k;

   scanf("%s", s);
   scanf("%s", p);

   for (i = 0; s[i] != '\0'; i++);
   for (j = 0; p[j] != '\0'; j++);

   for (k = 0; k < i; k++){
      q[k] = s[k];
      q[k + i] = s[k];
   }

   ret = strstr( q, p);

   if (ret != NULL ) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }


   return 0;

}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define int long long
#define f(i,l,n) for(int i=l;i<n;i++) 
#define E "\n"

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


int32_t main()
{

     int t = 1;
    // cin >> t;
     while(t--)
     {
          solve();
     }
}

Measured memory_bytes: 3636
from copy import copy

n = int(input())
bomb = [[0 for i in range(8)] for j in range(8)]
for count in range(n):
    _ = input()
    for i in range(8):
        bomb[i] = [int(i) for i in list(input())]
    y = int(input()) -1
    x = int(input()) -1
    exp = []
    exp.append([x,y])
    while(len(exp) != 0):
        exp_ = copy(exp)
        for x,y in exp_:
            bomb[x][y] = 0
            for i in range(1,4):
                if x+i < 8:
                    if bomb[x+i][y] == 1:
                        exp.append([x+i,y])
                        bomb[x+i][y] = 0
                if y+i < 8:
                    if bomb[x][y+i] == 1:
                        exp.append([x,y+i])
                        bomb[x][y+i] = 0
                if x-i > -1:
                    if bomb[x-i][y] == 1:
                        exp.append([x-i,y])
                        bomb[x-i][y] = 0
                if y-i > -1:
                    if bomb[x][y-i] == 1:
                        exp.append([x,y-i])
                        bomb[x][y-i] = 0
            exp.remove([x,y])
    print("Data {}:".format(count+1))
    for i in range(8):
        print(*bomb[i],sep="")                    




Measured memory_bytes: 6336
import java.io.*
import java.util.*

object Input {
    private var i = 0
    private var line = listOf<String>()

    fun next(): String = if (i < line.size) {
        line[i++]
    } else {
        line = readLine()?.split(" ") ?: throw Exception("EOF")
        i = 0
        next()
    }

    fun int() = next().toInt()

    fun long() = next().toLong()

    fun double() = next().toDouble()
}

object Out {
    private val buffer = mutableListOf<Any>()

    fun writeln(obj: Any) = writeSep(obj, "\n")

    fun writeSep(obj: Any, sep: String = " ") = write("$obj$sep")

    fun write(obj: Any) = buffer.add(obj)

    fun flush() {
        print(buffer.joinToString(""))
        buffer.clear()
    }
}

inline fun run(action: () -> Unit) {
    try {
        action()
    } finally {
        Out.flush()
    }
}

fun main(args: Array<String>) = run {
    Input.int()
    val a = Input.int()
    val b = Input.int()
    val s = Input.next()

    var c1 = 0
    var c2 = 0

    for (c in s) {
        if ((c == 'a') && (c1 < a+b)) {
            Out.writeln("Yes")
            c1++
        } else if ((c == 'b') && (c1 < a+b) && (c2 < b)) {
            Out.writeln("Yes")
            c1++
            c2++
        } else {
            Out.writeln("No")
        }
    }
}

Measured memory_bytes: 46516
function Main(input) {
	input = input.split("\n");
	
	var s = input[0];
	var t = input[1];
	
	if(s == t) {
		console.log("No");
		return;
	}
	
	var alphabetSort = (function(a, b){
		a = a.toString().toLowerCase();
		b = b.toString().toLowerCase();
		if(a < b){
			return -1;
		}else if(a > b){
			return 1;
		}
		return 0;
	});
	
	var ss = s.split("").sort(alphabetSort).join();
	var rst = t.split("").sort(alphabetSort).reverse().join();
	
	var result = [ss, rst].sort(alphabetSort);
	//s'<t'ならばresult[0] = s'
	
    console.log(result[0] === ss ? "Yes" : "No");
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(){
    int n;
    cin>>n;
    char s;
    for(int i=0;i<n;i++){
        cin>>s;
        if(s =='Y'){
            cout<<"Four"<<endl;
            return 0;
        }
    }

    cout<< "Three"<< endl;
    
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid
const int N=2e5+100;

int32_t main(){
    string s;
    cin >> s;
    ll n=s.size();
    string y=s;
    reverse(y.begin(),y.end());
    ll ans=0;
    for (int i=0;i<n/2;i++){
        if (s[i]!=y[i]){
            ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
a=input().split(' ')
A=int(a[0])
B=int(a[1])
if A==1 and B==1:
  print('Draw')
elif A==1 and B!=1:
  print('Alice')
elif A!=1 and B==1:
  print('Bob')
else:
  if A==B:
    print('Draw')
  elif A>B:
    print('Alice')
  else:
    print('Bob')
    

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
vector<int>V;
int main(){
    int m,n;
    while(cin>>m>>n,m||n){
        V.clear();
        V.resize(n);
        int Max=0;
        for(int i=0;i<n;i++){
            cin>>V[i];
            Max=max(Max,V[i]);
        }
        int l=Max,r=100000000;
        while(r-l>=1){
            int mid=(l+r)/2;
            int cnt=1,leftW=mid;
            for(int i=0;i<n;i++){
                if(leftW>=V[i])leftW-=V[i];
                else{
                    cnt++;
                    leftW=mid-V[i];
                }
            }
            if(m<cnt)l=mid+1;
            else r=mid;
        }
        cout<<r<<endl;
    }
    return 0;
}

Measured memory_bytes: 1196
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        int out = 0;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == '1') out++;
        }
        System.out.println(out);
    }
    
    public static void main(String[] args){
        new Main().solve();
    }
}


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

using namespace std;

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

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

int main()
{
	string str;cin >> str;
	str[3] = '8';
	cout << str << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a;
    std::deque<int> one;
    std::deque<int> two;
    cin>>n;
    for (int i=0;i<n;i++) {
        cin>>a;
        one.emplace_back(a);
    }
    for (int j=0;j<n;j++) {
        cin>>a;
        two.emplace_back(a);
    }
    int max=0;
    for (int k=0;k<n;k++) {
        int sum=0;
        for (int l=0;l<=k;l++) {
            sum+=one[l];
        }
        for (int m=k;m<n;m++) {
            sum+=two[m];
        }
        if (sum>max) {
            max=sum;
        }
    }
    cout<<max<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
    int N, K;
    cin >> N >> K;
    vector<pair<int, int>> p(K);
    for (int i = 0; i < K; i++) {
        cin >> p[i].first >> p[i].second;
    }
    vector<int> v(N);
    int m = 998244353;
    v[0] = 1;
    for (int i = 1; i < N; i++) {
        v[i] = v[i-1];
        for (auto x: p) {
            if (i >= x.first) {
                int a = max(0, i-x.second), b = i-x.first;
                if (a == 0) v[i] += v[b];
                else v[i] += (v[b] - v[a-1])%m;
                v[i] %= m;
            }
        }
    }
    int ans = v[N-1]-v[N-2];
    ans %= m;
    ans += m;
    ans %= m;
    cout << ans << endl;
}

Measured memory_bytes: 4028
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

void canP(bool x){
    if(x){
        cout << "Possible" << endl;
    }else{
        cout << "Impossible" << endl;
    }
}
int main(){
    string s; cin >> s;
    int ans = 0;
    rep(i,s.size()-1){
        if(s[i] != s[i+1]) ans++;
    }
    cout << ans << endl;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, char> Pc;
typedef pair<int, string> Ps;

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};
const int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const string dir8[8] = {"U", "RU", "R", "RD", "D", "LD", "L", "LU"};

// Self settings
// clang-format off
#define MAX_N 100000
#define MAX 100000
#define INFTY (1<<30)
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } Point operator*(double a) { return Point(a * x, a * y); } Point operator/(double a) { return Point(x / a, y / a); } double abs() { return sqrt(norm()); } double norm() { return x * x + y * y; } bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; } bool operator==(const Point& p) const { return fabs(x - p.y) < EPS && fabs(y - p.y) < EPS; } };
typedef Point Vector;
double norm(Vector a) { return a.x * a.x + a.y * a.y; }
double abs(Vector a) { return sqrt(norm(a));}
double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }
struct Segment { Point p1, p2; };
typedef Segment Line;
struct Node { int data; Node *left, *right; Node(int data) : data(data), left(NULL), right(NULL) {} };
// clang-format on

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int A, B;
  cin >> A >> B;
  // x * 0.08 = A && x * 0.10 = B

  for (int i = 0; i <= 10000; i++) {
    if (floor(i * 0.08) == A && floor(i * 0.1) == B) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from operator import itemgetter
# input
x = int(input())
#a, b, c = map(int, input().split())
#a, b, c = input().split()
o = []
for i in range(x):
    a, b = input().split()
    o.append([i+1, a, int(b)])
o.sort(key=itemgetter(2), reverse=True)
o.sort(key=itemgetter(1))
# print(o)
for j in range(x):
    print(o[j][0])


Measured memory_bytes: 3060
#!/usr/bin/env python3

import sys, heapq, bisect
sys.setrecursionlimit(300000)

def _count(A, n, v):
    ret = 0
    for a in A:
        target = v - a
        idx = bisect.bisect_left(A, target)
        ret += n - idx
    return ret

def _sum(A, n, v, sums):
    ss = 0
    for a in A:
        target = v - a
        idx = bisect.bisect_left(A, target)
        ss += sums[n] - sums[idx]
        ss += (n - idx) * a
    #print(mins)
    return ss

def solve(N: int, M: int, A: "List[int]"):
    A.sort()
    sums = [0]
    for a in A:
        sums.append(sums[-1] + a)
    l = -1
    r = max(A) * 2 + 1
    while r - l > 1:
        m = (r + l) // 2
        cnt = _count(A, N, m)
        if cnt >= M:
            l = m
        else:
            r = m
    cnt = _count(A, N, l)
    ret = _sum(A, N, l, sums)
    ret -= (cnt - M) * l
    print(ret)
    return ret


def solve_(N: int, M: int, A: "List[int]"):
    A.sort(reverse=True)
    q = [(-A[0] * 2, 0, 0)]
    ret = 0
    cnt = 0
    while cnt < M:
        s, i, j = heapq.heappop(q)
        ret += -s
        cnt += 1
        print(i, j)
        if i == j and i < N - 1:
            heapq.heappush(q, (-A[i] + -A[i + 1], i, i + 1))
        else:
            if cnt < M:
                ret += -s
                cnt += 1
                print(j, i)
            heapq.heappush(q, (-A[i + 1] + -A[j], i + 1, j))
            if j < N - 1:
                heapq.heappush(q, (-A[i] + -A[j + 1], i, j + 1))
    print(ret)
    return

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
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()


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

int res;
int main() {

    string s1,s2;
    cin>>s1>>s2;

    for(int i=0;i<3;i++) if(s1[i]==s2[i]) res++;

    cout<<res;
    return 0;
}

Measured memory_bytes: 256
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    h,w = map(int,ipt().split())
    a = [[int(i) for i in ipt().split()] for _ in range(h)]
    ans = []
    for i in range(h):
        for j in range(w):
            if a[i][j]&1:
                if j < w-1:
                    ans.append((i+1,j+1,i+1,j+2))
                    a[i][j+1] += 1
                elif i == h-1:
                    continue
                else:
                    ans.append((i+1,j+1,i+2,j+1))
                    a[i+1][j] += 1
    print(len(ans))
    for a1,a2,a3,a4 in ans:
        print(a1,a2,a3,a4)

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 75480
s = input()
t = input()

s_len = len(s)
t_len = len(t)

dp = [[0] * (t_len+1) for _ in range(s_len+1)]

for i in range(1,s_len+1):
    s_temp = s[i-1]
    for j in range(1, t_len+1):
        if(s_temp == t[j-1]):
            dp[i][j] = max(dp[i-1][j], dp[i][j-1], dp[i-1][j-1] + 1)
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])

ans = ''
while(s_len > 0 and t_len > 0):
    if(dp[s_len][t_len] == dp[s_len-1][t_len]):
        s_len -= 1
    elif(dp[s_len][t_len] == dp[s_len][t_len-1]):
        t_len -= 1
    else:
        ans = s[s_len-1]  + ans
        s_len -= 1
        t_len -= 1

print(ans)


Measured memory_bytes: 112988
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
template<typename T>vector<T> & cset(vector<T> &A,T e=T()){for(auto &I:A){I=e;} return A;}



ll cul(ll l,vector<ll> &A,ll M,ll N){
    ll mx=0;
    for(ll i=0;i<l;i++){
        ll a=A[i]+A[2*l-i-1];
        mx=max(mx,a%M);
    }
    for(ll i=0;i+l<N;i++){
        ll a=A[2*l+i]+A[2*N-1-i];
        mx=max(mx,a%M);
    }
    return mx;
}

int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> A(2*n);
    cin>>A;
    sort(A.begin(),A.end());
    ll l=0,r=n;
    auto judge=[&](ll mid){
        for(ll i=0;i+mid<n;i++){
            if(A[i+2*mid]+A[2*n-1-i]<m){return false;}
        }
        return true;
    };
    while(r-l>5){
        ll m=l+(r-l)/2;
        if(judge(m)){r=m;}
        else{l=m;}
    }
    ll ans=E;
    for(ll i=max(l-20,0LL);i<=min(r+20,n);i++){
        ans=min(ans,cul(i,A,m,n));
    }
    cout<<ans<<endl;
    
    
    return 0;
}


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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

// π M_PI
// deg = rad*180/M_PI

int main() {
    string s;
    cin >> s;
    if ( s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005

void solve()
{
    ll k,n;
    string s;
    cin>>k>>s;
    n=s.size();
    if(n<=k)
    {
        cout<<s<<endl;
    }
    else 
    {
        s=s.substr(0,k);
        s+="...";
        cout<<s<<endl;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3616
T = list(map(int,list(input())))
for i in range(2**3):
  ans = T[0]
  op = ["+"]*3
  for j in range(3):
    if (i>>j) & 1:
      ans += T[j+1]
    else:
      ans -= T[j+1]
      op[j] = "-"
  if ans == 7:
    print(T[0],op[0],T[1],op[1],T[2],op[2],T[3],"=7",sep="")
    exit()

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		String s = br.readLine();

		int max = 0;

		for (int i = 1; i < s.length() - 1; i++) {
			HashSet<Character> s1 = new HashSet<Character>();
			for (Character c : s.substring(0, i).toCharArray()) {
				s1.add(c);
			}
			HashSet<Character> s2 = new HashSet<Character>();
			for (Character c : s.substring(i).toCharArray()) {
				s2.add(c);
			}
			int mc = 0;
			for (Character c1 : s1) {
				for (Character c2 : s2) {
					if (c1 == c2)
						mc++;
				}
			}
			max = Math.max(max, mc);
		}

		System.out.println(max);

	}

}


Measured memory_bytes: 22740
#include<stdio.h>
int dfs(int i,int j);
char map[110][110];
char gg;
int W,H;

int main()
{
    int i,j,ans;
    while(scanf("%d %d",&H,&W)!=EOF&&W&&H)
    {
        ans=0;
        for(i=0;i<H;i++)
            scanf("%s",map[i]);
        for(i=0;i<H;i++)
            for(j=0;j<W;j++)
        {
            if(map[i][j]!='X')
            {
               gg=map[i][j];
               map[i][j]='X';
               dfs(i,j);
               ans++;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

int dfs(int i,int j)
{
    int k,sx,sy;
    int next[][2]={{0,1},{1,0},{0,-1},{-1,0}};
        for(k=0;k<4;k++)
        {
            sx=i+next[k][0];
            sy=j+next[k][1];
            if(sx>=0&&sy>=0&&sx<H&&sy<W&&map[sx][sy]==gg)
            {
                map[sx][sy]='X';
                dfs(sx,sy);
            }
        }
        return 0;
}

Measured memory_bytes: 1396
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>


int main(){
  int N;
  scanf("%d", &N);
  std::vector<int > A(N);
  for (int i=0; i<N; i++){
    scanf("%d", &A[i]);
  }
  //printf("read\n");
  std::sort(A.begin(), A.end());
  std::vector<int > count(1000004, 0);
  for (int i=0; i<N; i++){
    //printf("i=%d\n", i);
    if (count[A[i]]>0) {
      count[A[i]]++;
      continue;
    }
    for (int j=A[i]; j<1000004; j+=A[i]){
      count[j]++;
    }
  }
  int ans = 0;
  for (int i=0; i<N; i++){
    if (count[A[i]]==1) ans++;
  }
  std::cout << ans << std::endl;
  return 0;
  
}


Measured memory_bytes: 7508
#include<bits/stdc++.h>
	 
	#define mp make_pair
	#define fi first
	#define se second
	#define pb push_back
	#define all(x) (x).begin(), (x).end()
	#define rall(x) (x).rbegin(), (x).rend()
	#define forn(i,n) for(int i = 0; i < n; i++)
	#define for1(i,n) for(int i = 1; i <= n; i++)
	#define ford(i,n) for(int i = n-1; i >= 0; i--)
	#define fore(i,a,b) for(int i = a; i <= b; i++)
	 
	using namespace std;
	 
	typedef long long ll;
	typedef long double ld;
	typedef vector<int> vi;
	typedef pair<int,int> pii;
	typedef pair<ll,ll> pll;
	typedef vector<ll> vll;
	 
	 
	const  int MAXn= 3e5+5;
	const  long long INF= 1e18;
	const long long mod= 1e9+7;
	 
	vector<int> adj[MAXn];
	map<pii, int> m;

	int bfs(int v) {
		queue<pii> q;
		q.push({v, -1});
		int ans = 0;
		while(!q.empty()) {
			pii p = q.front();
			q.pop();
			int temp = 1;
			for(int i = 0; i < (int)adj[p.fi].size(); i++) {
					 if(temp == p.se) temp++;
					 m[{p.fi, adj[p.fi][i] }] = temp;
					 q.push({adj[p.fi][i] , temp});
					 temp++;
			}
			ans = max(ans, temp - 1);
		}
		return ans;
	}
					 
	 
	int main(){
		int n;
		cin >> n;
		vector<pii> v;
		forn(i, n-1) {
			int a, b;
			cin >> a >> b;
			v.pb({a, b});
			m[{a,b}] = 0;
			adj[a].pb(b);
		}
	//	cout << m.size();
		int ans =  bfs(1);
		cout << ans << endl;
		for(auto x : v) {
			cout << m[{x.fi,x.se}] << endl;
		}
	}	
		


Measured memory_bytes: 16244
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  string S;
  cin >> S;
  set<string> s;
  int n = S.length();
  if (n == 1) {
    cout << "1\n";
    return 0;
  }
  if (n == 2) {
    if (S[0] == S[1]) {
      cout << "1\n";
    } else {
      cout << "2\n";
    }
    return 0;
  }

  int dp[n + 1][2]{};
  dp[0][0] = 1;
  dp[0][1] = 0;
  if (S[0] == S[1]) {
    dp[1][0] = 1;
    dp[1][1] = 1;
  } else {
    dp[1][0] = 2;
    dp[1][1] = 1;
  }

  for (int i = 2; i < n; i++) {
    if(S[i] != S[i - 1]) {
      dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]) + 1; 
      dp[i][1] = dp[i - 2][0] + 1;
    } else {
      dp[i][0] = dp[i - 1][1] + 1;
      dp[i][1] = max(dp[i - 2][0] + 1, dp[i - 1][1]);
    }
  }
  cout << max(dp[n -1][0], dp[n - 1][1]) << "\n";
  return 0;
}

Measured memory_bytes: 2180
# 東京海上日動 プログラミングコンテスト2020 C
import numpy as np
from numba import njit
n, k = map(int, input().split())
A = np.array(list(map(int, input().split())), dtype=np.int64)

@njit
def imos(n, A):
    B = np.zeros(n+1, dtype=np.int64)
    for i in range(n):
        left = max(0, i - A[i])
        right = min(n, i + A[i] + 1)
        B[left] += 1
        B[right] -= 1
    B = np.cumsum(B)
    return B[:-1]

def solve(n,k,A):
    for i in range(k):
        A = imos(n, A)
        min_A = min(A)
        if min_A == n:
            return A
    return A

ANS = solve(n, k, A)
print(' '.join(map(str, ANS)))

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

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<int>A(M);
  int ans=0;
  int go0 =0;
  int goN =0;
  for(int i=0; i<M; i++)cin >> A.at(i);
  
  for(int i=0; i<M; i++){
    if(A.at(i)<X)go0 ++;
    else goN ++;
  }
  
  if(go0<goN)ans=go0;
  else ans = goN;
  
  cout << ans << endl;
}

Measured memory_bytes: 3636
export const Main = function (input: Array<Array<string>>) {
  const day: string = input[0][0];
  const days: Array<string> = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
  console.log(7 - days.indexOf(day))

}
const parseInput = (input: string) => {
  const lines = input.split("\n");
  if (lines[lines.length - 1] === "") lines.pop();
  return lines.map((el) => (el.split(" ")));
}

Main(parseInput(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 7500
#include <bits/stdc++.h>
#define rep(n) for(int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n, m;
    cin >> n >> m;
    vector<int> edge(n, 0);
    repeat(i, m) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        ++edge[a];
        ++edge[b];
    }
    repeat(i, n) {
        cout << edge[i] << endl;
    }
    return 0;
}

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

def main():
    N = int(input())
    a = list(map(int, input().split()))

    tmp = []
    for i in range(N):
        tmp.append((a[i], i))
    tmp = sorted(tmp, key=lambda x: x[0])
    
    for i in range(N-1):
        print(tmp[i][1]+1, end=" ")
    print(tmp[N-1][1]+1)


if __name__ == "__main__":
    main()

Measured memory_bytes: 20148
# 二項係数のmod (大量のmod計算が必要なとき)
def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r=min(r,n-r)

    return g1[n] * g2[r] * g2[n - r] % mod

mod=998244353
N = 10 ** 6 # 出力の制限
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)

n,m,k= map(int, input().split())


ans=0
# 同じ色で塗る組数で場合分け
for i in range(k+1):
    # 同色の組の色の割り当て
    v1=m*pow(m-1,n-i-1,mod)
    # グループの分け方
    v2=cmb(n-1,i,mod)
    ans+=v1*v2
    ans%=mod

print(ans)

Measured memory_bytes: 167868
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  
  int count = 0;
  for(int i = 0; i < N-2; i++){
    if(S[i] == 'A'){
      if(S[i+1] == 'B'){
        if(S[i+2] == 'C'){
          count++;
        }
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (ll i = ll(a); i <= ll(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
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 dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N, max, f = 0;
    in >> N;
    vector<ll> H(N);
    REP(i,N){
        in >> H[i];
    }

    max = H[0];
    REP_AB(i,1,N-1){
        if(max < H[i]){
            max = H[i] - 1;
        }
        else if(max > H[i]){
            f = 1;
            break;
        }
    }


    if(f == 0){
           out << "Yes" << endl;
    }else if(f == 1){
           out << "No" << endl;
    }


 

 

}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("4 6");
            WillReturn.Add("2 1");
            WillReturn.Add("3 4");
            WillReturn.Add("4 10");
            WillReturn.Add("3 4");
            //11
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("4 6");
            WillReturn.Add("2 1");
            WillReturn.Add("3 7");
            WillReturn.Add("4 10");
            WillReturn.Add("3 6");
            //13
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("4 10");
            WillReturn.Add("1 100");
            WillReturn.Add("1 100");
            WillReturn.Add("1 100");
            WillReturn.Add("1 100");
            //400
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("4 1");
            WillReturn.Add("10 100");
            WillReturn.Add("10 100");
            WillReturn.Add("10 100");
            WillReturn.Add("10 100");
            //0
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    struct NimotuDef
    {
        internal int W;
        internal int V;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] wkArr = { };
        Action<string> SplitAct = pStr =>
            wkArr = pStr.Split(' ').Select(X => int.Parse(X)).ToArray();

        SplitAct(InputList[0]);
        int W = wkArr[1];

        var NimotuList = new List<NimotuDef>();
        foreach (string EachStr in InputList.Skip(1)) {
            SplitAct(EachStr);
            NimotuList.Add(new NimotuDef() { W = wkArr[0], V = wkArr[1] });
        }
        //重さの昇順でソートしておく
        NimotuList.Sort((A, B) => A.W.CompareTo(B.W));

        //最大の価値[重さ合計]なDP表
        var PrevDP = new Dictionary<int, int>();
        PrevDP[0] = 0;

        foreach (NimotuDef EachNimotu in NimotuList) {
            var CurrDP = new Dictionary<int, int>(PrevDP);
            foreach (var EachPair in PrevDP) {
                int NewKey = EachPair.Key + EachNimotu.W;
                if (NewKey > W) continue;

                int NewVal = EachPair.Value + EachNimotu.V;

                if (CurrDP.ContainsKey(NewKey)) {
                    if (CurrDP[NewKey] < NewVal) {
                        CurrDP[NewKey] = NewVal;
                    }
                }
                else CurrDP[NewKey] = NewVal;
            }
            PrevDP = CurrDP;
        }
        Console.WriteLine(PrevDP.Values.Max());
    }
}


Measured memory_bytes: 14048
#include<stdio.h>
int main(){
    int a,b,c;
    int tmp;
    scanf("%d %d %d", &a, &b, &c);
    if(a > b){
        tmp = a;
        a = b;
        b = tmp;
    }
    if(b > c){
        tmp = b;
        b = c;
        c = tmp;
    }
    if (a > b){
        tmp = a;
        a = b;
        b = tmp;
    }
    printf("%d %d %d\n", a, b, c);
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>

#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD=(double)1e9+7;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

#define INF 1LL << 50


LL f(LL b,LL n){
    if(n<b) return n;
    return f(b,n/b)+(n%b);
}

int main(){
    LL N,S;
    cin>>N>>S;
    if(S>N){
        cout<<-1<<endl;
        return 0;
    }else if(N==S){
        cout<<N+1LL<<endl;
        return 0;
    }
    set<LL> SS;
    for(LL b=2;b*b<=N;b++) if(f(b,N)==S) SS.insert(b);
    
    for(LL p=1;p*p<N && p<=S;p++) {
        LL m=S-p;
        if(N-m>=0 && (N-m)%p==0) {
            LL b=(N-m)/p;
            if(b>p && b>m) SS.insert((N-m)/p);
        }
        
    }
    if(SS.empty()){
        cout<<-1<<endl;
    }else{
        cout<<*SS.begin()<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
 
int main(void){
 
  char str[3];
 
  int i;
  scanf("%c %c %c",&str[0],&str[1],&str[2]);
 
  if(atoi(str)%4 == 0){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
 
  return 0;
 
}

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

#include <iostream>

using namespace std;

int main() {
    int N, M, C;
    cin >> N >> M >> C;
    int B[21];
    for (int i = 0; i < M; i++) {
        cin >> B[i];
    }
    int A[21][21];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            cin >> A[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        int sum = C;
        for (int j = 0; j < M; j++) {
            sum += (A[i][j] * B[j]);
        }
        ans += (sum > 0 ? 1 : 0);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int N, K, ans = 1;
    cin >> N >> K;
    N;
    while(N > 0){
        N /= K;
        ans++;
    }
    cout << ans - 1 << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
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 (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

int main() {
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	int tot = 0;
	rep(i, n) tot ^= a[i];
	debug(tot);
	rep(i, n) {
		cout << (a[i]^tot);
		if (i<n-1) cout << " ";
		else cout << endl;
	}
}

Measured memory_bytes: 4044
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#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 ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int n,m,x,y;
    cin >> n >> m >> x >> y;
    int ans1 = x;
    rep(i,n){
        int t;
        cin >> t;
        ans1 = max(ans1, t);
    }
    int ans2 = y;
    rep(i,m){
        int t;
        cin >> t;
        ans2 = min(ans2, t);
    }
    if(ans1 < ans2){
        cout << "No War" << endl;
    }else{
        cout << "War" << endl;
    }

}


Measured memory_bytes: 256