akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<climits>
typedef long long ll;
using namespace std;
int main()
{
  ll a;
  cin>>a;
  ll b;
  cin>>b;
  ll n;
  cin>>n;
  ll k=min(b-1,n);
    ll medi=floor((a*k)/b)- a*(floor(k/b));


  cout<<medi;
}


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

int main(){
 int N;
  cin >> N;
  int ans = 0;
  for(int i=0; i<N; i++){
   int l,r;
    cin >> l >> r;
    ans += r-l+1;
  }
  cout << ans << "\n";
 return 0; 
}

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


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


    if(n/100==7){
        cout<<"Yes"<<endl;
    }else if((n%100)/10==7){
        cout<<"Yes"<<endl;
    }else if((n%10)/1==7){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }


    return 0;

}



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

int main() {
  int N, max, k, sub=0;
  cin >> N;
  vector<int> card(N);
  vector<int> sort(N);
  
  for(int i=0;i<N;i++){
    cin >> card.at(i);
  }
  
  for(int i=0;i<N;i++){
    max=0;
    for(int j=0;j<N;j++){
      if(max<card.at(j)){
        max = card.at(j);
        k=j;
      }
    }
    sort.at(i) = max;
    card.at(k) = 0;
  }
  
  for(int i=0;i<N;i++){
    if(i % 2 == 0){
      sub += sort.at(i);
    }else{
      sub -= sort.at(i);
    }
  }
  cout << sub << endl;
  
  
}


Measured memory_bytes: 3616
#include<stdio.h>

int main(){
  int N, C, i, x, sum = 0;
  scanf("%d %d", &N, &C);

  for ( i = 0; i < C; i++ ){
    scanf("%d", &x);
    sum += x;
  }
  N++;

  printf("%d\n", sum/N + (sum%N==0?0:1));

  return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};



int main()
{
    ll n,m,k;
    VLL a, b;
    cin>>n>>m>>k;
    REP(i,n) {
        ll t;
        cin>>t;
        a.push_back(t);
    }
    REP(i,m) {
        ll t;
        cin>>t;
        b.push_back(t);
    }
    ll ans = 0ll;
    ll a_max = n, b_max = m;
    ll val = 0ll, cnt = 0ll;
    REP(i,n) {
        val += a[i];
        cnt++;
        if (val > k) {
            a_max = i;
            val -= a[i];
            cnt--;
            break;
        }
    }
    REP(i,m) {
        val += b[i];
        cnt++;
        if (val > k) {
            b_max = i;
            val -= b[i];
            cnt--;
            break;
        }
    }
    ans = cnt;
    while (a_max > 0 && b_max < m) {
        val -= a[a_max-1];
        a_max--;
        cnt--;
        FOR(i,b_max,m) {
            val += b[i];
            cnt++;
            if (val > k) {
                b_max = i;
                val -= b[i];
                cnt--;
                break;
            }
        }
        CHMAX(ans,cnt);
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 7992
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
  int N, A;
  cin >> N >> A;
  cout << N * N - A << endl;
}

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

#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 EPS (1e-7)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int MAX=1e9;

int main(){
	char x,y;
	cin>>x>>y;
	if(x-'A'<y-'A'){
		cout<<"<"<<endl;
	}else if(x-'A'>y-'A'){
		cout<<">"<<endl;
	}else{
		cout<<"="<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  var line, buffer []byte
  var isPrefix bool = true
  var err error
  for isPrefix {
    line, isPrefix, err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
  }
  return string(buffer)
}
func NextInt() int {
  var n int
  n, _ = strconv.Atoi(NextLine())
  return n
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func Output() {
  _ = writer.Flush()
}

func main() {
  N := NextInt()
  A := make([]int, N)
  for i := range A {
    A[i] = NextInt()
  }
  sort.Ints(A)
  cnt := A[N - N / 2] - A[N / 2 - 1]
  for i := 0; i < N / 2 - 1; i++ {
    cnt += (A[N - 1 - i] - A[i]) * 2
  }
  if N % 2 == 1 {
    if A[N / 2] - A[N / 2 - 1] < A[N / 2 + 1] - A[N / 2] {
      cnt += A[N / 2 + 1] - A[N / 2]
    } else {
      cnt += A[N / 2] - A[N / 2 - 1]
    }
  }
  Write(cnt)
  Output()
}

Measured memory_bytes: 5504
# include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL dis[303][303];
int main()
{
    LL sum = 0;
    int n;
    scanf("%d",&n);
    for(int i=1; i<=n; ++i)
        for(int j=1; j<=n; ++j) scanf("%lld",&dis[i][j]);
    for(int i=1; i<n; ++i)
    {
        for(int j=i+1; j<=n; ++j)
        {
            LL imin = 0x3f3f3f3f3f3f3f3f;
            for(int k=1; k<=n; ++k)
            {
                if(k==i||k==j) continue;
                if(dis[i][k]+dis[k][j] < dis[i][j]) return 0*puts("-1");
                imin = min(imin, dis[i][k]+dis[k][j]);
            }
            if(imin > dis[i][j]) sum += dis[i][j];
        }
    }
    printf("%lld\n",sum);
    return 0;
}


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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

int main(void){
    int N, x; cin >> N >> x;
    if(x == 1 || x == 2*N-1){
        cout << "No" << endl;
    }
    else if(x == 2 || x == 2*N-2){
        if(N == 2){
            cout << "Yes" << endl;
            rep(i, 3) cout << i+1 << endl;
        }
        else if(N == 3){
            cout << "Yes" << endl;
            if(x == 2) printf("4\n1\n2\n3\n5\n");
            else printf("1\n5\n4\n2\n3\n");
        }
        else{
            cout << "Yes" << endl;
            vector<int> out_order(2*N, 0);
            for(int i = 1; i < out_order.size(); i++){
                out_order[i] = i;
            }
            if(x == 2){
                swap(out_order[N-1], out_order[1]);
                swap(out_order[N], out_order[2]);
            }
            else{
                swap(out_order[N+1], out_order[2*N-1]);
                swap(out_order[N], out_order[2*N-2]);
            }
            for(int i = 1; i < out_order.size(); i++) cout << out_order[i] << endl;

        }

    }
    else{
        //N > 3で構築可能。真ん中にxxxとなるようにする
        //A = (a_1, a_2,  ..., a_n-2, a_n-1, a_n, a_n+1, a_n+2, ..., a_2n-1)とすると
        //a_n-2 = x-2, a_n-1 = x+1, a_n = x, a_n+1 = x-1, a_n+2 = x+2とする
        cout << "Yes" << endl;

        int use[2*N] = {};
        use[x-2] = 1; use[x-1] = 1; use[x] = 1; use[x+1] = 1; use[x+2] = 1;
        int out_order[2*N] = {};
        out_order[N-2] = x-2; out_order[N-1] = x+1; out_order[N] = x; out_order[N+1] = x-1; out_order[N+2] = x+2;
        int loop = 2*N;
        int idx_use = 1;
        for(int i = 1; i < loop; i++){
            if(out_order[i] != 0) continue;
            while(use[idx_use] == 1) idx_use++;
            out_order[i] = idx_use;
            use[idx_use] = 1;
        }
        for(int i = 1; i < loop; i++){
            cout << out_order[i] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3072
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
typedef long long ll;
const ll MOD = 1e9+7;
int main(int argc,char **argv){
    (void)argc;
    (void)argv;
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin>>s;
    if(s[s.size()-1]=='s')cout<<s<<"es"<<endl;
    else cout<<s<<'s'<<endl;
    return 0;
}

Measured memory_bytes: 3628
DEBUG=0

H, W = map(int, input().split())
coins = []
odds = []

for y in range(H):
    line = list(map(int, input().split()))
    coins.append(line)
    tmp = [x for x in range(W) if line[x] % 2 == 1]
    odds.append(tmp)

if DEBUG: print(odds)

hands = []
prev = None
#import pdb; pdb.set_trace()
for y, o in enumerate(odds):
    if y % 2 == 0:
        if prev is not None:
            for x in range(prev, 0, -1):
                hands.append((x, y-1, x-1, y-1))
            hands.append((0, y-1, 0, y))
            for x in range(o[0]):
                hands.append((x, y, x+1, y))
            del o[0]
        n = len(o)
        for i in range(n//2):
            for x in range(o[2*i], o[2*i+1]):
                hands.append((x, y, x+1, y))
        if(n%2==1):
            prev = o[-1]
        else:
            prev = None
    else:
        o = o[::-1]
        if prev is not None:
            for x in range(prev, W-1):
                hands.append((x, y-1, x+1, y-1))
            hands.append((W-1, y-1, W-1, y))
            for x in range(W-1, o[0], -1):
                hands.append((x, y, x-1, y))
            del o[0]
        n = len(o)
        for i in range(n//2):
            for x in range(o[2*i], o[2*i+1], -1):
                hands.append((x, y, x-1, y))
        if(n%2==1):
            prev = o[-1]
        else:
            prev = None

print(len(hands))
for h in hands:
    x, y, x_, y_ = [_ + 1 for _ in map(int, h)]
    print(y, x, y_, x_)


Measured memory_bytes: 28868
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int op = a + b;
		if (24 <= op){
			op = op -24;
		}
		System.out.println(op);
	}

}

Measured memory_bytes: 21844
#include <stdio.h>

int main()
{
	long long N, K;
	scanf("%lld %lld", &N, &K);
	
	long long a, b, ans = 0;
	for (b = K + 1; b <= N; b++) {
		ans += (N - N % b) / b * (b - K);
		if (N % b >= K) ans += N % b - K + 1;
	}
	if (K == 0) ans -= N;
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h> 
     
    using namespace std; 
    // using namespace arma;
     
    #define ll long long
    #define ld long double
    // int ans(vector < vector<int > > xx)
    // {
    // 	return 0;
    // }
    int main()
    {
    	ll n;
        cin >> n;
        ll vl=n/1000;
        if(n%1000)
            vl+=1;
        ll sum=vl*1000;
        ll ans=sum-n;
    	cout << ans << "\n";
    }

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long           ll;
typedef unsigned long long  ull;
 
#define srev                reverse(s.begin(),s.end())
#define sortstr             sort(s.begin(), s.end());
#define gtl(x)              getline(cin, (x))
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define PI                  acos(-1)
#define Precision(a) 		cout << fixed << setprecision(a)
#define Faster       		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
template <typename T> T Sqr(T x) { T n = x * x ; return n ;}
template <typename T> T Pow(T B,T P){ if(P==0) return 1; if(P&1) return B*Pow(B,P-1);  else return Sqr(Pow(B,P/2));}
template <typename T> T Abs(T a) {if(a<0)return -a;else return a;}
template <typename T> T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template <typename T> T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}
//scanf("%[^\n]%*c", str);
//sort(s,s+n,greater<int>());
 
int main()
{
    string a, b, x, y;
    cin >> a >> b;
    int l=b.length();
    x=b.substr(0, l-1);
    y=a;
    if(y==x)cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

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

int main() {
    int N, A, B, C, D;
    string S;

    cin >> N >> A >> B >> C >> D >> S;
    A--, B--, C--, D--;

    bool two_shape = false;
    for (int i=A; i<=C-1; i++) {
        if (S[i]=='#' && S[i+1]=='#') two_shape = true;
    }
    for (int i=B; i<=D-1; i++) {
        if (S[i]=='#' && S[i+1]=='#') two_shape = true;
    }

    bool three_comma = false;
    for (int i=B-1; i<=min(D-1, N-3); i++) {
        if (S[i]=='.' && S[i+1]=='.' && S[i+2]=='.') three_comma = true;
    }

    string ans = "Yes";
    if (two_shape) ans = "No";
    if (C > D && !(three_comma)) ans = "No";
    cout << ans << endl;

    return 0;
}

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

using namespace std;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple

#define N 311111
#define A 1111111
#define BLOCK 555 // ~sqrt(N)

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

const int INF = 1e9 +5;

ll bin_search(ll arr[],ll x, ll l, ll r ){
	while(l<r){
		ll mid = (l+r+1)/2 ;
		ll power = (pow(2,mid+1)*x) - (arr[mid]);
		// cout<<l<<" "<<r<<" "<<mid<<" "<<power<<endl;
		if( power>0){
			l = mid;
		}
		else if(power <=0){
			r = mid-1;
		}
	}
	return l;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int t;
	// cin>>t;
	t = 1;
	while(t--){
		int n,q;
		string a,b;
		string ans = "";
		cin>>a>>b;
		int dp[a.length()+1][b.length()+1];
		for(int i=0;i<=a.length();i++){
			dp[i][0] = 0;
		}
		for(int j =0;j<=b.length();j++){
			dp[0][j] = 0;
		}
		for(int i=1; i<=a.length();i++){
			for(int j=1;j<=b.length();j++){
				if(a[i-1]==b[j-1]){
					dp[i][j] = dp[i-1][j-1]+1;
				}
				else{
					dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
				}
			}
		}
		int i=a.length();
		int j=b.length();
		while(i>=1 && j>=1){
			if(a[i-1]==b[j-1]){
				ans = a[i-1] + ans;
				i--;
				j--;
			}
			else{
				if(dp[i-1][j]==dp[i][j]){
					i--;
				}
				else{
					j--;
				}
			}			
		}	
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 35456
n = input()
k = int(input())
#nより小さいことが確定しているdp
#dp_0[i][j] := i桁目まで決めて、0でない数字をj個使った時の数字の個数
dp_0 = [[0 for i in range(k+1)] for j in range(len(n))]
#nより小さいことが確定していないdp
#dp_1[i][j] := i桁目まで決めて、0でない数字をj個使った時の数字の個数。
dp_1 = [[0 for i in range(k+1)] for j in range(len(n))]
dp_0[0][0] = 1
dp_0[0][1] = int(n[0]) - 1
dp_1[0][1] = 1
for i in range(1,len(n)):
    dp_0[i][0] = 1
    for j in range(1,k+1):
    #今回の桁が0でないことを想定
        if n[i] != '0':
            #0を使う場合と使わない場合両方考える
            #まずは使わない場合
            dp_0[i][j] = dp_0[i-1][j-1] * 9 + dp_1[i-1][j-1] * (int(n[i]) - 1) + dp_0[i-1][j] + dp_1[i-1][j]
            dp_1[i][j] = dp_1[i-1][j-1]
            #0を使う場合。この時はjが変化しない。なぜなら0を使うか
            #dp_1の更新は無し。
            #なぜなら、今回の桁が0でないことを想定しているため、もうnを超えることはないから
        else:
            #今回の桁が0の場合 
            #dp_1を遷移式に入れない理由は、今回の桁が0だった時は、どんな数字の選び方をしても
            #さっきの桁まででnより小さいことが確定しないものが
            #今回の桁の決め方で確定することはないから。
            dp_0[i][j] = dp_0[i-1][j-1] * 9 + dp_0[i-1][j]
            dp_1[i][j] = dp_1[i-1][j]
#print(dp_0)
#print(dp_1)
print(dp_0[-1][k] + dp_1[-1][k])



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

int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    
    int x;
    cin >> x;
    if(x<1200)
        cout<<"ABC";
    else
        cout << "ARC";

}
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int cnt=0,i,a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	for(i = a;i <= b;i++){
		if(c%i==0){
			cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 596
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}

debug dbg;

class AHappyBirthday {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int a, b;
	    in >> a >> b;

	    bool res = false;
        int diff = abs(a-b);
        if((16-(a+b)) / 2 >= diff) res = true;

	    if(res) out << "Yay!" << endl;
	    else out << ":(" << endl;
	}
};


int main() {
	AHappyBirthday solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
string S;
  cin >>S;
  if((S=="abc") ||(S=="acb") ||(S=="bac") ||(S=="bca") ||(S=="cab") ||(S=="cba"))   {
    cout << "Yes" << endl;
  }
else {
  cout << "No" << endl;
}
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on

using pi = pair<int, int>;

string rev(const string& s) {
    string t = s;
    reverse(all(t));
    rep(i, t.size()) {
        if (t[i] == '(')
            t[i] = ')';
        else
            t[i] = '(';
    }
    return t;
}

pi F(const string& s) {
    int ct = 0, mn = 0;
    for (char c : s) {
        if (c == '(')
            ++ct;
        else
            --ct;
        mn = min(mn, ct);
    }
    return {mn, ct};
}

int check(vector<pi> v) {
    sort(all(v), greater<pi>());

    int V = v.size();
    int vi = 0, now = 0;
    priority_queue<int> pq;

    rep(loop, V) {
        while (vi < V && v[vi].fi + now >= 0) {
            pq.push(v[vi].se);
            ++vi;
        }
        if (pq.empty()) return -1;
        now += pq.top();
        pq.pop();
    }
    return now;
}

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

    vector<pi> L, R;
    rep(i, n) {
        string s;
        cin >> s;

        int ct = 0;
        for (char c : s) {
            if (c == '(')
                ++ct;
            else
                --ct;
        }

        if (ct >= 0)
            L.pb(F(s));
        else
            R.pb(F(rev(s)));
    }

    int l = check(L), r = check(R);

    string ans = "Yes";
    if (l == -1 || r == -1 || l != r) ans = "No";
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 18864
#pragma GCC optimize("Ofast")
#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;
using ll = long long;
using u64 = uint_fast64_t;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    ll N,E,T; cin >> N >> E >> T;
    //assert(N <= 2000);
    //cout << N << " " << E << " " << T << ln;
    vector<ll> x(N+1);
    rep(i,N) cin >> x[i+1];
    //rep(i,N) cout << x[i+1] << " ";
    //cout << ln;

    vector<ll> dp(N+1);
    // dp[0] = 0;
    // auto calc=[&](int i, int j) {
    //     return dp[j]+(x[i]-x[j+1])*2+max(0LL,T-(x[i]-x[j+1])*2);
    // };

    int cur = 0;
    ll val = 1e18;
    for (int i = 1; i <= N; i++) {
        while (cur < i-1 and T < (x[i]-x[cur+1])*2) {
            chmin(val,dp[cur]-x[cur+1]*2);
            cur++;
        }
        dp[i] = min(val+x[i]*2,dp[cur]+T);
    }

    cout << dp[N]+E << ln;
}


Measured memory_bytes: 4764
a = input()
q = int(input())

fflag = 0
ato = ""
mae = ""
for i in range(q):
  qi = input()
  if( qi == "1"):
    fflag += 1 
  else:
    if( fflag%2 == 0 ):
      if( qi[2] == "2" ):
        ato += qi[4]
      else:
        mae += qi[4]
    else:
      if( qi[2] == "2" ):
        mae += qi[4]
      else:
        ato += qi[4]      
    
a = mae[::-1] + a + ato    
    
if( fflag%2==0 ):
  print( a )
else:
  print( a[::-1] )	

Measured memory_bytes: 4596
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    double X;
    cin >> X;
    
    double ans=0;
    double x=100;
    while(x<X) {
        x *= 1.01;
        x = floor(x);
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3784
#include <iostream>
#include <vector>
#include <queue>

using namespace std;
using ll = long long;

const int MAX = 1e5 + 1;
const ll INFTY = 1e50;
vector<pair<int,int> > G[MAX];
int N;

vector<ll> bfs(int K){
    vector<ll> dist(N,INFTY);
    dist[K] = 0;
    queue<int> Q;
    Q.push(K);

    while(!Q.empty()){
        int u = Q.front(); Q.pop();

        for(auto next : G[u]){
            int v = next.first, c = next.second;
            if(dist[v] > dist[u] + c){
                dist[v] = dist[u] + c;
                Q.push(v);
            }
        }
    }
    return dist;
}

int main(){
    cin >> N;
    int a,b,c;
    for(int i=0;i<N-1;i++){
        cin >> a >> b >> c;
        a--; b--;
        G[a].push_back(make_pair(b,c));
        G[b].push_back(make_pair(a,c));
    }
    int Q,K; cin >> Q >> K;
    K--;
    auto d = bfs(K);
    int x,y;
    for(int i=0;i<Q;i++){
        cin >> x >> y;
        x--; y--;
        cout << d[x] + d[y] << endl;
    }
    return 0;
}

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

int main(){
	for(int i = 0; i < 3; i++){
		int a[3], b[3];
		for(int j = 0; j < 3; j++) cin >> a[j];
		for(int j = 0; j < 3; j++) cin >> b[j];
		int res[3];
		if(b[2] < a[2]){
			b[1]--;
			b[2] += 60;
		}
		res[2] = b[2] - a[2];
		if(b[1] < a[1]){
			b[0]--;
			b[1] += 60;
		}
		res[1] = b[1] - a[1];
		res[0] = b[0] - a[0];
		for(int j = 0; j < 3; j++){
			cout << res[j];
			if(j == 2) cout << endl;
			else cout << ' ';
		}
	}
	return 0;
}


Measured memory_bytes: 3096
#include "bits/stdc++.h"

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	int x;
	for (int i = 1; cin >> x; i++) {
		if (x == 0) break;
		cout << "Case " << i << ": " << x << endl;
	}
	return 0;
}

Measured memory_bytes: 3024
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <cmath>         // sqrt
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <bits/stdc++.h> // isupper, islower, isdigit, toupper, tolower
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pl;
typedef pair<int, int> P;
typedef tuple<ll, ll, string> Tlls;

// Greatest Common Divisor (最大公約数)
ll gcd(ll a, ll b)
{
  // Eucledean algorithm
  while (a)
  {
    if (a < b)
    {
      std::swap(a, b);
    }
    a %= b;
  }
  return b;
}

// Least Common Multiple 最小公倍数
ll lcm(ll a, ll b)
{
  return a / gcd(a, b) * b;
}

// key: value of prime factor素因数分解
// value: number of prime factor
map<ll, ll> prime_factorization(ll n)
{
  map<ll, ll> prime_factors;
  for (ll i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      prime_factors[i]++;
      n /= i;
    }
  }
  if (n != 1)
    prime_factors[n] = 1;
  return prime_factors;
}

// 約数リスト約数の列挙
vector<ll> get_divisors(const ll n)
{
  vector<ll> divs;
  for (ll i = 1; i < (ll)sqrt((ld)n) + 1; i++)
  {
    if (n % i == 0)
    {
      divs.push_back(i);
      if (i != n / i)
      {
        divs.push_back(n / i);
      }
    }
  }

  // 必要に応じてソート
  // sort(divs.begin(), divs.end());

  return divs;
}

int main()
{
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N);
  ll ans = 0;
  rep(i, N)
  {
    cin >> A.at(i);
    ans += A.at(i);
  }
  if (N - ans < 0)
  {
    cout << -1 << endl;
  }
  else
  {
    cout << N - ans << endl;
  }

  return 0;
}


Measured memory_bytes: 11176
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll n;
  cin >> n;
  map<ll, ll> mp;
  rep(i, n) {
    ll x;
    cin >> x;
    if (mp.find(x) != mp.end()) {
      cout << "NO" << endl;
      return 0;
    }
    mp[x] = 1;
  }
  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 16112
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

int main(){
	int n, t, a, b, w;

	while( cin >> n , n ){
		w = 0;
		string ans = "Yes";
		multimap<int,int> m;

		for(int i=0 ; i< n ; i++ ){
			cin >> a >> b;
			m.insert( pair<int,int>(b,a) );
		}
		typedef multimap<int,int>::iterator Iter;
		for( Iter it = m.begin() ; it != m.end() ; ++it ){
			w += it->second;
      		if( it->first < w ){
	  			ans = "No";
	  			break;
	  		}
    	}
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めで昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    ll k,a,b;
    scanf("%lld%lld%lld",&k,&a,&b);
    ll ans = 1;
    if(b-a<=2){
        ans += k;
        cout << ans << endl;
        return 0;
    }

    if(k+1<a){
        cout << k+1 << endl;
        return 0;
    }

    ans = a;
    k -= a-1;

    if(k%2==1){
        k--;
        ans++;
    }

    ans += (b-a) * (k/2);

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


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    string a,b,c;
    int n=0,m=0;
    cin >> a >> b >> c;
    while(a[n]!='\0'){
        n++;
    }
    while(b[m]!='\0'){
        m++;
    }
    if((a[n-1]==b[0])&&(b[m-1]==c[0])){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

char a[3][3];

main() {
    rep(i,3) rep(j,3) cin >> a[i][j];
    rep(i,3) cout << a[i][i];
    cte
}






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

using namespace std;

struct Node{
  int key;
  Node* next;
  Node* prev;
};

struct List{
  Node* nil;

  void init(){
    nil=(Node*)malloc(sizeof(Node));
    nil->next=nil;
    nil->prev=nil;
    nil->key=0;
  }

  Node* find(int key){
    for(Node* i=nil->next;i!=nil;i=i->next){
      if(i->key==key)return i;
    }
    return nil;
  }

  void insert(Node *x){
    x->next=nil->next;
    nil->next->prev=x;
    nil->next=x;
    x->prev=nil;
  }
 
  void add(int x){
    Node* p = (Node*)malloc(sizeof(Node));
    p->key=x;
    insert(p);
  }
  
  void delete_x(int key){
    Node* x=find(key);
    if(x==nil)return;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);
  }
  
  void deleteFirst(){
    Node* x = nil->next;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);
  }
  
  void deleteLast(){
    Node* x = nil->prev;
    x->prev->next=x->next;
    x->next->prev=x->prev;
    free(x);    
  }

  void output(){
    int flg=0;
    for(Node* i=nil->next;i!=nil;i=i->next){
      if(flg)cout<<' ';
      cout<<i->key;
      flg=1;
    }
    cout<<endl;
  }
};

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

  List list;
  list.init();
  int n,x;
  string str;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>str;
    if(str=="insert"){
      cin>>x;
      list.add(x);
    }else if(str=="delete"){
      cin>>x;
      list.delete_x(x);
    }else if(str=="deleteFirst"){
      list.deleteFirst();
    }else {
      list.deleteLast();
    }
  }
  //cout<<'-'<<endl;
  list.output();
}

Measured memory_bytes: 32472
#include <stdio.h>

int main(void) {
	int n,ans;
	char a[100001];
	scanf("%s",a);
	n=0;ans=0;
	for(int i=0;a[i]!='\0';i++)n++;
	for(int i=0;i<n;i++){
		if(i%2==0&&a[i]=='1')ans++;
		if(i%2==1&&a[i]=='0')ans++;
	}
	if(n-ans<ans)ans=n-ans;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
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 n = 0;
        for(int i=1; i < b ;){
            i--;
            i+= a;
            n++;
        }
        System.out.println(n);
        sc.close();
    }
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nfs ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,a,b) for(i=a;i>=b;i--)
#define m_p make_pair
#define p_b push_back
#define MOD 1000000007
vector<ll> v[100005];
map<ll,ll> arr[100005];

ll marked[100005];
void dfs_set(ll col,ll idx)
{
	marked[idx] = col;
	ll sz = v[idx].size();
	ll x;
	ll y;
	for(y= 0;y<sz;y++)
	{
		x = v[idx][y] ;
		
		if(marked[x]==0)
		{
			if(arr[idx][x]&1)
			{
				dfs_set(3-col,x);
			}
			else
			{
				dfs_set(col,x);
			}
		}
	}
}
int main()
{
	nfs;
	int t;
	t=1;
//	cin >> t;

	while(t--)
	{
		ll n;
		cin >> n;
		ll i;
		F(i,0,n-1)
		{
			ll a,b,w;
			cin >> a >> b >> w;
			v[a].p_b(b);
			v[b].p_b(a);
			arr[a][b] = w;
			arr[b][a] = w;
			
		}
		dfs_set(2,1);
		F(i,1,n+1)
		{
			cout << marked[i]-1 << endl;
		}	
	}
	return 0;

}



Measured memory_bytes: 26624
N,M = (int(x) for x in input().split())
Now = [0]*N
maxL = 1
minR = N
for T in range(0,M):
    L,R = (int(x) for x in input().split())
    if maxL<L:
        maxL = L
    if minR>R:
        minR = R
if maxL>minR:
    print(0)
elif maxL==minR:
    print(1)
elif maxL<minR:
    print(minR-maxL+1)

Measured memory_bytes: 9620
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int i,j,k,h,w,c[16][16],r=0,x;
    scanf("%d%d",&h,&w);
    for(i=0;i<=9;i++){
        for(j=0;j<=9;j++){
            scanf("%d",&c[i][j]);
        }
    }
    for(k=0;k<=9;k++){
        for(i=0;i<=9;i++){
            for(j=0;j<=9;j++){
                c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
            }
        }
    }
    for(i=1;i<=h*w;i++){scanf("%d",&x);r+=c[x][1];}
    printf("%d\n",r);
    return 0;
}

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

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

	long long ans = a * c;
	ans = max( ans, a * d );
	ans = max( ans, b * c );
	ans = max( ans, b * d );

	cout << ans << endl;
}


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


def solve(n):
    if n < 10:
        return "Yes"
    for i in range(2, 10):
        q, r = divmod(n, i)
        # print(q, r)
        if q < 10 and r == 0:
            return "Yes"

    return "No"


print(solve(n))


Measured memory_bytes: 2940
#include <iostream>
    #include <stdio.h>
    using namespace std;
     
    const int N = 1e5 + 10;
     
    int n, a[N], b[N];
	long long ans = 0;
     
    int main()
    {
        scanf("%d", &n);
        n++;
        for (int i = 0; i < n; i++)
            scanf("%d", &a[i]);
        for (int i = 0; i < n - 1; i++)
            scanf("%d", &b[i]);
     
        for (int i = 0; i < n - 1; i++)
        {
            ans += min(a[i], b[i]);
            b[i] -= min(a[i], b[i]);
            ans += min(a[i + 1], b[i]);
            a[i + 1] -= min(a[i + 1], b[i]);
        }
     
        printf("%lld", ans);
        return 0;
    }

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int N;
    cin >> N;
    vector<int> H(N);
    rep(i, N) cin >> H[i];
    H[0]--;
    for (int i = 1; i < N; i++) {
        if (H[i] > H[i-1]) H[i]--;
        else if (H[i] < H[i-1]) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 3772
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  ll n,m;
  cin >> n;
  ll t[n];
  for(int i=0;i<n;i++){
    cin >> t[i];
  }
  cin >> m;
  ll p[m],x[m];
  for(int i=0;i<m;i++){
    cin >> p[i] >> x[i];
    ll ans = 0;
    p[i]--;
    for(int j=0;j<n;j++){
      if(p[i]==j) ans += x[i];
      else ans += t[j];
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
import math
import copy

ans = 0

H, W, K = map(int, input().split())
c = []
for h in range(H):
    c.append(list(input()))

for i in range(int(math.pow(2, H+W))):
    i_bin = ''.join(list(reversed(format(i, 'b').zfill(100))))
    C = copy.deepcopy(c)
    for h in range(H):
        if i_bin[h] == '1':
            for w in range(W):
                C[h][w] = '.'
    for w in range(W):
        if i_bin[H + w] == '1':
            for h in range(H):
                C[h][w] = '.'
    count = 0
    for h in range(H):
        count += C[h].count('#')
    if count == K:
        ans += 1

print(ans)

Measured memory_bytes: 9612
#include "bits/stdc++.h"
using namespace std;

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO  puts("NO\n")
#define No  puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }



signed main() {

	string s;
	cin >> s;

	bool ans = true;
	for (int i = 0; i < s.length(); i++) {
		if (i % 2 == 0) {
			if (s[i] == 'L') ans = false;
		}
		else {
			if (s[i] == 'R') ans = false;
		}
	}
	if (ans) Yes;
	else No;


	return 0;
}


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

int main() {

	int lim = 0;
	int sum = 0;
	int min = 0, max = 0;

	cin >> lim >> min >> max;

	//10000*a+1000*b+100*c+10*d+e

	for (int e = 0; e <= 9; e++) {
		for (int d = 0; d <= 9; d++) {
			for (int c = 0; c <= 9; c++) {
				for (int b = 0; b <= 9; b++) {
					for (int a = 0; a <= 9; a++) {
						if (a + b + c + d + e >= min && a+b+c+d+e<=max) 
						{
							if (10000 * a + 1000 * b + 100 * c + 10 * d + e <= lim) { sum += 10000 * a + 1000 * b + 100 * c + 10 * d + e; }
						}
					}
				}
			}
		}
	}


	cout << sum << endl;

	return 0;
}

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

// #define multitest 1
// #define Debug 1
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#endif

typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;

vector<ll> a;
ll getArr(int n, ll initial)
{
	for (int i = 0; i < n - 1; ++i)
		initial = a[i] - initial;
	return initial;
}

void brute(int low, int high, int n)
{
	for (int i = low; i <= high; ++i)
	{
		ll expected1 = a[n - 1] - i;
		ll received1 = getArr(n, i);
		if (expected1 == received1)
		{
			cout << i << ' ';
			for (int j = 0; j < n - 1; ++j)
			{
				i = a[j] - i;
				cout << i << ' ';
			}
			return;
		}
	}
}

void solve()
{
	int n;
	cin >> n;
	a.resize(n);
	for (ll &x : a)
	{
		cin >> x;
		x *= 2;
	}
	int low = 0, high = a[n - 1];
	for (int i = 0; i < 200; ++i)
	{
		int left1 = (low) + (high - low) / 2;
		if (high - low < 200)
		{
			brute(low, high, n);
			return;
		}
		ll expected1 = a[n - 1] - left1;
		ll received1 = getArr(n, left1);
		ll diff = expected1 - received1;
		if (diff < 0)
		{
			high = left1;
		}
		else
		{
			low = left1;
		}
	}
}

int main()
{
#ifndef Debug
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#endif
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
	return 0;
}

Measured memory_bytes: 2176
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0260
{
    class Program
    {
        static void Main(string[] args)
        {

            while (true)
            {
                int n = RInt();
                if (n == 0) break;

                int[] pipes = RArInt();
                int[] joints = RArInt();
                int[] cSumJoints = new int[joints.Length + 1];
                cSumJoints[0] = 0;

                Array.Sort(joints);
                Array.Reverse(joints);

                for (int i = 1; i < cSumJoints.Length; i++)
                {
                    cSumJoints[i] = cSumJoints[i - 1] + joints[i - 1];
                }

                long salary = 0;
                long pipeSum = pipes.Sum();
                for (int i = 0; i < n; i++)
                {
                    salary = Math.Max(salary, (pipeSum + cSumJoints[i]) * (n - i));
                }
                Console.WriteLine(salary);


            }
        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 38436