akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <math.h>

#include <boost/format.hpp>
using namespace std;

int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    int count = 0;
    for (int i = 0;i < 1000; i++){
         string ss = s;
         string str;
         if (i < 10) {
            str = "00" + std::to_string(i);
         } else if (i < 100) {
            str = "0" + std::to_string(i);
         } else {
            str = std::to_string(i);
         }
       
         int a1 = ss.find_first_of(str.substr(0,1));
         if (a1 == std::string::npos){
             continue;
         }
         ss = ss.substr(a1 + 1);
         int a2 = ss.find_first_of(str.substr(1,1));
         if (a2 == std::string::npos){
             continue;
         }      
         ss = ss.substr(a2 + 1);
         int a3 = ss.find_first_of(str.substr(2,1));
         if (a3 == std::string::npos){
             continue;
         }
      
         count++;
    }
  
    cout << count << endl;

}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
using namespace std;
int a[200010];
int main()
{
    set <int> s;
    int n;
    scanf("%d",&n);
    for(int i = 0;i < n;i++)
    {
        scanf("%d",&a[i]);
        s.insert(a[i]);
    }
    if(n != s.size())
        cout <<"NO" << endl;
    else
        cout << "YES" << endl;
    return 0;
}


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

int main(void){
  int N, M;
  bool success = false;
  cin >> N >> M;
  if(N == M)
    success = true;
  if(success) cout << "Yes" << "\n";
  else cout << "No" << "\n";
  return 0;
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

ll d[123][123];

int main(void){
	int n,m,a[1111],b[1111],i,j,k,ans=0;
	ll c[1111];
	cin >> n >> m;
	fill(d[0],d[123],INFLL);
	for(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(k=0; k<n; ++k){
		for(i=0; i<n; ++i){
			for(j=0; j<n; ++j){
				d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
			}
		}
	}
	for(i=0; i<m; ++i){
		if(d[a[i]][b[i]]<c[i]){
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
    int m, f, r; 
     cin>>m>>f>>r;
    while(!(m==-1 && f==-1 && r==-1)){
        if(m==-1 || f==-1) cout<<"F"<<endl;
        else if((m+f)>=80) cout<<"A"<<endl;
        else if((m+f)>=65 && (m+f)<80) cout<<"B"<<endl;
        else if((m+f)>=50 && (m+f)<65) cout<<"C"<<endl;
        else if((m+f)>=30 && (m+f)<50){
            if(r>=50){
                cout<<"C"<<endl;
            }
            else cout<<"D"<<endl;
        }
        else cout<<"F"<<endl;
        cin>>m>>f>>r;
    }
    
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;


int main(){
  string s;
  cin >> s;
  regex re ("(dream|dreamer|erase|eraser)*");
  cout << (regex_match(s,re)?"YES":"NO") << endl;

  return 0;
}

Measured memory_bytes: 39808
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

    int n;
    cin >> n;

    vector <int> cnt(3);

    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;

        int p = 0;
        while (x % 2 == 0) {
            x /= 2;
            ++p;
        }   

        p = min(p, 2ll);

        ++cnt[p];

    }   

    if (cnt[2] >= cnt[0] || (cnt[2] == cnt[0] - 1 && !cnt[1]))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3604
use proconio::{fastout, input};

use std::cmp::max;

#[fastout]
fn main() {
    input! {
        n: usize,
        aa: [i64; n]
    }
    const INF: i64 = 1_000_000_000_000;
    let mut t = (-INF, -INF, -INF, 0, -INF, -INF);
    for a in aa.iter() {
        t = (t.3 + a, t.4 + a, t.5 + a, t.0, max(t.3, t.1), max(t.4, t.2));
    }
    if n % 2 == 1 {
        println!("{}", max(t.2, t.4));
    } else {
        println!("{}", max(t.1, t.3));
    }
}


Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(5);
  rep(i, 5) cin >> a[i];
  sort(all(a));
  cout << (n + a[0] - 1) / a[0] + 4 << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

ll t1, t2, a1, a2, b1, b2, A1, A2, B1, B2, s[210000], now1, now2;
int main() {
	cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
	A1 = t1 * a1, A2 = t1 * b1, B1 = t1 * a1 + t2 * a2, B2 = t1 * b1 + t2 * b2;
	if (B1 == B2) {
		cout << "infinity" << endl;
		return 0;
	}
	if (A1 - A2 > 0 and B1 - B2 > 0) {
		cout << 0 << endl;
		return 0;
	}
	if (A1 - A2 < 0 and B1 - B2 < 0) {
		cout << 0 << endl;
		return 0;
	}
	ll y = abs(A1 - A2), x = abs(B1 - B2);
	if (y % x == 0) {
		cout << (y / x - 1) * 2 + 2 << endl;
	}
	else {
		cout << y / x * 2 + 1 << endl;
	}
}


Measured memory_bytes: 256
r, c = map(int, raw_input().split())

x = [map(int, raw_input().split()) for i in range(r)]

x.append([sum([x[i][j] for i in range(r)]) for j in range(c)])

for e1 in x:
    for e in e1:
        print e,
    print sum(e1)

Measured memory_bytes: 4292
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n;cin>>n;
  vector<pair<long long,long long>>t(n);
  for(int i=0;i<n;i++){
    cin>>t[i].second>>t[i].first;
  }
  sort(t.begin(),t.end());
  bool f=true;
  long long sum=0;
  for(int i=0;i<n;i++){
    sum+=t[i].second;
    if(t[i].first<sum){
      f=false;
      break;
    }
  }
  cout<<(f?"Yes":"No")<<endl;
}

Measured memory_bytes: 3456
n,m = list(map(int,input().split()))
s = n-m+1
a = []
for i in range(n):
    a.append(list(input()))

b = []
for i in range(m):
    b.append(list(input()))


ans = 'No'
for i in range(s):
    for j in range(s):
        flag = 0
        for k in range(m):
            if b[k] == a[i+k][j:j+m]:
                flag += 1
        if flag == m:
            ans = 'Yes'
            break

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define N 200001
#define ll long long
#define int ll 
#define pi pair<int , int>
#define pip pair<pair ,int>
#define mp make_pair 
#define f first
#define s second
#define mod 998244353
ll Mod(ll x, ll y, int p) 
{ll res = 1; x = x % p;
while (y > 0) 
{if(y & 1) res = (res*x) % p; 
y = y>>1;x = (x*x) % p; 
}return res; 
}
int* getlps(string pattern){
 int len = pattern.length();
 int * lps = new int[len];
 lps[0] = 0;
 int i = 1 , j = 0;
 while(i < len){
  if(pattern[i] == pattern[j]){
	  lps[i] = j+1;
   i++;
   j++;
  }
  else{
		if(j != 0){
		 j = lps[j-1];
		}
		else{
		 lps[i] = 0;
		 i++;
		}
  }
 }
 return lps;
}
class Triplet{
 public:
 int x ;
 int y ;
 int gcd;
};
Triplet extendedEuclid(int a , int b){
 if(b == 0){Triplet ans; ans.gcd = a;ans.x = 1;ans.y = 0;return ans;}
 Triplet smallAns = extendedEuclid(b , a%b);
 Triplet ans;
 ans.gcd = smallAns.gcd;
 ans.x = smallAns.y;
 ans.y = smallAns.x - (a/b)*smallAns.y;
 return ans;
}
int mmInverse(int a , int m){
 Triplet ans = extendedEuclid(a , m);
 return ans.x;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
int arr[n+1];
int min[n+1];
min[0] = INT_MAX;
for(int i = 1 ; i <= n ;i++){
	cin>>arr[i];
}
int cnt =0;
for(int i=  1 ; i <= n ;i++){
  if(min[i-1] > arr[i]){
      cnt++;
      min[i] = arr[i];
  }
  else{
   min[i] = min[i-1];
  }
}
cout<<cnt<<endl;
}


Measured memory_bytes: 3328
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Text;


namespace AtCoderDotNetCore
{
	class Program
	{
		static void Main(string[] args)
		{
			Question.Exec();
		}
	}

	public static class Question
	{
		public static void Exec()
		{
			var dn = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
			var d = dn[0];
			var n = dn[1];

			long answer = 0;
			if (n != 100) {
				if (d == 0) {
					answer = n;
				} else if (d == 1) {
					answer = 100 * n;
				} else {
					answer = 100 * 100 * n;
				}
			} else {
				if (d == 0) {
					answer = 101;
				} else if (d == 1) {
					answer = 100 * 101;
				} else {
					answer = 100 * 100 * 101;
				}
			}

			Console.WriteLine($"{answer}");
		}
	}
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N, M;
    cin >> N >> M;
    ll ans;
    if (N == 1 && M == 1) 
    {
        ans = 1;
    }
    else if (N == 1)
    {
        ans = max(0ll, M - 2);
    }
    else if (M == 1)
    {
        ans = max(0ll, N - 2);
    }
    else
    {
        ans = (N - 2) * (M - 2);
    }
    

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;

int main() {
    #ifdef LOCAL_RUN
    freopen("task.in", "r", stdin);
    freopen("task.out", "w", stdout);
    //freopen("task.err", "w", stderr);
    #endif // ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m = 100000;
    vector<int> cnt(m, 0);
    cin >> n;
    while (n-- > 0) {
        int x;
        cin >> x;
        cnt[x]++;
    }
    int ans = 0;
    for (int i = 1; i + 1 < m; ++i) {
        ans = max(ans, cnt[i - 1] + cnt[i] + cnt[i + 1]);
    }
    cout << ans << '\n';

}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main()
{
	int i=0,n,m=0,j=0,a[114];
	for(cin>>n;i<n;cin>>a[i++]);
	for(a[i]=0;j<100;j++)for(i=0;i<n;i++)m+=a[i]-->0&&a[i+1]<=0;
	cout<<m<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>

int main() {
    long long n, a, ret;
    std::cin >> n >> a;
    ret = n;
    for (auto k = 1ll; k <= 40; k++) {
        auto l = 0ll, r = n;
        while (r - l > 1) {
            auto mid = (l + r) / 2;
            if (std::log(n) / std::log(mid) >= k) l = mid;
            else r = mid;
        }
        auto m = 0ll;
        while (std::pow(l, k - m) * std::pow(r, m) < n) m++;
        ret = std::min(ret, l * (k - m) + r * m + (k - 1) * a);
    }

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

constexpr int MOD = 1'000'000'007;

void _main() {
  int N;
  string S;
  cin >> N >> S;

  vector<int> cnt(26, 1);
  fore(c, S) cnt[c-'a']++;

  int ans = 1;
  fore(x, cnt) {
    ans = 1ll * ans * x % MOD;
  }
  ans--;
  cout << ans << "\n";
}

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

int main(int argc, const char * argv[])
{
    while (1) {
        int n; cin >> n;
        if (n == 0) break;
        int result[2][n];
        for (int i = 0; i < n; i++) {
            int m1, s1, m2, s2, m3, s3, m4, s4;
            cin >> result[0][i] >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4;
            result[1][i] = m1*60 + s1 + m2*60 + s2 + m3*60 + s3 + m4*60 + s4;
        }
        for (int i = 0; i < n-1; i++) {
            for (int j = 0; j < n-1; j++) {
                if (result[1][j] > result[1][j+1]) {
                    int tmp[2];
                    tmp[0] = result[0][j];
                    tmp[1] = result[1][j];
                    result[0][j] = result[0][j+1];
                    result[1][j] = result[1][j+1];
                    result[0][j+1] = tmp[0];
                    result[1][j+1] = tmp[1];
                }
            }
        }
        cout << result[0][0] << endl << result[0][1] << endl << result[0][n-2] << endl;
    }
    return 0;
}

Measured memory_bytes: 1196
#include <stdio.h>

int main(int argc, char const *argv[]) {
	char str[101];
	int n, m;

	fgets(str, 100, stdin);
	sscanf(str, "%d\n", &n);

	m = n % 2 == 0 ? n : n * 2;

	printf("%d\n", m);

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    VI x = {a, b, c};
    sort(ALL(x));
    if(a % 2 == b % 2 and b % 2 == c % 2) {        
        cout << (x[2] - x[1]) / 2 + (x[2] - x[0]) / 2 << endl;
    } else {
        if(x[2] % 2 == x[1] % 2) x[0]--;
        else if(x[1] % 2 == x[0] % 2) x[2]--;
        else x[1]--;
        cout << (x[2] - x[1]) / 2 + (x[2] - x[0]) / 2  + 1 << endl;
    }
    return 0;
}


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

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double
#define pb push_back
#define mkpr make_pair
#define fi(i,a,b) for (int i=a;i<b;i++)
#define vll vector<ll>
#define vch vector<char>
#define vst vector<string>
#define vpll vector<pll>
#define vii vector<int>
#define vvl vector<vector<ll>>
#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define mxe(v) *max_element(v.begin(),v.end())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define mll map<ll, ll>
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)
#define nl "\n"
#define sp " "
#define sz(x)  (int)x.size()

using namespace std;

double PI = (acos(-1));
ll md = 1000000007;
//ll md = 998244353;
ll pw(ll a, ll b){ll c=1,m=a;while (b){if (b&1)c=(c*m);m=(m*m);b/=2;}return c;}
ll pwmd(ll a, ll b){ll c = 1, m = a;while (b){if (b & 1)c = ((c * m)) % md;m = (m * m) % md;b /= 2;}return c;}
ll modinv(ll n){return pwmd(n, md - 2);}
ll nc2(ll n){return (1ll * n * (n - 1)) / 2;}
ll nsum(ll n){return (1ll * n * (n + 1)) / 2;}
bool prime(ll a){for(int i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ceel(ll a,ll b){if(a%b==0) return a/b;else return a/b+1;}


#define MAX_SIZE 1005
void Sieve(vector<int> &primes){bool IsPrime[MAX_SIZE];memset(IsPrime, true, sizeof(IsPrime));
for (int p = 2; p * p < MAX_SIZE; p++){if (IsPrime[p] == true){
            for (int i = p * p; i < MAX_SIZE; i += p)IsPrime[i] = false;}}
    for (int p = 2; p < MAX_SIZE; p++)if (IsPrime[p])primes.push_back(p);}
        


vector<char> sml={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char> cap={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};



//---------VIPUL SHARMA----------\\


void solve(){
    ll n;
    cin>>n;
    vll dp(n+1,1);
    fi(i,2,n+1){
        for(ll j=i;j<=n;j+=i){
            dp[j]++;
        }
    }ll ans=0;
    fi(i,1,n)ans+=dp[i];
    cout<<ans<<nl;

}



int main(){
    //vector<int> primes;
    //Sieve(primes);

    fast
    ll tests=1;
    //cin>>tests;
    while(tests--){
        solve();
    }
    
    return 0;
}










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

vector<P>E[3000];
int d[3000];
int main() {
	int n, m, k; scanf("%d%d%d", &n, &m, &k);
	rep(i, m) {
		int a, b, l; scanf("%d%d%d", &a, &b, &l);
		a--; b--;
		E[a].push_back(P(l, b));
		E[b].push_back(P(l, a));
	}
	priority_queue<P, vector<P>, greater<P>>que;
	memset(d, 0x3f, sizeof(d));
	rep(i, k) {
		int s; scanf("%d", &s); s--;
		d[s] = 0;
		que.push(P(0, s));
	}
	while (!que.empty()) {
		P p = que.top(); que.pop();
		if (d[p.second] != p.first)continue;
		for (P u : E[p.second]) {
			if (d[u.second] > p.first + u.first) {
				d[u.second] = p.first + u.first;
				que.push(P(d[u.second], u.second));
			}
		}
	}
	double Max = 0;
	rep(i, n) {
		for (P u : E[i]) {
			for (double t = 0; t <= u.first; t += 0.5)
				Max = max(Max, min(d[i] + t, d[u.second] + u.first - t));
		}
	}
	printf("%d\n", (int)round(Max));
}

Measured memory_bytes: 6044
#include<stdio.h>
int main(void){
	int s,m,h,l;
	scanf("%d",&s);
	m=s/3600;
	h=(s-m*3600)/60;
	l=s-m*3600-h*60;
	printf("%d:%d:%d\n",m,h,l);
	return 0;
}

Measured memory_bytes: 592
from sys import stdin

def main():

    input = stdin.readline

    N,A,B = map(int,input().split())

    group_num = N // (A+B)

    amari = N % (A+B)
    amari_red = amari if  A >= amari else A

    # group_num * A
    ans_num = group_num * A + amari_red

    print(ans_num)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n,m; cin>>n>>m;
  cout << m*(m-1)/2+n*(n-1)/2;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
const double PI = acos(-1.0);
using namespace std;

int main()
{
    double a,b;
    double h,m;
    double s;
    cin >> a >> b >> h >> m;
	double c = abs(60 * h - 11 * m)/2;
    if(c>=180)
    {
        c = 360-c;
    }
    s = sqrt(a*a+b*b-2*a*b*cos(c / 180.0 * PI));
	printf("%.15f",s);  
    return 0;
}

Measured memory_bytes: 4212
# 2019-11-11 16:07:35(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

celebratable = [7, 5, 3]
def main():
    x = int(sys.stdin.readline().rstrip())
    print('YES' if x in celebratable else 'NO')
    



if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));
        String[] s1 = inp.readLine().split("");
        String[] s2 = inp.readLine().split("");

        solve(s1,s2);
    }
    static void solve(String[] x, String[] y){
        int[][] dp = new int[y.length+1][x.length+1];

        for(int i=1;i<=y.length;i++){
            for(int j=1;j<=x.length;j++){
                if(y[i-1].equals(x[j-1])){
                    dp[i][j] = dp[i-1][j-1]+1;

                }
                else{
                    dp[i][j] = Math.max(dp[i-1][j],dp[i][j-1]);
                }
            }
        }
//
//        for(int i=0;i<=y.length;i++){
//            for(int j=0;j<=x.length;j++){
//                System.out.print(dp[i][j]+" ");
//            }
//            System.out.println();
//        }
        ArrayList<String> list = new ArrayList<>();
        int max = dp[y.length][x.length];
        int a = x.length;
        int b = y.length;

        while (b>0 || a>0){
            if(max==0) {
                break;
            }
                //System.out.println(a + " " + b);
                if (dp[b][a - 1] == max) {
                    a--;
                } else if (dp[b - 1][a] == max) {
                    b--;
                } else {
                    a--;
                    b--;
                    list.add(y[b]);
                    max--;
                }

        }
        for(int i=0;i<list.size();i++){
            System.out.print(list.get(list.size()-1-i));
        }

    }
}


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

// bad knowhow
#define REP(i,n) for(long long i=0;i<(long long)n;++i)

struct Score {
	Score() {}
	Score(int c, int p) : collects(c), penalty(p) {}
	bool operator<(const Score & other) const {
		if (collects == other.collects){
			if (penalty == other.penalty) return id < other.id;
			return penalty < other.penalty;
		}
		return collects > other.collects;
	}
	int collects;
	long long penalty;
	int id;
};

int wrong[50][10];
bool collect[50][10];
Score score[50];


int main() {
	while (true) {
		fill(score, score + 50, Score(0,0));
		fill(*collect, *collect + 500, false);
		fill(*wrong, *wrong + 500, 0);

		int t, p, r;
		cin >> t >> p >> r;
		if (t == 0) break;

		REP(i, t) score[i].id = i;

		REP(i, r) {
			int tid, pid, time;
			string message;
			cin >> tid >> pid >> time >> message;
			tid--; pid--;
			if (collect[tid][pid]) continue;
			if (message == "CORRECT") {
				score[tid].collects++;
				collect[tid][pid] = true;
				score[tid].penalty += wrong[tid][pid] * 1200 + time;
			} else {
				wrong[tid][pid]++;
			}
		}

		sort(score, score+t);
		REP(i, t) {
			cout << score[i].id + 1 << " " << score[i].collects << " " << score[i].penalty << endl;
		}
	}
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, x, y, z;
map < string, int > id;
int f[ 5 ][ 5 ];
int a[ 2 ];

double tr( double x ) {
	return 1.0 * x / 180 * M_PI;
}

int g( int st, int l ) {
	double cycle = 1.0 + sqrt( 3.0 );
	double t = l;
	while ( t > cycle ) t -= cycle;
	if ( t < sqrt( 3.0 ) / 2.0 ) return st;
	else return 2;
}

int calc( int st, int ang, int l ) {
	if ( ang == 30 ) return g( st, l );
	
	double L1 = 1.0 * l * sin( tr( ang ) ) / sin( tr( 120 ) );
	double L2 = 1.0 * l * sin( tr( 60 - ang ) ) / sin( tr( 120 ) );
	int h = ( int )L1 + 1, t = ( int )L2;
	double r1 = L1 - h + 1, r2 = L2 - t;
	int num = t * 2;
	if ( 1.0 - r2 > r1 ) num++;
	else num += 2;
	if( h % 2 == 1 ) {
		num %= 4;
		if ( num == 0 ) return 4;
		else return num;
	}
	else {
		num = 5 - num % 4;
		if(num == 5) return 1;
		return num;
	}
}

string s;

int main(){


	id[ "BC" ] = 1, id[ "CD" ] = 3, id[ "DB" ] = 4;
	f[ 1 ][ 1 ] = 1, f[ 1 ][ 2 ] = 2, f[ 1 ][ 3 ] = 3, f[ 1 ][ 4 ] = 4;
	f[ 3 ][ 1 ] = 3, f[ 3 ][ 2 ] = 2, f[ 3 ][ 3 ] = 4, f[ 3 ][ 4 ] = 1;
	f[ 4 ][ 1 ] = 4, f[ 4 ][ 2 ] = 2, f[ 4 ][ 3 ] = 1, f[ 4 ][ 4 ] = 3;

	for ( i = 0; i < 2; i++ ) {
		cin >> s >> x >> y;
		a[ i ] = f[ id[ s ] ][ calc( id[ s ], 60 - x, y ) ];
	}

	if ( a[ 0 ] == a[ 1 ] ) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}



Measured memory_bytes: 3404
#include<bits/stdc++.h>
using namespace std;
 
 int c[4001][4001]{};
signed main(){
    int n;
    scanf("%d",&n);
    char a[5000];
char b[5000];
    for(int m=0;m<n;m++){
	scanf("%s%s",a,b);
int d,e;
d=strlen(a);
e=strlen(b);
for(int t=0;t<=d;t++){
    for(int w=0;w<=d;w++)c[t][w]=0;
    }
for(int x=0;x<d;x++){
    for(int y=0;y<e;y++){
	if(a[x]==b[y])c[x+1][y+1]=c[x][y]+1;
	else c[x+1][y+1]=max(c[x][y+1],c[x+1][y]);
	}
    }
    printf("%d\n",c[d][e]);
	}
}

Measured memory_bytes: 11048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int N;
  cin >> N;
  rep(i, N) {
    cout << "ACL";
  }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = 1e9;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
/*--------------------template--------------------*/

int main() {
    ll N,K;
    cin>>N>>K;
    vp ab(N);
    REP(i,N){
        ll a,b;
        cin>>a>>b;
        ab[i]=make_pair(a,b);
    }
    sort(ab.begin(),ab.end(),[&](P& l,P& r){return l.first<r.first;});
    REP(i,N){
        ans+=ab[i].second;
        if(ans>=K){
            cout<<ab[i].first<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 1792
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(len(A)):
    A[i] = -A[i]

heapq.heapify(A)
#print(A)

for i in range(M):
    tmp = heapq.heappop(A) 
    heapq.heappush(A, tmp/2)
    #print(A)

for i in range(N):
    A[i] = (-A[i])//1

#print(A)
print(int(sum(A)))

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

typedef int in;
#define int long long
int MAX=1e8;

int n;
int a[100005],dp[100005];

int f(int idx)
{
    if(idx==n-1)
        return 0;
    int &ret=dp[idx];
    if(ret!=-1)
        return ret;
    ret=f(idx+1)+abs(a[idx]-a[idx+1]);
    if(idx+2<n)
        ret=min(ret,f(idx+2)+abs(a[idx]-a[idx+2]));
    return ret;
}

in main()
{
    int tc=1;
//    cin>>tc;
    while(tc--)
    {
        cin>>n;
        for(int i=0; i<n; i++)
        {
            cin>>a[i];
        }
        memset(dp,-1,sizeof dp);
        cout<<f(0)<<endl;
    }
    return 0;
}


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

using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	int ans;
	if (A > 12) ans = B;
	else if (A > 5) ans = B / 2;
	else ans = 0;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1L<<32;
ll fac[MAX], finv[MAX], inv[MAX];

int main(){
  double a,b,v,w,t;cin>>a>>v>>b>>w>>t;
  if(abs(b-a)/(v-w)<=t&&v>w){cout<<"YES"<<endl;}
  else{cout<<"NO"<<endl;}
}




Measured memory_bytes: 3772
#include <bits/stdc++.h>
// #include "../../cxx-prettyprint/prettyprint.hpp"

using namespace std;
typedef long long ll;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)

#define INF 3000000000

void warshall_floyd(vector< vector<ll> >& d, int N){
    FOR(k,1,N+1){
        FOR(i,1,N+1){
            FOR(j,1,N+1){
                // if(k==2 && i==1 && j==3) cout << min(d[i][j], d[i][k] + d[k][j]);
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main(){
// ここに処理を記述

    int N, M, L, Q;

    vector< vector<ll> > cost(400,vector<ll>(400, INF));
    // vector< vector<ll> > cost(10,vector<ll>(10, INF));
    vector< vector<ll> > retank_d(400,vector<ll>(400, INF));
    // vector< vector<ll> > retank_d(10,vector<ll>(10, INF));

    cin >> N >> M >> L;

    REP(i,N+1){
        cost[i][i] = 0;
    }

    ll A, B, C;
    REP(i,M){
        cin >> A >> B >> C;
        cost[A][B] = C;
        cost[B][A] = C;
    }

    cin >> Q;
    vector< pair<int, int> > q;
    int s, t;
    for(int i=0; i<Q; i++){
        cin >> s >> t;
        q.push_back( make_pair(s, t) );
    }

    auto d = cost;

    warshall_floyd(d, N);

    REP(i,N+1){
        retank_d[i][i] = 0;
        REP(j,N+1){
            if(d[i][j] <= L){
                retank_d[i][j] = 1;
                retank_d[j][i] = 1;
            }
        }
    }

    // cout << d << "\n";

    warshall_floyd(retank_d, N);

    REP(i,q.size()){
        if(retank_d[q[i].first][q[i].second] >= INF) cout << -1 << "\n";
        else cout << retank_d[q[i].first][q[i].second] - 1 << "\n";
    }


return 0;
}

Measured memory_bytes: 4988
import java.io.*;
import java.util.*;
import static java.lang.Math.min;
import static java.lang.Math.max;
public class Main {
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
            int n = sc.nextInt();
            long dp[] = new long[3];
            long arr[] = new long[3];
            for(int i=0; i<n; i++){
                for(int j=0; j<3; j++) arr[j] = sc.nextLong();
                long dp1[] = new long[3];
                for(int j=0; j<3; j++){
                    long max=0;
                    for(int k=0; k<3; k++){
                        if(j!=k) {
                            if (dp[k] > max) max = dp[k];
                        }
                    }
                    dp1[j] = max + arr[j];
                }
                dp = dp1;
            }
            out.println(max(dp[0],max(dp[1],dp[2])));
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}
class Pair implements Comparable<Pair>{
    long x,y;
    Pair(long x, long y){
        this.x = x;
        this.y = y;
    }
    public int compareTo(Pair p){
        return (int)(this.x - p.x);
    }

}

Measured memory_bytes: 42908
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]


MOD = int(1e9) + 7

N, K = map(int, input().split())
A = list(map(int, input().split()))

init = 0
total = 0
for i in range(N):
    for j in range(i+1, N):
        if A[i] > A[j]:
            init += 1
        if A[i] != A[j]:
            total += 1
            
ans = init * K
ans %= MOD

hoge = (K * (K - 1)) // 2
hoge %= MOD
ans += total * hoge
ans %= MOD

print(ans)


Measured memory_bytes: 41452
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main() {
	int n, k;
	cin >> n >> k;
	
	ll ans = n-k+1;

	cout << ans << endl;
	
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int, input().rstrip().split()))
B=list(A[i]-i for i in range(N))
C=list(A[i]-i for i in range(N))
C.sort()
work=C[N//2]
testA=sum(abs(B[i]-work) for i in range(N))
testB=sum(abs(B[i]-work-1) for i in range(N))
testC=sum(abs(B[i]-work+1) for i in range(N))
output=min(testA,testB,testC)
print(output)

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

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

  ll N; cin >> N;
  ll M; cin >> M;
  vector<ll> cnt(N, 0);
  for (ll i = 0; i < M; i++) {
    ll a, b; cin >> a >> b; a--; b--;
    cnt[a]++;
    cnt[b]++;
  }

  string ans = "YES";
  for (ll i = 0; i < N; i++) {
    if (cnt[i] % 2) ans = "NO";
  }
  cout << ans << '\n';
  return 0;
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;

int main() {
    ll n,m,ans=1;
    cin>>n>>m;

    if(abs(n-m)>1){
        ans=0;
    }
    else {
        for (ll i=n; i>0; i--) {
            ans*=i%mod;
            ans%=mod;
        }
        for (ll i=m; i>0; i--) {
            ans*=i%mod;
            ans%=mod;
        }
    }

    if(n==m){
        ans=(ans*2)%mod;
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main(void) {
int n, m, x, sum = 0;
  scanf("%d %d",&n, &m);
int a[m];
  for( int i = 0; i < m; i++) {
    a[i] = 0;
  }
  for( int i = 0; i < n; i++) {
    int k; scanf("%d", &k);
    for( int j = 0; j < k; j++) {
      int x; scanf("%d", &x);
      a[x-1]++;
    }
  }
  for( int i = 0; i < m; i++) {
    if( a[i] == n){
      sum++;
    }
  }
  printf("%d", sum);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    int n;
    cin >> n;

    vector<int> d(n);
    for(auto &x:d)cin >> x;

    sort(d.begin(), d.end());

    int k=d[n/2]-d[n/2-1];

    cout << k << endl;

    return 0;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define N_MAX 1000
using namespace std;

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

	for (int i = X; 1; i++) {
		int flag = 1;
		for (int j = 2; j <= sqrt(i); j++) {
			if (i % j == 0) {
				flag = 0;
				break;
			}
		}

		if (flag == 1) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
from scipy.sparse.csgraph import dijkstra
N,M=map(int,input().split())

inf = float('inf')
graph = [[inf]*N for i in range(N)]

for i in range(M):
    a,b,c = map(int,input().split())
    graph[a-1][b-1] = c
    graph[b-1][a-1] = c

dist = dijkstra(graph)

count = 0

for i in range(N):
    for j in range(N):
        if graph[i][j] != inf:
            if graph[i][j] != dist[i][j]:
                count += 1

print(count//2)

Measured memory_bytes: 17300
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <deque>
#include <atcoder/all>

using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int op(int a, int b) {
  return max(a, b);
}

int e() {
  return 0;
}

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

  int n, k, ans = 0;
  cin >> n >> k;

  atcoder::segtree<int, op, e> seg(300010);

  REP(i, n) {
    int x;
    cin >> x;
    int l = max(x - k, 0);
    int r = min(x + k, 300000);
    int t = seg.prod(l, r + 1) + 1;
    ans = max(ans, t);

    seg.set(x, t);
  }

  cout << ans << endl;
}


Measured memory_bytes: 8480
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

int P,Q,R;

int main() {

	scanf("%d%d%d", &P,&Q,&R);

	int ans = P + Q;
	ans = min(ans, Q + R);
	ans = min(ans,  R+P);

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

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>
#include <queue>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using PP = pair<P, ll>;

const ll INF = 1<<30;
const ll MOD = (ll)1e9 + 7;
const ll MAX_N = (ll)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

ll N, M;
vector<ll> G[MAX_N];
ll dijkstra(ll s, ll t)
{
    vector<ll> dist(N, INF);
    vector<vector<ll>> used(MAX_N, vector<ll>(3, 0));
    priority_queue<PP, vector<PP>, greater<PP>> que;
    que.push(PP(P(0, 0), s));
    while(que.size())
    {
        PP p = que.top(); que.pop();
        ll v = p.second;
        if(v == t and p.first.second == 0) return p.first.first;
        ll q = (p.first.second + 1) % 3;
        if(q == 0)
        {
            for(auto &&e : G[v])
            {
                if(used[e][q]) continue;
                used[e][q] = 1;
                dist[e] = p.first.first + 1;
                que.push(PP(P(dist[e], q), e));
            }
        }
        else
        {
            for(auto &&e : G[v])
            {
                if(used[e][q]) continue;
                used[e][q] = 1;
                que.push(PP(P(p.first.first, q), e));
            }
        }
    }
    return -1;
}
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    for(ll i = 0; i < M; i++)
    {
        ll u, v; cin >> u >> v;
        u--, v--;
        G[u].push_back(v);
    }
    ll S, T; cin >> S >> T;
    S--, T--;
    cout << dijkstra(S, T) << endl;
    return 0;
}



Measured memory_bytes: 12404
#include <iostream>
using namespace std;
int f(int x){
        if(x%10==0) return x;
        else return x+10-x%10;
}
int main(void){
    // Your code here!
    int a[5];
    int i;
    int ans=0;
    int count=10;
    std::cin >>a[0] ;
    std::cin >>a[1] ;
    std::cin >>a[2] ;
    std::cin >>a[3] ;
    std::cin >>a[4] ;
    for (i=0;i<5;i++){
        if (a[i]%10!=0&&count>a[i]%10)
        count=a[i]%10;
    }
    for (i=0;i<5;i++){
        if(a[i]%10!=0) ans+=a[i]+10-a[i]%10;
        else ans+=a[i];
    }
    std::cout << ans-10+count << std::endl;
}

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

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

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

struct edge {
	ll a, b, cost;
};
 
int n, m,p;
vector<edge> e;
const ll INF = 1e16;
 
vll solve() {
	vector<ll> d (n, INF);
	d[0] = 0;
	for (int i=0; i<n-1; ++i)
		for (int j=0; j<m; ++j)
			if (d[e[j].a] < INF)
				d[e[j].b] = min (d[e[j].b], d[e[j].a] + e[j].cost);
	return d;
}

vll solve2(){
	vector<ll> d (n, INF);
	d[0] = 0;
	for (int i=0; i<2*n-1; ++i)
		for (int j=0; j<m; ++j)
			if (d[e[j].a] < INF)
				d[e[j].b] = min (d[e[j].b], d[e[j].a] + e[j].cost);
	return d;
}


int main()
{ios_base::sync_with_stdio(false);

cin>>n>>m>>p;

rep(i,0,m-1)
{
	int a,b,c;
	cin>>a>>b>>c;
	c=p-c;
	a--;b--;
	edge x;
	x.a=a;
	x.b=b;
	x.cost=c;
	e.pb(x);
}
vll d=solve();
vll d1=solve2();
if(d[n-1]!=d1[n-1])
{
	ol("-1");
	return 0;
}
ll ans=max(-d[n-1],0ll);
ol(ans);
return 0;
}



Measured memory_bytes: 512
<?php
$stdin = trim(fgets(STDIN));
$num = explode(' ', $stdin);
if ($num[0] < $num[1] && $num[1] < $num[2] && $num[0] < $num[2]) {
    echo 'Yes' . "\n";
} else {
    echo 'No' . "\n";
}

Measured memory_bytes: 15280
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<double>a(n);
	rep(i, n)cin >> a[i];
	double ans = 0;
	rep(i, n) {
		ans += 1.0 / a[i];
	}
	cout << fixed << setprecision(15) << 1.0 / ans << endl;
	return 0;
}

Measured memory_bytes: 256
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	char x;
	cin>>x;
	char ans = x+1;
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 256