akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define CONTEST_CNT 26

const ll mod = 1000000007;

int main() {
    int d; cin >> d;
    vector<int> cs(CONTEST_CNT);
    vector<vector<int>> ss(d, vector<int>(CONTEST_CNT));
    vector<int> ts(d);
    vector<int> lastd(CONTEST_CNT, -1);
    rep(i,CONTEST_CNT) cin >> cs.at(i);
    rep(i,d){
        rep(j,CONTEST_CNT){
            cin >> ss.at(i).at(j); 
        }
    }
    rep(i,d) cin >> ts.at(i);
    ll r = 0;
    rep(i,d){
        r += ss.at(i).at(ts.at(i) - 1);
        lastd.at(ts.at(i) - 1) = i;
        rep(j,CONTEST_CNT){
            r -= cs.at(j) * (i - lastd.at(j));
        }
        cout << r << endl;
    }
    return 0;
}

Measured memory_bytes: 3540
n = int(input())
C, S, F = [], [], []
for _ in range(n-1):
    c, s, f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)

for i in range(n-1):
    #i=0, 1つめの駅発を対象とする
    time = S[i] + C[i]
    for j in range(i+1, n-1):
        if time < S[j]:
            time = S[j] + C[j]
        elif time % F[j] == 0:
            time += C[j]
        else:
            time += F[j] - (time % F[j]) + C[j]
    print(time)
print(0)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

#define mod 1000000007

int main(){
	long long n,m;
	cin >> n >> m;
	vector<long long> x(n),y(m);
	for(long long i = 0;i < n;i++){
		cin >> x[i];
	}
	long long xsum = 0;
	for(long long i = 1;i < n;i++){
		long long c = i*(n-i)%mod;
		xsum = (xsum+(x[i]-x[i-1])*c)%mod;
	}
	for(long long i = 0;i < m;i++){
		cin >> y[i];
	}
	long long ysum = 0;
	for(long long i = 1;i < m;i++){
		long long c = i*(m-i);
		ysum = (ysum+(y[i]-y[i-1])*c)%mod;
	}
	cout << xsum*ysum%mod << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
const int INF=1001001001;

int main() {
  int N;
  cin>>N;
  vector<int>a(N),b(N);
  int64_t sum=0,M=0;
  for(int i=0;i<N;i++){
    cin>>a[i];
    b[i]=abs(a[i]);
    sum+=abs(a[i]);
    if(a[i]<0){M++;}
  }
  if(M%2==0){cout<<sum<<endl;}
  else{cout<<sum-2*(*min_element(b.begin(),b.end()))<<endl;}
  return 0;
}

Measured memory_bytes: 4036
#include <iostream> 
#include <cstdio> 
#include <cstdlib> 
#include <cstring> 
#include <string> 
#include <cmath> 
#include <queue> 
#include <stack>
#include <algorithm>
#include <vector> 
#include <bits/stdc++.h>
#define debug(x) cout<<"***"<<x<<"***"<<endl
using namespace std;
struct node
{
    long long a,b;
}z[100005];
bool cmp(node x,node y) 
{
    //if (x.a==y.a) return x.b>y.b;
	return x.a<y.a;
}
int main() 
{
    int n,m,tmp=0;
    long long ans=0;
    cin>>n>>m; 
	
        for(int i=0;i<n;i++)
            cin>>z[i].a>>z[i].b;
        sort(z,z+n,cmp);
        priority_queue<long long> que;
        for(int i=1;i<=m;i++) 
		{
            while(z[tmp].a<=i && tmp<n) 
			{
                que.push(z[tmp].b);
                tmp++;
            }
            if(que.empty()>0)	continue;
            ans+=que.top();
            que.pop();
        }
        cout<<ans<<endl;

    return 0;
}

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

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

    int N;
    cin >> N;

    int x = 800 * N;
    int y = (N / 15) * 200;
    cout << x - y << endl;

    return 0;
};

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, ans = 1;
char s[100005];
int main() {
	cin >> n;
	cin >> s[1];
	for(int i = 2; i <= n; i++) {
		cin >> s[i];
		if(s[i] != s[i - 1]) {
			ans++;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)                                 //g++ template.cpp -o template.exe
#define zeroes(x) memset(x,0,sizeof(x))                                        //all elements to 0  |  \
#define all(x) (x).begin(), (x).end()
typedef long long int ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn=100000;







bool sortbysec(const pair<int,int> &a,                         //sorting of elements wrt second
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 

bool sortinrev(const pair<int,int> &a,                   //sorting in descending wrt first 
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 
bool sortinrevsec(const pair<int,int> &a,                  //sorting in dsc wrt second
               const pair<int,int> &b) 
{ 
       return (a.second > b.second); 
} 




int main()
{
  ll a,b,c,k,sum=0;
  cin>>a>>b>>c>>k;
  if(a>=b)
  {
    long double p;
    p=(long double)a/(long double)b;
    p=log2(p);
    p=p+1;
    p=floor(p);
    sum+=(ll)p;
    b=b*pow(2,p);
  }
  //cout<<b;
  if(c<=b)
  {
    long double p;
    p=(long double)b/(long double)c;
    p=log2(p);
    p=p+1;
    p=floor(p);
    sum+=(ll)p;
    c=c*pow(2,p);
  }
  //cout<<a<<b<<c;

  if(sum<=k)
    cout<<"Yes";
  else
    cout<<"No";


  return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;

int p[200010];
double sum[200010];
int main()
{
	int N, K;
	cin >> N >> K;
	for (int i = 0; i < N; i++) cin >> p[i];
	for (int i = 0; i < N; i++) {
		sum[i + 1] = sum[i] + (double)(p[i] * (p[i] + 1) / 2) / p[i];
	}
	double ans = 0.0;
	for (int i = 0; i < N - K + 1; i++) {
		ans = max(ans, sum[i + K] - sum[i]);
	}
	printf("%.10f\n", ans);
}

Measured memory_bytes: 6120
import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
//		StringBuilder out = new StringBuilder();
		int n = sc.nextInt();
		int[] arr = new int[n];
		int[] brr = new int[n];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextInt()-1;
		}
		for(int i = 0; i < n; i++) {
			brr[i] = sc.nextInt()-1;
		}
		System.out.println(Math.abs(calc(brr, n) - calc(arr, n)));
	}
	static int calc(int[] arr, int n) {
		int res = 0;
		boolean[] seen = new boolean[n];
		for(int i = 0; i < n-1; i++) {
			int k = 0;
			for(int j = 0; j < n; j++) {
				if(!seen[j] && j < arr[i]) k++;
			}
			seen[arr[i]] = true;
			res += k;
			res *= (n-i-1);
		}
		return res;
	}

	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
	}

}


Measured memory_bytes: 22996
#include <iostream>

typedef long long ll;

#define FOR(i,a,b) for(ll i = (a);i < (b);++i)
#define REP(i,n) FOR(i,0,n)

#define debug(x) cout << #x << "=" << x << endl;

using namespace std;

int main(void){

  double a,b;
  cin >> a >> b;

  double mean = (a+b) /2.0;
  int ans = (mean + 0.5);

  cout << ans << endl;
    
  return 0;
}


Measured memory_bytes: 256
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,a,b,c,d = inm()
v = abs(b-a)
for i in range(n):
    l = i*c-(n-1-i)*d
    r = i*d-(n-1-i)*c
    if l<=v<=r:
        print('YES')
        exit()
print('NO')


Measured memory_bytes: 38768
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	int n,k,x,y;
	cin>>n>>k>>x>>y;
	if(n<=k){cout<<x*n<<endl;
	}else cout<<x*k+y*(n-k)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1e9+7
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n; cin >> n;
    vector<string> w(n);
    rep(i,n) {
        cin >> w[i];
    }
    rep(i,n) {
        rep(j,n) {
            if (i==j) continue;
            if (w[i]==w[j]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    bool check = true;
    rep(i,n-1) {
        int l = sz(w[i]);
        if (w[i][l-1]!=w[i+1][0]) {
            check = false;
        }
        if (!check) break;
    }
    if (check) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100007],b[100007];
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n+1;++i)
        cin>>a[i];
    for(int i=1;i<=n;++i)
        cin>>b[i];
    long long sum=0;
    sum+=min(b[1],a[1]);
    b[1]-=min(b[1],a[1]);
    for(int i=2;i<=n+1;++i){
        if(b[i-1]){
            sum+=min(b[i-1],a[i]);
            a[i]-=min(b[i-1],a[i]);
        }
        if(a[i]){
            sum+=min(b[i],a[i]);
            b[i]-=min(b[i],a[i]);
        }
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
long long X, Y;
int main(){ 
	cin>> X >> Y;
	long long count = 0;
	for (; X <= Y; X = X * 2){
		count++;
	}
	printf("%d\n", count);
	return 0;
} 

Measured memory_bytes: 256
from collections import OrderedDict, deque


def main():
    n = int(input())
    edges = [tuple(map(int, input().split())) for _ in range(n - 1)]
    tree = [[] for _ in range(n)]  # こうしないとすべて同じリストObjになる.
    coloring = OrderedDict()
    for e in edges:
        a, b = e[0] - 1, e[1] - 1
        tree[a].append(b)
        tree[b].append(a)
        coloring[(a, b)] = 0

    q = deque()
    q_append = q.append
    q_popleft = q.popleft
    seen = [False] * n
    q_append(0)
    col_count_by_v = [set() for _ in range(n)]
    while len(q):
        new_v = q_popleft()
        seen[new_v] = True
        color_i = 1  # One-based index.
        for adj in tree[new_v]:
            if seen[adj]:
                continue
            q_append(adj)
            while color_i in col_count_by_v[new_v]:
                color_i += 1
            coloring[(new_v, adj)] = color_i
            col_count_by_v[new_v].add(color_i)
            col_count_by_v[adj].add(color_i)
            color_i += 1

    print(len(set(coloring.values())))
    for c in coloring.values():
        print(c)


if __name__ == '__main__':
    main()


Measured memory_bytes: 140248
NT = input()
NT = NT.split()
N = int(NT[0])
T = int(NT[1])

ct = []
for i in range(N):
    ct_input = input()
    ct.append(ct_input)
    

flag = True
cost = 1000
for i in range(N):
    cti = ct[i]
    cti = cti.split()
    ci = int(cti[0])
    ti = int(cti[1])
    if T < ti:
        continue
    if cost >= ci:
        cost = ci
        flag = False



if flag == True:
    print("TLE")
else:
    print(cost)


Measured memory_bytes: 3064
def resolve():
    H, W = list(map(int, input().split()))
    C = [list(input()) for i in range(H)]
    passed = [[False for _ in range(W)] for _ in range(H)]
    import collections
    q = collections.deque([[0,0,1]])
    minhop = float("inf")    
    while q:
        y, x, cnt = q.popleft()
        if y == H-1 and x == W-1:
            minhop = min(minhop, cnt)
            continue
        if passed[y][x]:
            continue
        passed[y][x] = True
        for i, j in [[-1, 0], [1, 0], [0, 1], [0, -1]]:
            _y, _x = y+i, x+j
            if 0 <= _y < H and 0 <= _x < W and C[_y][_x] == ".":
                q.append([_y, _x, cnt+1])
    
    nblack = 0
    for i in range(H):
        for j in range(W):
            if C[i][j] == "#":
                nblack += 1
    print(H*W-minhop-nblack if minhop != float("inf") else -1)

if '__main__' == __name__:
    resolve()

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


void solve(long long A, long long B, long long K){
    auto tmp=A;
    while(tmp-A < K && tmp <= B){
        cout << tmp << endl;
        tmp++;
    }
    tmp = max(tmp, B-K+1);
    while(B-tmp>=0){
        cout << tmp << endl;
        tmp++;
    }
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long K;
    scanf("%lld",&K);
    solve(A, B, K);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    if (A<6){
      System.out.println(0);
    }else if(A>=6 && A<=12){
      System.out.println(B/2);
    }else{
      System.out.println(B);
    }      
    sc.close();
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N,K;
    int ans = 0;
    cin >> N >> K;
    rep(i,N){
        int h;
        cin >> h;
        if(h>=K){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    ll t, a, A = 1, T = 1;
    REP(i, N) {
        cin >> t >> a;
        ll n = max((T + t - 1) / t, (A + a - 1) / a);
        T = n * t;
        A = n * a;
    }
    cout << T + A << endl;
}

Measured memory_bytes: 384
N, A, B , *h = map(int, open(0).read().split())
C = A-B
l = -1
r = 10**20
while l+1<r:
  s = (l+r)//2
  M = [c-s*B for c in h]
  cnt = sum((c+C-1)//C if c>0 else 0 for c in M)
  if cnt>s:
    l = s
  else:
    r = s
print(r)

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

int main() {
  string s;
  cin >> s;
  
  bool ac = false;
  for(int i=0; i<s.size()-1; i++) if(s.substr(i,2)=="AC") ac = true;
  if(ac) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3596
//Snack
#include <stdio.h>
#include <limits.h>

long long gcd(long long x, long long y);

int main(void){
	long long A, B;
	scanf("%llu %llu", &A, &B);

	printf("%llu\n", A*B/gcd(A, B));

	return 0;
}

long long gcd(long long x, long long y) {
	long r;
	while((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
}


Measured memory_bytes: 1716
#include<stdio.h>

int main(){
  int n,b,f,r,v;
  int x[4][3][10]={{0}};
  int i,j,k;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d %d",&b,&f,&r,&v);
    x[b-1][f-1][r-1]+=v;
    }
  for(i=0;i<4;i++){
    for(j=0;j<3;j++){
      for(k=0;k<10;k++){
        printf(" %d",x[i][j][k]);
      }
      printf("\n");
    }
    if(i<3){
      printf("####################\n");
    }
  }
  return 0;
}

Measured memory_bytes: 2656
#include<iostream>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
int s[4],c[10],ans[4]={0,0,0,0},v[4]={0};
int n,m;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>s[i]>>c[i];
		if(v[s[i]]==0)
			ans[s[i]]=c[i],v[s[i]]=1;
		if(v[s[i]]==1&&ans[s[i]]!=c[i])
		{
			cout<<"-1"<<endl;
			return 0;
		}	
	}
	if((n==2||n==3)&&v[1]==1&&ans[1]==0)
	{
		cout<<"-1"<<endl;
		return 0;
	}
	else if(n==1)	
	{
		cout<<ans[1]<<endl;
		return 0;
	}
	else
	{
		int flag=0;
		for(int i=1;i<=n;i++)
		{
			if(ans[i]!=0)	flag=1;
			if(ans[i]==0&&flag==0)	ans[i]++,flag=1;
		}
	}
	for(int i=1;i<=n;i++)
		{
			cout<<ans[i];
		}
}


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

int main()
{
	ll X;
	cin >> X;

	for(ll A = -1000; A < 1000; A++)
	{
		ll A_2 = A * A;
		ll A_3 = A_2 * A;
		ll A_4 = A_3 * A;
		for(ll B = -1000; B < 1000; B++)
		{
			ll B_2 = B * B;
			ll B_3 = B_2 * B;
			ll B_4 = B_3 * B;

			ll func1 = A - B;
			ll func2 = A_4 + (A_3*B) + (A_2 * B_2) + (A * B_3) + B_4;
			if(X == (func1 * func2))
			{
				cout << A << " " << B << endl;
				return 0;
			}

		}

	}
	return 0;
}

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

using namespace std;

char s[200005];

int main() {
  long long cnt = 0;
  cin >> s;
  int n = strlen(s);
  for (int l = 0; l < n; ++l) {
    if (!(s[l] == 'A' || (s[l] == 'B' && s[l + 1] == 'C'))) {
      continue;
    }
    int r = l - 1;
    vector <int> v;
    while (s[r + 1] == 'A' || (s[r + 1] == 'B' && s[r + 2] == 'C')) {
      ++r;
      if (s[r] == 'A') {
        v.push_back(1);
      } else {
        v.push_back(0);
        ++r;  
      }
    }
    if (v.size() != 0) {
      int c = v[0] == 1;
      for (int i = 1; i < v.size(); ++i) {
        if (v[i] == 1) {
          ++c;
        } else {
          cnt += c;
        }
      }
    }
    l = r;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 1656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9 * 2;

int main() {
	string s;
	cin >> s;
	cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define reg register
typedef long long ll;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
static char buf[100000],*p1=buf,*p2=buf;
inline int read(void){
	reg char ch=getchar();
	reg int res=0;
	while(ch<'0'||'9'<ch)ch=getchar();
	while('0'<=ch&&ch<='9')res=10*res+ch-'0',ch=getchar();
	return res;
}

int x;

inline int gcd(reg int a,reg int b){
	return b==0?a:gcd(b,a%b);
}

int main(void){
	x=read();
	printf("%d\n",360/gcd(360,x));
	return 0;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <iostream>

using namespace std;
 
int main() {
int N, Y, a=-1, b=-1, c=-1;
cin >> N >> Y;
for(int i=0; i<=N; ++i){
  for(int j=0; j<=N-i; ++j){
    if(10000*i + 5000*j + 1000*(N-i-j) == Y){
      a=i; b=j; c=N-i-j;
      break ;
    }
  }
}
printf("%d %d %d",a,b,c);
}


Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    Int n, m;
    cin >> n >> m;
    vector<Int> a(m);
    for (Int i = 0; i < m; i++) {
        cin >> a[i];
    }

    Int ans = n - accumulate(a.begin(), a.end(), 0);

    if (0 <= ans) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
const int N = 188;
int dpr[N][N][N];
int dpd[N][N][N];
int new_dpr[N][N][N];
int new_dpd[N][N][N];
int main() {
	cin.tie(0); cin.sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	vector<string> grd(h);
	for (int i = 0; i < h; i++) cin >> grd[i];
	vector<vector<int>> cum(h + 1, vector<int>(w + 1, 0));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cum[i + 1][j + 1]
				= cum[i + 1][j] + cum[i][j + 1] - cum[i][j]
				+ (int)(grd[i][j] == '.');
		}
	}
	auto get_sum = [&] (int i1, int j1, int i2, int j2) {
		return cum[i2][j2]
			- cum[i2][j1] - cum[i1][j2] + cum[i1][j1];
	};
	auto is_mono = [&] (int i1, int j1, int i2, int j2) {
		int sum = get_sum(i1, j1, i2, j2);
		int area = (i2 - i1) * (j2 - j1);
		return (sum == 0 || sum == area);
	};
	for (int i1 = 0; i1 < h; i1++) {
		for (int j1 = 0; j1 < w; j1++) {
			for (int i2 = i1 + 1; i2 <= h; i2++) {
				int ok = j1, ng = w + 1;
				while (ng -  ok > 1) {
					int mid = (ok + ng) >> 1;
					if (is_mono(i1, j1, i2, mid)) ok = mid;
					else ng = mid;
				}
				dpr[i1][j1][i2] = ok;
			}
			for (int j2 = j1 + 1; j2 <= w; j2++) {
				int ok = i1, ng = h + 1;
				while (ng - ok > 1) {
					int mid = (ok + ng) >> 1;
					if (is_mono(i1, j1, mid, j2)) ok = mid;
					else ng = mid;
				}
				dpd[i1][j1][j2] = ok;
			}
		}
	}
	for (int it = 0; ; it++) {
		if (dpr[0][0][h] == w) {
			cout << it << endl;
			return 0;
		}
		for (int i1 = 0; i1 < h; i1++) {
			for (int j1 = 0; j1 < w; j1++) {
				for (int i2 = i1 + 1; i2 <= h; i2++) {
					int j2 = dpr[i1][j1][i2];
					if (j2 < w) j2 = dpr[i1][j2][i2];
					new_dpr[i1][j1][i2] = j2;
				}
				for (int j2 = j1 + 1; j2 <= w; j2++) {
					int i2 = dpd[i1][j1][j2];
					if (i2 < h) i2 = dpd[i2][j1][j2];
					new_dpd[i1][j1][j2] = i2;
				}
			}
		}
		for (int i1 = 0; i1 < h; i1++) {
			for (int j1 = 0; j1 < w; j1++) {
				for (int i2 = i1 + 1; i2 <= h; i2++) {
					int j2 = new_dpr[i1][j1][i2];
					while (j2 < w && new_dpd[i1][j1][j2 + 1] >= i2) ++j2;
					dpr[i1][j1][i2] = j2;
				}
				for (int j2 = j1 + 1; j2 <= w; j2++) {
					int i2 = new_dpd[i1][j1][j2];
					while (i2 < h && new_dpr[i1][j1][i2 + 1] >= j2) ++i2;
					dpd[i1][j1][j2] = i2;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 103808
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
const char endk = '\n';
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll mod = 1e9 + 7;
	//const ll mod = 998244353;

	ll n;
	cin >> n;
	vector<ll> a(n);
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		if (i % 2 == 0 && a[i] % 2 == 1) ans++;
	}
	cout << ans << endl;
}

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

int main(){
    char c;
    cin >> c;
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel" << endl;
    else cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
#define ll long long
using namespace std;
int main(){
    ll k,n,sum=0;
    cin>>k>>n;
    vector<ll> a(n);
    rep(i,0,n){
        cin>>a[i];
        sum+=a[i];
    }
    
    ll ans=k;
    rep(i,1,n)ans=min(ans,k-abs(a[i]-a[i-1]));
    ans=min(ans,k-(a[0]+k-a[n-1]));
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define N 200050
using namespace std;
int n,m,a[N],t[N],F[N],ans;
inline int rd() {
	int x=0,f=1;char ch=getchar();
	while (ch>'9'||ch<'0') {if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}
int main() {
	n = rd(), m = rd();
	for (int _=1;_<=n;++_) a[_] = rd();
	for (int _=1;_<=n;_++) t[a[_]]++;
	for (int _=1;_<=n;_++)
		for (int j=0;j<t[_];++j) if (_-j>0) F[_-j]++;
	for (int _=1;_<=n;_++) if (!F[_]) ans++;
	
	while (m--) {
		int x = rd(), y = rd();
		
		if (a[x]-t[a[x]]+1 >=1 && --F[ a[x]-t[a[x]]+1 ] == 0) ans++;
 		t[ a[x] ]--;
		
		a[x] = y;
		t[ a[x] ]++;
		if (a[x]-t[a[x]]+1 >=1 && ++F[ a[x]-t[a[x]]+1 ] == 1) ans--;
		printf("%d\n",ans);
	}
	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
using namespace std;
int main(void){
    int x,y,W,H,r,X,Y,Z,D;
  cin >> W;
  cin >> H;
  cin >> x;
  cin >> y;
  cin >> r;
  X=x+r;
  Y=y+r;
  Z=x-r;
  D=y-r;
  if(X<=W && Z>=0 && Y<=H && D>=0){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld; //
typedef double db; //
typedef string str; //
//
typedef pair<int, int> pi;
typedef pair<ll,ll> pl; //
typedef pair<ld,ld> pd; //
#define mp make_pair
#define f first
#define s second

typedef vector<int> vi; 
typedef vector<ll> vl; //
typedef vector<ld> vd; //
typedef vector<str> vs; //
typedef vector<pi> vpi; //
typedef vector<pl> vpl; //
typedef vector<pd> vpd; //
//
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend() //
#define rsz resize
#define ins insert //
#define ft front() //
#define bk back() //
#define pf push_front //
#define pb push_back
#define eb emplace_back //
#define lb lower_bound //
#define ub upper_bound //

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5; //
const ll INF = 1e18; //
const ld PI = 4*atan((ld)1); 
const int xd[4] = {0,1,0,-1}, yd[4] = {1,0,-1,0}; //

template<class T> bool ckmin(T& a, const T& b) { 
	return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { 
	return a < b ? a = b, 1 : 0; }
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int evify(int i) {
    if (i == 0) return 2;
    else return i % 2;
}

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

    int L;
    cin >> L;

    ll offset = 0;

    vl A(L);
    for (int i=0;i<L;i++) cin >> A[i];
    
    vl dpZ1(L+1, INF);
    vl dpE1(L+1, INF);
    vl dpO(L+1, INF);
    vl dpE2(L+1, INF);
    vl dpZ2(L+1, INF);

    dpZ1[0] = 0;

    for (int i=1;i<=L;i++) {
        dpZ1[i] = min(dpZ1[i], dpZ1[i-1] + A[i-1]);
        
        ll pre = min(dpZ1[i-1], dpE1[i-1]);
        dpE1[i] = min(dpE1[i], pre + evify(A[i-1]));

        pre = min(pre, dpO[i-1]);
        dpO[i] = min(dpO[i], pre + ((1 + A[i-1])%2));

        pre = min(pre, dpE2[i-1]);
        dpE2[i] = min(dpE2[i], pre + evify(A[i-1]));

        pre = min(pre, dpZ2[i-1]);
        dpZ2[i] = min(dpZ2[i], pre + A[i-1]);
    }

    // for (int i=0;i<=L;i++) {
    //     cout << i << ": " << dpZ1[i] << " " << dpE1[i] << " " << dpO[i] << " " << dpE2[i] << " " << dpZ2[i] << endl;
    // }

    ll ans = INF;
    ans = min(ans, dpZ1[L]);
    ans = min(ans, dpE1[L]);
    ans = min(ans, dpO[L]);
    ans = min(ans, dpE2[L]);
    ans = min(ans, dpZ2[L]);


    cout << ans << endl;

}

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

int main() {
    long mod = 1e9+7;
    int N, K;
    cin>>N>>K;
    vector<long> A;
    long tmpA;
    for(int i=0;i<N;++i){
        cin>>tmpA;
        A.push_back(tmpA);
    }
    sort(A.begin(), A.end());
    long ue[N], shita[N];
    ue[0] = 1;
    shita[0] = 1;
    for(long i=1;i<N;++i){
        ue[i] = i*ue[i-1];
        ue[i] %= mod;
        shita[i] = 1;
    }
    long tmpmod;
    long tmpshita;
    for(long i=0;i<N;++i){
        tmpmod = mod - 2;
        while(tmpmod>0){
            long tmp = 1;
            tmpshita = ue[i];
            while(true){
                tmp *= 2;
                if(tmp>tmpmod) break;
                tmpshita *= tmpshita%mod;
                tmpshita %= mod;
            }
            tmp /= 2;
            tmpmod -= tmp;
            shita[i] *= tmpshita;
            shita[i] %= mod;
        }
    }
    long comb[N-K+1];
    for(int i=K-2;i<=N-2;++i){
        comb[i-K+2] = ue[i]*shita[K-2]%mod*shita[i-K+2]%mod;
    }
    long sumcomb[N-K+1];
    for(int i=0;i<N-K+1;++i){
        sumcomb[i] = 0;
    }
    sumcomb[0] = comb[0]%mod;
    for(int i=1;i<N-K+1;++i){
        sumcomb[i] = (sumcomb[i-1] + comb[i])%mod;
    }
    long ans = 0;
    for(int i=0;i<N-K+1;++i){
        ans += A[K+i-1]*sumcomb[i]%mod;
        ans -= A[N-K+1-i-1]*sumcomb[i]%mod;
        ans %= mod;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3444
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	fmt.Println(check(a, b, c))
}

func check(a, b, c int) string {
	if a+b+c != 17 {
		return "NO"
	} else {
		if is7or5(a) && is7or5(b) && is7or5(c) {
			return "YES"
		} else {
			return "NO"
		}
	}
}

func is7or5(i int) bool {
	return (i == 7) || (i == 5)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define PII pair<int,int>
#define ll long long
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
int read()
{
    char ch=getchar();
    int x=0;
    while(ch>'9' || ch<'0') ch=getchar();
    while(ch<='9' && ch>='0') x=x*10+ch-'0',ch=getchar();
    return x;
}
int main()
{
    int p=read(),q=read(),r=read();
    int ans=min(q+p,p+r);
    ans=min(ans,q+r);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
int a,b,in;
 cin >> in;
int count = -1;
 int count2=64;
  a = 0;
for(int i=0;i<in;i++){
  cin >> b;
  count = -1;
  a = 0;
 while(a==0){
  count++;
  a = b % 2;
  b /= 2;
 }
  if(count<count2){
  count2 = count;
  }
}

  cout << count2  << endl;
}  

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    int ans = 0;
    for(char i : s){
        ans += (i - '0');
    }
    if(ans%9 == 0){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    return 0;
}


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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

const int MOD = 1e9 + 7;
int dp[101][100001];
int ps[101][100001];
int a[101];

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n, k;
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);

	for (int i = 0; i <= n; i++) dp[i][0] = 1;
	for (int i = 1; i <= n; i++) {
		ps[i-1][0] = dp[i-1][0];
		for (int j = 1; j <= k; j++)
			ps[i-1][j] = (ps[i-1][j-1] + dp[i-1][j]) % MOD;

		for (int j = 1; j <= k; j++) {
			if (j > a[i])
				dp[i][j] = (ps[i-1][j] - ps[i-1][j-a[i]-1] + MOD) % MOD;
			else
				dp[i][j] = ps[i-1][j];
		}
	}
	/*
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= k; j++) printf("%d ", dp[i][j]);
		puts("");
	}
	puts("--------");
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= k; j++) printf("%d ", ps[i][j]);
		puts("");
	}
	*/
	printf("%d\n", dp[n][k]);
}


Measured memory_bytes: 79104
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    int L, R;
    cin >> L >> R;
    vector<int> remainders(min(R - L + 1, 2019));
    for (int i = L; i <= min(R, L + 2018); ++i)
    {
        int rem = i % 2019;
        if (rem == 0)
        {
            cout << 0 << endl;
            return 0;
        }
        remainders[i - L] = rem;
    }
    // 2019=3*673
    if (find(remainders.begin(), remainders.end(), 3) != remainders.end()
        && find(remainders.begin(), remainders.end(), 673) != remainders.end())
    {
        cout << 0 << endl;
        return 0;
    }
    int min = 2019;
    for (int i = 0, n = static_cast<int>(remainders.size()); i < n; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            int rem = (remainders[i] * remainders[j]) % 2019;
            if (rem < min)
            {
                min = rem;
            }
        }
    }
    cout << min << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main (){
 int N,M;
  cin >> N >> M;
  int c = N;
  vector <int> vec(10010,0);
  for (int i = 0;i < M;i++){
  cin >> vec.at(i);
    c -= vec.at(i);
  }
  if (c >= 0){
    cout << c << endl;
  }
  else{
  cout << -1 << endl;
  }
}

Measured memory_bytes: 3672
#include "bits/stdc++.h"
using namespace std;

string a[55], b[55];

int main() {
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; ++i) cin >> a[i];
    for(int i = 0; i < m; ++i) cin >> b[i];


    for(int i = 0; i + m - 1 < n; ++i) 
        for(int j = 0; j + m - 1 < n; ++j) {
            bool ok = true;
            for(int k = 0; k < m; ++k) {
                string s = a[i + k].substr(j, m);
                if(s != b[k]) ok = false;
            }
            if(ok) return !printf("Yes");
        }

    puts("No");
}

Measured memory_bytes: 256
public class Main {
	public static void main(String[] args) {
		java.util.Scanner in = new java.util.Scanner(System.in);
		int w = in.nextInt();
		int h = in.nextInt();
		int n = in.nextInt();
		int[] xspot = new int[n];
		int[] yspot = new int[n];
		for (int i=0; i<n; i++) {
			xspot[i] = in.nextInt();
			yspot[i] = in.nextInt();
		}
		int sum = 0;
		for (int i=0; i<n-1; i++) {
			int tmp = 0;
			int x = Math.abs(xspot[i] - xspot[i+1]); //横
			int y = Math.abs(yspot[i] - yspot[i+1]); //縦
			if ((xspot[i] <= xspot[i+1] == true && yspot[i] <= yspot[i+1] == true) || (xspot[i] <= xspot[i+1] == false && yspot[i] <= yspot[i+1] == false)){
				if (x > y)
					tmp -= y;
				else
					tmp -= x;
			}
			 sum = sum + tmp + x + y;
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 25528
#include <iostream>
#include <vector>
#include <algorithm>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

signed main() {
    int N, K;
    cin >> N >> K;
    if (K % 2 == 1) {
        int ans = (N / K) * (N / K) * (N / K);
        cout << ans << endl;
        return 0;
    }
    int x = N / K;
    if (N % K >= K / 2) ++x;
    int ans = x * x * x + (N / K) * (N / K) * (N / K);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);
 
int main() {
int a,b,c;
cin >> a >> b >> c;
if(a==b&&b==c)cout <<"Yes"<< endl;
else cout <<"No"<<endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
int main(){
    double vm;
    while(cin>>vm){
        double t,y;
        t = vm/9.8;
        y = 4.9*t*t;
        int i=1;
        while(y>5*i-5) i++;
        cout<<i<<endl;
    }
}

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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

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

  set<char> st;
  string s;
  cin >> s;
  REP(i,sz(s)) {
    st.insert(s[i]);
  }

  if (sz(st) == sz(s)) cout << "yes" << endl;
  else cout << "no" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long a = sc.nextLong();
    long b = sc.nextLong();
    long[] x = new long[n];
    for(int i = 0;i < n;i++)x[i]=sc.nextLong();
    long ans = 0;
    for(int i = 1;i < n;i++){
      long dx = x[i]-x[i-1];
      if(dx*a<b)ans+=dx*a;
      else ans+=b;
    }
    System.out.println(ans);
  }
}

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

#define ll long long

 
int main(void){
    ll N,M,X,Y;
    cin >> N>>M>>X>>Y;
    ll ans,tmp;
    cin >> ans;
    bool flag = true;
    for(int i=1;i<N;i++){
        cin >> tmp;
        if(ans < tmp){
            ans = tmp;
        }
    }
    ans++;

    for(int i=0;i<M;i++){
        cin >> tmp;
        if(tmp < ans){
            flag = false;
        }
    }

    if(ans <= X or Y < ans){
        flag = false;
    }


    if(flag == true){
        cout << "No War"<<endl;
    }else{
        cout << "War"<< endl;
    }
    return 0;
}

Measured memory_bytes: 256
a,b,k = map(int,input().split())

if (b-a+1) < k:
    for i in range(a,b+1):
        print(i)
else:  
    lst1 = [i for i in range(a,a+k)]
    lst2 = [i for i in range(b-k+1,b+1)]

    lst = sorted(list(set(lst1 + lst2)))

    for i in lst:
        print(i)

Measured memory_bytes: 9148
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




int main() {
    ll a, b;
    cin >> a >> b;
    cout << ((a + b == 15)? "+" : (a * b == 15)? "*" : "x") << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <queue>
#include <random>
#include <map>
#include <set>
#include <boost/multiprecision/cpp_int.hpp>
 
#pragma warning(disable:4996)
 
using namespace std;
 
int main() {
  string s, ss;
  cin >> s;
  sort(s.begin(), s.end());
  unique_copy(s.begin(), s.end(), back_inserter(ss));
    cout << (s.size() == ss.size() ? "yes" : "no") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define mreps(i,j,n) for(int i = j; i <= n; i++)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout << endl
#define sp(x) cout << setprecision(x);
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vpii vector<pair<int,int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; }
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	vl ans;
	while (true)
	{
		int n; cin >> n;
		if (n == 0)break;
		vl dp(n + 1,0);
		dp[0] = 1;
		rep(i, n)reps(j, 3)
		{
			if (i + j <= n)dp[i + j] += dp[i];
		}
		ll tmp = (dp[n]+3649)/3650;
		ans.push_back(tmp);
	}
	rep(i, sz(ans))co(ans[i]);
	return 0;
}



Measured memory_bytes: 3032
fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    var yen = 0L
    var btc = 0L
    for(i in (1..n)) {
        val inpt = readLine()!!.split(" ")
        if(inpt[1] == "JPY") {
            yen+= inpt[0].toLong()
        } else {
            btc += (inpt[0].toDouble()*100000000).toLong()
        }
    }
    val ans = yen + (btc/100000000.0)*380000.0
    println("%.4f".format(ans))
}

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

int main()
{
    string O, E;
    cin >> O >> E;

    string T(O.size() + E.size(), 'a');
    for(int i = 0; i < O.size(); ++i) T[2*i] = O[i];
    for(int i = 0; i < E.size(); ++i) T[2*i+1] = E[i];
    cout << T << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		int[] results = {a+b, a-b, a*b};

		int max = a+b;
		for(int result : results) {
			max = result > max ? result : max;
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 21588
n = int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]

for i in range(n):
  buf = x[i]
  x[i] = x[i]+y[i]
  y[i] = buf-y[i]

dx = max(x) - min(x)
dy = max(y) - min(y)
  
print(max(dx,dy))

Measured memory_bytes: 149452
#include <iostream>
#include <algorithm>
using namespace std;
typedef unsigned long long int ul;

int main()
{
	ul Q, H,S,D,N,mn;
	cin >> Q>>H>>S>>D>>N;
	H = min(2 * Q, H);
	S = min(2 * H, S);
	D = min(2 * S, D);
	mn = min((N / 2)*D + (N % 2)*S, N*S);
	cout << mn << endl;
	return 0;
}

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

using namespace std;

# define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;

# define S second
# define F first
# define kill(x) return(cout << x << endl, 0)
# define debug(x) cerr<< #x << " : " << x << endl
# define ddebug(x, y) cerr<< #x << " : " << x  << ", " << #y << " : " << y << endl
# define sz(s) (int)s.size()
# define sq(x) (x) * (x)
# define PB(x) push_back(x)
# define smax(x, y) (x) = max((x), (y))
# define smin(x, y) (x) = min((x), (y))
# define all(x) x.begin(), x.end()
# define SP fixed << setprecision(10)

const int MAXN = 2000 + 10;
int cnt[MAXN][MAXN], a1[MAXN][MAXN], a2[MAXN][MAXN];
string s[MAXN];

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

	int n, m, q;
	cin >> n >> m >> q;
	for (int i = 0; i < n; i ++)
		cin >> s[i];

	for (int i = 0; i < n; i ++)
		for (int j = 0; j < m; j ++)
			cnt[i + 1][j + 1] = cnt[i + 1][j] + cnt[i][j + 1] - cnt[i][j] + (s[i][j] - '0');


	for (int i = 0; i < n; i ++)
		for (int j = 1; j < m; j ++)
			a1[i + 1][j + 1] = a1[i + 1][j] + a1[i][j + 1] - a1[i][j] + (s[i][j] == '1' && s[i][j - 1] == '1');
	
	for (int i = 1; i < n; i ++)
		for (int j = 0; j < m; j ++)
			a2[i + 1][j + 1] = a2[i + 1][j] + a2[i][j + 1] - a2[i][j] + (s[i][j] == '1' && s[i - 1][j] == '1');

	while (q --)
	{
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		cout << (cnt[x2][y2] - (cnt[x2][y1 - 1] + cnt[x1 - 1][y2] - cnt[x1 - 1][y1 - 1])) - 
			((a1[x2][y2] - (a1[x2][y1] + a1[x1 - 1][y2] - a1[x1 - 1][y1])) +
			 (a2[x2][y2] - (a2[x1][y2] + a2[x2][y1 - 1] - a2[x1][y1 - 1]))) << endl;
	}

	return 0;
}






Measured memory_bytes: 100608
#include<bits/stdc++.h>
using namespace std;
int n;
void dfs(int i, string s, char c){
    if(i == n) {
        cout << s << endl;
    }
    else{
        for (char j = 'a'; j <= c + 1; j++)
        {
            string t = s + j;
            if(j == c+1) dfs(i+1,t,c+1);
            else dfs(i+1,t,c);
        }
        
    }
}


int main(){
    cin >> n;
    dfs(1,"a",'a');
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<queue>
#include<algorithm>
using namespace std;
int ijk[1010000];
int v[1010000];
int main(){
	int a,b,c;
	while(scanf("%d%d%d",&a,&b,&c),a){
		if(b<c)swap(c,b);
		for(int i=0;i<b;i++)ijk[i]=999999999;
		for(int i=0;i<b;i++)v[i]=0;
		
		priority_queue<pair<int,int> >Q;
		ijk[0]=0;
		Q.push(make_pair(0,0));
		while(Q.size()){
			int cost=-Q.top().first;
			int at=Q.top().second;
			Q.pop();
			if(v[at])continue;
			v[at]=1;
			if(!v[(at+c)%b]&&ijk[(at+c)%b]>cost+c){
				ijk[(at+c)%b]=cost+c;
				Q.push(make_pair(-cost-c,(at+c)%b));
			}
		}
		int ret=0;
		for(int i=0;i<b;i++){
		//	printf("%d ",ijk[i]);
			ret+=min((a+b-i)/b,(ijk[i])/b);
		}
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 3116
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();

		int all = H * W;
		all -= (h * W);
		all -= w * (H - h);

		System.out.println(all);
	}
}

Measured memory_bytes: 23636
n = int(input())
s = input()

total = s.count("R") * s.count("G") * s.count("B")

#l = ["RGB", "RBG", "GRB", "GBR", "BRG", "BGR"]

lR = [0]*n
lG = [0]*n
lB = [0]*n

for i in range(len(s)):
    if s[i] == "R":
        lR[i] += 1
    elif s[i] == "G":
        lG[i] += 1
    else:
        lB[i] += 1

#print(lR)
#print(lG)
#print(lB)

for i in range(n):
    j = 1
    if lR[i]:
        while i-j >= 0 and i+j < n:
            if lG[i+j]!=0 and lG[i+j] == lB[i-j]:
                total -= 1
            elif lG[i-j]!=0 and lG[i-j] == lB[i+j]:
                total -= 1
            j += 1

    elif lG[i]:
        while i-j >= 0 and i+j < n:
            if lR[i+j]!=0 and lR[i+j] == lB[i-j]:
                total -= 1
            elif lR[i-j]!=0 and lR[i-j] == lB[i+j]:
                total -= 1
            j += 1

    elif lB[i]:
        while i-j >= 0 and i+j < n:
            if lG[i+j]!=0 and lG[i+j] == lR[i-j]:
                total -= 1
            elif lG[i-j]!=0 and lG[i-j] == lR[i+j]:
                total -= 1
            j += 1

print(total)


Measured memory_bytes: 9284
#include<iostream>


using namespace std;


int main(void){
	
	
		int x,y;
		cin>>x>>y;
		
		if( (x==1 || x==3 || x==5 || x==7 || x==8 || x==10 || x==12 )&&	(y==1 || y==3 || y==5 || y==7|| y==8 || y==10 || y==12))
									puts("Yes");
			else	if( (x==4 || x==6 || x==9 || x==11  )&&	(y==4 || y==6 || y==9 || y==11))
									puts("Yes");
			else	if(x==2 && y==2)
									puts("Yes");
									
			else
									puts("No");
				
	
	
	return 0;
}


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

int main() {
int b[1000000];
for (int k=0;k<1000001;k++){
	b[k]=0;
}
b[2]=1;
b[3]=1;
b[4]=0;
b[5]=1;
b[6]=0;
b[7]=1;

for (int p=11;p<1000001;p+=2){
int i,a=0 ;
	i=3;
	while(i<=sqrt(p)){
		if(p%i==0){
			break;
	}i=i+2;
	}
	if (i>sqrt(p)){
		a=1;
	}
	b[p]=a;
}
int c[1000000];
for (int l=0;l<1000001;l++){
	c[l+1]=c[l]+b[l+1];
}
int r;
while(cin>>r){
	cout<<c[r]<<endl;
}
	return 0;
}

Measured memory_bytes: 8968