akhauriyash/Code-Regression huggingface dataset:
import sys

input = sys.stdin.readline

N = int(input())
L, R = [], []
length = []
for i in range(N):
	Li, Ri = map(int,input().split())
	L.append(Li)
	R.append(Ri)
	length.append(Ri-Li)

sindL = sorted(range(N), key=lambda k: L[k])
sindR = sorted(range(N), key=lambda k: R[k])
sind_len = sorted(range(N), key=lambda k: length[k])

indLmax = sindL[-1]
indRmin = sindR[0]

if N==2:
	ans = sum(length)+2
else:
	if indLmax==indRmin:
		ans = R[indRmin]-L[indLmax]+max(length)+2
	else:
		lenmax_ind = sind_len[-1]
		if lenmax_ind==indLmax or lenmax_ind==indRmin:
			lenmax_ind = sind_len[-2]
			if lenmax_ind==indLmax or lenmax_ind==indRmin:
				lenmax_ind = sind_len[-3]
		ans = max(0,R[indRmin]-L[indLmax]+1)+length[lenmax_ind]+1

		Qind = [0]*N
		Qind[indRmin] = 1
		ri = 1
		for li in range(0,N-1):
			QL, QR = L[sindL[li]], R[indRmin]
			Qind[sindL[li]] = 1
			while Qind[sindR[ri]]==1:
				ri += 1
			PL, PR = L[indLmax], R[sindR[ri]]

			ans = max(ans,max(0,PR-PL+1)+max(0,QR-QL+1))

print(ans)

Measured memory_bytes: 79580
#include <iostream>
using namespace std;
typedef long long int LLI;

bool examine( string & s, int & cut )
{
	int tmp;
	for(int i = 0; i < (s.size() - cut)/2; i++)
	{
		tmp = (s.size() - cut)/2;
		if( s[i] != s[tmp+i] )
			return false;
	}
	return true;
}

int length( string & s )
{
	int cut = 2;
	while( s.size() - cut != 0 )
	{
		if( examine(s,cut) == true )
			return s.size() - cut;
		cut += 2;
	}
	return 0;
}

int main()
{
	string s;
	cin >> s;
	cout << length(s);
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define int        long long
#define inf       ((ll)1e18)
#define mod       (ll)1e9+7
#define double    long double
#define ull       unsigned long long
#define vi        vector<ll>
#define ppi       pair<int,int>
#define pii       pair<pair<int,int>,int>
#define pb        push_back
#define pi        2*acos(0.0)
#define rev       greater<int>()
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"THIS_AND_THIS"<<endl;
#define str       string
#define endl      '\n'
#define e         cout<<'\n';
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
int32_t main() {
	kehsihba();
	ll t=1;//cin>>t;
	for(int testcase=1;testcase<=t;testcase++){
		ll n;cin>>n;
		if(n>=400 and n<=599){cout<<8;}
		else if(n>=600 and n<=799){cout<<7;}
		else if(n>=800 and n<=999){cout<<6;}
		else if(n>=1000 and n<=1199){cout<<5;}
		else if(n>=1200 and n<=1399){cout<<4;}
		else if(n>=1400 and n<=1599){cout<<3;}
		else if(n>=1600 and n<=1799){cout<<2;}
		else if(n>=1800 and n<=1999){cout<<1;}
		
	}
}


Measured memory_bytes: 3648
from numba import njit
import numpy as np


@njit("i8(i8)")
def solve(n):
    ans = 1
    res = np.ones(n + 1, dtype=np.int64)
    for i in range(2, n + 1):
        for j in range(i, n + 1, i):
            res[j] += 1
        ans += i * res[i]
    return ans


N = int(input())
print(solve(N))


Measured memory_bytes: 188520
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

#define MAX 110
typedef pair<int, int> P;
int n, m;
char chair[MAX];
bool isZero;

bool isCanSit(int x){
  if(chair[x] == '#') return true;
  return false;
}

void A(){
  for(int i = 0 ; i < n ; i++){
    if(isCanSit(i)){
      chair[i] = 'A';
      isZero = false;
      return;
    }
  }
}

bool isNext(int x){
  if(chair[x-1] == 'A' || chair[x+1] == 'A') return true;
  return false;
}

void B(){
  for(int i = n-1 ; i >= 0 ; i--){
    if(isCanSit(i) && !isNext(i)){
      chair[i] = 'B';
      isZero = false;
      return;
    }
  }
  
  for(int i = 0 ; i < n ; i++){
    if(isCanSit(i)){
      chair[i] = 'B';
      isZero = false;
      return;
    }
  }
}


void C(){
  if(isZero){
    chair[n/2] = 'C';
    isZero = false;
    return;
  }
  
  for(int i = 0 ; i < n ; i++){
    if(!isCanSit(i)){
      if(isCanSit(i+1)){
	if(i+1 != n){
	  chair[i+1] = 'C';
	  isZero = false;
	  return;
	}
	else{
	  chair[i-1] = 'C';
	  isZero = false;
	  return;
	}
      }
      else if(isCanSit(i-1)){
	chair[i-1] = 'C';
	isZero = false;
	return;
      }
    }
  }
}

bool DcanSitNoneNext(int x){
  if(x == n-1){
    if(chair[x-1] == '#') return true;
  }
  if(x == 0){
    if(chair[x+1] == '#') return true;
 }  
  if(chair[x-1] == '#' && chair[x+1] == '#') return true;
  return false;
}

int calcDisD(int x){
  int ret, cnt = 0;
  for(int i = x-1 ; i >= 0 ; i--){ // left
    if(chair[i] != '#') break;
    else cnt++;
  }
  
  ret = cnt;
  cnt = 0;
  
  for(int i = x+1 ; i < n ; i++){ // right
    if(chair[i] != '#') break;
    else cnt++;
  }
  
  ret = max(ret, cnt);
  return ret;
}

void D(){
  if(isZero){
    chair[0] = 'D';
    isZero = false;
    return;
  }
  
  int sit;
  int dis[MAX];
  fill(dis, dis+MAX, MAX);
  for(int i = 0 ; i < n ; i++){
    if(chair[i] != '#'){
      for(int j = 0 ; j < n ; j++){
	dis[j] = min(dis[j], abs(i-j));
      }
    }
  }  
  int d = 0;
  for(int i = 0 ; i < n ; i++){
    if(dis[i] > d){
      sit = i;
      d = dis[i];
    }
  }
  chair[sit] = 'D';
  return;
}
  
void init(){
  fill(chair, chair+MAX, '#');
  isZero = true;
}

void display(){
  for(int i = 0 ; i < n ; i++){
    cout << chair[i];
  }
  cout << endl;
}

int main(){
  char p;
  while(cin >> n >> m){
    if(n == 0 && m == 0) break;
    init();
    for(int i = 0 ; i < m ; i++){
      cin >> p;
      if(p == 'A') A();
      if(p == 'B') B();
      if(p == 'C') C();
      if(p == 'D') D();
      //      display();
    }
    display();
  }
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	int ans1 = 0, ans2 = 0;
	for (int i = 0; i < n; ++i) {
		string tmp1, tmp2;
		cin >> tmp1 >> tmp2;
		if (tmp1 == tmp2) {
			++ans1;
			++ans2;
		}
		else if (tmp1 > tmp2) ans1 += 3;
		else ans2 += 3;
	}
	cout << ans1 << ' ' << ans2 << endl;
}


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

int main() {
    long n, ans=0;
    cin >> n;
    vector<long> b(100002, 0);
    for (long i=0; i<n; i++) {
        long ai;
        cin >> ai;
        ai++;
        b[ai-1]++;
        b[ai]++;
        b[ai+1]++;
    }
    for (long l=1; l<=100001; l++)
        ans = max(ans, b[l]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>
// #include "atcoder/all"

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long k){

    for(int i = 0; i < k; ++i)
        cout << "ACL";
        cout << endl;
}


signed main(){
    long long K;
    scanf("%lld",&K);
    solve(K);
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */


int main(const int argc, char * argv [])
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  size_t n;
  cin >> n;
  vector<int> a(n);
  cin >> a;

  map<int, size_t> cnt;
  for(const auto i: a) ++cnt[i];

  sort(begin(a), end(a));
  a.erase(unique(begin(a), end(a)), end(a));

  size_t out = 0;
  for(const auto i: a)
  {
    out = max({out, cnt[i - 2] + cnt[i - 1] + cnt[i]});
    out = max({out, cnt[i - 1] + cnt[i] + cnt[i + 1]});
    out = max({out, cnt[i] + cnt[i + 1] + cnt[i + 2]});
  }

  cout << out;
  return EXIT_SUCCESS;
}


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

int dp[3100][3100];

int main(){
  string s,t;
  cin>>s>>t;
  int sl=s.length();
  int tl=t.length();
  for(int i=0;i<=sl;i++){
    for(int j=0;j<=tl;j++){
      if(i==0 || j==0 ) dp[i][j]=0;
      else if(s[i-1]==t[j-1]) dp[i][j]=dp[i-1][j-1]+1;
      else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
}
//cout<<dp[sl][tl];

//back tracking
int cont=dp[sl][tl];
char st[cont+1];
st[cont]='\0';
int i=sl,j=tl;
  while(i>0 && j>0){
    if(s[i-1]==t[j-1]){
      st[cont-1]=s[i-1];
      i--;
      j--;
      cont--;
    }
    else if(dp[i-1][j]>dp[i][j-1]){
      i--;
    }
    else{
      j--;
    }
  }
cout<<st;
}


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

int main(){
    int n,W,dp[110][10010];
    cin>>n>>W;
    vector<int> w(n),v(n);
    for(int i=0; i<n; i++) cin>>v[i]>>w[i];
    for(int i=0; i<=W; i++) dp[0][i] = 0;
    for(int i=0; i<n; i++) {
        for(int j=0; j<=W; j++) {
            if(j >= w[i]) dp[i+1][j] = max(dp[i][j-w[i]] + v[i],dp[i][j]);
            else dp[i+1][j] = dp[i][j];
        }
    }
    cout<<dp[n][W]<<endl;
}


Measured memory_bytes: 7060
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=4000000000000000000;
typedef pair<int,int> P;
int dp[510][510],ans[510][510];
int main(){
    int n,m,q;cin>>n>>m>>q;
    for(int i=0;i<m;i++){
        int l,r;cin>>l>>r;
        for(int j=1;j<=l;j++){
            dp[j][r]++;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=i;j<=n;j++){
            dp[i][j]+=dp[i][j-1];
        }
    }
    while(q--){
        int p,q;cin>>p>>q;
        cout<<dp[p][q]<<endl;
    }
}   


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

int main() {
    string s1, s2;
    while (1) {
        cin >> s1;
        if (s1[0] == '.') break;
        cin >> s2;
        int count = 0;
        if (s1 == s2) {
            cout << "IDENTICAL" << endl;
            continue;
        }
        int n1 = 0;
        int n2 = 0;
        int size1 = s1.size();
        int size2 = s2.size();
        while (1) {
            if (n1 == size1 - 1 && n2 == size2 - 1) {
                if (count == 1) {
                    cout << "CLOSE" <<endl;
                }
                break;
            }
            if (s1[n1] == '"' && s2[n2] == '"') {
                int c1 = n1 + 1;
                int c2 = n2 + 1;
                bool diff = false;
                while (1) {
                    if (s1[c1] == '"' && s2[c2] == '"') {
                        n1 = c1;
                        n2 = c2;
                        break;
                    }
                    if (s1[c1] != s2[c2] && !diff) {
                        count++;
                        diff = true;
                    }
                    if (s1[c1] != '"') c1++;
                    if (s2[c2] != '"') c2++;
                }
            }
            if (s1[n1] != s2[n2]) {
                cout << "DIFFERENT" << endl;
                break;
            }
            if (count >= 2) {
                cout << "DIFFERENT" <<endl;
                break;
            }

            if (n1 != size1 - 1) n1++;
            if (n2 != size2 - 1) n2++;
        }
    }
    return 0;
}


Measured memory_bytes: 3132
#include <iostream>

int main() {
int m, f, r;

do{
std::cin >> m >> f >> r;
int sum = m + f;

if(m == -1 || f == -1){
if(m == -1 && f == -1 && r == -1){
}
else{
std::cout << 'F' << std::endl;
}
}
else if(sum >= 80){
std::cout << 'A' << std::endl;
}
else if(sum >= 65){
std::cout << 'B' << std::endl;
}
else if(sum >= 50){
std::cout << 'C' << std::endl;
}
else if(sum >= 30){
if(r >= 50){
std::cout << 'C' << std::endl;
}
else {
std::cout << 'D' << std::endl;
}
}
else if(sum < 30){
std::cout << 'F' << std::endl;
}
} while(!(m == -1 && f == -1 && r == -1));
}

Measured memory_bytes: 3092
import java.util.*;

public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		String str = sc.next();

		int cnt = 0;
		  
		for(int i=0; i<3; i++){

			if(str.equals("RSR")){
				cnt = 1;
				break;
			}
			if(str.charAt(i)=='S'){
				continue;
			}
			if(str.charAt(i)=='R'){
				cnt++;
			}

		}

        System.out.println(cnt);
		return;
	}
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vi t(n), v(n);
	int sum = 0;
	REP(i, n) {
		cin >> t[i];
		t[i] *= 2;
		sum += t[i];
	}
	REP(i, n)cin >> v[i];
	vector<vector<double>> dp(sum + 1, vector<double>(201, -1));
	dp[0][0] = 0;
	vi acum(n + 1);
	acum[0] = 0;
	REP(i, n)acum[i + 1] = acum[i] + t[i];
	int p = 1;
	REP(i, sum) {
		int ub=v[p-1];
		if (i == acum[p]) {
			p++;
			ub = min(v[p - 1], v[p - 2]);
		}
		FOR(j, 2 * ub + 1, 201) {
			dp[i][j] = -1;
		}
		
		REP(j, 201) {
			if (abs(dp[i][j] + 1)<EPS)continue;
			if (j != 0) {
				dp[i + 1][j - 1] = max(dp[i + 1][j - 1], dp[i][j] + (j - 1) + 0.5);
			}
			if (j != 200) {
				dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + j + 0.5);
			}
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + j);
		}
		
	}
	cout << fixed << setprecision(12) << dp[sum][0]/4 << endl;
}


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PPQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> &vec){ return (ll)vec.size(); }
template<typename T>
ll sz(priority_queue<T, vector<T>> &pq) {return (ll)pq.size(); }
template<typename T>
ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
ll sz(string &s) {return (ll)s.size(); } 
ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b; }
bool checkindex(ll i,ll n){ return (i < n && i >= 0); }



int main(){
    ll n,t;
    cin >> n >> t;
    ll a[n],b[n];
    rep(i,0,n) cin >> a[i] >> b[i];
    ll dp[2][n+1][t+1];
    rep(i,0,2) rep(j,0,n+1) rep(k,0,t+1) dp[i][j][k] = 0;

    rep(i,0,n){
        rep(j,0,t){
            // 0 -> 0
            dp[0][i+1][j] = max(dp[0][i+1][j],dp[0][i][j]);
            if(j+a[i] <= t) dp[0][i+1][j+a[i]] = max(dp[0][i+1][j+a[i]],dp[0][i][j]+b[i]); 

            // 1 -> 1
            dp[1][i+1][j] = max(dp[1][i+1][j],dp[1][i][j]);
            if(j+a[i] <= t) dp[1][i+1][j+a[i]] = max(dp[1][i+1][j+a[i]],dp[1][i][j]+b[i]); 

            // 0 -> 1
            dp[1][i+1][j] = max(dp[1][i+1][j],dp[0][i][j]+b[i]);
        }
    }

    ll ans = 0;
    rep(i,0,t) ans = max(ans,dp[1][n][i]);
    rep(i,0,t+1) ans = max(ans,dp[0][n][i]);

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



Measured memory_bytes: 144272
n,m=map(int,input().split())
nexts=[None for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  if nexts[a]==None:
    nexts[a]=[b]
  elif b not in nexts[a]:
    nexts[a].append(b)
  if nexts[b]==None:
    nexts[b]=[a]
  elif a not in nexts[b]:
    nexts[b].append(a)

ans=0
stack=[]
stack.append([0,[]])
while stack:
  node=stack.pop()
  v=node[0]
  seen=node[1][:]
  seen.append(v)
  if len(seen)==n:
    ans+=1
    continue
  childs=nexts[v]
  if childs:
    for child in (set(childs)-set(seen)):
      stack.append([child,seen])
  
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int mod = 1e9+7; 
char s[N];  
int d[N], r[N]; 
int main(){
	int n, ans; 
	scanf("%d", &n);
	scanf("\n%s", s+1); 
	for(int i=1; i<=n*2; ++i){
		d[i] = d[i-1]; 
		if(s[i] == s[i-1]) d[i] ^= 1; 
	}
	for(int i=n*2; i>=1; --i){
		if(d[i] == 1) r[i] = r[i+1]+1; 
		else r[i] = r[i+1]-1; 
	}
	ans = 1; 
	for(int i=1; i<=n*2; ++i)
		if(r[i] < 0){
			ans = 0; 
			break; 
		}
	if(r[1] != 0 || s[1] == 'W') ans = 0; 
	for(int i=1; i<=n*2; ++i)
		if(!d[i]) ans = 1ll*ans*(r[i]+1)%mod; 
	for(int i=1; i<=n; ++i) ans = 1ll*ans*i%mod; 
	printf("%d\n", ans); 
	return 0; 
}


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

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

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

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

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

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

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

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

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

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

fn solve() {
    input!(a: i32, b: i32);
    let mut ans;
    ans = 6 - a -b;

    println!("{}", ans);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

Measured memory_bytes: 8572
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<ii, int>;
#define vt vector
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define __lcm(a, b) a * b / __gcd(a, b)
const int MOD = 1e9 + 7;
const int INF = 2e9;
const int N = 1e2 + 5;

int n;
double x, a, b;
priority_queue<double, vt<double>, greater<double>> pq;

void solve() {
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> x;
        pq.push(x);
    }
    while(pq.size() > 1) {
        a = pq.top(); pq.pop();
        b = pq.top(); pq.pop();
        pq.push((a + b) / 2);
    }
    cout << setprecision(5) << pq.top() << "\n";
}

int main() {
    
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    solve();
    
}

Measured memory_bytes: 3808
import sys,string
A="abcdefghijklmnopqrstuvwxyza"
tbl=string.maketrans(A[:-1],A[1:])
for s in sys.stdin.readlines():
    while not("the" in s or "that" in s or "this" in s):
        s=s.translate(tbl)
    print s[:-1]

Measured memory_bytes: 4372
#include<stdio.h>
#define SENTINEL 1000000000
#define N 500000
int c = 0;
void Merge(int A[],int left, int mid, int right){
  int n1, n2;
  n1 = mid - left;
  n2 = right - mid;
  int L[n1 + 1], R[n2 + 1];
  int i, j, k;
  for(i = 0; i < n1; i++){
    L[i] = A[left + i];
  }
  for(i = 0; i < n2; i++){
    R[i] = A[mid + i];
  }
  L[n1] = SENTINEL;
  R[n2] = SENTINEL;
  i = 0;
  j = 0;
  for(k = left; k < right; k++){
    c++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    } else {
      A[k] = R[j];
      j++;
    }
  }
}

void MergeSort(int A[], int left, int right){
  int mid;
  if(left + 1 < right){
    mid = (left + right) / 2;
    MergeSort(A, left, mid);
    MergeSort(A, mid, right);
    Merge(A, left, mid, right);
  }
}

int main(){
  int A[N], n, i;
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &A[i]);
  }
  MergeSort(A, 0, n);
  for(i = 0; i < n; i++){
    printf("%d", A[i]);
    if(i < n - 1)printf(" ");
  }
  printf("\n%d\n", c);
  return 0;
}



Measured memory_bytes: 5604
#include<stdio.h>
int main(){
  int a,b,c,d,x,y,i;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  x=c-a;
  y=d-b;
  for(i=0;i<y;i++)printf("U");
  for(i=0;i<x;i++)printf("R");
  for(i=0;i<y;i++)printf("D");
  for(i=0;i<x;i++)printf("L");
  printf("L");
  for(i=0;i<=y;i++)printf("U");
  for(i=0;i<=x;i++)printf("R");
  printf("DR");
  for(i=0;i<=y;i++)printf("D");
  for(i=0;i<=x;i++)printf("L");
  printf("U\n");
  return 0;
}


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

using namespace std;

int main()
{
    string S,T;
    cin>>S>>T;
    
    for (int i=S.length()-1; i>=0; i--) {
        if(i+1<T.length())break;
        string cS=S;
        for(int j=0;j<T.length();j++)
        {
            if(cS[i-j]=='?')
            {
                cS[i-j]=T[T.length()-1-j];
            }else if(cS[i-j]!=T[T.length()-1-j])
            {
                break;
            }
            if(j==T.length()-1)
            {
                for (int k=0; k<cS.length(); k++) {
                    if(cS[k]=='?')cS[k]='a';
                }
                cout<<cS<<endl;
                return 0;
            }
        }
    }
    
    cout<<"UNRESTORABLE"<<endl;
    return 0;
}

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

int main(){
    int X,N;
    cin>>X>>N;
    vector<int> p;
    if(N==0){
        cout<<X<<endl;
        return 0;
    }
    for(int i=0;i<N;i++){
        int temp;
        cin>>temp;
        p.push_back(temp);
    }
    sort(p.begin(),p.end());
    int now=0;
    int min_value=0;
    int max_value=101;
    for(int i=0;i<=101;i++){
        if(now<N){
            if(p[now]==i){
                now++;
                continue;
            }
        }
        if(i==X){
            cout<<X<<endl;
            return 0;
        }else if(i<X){
            min_value=i;
        }else if(i>X){
            max_value=i;
            break;
        }
    }
    if(X-min_value<=max_value-X){
        cout<<min_value<<endl;
    }else{
        cout<<max_value<<endl;
    }
}

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

int main()
{
	int l[200];
	int N;
	int sum = 0;

	cin >> N;

	for(int i=0; i<2*N; i++) {
		cin >> l[i];
	}
	
	sort(l, l+2*N, greater<int>());

	for(int i=1; i<2*N; i=i+2) {
		sum = sum + l[i];	
	}

	cout << sum << endl;

	return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

struct data{
	string date;
	int tin,tout;
};

int n;
vector<data> vis[1111];
int sum[1111];

int gettime(string t){
	return stoi(t.substr(0,2))*60+stoi(t.substr(3,2));
}

int main(){
	cin.sync_with_stdio(false);
	while(1){
		cin>>n;
		if(n==0)break;
		rep(i,1111)vis[i].clear();
		memset(sum,0,sizeof(sum));
		rep(i,n){
			string date,time;
			char e; int id;
			cin>>date>>time>>e>>id;
			if(e=='I'){
				vis[id].push_back((data){date,gettime(time),INF});
			}else if(e=='O'){
				vis[id][vis[id].size()-1].tout=gettime(time);
			}
		}
		repl(i,1,1000){
			rep(j,vis[0].size())rep(k,vis[i].size()){
				data d1=vis[0][j],d2=vis[i][k];
				if(d1.date!=d2.date)continue;
				sum[i]+=max(0,min(d1.tout,d2.tout)-max(d1.tin,d2.tin));
			}
		}
		cout<<*max_element(sum,sum+1000)<<endl;
	}
	return 0;
}

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

int main(){
  int n,k,x,y;
  cin >> n >> k >> x >> y;

  int ans = 0;
  rep(i,n){
    if(i+1<=k) ans += x;
    else ans += y;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
class Main {
  public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);
    
    long N = scanner.nextLong(); //next(文字列), nextDouble, nextLine(1行)とか
    int K = scanner.nextInt();
    long ans = 0;
    for (long i = K; i <= N+1; i++){
      long left = (i-1)*i/2;
      long right =  (N + N - i +1)*i/2;
      long num = right - left + 1;
      ans += num;
 
    }
    long z = 1000000007;
    System.out.println(ans%z);    
  }
}

Measured memory_bytes: 35520
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

template<class T> using OS = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ld double
#define ull unsigned long long

const int mod = 1e9 + 7, N = 1e5 + 5;
ll n, k, cnt[N];

ll fp(ll n, ll p, ll m) {
    ll re = 1;
    while (p) {
        if (p & 1) re = re * n % m;
        p >>= 1;
        n = n * n % m;
    }
    return re;
}

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

    cin >> n >> k;
    ll out = 0;
    for (ll i = k; i >= 1; i--) {
        ll f = k / i;
        cnt[i] = fp(f, n, mod);

        for (ll j = i + i; j <= k; j += i) {
            cnt[i] = (cnt[i] - cnt[j] + mod) % mod;
        }

        out = (out + cnt[i] * i) % mod;
    }
    cout << out;

    return 0;
}

Measured memory_bytes: 4360
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}


int main() {
    long long a, b;
    string s;
    cin >> a >> b;
    if (a >= b){
        for (int i = 0; i < a; i++){
            cout << b;
        }
    }else{
        for (int i = 0; i < b; i++){
            cout << a;
        }
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int R = sc.nextInt();
        
        int rate;
        
        if(N>=10){
            rate = R;
        } else {
            rate = R + 100 * (10-N);
        }
        
        System.out.println(rate);
    }
}


Measured memory_bytes: 35516
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int solve()
{
	ll n,k;cin>>n>>k;

	if(n>=k)
	{
		ll t = n/k;
		ll ans1 = n-t*k;
		ll ans2= abs(ans1-k);
		ll ans3=abs(k-ans2);
		n = min(ans3,min(ans1,ans2));
		cout<<n<<"\n";
	}
	else
	{
		cout<<min(n,abs(n-k))<<"\n";
	}
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
#define endl '\n'
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}}

struct Edge {
    int src, to;
    i64 cost;
    Edge(int src,  int to, i64 cost) : src(src), to(to), cost(cost) {}
    Edge(int to, i64 cost = 0) : Edge(-1, to, cost) {}
    bool operator< (const Edge &o) const { return cost < o.cost; }
    bool operator> (const Edge &o) const { return cost > o.cost; }
};
using Edges = vector<Edge>;
using WGraph = vector<vector<Edge>>;
using Ugraph = vector<vector<int>>;

vector<i64> bellmanFord(const Edges &es, int V, int src)
{
    vector<i64> dist(V, LINF);
    dist[src] = 0;

    int updateCnt = 0;
    bool updated;
    do {
        updated = false;
        for (const auto &e : es) {
            if (dist[e.src] == LINF) continue;
            updated |= chmin(dist[e.to], dist[e.src] + e.cost);
        }
    } while(updated && ++updateCnt < V);

    return dist;
}

signed main()
{
    int V, E;
    cin >> V >> E;

    Edges es;
    for (int i = 0; i < E; ++i) {
        int s, t, c;
        cin >> s >> t >> c;
        --s, --t;
        es.emplace_back(s, t, -c);
    }

    const auto dist = bellmanFord(es, V, 0);

    bool negative[1005] {};
    for (int i = 0; i < V; ++i) {
        for (const auto &e : es) {
            if (dist[e.src] >= LINF) continue;
            if (dist[e.to] > dist[e.src] + e.cost) {
                negative[e.src] = true;
            }
            negative[e.to] |= negative[e.src];
        }
    }

    if (negative[V-1]) {
        cout << "inf" << endl;
    } else {
        cout << -dist[V-1] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if ("snuke".equals(sc.next())) {
					System.out.println(String.valueOf((char)(j + 'A')) + (i + 1));
					return;
				}
			}
		}
	}
}


Measured memory_bytes: 23124
#include <stdio.h>

int main() {

	int x, y;

	scanf("%d %d",&x,&y);

	int result[4] = { 0,0,0,0 };

	result[0] = y - x;
	result[1] = -x - y + 1;
	result[2] = x + y + 1;
	result[3] = x - y + 2;

	int ans;

	int i;

	for (i = 0; i < 4; i++) {
		if (result[i] > 0) { 
			ans = result[i];
			break;
		}
	}

	for (i = 0; i < 4; i++) {
		if (result[i] > 0 && ans > result[i]) {
			ans = result[i];
		}
	}

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

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<class Z> V<Z> divisor(Z n) {
  V<Z> res;
  Z i;
  for (i = 1; i * i < n; ++i) if (n % i == 0) res.push_back(i), res.push_back(n / i);
  if (i * i == n) res.push_back(i);
  sort(begin(res), end(res));
  return res;
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  lint n; cin >> n;
  lint res = 1e18;
  for (lint d : divisor(n)) {
    res = min(res, d - 1 + n / d - 1);
  }
  cout << res << '\n';
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong(), B = sc.nextLong(), ans = 0;
        if (A%2==1) {
            ans^=A-1;
            A--;
        }
        while ((B-A+1)%4!=0) {
            ans ^= B+1;
            B++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23124
#include <iostream>
using namespace std;
void ABC50(void);
void ABC52(void);
void ABC53(void);
void ABC54(void);
void ABC55(void);
void ABC56(void);
void ABC57(void);
void ABC58(void);
void ABC59(void);

int main(void){
    ABC55();
    return 0;
}

void ABC55(void){
    int n,y;
    cin>>n;
    y=n/15;
    cout<<800*n-200*y<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main (void)
{
    int A,B;
    int ans=0;
    int val=1;

    scanf("%d %d",&A,&B);

    while(1){
        if(val>=B){
            break;
        }

        val+=(A-1);
        ans++;
    }

    printf("%d",ans);



    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll f[200000];
int main()
{
    ll a,b,c,d,i,j;
    cin>>b;
    for(i=1;i<=200000;i++)f[i]=i;
    for(i=2;i*i<=200000;i++)
    {
        if(f[i]!=i)continue;
        for(j=i*i;j<=200000;j+=i)
        {
            f[j]=i;
        }
    }
    for(i=b;;i++)
    {
        if(f[i]==i)
        {
            cout<<i<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
using namespace std;
int dx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};
int dfs(int x, int y, int acc, vector<vector<bool> > &map)
{
    acc=0;
    if(map[x][y]==false)return 0;
map[x][y]=false;
for(int i=0;i<4;i++){
    int nx=x+dx[i];
    int ny=y+dy[i];

    acc+=dfs(nx,ny,acc,map);
}
acc++;
return acc;
}
/*void dfs(int x,int y,vector<vector<bool> > &map,vector<int> &ans){
    if(map[x][y]){
        ans.push_back(x);
    map[x][y]=false;
for(int i=0;i<4;i++){
    int nx=x+dx[i];
    int ny=y+dy[i];
    dfs(nx,ny,map,ans);
}
    }
}*/
int main(void)
{
    int h, w;
    while (1)
    {
        cin >> h >> w;
        if (h == 0)
            break;
        vector<vector<bool> > map(w + 2, vector<bool>(h + 2, false));
        char temp;
        int x, y;
        for (int i = 1; i <= w; i++)
        {
            for (int j = 1; j <= h; j++)
            {
                cin>>temp;
                if(temp!='#')
                map[i][j]=true;
                if(temp=='@'){
                    x=i;
                    y=j;
                 }
            }
        }
        cout<<dfs(x,y,0,map)<<endl;
   /*     vector<int> ans;
dfs(x,y,map,ans);
cout<<ans.size()<<endl;*/

    }
    return 0;
}

Measured memory_bytes: 3008
package main

import (
	"fmt"
)

func solution(n, m int, a []int) string {
	sum := 0.0
	for _, x := range a {
		sum += float64(x)
	}
	c := 0
	for _, x := range a {
		if float64(x) >= sum/float64(4*m) {
			c++
		}
	}
	if c >= m {
		return "Yes"
	}
	return "No"
}

func main() {
	var n, m, j int
	fmt.Scan(&n, &m)
	a := make([]int, n)

	for i := range a {
		fmt.Scan(&j)
		a[i] = j
	}
	fmt.Println(solution(n, m, a))
}


Measured memory_bytes: 512
from collections import defaultdict
from bisect import bisect_left, bisect_right
n, k = map(int, input().split())
a = list(map(int, input().split()))

a_cs = [0] * (n + 1)
for i in range(n):
    a_cs[i + 1] = a_cs[i] + a[i]

d = defaultdict(list)
for i in range(n + 1):
    d[(a_cs[i] - i) % k].append(i)

ans = 0
for l in range(n):
    idx_1 = bisect_right(d[(a_cs[l] - l) % k], l)
    idx_2 = bisect_left(d[(a_cs[l] - l) % k], l + k)
    ans += idx_2 - idx_1

print(ans)


Measured memory_bytes: 69512
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		int cnt = 0;
		for(int i = 1; i <= n; i++){
		    int c = i;
		    int tmp = 0;
		    while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    }
		    if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    }
		}
		
		// 出力
		System.out.println(result);
	}
}



Measured memory_bytes: 21716
#include <cstdio>
#include <cstring>
int main()
{
    char ch(getchar());
    while(ch<'a'||ch>'z')
        ch=getchar();
    while((ch>='a'&&ch<='z')||ch==',')
    {
        if(ch==',')
            printf(" ");
        else 
            printf("%c",ch);
        ch=getchar();
    }
}

Measured memory_bytes: 128
import math

a, b, x = map(int, input().split())

height = x / (a ** 2)

if height <= b / 2 :
   print(90 - math.degrees(math.atan((x * 2) / (a * b * b))))
else :
    print(math.degrees(math.atan((a * a * b - x) * 2 / (a ** 3) )))

Measured memory_bytes: 3060
#include <iostream>
#include <unordered_map>

int main() {
  std::unordered_map<int, int> rem;
  int n;
  std::cin >> n;
  for (int i= 0, a; i < n; ++i) {
    std::cin >> a;
    ++rem[a];
  }
  bool ans = true;
  for (const auto& v: rem) {
    if (v.second > 1) {
      ans = false;
      break;
    }
  }
  if (ans) std::cout << "YES" << std::endl;
  else std::cout << "NO" << std::endl;
  return 0;
}


Measured memory_bytes: 8520
#include <stdio.h>

int main(){
    int a=0;
    int b=0;
    int c=0;

    scanf("%d %d %d",&a, &b, &c);

    if ((a < b)&&(b < c)){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 1768
#include<bits/stdc++.h>
#define MOD 1000000007
#define MOD2 1000000006
#define TEMPMOD1 998244353
#define TEMPMOD2 998244352
#define INF 1000000000000000007
#define NEGINF -1000000000000000007
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define plll pair<ll,pll>
#define vpll vector<pll>
using namespace std;
typedef long long int ll;

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

    ll n;
    cin>>n;
    int compatible[n][n];
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++)
        {
            cin>>compatible[i][j];
        }    
    }
    ll mask1=(1<<n);
    ll value[mask1];
    for(ll i=0;i<mask1;i++)
    {
        value[i]=0;
        for(ll j=0;j<n;j++)
        {
            if(((i>>j)&1)==0)
            {
                continue;    
            }
            for(ll k=j+1;k<n;k++)
            {
                if(((i>>k)&1)==0)
                {
                continue;    
                }    
                value[i]+=compatible[j][k];
            }    
        }
    }
    ll dp[mask1];
    for(ll i=0;i<mask1;i++)
    {
        dp[i]=0;
        for (ll s=i; s; s=(s-1)&i)
        {
            dp[i]=max(dp[i^s]+value[s],dp[i]);    
        }
    }
    cout<<dp[mask1-1];
    return 0;
}

Measured memory_bytes: 1280
n = int(input())
lst = []
for i in range(n):
  lst.append(int(input()))
lst.sort()
ac = sum(lst)
if ac % 10 != 0:
  print(ac)
  exit()
for i in range(n):
  if lst[i] % 10 != 0:
    print(ac - lst[i])
    exit()
print(0)

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


void solve(long long N){
	long i,j;
	long ran = sqrt(N);
	long ans = INFINITY;
	long temp;
	for(i=1;i<=ran;i++){
		if(N%i==0){
			j=N/i;
			temp = i+j-2;
			ans = min(ans,temp);
		}
	}
	cout << ans << endl;

}

// 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)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
def chk(a,b):
	if len(a)!=len(b):
		return False
	for i in range(len(a)):
		if a[i]!=b[i] and a[i]!='?' and b[i]!='?':
			return False
	return True

s=list(input())
t=list(input())
ans=[]

l=len(s)-len(t)+1
for i in range(l):
	if chk(s[i:i+len(t)],t):
		ans.append((''.join(s[:i]+t+s[i+len(t):])).replace('?','a'))
if ans==[]:
	print('UNRESTORABLE')
else:
	print(min(ans))

Measured memory_bytes: 3064
S = input()
N = len(S)
cells = [0]*N

seq = 0
for i, s in enumerate(S):
    if s == 'R':
        seq += 1
        cells[i] = seq
        continue
    seq = 0

rev_S = S[::-1]
seq = 0
for i, s in enumerate(rev_S):
    if s == 'L':
        seq += 1
        cells[N-1-i] = seq
        continue
    seq = 0

ans = [0]*N
pre_cell = 0
pre_s = 'R'
l_flag =False
for i, s in enumerate(S):
    cell = cells[i]
    if pre_s == 'R' and s == 'L':
        ans[i] = cell//2 + cell%2 + pre_cell//2
        ans[i-1] = pre_cell//2 + pre_cell % 2 + cell//2
    pre_s = s
    pre_cell = cell

ans_str = ""
for a in ans:
    ans_str += str(a)+" "
print(ans_str)

Measured memory_bytes: 8672
#include<iostream>
#include<vector>
#include<set>
#include<bitset>
#include<algorithm>
using namespace std;

const int N = 49;

int w, h;
vector<vector<int>> field;
int size;
vector<vector<int>> vertex;
vector<vector<int>> edge;
bitset<N> visited;
set<unsigned long long> memo;

void make_graph() {
    enum {Y, X};
    const int NEXT[4][2] = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};
//     const int NEXT[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
    const int NIL = -1;
    size = 0;
    vertex = vector<vector<int>>(h, vector<int>(w, NIL));
    for(int y = 0; y < h; ++y) for(int x = 0; x < w; ++x) if(!field[y][x]) vertex[y][x] = size++;
    edge = vector<vector<int>>(h * w, vector<int>());
    for(int y = 0; y < h; ++y) for(int x = 0; x < w; ++x) {
        if(vertex[y][x] == NIL) continue;
        for(const auto &d: NEXT) {
            int ny = y + d[Y];
            int nx = x + d[X];
            if(ny < 0 || h <= ny || nx < 0 || w <= nx) continue;
            if(vertex[ny][nx] == NIL) continue;
            edge[vertex[y][x]].push_back(vertex[ny][nx]);
        }
    }
};

void reachability(const int &from, bitset<N> &visited) {
    visited.set(from);
    for(const auto &to: edge[from]) if(!visited[to]) reachability(to, visited);
}
bool cut_vertex(const int &from) {
    auto dup = visited;
    dup.set(from);
    for(const auto &to: edge[from]) {
        if(dup[to]) continue;
        reachability(to, dup);
        return dup.count() != size;
    }
    return dup.count() != size;
}

bool dfs(const int &start, int from) {
//     cout<<visited<<" "<<from<<endl;
    unsigned long long m = visited.to_ullong() * N + from;
    if(memo.count(m)) return false;
    memo.insert(m);

    // cut vertexはダメ
    if(cut_vertex(from)) return false;

    // 現在地以外で次数1の頂点があるとダメ
    for(int u = 0; u < size; ++u) {
        if(u == from) continue;
        if(visited[u]) continue;
        int degree = 0;
        for(const auto& v: edge[u]) if(v == start || !visited[v]) ++degree;
        if(degree < 2) return false;
    }

    visited.set(from);
    for(const auto &to: edge[from]) {
        if(to == start && visited.count() == size) return true;
        if(visited[to]) continue;
        if(dfs(start, to)) return true;
    }
    visited.reset(from);
    return false;
}

bool solve() {
    visited = bitset<N>(0);
    make_graph();
    memo.clear();
    for(int y = 0; y < h; ++y) for(int x = 0; x < w; ++x) if(!field[y][x]) return dfs(vertex[y][x], vertex[y][x]);
//     for(int y = 3; y < h; ++y) for(int x = 0; x < w; ++x) if(!field[y][x]) return dfs(vertex[y][x], vertex[y][x]);
//     for(int y = 0; y < 3; ++y) for(int x = 0; x < w; ++x) if(!field[y][x]) return dfs(vertex[y][x], vertex[y][x]);
    return false;
}

int main() {
    while(cin >> w >> h, w | h) {
        field = vector<vector<int>>(h, vector<int>(w));
        for(auto &line: field) for(auto &v: line) cin >> v;
        cout << (solve() ? "Yes" : "No") << endl;
    }
}

Measured memory_bytes: 26680
n = int(input())
s = [input() for i in range(n)]
count,a,b,ab = 0,0,0,0
for word in s:
  count += word.count("AB")
  if word[0] == "B" and word[-1] =="A":
    ab += 1
  elif word[0] == "B":
    b += 1
  elif word[-1] == "A":
    a += 1
  else:
    pass
if ab == 0:
  print(min([a,b])+count)
else:
  if a == 0 and b == 0:
    print(ab-1+count)
  elif a == 0 or b == 0:
    print(ab+count)
  else:
    print(ab+1+min([a-1,b-1])+count)


Measured memory_bytes: 3700
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

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

ll how_many(ll A, ll B){
    if(A<=B){
        return B-A;
    }else{
        return inf;
    }
}

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

    // input
    ll A, B;
    cin >> A >> B;

    vector<ll> candidates;
    candidates.push_back(how_many(A, B));
    candidates.push_back(1+how_many(-A, B));
    candidates.push_back(1+how_many(A, -B));
    candidates.push_back(2+how_many(-A, -B));

    sort(ALL(candidates));

    p(candidates[0]);

    return 0;
}

Measured memory_bytes: 256