akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define fur(i,x,y) for(i=x;i<=y;i++)
#define fdr(i,x,y) for(i=x;i>=y;i--)
#define Fur(i,x,y) for(ll i=x;i<=y;i++)
#define Fdr(x,y) for(ll i=x;i>=y;i--)
#define in2(x,y) in(x);in(y)
#define in3(x,y,z) in2(x,y);in(z)
#define in4(a,b,c,d) in2(a,b);in2(c,d)
#define clr(x,y) memset(x,y,sizeof(x))
using namespace std;
/*---------------------------------------*/

namespace fib{char b[300000]= {},*f=b;}
#define gc ((*fib::f)?(*(fib ::f++)):(fgets(fib::b,sizeof(fib::b),stdin)?(fib::f=fib::b,*(fib::f++)):-1))
inline void in(ll &x){x=0;char c;bool f=0;while((c=gc)>'9'||c<'0')if(c=='-')f=!f;x=c-48;while((c=gc)<='9'&&c>='0')x=x*10+c-48;if(f)x=-x;}
namespace fob{char b[300000]= {},*f=b,*g=b+300000-2;}
#define pob (fwrite(fob::b,sizeof(char),fob::f-fob::b,stdout),fob::f=fob::b,0)
#define pc(x) (*(fob::f++)=(x),(fob::f==fob::g)?pob:0)
struct foce{~foce(){pob;fflush(stdout);}} _foce;
namespace ib{char b[100];}
inline void out(ll x){if(x==0){pc(48);return;}if(x<0){pc('-');x=-x;}char *s=ib::b;while(x) *(++s)=x%10,x/=10;while(s!=ib::b) pc((*(s--))+48);}
inline void outn(ll x){out(x);pc('\n');}
inline void swap(ll &x,ll &y){ll t=x;x=y;y=t;}
/*------------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------------*/
#define N 101
ll a[6],t=0;
bool v[6];
inline void dfs(ll d,ll now,ll ans){
	if(d==3){t+=ans;return;}
	Fur(x,now+1,5)
	if(!v[x]){
		v[x]=1;
		dfs(d+1,x,ans*a[x]);
		v[x]=0;
	}
}
int main(){
	ll n;in(n);
	char c[10];
	while(n--){
		scanf("%s",c);
		if(c[0]=='M')a[1]++;
		if(c[0]=='A')a[2]++;
		if(c[0]=='R')a[3]++;
		if(c[0]=='C')a[4]++;
		if(c[0]=='H')a[5]++;
	}
	dfs(0,0,1);
	outn(t);
}

/*

*/

Measured memory_bytes: 256
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
    #include<numeric>
    #include<array>
     
    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
    #define ALL(a)  (a).begin(),(a).end()
    #define chmin(a, b) a = min(a, b)
    #define chmax(a, b) a = max(a, b)
    #define Vl vector<ll>
     
    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<ll, ll>;
     
const ll MOD = 1e9 + 7;
const ll ZER = 0;

int main(){
   ll n, a, b, c, d;
   cin >> n >> a >> b >> c >> d;
   a--;b--;c--;d--;
   string s;
   cin >> s;
   int cnt = 0;
   if(c < d){
       REP(i, a, d){
           if(s[i] == '#' && s[i + 1] == '#'){
               cout << "No" << endl;
               return 0;
           }
       }
       cout << "Yes" << endl;
       return 0;
   }
   else{
       REP(i, b, d){
           if(s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.'){
               cout << "Yes" << endl;
               return 0;
           }
       }
   }
   cout << "No" << endl;
}


Measured memory_bytes: 3736
#include <iostream>


using namespace std;
int main(){

    char a;
    cin>>a;
    if(a=='A'){
        cout<<'T';
    }
    else if (a=='C'){
        cout<<'G';
    }
       else if (a=='G'){
        cout<<'C';
    }
       else if (a=='T'){
        cout<<'A';
    }






    return 0;
}


Measured memory_bytes: 256
n = int(input())
cards = [int(i) for i in input().split(' ')]
cards.sort(reverse=True)

alice = 0
bob = 0

for i in range(len(cards)):
    if i % 2 == 0:
        alice += cards[i]
    else:
        bob += cards[i]
        
print(alice - bob)

Measured memory_bytes: 9168
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        int[] dts = null;
        string r = "";

        while(true)
        {
            // 0:H, 1:W
            dts = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            if (dts[0] == 0 && dts[1] == 0) break;

            for (int i = 1; i <= dts[0]; i++)
            {
                r = "";
                
                for (int j = 1; j <= dts[1]; j++)
                {
                    if ( (i % 2) == 0 )
                    {
                        if ( (j % 2) == 0 )
                            r += "#";
                        else   
                            r += ".";
                    }
                    else
                    {
                        if ( (j % 2) == 0 )
                            r += ".";
                        else
                            r += "#";
                    }
                }

                Console.WriteLine(r);    
            }

            Console.WriteLine("");
        }
    }
}


Measured memory_bytes: 9544
#include <iostream>

using namespace std;

int main(void) {
	int N, X, num = 1;
	cin >> N >> X;
	int L[N];
	for(int i = 0; i < N; i++) {
		cin >> L[i];
		X = X -L[i];
		if(X >= 0)
			num++;
	}
	cout << num << endl;
	return 0;
}

Measured memory_bytes: 256
import math
n=int(input())
res = [0]*n
A=[int(i) for i in input().split()]
for i in range(n):
    res[i]=(A[i]-(i+1))
res.sort()

if n%2==1:
    ans = sum([abs(i-res[n//2]) for i in res])
else:
    b0 = (res[n//2-1]+res[n//2])//2
    b1 = math.ceil(res[n//2-1]+res[n//2])
    ans = min(sum([abs(a-b0) for a in res]), sum([abs(a-b1) for a in res]))
print(ans)


Measured memory_bytes: 29476
#include<iostream>
#include<string>
#include<cmath>

using std::cout;
using std::cin;
using std::endl;
using std::pow;
using std::string;

int main(){
    string out;
    long long int N;
    char c;
    cin >> N;
    for(int i=0;i<15;i++){
        if(N % 26 != 0){
            c = char(N % 26 + int('a') - 1);
            N /= 26;
        }else{
            c = 'z';
            N = N / 26 - 1; 
        }
        out += c;
        if(N == 0) break;;
    }
    for(int i=out.length()-1;i>=0;i--) cout << out[i];
}

Measured memory_bytes: 3612
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{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 main()
{
fast;
ll n,m;
cin>>n>>m;
vector<ll>v;
set<ll>s;
for(ll i=0;i<n;i++)
{
    ll a;
    cin>>a;
    s.insert(a);

}
for(auto x:s)
{
    v.pb(x);
}
n=v.size();
ll lcm=v[0];
bool flag=true;
for(ll i=1;i<n;i++)
{
    ll x=gcd(v[i],lcm);
    ll y=(lcm*v[i])/x;
    if(y>2*m)
    {
        flag=false;
        break;
    }
    lcm=y;
}
if(flag==false)
{
    cout<<0<<endl;
    return 0;
}
ll z=lcm/2;
for(ll i=0;i<n;i++)
{
    ll a=z%v[i];
    if(a!=(v[i]/2))
    {
        flag=false;
        break;
    }
}
if(flag==false)
{
    cout<<0<<endl;
    return 0;
}

ll ans=m/lcm;
ll hh=(ans+1)*lcm-(lcm/2);
if(hh<=m)
{
    ans++;
}
cout<<ans<<endl;


return 0;
}


Measured memory_bytes: 6140
import java.util.*;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		
		int max = a;
		if( a < b ) {
			max = b;
		}
		int flag = 0;
		for(int i = max; i > 0; i--) {
			if( a%i == 0 && b%i == 0 ) {
				flag++;
			}
			if(flag == k) {
				System.out.println(i);
				break;
			}
		}
	}
}

Measured memory_bytes: 22356
A , N = %w(7 5 3), gets.to_i
def dfs(v); [v] + A.map{ |a| dfs(v + a) } if v.to_i <= N; end
def all_in?(s); A.select{|v| !s.include?(v)}.length == 0; end
p A.map{|v| dfs(v)}.flatten.compact.select{|v| all_in?(v) }.length

Measured memory_bytes: 8184
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int, X: int, Y: int):
    ans = 10**9
    if Y > X:
        bigger_y = 1
        bigger_x = 0
    elif Y == X:
        bigger_y = 1
        bigger_x = 1
    else:
        bigger_y = 0
        bigger_x = 1

    if A + B < 2 * C:#C=0
        ans = A*X + B*Y
    else:#C>1
        #Aを2*Cで補うときの利益 > Bを2*Cで補うときの利益
        if A*X - 2*C*X + B*(Y-X)*bigger_y > B*Y - 2*C*Y + A*(X-Y)*bigger_x:
            #A=0
            if bigger_x:
                ans = 2*C*X
            else:
                ans = 2*C*X + (Y-X)*B

        #Aを2*Cで補うときの利益 <= Bを2*Cで補うときの利益
        else:
            #B=0
            if bigger_y:
                ans = 2*C*Y
            else:
                ans = 2*C*Y + (X-Y)*A
        if 2*C < A and 2*C < B:
            ans = min(ans, 2*C*max(X,Y))
    print(ans)

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(A, B, C, X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
N = input()
K = int(input())

def comb(n,k):
    if k==0:
        return 1
    if k==1:
        return n
    if k==2:
        return (n*(n-1))//2
    if k==3:
        return (n*(n-1)*(n-2))//6

def rec(n,k):
    res = 0
    if k < 0:
        return res
    if k==0:
        res = 1
        return res
    if len(n)<k:
        return res
    if n[0] != '0':
        res += rec(n[1:],k-1)
        res += (int(n[0])-1)*comb(len(n)-1,k-1)*9**(k-1)
        res += comb(len(n)-1,k)*9**k
    else:
        res += rec(n[1:],k)
    return res

print(rec(N,K))

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef pair<double,ll> pdl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<pdd> vdd;
typedef vector<pdi> vdi;
typedef vector<pdl> vdl;
typedef vector<string> vs;
#define fi first
#define se second
const ll INFLL=LLONG_MAX;
const int INF=INT_MAX;
const ll MAXLL=0x3f3f3f3f3f3f3f3f;
const int MAX=0x3f3f3f3f;
const ll MOD=1000000007;
const ll mod=998244353;
#define eb emplace_back
#define emp emplace
#define mp(a,b) make_pair(a,b)
template<class T> using min_heap=priority_queue<T,vector<T>,greater<T> >;
template<class T>
void sort(vector<T>& v){
	sort(v.begin(),v.end());
}
template <class T, class U>
void sort(vector<T>& v,U func){
	sort(v.begin(),v.end(),func);
}
template<class T>
void rsort(vector<T>& v){
	sort(v.rbegin(),v.rend());
}
template <class T>
int lb_index(vector<T>& v,T k){
	return lower_bound(v.begin(),v.end(),k)-v.begin();
}
template <class T>
int ub_index(vector<T>& v,T k){
	return upper_bound(v.begin(),v.end(),k)-v.begin();
}
template<class T>
bool is_sorted(vector<T>& v){
	return is_sorted(v.begin(),v.end());
}
template<class T>
bool sorted(vector<T>& v){
	return is_sorted(v);
}
void precompute(){

	return;
}
void solve(){
	int n;
	cin>>n;
	vl a(n),b(n);
	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	ll ans=0,p=0;
	for(int i=n-1;i>=0;i--){
		ll t=((b[i]-((p+a[i]))%b[i])%b[i]+b[i])%b[i];
		ans+=t;
		p+=t;
	}
	cout<<ans<<endl;
	return;
}

int main(){
	ios::sync_with_stdio(0);
	int numberofsubtestcases=1;
//	cin>>numberofsubtestcases;
	precompute();
	for(int looping=1;looping<=numberofsubtestcases;looping++){
//		cout<<"Case #"<<looping<<": ";
		solve();
	}
	return 0;
}




Measured memory_bytes: 4840
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  cout << (b-a == c-b ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#define _USE_MATH_DEFINES
#include <cmath>

#define rep(i, n)     for (int (i) = 0; (i) < (n); (i)++)
#define rep1(i, n)    for (int i = 1; i <= (int)(n); i++)

using namespace std;
typedef long long ll;

const int MAX = 500100;
const int INF = 2e9;
int cnt = 0, S[MAX];

void merge(int head, int mid, int tail) {
   int n1 = mid - head;
   int n2 = tail - mid;
   int L[n1 + 1], R[n2 + 1];

   rep(i, n1) L[i] = S[head + i];
   rep(i, n2) R[i] = S[mid + i];
   L[n1] = R[n2] = INF;

   int l = 0, r = 0;
   for (int i = 0; i < tail - head; i++) {
      if (L[l] <= R[r]) {
         S[head + i] = L[l];
         l++;
      }
      else{
         S[head + i] = R[r];
         r++;
      }
      cnt++;
   }
}

void mergeSort(int head, int tail) {
   int mid = (head + tail) / 2;

   if (head + 1 < tail) {
      mergeSort(head, mid);
      mergeSort(mid, tail);
      merge(head, mid, tail);
   }
}

int main() {
   int n;

   cin >> n;
   rep(i, n) scanf("%d", &S[i]);
   mergeSort(0, n);
   rep(i, n) {
      if (i != 0)
         printf(" ");
      printf("%d", S[i]);
   }
   printf("\n%d\n", cnt);
   return 0;
}



Measured memory_bytes: 7036
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	ll a[n][n];
	for(int i = 0; i<n; i++)
		for(int j = 0; j<n; j++)
			cin>>a[i][j];
	int flag = 0;
	for(int k = 0; k<n; k++)
		for(int i = 0;i <n; i++)
			for(int j = 0; j<n; j++)
			{
				if(a[i][j]>a[i][k]+a[k][j])
				flag = 1;
			}
	if(flag ==1)
		cout<<-1<<endl;
	else
	{
		ll ans = 0;
		for(int i = 0; i<n; i++)
			for(int j =0; j<n; j++)
			{
				int flag2 = 0;
				for(int k =0 ; k<n; k++)
					if(a[i][j]==a[i][k]+a[k][j] && k!=i && k!=j)
						flag2 = 1;
				if(!flag2)
					ans += a[i][j];
			}

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

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

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

    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;

    int f1 = a * x + b * y;
   
    // Bに合わせる
    int f2 = 0;
    f2 = c * 2 * y;
    f2 += a * max(0, (x - y));
    
    int f3 = 0;
    f3 = c * 2 * x;
    f3 += b * max(0, (y - x));

    int f4 = 0;
    f4 = c * 2 * max(x, y);

    cout << min(min(f1, f2), min(f3, f4)) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)
const ll INF=1LL << 60;
int main(){
    string s;
    cin >> s;
    int n=s.size();
    vector<vector<ll>> dp(2,vector<ll> (n,-INF));
    if (s[0]=='g') dp[0][0]=0;
    else dp[0][0] = -1;
    for (int i=1;i < n;i++){
      if (i==1){
        if (s[i]== 'g'){
          dp[0][1] = dp[0][0];
          dp[1][1] = dp[0][0]+1LL;
         }
        else{
          dp[0][1] = dp[0][0]-1LL;
          dp[1][1] = dp[0][0];
        }
      }
      else {
        if (s[i]== 'g'){
          dp[0][i] = max(dp[0][i-1],dp[1][i-1]);
          dp[1][i] = dp[0][i-1]+1LL;
         }
        else{
          dp[0][i] = max(dp[0][i-1]-1LL,dp[1][i-1]-1LL);
          dp[1][i] = dp[0][i-1];
        }  
      }
    }
    //rep(i,n){
    //  cout << dp[0][i] << " "; 
    //}
    //printf("\n");
    //rep(i,n){
    //  cout << dp[1][i] << " ";
    //}
    //printf("\n");
    cout << max(dp[0][n-1],dp[1][n-1]) << endl;
    
    return 0;
}


Measured memory_bytes: 2816
#include <cstdio>
#define MOD 1000000007
typedef long long ll; 
ll dp[2005][2005], ans; 
int main()
{
	// freopen("ARC068-F.in", "r", stdin);
	int n, k; 
	scanf("%d%d", &n, &k); 
	dp[0][n] = 1; 
	for (int i = 0; i < k - 1; i++)
	{
		ll cur = dp[i][n - i]; 
		for (int j = n - i - 1; j >= 1; j--)
		{
			(cur += dp[i][j]) %= MOD; 
			(dp[i + 1][j] += cur) %= MOD; 
		}
	}
	for (int i = 1; i <= n; i++)
		(ans += dp[k - 1][i]) %= MOD; 
	for (int i = 1; i < n - k; i++)
		ans = ans * 2 % MOD; 
	printf("%lld\n", ans);
	return 0; 
}


Measured memory_bytes: 30976
#include <bits/stdc++.h>
using namespace::std;
#define int long long

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sax(x) cout << "!!!!!!!!!!! " << #x << " = " << x << '\n'
#define inf (sizeof(int) == 4 ? (int)1E9 : (int)1E18)
#define one(x) x.insert(x.begin(), 0);
#define TCT template <class T>
#define TCT12 template <class T1, class T2>

//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,
//tree_order_statistics_node_update> imsi;

TCT12 istream& operator>>(istream &I, pair<T1,T2>& p) {return I >> p.first >> p.second;}
TCT12 ostream& operator<<(ostream &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}
TCT istream& operator>>(istream &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
TCT ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const unordered_set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const unordered_multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT12 ostream& operator<<(ostream &O, const unordered_map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
TCT12 ostream& operator<<(ostream &O, const map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
TCT istream& operator>>(istream &I, deque<T>& v) {for (T &e: v) I >> e; return I;}
TCT ostream& operator<<(ostream &O, const deque<T>& v) {for (const T &e: v) O << e << ' '; return O;}
typedef pair<int,int> pii;
typedef vector<int> vi;





void _main() {
        char c; cin >> c; c++;
        cout << (char) c;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
l = [0 for i in range(n)]
for i in range(n):
    l[a[i]-1] += 1
l.sort()
cnt = 0
for i in range(n-k):
    cnt += l[i]
print(cnt)

Measured memory_bytes: 85584
#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>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
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 long long MOD = 1000000007;
const long long INF = (1LL << 60);
using namespace std;
typedef long long ll;
map<int, int> mp;
using Graph = vector<vector<int>>; 
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))


int dp[100100];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	for (int i = 0; i < 100100; i++) dp[i] = INF;
	dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int pow6 = 1; pow6<=i;pow6*=6) {
			dp[i] = min(dp[i],dp[i - pow6] + 1);
		}
		for (int pow9 = 1; pow9 <= i; pow9 *= 9) {
			dp[i] = min(dp[i], dp[i - pow9] + 1);
		}
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main() {
#ifdef RUN_LOCAL
  ifstream in("../input.txt");
  cin.rdbuf(in.rdbuf());
#endif

  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  int sum = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int k = 1; k <= n; ++k) {
        sum += gcd(gcd(i, j), k);
      }
    }
  }

  cout << sum << endl;


  return 0;
}


Measured memory_bytes: 3172
#include <iostream>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std;

#define rip(i,n,s) (int i=(s);i<(int)n;i++)
#define all(a) (a.begin(),a.end())

int main(){
	int n,w;
	cin >> n >> w;
	vector<pair<int,int>> da(n);
	for rip(i,n,0){
		cin >> da[i].first >> da[i].second;
	}
	vector<vector<int>> dp(n+1,vector<int>(100001,0));
	for rip(i,100001,1){
		dp[0][i]=INT_MAX;
	}
	for rip(i,n,0){
		for rip(j,100001,1){
			dp[i+1][j]=dp[i][j];
			if(j>=da[i].second){
				int x=max(dp[i][j-da[i].second]+da[i].first,dp[i][j-da[i].second]);
				dp[i+1][j]=min(dp[i+1][j],x);
			}
		}
	}
	int ans=0;
	for rip(i,100001,1){
		if(dp[n][i]<=w){
			ans=i;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 40192
def bubbleSort(a, n):
    count = 0
    flag = 1
    while flag:
        flag = 0
        for j in range(n - 1, 0, -1):
            if a[j] < a[j - 1]:
                a[j], a[j - 1] = a[j - 1], a[j]
                count += 1
                flag = 1
    return count


def main():
    n = int(input())
    a = [int(x) for x in input().split(' ')]
    count = bubbleSort(a, n)
    print(' '.join([str(x) for x in a]))
    print(count)

if __name__ == '__main__':
    main()

Measured memory_bytes: 7768
o=input()
e=input()
n=max(len(o),len(e))
ans=''
for i in range(n):
    if len(o)>len(e):
        ans+=o[i]
        if i!=n-1:
            ans+=e[i]
    else:
        ans+=o[i]
        ans+=e[i]       
print(ans)

Measured memory_bytes: 3060
/*

 Remember, Hope is a good thing... May be the best of things... and No Good thing ever Dies !!!

*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios::sync_with_stdio(0); cout.tie(0);
#define endl "\n"
#define MOD 1000000007
#define MOD1 1e18
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
typedef long double ld;
const ll inf=(1LL<<60)-1;
const ll mxn=1e5;
int dx[]= {-1,1,0,0};
int dy[]= {0,0,-1,1};
bool ans[100005];
vector<ll>city[100005];
ll bigmod(ll x,ll n)
{
    ll res=1;
    while(n>0)
    {
        if(n&1)
            res=(res*x)%MOD;
        x=(x*x)%MOD;
        n>>=1;
    }
    return res;
}
/*
sort(v.begin(),v.end(),[&](const pair<ll,ll>&a,const pair<ll,ll>&b)
   {
       if(a.first==b.first)
           return a.second<b.second;
       else
           return a.first>b.first;
   });
   */
ll rev(ll a)
{
    return (a%10)*10+a/10;
}
void dfs(ll n)
{
   if(!ans[n])
   {
       ans[n]=1;
       for(auto i:city[n])
       {
           dfs(i);
       }
   }
}
void solve()
{
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
  ll n,m,cnt=0;
  cin>>n>>m;
  for(ll i=0;i<m;i++)
  {
      ll a,b;
      cin>>a>>b;
      a--,b--;
      city[a].push_back(b);
      city[b].push_back(a);
  }
  for(ll i=0;i<n;i++)
  {
      if(!ans[i])
      {
          cnt++;
          dfs(i);
      }
  }
  cout<<cnt-1<<endl;
}
int main()
{
    IOS;
    //ll t;
    //cin>>t;
    //while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 10428
#include<cstdio>
#include<cstdlib>
#define LL long long
using namespace std;
int main() {
    LL x,y;
    scanf("%lld%lld",&x,&y);
    if(llabs(x-y)>=2)
        printf("Alice\n");
    else
        printf("Brown\n");
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;


public class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char c[] = s.toCharArray();
		
		if(c[0] == c[1] && c[1] == c[2]) {
			System.out.println("Yes");
		}else if(c[1] == c[2] && c[2] == c[3]) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int n;
	cin >> n;
	vector<int> p(n);
	rep(i,0,n){
		cin >> p[i];
	}
	int cnt = 0;
	int curMin = INF;
	rep(i, 0, n) {
		curMin = min(curMin, p[i]);
		if (curMin == p[i])cnt++;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
    int N;
    cin >> N;
    if(N %1000 != 0){
        N %= 1000;
        cout << 1000 - N << endl;
    }
    else if(N % 1000 == 0 ) cout << 0 << endl;
}

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

int main()
{
	int a,b,ans1,ans2,ans3;

	cin >> a >> b;
	ans1 = a+b;
	ans2 = 2*a - 1;
	ans3 = 2*b - 1;

	cout << max(ans1, max(ans2, ans3)) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    long long a,b,k;
    cin>>a>>b>>k;
    if (a>=k) cout<<a-k<<" "<<b<<endl;
    else if(a<k && a+b>=k) cout<<0<<" "<<b-(k-a)<<endl;
    else cout<<0<<" "<<0<<endl;
    return 0;
}

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

int main(){
  int k;cin>>k;
  string s;
  cin>>s;
  if(s.size() <= k) { cout << s << endl;}
  else {
    string sub = s.substr(0,k);
    cout << sub << "..." <<endl;
  }
    
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define TEST cout << "pass" << endl;
const ll MOD = 1e9+7;


ll inverse(ll a){
  ll n = MOD-2;
  ll res = 1;
  while(n){
    if(n & 1){
      res = res * a % MOD;
    }
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}

int main(){
  int n;
  cin >> n;
  ll a[10000], inv[10000];
  rep(i, n) cin >> a[i];
  for(int i = 0; i < n; i++){
    inv[i] = inverse(a[i]);
  }
  int L[1000000];
  fill(L ,L + 1000000, 0);
  ll g = 1;
  rep(i, n){
    for(int j = 2; j * j <= a[i]&& a[i] != 1; j++){
        if(a[i] % j == 0){
            int cnt = 0;
            while(a[i] % j == 0){
                a[i] /= j;
                cnt++;
            }
            L[j] = max(L[j], cnt);
        }
    }
    L[a[i]] = max(L[a[i]], 1);
    
  }
  for(int i = 2; i < 1000000; i++){
      if(L[i]){
          int x = i;
          while(L[i]){
              if(L[i] & 1){
                  g = g * x % MOD;
              }
              L[i] >>= 1;
              x = x * x % MOD;
              
          }
      }
  }
  ll ans = 0;
  for(int i = 0; i < n; i++){
      ans += g * inv[i];
      ans %= MOD;
  }
  cout << ans << endl;
}
  



Measured memory_bytes: 7652
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>

typedef long long ll;

using namespace std;

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

    ll diff = a - b;
    c = c - diff;

    if (c < 0)
        c = 0;
    cout << c << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef long double ld;

using namespace std;

const int MAXN = 200010;

const int LG = 22;
int x[MAXN], p[MAXN][LG], f[MAXN * 3], v[MAXN], vs = 0;
int f2[MAXN * 3],  p2[MAXN][LG];

int main()
{
	int n;
	scanf("%d%d", &n, v);
	vs = 0;
	while (v[vs] > 0)
	{
		v[vs + 1] = v[vs] / 2;
		vs++;
	}
	vs++;
	for (int i = 0; i < n; i++)
		scanf("%d", x + i);

	for (int i = 0; i < vs; i++)
	{
		p[n][i] = p[n - 1][i] = n;
		for (int j = n - 2; j >= 0; j--)
		{
			if (x[j + 1] - x[j] > v[i]) p[j][i] = j + 1;
			else p[j][i] = p[j + 1][i];
		}
	}
	for (int i = 0; i < vs; i++)
	{
		p2[0][i] = p2[1][i] = 0;
		for (int j = 2; j <= n; j++)
		{
			if (x[j - 1] - x[j - 2] > v[i]) p2[j][i] = j - 1;
			else p2[j][i] = p2[j - 1][i];
		}
	}
	memset(f, 0, sizeof(f));
	for (int i = 0; i < (1 << vs); i++)
		for (int j = 0; j < vs; j++)
		{
			if (i & (1 << j)) continue;
			int nv = i + (1 << j);
			f[nv] = max(f[nv], p[f[i]][j]);
		}
	for (int i = 0; i < (1 << vs); i++) f2[i] = n;
	for (int i = 0; i < (1 << vs); i++)
		for (int j = 0; j < vs; j++)
		{
			if (i & (1 << j)) continue;
			int nv = i + (1 << j);
			f2[nv] = min(f2[nv], p2[f2[i]][j]);

		}
	int msk = (1 << vs) - 1;
	if (f[msk] < n)
	{
		for (int i = 0; i < n; i++) printf("Impossible\n");
		return 0;
	}
	int l, r;
	for (l = 0; l != n; l = r)
	{
		r = p[l][0];
		bool ok = false;
		for (int i = 0; i < (1 << vs); i++)
		{
			if (i & 1) continue;
			if ((f[i] >= l) && (f2[msk - 1 - i] <= r))
				ok = true;
		}
		for (int i = l; i < r; i++)
			if (!ok) printf("Impossible\n");
			else printf("Possible\n");
	}
	return 0;
}


Measured memory_bytes: 43008
N,M = map(int,input().split())
MOD = 1000000007
a = [int(input()) for _ in range(M)]
dp_list = [-1] * (N+1)

#brokenのところを0に
for i in range(M):
  dp_list[a[i]] = 0

#最後の段の確定
if dp_list[N] != 0:
  dp_list[N] = 1
  
#最後の段の一段前の値を確定
if dp_list[N-1] != 0:
  dp_list[N-1] = 1

#漸化式で求める
for i in range(N-2,-1,-1):
  if dp_list[i] == 0:
    continue
  dp_list[i] = dp_list[i+1] + dp_list[i+2]

print(dp_list[0]%MOD)

Measured memory_bytes: 460020
from itertools import combinations
L, R = map(int, input().split())
A = 2019
M = min(R+1, L+A)

a = min(i % A for i in range(L, M))
if a == 0:
    print(0)
else:
    print(min((i*j) % A for (i, j) in combinations(range(L, R+1), 2)))
    # print(min((a * (a+1)) % A, (b * (b+1)) % A))


Measured memory_bytes: 3060
def my_code_D():
    mod = 10**9+7
    n,k = map(int, input().split())
    res = 0
    for i in range(k,n+1):
        count = (n*i - i*(i-1) + 1)%mod
        res = (res + count)%mod
    res = (res+1)%mod
    print(res)

my_code_D()


Measured memory_bytes: 9112
r, c = map(int, input().split())
a = []

for i in range(r):
    a.append(list(map(int, input().split())))
    a[i].append(sum(a[i]))

for i in range(r):
    print(" ".join(list(map(str, a[i]))))

col_sum = []
for j in range(c+1):
    su = 0
    for i in range(r):
        su += a[i][j]
    col_sum.append(su)

print(" ".join(list(map(str, col_sum))))





Measured memory_bytes: 5704
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    S = input()

    ans = 0
    for p in range(1000):
        p = str(p).zfill(3)

        i = 0
        for j in range(N):
            if S[j] == p[i]:
                i += 1

                if i == 3:
                    ans += 1
                    break

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 40304
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
#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 pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
#define itn int
int N;
int S[300][300];
int C[300];
bool dbg = false;
void solve() {
    bool flag = true;
    C[0] = 1;
    queue<int> que;
    que.push(0);
    while (!que.empty()) {
        int i = que.front();
        que.pop();
        FOR(j, 0, N) {
            if (S[i][j]) {
                if (C[j] == 0) {
                    C[j] = C[i] * -1;
                    que.push(j);

                } else if (C[j] != C[i] * -1) {
                    flag = false;
                }
            }
        }
    }
    FOR(i, 0, N) {
        FOR(j, 0, N) {
            if (!S[i][j] && i != j) {
                S[i][j] = INF;
            }
        }
    }
    int MAX = 0;
    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                if (S[i][k] == INF || S[k][j] == INF)
                    continue;
                S[i][j] = min(S[i][j], S[i][k] + S[k][j]);
            }
        }
    }
    /*
    FOR(i, 0, N) {
        FOR(j, 0, N) {
            cout << S[i][j] << " ";
        }
        cout << endl;
    }
    */
    FOR(i, 0, N) {
        FOR(j, 0, N) {
            MAX = max(MAX, S[i][j]);
        }
    }
    if (flag) {
        cout << MAX + 1 << endl;
    } else {
        cout << -1 << endl;
    }
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(i, 0, N) {
        FOR(j, 0, N) {
            char c;
            cin >> c;
            S[i][j] = c - '0';
        }
    }
    solve();
    return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<cmath>
using namespace std;
int n,m,v;
int a[55],b[55],c[55],d[55],ans[55];
int main(){
    cin>>n>>m;
    for(int i=0;i<n;i++)cin>>a[i]>>b[i];
    for(int i=0;i<m;i++)cin>>c[i]>>d[i];
    for(int i=0;i<n;i++){
        int t=1e9;
        for(int j=0;j<m;j++){
            int s=abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(s<t){
              t=s;
              v=j+1;
            }
        }
        ans[i]=v;
    }
    for(int i=0;i<n;i++)cout<<ans[i]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long  long
#define ld long double
#define mod 1000000007
#define max_char 128
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define lbd lower_bound
#define ubd upper_bound
#define PI 3.141592653589793238
#define pf push_front
#define all(x) x.begin(),x.end()
#define input(arr,n) for(ll c1=0;c1<n;c1++)cin>>arr[c1];
#define rep(i,a,n) for( ll i=a ; i<n ; i++)
#define mems(x, y) memset(x, y, sizeof(x))
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
//cout<<"Case #"<<v1+1<<": ";

ll power(ll base,ll pow, ll mo)
{
   ll res=1;
   while(pow)
   {     
        if (pow%2!=0)  res=(res*base)%mo;
        base=(base*base)%mo;
        pow/=2;
   }
   return res;
}


int main()
{
    fastio
	ll a,b,c,d;
	string s;
	ll n;
	cin>>n;
	map<string,ll>m;
	ll ans=0;
	for(a=0;a<n;a++)
	{
	    cin>>s;
	    m[s]++;
	    if(m[s]==1)
	    ++ans;
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 19252
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;


namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');

            long[] v = new long[N];
            for (int i = 0; i < N; i++)
            {
                v[i] = long.Parse(s[i]);
            }
            Array.Sort(v);

            double ans = v[0];
            for (int i = 1; i < N; i++)
            {
                ans += v[i];
                ans /= 2;
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11348
N = int(input())
Xs = input()
Xlist = Xs.split(' ')
Xlist.sort()
anslist = []
if len(set(Xlist)) != 1:
    for P in range(int(Xlist[0]),int(Xlist[N - 1])+1):
        ans = 0
        for i in range(len(Xlist)):
            ans = ans + (int(Xlist[i]) - P)**2
        anslist.append(ans)
    print(min(anslist))
else:
    print(0)

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

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

struct Query { ll cmd, a, b; };

vector<ii> solve(const vector<Query>& qs)
{
    vector<ii> ans;

    priority_queue<int> L;
    priority_queue<int, vector<int>, greater<int>> R;

    ll ls = 0, rs = 0, bs = 0;

    for (auto q : qs)
    {
        switch (q.cmd) {
        case 1:
            {
                L.push(q.a);
                ls += q.a;

                while (not R.empty() and L.top() > R.top())
                {
                    auto x = L.top(), y = R.top();

                    L.pop();
                    R.pop();

                    ls -= x;
                    ls += y;
                    L.push(y);

                    rs -= y;
                    rs += x;
                    R.push(x);
                }

                if (L.size() - R.size() > 1)
                {
                    auto x = L.top();
                    L.pop();

                    ls -= x;
                    rs += x;

                    R.push(x);
                }

                bs += q.b;
            } 
            break;

        default:
            {
                auto median = L.top();
                auto f = bs + (median * L.size() - ls) + (rs - median * R.size());

//cout << "-- median: " << median << endl;
//cout << "-- f: " << f << endl;

                ans.push_back(ii(median, f));
            }

            break;
        }
    }

    return ans;
}

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

    int Q;
    cin >> Q;

    vector<Query> qs(Q);

    for (int i = 0; i < Q; ++i)
    {
        cin >> qs[i].cmd;

        if (qs[i].cmd == 2)
            continue;

        cin >> qs[i].a >> qs[i].b;
    }

    auto ans = solve(qs);

    for (auto p : ans)
        cout << p.first << ' ' << p.second << '\n';

    return 0;
}


Measured memory_bytes: 9712
#!/usr/bin/env python3
#ABC94 D

import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7

n = int(input())
a = list(map(int,input().split()))
a.sort()
m = max(a)
l = 0
ans = a[0]
for i in a[:n-1]:
    if l < min(m-i,i):
        l = min(m-i,i)
        ans = i
print(m,ans)


Measured memory_bytes: 62704
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int main(){
    string s;
    int count=0;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='o'){
            count++;
        }
    }
    int a = 15-s.size();
    if(a+count>=8)
            cout<<"YES"<<endl;
    else{cout<<"NO"<<endl;}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    string s;
    cin >> s;
    rep(i, sz(s)) cout << 'x';
    cout << endl;
}


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

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

    if (a < b && b < c) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }

    return 0;
}


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

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

    string S, T;
    cin >> S >> T;

    int M;
    int max = 10000;
    int ans = 0;

    for(int i=0; i < S.size() - T.size() + 1; i++){
        M = 0;
        for(int j=0; j < T.size(); j++){
            if(T[j] == S[i+j]){
                M++;
            }              
        }

        if(max > T.size() - M){
            ans = T.size() - M;
            max = ans;
        }      

    }

    if(ans == 0 && max != 0){
        ans = T.size();
    }
    
    cout << ans;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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; }     //最小公倍数

void yes()
{
    cout << "Yes" << endl;
}
void no()
{
    cout << "No" << endl;
}
//-----------------------------------------
int H, W ;
vector<vector<int>> seen ;
vector<vector<char>> grid ;
vector<vector<int>> dist ;
queue<pair<int,int>> que ;
//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> H >> W ;



    vector<vector<int>> zero(H,vector<int>(W,0)) ;
    seen = zero ;
    dist = zero ;
    
    int cnt = 0 ;
    
    vector<string> str(H) ;
    for(int i=0;i<H;i++){
        cin >> str[i] ;
    }

    for(int i=0;i<H;i++){
        grid.push_back(vector<char>()) ;
        for(int j=0;j<W;j++){
            grid[i].push_back(str[i][j]) ;
            if(grid[i][j]=='.'){
                cnt++ ;
            }
        }
    }

    que.push(make_pair(0,0)) ;
    seen[0][0] = 1 ;
    dist[0][0] = 0 ;

    while(!que.empty()){
        int x, y ;
        x = que.front().first ;
        y = que.front().second ;
        que.pop() ;
        for(int i=0;i<4;i++){
            int nx = x +dx[i] ;
            int ny = y +dy[i] ;
            if(nx>=0 && nx<H && ny>=0 && ny<W && seen[nx][ny]==0){
                if(grid[nx][ny]=='.'){
                    seen[nx][ny] = 1 ;
                    que.push(make_pair(nx,ny)) ;
                    dist[nx][ny] = dist[x][y] + 1 ;
                }
            }
        }
    }

    if(seen[H-1][W-1]==0){
        cout << -1 <<endl ;
    }
    else{
        cout << cnt - dist[H-1][W-1]-1 <<endl ;
    }
    

    return 0;
}


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 P = pair<int,int>;

 
int main() {
    int c[3][3];
    int a[3] = {0}, b[3] = {0};
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    
    for(int i = 0; i < 3; i++){
        b[i] = c[0][i] - a[0];
    }
    for(int i = 0; i < 3; i++){
        a[i] = c[i][0] - b[0];
    }

    bool yes = true;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            if(a[i] + b[j] != c[i][j]){
                yes = false;
            }
        }
    }
    if(yes) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

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

    if(a == b && b == c) cout << "Yes" << endl;
    else if(b == c && c == d) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 764
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let x = input::<usize>();
    let y = input::<usize>();
    let z = input::<usize>();
    let k = input::<usize>();
    let mut a = (0..x).map(|_| input::<i64>()).collect::<Vec<_>>();
    let mut b = (0..y).map(|_| input::<i64>()).collect::<Vec<_>>();
    let mut c = (0..z).map(|_| input::<i64>()).collect::<Vec<_>>();

    a.sort();
    b.sort();
    c.sort();
    a.reverse();
    b.reverse();
    c.reverse();

    let mut ans = Vec::new();
    let mut q = std::collections::BinaryHeap::new();
    let mut ck = std::collections::HashSet::new();
    q.push((a[0] + b[0] + c[0], (0, 0, 0)));
    ck.insert((0, 0, 0));
    for _ in 0..k {
        let (s, p) = q.pop().unwrap();
        ans.push(s);

        if p.0 < x - 1 && !ck.contains(&(p.0 + 1, p.1, p.2)) {
            let next = (p.0 + 1, p.1, p.2);
            q.push((a[p.0 + 1] + b[p.1] + c[p.2], next));
            ck.insert(next);
        }
        if p.1 < y - 1 && !ck.contains(&(p.0, p.1 + 1, p.2)) {
            let next = (p.0, p.1 + 1, p.2);
            q.push((a[p.0] + b[p.1 + 1] + c[p.2], next));
            ck.insert(next);
        }
        if p.2 < z - 1 && !ck.contains(&(p.0, p.1, p.2 + 1)) {
            let next = (p.0, p.1, p.2 + 1);
            q.push((a[p.0] + b[p.1] + c[p.2 + 1], next));
            ck.insert(next);
        }
    }

    let stdout_ = std::io::stdout();
    let mut stdout = stdout_.lock();
    for an in ans {
        write!(stdout, "{}\n", an).unwrap();
    }
}


Measured memory_bytes: 4352