akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{
    int N,M;
    cin >> N >> M;
    ve<vi> a(N,vi(M));
    rep(i,N) rep(j,M){ cin >> a[i][j]; a[i][j]--;}
    
    ve<bool> f(M,true);
    vi ii(N,0);
    int ans = infi;
    
    rep(i,M){
        vi aa(M,0);
        rep(j,N){
            while (!f[a[j][ii[j]]]) {
                ii[j]++;
            }
            aa[a[j][ii[j]]]++;
        }
        
        int jj = 0;
        int kk = 0;
        rep(k,M) if(kk<aa[k]) jj = k, kk = aa[k];
        ans = min(ans,kk);
        f[jj] = false;
    }

    cout << ans << endl;
    
    
    
    

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(i, n) for (int i = n; 0 <= i; --i)
#define FOR(i, start, end) for (int i = start; i < end; ++i)
#define RFOR(i, start, end) for (int i = start; end <= i; --i)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }


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

    string S; cin >> S;
    string ans = (S=="Sunny") ? "Cloudy":
        (S=="Cloudy") ? "Rainy" :
        "Sunny";
    cout << ans << '\n';
    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 x = Integer.parseInt(sc.next());
		if (x < 1200){
			System.out.println("ABC");
		}else {
			System.out.println("ARC");
		}
	}
}

Measured memory_bytes: 20820
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int N;
string S;
string ans = "";
map<int, string> mp;

int main(void) {
    cin >> N >> S;
    int cnt = 0;
    int st = -1;
    int CNT = 0;
    REP(i, N) {
        if (S[i] == '(') {
            if (cnt < 0) {
                //mp[st] = string(-cnt, '(');
                CNT += -cnt;
                st = -1;
                cnt = 0;
            }
            ++cnt;
        } else {
            --cnt;
            if (st == -1 && cnt <= 0) st = i;
        }
    }
    if (cnt < 0) cout << string(-cnt, '(');
    if (CNT) cout << string(CNT, '(');
    REP(i, N) {
        cout << S[i];
    }
    if (cnt > 0) cout << string(cnt, ')');
    cout << endl;
}


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

int main() {
    int n, l, suma = 0, z;
    cin >> n >> l;
    for(int i = 1; i <= n; i++) {
        z = l + i - 1;
        suma = suma + z;
    }
    int najmniejszaRoz = INT_MAX;
    int jabDoUsun = -1;
    for(int i = 1; i <= n; i++) {
        int sumaBezJablka = suma - (l + i - 1);
        int aktualnaRoz = abs(suma - sumaBezJablka);
        if(aktualnaRoz < najmniejszaRoz) {
            jabDoUsun = i;
            najmniejszaRoz = aktualnaRoz;
        }
    }
    cout << suma - (l + jabDoUsun - 1);
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
//#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
// namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
// using ll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
ll gcd(ll m, ll n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
void swap(ll &a, ll &b) {
    ll tmp = a;
    a = b;
    b = tmp;
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
        // r %= 1000000007;
        // rr %= 1000000007;
    }
    r /= rr;
    // r %= 1000000007;
    return r;
}
int main() {
  ll N,K;
  cin>>N>>K;
  string S;
  cin>>S;
  ll g=1;
  ll sum = 0;
  char c = S[0];
  FOR(i,N-1){
    if(S[i+1]==c){
      sum += 1;
    }else{
      c = S[i+1];
      g+= 1;
    }
  }
  if(g-K*2>=1){
    sum += K*2;
  }else if(g%2==2){
    sum += g-2;
    sum+=1;
  }else{
    sum += g-1;
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 512
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  n,l = map(int,input().split())
  APPLE = []
  for i in range(n):
    APPLE.append(l+(i+1)-1)
  if 0 in APPLE:
    print(sum(APPLE))
    exit()
  if sum(APPLE) > 0:
    print(sum(APPLE[1:]))
  elif sum(APPLE) < 0:
    APPLE = APPLE[::-1]
    print(sum(APPLE[1:]))
if __name__ == '__main__':
  main()

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
L = []
for i in range(N):
    x, y = map(int, input().split())
    L.append([x, y])

K = 1
for i in range(1, N+1):
    K = K * i

def length(x1, y1, x2, y2):
    return ((x1 - x2)**2 + (y1 - y2)**2)**(0.5)

L2 = []
for i in range(N):
    for j in range(N):
        if i != j:
            L2.append(length(L[i][0], L[i][1], L[j][0], L[j][1]))

print(sum(L2)/N)

Measured memory_bytes: 3064
def determin_bingo(row_list):
    for num in row_list:
        if num != 0:
            return False
    return True

g=0
a_list=[]
while g<3:
    a_element=input()
    a_element=a_element.split()
    a_list.append(list(map(int, a_element)))
    g+=1

h=0
b_list=[]
n=int(input())
while h<n:
    b_list.append(int(input()))
    h+=1
    
a_list.extend([
    [a_list[0][0], a_list[1][0], a_list[2][0]],
    [a_list[0][2], a_list[1][2], a_list[2][2]],
    [a_list[0][0], a_list[1][1], a_list[2][2]],
    [a_list[0][2], a_list[1][1], a_list[2][0]]
])

f=0
for a in a_list:
    for b in b_list:
        if b in a:
            a_list[f][a.index(b)]=0
    f+=1


result='No'

for a in a_list:
    if determin_bingo(a):
        result='Yes'
        break

print(result)

Measured memory_bytes: 3064
#include <stdio.h>                                                                                       
                                                                                                         
int main() {                                                                                             
    int n;                                                                                               
    scanf("%d", &n);                                                                                     
    int a[n];                                                                                            
    int b[n];                                                                                            
    for (int i = 0; i < n; i++) {                                                                        
        scanf("%d", &a[i]);                                                                              
    }                                                                                                    
                                                                                                         
    for (int i = 0; i < n; i++) {                                                                        
        b[a[i]-1] = i + 1;                                                                               
    }                                                                                                    
                                                                                                         
    for (int i = 0; i < n; i++) {                                                                        
        printf("%d ", b[i]);                                                                             
    }                                                                                                    
    printf("\n");                                                                                        
                                                                                                         
}            

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

int N, A, B, C;
vector<int> v(1000, 0);

int dfs(int cur,int a,int b,int c) {
    if (cur == N) {
        if (min({a, b, c}) > 0) return abs(a-A) + abs(b-B) + abs(c-C) - 30;
        else return 1000000000;
    }
    int ret0 = dfs(cur+1, a, b, c);
    int ret1 = dfs(cur+1, a+v[cur], b, c) + 10;
    int ret2 = dfs(cur+1, a, b+v[cur], c) + 10;
    int ret3 = dfs(cur+1, a, b, c+v[cur]) + 10;
    return min({ret0, ret1, ret2, ret3});
}

int main(void){
    cin >> N >> A >> B >> C;
    
    for (int i = 0; i < N; i++) cin >> v[i];
    cout << dfs(0, 0, 0, 0) << endl;
}


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

int main(void)
{
 	string x;
  	cin >> x;
  	
  	if(x == "Sunny")
		cout << "Cloudy" << endl;
	else if(x == "Cloudy")
		cout << "Rainy" << endl;
	else
		cout << "Sunny" << endl;
		
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	
	double a,max,mni;


	max=0;
	mni=1000000;

	while(scanf("%lf",&a)!=EOF){
		if(max<a)max=a;
		else if(mni>a)mni=a;

	}

	printf("%.1f\n",max-mni );
	return 0;
}

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

int main() {
  int n,k;
  cin>>n>>k;
  long long a[n];
  for (int i=1;i<=n;i++){
    cin>>a[i];
  }
  for (int i=k+1;i<=n;i++){
    if (a[i-k]<a[i]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 4648
def main(A, B, C, K):
    if K - A <= 0:
        print(K)
    elif K - A > 0 and K - A - B <= 0:
        print(A)
    else:
        print(A - (K - A - B))

if __name__ == '__main__':
    A, B, C, K = list(map(int, input().split()))
    main(A, B, C, K)

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

using namespace std;

const int N = 1e5+10;
typedef long long ll;

ll a[N],n,m,ans;
int main(){
	scanf("%lld%lld",&n,&m);
	for(int i=0;i<n;i++) scanf("%lld",&a[i]);
	ans=a[0];
	for(int i=1;i<n;i++){
		ans=ans*a[i]/__gcd(ans,a[i]);
	}
	for(int i=0;i<n;i++){
		if((ans/a[i])%2==0){
			printf("0");
			return 0;
		}
	}
	printf("%lld",(m*2/ans+1)/2);
	return 0;
}

Measured memory_bytes: 4548
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

  if(abs(n-m)>1){
    cout<<0<<endl;
    return 0;
  }
  if(n>m) swap(n,m);

  ll fact[m+1]={},ans=0;

  fact[0]=1;
  for(int i=1;i<=m;i++){
    fact[i]=fact[i-1]*i%MOD;
  }
  if(n==m){
    ans=fact[n]*fact[m]%MOD*2%MOD;
  }else{
    ans=fact[n]*fact[m]%MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main
{
public  static  void main(String args[])
{
Scanner inp= new Scanner(System.in);
int a=inp.nextInt();
    int b=inp.nextInt();
    int c=inp.nextInt();
    if((a+b+c)<22)
    {
        System.out.println("win");
    }
    else if((a+b+c)>=22)
    {
        System.out.println("bust");
    }
}
}


Measured memory_bytes: 22996
A = int(input())
B = int(input())
C = int(input())
X = int(input())

out_sum = 0
cnt = 0

for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            out_sum = i * 500 + j * 100 + k * 50
            if out_sum == X : cnt += 1
                
                
print(cnt)

Measured memory_bytes: 3064
from itertools import combinations

def main():
    N = int(input())
    k = 0
    for i in range(N+5):
        if i * (i - 1) == 2 * N:
            k = i
            break
    if k == 0:
        print('No')
        exit()
    num = 0
    groups = [[] for _ in range(k)]
    for pattern in combinations(range(k), r=2):
        num += 1
        a, b = pattern
        groups[a].append(num)
        groups[b].append(num)
    print('Yes')
    print(k)
    for g in groups:
        print(len(g), end=" ")
        print(*g, sep=' ')


if __name__ == "__main__":
    main()

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

int main() {
int n,q; cin>>n>>q;
  string s; cin>>s;
  int st[q]={0};
  int fi[q]={0};
  rep(i, q){
    cin>>st[i]>>fi[i];}
  int ac[n]={0};
  rep(i, n){
    if(i){
      if(s[i-1]=='A'&&s[i]=='C'){
        ac[i]+=ac[i-1]+1;}
      else {ac[i]=ac[i-1];}
    }
  }

  
  rep(i, q){
    cout<<ac[fi[i]-1]-ac[st[i]-1]<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include<stdio.h>
#include<stdlib.h>

using namespace std;

int minana(int a,int b){
  if(a<b){
    return a;
  }
  else if(a>b){
    return b;
  }
  else return a;
}


int main(){
  int n;
  cin>>n;
  int r[100];
  int m[101][101];
  int j;
  int q=0;
  //int c[n];
  for(int i=1;i<=n;i++){
    cin>>r[i-1]>>r[i];
  }
  for(int i=1;i<=n;i++){
    m[i][i]=0;
  }
  for(int l=2;l<=n;l++){
    for(int i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=(1<<21);
      for(int k=i;k<j;k++){
	q=m[i][k]+m[k+1][j]+r[i-1]*r[k]*r[j];
	m[i][j]=minana(m[i][j],q);
      }
    }
  }
  
  cout<<m[1][n]<<endl;
  return 0;
}



Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
//for(int i = 0; i < n; i++)
 
int main() {
  int a = 0, b = 0;
  cin >> a >> b;
  if(a == b) cout << a * 2 << endl;
  else cout << max(a, b) * 2 - 1 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;

ll solve(string str, ll num){
    ll start = 0;
    while(start < str.length()){
        if(str[start] != '0')
            break;
        start++;
    }
    str = str.substr(start, str.length()-start);


    if(str.length()==0) return 0;
    if(num == 0) return 0;
    ll N = str.length(), res=0;
    if(num == 1){
        REP(i, N){
            if(i == 0) res += (ll) (str[i] - '1')+1;
            else res += 9;
        }
        return res;
    }
    if(num == 2){
        res = solve(str.substr(1, N-1), num-1);
        res +=  (str[0]-'1') * (N-1) * 9;
        res += (N-1)*(N-2) / 2 * 81;
        return res;
    }
    if(num == 3){
        res = solve(str.substr(1, N-1), num-1);
        res += (str[0]-'1') * (N-1)*(N-2) / 2 * 81;
        res += (N-1)*(N-2)*(N-3)/6 * 9*9*9;
        return res;
    }
    return 0;
}

int main(){
    string S;
    cin >>S;
    long long K;
    cin>>K;
    ll ans = solve(S, K);
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn._
object Main extends App {
  val Array(n, k) = readLine.split(" ").map{_.toLong}
  println(if ((k & 1) == 1) calcOdd else calcEven)

  def calcOdd: Long = {
    val l = n / k
    l * l * l
  }

  def calcEven: Long = {
    val sumK = {
      val l = n / k
      l * l * l
    }

    val sumKHalf = {
      val l = (n + k / 2) / k
      l * l * l
    }
    sumK + sumKHalf
  }
}

Measured memory_bytes: 27416
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <complex>

using namespace std;

//#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")



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

	long long n, k, i, j, ll, rr, MOD = 998244353, s, x, ans;
	cin >> n >> k;
	vector<long long> l(k), r(k);
	for (i = 0; i < k; i++) cin >> l[i] >> r[i];

	vector<long long> dp(n + 1), ss(n + 1);
	ss[0] = 0;
	dp[1] = 1;
	ss[1] = 1;
	for (i = 2; i <= n; i++) {
		s = 0;
		for (j = 0; j < k; j++) {
			ll = i - r[j];
			rr = i - l[j];

			if (rr < 1) continue;
			ll = max(ll, 1LL);
			x = ss[rr] - ss[ll - 1]; 
			s = (s + x) % MOD;
		}
		dp[i] = s;
		ss[i] = (ss[i - 1] + s);
	}

	ans = dp[n];
	cout << ans << "\n";

	return 0;
}




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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int p[110000 + 1];
    rep(i, 110000 + 1) p[i] = 1;
    p[0] = 0, p[1] = 0;
    for (int i = 2; i <= (int)sqrt(110000); i++)
    {
        if (p[i] == 1)
        {
            for (int j = 2; i * j <= 110000; j++)
            {
                p[i * j] = 0;
            }
        }
    }
    int n;
    while (cin >> n, n)
    {

        int sum = 0;
        int cnt = 0;
        for (int i = 2; i <= 110000; i++)
        {
            if (p[i] == 1)
            {
                cnt++;
                sum += i;
                if (cnt == n)
                {
                    break;
                }
            }
        }
        OP(sum);
    }
    return 0;
}


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

int main(){
  string s;
  cin >> s;
  
  vector<char> str;
  rep(i, s.size() ){
    //Bでなければ，その数字をpushする
    if(s[i] != 'B')
      str.push_back(s[i]);
    //Bであれば，末尾を取り除く．
    //ただし，strが空であれば何もしない
    else if(!str.empty())
      str.pop_back();
  }

  //表示
  rep(i, str.size() )
    cout << str[i];
  cout<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    string s;
    cin>>a>>b>>s;
    for(int i=0;i<a;i++){
        for(int j=a+1;j<a+b+1;j++){
          if(s[i]!='-'&&s[a]=='-'&&s[j]!='-'){
           cout<<"Yes"<<endl;
           return 0;
          }
          else{
              cout<<"No"<<endl;
              return 0;
          }
        }
    }
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

const ll MOD = 1e9+7;

ll dp[3010][3010];

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

  int N;
  cin >> N;

  string s;
  cin >> s;

  rep(i, N+1){
    rep(j, N){
      dp[i][j] = 0;
    }
  }

  rep(i, N){
    dp[0][i] = 1;
  }

  rep(i, N-1){

    vector<ll> dp_sum(N+1, 0LL);
    dp_sum[0] = 0LL;
    rep(j, N){
      dp_sum[j+1] = (dp_sum[j] + dp[i][j]) % MOD;
    }

    rep(j, N){
      if(s[i] == '<'){
        if(N-i-1 < j+1) continue;
        dp[i+1][j] = (dp_sum[N-i] + MOD - dp_sum[j+1]) % MOD;
      }else{
        dp[i+1][j] = (dp_sum[j+1] + MOD - dp_sum[0]) % MOD;
      }
    }
  }

  cout << dp[N-1][0] << endl;

  return 0;
}


Measured memory_bytes: 70912
#include <bits/stdc++.h>
#include <math.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
 
int main(){
  long int a,b,k;
  cin >> a >> b;
  k = a+b;
  if(k%2==0){
    printf("%ld\n",k/2);
  }
  else{
    printf("IMPOSSIBLE\n");
  }


  return 0;
}

Measured memory_bytes: 256
(* Vicfred
 * https://atcoder.jp/contests/abc131/tasks/abc131_a
 * implementation
 * *)
let main = 
    let s = Scanf.scanf "%s\n" (fun x -> x) in
    String.iteri(fun i ss -> if (i + 1 < (String.length s) && s.[i] = s.[i + 1]) then (Printf.printf "Bad\n"; exit 0)) s;
    Printf.printf "Good\n"



Measured memory_bytes: 3720
<?php

//$_input = explode(
//    "\n",
//    '2000 20000000
//'
//);

function getNext() {
    return trim(
        isset($GLOBALS['_input'])
            ? array_shift($GLOBALS['_input'])
            : fgets(STDIN)
    );
}


list($numberOfBills, $amount) = explode(' ', getNext());
$numberOfBills = (int) $numberOfBills;
$amount = (int) substr($amount, 0, -3); // 000を消す

// 絶対に千円札を使わないと払えない分を除いておく
$temp = $amount % 5;
$numberOfBills = $numberOfBills - $temp;
$amount = $amount - $temp;

$b10000 = 0;
$b5000 = 0;
$b1000 = $temp;

if ($numberOfBills < 0) {
    printf("%d %d %d\n", -1, -1, -1);
}

for ($i10 = 0; $i10 <= $numberOfBills; ++$i10) {
    for ($i5 = 0; $i5 <= ($numberOfBills - $i10); ++$i5) {
        $i1 = $numberOfBills - $i10 - $i5;
        if ($i1 >= 0 && $i10 * 10 + $i5 * 5 + $i1 === $amount) {
            printf("%d %d %d\n", $i10, $i5, $i1 + $b1000);
            return;
        }
    }
}

printf("%d %d %d\n", -1, -1, -1);



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

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        double ans=6.28318530717958623200;
        double x;
        cin>>x;
        cout<<ans*x<<endl;
    }
    return 0;
}

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

/*
,,,,
　　　　　　　　　　　　　　　　　　　　　　　　　　,.斗*''“i:i:{
　　　　　　　　　　　　　,.　｡. . . * : : : ''' : : : :” :”“ ''ｰ - 弋,,_
　　　　　 　 　 ,.斗*''“ : : : : : : : : : : : : : ' ' ' ' ' ' : : : : : : : : : : :”: '':* ｡ ,
　　　 ,.斗*''“ ” ＼：　　 ”・・． ' ' ' '　　　　　　　　 ' ' ' ' : : : : : : : : : : : : ”ミ*｡,,,,,,　　　　　　 　 　 　 ＿
　　く.　 ◎　 ﾞ:.ﾞ:..　ﾟ:,　:　───────────　　　--　　,,,,,,__ ' ' ' :.:.:.:.:.”≧s｡.　　＿,,,｡s*i:i:i:i:<
　　ﾏ*s｡ :,　 }　ﾟ:,　 :}　　　　　　　　　　　　　　　　　　　　　　　　　　　　”　''　-　”””：：”：：`*｡i:i:i:i:i:i:i;:’
　　　` .｡`　 ,　,ノ ／｡ ,,,_　　　　　　　　　　　　　　　　　　　　　　　　　　　　　＿＿`　　} }　　ﾉi:i:i:i:i:ﾂ
　　　　　 `　*　｡　　`*｡i:i:i::*=-　　　　　　　　　　　＿＿　　　　　　,,,....｡s*'i,:’　　　”`*｡＿,*’i:i:i:i:r’
　　　　　　　　　　　”　─ --　　　　｡｡｡｡｡　　 -　－`''''''''ヽ ─ '''”　　　｀ｰ“　　　　　　　`*｡i:i:i:i:i:i:
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*｡i:i:::
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*ﾟ:,
         fozubaoyou    no BUGs alive!
*/

typedef long long ll;
//{
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define dumo dump
#define sysp system("pause")
//}

#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 0

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cout<<endl;}
template<class...A> inline void debug_rest() {cout<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cout<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cout<<first,debug_rest(rest...);}
inline long long digitsum(long long v){long long d=0;while(v){d+=v%10;v/=10;}return d;}
inline long long digitnumbersum(long long a){long long b=0;while(a){a/=10;b++;}return b;}
inline long long mysqrt(long long a){long long i=0;for(i=1;a>0;i++){a-=i*2+1;}return i-1;}
//}

int a,b;

int main(){
  cin>>a;
  if(a%2==0)dump(a);
  else dump(a*2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 2e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }


int main(void){
    int n;
    cin >> n;
    int m = 1<<n;
    multiset<int> s;
    rep(i,m){
        int x;
        cin >> x;
        s.insert(-x);
    }
    vector<int> pars = {*s.begin()};

    s.erase(s.begin());
    while(s.size()){
        int k = pars.size();
        rep(i,k){
            auto itr = s.upper_bound(pars[k-1-i]);
            if (itr == s.end()) {
                cout << "No" << endl;
                return 0;
            }
            pars.push_back(*itr);
            s.erase(itr);
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 13692
#include <bits/stdc++.h>
using namespace std;
#define MOD1 1000000007
#define MOD2 1000000009
#define ll long long int
#define li long int
#define fi first
#define se second
#define ffl fflush(stdout);
#define whT int t; cin>>t; while(t--)
int main() 
{
	/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#else*/
	ios_base::sync_with_stdio(false); cin.tie(NULL);
//	#endif
	string s;
	cin>>s;
	for(int i=0;i<3;i++) {
		cout<<s[i];
	}
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define F first
#define S second
#define ld long double
#define rep(i,a,n) for (ll i = (a) ; i < (n); ++i)
#define vi vector<ll>
#define all(v) (v).begin(),(v).end()
#define M_PI 3.14159265358979323846
const ll MOD = 1e9 + 7;
const ll INF = 1e18L + 5;
vi cnt(10000007, 2);
void solve() {
	ll n;
	cin >> n;

	for ( int i = 2; i * 2 <= n; i++) {
		for (int j = 2*i; j <= n; j += i) {
			cnt[j]++;
		}
	}
	ll ans = 0;
	cnt[1] = 1;
	for (int i = 1; i <= n; i++) {
		ans += i * cnt[i];
		//cout<<cnt[i]<<" "<<i<<endl;
	}

	cout << ans << endl;
}


int main() {

	int t = 1;

	//cin >> t;
	ll k = 1;
	while (t--) {
		//cout << "Case #" << k++ << ": ";
		solve();
	}
	return 0;
}


Measured memory_bytes: 81220
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INF = 1000000007;
const int mod = 1000000007;

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

//----------------------------------------------------------------

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    if (n % 2)
    {
        reverse(a.begin(), a.end());
        for (int i = 0; i < n; i += 2)
        {
            cout << a[i] << " ";
        }
        reverse(a.begin(), a.end());
        for (int i = 1; i < n; i += 2)
        {
            cout << a[i] << " ";
        }
    }
    else
    {
        reverse(a.begin(), a.end());
        for (int i = 0; i < n; i += 2)
        {
            cout << a[i] << " ";
        }
        reverse(a.begin(), a.end());
        for (int i = 0; i < n; i += 2)
        {
            cout << a[i] << " ";
        }
    }
}


Measured memory_bytes: 3712
N=input()
A=[ map(int, raw_input().split()) for _  in range(N) ]

A.sort(key=lambda x:x[2],reverse=True)
h_highest=A[0][2]

for cx in range(101):
	for cy in range(101):
		for H in range( max(h_highest-200,0), h_highest+200):
			for x,y,h in A:
				if h==max( H-abs(x-cx)-abs(y-cy), 0):
					pass
				else:
					break
			else:
				print cx,cy,H
				quit()


Measured memory_bytes: 33640
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
ll d[5005]={0},k;
ll solve(ll x,ll n,ll mod){
  ll sd[5005],ad[5005]={0};
  n--;
  for(int i=0;i<k;i++) sd[i]=d[i]%mod;
  for(int i=0;i<k;i++) ad[i]=n/k;
  for(int i=0;i<(n%k);i++) ad[i]++;
  x%=mod;
  ll fst=x,lst=x,res=n;
  for(int i=0;i<k;i++) lst+=sd[i]*ad[i];
  res-=((lst/mod)-(fst/mod));
  for(int i=0;i<k;i++){
    if(sd[i]==0) res-=ad[i];
  }
  return res;
}
int main(){
  ll q;
  cin>>k>>q;
  for(int i=0;i<k;i++) cin>>d[i];
  for(int i=0;i<q;i++){
    ll n,x,m;
    cin>>n>>x>>m;
    cout<<solve(x,n,m)<<endl;
  }
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

vector<int> G;
long long cnt;

void insertionSort(int array[], int arrayLength, int g)
{
    for (int i = g; i < arrayLength; i++)
    {
        int v = array[i];
        int j = i - g;
        while (j >= 0 && array[j] > v)
        {
            array[j + g] = array[j];
            j -= g;
            cnt++;
        }
        array[j + g] = v;
    }
}

void shellSort(int array[], int arrayLength)
{
    for (int h = 1;;)
    {
        if (h > arrayLength)
            break;
        G.push_back(h);
        h = 3 * h + 1;
    }

    for (int i = G.size() - 1; i >= 0; i--)
    {
        insertionSort(array, arrayLength, G[i]);
    }
}

int main()
{
    cnt = 0;
    int N;
    cin >> N;
    int A[N];
    for (int i = 0; i < N; i++)
        scanf("%d", &A[i]);

    shellSort(A, N);
    cout << G.size() << endl;

    for (int i = G.size() - 1; i >= 0; i--)
    {
        if (i != G.size() - 1)
            cout << " ";
        cout << G[i];
    }
    cout << endl;
    cout << cnt << endl;

    for (int i = 0; i < N; i++)
    {
        printf("%d\n", A[i]);
    }
    return 0;
}


Measured memory_bytes: 7100
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N, M;
  int num[100001];
  int infl[100001];
  cin >> N >> M;

  for(int i=0; i<N; i++) {
    num[i] = 1;
    infl[i] = 0;
  }
  infl[0] = 1;

  for(int i=0; i<M; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    if( num[x] >= 1 && infl[x] ) {
      infl[y] = 1;
    }
    num[x]--;
    num[y]++;
    if( num[x] == 0 ) {
      infl[x] = 0;
    }
  }

  int sum = 0;
  for(int i=0; i<N; i++) {
    if( infl[i] ) sum++;
  }

  cout << sum << endl;
}


Measured memory_bytes: 1024
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7

n, m = map(int, input().split())
memo = [[ 0,0 ] for i in range(n+1)] 
for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        memo[p][0] = 1
    elif s == 'WA':
        if memo[p][0] == 0:
            memo[p][1] += 1

ac, wa = 0, 0
for i in range(n+1):
    if memo[i][0] == 1:
        ac += 1
        wa += memo[i][1]
#print(memo)
print(*[ac, wa])

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

int main() {
	for( ;; ) {
		int n, x;
		cin >> n >> x;

		if( n == 0 && x == 0 ) {
			break;
		}

		int result = 0;

		for( int i = 1; i <= n; ++i ) {
			for( int j = i+1; j <= n; ++j ) {
				for( int k = j+1; k <= n; ++k ) {
					int s = i + j + k;

					if( s == x && i != j && j != k && k != i ) {
						result += 1;
					}
				}
			}
		}

		cout << result << endl;
	}
}



Measured memory_bytes: 3076
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>

using namespace std;
using ll = long long;

struct UnionFind {
	vector<int> par;

	UnionFind(int N) : par(N) {
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) {
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx == ry) return;
		par[rx] = ry;
	}

	bool same(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

int main() {
	int v, e;
	cin >> v >> e;
	vector<tuple<int, int, int>> edges(e);
	for (int i = 0; i < e; i++) {
		int s, t, w;
		cin >> s >> t >> w;
		edges[i] = make_tuple(w, s, t);
	}
	sort(edges.begin(), edges.end());
	UnionFind tree(v);
	int res = 0;
	for (int i = 0; i < e; i++) {
		int w = get<0>(edges[i]);
		int s = get<1>(edges[i]);
		int t = get<2>(edges[i]);
		if (!tree.same(s, t)) {
			tree.unite(s, t);
			res += w;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 4156
import math
n = int(input())
traffic = [int(input()) for _ in range(5)]

real = [float("inf")]
for i in range(len(traffic)):
    if real[-1] < traffic[i]:
        real.append(real[-1])
        continue

    real.append(traffic[i])

print(math.ceil(n/real[-1]) + 4)


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

#define sp ' '
#define endl '\n'
#define st first
#define nd second
#define sz(x) ((long long int)x.size())
#define pb push_back
#define pob pop_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define forn(YY, yy) for(long long int yy = 0; yy < YY; ++yy)
#define prn(XX) cout << XX << '\n'
#define prs(XX) cout << XX << ' '
#define TEST cout << "TEST\n";

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;

const long long int MOD = 1e9 + 7;
const long long int INF = 2e9 + 13;
const long long int mINF = -2e9 - 13;
const double PI = acos(-1.0);
const double EPS = 1e-9;

ll mx(ll x, ll y){ return (x>y?x:y); }
ll mn(ll x, ll y){ return (x<y?x:y); }

void max_self(ll &x, ll y){ x = mx(x, y); }
void min_self(ll &x, ll y){ x = mn(x, y); }
void add(ll &x, ll y){ x%=MOD; x += (y%MOD); x %= MOD; }
void mul(ll &x, ll y){ x%=MOD; x *= (y%MOD); x %= MOD; }

ll us(ll n, ll x, ll m){
    if(x == 0) return 1;
    ll a = us(n, x>>1, m);
    return (((a*a)%m)*(x&1?n:1))%m;
}

class UnionFind{
    private:
        vll setsize, p, rank;
        ll numsets;
    public:
        UnionFind(ll n){
            setsize.resize(n, 1); p.resize(n); rank.resize(n, 0);
            forn(n, i) p[i] = i;
            numsets = n;
        }
        ll findset(ll u){ return (p[u] == u ? u : p[u] = findset(p[u])); }
        bool issameset(ll u, ll v){ return findset(u) == findset(v); }
        void unionSet(ll u, ll v){
            if(!issameset(u, v)){
                numsets--;
                ll x = findset(u), y = findset(v);
                if(rank[x]>rank[y]){
                    p[y] = x;
                    setsize[x] += setsize[y];
                }
                else{
                    p[x]=y;
                    setsize[y] += setsize[x];
                    if(rank[x]==rank[y]) rank[y]++;
                }
            }
        }
        ll sizeofset(ll u){ return setsize[findset(u)]; }
};

ll N, M, K;
vvll AdjList_Block, AdjList_Friend;

int main(int argc, char **argv){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    cin >> N >> M >> K;
    AdjList_Block.resize(N);
    AdjList_Friend.resize(N);
    UnionFind UF(N);
    forn(M, i){
        ll u, v; cin >> u >> v; u--; v--;
        AdjList_Friend[u].pb(v);
        AdjList_Friend[v].pb(u);
        UF.unionSet(u, v);
    }
    forn(K, i){
        ll u, v; cin >> u >> v; u--; v--;
        AdjList_Block[u].pb(v);
        AdjList_Block[v].pb(u);
    }

    forn(N, i){
        ll blocked = 0;
        forn(sz(AdjList_Block[i]), j){
            blocked += (UF.issameset(AdjList_Block[i][j], i));
        }
        cout << UF.sizeofset(i) - blocked - sz(AdjList_Friend[i]) -1<< sp;
    }
    cout << endl;

    return 0;
}

//cikisir



Measured memory_bytes: 15348
#include <stdio.h>
#include <math.h>

int main(){
    int a;
    int b;
    scanf("%d", &a);
    scanf("%d", &b);
    for(int i = 0; i < 1010; i++){
        double result1 = i * 0.08;
        double result2 = i * 0.1;
        if(floor(result1) == a && floor(result2) == b){
            printf("%d\n", i);
            return 0;
        }
    }
    printf("-1\n");
    return 0;
}

Measured memory_bytes: 128
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    
    rui = [a[0]]
    for i in range(1, n):
        rui.append(rui[i - 1] + a[i])
    rui = [0] + rui
    L = []
    for i in range(n):
        for j in range(i,n):
            L.append(rui[j + 1] - rui[i])

    ans = 0
    for i in range(51):
        bit = (1 << (50 - i))
        LL = []
        cnt = 0
        for j in range(len(L)):
            if L[j] & bit != 0:
                cnt+=1
                LL.append(L[j])

        if cnt >= k:
            L = LL
            ans |= bit

        if len(L) < k:
            break
                

    
    print(ans)
    
                    


if __name__ == '__main__':
    main()


Measured memory_bytes: 102136
//#pragma GCC optimize ("O3,unrolled-loops")
#include <bits/stdc++.h>

#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

signed main(){
	//fastio
	string s,t;
	cin >> s >> t;
	int n = s.size(), m = t.size();
	int dp[n+1][m+1];
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= m;j++){
			if(i==0||j==0) dp[i][j] = 0;
			else if(s[i-1]==t[j-1]) dp[i][j] = dp[i-1][j-1] + 1;
			else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
		}
	}
	//cout << dp[n][m] << "\n";
	string ans;
	for(int i = 0;i < dp[n][m];i++) ans += 'a';
	int i = n, j = m, ind = dp[n][m];
	while(i > 0&&j > 0){
		if(s[i-1]==t[j-1]){
			ans[ind-1] = s[i-1];
			i--,j--,ind--;
		}else if(dp[i-1][j] > dp[i][j-1]){
			i--;
		}else{
			j--;
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 74004
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()

vector<int> G[100010];
deque<int> ans;
bool arr[100010];

void dfs(int i, bool fr) {
	arr[i] = 1;

	for (int x : G[i]) {
		if (arr[x])continue;
		if (fr)
			ans.push_front(x);
		else
			ans.push_back(x);
		dfs(x, fr);
		return;
	}
}

int main(){
	int N, M, a, b;
	cin >> N >> M;
	for (int i = 0;i < M;i++) {
		cin >> a >> b;
		a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	ans.push_back(0);
	dfs(0, 0);
	dfs(0, 1);
	cout << ans.size() << endl;
	while (!ans.empty()) {
		cout << ans.front() + 1 << " ";
		ans.pop_front();
	}
	cout << endl;
}

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

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

int main(){
    bool ans = 0;
    int a,b,c;
    cin >> a >> b >> c;
    int x = gcd(a,b);
    int y = gcd(b,c);
    int z = gcd(x,y);

    a /= z;
    b /= z;
    c /= z;

    if(gcd(a,b) == 1){
        ans = 1;
    }

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

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main() {
  ll h,w;
  cin>>h>>w;
  if (h==1 || w==1) {
    cout<<1<<endl;
  }else if(h%2 && w%2) {
    cout<<(h-1)/2*w+(w+1)/2<<endl;
  }else{
    cout<<h*w/2<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
typedef long long lld;
#define Ma(x,y)(x>y?x:y)

int main(){
	int n,W,v[2<<6],w[2<<16];
	scanf("%d%d", &n, &W);
	rep(i,n)scanf("%d%d",&w[i],&v[i]);
	lld dp[2<<6][2<<16];//dp[a+1][b]...v[a]w[a]までの品物の中から重さがbを超えぬように選んだ時の価値の総和の最大値
	rep(i,W+1)dp[0][i]=0;//1つも選んでいない
	rep(i,n){//(0~N-1で)i番目まで
		rep(j,W+1){//(0~Wで)j gまで
		//(0から数えて)i番目のを入れるかどうか
			if(j<w[i])dp[i+1][j]=dp[i][j];//w[i]がjより大きくて選べない
			else dp[i+1][j]=Ma(dp[i][j],dp[i][j-w[i]]+v[i]);
		}
	}
	printf("%lld",dp[n][W]);
	return 0;
}

Measured memory_bytes: 105344
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int A = scan.nextInt() ;
		int B = scan.nextInt() ;
		int sum = A + B ;

		if (sum % 2 == 0 ) {
			System.out.println( sum/2 );
		} else {
			System.out.println("IMPOSSIBLE");
		}
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
int main(){
int n=0;
char a[1000];
for(int i=0;i<1000;i++)a[i]='\0';
scanf("%s",a);
while(a[n]!='\0')n++;
for(int i=n-1;i>=0;i--)printf("%c",a[i]);
printf("\n");
}

Measured memory_bytes: 2500
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N;
    vector<ld> A;
    
    cin >> N;
    rep(i, N){
        ld inp; cin >> inp;
        A.pb(inp);
    }
    
    sort(all(A));
    
    ld ans = A[0] ;
    rep(i, A.size()){
        if(i == 0) continue;
        ans += A[i];
        ans /= (ld) 2.0;
    }
    cout << ans << endl;


    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    if (s == "keyence") {
        println("YES")
        return
    }
    for (si in s.indices) {
        for (len in 1..s.length) {
            val to = si + len - 1
            if (to < s.length) {
                if (s.removeRange(si, to) == "keyence") {
                    println("YES")
                    return
                }
            }
        }
    }
    println("NO")
}

Measured memory_bytes: 31652