akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, q;
    string s;
    cin >> n >> s >> q;
    vll k(q); REP(i, q) cin >> k[i];
    REP(i, q) {
        ll dc=0, mc=0, dmc=0, ans=0;
        REP(j, s.size()) {
            if (s[j] == 'D') dc++;
            else if (s[j] == 'M') {mc++; dmc+=dc;}
            else if (s[j] == 'C') {
                ans += dmc;
            }
            if (j >=k[i]-1) {
                if (s[j-k[i]+1] == 'D') {dc--; dmc-=mc;}
                else if (s[j-k[i]+1] == 'M') mc--;
            }
        }
        cout << ans << '\n';
    }
    return 0;
}


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

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;
  map<int, int> cnt;
  for (int i = 0; i < N; i++)
  {
    int K;
    cin >> K;
    for (int j = 0; j < K; j++)
    {
      int A;
      cin >> A;
      cnt[A]++;
    }
  }
  int ans = 0;
  for (pair<int, int> t : cnt)
    if (t.second == N)
      ans++;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
long N,count=0;
  string stones;
  cin>>N;
  cin>>stones;
 long i=0,j=stones.length()-1;
  while(i<=j)
  {
    while(i<=j && stones[i]=='R')
    i++;
    while(i<=j && stones[j]=='W')
      j--;
    if(i<=j && stones[i]=='W' && stones[j]=='R')
    {
     i++;
     j--;
     count++;
    }
  }
  cout<<count;
  return 0;
}


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

using namespace std;

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

    vector<int> num;

    while(s>0){
        num.push_back(s%10);
        s=s/10;
    }

    reverse(num.begin(),num.end());
    long sum=0;

    for (int bit = 0; bit < (1 << (num.size()-1)); bit++){
        long tmp=num[0];
        for(int i=0; i < (int)num.size()-1; i++){
            if(bit & (1 << i)){
                sum+=tmp;
                tmp=num[i+1];
            }else{
                tmp = tmp*10+num[i+1];
            }
        }
        sum+=tmp;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
li = list(map(int, input().split()))
dic = {}
for n,i in enumerate(li):
    buka = n+1
    zyousi = i
    if zyousi in dic.keys():
        dic[zyousi].append(buka)
    else:
        dic[zyousi] = [buka]
for n in range(N):
    if n+1 in dic.keys():
        print(len(dic[n+1]))
    else:
        print(0)

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

using namespace std;

int main()
{
    int n;
    string s;
    cin >> n;
    cin >> s;
    long long result = 0;
    int numR = 0,numG = 0,numB = 0;
    int snumR = 0,snumG = 0, snumB = 0;
    for(int i = 0;i < n;i++){
        if(s[i] == 'R') numR++;
        else if(s[i] == 'G') numG++;
        else if(s[i] == 'B') numB++;
    }
    for(int i = 0;i < n;i++){
        string index = "111";
        if(s[i] == 'R') {
            numR--;
            index[0] = '0';
        }
        else if(s[i] == 'G') { 
            numG--; 
            index[1] = '0';
        }
        else if(s[i] == 'B') {
            numB--; 
            index[2] = '0';
        }
        snumR = numR; snumG = numG; snumB = numB;
        for(int j = i + 1;j < n;j++){
            string sindex = index;
            if(s[j] =='R') {
                snumR--;
                sindex[0] = '0';
            }
            else if(s[j] == 'G') {
                snumG--;
                sindex[1] = '0';
            }
            else if(s[j] == 'B') {
                snumB--;
                sindex[2] = '0';
            }
            if(s[j] != s[i]) {
                if(sindex == "001"){
                    if((j + j - i) <= (n - 1) && s[j + j - i] == 'B')
                        result += snumB - 1;
                    else
                        result += snumB;
                } else if(sindex == "010"){
                    if((j + j - i) <= (n - 1) && s[j + j - i] == 'G')
                        result += snumG - 1;
                    else
                        result += snumG;
                } else if(sindex == "100"){
                    if((j + j - i) <= (n - 1) && s[j + j - i] == 'R')
                        result += snumR - 1;
                    else
                        result += snumR;
                }
            }
        }
    }
    cout << result <<endl;
    return 0;
}

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

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

    li x; cin >> x;

    for (li i=200; i>=(-200); i--) {
        for (li j=200; j>=(-200); j--) {
            if (x == (pow(i,5) - pow(j,5))){
                cout << i << " " << j << "\n";
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18+100;
const int MAX = 1e5;

int main() {
    int n, k; cin >> n >> k;
    vint p(n), c(n);
    rep(i,n) {
        int x; cin >> x;
        x--;
        p[i] = x;
    }
    rep(i,n) cin >> c[i];
    vll v(n);
    vint ct(n);
    rep(i,n) {
        for (int j = p[i]; ; j = p[j]) {
            v[i] += c[j];
            ct[i]++;
            if (j == i) break;
        }
    }
    ll ans = -inf_l;
    rep(i,n) {
        if (v[i] > 0) {
            int n_loop = k / ct[i];
            int rem = k % ct[i];
            ll sum = v[i] * n_loop;
            int num = 0;
            for (int j = p[i]; ; j = p[j]) {
                if (num == rem) sum -= v[i];
                num++;
                sum += c[j];
                ans = max(ans,sum);
                if (j == i) break;
            }
        } else {
            ll sum = 0;
            int rem = min(k,ct[i]);
            int cur = i;
            while (rem--) {
                cur = p[cur];
                sum += c[cur];
                ans = max(ans,sum);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3732
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.NoSuchElementException;
 
public class Main {
	private static FastScanner sc = new FastScanner();
	
	public static void main(String[] args) {
		int N = sc.nextInt();
		int W = sc.nextInt();
		ArrayList<Integer> v = new ArrayList<>();
		ArrayList<Integer> w = new ArrayList<>();
		for(int i=0; i<N; i++) {
			int va = sc.nextInt();
			int wa = sc.nextInt();
			int m = sc.nextInt();
			int k = 1;
			int sum = 0;
			while(k <= m/2) {
				v.add(va*k);
				w.add(wa*k);
				sum += k;
				k *= 2;
			}
			v.add(va*(m - sum));
			w.add(wa*(m - sum));
		}
		
		int[] dp = new int[W+1];
		for(int i=0; i<v.size(); i++) {
			for(int j=W; j>=0; j--) {
				if(j-w.get(i) >= 0 && dp[j-w.get(i)] + v.get(i) > dp[j]) {
					dp[j] = dp[j-w.get(i)] + v.get(i);
				}
			}
		}
		
		int max = 0;
		for(int j=0; j<=W; j++) {
			if(dp[j] > max) {
				max = dp[j];
			}
		}
		System.out.println(max);
	}
	
	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 26428
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
using int128=__int128;

void solve(){
    ll n,a,b,c,d;cin>>n>>a>>b>>c>>d;

    map<int128,int128> memo;
    memo[1]=d;
    function<int128(int128)> rec=[&](int128 m){
        if(memo.count(m)) return memo[m];
        int128 ret=m*d;
        if(m/2>0) chmin(ret,rec(m/2)+m%2*d+a);
        if(m/3>0) chmin(ret,rec(m/3)+m%3*d+b);
        if(m/5>0) chmin(ret,rec(m/5)+m%5*d+c);
        if((m+1)/2<m) chmin(ret,rec((m+1)/2)+(2-m%2)*d+a);
        if((m+2)/3<m) chmin(ret,rec((m+2)/3)+(3-m%3)*d+b);
        if((m+4)/5<m) chmin(ret,rec((m+4)/5)+(5-m%5)*d+c);
        return memo[m]=ret;
    };
    cout<<(ll)rec(n)<<endl;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int q;cin>>q;
    while(q--) solve();    
    return 0;
}


Measured memory_bytes: 4620
#include<bits/stdc++.h>
using namespace std;
string str;
long long ans;
map<string,int>lwq;
int n;
int main() {
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>str;
		sort(str.begin(),str.end());
		ans+=(lwq[str]++);
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

int main()
{
    long long sum=0;
    int a[300009]={0},n,i,ind;
    scanf("%d",&n);
    for(i=0;i<3*n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+(3*n));
    ind=3*n-2;
    for(i=3*n-2;i>=n;i-=2)
    {
        sum+=(long long)a[i];
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;



signed main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = 0;
    int e[101] = {};
    rep(i, a, b) e[i]++;
    rep(i, c, d) e[i]++;
    rep(i, 0, 101) if(e[i] == 2) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Long() + add;
        }
        return Array;
    }
}
class Program {
    
    static Scanner cin = new Scanner();
    static void Main() {
        int N = cin.Int();
        var A = new long[N];
        for (int i = 0; i < N; i++) { //数字i+1のカードがA[i]枚ある
            A[i] = cin.Long();
        }

        long ans = 0;
        long sum = 0;

        for (int i = 0; i < N; i++) {
            if (A[i] == 0) {
                ans += sum / 2;
                sum = 0;
            }
            else sum += A[i];
        }
        ans += sum / 2;

        Console.WriteLine(ans);
        Console.ReadLine();
    }
}

Measured memory_bytes: 17328
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#define MOD (int)(1e9+7)

int main()
{
	long long n, a, b; cin >> n >> a >> b;
	long long ans = 0;
	vector<int>X(n);
	cin >> X[0];
	for (int i = 1; i < n; i++) {
		cin >> X[i];
		if (b < a*(X[i] - X[i - 1]))ans += b;
		else ans += a*(X[i] - X[i - 1]);
	}

	cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main() {
    int R;
    cin >> R;
    string s;
    if(R < 1200) s = "ABC";
    else if(R < 2800) s = "ARC";
    else s = "AGC";
    cout << s << endl;
}


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

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

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

int main()
{
	ll n,t;
	cin >> n >> t;
	vector<ll> a(n+10,0),b(n+10,0);
	rep(i,n) cin >> a[i];
	for(int i = n-1; i >= 0; i--){
		b[i] = max(a[i],b[i+1]);
	}
	ll ma = 0;
	for(int i = 0; i < n-1; i++){
		ma = max(ma,b[i]*(t/2)-a[i]*(t/2));
	}
	ll ans = 0;
	for(int i = 0; i < n-1; i++){
		if(ma == b[i]*(t/2)-a[i]*(t/2)) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;
//import java.lang.Math;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(true){
            String S=sc.next();
            int n=S.length();
            int ans=0;
            if(n==1 && S.charAt(0)=='0') break;
            for(int i=0;i<n;i++) ans+=(S.charAt(i)-'0');
            System.out.println(ans);
        }
        sc.close();
    }
}


Measured memory_bytes: 26328
// Problem : B - Beautiful Strings
// Contest : AtCoder - AtCoder Beginner Contest 044
// URL : https://atcoder.jp/contests/abc044/tasks/abc044_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;

void solve() {
	string w;
	cin >> w;
	
	int cnt[123] = {0};
	for (char i: w){
		cnt[(int) i]++;
	}
	
	for (int i=97; i<123; i++){
		if (cnt[i] % 2 == 1){
			cout << "No";
			return;
		}
	}
	
	cout << "Yes";
	return;
}

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

    solve();

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) { // 33m30s AC

        Scanner sc = new Scanner(System.in);

        int N = Integer.parseInt(sc.nextLine());
        String[] pn = sc.nextLine().split(" ");

        int badPlaceCount = 0;
        for (int i = 0; i < N; i++) {
            if (Integer.parseInt(pn[i]) != i + 1) {
                badPlaceCount++;
            }
        }

        if (badPlaceCount == 2 || badPlaceCount == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int arr[3][3];
    for (int i=0;i<3;i++){
        for (int j=0;j<3;j++){
            cin>>arr[i][j];
        }
    }
    int t,stop=0,win=0;
    cin>>t;
    for (int k=0;k<t;k++){
        int b;
        cin>>b;
    for (int i=0;i<3;i++){
        for (int j=0;j<3;j++){
            if (arr[i][j]==b)
                arr[i][j]=-1;
            }
        }
    }
        for (int i=0;i<3;i++){
        if (arr[i][0]==arr[i][1] and arr[i][1]==arr[i][2] and arr[i][2]==-1)
            win =1;
        else if (arr[0][i]==arr[1][i] and arr[1][i]==arr[2][i] and arr[2][i]==-1)
            win =1;
     }
    if (arr[0][0]==arr[1][1] and arr[1][1]==arr[2][2] and arr[2][2]==-1)
            win=1;
    if (arr[0][2]==arr[1][1] and arr[1][1]==arr[2][0] and arr[2][0]==-1)
            win=1;
    if (win){
         cout<<"Yes";
         return 0;
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
using ll = long long;
using ull = unsigned long long;

vector<int> v;

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

    rep(i, n){
        int a;
        cin >> a;
        v.pb(a);
    }
    v.pb(v[0] + k);

    int d = 0;
    rep(i, n){
        d = max(d, v[i + 1] - v[i]);
    }

    println(k - d);
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin>>N;
vector<int>wtf(N);
vector<int>answer(N);
for(int i=0; i<N; i++){
cin>>wtf.at(i);
}
for(int i=0;i<N; i++){
 int a=wtf.at(i);
answer.at(a-1)=i+1;
}
for(int i=0; i<N; i++){
cout<<answer.at(i)<<" ";
}
cout<<""<<endl;
}

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


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n); bool check = true;
    for(int i=0;i<n;++i) cin>>a[i];
    for(int i=0;i<n;++i)
    {
        if(a[i]%2==0 && (a[i]%3==0 || a[i]%5==0)) continue;
        else if(a[i]&1) continue;
        check = false;
    }
    if(check) cout<<"APPROVED";
    else cout<<"DENIED";
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N;
    void solve()
    {
        var S = cin.next;
        N = S.Length;
        bool flag = true;
        if (N < 4)
        {
            flag = false;
        }
        if (new string(S.Take(4).ToArray()) != "YAKI")
        {
            flag = false;
        }
        WriteLine(flag ? "Yes" : "No");
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k,w;
	string s="";
	cin>>n>>k;
	while(n>=k){
		w=n%k;
		n/=k;
		s+=to_string(w);
	}
	s+=to_string(n);
	reverse(s.begin(), s.end());
	cout<<s.length()<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

signed main(){
	cout<<fixed<<setprecision(7);
	
	int n[10] = {}, te[100] = {};
	
	cin>>n[0]>>n[1]>>n[2]>>n[3];
	
	for(int i = 0; i < 4; i++){
		te[n[i]]++;
	}
	cout<<YN(te[1]&&te[9]&&te[7]&&te[4])<<endl;
	
	return 0;
}

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

using namespace std ;

#define maxn 1000005

vector <int> prm ;
int isPrime[maxn] ;

int main()
{
    for(int i=2 ; i<=1000000 ; i++) isPrime[i] = 1 ;

    for(int i=2 ; i<=1000000 ; i++)
    {
        if( isPrime[i] )
        {
            for(int j=i+i ; j<=1000000 ; j+=i) isPrime[j] = 0 ;
        }
    }

    for(int i=2 ; i<=1000000 ; i++)
    {
        if( isPrime[i] ) prm.push_back(i) ;
    }

    long long n , P ;
    scanf("%lld %lld",&n,&P) ;

    if(n==1)
    {
        printf("%lld\n",P) ;
        return 0 ;
    }

    long long ans = 1 ;

    for(int i=0 ; i<prm.size(); i++)
    {
        long long pwr = 0 ;
        while( P%prm[i] == 0 )
        {
            pwr++ ;
            P /= prm[i] ;
        }

        pwr /= n ;

        for(int j=1 ; j<=pwr ; j++ ) ans = ans*prm[i] ;

    }

    printf("%lld\n",ans) ;

    return 0 ;
}


Measured memory_bytes: 4732
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

int main() {
    int A, B, T, ans = 0;
    cin >> A >> B >> T;
    for (int i = 1; i < (T + 0.5) / A; i++) {
        ans += B;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int a,b,c,d;
    while(cin>>a>>b>>c>>d){
        int sum1=a+c;
        int sum2=a+d;
        int sum3=b+c;
        int sum4=b+d;
        cout<<min(sum1,min(sum2,min(sum3,sum4)))<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	e = [Int[] for i in 1:n]
	for i in 1:n-1
		a,b = readline() |> split |> parseMap
		push!(e[a],b)
		push!(e[b],a)
	end
	k = readline() |> parseInt
	num = Tuple{Int,Int}[(-10^18,10^18) for i in 1:n]
	nx = zeros(Int,n)
	for i in 1:k
		v,p = readline() |> split |> parseMap
		num[v]=(p,p)
		nx[v]=1
	end
	rt = 0
	for i in 1:n
		if nx[i]==1
			rt = i
			break
		end
	end
	stack = Int[rt]
	t = -ones(Int,n)
	layer = Tuple{Int,Int}[(0,i) for i in 1:n]
	t[rt] = rt
	while !isempty(stack)
		now = pop!(stack)
		for i in e[now]
			if t[i]<0
				push!(stack,i)
				t[i] = now
				layer[i] = (layer[now][1]+1,i)
			end
		end
	end
	layer = sort(layer,by=x->x[1],rev=true)
	f = 0
	x = num[rt][1]%2
	for iter in 1:n
		i = layer[iter][2]
		cl = num[i][1]
		cr = num[i][2]
		pl = num[t[i]][1]
		pr = num[t[i]][2]
		if cl==cr&&(cl+layer[iter][1])%2!=x
			f = 1
		elseif pr+1<cl||cr+1<pl
			f = 1
		else
			num[t[i]] = (max(pl,cl-1),min(pr,cr+1))
		end
	end
	if f == 1
		println("No")
	else
		println("Yes")
		ans = -10^18*ones(Int,n)
		ans[rt] = num[rt][1]
		stack = Int[rt]
		while !isempty(stack)
			now = pop!(stack)
			for i in e[now]
				if ans[i]==-10^18
					push!(stack,i)
					if num[i][1]<=ans[now]+1<=num[i][2]
						ans[i] = ans[now]+1
					else
						ans[i] = ans[now]-1
					end
				end
			end
		end
		for i in 1:n
			println(ans[i])
		end
	end
end

main()

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

typedef long long int ll;
typedef vector<ll> vi;			typedef vector<ll> vl;
typedef vector<vi> vvi; 		typedef vector<vl> vvl;
typedef pair<ll, ll> 	pii;	typedef pair<ll, ll> pll;
typedef vector<pii> vii; 		typedef vector<pll> vll;
typedef vector<vii> vvii;
typedef map<ll,ll> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(ll i=0;i<n;i++)
#define rforn(i,n) for(ll i=n-1;i>=0;i--)
#define forne(i,n) for(ll i=1;i<=n;i++)
#define rforne(i,n) for(ll i=n;i>=1;i--)
#define forse(i,s,e) for(ll i=s;i<e;i++)
#define rforse(i,s,e) for(ll i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define in insert
#define mp(a, b) make_pair(a, b)
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define INF LLONG_MAX
#ifdef KARAN
	#include "../../trace.h"
#else
    #define trace(args...)
#endif

vvii adj;
ll const mcoins = 2500;


void dijkstra(ll s, vector<ll> & d){
//Adjlist stored as vvii
    ll n = adj.size();
    d.assign(n, INF);

    d[s] = 0;
    priority_queue<pii, vector<pii>, greater<pii>> q;
    q.push(mp(0, s));
    while (!q.empty()){
        ll v = q.top().second;
        ll d_v = q.top().first;
        q.pop();
        if (d_v != d[v])
            continue;

        for (auto edge: adj[v]){
            ll to = edge.first;
            ll len = edge.second;

            if (d[v] + len < d[to]) {
                d[to] = d[v] + len;
                q.push(mp(d[to], to));
            }
        }
    }
}

void solve(){
	ll n, m, s;
	cin>>n>>m>>s;
	s = min(s, mcoins-1);
	adj.resize(n*mcoins);

	forn(i, m){
		ll u, v, a, b;
		cin>>u>>v>>a>>b;
		u--; v--;
		ll nodeu = u*mcoins, nodev = v*mcoins;
		forn(j, mcoins-a){
			adj[nodeu + j + a].pb(mp(nodev + j, b));
			adj[nodev + j + a].pb(mp(nodeu + j, b));
		}
	}

	forn(i, n){
		ll nodei = i*mcoins;
		ll c, d;
		cin>>c>>d;
		forn(j, mcoins - c)
			adj[nodei + j].pb(mp(nodei + j + c, d));
	}
	
	vector<ll> dist(n*mcoins);
	dijkstra(s, dist);
	vector<ll> output(n, INF);
	forn(i,n)
		forn(j, mcoins)
			output[i] = min(output[i], dist[i*mcoins+j]);
	
	forne(i, n-1)
		cout<<output[i]<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef KARAN
		freopen("inp.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    	freopen("err.txt", "w", stderr);
	#endif
	ll t=1;
	// cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 23720
import sys
sys.setrecursionlimit(3*(10**5))


N, Q = map(int, input().split())
T = [[0, []] for _ in range(N+1)] #counter, nearest-children
E = [list(map(int, input().split())) for _ in range(N-1)]
PX = [list(map(int, input().split())) for _ in range(Q)]
for e in E:
  T[e[0]][1].append(e[1])
for px in PX:
  T[px[0]][0] += px[1]
for t in T:
  for c in t[1]:
    T[c][0] += t[0]
ans_s = ""
for t in T[1:]:
  ans_s += "%d "%t[0]
print(ans_s)



Measured memory_bytes: 146620
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] s = Console.ReadLine().Trim().Split(' ');
        var y = false;
        for (int i = 0; i < n; i++)
            if (s[i] == "Y") { y = true; break; }
        Console.WriteLine(y ? "Four" : "Three");
    }
}




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

int main(){
  //ここからコードを書く
  int N , M; /// N個のボールは偶数、M個のボールには奇数が書かれている。
  cin >> N >> M;
  int count = 0; //countに記録する。
  if (N >= 2) count += N*(N-1)/2;
  if (M >= 2) count += M*(M-1)/2;
  cout << count << endl;
}



Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

// NextLine reads a line text from stdin, and then returns its string.
func NextLine() string {
	sc.Scan()
	return sc.Text()
}

// NextIntsLine reads a line text, that consists of **ONLY INTEGERS DELIMITED BY SPACES**, from stdin.
// And then returns intergers slice.
func NextIntsLine() []int {
	ints := []int{}
	intsStr := NextLine()
	tmp := strings.Split(intsStr, " ")
	for _, s := range tmp {
		integer, _ := strconv.Atoi(s)
		ints = append(ints, integer)
	}
	return ints
}

// NextRunesLine reads a line text, that consists of **ONLY CHARACTERS ARRANGED CONTINUOUSLY**, from stdin.
// Ant then returns runes slice.
func NextRunesLine() []rune {
	return []rune(NextLine())
}

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// PowInt is integer version of math.Pow
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}
	fa := float64(a)
	fe := float64(e)
	fanswer := math.Pow(fa, fe)
	return int(fanswer)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	fa := float64(a)
	fanswer := math.Abs(fa)
	return int(fanswer)
}

// DeleteElement returns a *NEW* slice, that have the same and minimum length and capacity.
// DeleteElement makes a new slice by using easy slice literal.
func DeleteElement(s []int, i int) []int {
	if i < 0 || len(s) <= i {
		panic(errors.New("[index error]"))
	}
	// appendのみの実装
	n := make([]int, 0, len(s)-1)
	n = append(n, s[:i]...)
	n = append(n, s[i+1:]...)
	return n
}

// Concat returns a *NEW* slice, that have the same and minimum length and capacity.
func Concat(s, t []rune) []rune {
	n := make([]rune, 0, len(s)+len(t))
	n = append(n, s...)
	n = append(n, t...)
	return n
}

// sort package (snippets)
//sort.Sort(sort.IntSlice(s))
//sort.Sort(sort.Reverse(sort.IntSlice(s)))
//sort.Sort(sort.Float64Slice(s))
//sort.Sort(sort.StringSlice(s))

// copy function
//a = []int{0, 1, 2}
//b = make([]int, len(a))
//copy(b, a)

/*******************************************************************/

var n int

func main() {
	tmp := NextIntsLine()
	n = tmp[0]
	power := 1
	for i := 1; i <= n; i++ {
		power = (power * i) % 1000000007
	}
	fmt.Println(power)
}


Measured memory_bytes: 640
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N, A, B;
  std::cin >> N >> A >> B;
  std::cout << std::min<i64>(A, B) << ' ' << std::max<i64>(A + B - N, 0) << std::endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	var h []int
	var hi int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&hi)
		h = append(h, hi)
	}
	result := make([]int, n)
	for index, num := range h {
		result[num-1] = index + 1
	}
	fmt.Println(strings.Trim(fmt.Sprint(result), "[]"))
}


Measured memory_bytes: 6016
package main

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

var (
	nstr   func() string
	stdout *bufio.Writer
)

func init() {
	nstr = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func main() {
	defer stdout.Flush()

	n := nint()
	xList := make([]string, n)
	yList := make([]string, n)

	for i:=0;i<n ;i++  {
		xList[i] = nstr()
		yList[i] = nstr()
	}

	for i := 0; i<n	; i++  {
		fmt.Println(lcs(xList[i], yList[i]))
	}

}

func lcs(x string, y string) int{
	var m = len(x)
	var n = len(y)

	c := make([][]int, m+1)
	for i:= range c{
		c[i] = make([]int, n+1)
	}
	for i:=	1;i<=m ;i++  {
		for j:=1;j<=n ;j++  {
			if x[i-1] == y[j-1]{
				c[i][j] = c[i-1][j-1] + 1
			}else{
				c[i][j] = int(math.Max(float64(c[i-1][j]), float64(c[i][j-1])))
			}


		}
	}
	return c[m][n]

}


func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func nint64() int64 {
	i, err := strconv.ParseInt(nstr(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func nint() int {
	return int(nint64())
}

func getIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = nint()
	}
	return b
}

func getStringSlice(n int) []string {
	b := make([]string, n)
	for i := 0; i < n; i++ {
		b[i] = nstr()
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}

func contains(s []int, e int) bool {
	for _, a := range s {
		if a == e {
			return true
		}
	}
	return false
}

func bin(i int, prefix bool) string {
	i64 := int64(i)

	if prefix {
		return "0b" + strconv.FormatInt(i64, 2)
	} else {
		return strconv.FormatInt(i64, 2)
	}
}

func strReverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}

	return string(runes)
}



Measured memory_bytes: 18940
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxx = 1e5 + 7;
int n, m, ans;

struct PP {
	int a, b;
} p[maxx];

bool Cmp(PP x, PP y) { return x.b < y.b; }

int main() {
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= m; i++) scanf("%d %d", &p[i].a, &p[i].b);
	sort(p + 1, p + m + 1, Cmp);
	int t = 0;
	for(int i = 1; i <= m; i++) {
		if(p[i].a >= t){
			t = p[i].b; ans++;
		}
	}
	printf("%d\n", ans);
}

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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
    
int main(){
    LL N,A,B,C,D;
    cin>>N>>A>>B>>C>>D;
    LL X=B-A;
    if([&](){
            REP(i,N){
                LL t=i*D-(N-1-i)*C;
                LL b=i*C-(N-1-i)*D;
                if(b<=X&&X<=t)return true;
            }
            return false;
        }())cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> P;

signed main(){
  vector<int> v;
  int t=3;
  while(v.size()<1000){
    bool f=1;
    for(int i=2;i*i<=t;i++)if(t%i==0)f=0;
    if(f)v.push_back(t);
    t++;
  }
  int d1[500][500],d2[500][500],c=0;
  for(int i=-498;i<500;i+=2){
    for(int j=-i;j+i<500;j++){
      if(0<=j&&j<500&&0<=j+i&&j+i<500)d1[j][j+i]=v[c];
    }
    c++;
  }

  for(int i=0;i<1000;i+=2){
    for(int j=1000;i-j<500;j--){
      if(0<=j&&j<500&&0<=i-j&&i-j<500)d2[j][i-j]=v[c];
    }
    c++;
  }

  int n;
  cin>>n;
  
  int dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j)cout<<" ";
      if((i+j)%2){
	int res=1;
	set<int> s;
	for(int k=0;k<4;k++){
	  int nx=j+dx[k],ny=i+dy[k];
	  if(nx<0||ny<0||nx>=500||ny>=500)continue;
	  s.insert(d1[ny][nx]);
	  s.insert(d2[ny][nx]);
	}
	for(auto z:s){res*=z;}
	cout<<res+1;
      }
      else cout<<d1[i][j]*d2[i][j];
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 7040
#include<bits/stdc++.h>
#define LL long long
#define db double

using namespace std;
const int N=1e6+10,mod=1e9+7;
int rd()
{
    int x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+(ch^48);ch=getchar();}
    return x*w;
}
void ad(int &x,int y){x+=y,x-=x>=mod?mod:0;}
int n,f[N],sm,ans;

int main()
{
///
	n=rd(),f[0]=sm=1;
	ad(ans,1ll*(n-1)*(n-1)%mod),ad(ans,min(2,n-1));
	for(int i=1;i<n;++i)
	{
		f[i]=sm;
		if(i>=2) ad(f[i],mod-f[i-2]);
		ad(sm,f[i]);
		if(i<n-1) ad(ans,1ll*(n-1)*(n-1)%mod*f[i]%mod),ad(ans,1ll*min(i+2,n-1)*f[i]%mod);
	}
	ad(ans,1ll*n*f[n-1]%mod);
	printf("%d\n",ans);
    return 0;
}




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

#define INF 100000000
#define MOD9(a) (a%1000000009)
#define MOD7(a) (a%1000000007)
#define ABS(a) (a<0?-(a):a)
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define REP(i,a) for(int i=0;i<a;i++) 

using namespace std;
int main(){
  int A,B;
  char op;
  cin >> A >> op >> B;
  cout << A + (op=='+'?1:-1)*B << endl;

}



Measured memory_bytes: 256
/*#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define INF 1000000000000 //10^12:極めて大きい値,∞
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int x;
    cin >> x;
    cout << x*x*x << endl;
    return 0;
}


Measured memory_bytes: 3084
## 題意を愚直に実装した

H, W = map(int, input().split())

## 分け方は4通りしかない
## 全て縦に分割する/全て横に分割する/縦1横2に分割する/縦2横1に分割する

solver = []

## どちらかの辺が3で割り切れる場合は、平等に分配できる
if H % 3 == 0 or W % 3 == 0:
  print(0)
  exit()

## 全て縦に分割する
solver.append(H)
## 全て横に分割する
solver.append(W)

## 縦1横2に分割する
for height in [(H-1)//2, H//2, (H+1)//2]: ## 思考停止脳筋候補全列挙
  for length in [(W-1)//3, W//3, (W+1)//3]:
    area1 = H * length
    area2 = height * (W - length)
    area3 = (H - height) * (W - length)
    solver.append(max(area1,area2,area3) - min(area1,area2,area3))
    
## 縦2横1に分割する
for height in [(H-1)//3, H//3, (H+1)//3]:
  for length in [(W-1)//2, W//2, (W+1)//2]:
    area1 = height * W 
    area2 = (H - height) * length
    area3 = (H - height) * (W - length)
    solver.append(max(area1,area2,area3) - min(area1,area2,area3))
    
print(min(solver))

Measured memory_bytes: 3064
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<cmath>
#include<cstdio>
#include<cassert>
using namespace std;

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0)); 
const double INF = 0x3f3f3f3f;
const double INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

const int K = 160 * 160;
int H, W;
int A[81][81];
int B[81][81];
int dp[81][81][K+1];

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");

    cin >> H >> W;
    rep(i,H) rep(j,W) cin >> A[i][j];
    rep(i,H) rep(j,W) cin >> B[i][j];

    rep(i,H) rep(j,W) rep(k,K) dp[i][j][k] = 0;
    int d = abs(A[0][0] - B[0][0]);
    dp[0][0][d] = 1;

    rep(i,H){
        rep(j,W){
            d = abs(A[i][j] - B[i][j]);
            rep(k,K){
                if(i > 0 && dp[i-1][j][k] == 1){
                    dp[i][j][abs(k-d)] = 1;
                    dp[i][j][k+d] = 1;
                }
                if(j > 0 && dp[i][j-1][k] == 1){
                    dp[i][j][abs(k-d)] = 1;
                    dp[i][j][k+d] = 1;
                }
            }
        }
    }
    
    rep(k,K) if(dp[H-1][W-1][k] == 1){
        cout << k << endl;
        break;
    }
    return 0;
}


Measured memory_bytes: 649472
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<int,int>a,pair<int,int>b)
{
    if(a.first<b.first)
        return true;
    else
        return false;
}
int main()
{
 int n;
 cin>>n;
vector<pair<int,int>>v;
 for(int i=0;i<n;i++)
 {
    int x;
    cin>>x;
    v.push_back(make_pair(x,i+1));
 }
 sort(v.begin(),v.end(),comp);
 for(int i=0;i<n;i++)
 {
     cout<<v[i].second<<" ";

 }
}


Measured memory_bytes: 1780
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#include<tuple>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
#define REP(i,n) for (int i = 1; i <= (int)n; i++)//i=1からi=nまで
#define RREP(i,n)for(int i=n;i>=1;i--) 
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main() {
    int N, M, X; cin >> N >> M >> X;
    int c[13], a[13][13];
    rep(i, N) {
        cin >> c[i];
        rep(j, M) {
            cin >> a[i][j];
        }
       
    }
    int ans = INF;
    rep(s, 1 << N) {
        int cost=0;
        vector<int>und(M);
        rep(i, N) {
            if (s >> i & 1) {
                cost += c[i];
                rep(j, M) {
                    und[j] += a[i][j];
                }
            }
        }
       bool ok = true;
        
        rep(j, M) {
            if (und[j] < X) { ok = false; break; }
        }
        if (ok == true)chmin(ans, cost);
    }
    if (ans == INF)cout << -1 << endl;
    else cout << ans << endl;
       
 
}








   


Measured memory_bytes: 3640