akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
string s1,s2;
int my_find(int t)
{
	for(int i=0;i<s1.length()/2;i++)
	{
		if(s1[i+t]!=s2[i])
			return 0;
	}
	return 1;
}
int main ()
{
	int i;
	cin>>s1; cin>>s2;
	s1=s1+s1;
//	cout<<s1<<endl<<s2<<endl;
	for(i=0;i<s1.length();i++)
	{
		if(my_find(i))
		{
			printf("Yes\n");
			break;
		}
	}
	if(i==s1.length())
		cout<<"No"<<endl;
	return 0;
}

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

const int N=200005;
const long long MOD=1e9+7;
int n,now[N];
int v[N],nxt[N],head[N];
long long m,dp[N],l[N],r[N],ans[N];

void dfs(int x,int fa)
{
	dp[x]=1;
	for(int i=head[x];i>0;i=nxt[i])
	{
		if(v[i]==fa) continue;
		dfs(v[i],x),dp[x]=dp[x]*(dp[v[i]]+1)%m;
	}
	int cnt=0;
	for(int i=head[x];i>0;i=nxt[i])
	{
		if(v[i]!=fa) now[++cnt]=v[i];
	}
	if(!cnt) return;
	l[now[1]]=r[now[cnt]]=1;
	for(int i=2;i<=cnt;i++) l[now[i]]=l[now[i-1]]*(dp[now[i-1]]+1)%m;
	for(int i=cnt-1;i>=1;i--) r[now[i]]=r[now[i+1]]*(dp[now[i+1]]+1)%m;
}

void dfs2(int x,int fa,long long val)
{
	ans[x]=dp[x]*(val+1)%m;
	for(int i=head[x];i>0;i=nxt[i])
	{
		if(v[i]==fa) continue;
		dfs2(v[i],x,(val+1)*l[v[i]]%m*r[v[i]]%m);
	}
}

int main()
{
	scanf("%d%lld",&n,&m);
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&v[i],&v[i+n]);
		nxt[i]=head[v[i+n]],head[v[i+n]]=i;
		nxt[i+n]=head[v[i]],head[v[i]]=i+n;
	}
	dfs(1,0);
	dfs2(1,0,0);
	for(int i=1;i<=n;i++) printf("%lld\n",ans[i]);
}

Measured memory_bytes: 12416
if __name__ == '__main__':
    n = int(input())
    b = list(map(int,input().split()))

    a = [0] * n
    for i in range(n):
        if i == 0:
            a[i] =b[0]
        elif i == n-1:
            a[i] = b[n-2]
        else:
            a[i] = min(b[i-1],b[i])
    answer = sum(a)
    print(answer)



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

int main() {
  int n, a[100005];
  cin >> n;
  rep(i, n) scanf("%d", &a[i]);

  sort(a, a+n);

  int ai, aj;
  ai = a[n - 1];

  int x, upper, lower;
  int *pos, idx;
  //if (ai % 2 == 0) {
    x = ai / 2;
    pos = lower_bound(a, a+n, x);
    idx = distance(a, pos);

    upper = min(idx, n - 2);
    lower = max(0, idx - 1);
    if (abs(a[upper] - x) <= abs(a[lower] - x)) aj = a[upper];
    else aj = a[lower];
  //} else {
  //
  if (aj == ai) aj = 0;

  cout << ai << " " << aj << endl;
    

  return 0;

}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define   pr pair<int,int>
const int N = 505 , M=N,inf=(int)1e9;
const ll mod=1e9+7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
int ans = INT_MAX;
map< pair<int,int> , int > mp;
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
void solve(){
	int n , k ; 
	cin >> n >> k ;
	vector < int > a(n,0);
	for( int i = 0 ; i < n ; i++ ) cin >> a[i] ; 
	vector < int > dp(n);
	dp[0] = 0 ;
	dp[1] = abs(a[0]-a[1]);
	for( int i = 2 ; i < n ; i++){
		dp[i] = INT_MAX;
		for( int j = i-1 ; j >= max(0,i-k) ;j--){
			dp[i] = min(dp[j]+abs(a[j]-a[i]),dp[i]) ;
		}
		//cout << dp[i] << " " ;
	}
	cout << dp[n-1];
	
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
    //cin >> q;
    while(q--)
        solve();
}


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

#define int long long
#define INF 1e18

signed main() {
    int a, b, c, d; cin >> a >> b >> c >> d;

    if(c > b | a > d) {
        cout << 0 << endl;
        return 0;
    }

    cout << min(b, d) - max(a, c) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define mp make_pair
#define pb push_back
#define pf push_fron
#define INF 1e9
#define PI acos(-1)
typedef long long ll;


ll sum = 0;
string str;
bool flag[15];

void dfs(int pos, bool flag[]) {
	if (pos == str.size()-1) {
		string t = "";
		for (int i = 0; i < str.size(); i++) {
			t += str[i];
			if (flag[i] || i==str.size()-1) {
				sum += stoll(t);
				t = "";
			}
		}
		return;
	}

	flag[pos] = true;
	dfs(pos + 1, flag);//選ぶ

	flag[pos] = false;
	dfs(pos + 1, flag);//選ばない

}

int main() {
	cin >> str;
	for (int i = 0; i < str.size(); i++)flag[i] = false;

	dfs(0, flag);

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;

vector<string> split(const string& s, char c) {
    vector<string> v; stringstream ss(s); string x;
    while (getline(ss, x, c)) v.push_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
    stringstream s; s << "[";
    for(int i = 0; i < n - 1; i++) s << arr[i] << ",";
    s << arr[n - 1] << "]";
    return s.str();
}
#define EVARS(args...) {__evars_begin(__LINE__); __evars(split(#args, ',').begin(), args);}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template<typename T> inline void __evars_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
template<typename T> inline void __evars_out_var(T* val) { cerr << arrStr(val, 10); }
template<typename T> inline void __evars_out_var(T val) { cerr << val; }
inline void __evars(vector<string>::iterator it) { cerr << endl; }
template<typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
    cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
    __evars_out_var(a);
    cerr << "; ";
    __evars(++it, args...);
}
const int N = 1e6 + 5;

int main()
{
	sync;
	clock_t clk=clock();
    ll n, x, m;
    cin >> n  >> x >> m;
    x %= m;
    vector<ll> series;
    vector<bool> visited(m + 1, false);
    series.push_back(x);
    visited[x] = 1;
    for(ll i = 2; i <= n; i++)
    {
        x = x * x % m;
        if(visited[x])
            break;
        visited[x] = true;
        series.push_back(x);
    }  
    ll ans = 0;
    if(series.size() == n)
    {  
        //EVARS(series);
        for(ll i = 0; i < n; i++)
            ans = ans + series[i];
    }
    else
    {
        ll find_first = -1;
        for(ll i = 0; i < series.size(); i++)
        {
            if(x == series[i])
            {
                find_first = i;
                break;
            }
            ans = ans + series[i];
        }
        vector<ll> cyc;
        for(ll i = find_first; i < series.size(); i++)
        {
            cyc.push_back(series[i]);
            if(i != find_first)
                cyc[i - find_first] += cyc[i - find_first - 1];
        }
        n -= find_first;
        ll times = n / cyc.size(), remain = n % cyc.size();
        ans = ans + times * cyc.back();
        if(remain)
            ans += cyc[remain - 1];
    }
    cout << ans;
 	//cerr << '\n'<<"Time (in s): " << double(clock() - clk) * 1.0 / CLOCKS_PER_SEC << '\n';	
}


Measured memory_bytes: 4300
A, B, C, D, E, F = map(int, input().split())

W = set()
for i in range(0, F + 1, 100 * A):
    for j in range(0, F + 1 - i, 100 * B):
        W.add(i + j)
        
S = set()
for i in range(0, F + 1, C):
    for j in range(0, F + 1 - i, D):
        S.add(i + j)

rate = -1
for w in W:
    for s in S:
        if 0 < w + s <= F and s / (w + s) <= E / (E + 100):
            if s / (w + s) > rate:
                rate= s / (w + s)
                ans = w + s, s
                
print(ans[0], ans[1])

Measured memory_bytes: 3188
fun main(args: Array<String>) = yorukatsu20b()

fun yorukatsu20b() {
    val (d, n) = readLine()!!.split(' ').map { it.toInt() }

    var pos = 0

    for (i in 1..Long.MAX_VALUE) {
        var count = 0
        var curr = i
        while (curr % 100 == 0L) {
            curr /= 100
            count++
        }
        if (count == d) pos++
        if (pos == n) return println(i)
    }
}


Measured memory_bytes: 38552
//Code By: pratibha_899 (Pratibha Shrivastav)

/********   All Required Header Files ********/
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

//All the Loops and defines required
typedef long long int ll;
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

//All the declarations using typedef

typedef pair<ll, ll> PII;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<ll, ll> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int l;
typedef unsigned long int ul;
typedef unsigned long long int  ull;

ll knapsack(ll n,ll w, ll weights[], ll values[]){
	ll dp[n+1][w+1];
	for(ll i=0;i<n+1;i++)
		dp[i][0]=0;
	for(ll i=0;i<w+1;i++)
		dp[0][i]=0;
	for(ll i=1;i<n+1;i++){
		for(ll j=1;j<w+1;j++){
			if(weights[i]<=j){
				dp[i][j]=max(dp[i-1][j],dp[i-1][j-weights[i]]+values[i]);
			}
			else
			{
				dp[i][j]=dp[i-1][j];
			}	
		}
	}
	return dp[n][w];
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,w;
	cin>>n>>w;
	ll weights[n+1];
	ll values[n+1];
	for(ll i=1;i<=n;i++)
		cin>>weights[i]>>values[i];
	ll res = knapsack(n,w,weights,values);
	cout<<res;
	return 0;
}

Measured memory_bytes: 79232
#include<stdio.h>


int main() 
{
	int arr[1001][2] = { 0 },num, i;
	char ch=0;

	while ((ch=getchar())!='\n')
	{
		ungetc(ch, stdin);
		scanf("%d,%*d", &num);
		++arr[num][0];
		getchar();
	}

	while (scanf("%d,%*d", &num) != EOF)
	{
		++arr[num][1];
	}
		
	for (i = 1; i < 1001; i++)
	{
		if (arr[i][0] && arr[i][1])
		{
			printf("%d %d\n", i,arr[i][0]+arr[i][1]);
		}
	}
	
	return 0;
}


Measured memory_bytes: 612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define N_MAX 110
#define K_MAX 100010

int main() {
  int N, K;
  vector<int> dp(K_MAX);
  vector<int> a;
  
  cin >> N >> K;
  rep(i,N){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }

  rep(i,K+1){
    for(int x : a){
      if(i >= x){
        dp.at(i) |= !dp.at(i-x);
      }
    }
  }

  cout << (dp.at(K) ? "First" : "Second") << endl;
  return 0;
}

Measured memory_bytes: 640
n,m = (int(i) for i in input().split())
a = [input() for i in range(n)]
b = [input() for i in range(m)]
answer ="No"
for i in range(n-m+1):
	for j in range(n-m+1):
		num = 0
		for k in range(m):
			if all(a[i+k][j+k2]==b[k][k2] for k2 in range(m)):
				num += 1
		if num == m:
			answer = "Yes"
			break
			break
print(answer)

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

using namespace std;
#ifdef ONLINE_JUDGE
#define cerr if(false)cerr
#endif

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define int long long
#define ld1 long double
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL),cout<<setprecision(14);
#define vint vector<int>
#define all(v) (v).begin(), (v).end()
#define pii pair<int,int>
#define pb push_back
#define mm0(X) memset((X), 0, sizeof((X)))
#define mm1(X) memset((X), -1, sizeof((X)))
#define INF (int)1e9
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define endl '\n'
#define vcc vector<char>
#define rep(i,a,b) for(int i=a;i<b;i++)

// if you have no idea just guess the appropriate well-known algo instead of doing nothing -- Benq inspiration
const int mod=998244353;
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int powmod(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return powmod(a,mod-2);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

const int N=(int)1e6+6;

void solve(){
    int n; cin >> n;

    string ans="";
//    n--;
    while(n>0){
        int tmp=(n-1)%26;
        ans+=(char)'a'+tmp ;
        n=(n-1)/26;
    }
    reverse(all(ans));

    cout<<ans<<endl;
}

int32_t main() {
    faster;

#ifndef ONLINE_JUDGE
    READ("input.txt");
    WRITE("output.txt");
    double beg=clock();
#endif

    int t=1;
//    cin>>t;

//    cout<<"hello"<<endl;
    while(t--){
        solve();
    }

#ifndef ONLINE_JUDGE
    double endd=clock();
    cout<<endl;
    cerr<<"*** Total time = "<<(endd-beg)/CLOCKS_PER_SEC;
#endif
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
 
int main(){
    int N,M,flag=0;
    cin >> N >> M;
    vector<int> ans(N,0);
    vector<int> count(N,0);

    for (int i=0; i<M; i++){
        int x,y;
        cin >> x >> y;
        if(x==1 && y==0 && N!=1){
            flag=1;
            break;
            }
        else if(x==1 && y==0 && N==1){
            flag=2;
            break;
        }
        else if(count.at(x-1)==0){
            ans.at(x-1)=y;
            count.at(x-1)++;
            }
        else if(count.at(x-1)!=0 && ans.at(x-1)==y){
            continue;
        }
        else if(count.at(x-1)!=0 && ans.at(x-1)!=y){
            flag=1;
            break;
        }
        
    }

    


    
    if(N==2 && ans.at(0)==0){
        ans.at(0)=1;
    }
    if(N==3 && ans.at(0)==0){
        ans.at(0)=1;
    }
    
    
    
    
    if(flag==1){
        cout << -1 << endl;
    }
    else if(flag==2){
        cout << 0 << endl;
    }
    else if(flag==0){
        for(int i=0; i<ans.size(); i++){
            cout << ans.at(i);
            if(i==ans.size()){
                cout << endl;
            }

        }

    }
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort(v.rbegin(), v.rend())
typedef pair<int, int> pii;

ll exp(ll taban, ll us) {
    ll carpan = taban % mod;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % mod;
        temp /= 2;
        carpan = (carpan*carpan) % mod;
    }
    return res;
}
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}
ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	ll r = 0, g = 0, b = 0;
	ll ans = 0;
	vector<char> vec(n);
	for(int i = 0; i < n; i++){
		char c; cin>>c;
		vec[i] = c;
		if(c == 'R'){
			r++;
			ans += g*b;
		}
		else if(c == 'G'){
			g++;
			ans += r*b;
		}
		else{
			b++;
			ans += r*g;
		}
		for(int u = 0; u < i; u++){
			int left = 2*u-i;
			if(left >= 0 && vec[u] != vec[i] && vec[left] != vec[i] && vec[left] != vec[u]) ans--;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3680
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


l = I()
ans = []
d = len(bin(l)) - 2
ret = 2 ** (d - 1)


remain = l-(2**(d - 1))
ret = 2 ** (d - 1)
for i in range(d-1, 0, -1):
    ans += [(i, i + 1, 0)]
    ans += [(i, i + 1, 2 ** (i - 1))]
    if 1 << (i-1) & remain:
        ans += [(i, d, ret)]
        ret += 2 ** (i - 1)




print(d, len(ans))
for k in ans:
    print(*k)

Measured memory_bytes: 39664
n = int(input())
 
a_list = list(map(int,input().split()))
b_list = list(map(int,input().split()))
c_list = list(map(int,input().split()))

cnt = 0
temp = ""

for x in a_list:
    cnt += b_list[x-1]
    if temp == x -1:
        cnt += c_list[temp-1]
    temp = x
    
print(cnt)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair

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

using namespace std;

typedef pair<int,int> pii;



int main(){

  llong n, t;
  while(true){
    scanf("%lld %lld", &t, &n);
    if(n == 0 && t == 0) break;

    bool visited[300][300] = {}; 
    bool syougai[300][300] = {};

    REP(i,n){
      llong x, y;
      scanf("%lld %lld", &x, &y);
      x += 150; y += 150;
      syougai[y][x] = true;
    }

    llong sx, sy;
    scanf("%lld %lld", &sx, &sy);
    sx += 150; sy += 150;
    visited[sy][sx] = true;

    queue<pair<int, pair<int, int>>> que;
    que.push(MP(sx, MP(sy, t)));
    while(!que.empty()){
      pair<int, pair<int, int>> tp = que.front();
      que.pop();
      
      if(tp.second.second == 0) continue;

      REP(i,6){
        int nx = tp.first + dx[i], ny = tp.second.first + dy[i];
    
        if(!visited[ny][nx] && !syougai[ny][nx]){
          visited[ny][nx] = true; 
          que.push(MP(nx, MP(ny, tp.second.second-1)));
        }
      }
    }

    llong ans = 0;
    REP(i,300){
      REP(j,300){
        if(visited[i][j]) ans++;
      }
    }
    
    printf("%lld\n", ans);
  }
  return 0;
}




Measured memory_bytes: 3420
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<iomanip>
#include<tuple>
#include<bitset>


using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define printfloat(x) cout << fixed << setprecision(7) << (x) << endl;
#define printbit(x) cout << bitset<15>(x) << endl;
using ll = long long int;

int n;
int ans;
string s;

long double pi = 3.14159265359;



int main(){
    cin >> s;
    n = (int)s.size();
    rep(i,n){
        int x = s[i] - '0';
        // cout << x << endl;
        ans += x;
    }
    if(ans%9 == 0){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }


return 0;
}

Measured memory_bytes: 3752
A,B,C = map(int,input().split())

if A == B == C and A%2 == 0 :
    ans = -1
else :
    flg = 1
    ans = 0
    while flg :
        if A%2 + B%2 + C%2 :
            flg = 0
        else :
            ans += 1
            ta,tb,tc = A,B,C
            A = (tb+tc)//2
            B = (tc+ta)//2
            C = (ta+tb)//2
print(ans)


Measured memory_bytes: 38256
#include <iostream>
#include <cmath>
using namespace std;
int main(void) {
	long n;
	cin >> n;
	int k = 0,ans =0;
	for(int i = floor(sqrt(n));i>=1;i--){
		long j;
		if(n%i == 0){
			j = n/i;
			while(j != 0){
				k++;
				j = j/10;
			}
			ans = k;
			break;
		}
	}
	cout << ans << endl;
}

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

using namespace std;

int a,b;
int main(){
    cin >> a >> b;
    if( a <= 0 && 0 <=  b ) cout << "Zero";
    else if( a < 0 && b < 0 ) cout << ( (a - b) % 2 ? "Positive":"Negative");
    else cout << "Positive";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
vector<vector<ll int>> graph;
vector<ll int> numin;
vector<bool> visited;
vector<ll int> dist;

void bfs(ll int u){
	dist[u] = 0;
	// visited[u] = true;
	queue<ll int> q;
	q.push(u);
	while(!q.empty()){
		ll int f = q.front();
		q.pop();
		// if(f>graph.size())
		// 	cout<<"jjaaaaaaaaaaaa";
		for(auto i = graph[f].begin();i!=graph[f].end();i++){
			numin[*i] -= 1;
			dist[*i] = max(dist[*i],dist[f]+1);
			if(numin[*i] == 0 && visited[*i]==false){
				visited[*i] = true;
				q.push(*i);
			}
		}
	}
	// exit(0);
}

int main(int argc, char const *argv[])
{
	ll int n,m;
	cin>>n>>m;
	visited.assign(n,false);
	graph.assign(n+1,vector<ll int>());
	dist.assign(n+1,0);
	numin.assign(n,0);
	for(ll int i=0;i<m;i++){
		ll int x,y;
		cin>>x>>y;
		numin[y-1]+=1;
		graph[x-1].pb(y-1);
	}
	for(ll int i=0;i<n;i++){
		graph[n].pb(i);
		numin[i]+=1;
	}
	bfs(n);
	ll int max1 = 0;
	for(ll int i=0;i<n;i++){
		max1 = max(max1,dist[i]);
	}
	cout<<max1-1;
	cout.flush();
	exit(0);
	return 0;
}

Measured memory_bytes: 8440
#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 db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N=55;
int a[N];
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  int n;
  cin>>n;
  rep(i,1,n+1) cin>>a[i];
  ll ans=0;
  rep(i,1,n+1) rep(j,i+1,n+1)  ans+=a[i]*a[j];
  cout<<ans<<endl;
  return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#include<list>
#include<algorithm>
#define ld long double
#define pb push_back
#define FF first
#define SS second
#define rep(a,b,c) for(a=b;a<c;a++)
#define repr(a,b,c) for(a=b-1;a>=c;a--)
#define PLL pair<ll, ll>
#define inf 100000001
#define mod 1000000007
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define PQ priority_queue
#define rep1 for(i=1;i<=n;i++)
#define VLL vector<ll>
#define EF else if
const double pi  =3.141592653589793238463;
#define all(x) (x).begin(), (x).end()
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define UMP unordered_map
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define test1(x)                cerr<<#x<<": "<<x<<endl
#define test2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define test3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define test4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define test5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define test6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
using namespace std;
/*
    //string with spaces
    std::string str;
    std::getline(std::cin >> std::ws, str);
*/
ll myXOR(unsigned long long int x, unsigned long long int y)
{
    return (x|y)&(~x|~y);   
}
ll powerLL(ll x, ll n) 
{ 
    ll result = 1; 
    while (n) { 
        if (n & 1) 
            result = result * x % mod; 
        n = n / 2; 
        x = x * x % mod; 
    }
    return result; 
}
int main()
{
    fastio
    ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r, t,u,w,x,y,z;
    string str, ss, str1;
    cin>>n>>x>>t;
    ll val = ceil((double)n/(double)x);
    ll res = val*t;
    cout<<res;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/
template<typename T>
vector<pair<T,long long>> RunLengthEncoder(vector<T> &v){
    vector<pair<T,long long>> RLE;
    long long cnt = 1;
    for(int i = 0; i < (int)v.size(); ++i){
        if(i == (int)v.size()-1){
            RLE.push_back(make_pair(v[i], cnt));
            continue;
        }
        if(v[i] == v[i+1])cnt++;
        else{
            RLE.push_back(make_pair(v[i],cnt));
            cnt = 1;
        }
    }
    return RLE;
}

vector<pair<char,long long>> RunLengthEncoder_ForString(string v){
    vector<pair<char,long long>> RLE;
    long long cnt = 1;
    for(int i = 0; i < (int)v.size(); ++i){
        if(i == (int)v.size()-1){
            RLE.push_back(make_pair(v[i], cnt));
            continue;
        }
        if(v[i] == v[i+1])cnt++;
        else{
            RLE.push_back(make_pair(v[i],cnt));
            cnt = 1;
        }
    }
    return RLE;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    string S;
    cin >> S;
    auto v = RunLengthEncoder_ForString(S);
    ll N = v.size();
    ll ans = 0;
    if(v.front().first == '>'){
        ll x = v.front().second;
        ans += x * (x+1) / 2;
    }
    if(v.back().first == '<'){
        ll x = v.back().second;
        ans +=  x * (x+1) / 2;
    }
    for(int i = 0; i < N-1;i++){
        if(v[i].first == '<'&& v[i+1].first == '>'){
            ll x = v[i].second;
            ll y = v[i+1].second;
            ans += x * (x+1) / 2;
            ans += y * (y+1) / 2;
            ans -= min(x, y);
        }
    }
    cout << ans << endl;
}
/*
0 < >>> 0 << > 0 <<<<< >>> 0 <
*/


Measured memory_bytes: 7956
from collections import defaultdict


def main():
    N = int(input())
    d = defaultdict(list)
    for i in range(N):
        n = int(input())
        for _ in range(n):
            d[i].append(list(map(int, input().split())))
    max_trust_num = 0

    # check all possible combinations of Honest or Unkind.
    for i in range(2**N):
        trust = True

        # assign Honest or Unnkind to each person.
        # if person i is Honest, trust_combs[i] = 1
        # else, trust_combs[i] = 0
        trust_combs = []
        for j in range(N):
            if (i >> j) & 1:
                trust_combs.append(1)
            else:
                trust_combs.append(0)
  
        # check if the combination of Honest or
        # Unkind contradicts the given statements.
        for k in range(len(trust_combs)):
            if trust_combs[k] == 1:
                for l in d[k]:
                    if not l[1] == trust_combs[l[0]-1]:
                        trust = False
        if trust:
            max_trust_num = max(max_trust_num, sum(trust_combs))

    print(max_trust_num)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
    int n;
    cin >> n;
    int ans=((1+n)*n)/2;
    cout << ans << endl;
}

Measured memory_bytes: 3596
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        n: usize, m: usize,
    }
    let mut i = 1;
    let mut yakusu = vec![];
    while i * i <= m {
        if m % i == 0 {
            yakusu.push(i);
            yakusu.push(m / i);
        }
        i += 1;
    }
    yakusu.sort();
    yakusu.reverse();

    for &v in &yakusu {
        if v * n <= m {
            println!("{}", v);
            return;
        }
    }
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    if ( a % 3 == 0 || b % 3 == 0 ||  ( a + b ) % 3 == 0 ) {
        cout << "Possible";
    }
    else {
        cout << "Impossible";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int f(int64_t a,int64_t b){
  if(a>=b){
    int cnt=0;
    while(a>0){
      a/=10;
      cnt++;
    }
    return cnt;
  }
  else {
    return f(b,a);
  }
}
int main(){
  int64_t n;
  cin >> n;
  int ans=12;
  for(int64_t i=1;i<=sqrt(n);i++){
    if(n/i*i==n){
      ans=min(ans,f(i,n/i));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>

using namespace std;

priority_queue <double> q;

int main()
{
	int n; scanf("%d",&n);
	
	for (int i=0; i<n; i++)
	{
		int x; scanf("%d",&x);
		
		q.push(-x);
	}
	
	for (int i=1; i<n; i++)
	{
		double mi1=q.top(); q.pop();
		double mi2=q.top(); q.pop();
		
		q.push((mi1+mi2)*0.5);
	}
	
	printf("%.7f",-q.top());
	
	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);
        char[] n = sc.next().toCharArray();
        for (int i = 0 ;i < n.length ; i++) {
            if (i % 2 == 0) {
                if (n[i] == 'L') {
                    System.out.println("No");
                    return;
                }
            } else {
                if (n[i] == 'R') {
                    System.out.println("No");
                    return;
                }
            }
        }

        System.out.println("Yes");
    }

}


Measured memory_bytes: 23764
def resolve():
    N = int(input())
    ls = []
    for i in range(N):
        tmp = input().split()
        tmp.append(i+1)
        ls.append(tmp)

    ls = sorted(ls, key=lambda x: (x[0], -int(x[1])))

    for l in ls:
        print(l[2])
    return

resolve()

Measured memory_bytes: 9128
# abc148_c.py
import sys
import time
import unittest
from io import StringIO
import fractions as math


def resolve():
    A, B = [int(i) for i in input().split()]
    print(int(A * B / math.gcd(A, B)))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def setUp(self):
        self.startTime = time.time()

    def tearDown(self):
        t = time.time() - self.startTime
        print('%s: %.3f' % (self.id(), t), flush=True)

    def test_入力例_1(self):
        input = """2 3"""
        output = """6"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """123 456"""
        output = """18696"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """100000 99999"""
        output = """9999900000"""
        self.assertIO(input, output)


if __name__ == "__main__":
    if "IS_LOCAL" in locals():
        suite = unittest.TestLoader().loadTestsFromTestCase(TestClass)
        unittest.TextTestRunner(verbosity=0).run(suite)
    else:
        resolve()


Measured memory_bytes: 6500
/* Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/
#include <bits/stdc++.h>
using namespace std;
#define fore(i, a, b) for (int i = a, to = b; i < to; i++)
#define all(v) v.begin(), v.end()
#define SZ(v) (int)v.size()
#define pb push_back
typedef long long Long;
typedef pair<int, int> Pair;
vector<Long> v;
vector<Long> acum;
int n;
const Long INF = (1e15);
const int MX = 2e5;
Long memo[MX + 2][3];
Long vis[MX + 2][3];
Long dp(int pos, int dejo) {
  if (pos >= n) {
    if (n % 2 == 0) {
      if (dejo <= 1)
        return 0;
      else
        return -INF;
    } else {
      if (dejo == 2 || dejo == 1)
        return 0;
      else
        return -INF;
    }
  }
  if (dejo > 2) return -INF;
  if (vis[pos][dejo]) return memo[pos][dejo];
  vis[pos][dejo] = true;
  Long &ans = memo[pos][dejo] = -INF;
  ans = max(ans, dp(pos + 1, dejo + 1));
  ans = max(ans, dp(pos + 2, dejo) + v[pos]);
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n;
  v.resize(n);
  fore(i, 0, n) cin >> v[i];
  acum.resize(n);
  acum[0] = v[0];
  acum[1] = v[1];
  Long mini = INF;
  fore(i, 1, n) {
    mini = min(mini, v[i]);
    i++;
  }
  fore(i, 2, n) {
    acum[i] = acum[i - 2] + v[i];
  }
  memset(memo, -1, sizeof memo);
  cout << dp(0, 0) << '\n';

  return 0;
}

Measured memory_bytes: 20460
#include<stdio.h>
#include<stdlib.h>

void swap(int *x, int *y) {
    int t;
    t = *x;
    *x = *y;
    *y = t;
}

typedef struct heap{
    heap(int n) {
        tree = (int*)malloc(sizeof(int) * n);
        size = 0;
    };
    ~heap(void) { free(tree); }

    void insert(int x) {
        tree[size++] = x;
        
        int i = size-1;
        while(true) {
            if(tree[i] < tree[i/2]) {
                swap(&tree[i], &tree[i/2]);
                i/=2;
            }
            else break;
        }
    }

    int deletemin() {
        int res = tree[0];
        tree[0] = tree[--size];
        int i=0;
        while(true) {
            int min;
            if(2*i+1 < size)
                min = (tree[2*i] < tree[2*i+1]) ? 2*i : 2*i+1;
            else if(2*i < size)
                min = 2*i;
            else break;

            if(tree[i] > tree[min]) {
                swap(&tree[i], &tree[min]);
                i = min;
            } else break;
        }
        return res;
    }
    int size;
    int *tree;
} heap;

int main(void) {
    heap h(2000000000);
    while(true){
        int x;
        char s[30];
        scanf("%s%d",s,&x);
        if(s[0] == 'i')
            h.insert(-x);
        else if(s[1] == 'x')
            printf("%d\n", -h.deletemin());
        else
            return 0;
    }
}

Measured memory_bytes: 6284
#include <bits/stdc++.h>
using namespace std;
int main(){
  char a, b, c;
  cin >> a >> b >> c;
  int x = 0;
  if (a == '1')
    x++;
  if (b == '1')
    x++;
  if (c == '1')
    x++;
  cout << x << endl;
}

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

using namespace std;

int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  long long int a[n], sum = 0, m;
  for (size_t i = 0; i < n; i++) cin >> a[i];

  for (size_t i = 0; i < n; i++) sum += a[i]-1;
  cout << sum << endl;
  return 0;
}


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

using namespace std;


int main(int argc, const char * argv[]) {

    int n;
    cin >> n;
    
    int taro=0,hanako=0;
    for(int i=0; i<n; i++){
        string s1, s2;
        cin >> s1;
        cin >> s2;
        
        if(s1>s2)
            taro+=3;
        else if(s2>s1)
            hanako+=3;
        else{
            taro++;
            hanako++;
        }
    }
    
    cout << taro << " " << hanako << endl;
    return 0;
}



Measured memory_bytes: 3192
#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 FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  cout << min(a, b) + min(c, d) << endl;


  
  return 0;
}

Measured memory_bytes: 256
import numpy as np
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
B=np.array(B)
L=[list(map(int,input().split())) for _ in range(N)]
L=np.array(L)
ans=0
for i in range(N):
    if B.dot(L[i])+C>0:
        ans+=1
print(ans)

Measured memory_bytes: 12480
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF = 1e9;

vector<int> to[2500], rto[2500];
bool s_ok[2500], g_ok[2500], ok[2500];

void dfs(int v){
    if(s_ok[v]) return;
    s_ok[v] = true;
    for(auto nv : to[v]){
        dfs(nv);
    }
}

void rdfs(int v){
    if(g_ok[v]) return;
    g_ok[v] = true;
    for(auto nv : rto[v]){
        rdfs(nv);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, p;
    cin >> n >> m >> p;
    vector<tuple<int, int, int>> edges;
    rep(i,m){
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        c -= p;
        edges.emplace_back(a, b, -c);
        to[a].push_back(b);
        rto[b].push_back(a);
    }
    dfs(0);
    rdfs(n-1);
    rep(i,n) ok[i] = s_ok[i] & g_ok[i];
    vector<int> d(n, INF);
    d[0] = 0;
    int step = 0;
    bool upd = true;
    while(upd){
        upd = false;
        rep(i,m){
            int a, b, c;
            tie(a, b, c) = edges[i];
            if(!ok[a]) continue;
            if(!ok[b]) continue;
            int next_dist = d[a] + c;
            if(next_dist < d[b]){
                upd = true;
                d[b] = next_dist;
            }
        }
        if(++step > n){
            cout << -1 << endl;
            return 0;
        }
    }
    int ans = -d[n-1];
    chmax(ans, 0);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4016
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {

    sc.Split(bufio.ScanWords)
    r := float64(nextInt())
    fmt.Println((r * 2) * 3.14)

}



//==================================================
//
// Library
//
//==================================================

//===========================
//  round(12.54, 0) -> 13.0
//  round(12.54, -1) -> 12.5
//===========================

func round(num float64, digit uint) float64 {
    d := float64(digit)
    return float64(int(num * math.Pow(10, d) + 0.5)) / math.Pow(10, d)
}

func abs(n int) int {
    return int(math.Abs(float64(n)))
}

func max(a, b int) int {
    return int(math.Max(float64(a), float64(b)));
}

func min(a, b int) int {
    return int(math.Min(float64(a), float64(b)));
}

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

    return gcd(y, x%y)
}

//===========================
//  var q Queue
//  q.Enqueue(n)
//  n := q.Dequeue()
//===========================
type Queue struct {
    data []int
}

func (q *Queue) Enqueue(n int) {
    q.data = append(q.data, n)
}

func (q *Queue) Dequeue() int {
    tmp := q.data[0]
    q.data = q.data[1:]
    return tmp
}

// 数値を桁区切りのスライスにする
func digit(n int, list []int) []int {
   if n > 0 {
       return digit(n/10, append(list, n%10))
   }
   return list
}

func sortIntsRev(list []int) {
    sort.Sort(sort.Reverse(sort.IntSlice(list)))
}

func strReverse(s string) string {
    runes := []rune(s)
    for i := 0; i < len(s)/2; i++ {
        runes[i], runes[len(s)-1-i] = runes[len(s)-1-i], runes[i]
    }
    return string(runes)
}

func nextInt() int {
    sc.Scan()
    i, _ := strconv.Atoi(sc.Text())
    return i
}

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

func swap(a, b int) (int, int) {
    return b, a
}

func mySort(list []int, start int, end int) {
    var l []int
    for i := start; i < end; i++ {
        l = append(l, list[i])
    }
    sort.Ints(l)

    j := 0
    for i := start; i < end; i++ {
        list[i] = l[j]
        j++
    }
}

func mySortRev(list []int, start int, end int) {
    var l []int
    for i := start; i < end; i++ {
        l = append(l, list[i])
    }

    sortIntsRev(l)

    j := 0
    for i := start; i < end; i++ {
        list[i] = l[j]
        j++
    }
}

func nextPermutation(array []int) bool {
    n := len(array)

    for i:= n - 2; i >= 0; i-- {
        if array[i] < array[i+1] {
            j := n;
            for {
                j--;
                if (array[i] < array[j]) {
                    break
                }
            }
            array[i], array[j] = swap(array[i], array[j])
            mySort(array, i + 1, n)
            return true
        }
        if i == 0 {
            mySortRev(array, 0, n)
        }
    }
    return false
}



Measured memory_bytes: 1756
n = int(input())

alist = []
vlist = []
for _ in range(n):
    a, v = map(int, input().split())
    alist.append(a)
    vlist.append(v)

max = 0
num = 10**9
for a, v in zip(alist, vlist):
    if v > max:
        num = a
        max = v
    elif v == max:
        if a < num:
            num = a

print(num, max)



Measured memory_bytes: 5596
#include <iostream>
using namespace std;
int main() {
	char m[52][52];
	for (int i = 0; i < 52; i++)
	{
		for (int j = 0; j < 52; j++)
		{
			m[i][j] = '.';
		}
	}
	int H, W;
	cin >> H >> W;
	for (int i = 1; i <= H; i++)
	{
		for (int j = 1; j <= W; j++)
		{
			cin >> m[i][j];
		}
	}

	bool can = true;

	for (int i = 1; i <= H; i++)
	{
		for (int j = 1; j <= W; j++)
		{
			if (m[i][j] == '#') {
				if (!(m[i+1][j] == '#' || m[i-1][j] == '#' || m[i][j+1] == '#' || m[i][j-1] == '#')) {
					can = false;
				}
			}
		}
	}

	if (can) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
/* include */
#include <bits/stdc++.h>
#include <boost/algorithm/string/trim.hpp>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/math/special_functions/factorials.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>

/* using */
using namespace std;
namespace mp = boost::multiprecision;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x)  \
    boost::sort(x); \
    (x).erase(unique(all(x)), (x).end())
#define mp make_pair

/* const */
const int inf = 1e9 + 7;
const int dxl[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dyl[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dxs[4] = {1, 0, -1, 0};
const int dys[4] = {0, 1, 0, -1};

/* main */
signed main(void)
{
    int a, b;
    cin >> a >> b;
    int sum = ((b - a) * (1 + (b - a))) / 2;
    cout << sum - b << endl;
    return 0;
}


Measured memory_bytes: 256
e,s=gets
h=gets.split.map(&:to_i).sort.chunk(&:to_i).map{|c,r|s||=c;[e=c,r.size]}.to_h
puts h[s]<3&&e==s*2+1-h[s]&&(s+1..e).all?{|i|(h[i]||0)>=2}?"Possible":"Impossible"

Measured memory_bytes: 1916