akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;
//必要な宣言
#define MAX 100000

//問題をよく読もう！
//論理的に考えよう！
//サンプルを確認しよう!
//絶対に諦めるな！
//工夫をしろ！
int main() {
  int x;
  cin >> x;

  if(x < 1200) {
    cout << "ABC" << endl;
  }
  else {
    cout << "ARC" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define MOD 1000000007
int main(){
ll n;
cin>>n;
vector<ll> a(n);
for(int i=0;i<n;i++) cin>>a[i];
sort(a.begin(),a.end());
reverse(a.begin(),a.end());
ll c=0;
for(int i=1;i<n;i++) c+=a[i];
cout<<(c>a[0]?"Yes":"No");
}


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

int main(){
    int a, b, c, t;
    cin >> a >> b >> c;
    if (a > b) {
        t = a;
        a = b;
        b = t;
    }
    if (b > c) {
        t = b;
        b = c;
        c = t;
    }
    if (a > b) {
        t = a;
        a = b;
        b = t;
    }
    cout << a << " " << b << " " << c << endl;
    return 0;
}

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

#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
using ll = long long;
const ll inf = 1e9+7; 
const double PI =  3.141592653589793;

int main(){
	IO;
	char c;
	cin>>c;
	c+=1;
	cout<<c<<"\n";
	return 0;
}


// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""



Measured memory_bytes: 3528
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = 998244353;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main() {
    cin>>N>>M;
    mat a(N, vec(M));
    rep(i,N) rep(j,M) cin>>a[i][j], --a[i][j];
    vector<bool> stop(M, false);
    vec id(N,0), memo(M, 0);
    ll ans = N;
    rep(roop,M){
        rep(i,N){
            while(stop[a[i][id[i]]]) ++id[i];
            ++memo[a[i][id[i]]];
        }
        auto ite = max_element(ALL(memo));
        ans = min(ans, *ite);
        stop[ite - memo.begin()] = true;
        rep(i,M) memo[i] = 0;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>

#define BUF_SIZE 15

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int main(void) {
    int n = get_int();
    uint64_t sum = (uint64_t)(n-1) * n / 2;
    printf("%llu\n", sum);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#define ordered_set tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update>
#pragma 03
using namespace std;
using namespace __gnu_pbds;
ll degin[200005], degout[200005];
vll adj[200005];
bool occ[200005], diff[200005], vis[200005];
ll col[200005];
void dfs(ll u, ll c){
	if (vis[u]) return; vis[u] = 1; col[u] = c;
	for (ll i = 0; i < adj[u].size(); i++) dfs(adj[u][i], c);
}
int main(){
	fastio;
	ll n, h; cin >> n >> h;
	for (ll i = 0; i < n; i++){
		ll a, b, c, d, l, r; cin >> a >> b >> c >> d;
		if (c == 0) l = a; else l = -c;
		if (d == 0) r = -b; else r = d;
		l += h; r += h;
		adj[l].pb(r); adj[r].pb(l);
		degin[r]++; degout[l]++;
		occ[l] = 1; occ[r] = 1;
	}
	ll cur = 0;
	for (ll i = 0; i <= 2 * h; i++){
		if (occ[i] && !vis[i]){
			dfs(i, cur); cur++;
		}
	}
	for (ll i = 0; i <= 2 * h; i++){
		if (!occ[i]) continue;
		if (i >= h){
			if (degout[i] < degin[i]){
				cout << "NO\n"; return 0;
			}
		}
		else{
			if (degout[i] > degin[i]){
				cout << "NO\n"; return 0;
			}
		}
		if (degin[i] != degout[i]) diff[col[i]] = 1;
	}
	for (ll i = 0; i < cur; i++){
		if (!diff[i]){
			cout << "NO\n"; return 0;
		}
	}
	cout << "YES\n"; 
	return 0;
}

Measured memory_bytes: 9344
//#include <boost/multiprecision/cpp_int.hpp> 
#include<bits/stdc++.h>
#define ll long long 
#define ull unsigned ll
#define pb push_back
#define mp make_pair
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define test    ll t=0;cin>>t;while(t--)
#define fast    ios_base::sync_with_stdio(false);cin.tie(NULL)
//using namespace boost::multiprecision; 
using namespace std;

int main(void) {
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll x=ceil(1.0*a/d),y=ceil(1.0*c/b);
	if(x>=y)
	cout<<"Yes";
	else
	cout<<"No";
	
	return 0;
}



Measured memory_bytes: 3688
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define en '\n'
#define rep(i,n)    for(ll i=0; i<n; i++)
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(1);
#define yes cout<<"YES"<<'\n'
#define no cout<<"NO"<<'\n'
using namespace std;



int main()
{
    godspeed
    ll  t,n,i,j,k,x,l;
    cin>>n;
    ll a[n];
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
   sort(a,a+n);
    ll ans=0;
    for(i=0; i<n-2; i++)
    for(j=i+1; j<n-1; j++)
    for(k=j+1; k<n; k++)
    {
        if(a[i]!=a[j]&&a[i]!=a[k]&&a[j]!=a[k])
        if(a[i]+a[j]>a[k])

            ans++;
    }


    cout<<ans<<en;

    return 0;
}





Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  string s;
  cin >> s;
  ll ans = 0;
  for (ll i = 1; 2 * i < SZ(s); i++) {
    if (s.substr(0, i) == s.substr(i, i)) {
      ans = max(ans, 2 * i);
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 N              PIC 9(10).
01 K              PIC 9(10).
01 idx            PIC 9(10).
01 ln             PIC X(599).
01 maxlen         PIC 9(10) VALUE 100 COMP.
01 cur            PIC 9(10) VALUE 1 COMP.
01 i              PIC 9(10) VALUE 1 COMP.
01 j              PIC 9(10) COMP.
01 len            PIC 9(10) COMP.
01 ans            PIC 9(10).
01 zs             PIC Z(9)9.
01 A1.
    03 A11 OCCURS 100 DEPENDING ON N.
        05 A      PIC S9(10) VALUE 1.

PROCEDURE DIVISION.
  ACCEPT ln.
  UNSTRING ln DELIMITED BY SPACE INTO N K.
  PERFORM K TIMES
      ACCEPT maxlen
      ACCEPT ln
      MOVE 1 TO cur
      PERFORM maxlen TIMES
          PERFORM VARYING j FROM cur BY 1 UNTIL ln(j:1) = SPACE
          END-PERFORM
          COMPUTE len = j - cur
          MOVE ln(cur:len) TO idx
          MOVE ZERO TO A(idx)
          COMPUTE cur = j + 1
          ADD 1 TO i
      END-PERFORM
  END-PERFORM.
  PERFORM VARYING j FROM 1 BY 1 UNTIL N < j
      IF ZERO < A(j)
          ADD A(j) TO ans
      END-IF
  END-PERFORM.
  MOVE ans TO zs.
  DISPLAY FUNCTION TRIM(zs).
  STOP RUN.


Measured memory_bytes: 3908
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<sstream>
#include<iomanip>
#define forn(i,n) for(int (i)=0;i<(n);i++)
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int MAXN=100005;
const int INF=2147483647;
const ll LINF=9223372036854775807;
const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int k;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>k;
	forn(i,k)cout<<"ACL";
	return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  int n;
  cin>>n;
  ll a[n];
  ll money=1000;
  for(int i=0;i<n;i++)
    cin>>a[i];
  
  for(int i=0;i<n-1;i++)
  { 
    ll stocks=0;
    if(a[i]<a[i+1])
    stocks=money/a[i];
    money+=(a[i+1]-a[i])*stocks;
  }
  cout<<money<<endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << max(a - b, max(a + b, a * b)) << endl;
}


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

using namespace std;

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

  long long total = 0;
  for(int i=0; i < n; i++) {
    total += min(a[i], b[i]);
    if(0 < b[i]-a[i]) {total += min(a[i+1], b[i]-a[i]); a[i+1] = max(a[i+1]-b[i]+a[i], (long long)0);}
  }
  cout << total << endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int N = S.length();
		boolean isStrongStr = false;

		StringBuffer sb = new StringBuffer(S);
		String dst = sb.reverse().toString();
		if (S.equals(dst)) {
			String second = S.substring(0, (N - 1) / 2);
			sb = new StringBuffer(second);
			if (second.equals(sb.reverse().toString())) {
				String third = S.substring((N + 3) / 2 - 1, S.length());
				sb = new StringBuffer(third);
				if (third.equals(sb.reverse().toString())) {
					isStrongStr = true;
				}
			}
		}

		if (isStrongStr) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

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

int main() {
    int N,M;
    cin >> N >> M;
    int food[M] = {};
    for (int i = 0; i < N; ++i) {
        int K;
        cin >> K;
        int A[K];
        for (int r=0;r<K;++r){
            cin >> A[r];
            food[A[r]-1]++;
        }
    }
    int res=0;
    for(int i=0;i<M;i++){
        if(food[i]==N){
            res++;
        }
    }
    cout << res <<endl;

}

Measured memory_bytes: 256
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            if (i+1 < h and s[i+1][j] == ".") and (j+1 < w and s[i][j+1] == ".") and (i-1 > 0 and s[i-1][j] == ".") and (j-1 > 0 and s[i][j-1] == "."):
                print("No")
                exit()
print("Yes")


Measured memory_bytes: 3064
import java.io.ByteArrayInputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    String INPUT = "";

    public static void main(String[] args) throws Exception {
        new Main().run();
    }

    void run() {
        Scanner sc = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(new ByteArrayInputStream(INPUT.getBytes()));
        PrintWriter out = new PrintWriter(System.out);

        solve(sc, out);
        out.flush();
    }

    void solve(Scanner sc, PrintWriter out) {
        String S = sc.nextLine();
        String ans = "";
        for (int i = 0; i < S.length(); i++) {
            if (S.charAt(i) >= 'a' && S.charAt(i) <= 'z') {
                ans += S.substring(i, i+1).toUpperCase();
            } else if (S.charAt(i) >= 'A' && S.charAt(i) <= 'Z'){
                ans += S.substring(i, i+1).toLowerCase();
            } else {
                ans += S.substring(i, i+1);
            }
        }
        System.out.println(ans);
    }
}



Measured memory_bytes: 31556
#include <bits/stdc++.h>
#define All(v) v.begin(), v.end()
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N, K, d;
    cin>>N>>K;
    d = (N-2) * (N-1) / 2 - K;
    if(d<0){cout<<-1<<endl; return 0;}
    vector<pii> ans;
    for(int i=2;i<=N && d;i++){
        for(int j=i+1;j<=N && d;j++){
            ans.emplace_back(pii(i, j));
            d--;
        }
    }
    for(int i=2;i<=N;i++) ans.emplace_back(pii(1, i));
    cout<<ans.size()<<endl;
    for(auto p : ans){
        cout<<p.first<<' '<<p.second<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=105;
char s[N];int n,f1,f2;
int main(){
	scanf("%s",s+1),n=strlen(s+1);
	fp(i,1,n)if(s[i]=='C')f1=1;
		else if(f1&&s[i]=='F')f2=1;
	puts(f2?"Yes":"No");
	return 0;
}

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

typedef signed long long ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) x.begin(),x.end()

#define DEBUG

int main()
{
	int n;
	vector<int> a;

	int s;
	cin >> n;
	rep(i,n)
	{
		cin >> s;
		a.push_back(s);
	}
	sort(all(a));

	ll sum = 0;
	rep(i, a.size())
	{
		sum += a[i];
	}

	int min = *a.begin();
	int max = *(--a.end());
	cout << min << ' ';
	cout << max << ' ';
	cout << sum << endl;
	return 0;
}



Measured memory_bytes: 3252
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<cstdio>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

long int prime[1000001];

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

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

void fact(long int x){
    long int num = x;
    for (long int i = 2; i * i <= x; i++){
        long int c = 0;
        while(num % i == 0){
            num /= i;
            c++;
        }
        prime[i] = max(prime[i], c);
    }
    if (num > 1){
        prime[num] = max(prime[num], (long int)1);
    }
    
}

// a^n mod を計算する
long int modpow(long int a, long int n, long int mod) {
    long int res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}

long int inv(long int a, long int mod){
    long int i_inv = modpow(a, mod - 2, mod);
    return i_inv;
}

int main(){
    const long int mod = 1000000007;
    long int n;
    cin >> n;
    long int a[n];
    rep(i, n) cin >> a[i];
    
    for (int i = 0; i < n; i++){
        fact(a[i]);
    }
    long int num = 1;
    // rep(i, 10) cout << prime[i] << " "; cout << endl;

    rep(i, 1000001){
        if (prime[i] > 0){
            num *= modpow(i, prime[i], mod);
            num %= mod;
        }
    }
    // cout << num << endl;
    long int ans = 0;
    rep(i, n){
        long int b = 0;
        b = num * inv(a[i], mod);
        b %= mod;
        ans += b;
        ans %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 6656
import java.util.*;
import java.util.Arrays;
public class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String a = sc.next();
      String b = sc.next();
      int flag = 0;
      char []x =a.toCharArray();
      char []y =b.toCharArray();
      for(int i=0;i<x.length;i++){
        if(x[i]!=y[i]){
          flag = 1;
          break;
        }
      }
      if(flag==0){
        System.out.println("Yes");
      }
      else{
        System.out.println("No");

      }

     

      
    }
}

Measured memory_bytes: 26920
maxX, maxY, a = map(int, input().split())
minX = 0
minY = 0
for i in range(a):
    x, y, b = map(int, input().split())
    if b == 1:
        minX = max(x, minX)
    elif b == 2:
        maxX = min(x, maxX)
    elif b == 3:
        minY = max(y, minY)
    elif b == 4:
        maxY = min(y, maxY)
if maxX > minX and maxY > minY:
    print((maxX - minX)*(maxY - minY))
else:
    print(0)


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

int main() {
  long long n, m;

  cin >> n >> m;

  vector<long long> a(m);

  for(long long i = 0; i < m; i++)
    cin >> a[i];

  long long sum = accumulate(a.begin(), a.end(), 0);

  if(sum > n)
    cout << -1 << endl;
  else
    cout << n - sum << endl;
  
  return 0;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 1002
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

vector<int> b[11], v[11];
int dp[2000];
int main(){
	int n, k, t1, t2;
	scanf("%d%d", &n, &k);
	rep(i,n){
		scanf("%d%d", &t1, &t2);
		b[t2].pb(t1);
	}
	rrep(i,10)sort(b[i].begin(), b[i].end(), greater<int>());
	rrep(i,10)v[i].pb(0);
	rrep(i,10)rep(j,b[i].size())v[i].pb(v[i][j]+b[i][j]+j*2);
	/*for(int i = 1;i <= 3;i++){
		rep(j,v[i].size())printf("%d ",v[i][j]);
		printf("\n");
	}*/
	rrep(i,10){
		drep(j,k){
			t1 = v[i].size();
			for(int h = 0;h < min(j+1, t1);h++){
				dp[j] = max(dp[j], dp[j-h]+v[i][h]);
			}
		}
	}
	printf("%d\n", dp[k]);
	return 0;
}

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

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> L(N);
  for (int i = 0; i < N; i++) cin >> L[i];
  int ans = 0, distance = 0;
  for (int i = 0; i < N; i++) {
    distance += L[i];
    if (distance > X) {
      ans += i+1;
      break;
    }
    if (i == N-1) ans += N+1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define INF (ll)(1e18)
#define MOD (ll)(1e9 + 7)
#define MAX (ll)(1e5 + 9)

using namespace std;
using ll = long long;

int main () {
	int a, b;
	cin >> a >> b;
	cout << a * b << "\n";
}
	


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    string S;
    cin >> S;
    for (int i = 0; i < S.size(); i++) if (i % 2 == 0) cout << S[i];
    cout << '\n';
}


Measured memory_bytes: 512
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define pii pair<int,int>
#define prec(n) fixed<<setprecision(n)
#define MOD 1000000007
#define eps 1e-8
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

bool f(int n){
    if(abs(sqrt(n)-((int)(sqrt(n)+0.5)))<=eps){
        return 1;
    }
    return 0;
}

signed main(){
    FASTER;
    int n,m;cin>>n>>m;
    vector<vi> v(n,vi(m));cin>>v;
    int cnt=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int ans=0;
            for(int k=0;k<m;k++){
                ans+=(v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
            }
            cnt+=f(ans);
        }
    }
    cout<<cnt;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{

int num1,num2,num3;

cin>>num1>>num2>>num3;

if(num1==num2){
cout<<num3<<endl;
}

if(num1==num3){

    cout<<num2<<endl;
}

if(num2==num3){

    cout<<num1<<endl;
}
    return 0;
}


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

#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define pb push_back
#define inf 1e+18L
#define MOD 1000000007

bool isPalin(string s, int i, int j){
    for(int x=i, y=j; x < y; x++, y--){
        if(s[x] != s[y]){ 
            return false;
        }
    }
    return true;
}

int main(){
    FastIO
    string s;
    cin >> s;
    int n = s.size();
    if(isPalin(s,0,n-1) && isPalin(s,0,(n-1)/2 - 1) && isPalin(s,(n+3)/2 - 1, n-1)){
        cout<<"Yes\n";
    }
    else{ 
        cout <<"No\n";
    }
    return 0;
}

Measured memory_bytes: 256
<?php
$num = trim(fgets(STDIN));
$array = explode(" ", trim(fgets(STDIN)));

$arrays = sort($array);
$sum = 0;

for($i = 0; $i < $num; $i++){
    $sum = $sum + $array[$i];
}

printf("%d %d %d\n", $array[0], $array[$num - 1], $sum);


Measured memory_bytes: 11116
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            int c = int.Parse(s[2]);
            int d = 0;
            for(int i = a; i <= b; i++)
            {
                if(c % i == 0)
                {
                    d ++;
                }
            }
            Console.WriteLine(d);
        }
    }
}

Measured memory_bytes: 9248
N = int(input())
nums = list(map(int, input().split()))

cnt = 0

while True:
    for i in range(N):
        if nums[i] % 2 == 1:
            result = "Odd"
            break
        else:
            result = "Even"
            nums[i] /= 2
    if result == "Odd": break
    cnt += 1
print(cnt)


Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;

int main(){
  int N, M, R; cin >> N >> M >> R;
  vector<int> r(R);
  vector<vector<int>> dist(N, vector<int> (N, INF));
  for(int i = 0; i < R; i++){
    cin >> r[i]; --r[i];
  }
  for(int i = 0; i < M; i++){
    int a, b, c; cin >> a >> b >> c; --a; --b;
    dist[a][b] = c;
    dist[b][a] = c;
  }
  for(int i = 0; i < N; i++) dist[i][i] = 0;
  for(int k = 0; k < N; k++){
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
  sort(r.begin(), r.end());
  int ans = 1e9;
  do{
    int ans1 = 0;
    for(int i = 1; i < R; i++){
      ans1 += dist[r[i - 1]][r[i]];
    }
    ans = min(ans, ans1);
  }while(next_permutation(r.begin(), r.end()));
  cout << ans << endl;
}

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

using namespace std;

int main(){
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    vector<int> x(N);
    vector<int> y(M);
    for(int i = 0; i < N; i++) cin >> x[i];
    for(int j = 0; j < M; j++) cin >> y[j];

    for(int i = X+1; i <= Y; i++){
        bool check = true;
        for(int j = 0; j < N; j++){
            if(x[j] >= i){
                check = false;
                break;
            }
        }
        for(int j = 0; j < M; j++){
            if(y[j] < i){
                check = false;
                break;
            }
        }
        if(check){
            cout << "No War" << endl;
            return 0;
        }
    }

    cout << "War" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

std::string removeCube(std::string c);

int main()
{
	std::string s;
	std::cin >> s;

	std::string tmp_s = s;
	int tmp_c = tmp_s.size();
	while (true) {
		tmp_s = removeCube(tmp_s);
		if (tmp_c == tmp_s.size())
			break;
		tmp_c = tmp_s.size();
	}

	std::cout << s.size() - removeCube(tmp_s).size();

	return 0;
}

std::string removeCube(std::string c)
{
	if (c.empty())
		return c;

	for (int i = 0; i < c.size() - 1; ++i) {
		if (c[i] != c[i+1]) {
			c = c.erase(i,2);
			break;
		}
	}
	return c;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define INF 1e18
#define MAX 100010
using namespace std;

struct edge {
    int to;
    ll cost;
    edge(int t, int c) : to(t), cost(c) {}
};

typedef pair<ll, int> p;
ll dist[MAX];
vector<edge> graph[MAX];

void dijkstra(int r) {
    priority_queue<p, vector<p>, greater<p> > que;
    bool color[MAX];
    for (int i = 0; i < MAX; i++) {
        dist[i] = INF;
        color[i] = false;
    }
    dist[r] = 0;
    que.push(p(0, r));
    while (!que.empty()) {
        p f = que.top();
        que.pop();
        int v = f.second;
        color[v] = true;
        if (dist[v] < f.first) continue;
        for (int i = 0; i < graph[v].size(); i++) {
            edge e = graph[v][i];
            if (color[e.to] == true) continue;
            if (dist[e.to] > dist[v] + e.cost) {
                dist[e.to] = dist[v] + e.cost;
                que.push(p(dist[e.to], e.to));
            }
        }
    }
}

int main() {
    int n, x, y;
    cin >> n >> x >> y;
    for (int i = 0; i < n; i++) {
        graph[i].push_back(edge(i + 1, 1));
        graph[i + 1].push_back(edge(i, 1));
    }
    graph[x - 1].push_back(edge(y - 1, 1));
    graph[y - 1].push_back(edge(x - 1, 1));
    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        dijkstra(i);
        for (int j = 0; j < n; j++) {
            if (dist[j] == 0 || dist[j] >= n) continue;
            ans[dist[j] - 1]++;
        }
    }
    for (int i = 0; i < n - 1; i++) cout << ans[i] / 2 << endl;
    return 0;
}


Measured memory_bytes: 3584
use std::cmp::min;

const MAX: usize = std::usize::MAX;

fn main() {
    let mut nl = vec![];
    loop {
        let mut x = String::new();
        std::io::stdin().read_line(&mut x).unwrap();
        let n: usize = x.trim().parse().unwrap();
        if n == 0 { break; }
        nl.push(n)
    }

    let mut s = vec![];
    let mut os = vec![];
    for i in 1.. {
        let d = i * (i + 1) * (i + 2) / 6;
        if d > 1_000_000 { break; }
        s.push(d);
        if d % 2 == 1 {os.push(d)}
    }
    let mut dp = vec![MAX; 1_000_001];
    let mut odp = vec![MAX; 1_000_001];
    dp[0] = 0;
    odp[0] = 0;
    for j in 1..1_000_001 {
        for &i in &s {
            if j < i { break; }
            dp[j] = min(dp[j], dp[j - i] + 1)
        }
        for &i in &os {
            if j < i { break; }
            odp[j] = min(odp[j], odp[j - i] + 1)
        }
    }
    for i in nl {
        println!("{} {}", dp[i], odp[i]);
    }
}




Measured memory_bytes: 21304
s = list(input())
len_s = len(s)
t = list(input())
len_t = len(t)

if len_s<len_t:
    print("UNRESTORABLE")
    exit()

def fix(ls):
    for i in range(len(ls)):
        if ls[i]=="?":
            ls[i]="a"
    return ls

ans = []
for i in range(len_s-len_t+1):
    flg = True
    for j in range(len_t):
        if t[j]==s[i+j] or s[i+j]=="?":
            pass
        else:
            flg=False
            break
    if flg:
        can1 = fix(s[0:i])
        can2 = t
        can3 = fix(s[i+len_t:])
        ans.append("".join(can1+can2+can3))
ans.sort()
if len(ans)!=0:
    print(ans[0])
else:
    print("UNRESTORABLE")

Measured memory_bytes: 39152
// wake me up, wake me up inside. I cant wake up.
// save me , save me from the nothing ive become;

#include <bits/stdc++.h>

#define s second
#define f first
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define int int64_t

using namespace std;

const int MAX=1e6+20,INF=1e9+1,mod=1e9+7;

int n,m,d,ans=INF,a[MAX],c,b,t[MAX],dis[MAX],sum,del,x,cnt,c2,mn2=INF,mx1=-MAX,mx2=-MAX,l,r,color,sum2,fn,mx=-1,mn=INF,k,y,z;
string s,str,sans;
//set <int> st;
//vector <pii> adj[MAX];
bool mark[MAX],ark2;
vector <int> adj[MAX];
vector<pii> v;
queue <int> q;
long double a1,a2;
map <int,int> mp;

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

main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> s;
	for(int i=1;i<s.size()-1;i++)
    {
        x=0;
        x+=(s[i-1]-48)*100;
        x+=(s[i]-48)*10;
        x+=(s[i+1]-48);
        ans=min(abs(753-x),ans);
    }
    cout << ans;
    return -0;
}




Measured memory_bytes: 24832
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define rep(i,strt,end) for(long long i = strt;i < end;i++)


int main(){
    int n,k;
    cin >> n >> k;
    int sHas[n+1]; 
    rep(i,0,n+1){
        sHas[i] = 0;
    }
    rep(i,0,k){
        int d;
        cin >> d;      
        rep(j,0,d){
            int ad;
            cin >> ad;
            sHas[ad]++;
        }
    }
    unsigned long long numEmptCnt = 0;
    rep(i,1,n+1){
        if(sHas[i] < 1){
            numEmptCnt++;
        }
    }
    cout << numEmptCnt << endl;
    //--------------
    return 0;
}

Measured memory_bytes: 3632
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE BangPatterns          #-}
{-# LANGUAGE CPP                   #-}
{-# LANGUAGE LambdaCase            #-}
{-# LANGUAGE MagicHash             #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE MultiWayIf            #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE TupleSections         #-}
{-# LANGUAGE TypeFamilies          #-}
{-# LANGUAGE ViewPatterns          #-}

import           Control.Applicative
import           Control.Exception
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString             as B
import qualified Data.ByteString.Builder     as B
import qualified Data.ByteString.Char8       as C
import qualified Data.ByteString.Internal    as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import qualified Data.Foldable               as F
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import qualified Data.List                   as L
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           GHC.Exts
import qualified System.IO                   as IO
import           Unsafe.Coerce

main :: IO ()
main = do
    [a,b] <- map read.words <$> getLine :: IO [Int]
    if even $ abs (a - b)
    then print $ min a b + div (abs $ a - b) 2
    else putStrLn "IMPOSSIBLE"


-------------------------------------------------------------------------------
type Parser a = C.ByteString -> Maybe (a, C.ByteString)

parseInt :: Parser Int
parseInt = C.readInt . C.dropWhile isSpace

parseInt2 :: Parser (Int, Int)
parseInt2 = runStateT $
    (,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)

parseInt3 :: Parser (Int, Int, Int)
parseInt3 = runStateT $
    (,,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)

parseInt4 :: Parser (Int, Int, Int, Int)
parseInt4 = runStateT $
    (,,,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)

Measured memory_bytes: 508
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();long b = sc.nextInt();long result=1;int d=2;
        while(d<=((a>b)?a:b)){
            if(a%d==0 && b%d==0){
                result*=d;
                a/=d;b/=d;
            }else {
                d++;
            }
        }
        result=result*a*b;
        System.out.println(result);
        }
    }

Measured memory_bytes: 22612
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
N = int(input())
AB = [tuple(map(int,input().split())) for i in range(N-1)]
es = [[] for _ in range(N)]
for i,(a,b) in enumerate(AB):
    a,b = a-1,b-1
    es[a].append((b,i))
    es[b].append((a,i))

ans = [None] * (N-1)

def dfs(v,p=-1,c=-1):
    nc = 1
    for to,e in es[v]:
        if to==p: continue
        if nc==c: nc += 1
        ans[e] = nc
        dfs(to,v,nc)
        nc += 1
dfs(0)

print(max(ans))
print(*ans, sep='\n')

Measured memory_bytes: 102500
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  string a;
  int b = 0;
  cin >> a;
  if(a == "SUN"){
    b = 7;
  }
  else if(a == "MON"){
    b = 6;
  }
  else if(a == "TUE"){
    b = 5;
  }else if(a == "WED"){
    b = 4;
  }else if(a == "THU"){
    b = 3;
  }else if(a == "FRI"){
    b = 2;
  }else if(a == "SAT"){
    b = 1;
  }
  cout << b << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示

void solve(std::string S, std::string T){
  int ans = 0;
  for (int i = 0; i < 3; i++) {
    if(S[i] == T[i])ans++;
  }
  cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
}


Measured memory_bytes: 256
#pragma GCC optimize("O2")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<limits.h>
#include<ctime>
#define N 100001
typedef long long ll;
const int inf=0x3fffffff;
const int maxn=2017;
using namespace std;
inline int read()
{
    int f=1,x=0;char ch=getchar();
    while(ch>'9'|ch<'0')
    {
        if(ch=='-')
        f=-1;
        ch=getchar();
    }
    while(ch<='9'&&ch>='0')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return f*x;
}
char s[N];
int main()
{
	scanf("%s",s+1);
	int n=strlen(s+1);
	for(int i=1;i<=n;i++)
	{
		if(n-i==7)break;
		cout<<s[i];
	}
}

Measured memory_bytes: 256
def main():
    is_prime = [i for i in range(1000000)]
    is_prime[0] = is_prime[1] = False

    for i in range(2, 1000000):
        is_prime[i] = True
    
    for i in range(2, 1000000):
        if i*i >= 1000000:
            break
        for j in range(i*i, 1000000, i):
            is_prime[j] = False
    
    while 1:
        try:
            ans = [0,0]
            n = int(input())
            for i in range(2,1000001):
                if is_prime[i]:
                    if i < n:
                        ans[0] = i
                    else:
                        if i != n:
                            ans[1] = i
                            break

            print('%s %d' % (ans[0],ans[1]))
        except:
            break

if __name__ == "__main__":
    main()  


Measured memory_bytes: 45164
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w,n;
  cin >> h >> w >> n;
 
  int s=max(h,w);
  
  if(n%s==0){
    cout << n/s << endl;
  }
  else if(n%s!=0){
    cout << n/s + 1 << endl;
  }
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var sc = bufio.NewScanner(os.Stdin)

func r() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n, m := r(), r()

	ab := make(map[int]int, n)
	for i := 0; i < n; i++ {
		a, b := r(), r()
		if _, ok := ab[a]; !ok {
			ab[a] = b
		} else {
			ab[a] += b
		}
	}

	key := make([]int, 0, len(ab))
	for k, _ := range ab {
		key = append(key, k)
	}
	sort.Ints(key)

	var count int // 買った本数
	var ans int64 // かかった費用
	for _, k := range key {
		switch {
		case count+ab[k] < m:
			count += ab[k]
			ans += int64(k) * int64(ab[k])
		case count+ab[k] == m:
			count += ab[k]
			ans += int64(k) * int64(ab[k])
			fmt.Println(ans)
			return
		case count+ab[k] > m:
			ans += int64(k) * int64(m-count)
			fmt.Println(ans)
			return
		}
	}
}


Measured memory_bytes: 4352
using System;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            char[] ch = S.ToCharArray();
            int count = 0;
            int ans = 0;
            for(int i = 0; i < ch.Length; i++)
            {
                if(ch[i] == 'A'||ch[i] == 'C' || ch[i]=='T' || ch[i] == 'G')
                {
                    count++;
                    ans = Math.Max(count,ans);
                }
                else
                {
                    count = 0;
                }
            }
            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 13140
import math

a,b,x = map(int, input().split())

# 台形部分の面積
m = x / a
# 水の高さ
w = m / b

# 台形を構成しているとき
w_max = 2 * m / a
max_deg = math.degrees(math.atan(2*(a*a*b -x)/ (a*a*a)))

# 台形から崩れたとき
h = 2 * m / b
max_deg2 = 90 - math.degrees(math.atan(h / b))

if (a * a * b / 2.0) <= x :
  print(max_deg)
else:
  print(max_deg2)



Measured memory_bytes: 3060
using System;
using System.Collections.Generic;

namespace ABC152_B
{
    class Program
    {
        static void Main(string[] args) {
            string[] input = Console.ReadLine().Split();
            string ans = "";
            long a = long.Parse(input[0]);
            long b = long.Parse(input[1]);
            long target = 0;
            long kurikaesi = 0;
            if (a >= b) {
                target = b;
                kurikaesi = a;
            } else {
                target = a;
                kurikaesi = b;
            }
            for(int i = 0; i < kurikaesi; i++) {
                ans = ans + target;
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main() {
    int N;
    cin >> N;
    string s, t;
    cin >> s >> t;
    
    int res = 2 * N;
    
    
    for (int i = 0; i < N; ++i) {
        bool can = true;
        for (int j = 0; j < N - i; ++j) {
            if (s[i + j] != t[j]){
                can = false;
                break;
            } 
        }
        if (can) {
            res = N + i;
            break;
        }
            
    }
    
    cout << res << endl;
}

Measured memory_bytes: 256
#pragma GCC optimze("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
#define ppp pair<ll,pp >
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t=1, tt;
const ll inf=1e18, N=100005;
ll dp[105][N];
inline ll mult(ll x,ll y){x%=hell;y%=hell;return (1LL*x*y)%hell;}
inline ll add(ll x,ll y){x+=y;return x%hell;}
inline ll powMod(ll base,ll expo){
	if(base==0)return 0;
	ll ans=1;
	while(expo){
		if(expo&1)ans=mult(ans,base);
		base=mult(base,base); 
		expo>>=1;
	}
	return ans;
}
void solve(){
	memset(dp,-1,sizeof dp);
	ll n, k;
	cin>>n>>k;
	dp[0][0]=0;
	vector<ll> a(n+1), b(n+1);
	rep(i,1,n+1){
		cin>>a[i]>>b[i];
		rep(j,0,k+1){
			dp[i][j]=dp[i-1][j];
			if(a[i]<=j and dp[i-1][j-a[i]]!=-1){
				dp[i][j]=max(dp[i][j],dp[i-1][j-a[i]]+b[i]);
			}
		}
	}
	ll ans=0;
	rep(i,0,k+1)ans=max(ans,dp[n][i]);
	cout<<ans;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   	//cin>>t;
   	tt=t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


Measured memory_bytes: 82304
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 C = scan.nextInt();
	int X = scan.nextInt();
	int Y = scan.nextInt();

	if((A+B)/2.0 > C && X >= Y && A >= C*2){
	    System.out.println(C*X*2);
	}else if((A+B)/2.0 > C && Y > X && B >= C*2){
	    System.out.println(C*Y*2);
	}else if((A+B)/2.0 > C && X >= Y){
	    System.out.println(C*2*Y+A*(X-Y));
	}else if((A+B)/2.0 > C && Y > X){
	    System.out.println(C*2*X+B*(Y-X));
	}else{
	    System.out.println(A*X+B*Y);
	}
    }
}
	


Measured memory_bytes: 21844
#include <algorithm>
#include <numeric>
#include <iostream>
using namespace std;
constexpr int M = 1000000007;

class ModComb {
    long long *fact, *facti;
    int mod;

    int modinv(int a) {
        int x = mod, y = a, p = 1, q = 0, r = 0, s = 1;
        while (y != 0) {
            int u = x / y;
            int x0 = y; y = x - y * u; x = x0;
            int r0 = p - r * u, s0 = q - s * u;
            p = r; r = r0; q = s; s = s0;
        }
        return q < 0 ? q + mod : q;
    }
public:
    explicit ModComb(int n, int m) : mod(m) {
        fact = new long long[n+1];
        facti = new long long[n+1];
        fact[0] = 1; facti[0] = 1;
        for (int i = 1; i <= n; i++) {
            fact[i] = (fact[i-1] * i) % m;
            facti[i] = modinv(fact[i]);
        }
    }

    ~ModComb() {
        if (fact) delete[] fact;
        if (facti) delete[] facti;
    }

    long long get(int n, int k) {
        if (n < 0 || k < 0 || k > n) return 0;
        return fact[n] * facti[k] % M * facti[n-k] % M;
    }
};

int main() {
    int h, w, n; cin >> h >> w >> n;
    pair<int, int> P[n];
    for (int i = 0; i < n; i++) cin >> P[i].first >> P[i].second;
    sort(P, P+n);
    ModComb mc(h+w, M);
    long long dp[n] = {};
    for (int i = 0; i < n; i++) {
        int r = P[i].first, c = P[i].second;
        long long sum = 0;
        for (int j = 0; j < n; j++) {
            int r1 = P[j].first, c1 = P[j].second;
            if (r1 <= r && c1 <= c) sum += dp[j] * mc.get(r+c-r1-c1, r-r1) % M;
        }
        dp[i] = (mc.get(r+c-2, r-1) - sum) % M;
    }
    long long ans = mc.get(h+w-2, h-1);
    for (int i = 0; i < n; i++) {
        //cerr << (ans % M + M) % M << endl;
        int r = P[i].first, c = P[i].second;
        ans -= dp[i] * mc.get(h+w-r-c, h-r) % M;
    }
    cout << (ans % M + M) % M << endl;
}


Measured memory_bytes: 3456
from math import sin, cos, sqrt

A, B, H, M = map(int, input().split())
pi = 3.14159265358979323846264338327950288

omgA = 2*pi/720
omgB = 2*pi/60
time = 60*H + M

hour = [A*cos(omgA*time), A*sin(omgA*time)]
min = [B*cos(omgB*time), B*sin(omgB*time)]

ans = sqrt(((hour[0] - min[0])**2) + ((hour[1] - min[1])**2))

print(ans)

Measured memory_bytes: 9584
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N;
    string S,T,ans;
    cin>>N>>S>>T;
    rep(i,N){
        ans.push_back(S[i]);
        ans.push_back(T[i]);
    }
    cout<<ans<<endl;
}

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

unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

int main()
{
    int n;
    cin>>n;
    int ans=0;
    for (int i = 1; i <= n; i++)
    {
        if(GetDigit(i)%2==1){
            ans++;
        }
    }
    cout<<ans<<endl;
    
    return 0;
}

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

bool is_prime(int num) {
  for (int i = 2; i < num; i++) {
    if (num % i == 0) {
      return false;
    }
  }
  return true;
}

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

  while (true) {
    if (is_prime(X)) {
      cout << X << endl;
      break;
    }
    X++;
  }
  return 0;
}


Measured memory_bytes: 256