akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    int ts,te,cnt=0,ans;
    while(1){
        ts=(a+b)*cnt;
        te=a*(cnt+1)+b*cnt;
        if(ts%60<=c&&c-ts%60<=a){
            ans=60*(ts/60)+c;
            break;
        }
        if(ts!=0&&ts%60==0){
            ans=-1;
            break;
        }
        cnt++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long int lli;

int main() {
	int N;
	cin >> N;
	int a, b, c, d;
	a = N / 1000;
	b = N / 100 - a * 10;
	c = N / 10 - a * 100 - b * 10;
	d = N % 10;

	char op1, op2, op3;
	if (a + b + c + d == 7) {
		op1 = '+';
		op2 = '+';
		op3 = '+';
	}
	if (a + b + c - d == 7) {
		op1 = '+';
		op2 = '+';
		op3 = '-';
	}
	if (a + b - c + d == 7) {
		op1 = '+';
		op2 = '-';
		op3 = '+';
	}
	if (a + b - c - d == 7) {
		op1 = '+';
		op2 = '-';
		op3 = '-';
	}
	if (a - b + c + d == 7) {
		op1 = '-';
		op2 = '+';
		op3 = '+';
	}
	if (a - b + c - d == 7) {
		op1 = '-';
		op2 = '+';
		op3 = '-';
	}
	if (a - b - c + d == 7) {
		op1 = '-';
		op2 = '-';
		op3 = '+';
	}
	if (a - b - c - d == 7) {
		op1 = '-';
		op2 = '-';
		op3 = '-';
	}

	cout << a << op1 << b << op2 << c << op3 << d << "=7";
}

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

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

  int apos, zpos;
  for (int i=0; i<s.size(); i++) {
    if (s.at(i) == 'A') {
      apos = i;
      break;
    }
  }
  for (int j=s.size()-1; j>=0; j--) {
    if (s.at(j) == 'Z') {
      zpos = j;
      break;
    }
  }
  cout << zpos - apos + 1 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
int y, m, d;
int main() {
	scanf("%4d/%2d/%2d", &y, &m, &d);
	if (y < 2019) {
		puts("Heisei");
	}
	else if (y > 2019) {
		puts("TBD");
	}
	else if (y == 2019) {
		if (m < 4) {
			puts("Heisei");
		}
		else if (m > 4) {
			puts("TBD");
		}
		else if (m == 4) {
			if (d < 30) {
				puts("Heisei");
			}
			else if (d > 30) {
				puts("TBD");
			}
			else if (d == 30) {
				puts("Heisei");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=[]
ans='DENIED'
for i in range(len(a)):
    if(a[i]%2==0):
        b.append(a[i])
f=0
for i in range(len(b)):
    if((b[i]%3==0)|(b[i]%5==0)):
        f+=1
if(f==len(b)):
    ans='APPROVED'
print(ans)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int prime[100005],check[100005];
void sieve()
{
    prime[0]=0;prime[1]=0;
    for(int i=2;i<100005;i++) prime[i]=1;
    for(int i=2;i*i<100005;i++){
        //cout<<"POP"<<endl;
        if(prime[i]==1) {
          //  cout<<i<<endl;
            for(int j=i*i;j<100005;j+=i) prime[j]=0;
        }
    }
    int c=0;
    memset(check,0,sizeof check);
    for(int i=3;i<100005;i++){
        int h=(i+1)/2;
        if(prime[i]==1 && prime[h]==1){
            c++;
            check[i]=c;
        }
    check[i]=c;
    }

}

int main()
{
    int n,m,c=0,t;
    sieve();
    cin>>t;
    while(t--){
    cin>>n>>m;
   int p=n-1;
   c=check[m]-check[p];


    cout<<c<<endl;
    c=0;
    }

}


Measured memory_bytes: 1408
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m; 
const int mod=1e9+7;
const ll MOD=1e9+7;
int dp[103][10004];
int main(){
	ll a=1;
	cin>>n>>m;
	for (int i=0;i<n-1;i++) a=a*(m+1)%MOD;
	dp[n+1][0]=1;
	for (int i=n;i>=1;i--)
		for (int j=0;j<=m;j++)
			for (int k=0;k<=10000;k++){	
				if (j>i){
					dp[i][k]=(dp[i+1][k]+dp[i][k])%mod;
					continue;
				}
				int x=(j+k)/i;
				if (x+k>10000) continue;
				dp[i][x+k]=(dp[i+1][k]+dp[i][x+k])%mod;
			}
	ll res=a*m*(m+1)/2*n%MOD;
	for (int i=0;i<=10000;i++)
		res=(res-1ll*dp[1][i]*i+MOD)%MOD;
	cout<<res;
}

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

int main(){
  int n;
  cin >> n;
  int m,oth=0;
  vector<int>iro(8,0);
  for(int i=0;i<n;i++){
    cin >> m;
    if(m<3200){
      iro.at(m/400)++;
    }else{
      oth++;
    }
  }
  int ans=0;
  for(int i=0;i<8;i++){
    if(iro.at(i)>0)
      ans++;
  }
  cout << max(ans,1) << " " << ans+oth << endl;
  return 0;
}

Measured memory_bytes: 3552
#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<cstring>
using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
/////////////////////

int const N = 2e5 + 41;

int n;
char s[N];
deque<int> p[N];
int q[N];
ll ans;
vector<pii> a;
int b[N];

int F[N];

void upd(int x, int v){
	while(x < N){
		F[x] += v;
		x |= (x + 1);
	}
}

int get(int x){
	int res = 0;
	while(x >= 0){
		res += F[x];
		x = (x&(x+1))-1;
	}
	return res;
}

void solve(){
	n = strlen(s);
	fi(0, n) p[s[i]-'a'].pb(i);
	int m = 0;
	fi(0, N) m += (sz(p[i]) & 1);
	if(m > 1){
		ans = -1;
		return;
	}
	int k = -1;
	fi(0, N){
		while(sz(p[i]) > 1){
			int x = p[i].front();
			int y = p[i].back();
			p[i].pop_front();
			p[i].pop_back();
			a.pb(mp(x, y));
		}
		if(sz(p[i])) k = p[i].back();
	}
	sort(a.begin(), a.end());
	if(k != -1) b[k] = n / 2;
	fi(0, sz(a)) b[a[i].first] = i, b[a[i].second] = n-1-i;
	fi(0, n){
		ans += get(n-1) - get(b[i]);
		upd(b[i], 1);
	}
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	scanf("%s",s);

	solve();

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


	return 0;
}

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

int main()
{
	std::string song_name[50],X;
	int N, t[50],j=0,total_t=0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> song_name[i];
		cin >> t[i];
	}
	cin >> X;


	while(X.compare(song_name[j])!=0) {
		j++;
	}

	for (int k = j + 1; k < N; k++) {
		
		total_t += t[k];
	}

	cout << total_t << endl;
}

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;

using P = pair<ll,ll>;
#define v first
#define w second

// v高い順（vが同じならw軽い方優先）
bool comp(P a, P b){
    return a.v == b.v ? a.w < b.w : a.v > b.v;
}

int main(void){
    ll N,W;
    cin>>N>>W;
    vector<P> a(N);
    rep(i,N){
        ll v,w;
        cin>>v>>w;
        a[i] = {v,w};
    }
    vector<P> dp = {{0,0}};

    rep(i,N){
        vector<P> tmp;
        for(P s : dp){
            tmp.push_back(s);
            tmp.push_back({s.v + a[i].v, s.w + a[i].w});
        }

        sort(all(tmp),comp);
        dp.clear();
        ll w_border = W+1;
        for(P s : tmp){
            if( w_border > s.w){
                w_border = s.w;
                dp.push_back(s);
            }
        }
        assert((ll)dp.size() <= N*N*2);
    }
    cout<<dp[0].v<<endl;
    return 0;
}



Measured memory_bytes: 3268
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int a = in.Int();
            out.println(a + a * a + a * a * a);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 32648
using System;
using System.Linq;
using System.Collections.Generic;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    int N=int.Parse(Console.ReadLine());
    if(N<1200){
     Console.WriteLine("ABC");
      
    }else{
      Console.WriteLine("ARC");
    }
      
    }
    
  }

}


Measured memory_bytes: 26952
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
using namespace std;

long long power(long long a, long long b) {
    //a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
    }
  ll int binomial(ll int n, ll int k) 
{ 
    ll int C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll int i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (int j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 
  vector<int> pr;
void Sieve(ll int n) 
{ 
    bool prime[10000000];
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            pr.push_back(p);
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
}
 

int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
  
// Function to find gcd of array of 
// numbers 
int find(int arr[], int n) 
{ 
    int result = arr[0]; 
    for (int i = 1; i < n; i++) 
    { 
        result = gcd(arr[i], result); 
  
        if(result == 1) 
        { 
           return 1; 
        } 
    } 
    return result; 
} 


//It reurns Fn,Fn+1
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}


  
int main() {
  string s,t;
  cin>>s>>t;
  int l=0;
  for(int i=0;i<s.length();i++)
  {
      if(s[i]!=t[i])
      {
          l++;
      }
  }
  cout<<l<<endl;
 
}


Measured memory_bytes: 3920
def main():
    s = input()
    d = [0]*2019
    d[0] += 1
    now = 0
    for j, i in enumerate(s[::-1]):
        now = (int(i)*pow(10, j, 2019)+now) % 2019
        d[now] += 1
    print(sum([i*(i-1)//2 for i in d]))


main()

Measured memory_bytes: 9232
##E
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

psum = 0

for i in range(X):
        r.append(p[i])
for i in range(Y):
        r.append(q[i])
        
r.sort(reverse=True)
ans = 0

for i in range(X+Y):
		ans += r[i]

        
print(ans)

Measured memory_bytes: 23328
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

signed main()
{
  string S;
  cin >> S;
  int N = S.size();

  int lose = 0;
  for (int i = 0; i < N; i++)
  {
    if (S.at(i) == 'x') lose++;
  }
  
  string ans = "YES";
  if (lose >= 8) ans = "NO";
  
  cout << ans << endl;
}

Measured memory_bytes: 256
def knapsack(N, W, l):    
    dp = [[0]*(W+1) for _ in range(N+1)]
    for j in range(1, W+1):
        for i in range(1, N+1):
            v = l[i-1][0]
            w = l[i-1][1]
            if j-w < 0:
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = max(dp[i-1][j-w] + v, dp[i-1][j])
    return dp[N][W]

N, W = [int(_) for _ in input().split()]
l = [[0]* 2 for _ in range(N)]
for i in range(N):
    l[i][0],l[i][1] = [int(_) for _ in input().split()]
ans = knapsack(N, W, l)
print(ans)


Measured memory_bytes: 41900
N, K = [int(x) for x in input().split(" ")]
lst = [int(x) for x in input().split(" ")]

dic= {}
cnt = 0 
swap = 0
prep = len(set(lst))-K

for i in range(1,N+1):
	dic["{}".format(i)] = 0

for i in range(0,N):
	dic["{}".format(lst[i])] += 1

sorted_dic = sorted(dic.items(), key = lambda x : x[1])
    
for i in range(0,N):
  swap += sorted_dic[i][1]
  if sorted_dic[i][1] != 0:
    cnt +=1
  if cnt >= prep:
    break
      
print(swap)

Measured memory_bytes: 59264
# -*- coding:utf-8 -*-

s1 = input()
s2 = input()
f = 0

for i in range(len(s1)):
    s = s1[i:len(s1)] + s1[0:i]
    if s == s2:
        f = 1
        break
if f == 1:
    print("Yes")
elif f == 0:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define INTXT std::ifstream in ("input.txt"); std::cin.rdbuf(in.rdbuf());
#define INF 1e9

using namespace std;
typedef long long ll;
static const ll MOD = 1000000007LL;

signed main() {
  IOS
  int a, b, t;
  cin >> a >> b >> t;
  cout << b * (t / a) << endl;
}


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

#ifdef DEBUG
#include "../include/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

const long long mod = 1e9+7;
long long dp[2100][2100];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("_input.txt");

    int N, M;
    cin >> N >> M;

    vector<long long> S(N), T(M);
    for (int i=0; i<N; ++i) cin >> S[i];
    for (int i=0; i<M; ++i) cin >> T[i];

    // init
    for (int i=0; i<=N; ++i) dp[i][0] = 1;
    for (int i=0; i<=M; ++i) dp[0][i] = 1;

    for (int i=1; i<=N; ++i) {
        for (int j=1; j<=M; ++j) {
            if (i>0) dp[i][j] += dp[i-1][j];
            if (j>0) dp[i][j] += dp[i][j-1];
            if (S[i-1] != T[j-1] && i>0 && j>0) {
                dp[i][j] += mod - dp[i-1][j-1];
            }
            dp[i][j] %= mod;
        }
    }
    cout << dp[N][M] << endl;

    return 0;
}


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

int main(void) {
	int n;

	cin >> n;

	if (n % 2 == 0 )
	{
		cout << n / 2 << endl;
	}
	else
	{
		cout << n /2 + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
typedef pair<int,int> P;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i, n) for (lint i = 0; i < (n); i++)
#define INF LLONG_MAX
#define all(x) (x).begin(),(x).end()
#define pb push_back
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int i=max(max(a,b),max(b,c));
    int k=min(min(a,b),min(b,c));
    cout<<i-k<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    string s;
    cin >> s;
    int n = s.length();
    int ans = 0;
    int cnt0 = 0, cnt1 = 0;
    for(int i = 0; i < n; ++i){
        if(s[i] == '0'){
            if(cnt1 > 0){
                ans += 2;
                --cnt1;
            }
            else    ++cnt0;
        }
        else{
            if(cnt0 > 0){
                ans += 2;
                --cnt0;
            }
            else    ++cnt1;
        }
    }
    cout << ans << endl;
}

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

int main()
{
    long long N,A,B;

    cin>>N>>A>>B;

    long long ans = A * (N / (A + B)) + min((N % (A + B)),A);

    cout<<ans<<endl;
    cin>>N;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<deque>
using namespace std;
const int dx[4]={1,-1,0,0};
const int dy[4]={0,0,1,-1};
constexpr long mod=1000000007;



int main(){
	int n,m,ai;
	cin>>n>>m;
	vector<bool>a(n,true);
	for(int i=0;i<m;i++){
		cin>>ai;
		a[ai]=false;
	}
	vector<long>dp(n+10,0);
	dp[0]=1;
	for(int i=1;i<=n;i++){
		if(a[i]){
			if(a[i-1]){
				dp[i]+=dp[i-1];
			}
			if(i-2>=0){
				if(a[i-2]){
					dp[i]+=dp[i-2];
				}
			}
		}
		dp[i]%=mod;
	}
	cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2e5 + 123;
int n, a[N], pos[20];
vector <int> b[20];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		for (int j = 0; j < 20; j++)
			if (a[i] >> j & 1)
				b[j].pb(i);
	}
	ll res = 0;
	for (int i = 1; i <= n; i++) {
		int r = n;
		for (int j = 0; j < 20; j++) {
			if (pos[j] < (int)b[j].size() && b[j][pos[j]] < i)
				pos[j]++;
			if (pos[j] < (int)b[j].size() - 1)
				r = min(r, b[j][pos[j] + 1] - 1);
		}
		res += r - i + 1;
	}
	cout << res;
}


Measured memory_bytes: 12112
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)     for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = m; i <= (int)(n); i++)
#define MOD 1000000007
#define Graph vector<vector<int>>
typedef pair<int, int> PII;
typedef long long int ll;

int main(){
  string S,T,U;
  int A,B;

  cin >> S >> T;
  cin >> A >> B;

  cin >> U;

  if(S == U){
    A -= 1;
  }else if(T == U){
    B -= 1;
  }

  cout << A << " " << B << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
using ll=long long;
const ll MOD=100000007;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=b-1;i>=a;i--)
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}
inline long double median(vector<ll> v){
    ll size=v.size();
    sort(v.begin(),v.end());
    if (size % 2 == 1) return v[(size - 1) / 2];
    else return (v[(size / 2) - 1] + v[size / 2]) / 2;
}


int main(){
    ll n,k;
    cin>>n>>k;
    long double ans=0;
    rep(i,0,n){
        ll cnt=1;
        long double ansi=1;
        while((i+1)*cnt<k){
            ansi*=0.5;
            cnt*=2;
        }
        ans+=ansi;
    }
    cout<<fixed<<setprecision(10)<<ans/n;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    string s;
    cin >> s;

    int n = SZ(s);
    //vector<P> l, r;
    vector<int> ans(n);

    int l, r;
    int cntR = 0;
    int cntL = 0;
    bool isR = true;
    rep(i, n){
        if(s[i] == 'R'){
            if(isR){
                r = i;
            }else{
                isR = true;

                int sum = cntR + cntL;
                ans[l] = ans[r] = sum / 2;
                if(sum % 2){
                    if(cntR > cntL){
                        ans[r]++;
                    }else{
                        ans[l]++;
                    }
                }

                if((max(cntR, cntL) - 1) % 2){
                    swap(ans[l], ans[r]);
                }

                cntR = 0;
                cntL = 0;
                r = i;
            }
            cntR++;
        }else{
            if(isR){
                l = i;
                isR = false;
            }
            cntL++;
        }
    }
    int sum = cntR + cntL;
    ans[l] = ans[r] = sum / 2;
    if(sum % 2){
        if(cntR > cntL){
            ans[r]++;
        }else{
            ans[l]++;
        }
    }

    if((max(cntR, cntL) - 1) % 2){
        swap(ans[l], ans[r]);
    }

    rep(i, n){
        cout << ans[i] << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 1472
from functools import reduce
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))


lcm = A[0]
for a in A[1:]:
    lcm = lcm * a // gcd(lcm, a)


MOD = 10 ** 9 + 7
lcm %= MOD
ans = 0
for a in A:
    ans += lcm * pow(a, MOD-2, MOD)
    ans %= MOD

print(ans)


Measured memory_bytes: 67416
import sys

n, y = map(int, input().split())

for bill10000 in range(n + 1):
    for bill5000 in range(n - bill10000 + 1):
        bill1000 = n - bill10000 - bill5000
        if bill10000 * 10000 + bill5000 * 5000 + bill1000 * 1000 == y:
            print(bill10000, bill5000, bill1000)
            sys.exit()
print(-1, -1, -1)


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

using namespace std;


int main(void) {
	int n;

	while (cin >> n) {
		n = n % 39 == 0 ? 39 : n % 39;
		cout << "3C" << setw(2) << setfill('0') << n << endl;
	}

	return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    if(s.compare("abc") == 0){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(r <= x&&x <= W-r&&r <= y&&y <= H-r){
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2144
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int a[m],b[m],c[m];
    vector<vector<int>>d(n,vector<int>(n,1000000000));
    for(int i=0;i<n;i++)d[i][i]=0;
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i]>>c[i];
        a[i]--;
        b[i]--;
        d[a[i]][b[i]]=c[i];
        d[b[i]][a[i]]=c[i];
    }
    for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++)d[i][j]=min(d[i][j],d[i][k]+d[j][k]);
    bool use[m]={};
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                if(d[j][k]==d[j][a[i]]+c[i]+d[b[i]][k] || d[j][k]==d[j][b[i]]+c[i]+d[a[i]][k]){
                    use[i]=1;
                }
            }
        }
    }
    int ans=0;
    for(int i=0;i<m;i++)if(use[i]==0)ans++;
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

const int N=1e3+10;

int n, a[N], sum[N], ans=0x3f3f3f3f;

int main() {
	cin>>n;
	for(int i=1; i<=n; i++) {
		cin>>a[i];
		sum[i]=sum[i-1]+a[i];
	}
	for(int i=1; i<=n-1; i++) {
		ans=min(ans, abs(sum[i]-(sum[n]-sum[i])));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return float64(i)
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

const Mod = 1000000007

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func main() {
	sc.Split(bufio.ScanWords)
	a, b, c := readInt(), readInt(), readInt()

	if a-b-c >= 0 {
		fmt.Println(0)
	} else {
		fmt.Println(c - (a - b))
	}
}


Measured memory_bytes: 640
break_offs = set()
N, M = map(int, input().split())
for i in range(M):
    a, b = map(int, input().split())
    if a > b:
        a, b = b, a
    break_offs.add((a, b))

covered = []
break_offs = sorted(list(break_offs), key=lambda x:x[1])
for a, b in break_offs:
    found = False
    for area in covered:
        if not (area[0] >= b or area[1] <= a):
            covered.remove(area)
            covered.append((max(area[0], a), min(area[1], b)))
            found = True
            break

    if not found:
        covered.append((a, b))


answer = len(covered)
print(answer)

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

int main(){
    string s, t;
    cin >> s >> t;
    int len = s.size();
    for(int i = 0; i < len; i++)
    {
        if (s == t) {
            cout << "Yes" << endl;
            return 0;
        }
        else
        {
            s = s[len-1] + s;
            s.pop_back();
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

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

    ll ans = INF;
    REP(i, n) {
        ll a;
        cin >> a;

        ll count = 0;
        while(a % 2 == 0) {
            count++;
            a /= 2;
        }
        ans = min(ans, count);
    }

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

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int i=1 ,x ;
	
	while(scanf("%d",&x))
	{
		
		if(x == 0)
		{ 
		    break ;
		}
		
		
			printf("Case %d: %d\n",i++ , x);
		
	}
	
	
	
	 
	
	
	
	return 0;
	
	
 } 


Measured memory_bytes: 2576
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
#include <cstdio>
#include <stack>
#include <list>
#include <iomanip>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;
template <class T> T gcd(T n, T m){return m ? gcd(m, n%m):n;}

int main(){
    int n;cin >> n;
    vector<int> x(n), y(n);
    rep(i,n){ cin >> x[i] >> y[i];}
    double sum = 0;
    rep(i,n){
        rep(j,n){
            sum += sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]));
        }
    }
    double de = 1;
    // rep(i,n){de *= i+1;}
    // cout << sum/(double)n << endl;
    // cout << fixed;
    // cout << setprecision(10) << sum/(double)n; // "3.1"
    cout<<fixed<<setprecision(10)<<sum/(double)n;
}

Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    string[] itos;
    void init(string S)
    {
        if (S.length == 3)
        {
            itos ~= S;
            return;
        }
        foreach (c; "ACGT")
            init(S ~ c);
        return;
    }

    init("");
    long M = itos.length;

    long[string] stoi;
    foreach (i; 0 .. M)
        stoi[itos[i]] = i;

    auto dp = new long[][](N + 1, M);

    foreach (i; 0 .. M)
    {
        dp[3][i] = (itos[i] != "AGC" && itos[i] != "ACG" && itos[i] != "GAC");
    }

    foreach (i; 3 .. N)
    {
        foreach (j; 0 .. M)
        {
            if (itos[j] == "AGC" || itos[j] == "ACG" || itos[j] == "GAC")
                continue;
            foreach (c; "ACGT")
            {
                string s4 = itos[j] ~ c;
                // writeln(s4);
                string s3 = s4[1 .. $];
                if (s3 == "AGC" || s3 == "ACG" || s3 == "GAC")
                    continue;
                if (s4[0] == 'A' && s4[2 .. $] == "GC")
                    continue;
                if (s4[0 .. 2] == "AG" && s4[$ - 1] == 'C')
                    continue;
                dp[i + 1][stoi[s3]] += dp[i][j];
                dp[i + 1][stoi[s3]] %= MOD;
            }
        }
        // writeln(dp[i]);
    }

    long ans;
    foreach (a; dp[N])
        ans = (ans + a) % MOD;

    writeln(ans);
}


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

int main(){
  //input 入力
  int n,m;cin >> n >> m;
  int x[m],y[m];rep(i,m)cin >> x[i] >> y[i];

  //solve 処理
  int ans = 0;
  int num[n];rep(i,n)num[i] = 1; //_1
  int red[n];rep(i,n)red[i] = 0; //_2
  red[0] = 1; //_3
  rep(i,m){
    if(num[x[i]-1] != 0 && red[x[i]-1] == 1)red[y[i]-1] = 1;//_4
    num[x[i]-1] -= 1;num[y[i]-1] += 1;
    if(num[x[i]-1] == 0)red[x[i]-1] = 0;//_5
  }
  rep(i,n)if(red[i] == 1)ans += 1;
  
  //output 出力
  cout << ans << endl;
  return 0;
  
}

/*description 説明
_1:the number of balls box[i] has.
   箱[x]が持っているボールの数
_2:he number of the boxes which probably has red balls.
   赤いボールが中にある可能性がある箱の数
_3:box[0] always has a red ball at first.
   箱[0]は最初いつも赤いボールを持っている
_4:if the red ball is in the box[x[i]], box[y[i]] will be also has a red ball.
   箱[x[i]]に赤いボールがある場合,箱[y[i]]も赤いボールを持つだろう
_5:if no balls in the box[x[i]], red[x[i]] is certainly has no red balls.
   箱[x[i]]にボールが入っていなかったら箱[y[i]]には赤いボールは確実にない
*/

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

using ll = long long;

template<typename T>
T gcd(T a, T b)
{
	if (a < b)	return gcd(b, a);
	T r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}

template<typename T>
T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

template<typename T>
T ext_gcd(T a, T b, T& x, T& y)
{
	x = 1;
	y = 0;
	T x0 = 0, y0 = 1;
	while (b != 0)
	{
		T q = a / b;
		a -= q * b;
		swap(a, b);
		x -= q * x0;
		swap(x, x0);
		y -= q * y0;
		swap(y, y0);
	}
	return a;
}

template<typename T>
T inv_mod(T a, T mod)
{
	T t1, t2;
	ext_gcd(a, mod, t1, t2);
	t1 %= mod;
	if (t1 < 0)		t1 += mod;
	return t1;
}

template<typename T>
T combination_large(T n, T k, T mod)
{
	if (n < k || n < 0 || k < 0)	return 0;
	vector<T> inv(n + 1, 1), fact(n + 1, 1), fact_inv(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}
	return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

template<typename T>
T combination(T n, T k, T mod = 1)
{
	vector<vector<T>> table(n + 1, vector<T>(k + 1, 1));
	for (T i = 1; i <= n; ++i)
	{
		table[i][0] = 1;
		for (T j = 1; j <= n; ++j)
		{
			table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
		}
	}
}


int main(int, char**)
{
	long long N;
	scanf("%lld",&N);
	long long K;
	scanf("%lld",&K);

	cout << static_cast<ll>(log(N) / log(K)) + 1 << endl;

	return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
  int N,ans=0,A[15],x[15][14],y[15][14];
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> A[i];
    for(int k=0;k<A[i];k++){
      cin >> x[i][k] >> y[i][k];
      x[i][k]--;
    }
  }

  for(int bits=0;bits< (1<<N);bits++){
    bool flag=true;
    for(int i=0;i<N;i++){
      if((bits&(1<<i))==0)continue;
      for(int k=0;k<A[i];k++){
        if( ((bits&(1<<x[i][k]))>0) ^ (y[i][k])  )flag=false;
      }
    }
    
    if(flag){
      int cnt=0;
      for(int i=0;i<N;i++){
        if(bits&(1<<i))cnt++;
      }
      ans=max(ans,cnt);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int t = sc.nextInt();
    int a = sc.nextInt();
    double minDif = Double.MAX_VALUE;
    int minPoint = 0;
    for (int i = 0;i < n;i ++) {
      int h=sc.nextInt();
      double averageT = t - (h * 0.006);
      double dif = Math.abs(a - averageT);
      if (dif < minDif) {
        minDif=dif;
        minPoint=i;
      }
    }
    System.out.println(minPoint+1);
  }
}

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

using namespace std;
using ll = long long;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    if((A - B)%2) {
        cout << min(A + B - 1,2*N - A - B + 1)/2 << endl;
    } else {
        cout << abs(A - B)/2 << endl;
    }

    return 0;
}

Measured memory_bytes: 3568
#include<iostream>
#include<string>
#include<algorithm>
#include<map>

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

int main() {
	long long n, x;

	std::cin >> n >> x;

	std::cout << 3 * (n - gcd(n, x)) << std::endl;
	return 0;
}

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

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

    double a[n],x,y,ans(0.0),sum(0.0),l;
    rep(i,n){
        cin >> a[i];
        sum += a[i];
    }
    x = n;  y = m;

    l = sum/(4*y);

    rep(i,n){
        if(a[i]>=l){
            ans++;
        }
    }

    if(ans>=m){
        puts("Yes");
    }else{
        puts("No");
    }

    return 0;
}

Measured memory_bytes: 256
s = input()

if s[0] == s[1] and s[1] != s[2] and s[2] == s[3]:
	print("Yes")
elif s[0] != s[1] and s[0] == s[2] and s[2] != s[3]:
	print("Yes")
elif s[0] != s[1] and s[1] == s[2] and s[2] != s[3]:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3064
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
ll gcd(ll a,ll b){
    if(b==0) return a;
    if(a==0) return b;
    if(a>=b){
        return gcd(b,a%b);
    }
    else{
        return gcd(a,b%a);
    }
}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll a,b;
    cin >> a >> b;
    cout << a*b/gcd(a,b);

    return 0;
}

Measured memory_bytes: 3652
#include"bits/stdc++.h"
//#include<boost/multi_array.hpp>
//#include<boost/optional.hpp>
//#include<boost/range/irange.hpp>
//#include<boost/range/algorithm.hpp>
//#include<boost/range/adaptors.hpp>

using namespace std;
//namespace adaptor = boost::adaptors;

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

long long Pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret *= x;
        x *= x;
        n >> 1;
    }
    return ret;
}

void Main()
{
    int a, b, k;
    cin >> a >> b >> k;
    bool choku = true;
    for(int i = 0; i < k; i++){
        if(i % 2 == 0){
            if(a % 2 == 1){
                a--;
                b += a/2;
                a = a/2;
            }else{
                b += a/2;
                a = a/2;
            }
            choku = false;
        }
        if(i % 2 == 1){
            if(b % 2 == 1){
                b--;
                a += b/2;
                b = b/2;
            }else{
                a += b/2;
                b = b/2;
            }
            choku = true;
        }
        //cout << a << " " << b << endl;
    }
    cout << a << " " << b << endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s[1]=='R')
	{
		if(s[0]=='R'&&s[2]=='R')
			cout<<3;
		else if(s[0]=='R'||s[2]=='R')
			cout<<2;
		else
			cout<<1;
	}
	else
	{
		if(s[0]=='R'||s[2]=='R')
			cout<<1;
		else
			cout<<0;
	}
	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
using namespace std;
int  partition(int A[],int n,int p,int r){

	int i=p;
	int x=A[r];
	for(int j=p;j<r;j++){
		if(A[j]<=x){
			
			int t=A[j];
			A[j]=A[i];
			A[i]=t;
			++i;
		}
	}
	A[r]=A[i];
	A[i]=x;

	return i;
}
int main(){
	int n;
	cin>>n;
	int *A=new int[n];
	for(int i=0;i<n;i++)cin>>A[i];

    int q=partition(A,n,0,n-1);
 
    for(int i=0;i<n;i++){
    	if(i>0)cout<<' ';
    	if(i==q)cout<<"[";
    	cout<<A[i];
        if(i==q)cout<<"]";
    }
    cout<<endl;

    return 0;
}


Measured memory_bytes: 3448
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

//const long long int MOD = 1000000007;
const int MOD = 1000000007;
//const int MOD = 998244353;
//const long long int MOD = 998244353;

//long long int N, M, K, H, W, L, R;
int N, M, K, H, W, L, R;

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

	cin >> N;
	double r, t;
	cin >> r >> t;
	t *= 3.14159265358979;
	t /= 180;
	vector<pair<double, double>>v(N);
	for (auto &i : v)cin >> i.first >> i.second;
	vector<vector<double>>dis(N, vector<double>(N));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			dis[i][j] = sqrt(pow(v[i].first - v[j].first, 2) + pow(v[i].second - v[j].second, 2));
		}
	}
	vector<vector<vector<vector<double>>>>rad(N, vector<vector<vector<double>>>(N,vector<vector<double>>(N,vector<double>(N))));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (i == j)continue;
			for (int k = 0; k < N; k++) {
				if (i == k || j == k)continue;
				//cout << i << " " << j << " " << j << " " << k << endl;
				double a = (dis[i][k] * dis[i][k] - dis[i][j] * dis[i][j] - dis[j][k] * dis[j][k]) / -2 / dis[i][j] / dis[j][k];
				if (a >= 1)a = 1;
				if (a <= -1)a = -1;
				rad[i][j][j][k] = acos(a);
				//cout << rad[i][j][j][k] << endl;
			}
		}
	}
	vector<vector<vector<double>>>dp(N, vector<vector<double>>(N, vector<double>(10001, -100000)));
	for (int i = 1; i < N; i++) {
		dp[0][i][1] = r - dis[0][i];
	}
	int ans = 0;
	for (int i = 1; i <= 9999; i++) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < N; k++) {
				if (j == k)continue;
				if (dp[j][k][i] < 0)continue;
				ans = max(ans, i);
				for (int l = 0; l < N; l++) {
					if (j == l || k == l)continue;
					if (rad[j][k][k][l] + t<=3.14159265358979)continue;
					//cout << j << " " << k << " " << l << endl;
					//cout << rad[j][k][k][l] << " " << t << endl;
					dp[k][l][i + 1] = max(dp[k][l][i + 1], dp[j][k][i] - dis[k][l]);
				}
			}
		}
	}
	cout << ans << endl;
}


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

int main()
{
    string S;
    cin >> S;
    if(S[0] != S[1] && S[1] != S[2] && S[0]!=S[2]){
            cout << "Yes" << endl;
    }else{
            cout << "No" << endl;
    }
    return 0;
}


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

int main(){
  int i,j,cnt=0;
  ll n,p;
  cin>>n>>p;
  if(n==1){
    cout<<p;
    return 0;
  }
  ll a[50];
  for(i=2;i<=(int)round(sqrt(p));i++){
    if(p%i==0){
      a[cnt++]=i;
      p/=i;
      i=1;
    }
  }
  a[cnt++]=p;
  int m=cnt;cnt=1;
  ll b[m];
  b[0]=a[0];
  for(i=1;i<m;i++){
    if(a[i-1]!=a[i])b[cnt++]=a[i];
  }
  int c[cnt];
  for(i=0;i<cnt;i++)c[i]=0;
  for(i=0;i<cnt;i++){
    for(j=i;j<m;j++){
      if(b[i]==a[j])c[i]++;
      else if(b[i]<a[j])break;
    }
  }
  ll prod=1;
  for(i=0;i<cnt;i++){
    for(j=0;j<c[i]/n;j++){
      prod*=b[i];
    }
  }
  cout<<prod;
}

Measured memory_bytes: 256
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input())
    A = list(int(_) for _ in input().split())
    A = [0] + A
    A.append(0)
    ans = []
    A_sum = 0
    for i in range(len(A)):
        A_sum+=abs(A[i]-A[i-1])
    for i in range(1,N+1):
        tmp = A_sum - abs(A[i]-A[i-1]) - abs(A[i+1]-A[i]) + abs(A[i+1]-A[i-1])
        ans.append(tmp)
    print('\n'.join(str(_) for _ in ans))
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 19536
def is_harshad_number(x: int) -> bool:
    dividend = x
    sum_of_digits = 0

    for _ in range(len(str(x))):
        x, mod = divmod(x, 10)
        sum_of_digits += mod

    return dividend % sum_of_digits == 0


def answer(x: int) -> str:
    return 'Yes' if is_harshad_number(x) else 'No'


def main():
    x = int(input())
    print(answer(x))


if __name__ == '__main__':
    main()

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

int main() {
  int X,N;
  cin >> X >> N;
  vector<int> vec(N);
  for (int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  int a=X,b=X;
  for (int i=0;i<N;i++){
    if(find(vec.begin(),vec.end(),a)!= vec.end()){
      a--;
    }
    else{
      break;
    }
  }
  for (int i=0;i<N;i++){
    if(find(vec.begin(),vec.end(),b)!= vec.end()){
      b++;
    }
    else{
      break;
    }
  }
  if(X-a<=b-X){
    cout << a << endl;
  }
  else{
    cout << b << endl;
  }
 
}

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    private static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(final String[] args) throws IOException {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out, true);

        int n = in.nextInt();
        int answer = 0;

        String[] tokens = in.nextLine().split(" ");
        for (int i = 1; i <= n; i++) {
            int value = Integer.parseInt(tokens[i - 1]);
            if ((i % 2) == 1 && (value % 2) == 1) {
                answer++;
            }
        }
        out.println(answer);
    }
}


Measured memory_bytes: 32708
#include<bits/stdc++.h>
using namespace std;
vector<int>vec;
set<int>st;
int main()
{
    int i,j,n,t,a,b,c;
    string s,s1,s2;
    cin>>a>>b>>c;
    if(a+b==c||a+c==b||b+c==a)
        cout<<"Yes"<<"\n";
    else
        cout<<"No"<<"\n";



return 0;
}


Measured memory_bytes: 3612