akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    vec<int> W(N, 0);
    vec<int> E(N, 0);
    for (int i = 1; i < N; ++i) {
        W[i] = W[i - 1];
        if (S[i - 1] == 'W') ++W[i];
    }
    for (int i = N - 2; i >= 0; --i) {
        E[i] = E[i + 1];
        if (S[i + 1] == 'E') ++E[i];
    }
    int ans       = 1e9;
    rep(i, N) ans = min(ans, W[i] + E[i]);
    cout << ans << endl;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    string s;cin>>s;
    if(s.length()%2==1)
    {
        cout<<"No";
        return 0;
    }
    int flag=0;
    for(int i=0;i<s.length()-1;i+=2)
    {
        if(s[i]=='h'&&s[i+1]=='i')
        {
          flag++;  
        }
    }
    if(flag==s.length()/2)cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FAST std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl '\n'
#define pb push_back
#define mod 1000000007
#define fr(i,n) for(int i=0;i<n;i++)
#define int long long int

int h,w;
std::vector<std::vector<int> > a;
map<pair<int,int>,int> m;
std::queue<pair<int,int>> q;

signed main() 
{
    FAST
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin>>h>>w;
    std::vector<int> row(w);
    char x;
    fr(i,h)
    {
        fr(j,w) 
        {
            cin>>x;
            if(x=='.') row[j]=0;
            else row[j]=-1;
        }
    a.pb(row);
    }

    q.push({h-1,w-1});
    a[h-1][w-1]=1;
    
    while(!q.empty())
    {
        pair<int,int> node=q.front();
        q.pop();
        int i=node.first;
        int j=node.second;
        if(m[{i,j}]) continue;
        m[{i,j}]=1;

        if(j>0 && a[i][j-1]!=-1)
            {a[i][j-1]=(a[i][j-1]+a[i][j])%mod;q.push({i,j-1});}
        if(i>0 && a[i-1][j]!=-1)
            {a[i-1][j]=(a[i-1][j]+a[i][j])%mod;q.push({i-1,j});}
    }

    cout<<a[0][0]%mod;



    return 0;
}

Measured memory_bytes: 71552
//============================================================================
// Name        : template.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers

// int main() {
//     int x,y,z;
//     cin >> x >> y >> z;
//     swap(x,y); swap(x,z); 
//     cout << x << " " << y << " " << z;
// return 0;
// }

int main() {
    int a ,b;
    cin >> a >> b;
    vi arr;
    int sm;
    forn(i,a) {
        int x; cin >>x;
     sm+=x;
      arr.pb(x);
    }
    int ans = 0;
    forn(i,a) {
      int val = sm/(4*b) + (sm % (4 *b) != 0);
      if(arr[i] < val) continue;
      ans++;
    }
     if(ans >= b) cout << "Yes";
     else cout << "No";
    // cout << sol;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007


int main() {
  int N;
  cin >> N;
  bool f = false;
  rep(i,100){
    rep(j,100){
      if(4*i + 7*j == N) f = true;
    }
  }

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a,b,x,c;
int main()
{
	cin>>a>>b>>x;
	c=a+b;
	if(a>x)
	{
	cout<<"NO";	
	}
	else if(c>=x)cout<<"YES";
	else cout<<"NO";
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
const ll MOD = 1e9 + 7;
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    IOS
    ll s;
	cin>>s;
	ll v=1000000000;
	ll x=(v-s%v)%v;
	ll y=(s+x)/v;
	cout<<"0 0 1000000000 1 "<<x<<" "<<y<<endl;
}

Measured memory_bytes: 256
# ABC 072 D
N = int(input())
p = list(map(int,input().split()))
ans = 0

r = [0 for k in range(N)]
for k in range(N):
    if p[k] == k+1:
        r[k] = 1
for k in range(1,N):
    if r[k] > 0:
        r[k] += r[k-1]

r = r + [0]

for k in range(1,N+1):
    if r[k] == 0:
        ans += (r[k-1]+1)//2

print(ans)


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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    int A, B, C, X, Y;
    std::cin >> A >> B >> C >> X >> Y;
    ll ans = 0;
    if(C * 2 <= A + B) {
        ans += min(X, Y) * 2 * C;
        if(X != Y) {
            if(Y < X) {
                if(A < C * 2) {
                    ans += abs(X - Y) * A;
                }
                else {
                    ans += abs(X - Y) * C * 2;
                }
            }
            else {
                if(B < C * 2) {
                    ans += abs(X - Y) * B;
                }
                else {
                    ans += abs(X - Y) * C * 2;
               }
            }
        }
    }
    else {
        ans += X * A + Y * B;
    }
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
src = [tuple(map(int,input().split())) for i in range(N)]

cands = []
for cx in range(0,101):
    for cy in range(0,101):
        tmph = None
        for x,y,h in src:
            if h == 0: continue
            ch = h + abs(x-cx) + abs(y-cy)
            if ch < 0: break
            if tmph is None:
                tmph = ch
            elif tmph != ch:
                break
        else:
            cands.append((cx,cy,tmph))

for cx,cy,ch in cands:
    for x,y,h in src:
        if h != max(ch - abs(x-cx) - abs(y-cy), 0): break
    else:
        print(cx,cy,ch)
        exit()

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

#define rep(n) for(ll i=0;i<n;i++)
#define repp(j, n) for(ll j=0;j<n;j++)
#define reppp(i, m, n) for(ll i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    ll n = (ll)s.length();
    
    ll ans = 0;
    repp(i, 1LL << (n-1)){
        ll tmp_ans = 0;
        int start = 0;
        repp(j, n){
            if(i & (1LL << j)){
                tmp_ans += stoll(s.substr(start, j-start+1));
                start = j+1;
            }
        }
        tmp_ans += stoll(s.substr(start, n-1-start+1));
        ans += tmp_ans;
    }
    cout << ans << endl;
}


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

int main() {
  string s,s1="maerd",s2="remaerd",s3="esare",s4="resare";
  cin >> s;
  reverse(s.begin(),s.end());
  bool flag=true;
  int i=0;
  while(i!=s.size()){
    if(s.substr(i,5)==s1)i+=5;
    else if(s.substr(i,5)==s3)i+=5;
    else if(s.substr(i,7)==s2)i+=7;
    else if(s.substr(i,6)==s4)i+=6;
    else {flag=false; break;}
  }
  if(flag)cout << "YES"<<endl;
  else cout << "NO"<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define akumanosuuji = 666;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int a,b,x;
    cin >> a >> b >> x;
    x--;
    for(int i=a;i<=b;i++){
        if(i <= a+x || b-x <= i) cout << i << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[105][105][305];
ll v[105], w[105];
int main()
{
    ll ans = 0, W;
    int n;
    scanf("%d%lld", &n, &W);
    for (int i = 0; i < n; i++) {
        scanf("%lld%lld", &w[i], &v[i]);
    }

    for (int i = 0; i < n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 0; k <= 3 * j; k++) {
                dp[i + 1][j][k] = max(dp[i][j][k], dp[i + 1][j][k]);
                if (k + (w[i] - w[0]) <= 3 * n) dp[i + 1][j][k + (w[i] - w[0])] = max(dp[i + 1][j][k + (w[i] - w[0])], dp[i][j - 1][k] + v[i]);
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 0; k <= 3 * j; k++) {
                if (W - j * w[0] >= k) ans = max(ans, dp[i][j][k]);
                //printf("dp[%d][%d][%d] = %d\n", i, j, k, dp[i][j][k]);
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}


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


int main(){
    int n;cin>>n;vector<int> l(n);
    rep(i,n) cin>>l[i];
    sort(l.begin(),l.end());
    int ans=0;
    rep(i,n-2){
        rept(i+1,j,n-1){
            int sm=l[i]+l[j];
            int k=lower_bound(l.begin(),l.end(),sm)-l.begin();
            if(j<k-1){
                ans+=k-1-j;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
const ll M = 1e9+7;
 
ll n, m, k, ans;
ll fact[220000];
 
ll mpow(ll a, ll n) {
  if (n == 0) return 1;
  if (n % 2) return mpow(a, n-1) * a % M;
  return mpow(a * a % M, n/2);
}
 
ll cmb(ll n, ll r) {
  return fact[n] * mpow(fact[r], M-2) % M * mpow(fact[n-r], M-2) % M;
}
 
int main() {
  cin >> n >> m >> k;
  
  fact[0] = 1;
  for (ll i = 1; i <= 220000; ++i) {
    fact[i] = fact[i-1] * i % M;
  }
  
  ans = 0;
  for (ll i = 1; i <= n-1; i++) {
    ans += i * (n-i) * m % M * m % M * cmb(n*m-2, k-2) % M;
    ans %= M;
  }
  
  for (ll i = 1; i <= m-1; i++) {
    ans += i * (m-i) * n % M * n % M * cmb(n*m-2, k-2) % M;
    ans %= M;
  }
  
  ans %= M;
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1920
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int A = int.Parse(str[1]);
		int B = int.Parse(str[2]);
		int c = 1;
		int ct0 = 0;
		int ct1 = 0;
		int ct1i = -1;
		int[] LNa = new int[N];
		int[] LNb = new int[N];
		int[] D = new int[N];
		int[] ctL = new int[N];
		for(var i=0;i<N;i++){
			D[i] = c;
			int a1 = (A/c)%2;
			int b1 = (B/c)%2;
			LNa[i] = a1;
			LNb[i] = b1;
			if(Math.Abs(a1-b1)%2==1){
				ct1++;
				ctL[i]=1;
				ct1i = i;
			} else {
				ct0++;
			}
			c *= 2;
		}
		if(ct1%2==0){
			Console.WriteLine("NO");
		} else {
			Console.WriteLine("YES");
			List<int> ans = Ar(N,A,B);
			Console.Write(ans[0]);
			for(var i=1;i<ans.Count;i++){
				Console.Write(" "+ans[i]);
			}
		}
	}
	static List<int> Ar(int n,int a,int b){
		int L = (int)Math.Pow(2,n);		
		List<int> A = new List<int>();
		if(n==1){
			A.Add(a);
			A.Add(b);
		} else {
			int c = 1;
			for(var i=0;i<n;i++){
				int a1 = a/c%2;
				int b1 = b/c%2;
				if(a1!=b1){
					int a2 = a%c+a/(c*2)*c;
					int b2 = b%c+b/(c*2)*c;
					int a3 = a2/2*2+(a2%2+1)%2;
					A.AddRange(Ar(n-1,a2,a3));
					for(var j=0;j<L/2;j++){
						int a4 = A[j]/c;
						A[j] = a4*2*c+a1*c+A[j]%c;
					}
					A.AddRange(Ar(n-1,a3,b2));
					for(var j=L/2;j<L;j++){
						int a4 = A[j]/c;
						A[j] = a4*2*c+b1*c+A[j]%c;
					}
					break;
				} else {
					c *= 2;
				}
			}
		}
		return A;
	}
}

Measured memory_bytes: 25404
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    unsigned long long int x, deposit = 100;
    scanf("%llu", &x);

    int year = 1;

    while(1)
    {
        deposit += (.01*deposit);

        if(deposit >= x)
            break;

        year++;
    }

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

    return 0;
}


Measured memory_bytes: 1732
#include<stdio.h>
int main() {

	int n, i, d1[100], d2[100], count = 0;
	int flag = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d%d", &d1[i], &d2[i]);

		if (d1[i] == d2[i])
			count++;
		else
			count = 0;

		if (count == 3)
			flag = 1;
	}

	if (flag == 1)
		printf("Yes");
	else
		printf("No");

	return 0;
}



Measured memory_bytes: 2176
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	char s[3];
	for(int i=0;i<3;i++)
		scanf("%c",&s[i]);
	bool flag=false;
	for(int i=0;i<3;i++)
		if(i>0&&s[i]!=s[i-1])
			flag=true;
	if(flag)
		printf("Yes\n");
	else
		printf("No\n");
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N;
string S;
signed main(){
	cin>>N>>S;
	int cnt=0;
	rep(i,N)cnt+=S[i]=='R';
	int ans=0;
	rep(i,cnt){
		ans+=S[i]=='W';
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  int a = 0; int b = 0; int c = 0; int d = 0;
  for(int i = 0; i < n; i++){
    string s;
    cin >> s;
    if(s == "AC") a++;
    if(s == "WA") b++;
    if(s == "TLE") c++;
    if(s == "RE") d++;
  }
  cout << "AC" << " x " << a << endl;
  cout << "WA" << " x " << b << endl;
  cout << "TLE" << " x " << c << endl;
  cout << "RE" << " x " << d << endl;
}

Measured memory_bytes: 3508
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque, BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let s: Vec<char> = util::line().chars().collect();

    let pp: Vec<Vec<char>> = vec!["dream", "dreamer", "erase", "eraser"]
        .into_iter()
        .map(|s| s.chars().collect())
        .collect();

    let mut r = &s[..];

    let mut updated = true;
    while updated {
        updated = false;
        for p in &pp {
            if r.ends_with(p) {
                r = &r[..r.len() - p.len()];
                updated = true;
            }
        }
    }

    if r.is_empty() {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 4352
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.CompletableFuture;
import java.util.function.LongSupplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static final long[] fal_rnd(long[] ar,LongSupplier sp){
		int l=-1,r=ar.length;
		while(l+1!=r)
			ar[Math.random()<0.5?++l:--r]=sp.getAsLong();
		return ar;
	}
	static final IntStream REPS(int v){
		return IntStream.range(0,v);
	};
	public static void main(String[] __) throws Exception{
		int n,m;
		solve:
		while((n=s.nextInt())+(m=s.nextInt())!=0){
			List<Integer>
			t=REPS(n).mapToObj(i->s.nextInt()).collect(Collectors.toList()),
			h=REPS(m).mapToObj(i->s.nextInt()).collect(Collectors.toList());
			CompletableFuture<Integer>
			f1=CompletableFuture.supplyAsync(()->t.parallelStream().mapToInt(v->v).sum()),
			f2=CompletableFuture.supplyAsync(()->h.parallelStream().mapToInt(v->v).sum());
			int sumt=f1.get(),sumh=f2.get();
			if((sumt+sumh)%2==1) {
				System.out.println(-1);
				continue solve;
			}
			for(int i:t) {
				if(h.contains(i+(sumh-sumt)/2)) {
					System.out.printf("%d %d\n",i,i+(sumh-sumt)/2);
					continue solve;
				}
			}
			System.out.println(-1);
		}
	}
}

Measured memory_bytes: 35452
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll r;
    cin>>r;
    ll res=3*r*r;
    cout<<res<<endl;
    return 0;
    }


Measured memory_bytes: 256
N = int(input())
A = 1
answer = 10**10
while A**2 <= N:
    if N % A == 0:
        B = N//A
        if answer > max(len(str(A)), len(str(B))):
            answer = max(len(str(A)), len(str(B)))
    A += 1
print(answer)

Measured memory_bytes: 3060
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
	}
	counter := make(map[int]int)
	for _, a := range as {
		counter[a]++
	}

	ans := 0
	for a, cnt := range counter {
		if cnt >= a {
			ans += cnt - a
		} else {
			ans += cnt
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 7808
#include <cstdio>
#include <vector>

using namespace std;

int main() {
	int n;
	scanf("%d", &n);
	vector<int> a, p(1);
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		a.push_back(x);
		p.push_back(0);
	}
	for (int i = 0; i < n; i++) {
		p[a[i]] = p[a[i] - 1] + 1;
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		ans = max(ans, p[i]);
	}
	printf("%d\n", n - ans);
	return 0;
}


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

int main(){
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	int flag=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='9'){
			cout<<"Yes"<<endl;
			flag=1;
			break;
		}
	}
	if(flag==0){
		cout<<"No"<<endl;
	}
	return 0;
} 

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

int main() {
    int a;
    int b;
    string calc;
    cin >> a >> b;
    
    if(a < b){
        calc = "a < b";
    }else if(a > b){
        calc = "a > b";
    }else{
        calc = "a == b";
    }

    cout << calc << endl;
}


Measured memory_bytes: 3200
n = int(input())
main = [[0] * (n+1) for i in range(n+1)]

for i in range(n):
	a = input().split()
	for j in range(int(a[1])):
		main[int(a[0])][int(a[j+2])] = 1

#print(main)
for i in range(1,n+1):
	print(*main[i][1:])

del a


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

int main(){
    int k,n;
    int a[200000];
    int ans = 0;
    int maxdis = 0;
    int dep = 0;
    scanf("%d %d",&k,&n);
    for(int i = 0;i < n;i++){
        a[i] = -1;
        scanf("%d",&a[i]);
    }
    for(int i = 0;i < n - 1 && a[i + 1] > 0;i++){
        if(a[i + 1] - a[i] > maxdis){
             maxdis = a[i + 1] - a[i];
             dep = i;
        }
    }
    if(k - a[n - 1] > maxdis){
         maxdis = k - a[n];
         dep = n;
    }
    if(dep == 0 || dep == n){
        ans = a[n - 1] - a[0];
    }else{
        ans = k - (a[dep + 1] - a[dep]);
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll x0=100,c=0,x;
    cin>>x;
    while(x0<x){
        ++c;
        x0+=x0/100;
    }
    cout<<c;
}


Measured memory_bytes: 3520
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int W = scan.nextInt();
		int a = scan.nextInt();
		int b = scan.nextInt();
		int ans;

		if(a+W < b){
			System.out.println(b - (a+W));
		}else if(b+W < a){
			System.out.println(a-(b+W));

		}else{
			System.out.println("0");
		}

	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N; cin >> N;
    vector<long long> A(N * N), S(1 << N), M(1 << N, -1e16);
    for (int i = 0; i < N * N; i++) cin >> A[i];
    for (int i = 0; i < 1 << N; i++) {
        for (int x = 0; x < N; x++) {
            for (int y = x + 1; y < N; y++) {
                if ((i & (1 << x)) && (i & (1 << y))) {
                    S[i] += A[x * N + y];
                }
            }
        }
    }
    M[0] = 0;
    for (int i = 0; i < 1 << N; i++) {
        for (int j = i; j >= 0; j--) {
            j &= i;
            M[i] = max(M[i], S[j] + M[(~j) & i]);
        }
    }
    cout << M[(1 << N) - 1] << endl;
    return 0;
}

Measured memory_bytes: 1280
N,*A = map(int, open(0).read().split())
a = A[0]
b = A[1]
c = A[2]
d = sum(A[3:])
x = 0
m = c
n = d
df2 = max(m,n)-min(m,n)
y = 2
for i in range(3,N-1):
  m += A[i]
  n -= A[i]
  if df2>max(m,n)-min(m,n):
    df2 = max(m,n)-min(m,n)
    c,d = m,n
    y = i
ans = max(a,b,c,d)-min(a,b,c,d)
for i in range(2,N-2):
  b += A[i]
  c -= A[i]
  df1 = max(a,b)-min(a,b)
  df2 = max(c,d)-min(c,d)
  while True:
    na = a+A[x+1]
    nb = b-A[x+1]
    if df1<max(na,nb)-min(na,nb):
      break
    df1 = max(na,nb)-min(na,nb)
    a,b = na,nb
    x += 1
  while True:
    nc = c+A[y+1]
    nd = d-A[y+1]
    if df2<max(nc,nd)-min(nc,nd):
      break
    df2 = max(nc,nd)-min(nc,nd)
    c,d = nc,nd
    y += 1
  ans = min(ans,max(a,b,c,d)-min(a,b,c,d))
print(ans)

Measured memory_bytes: 24724
from sys import stdin
##  input functions for me
def ria(sep = ''):
    if sep == '' :
        return list(map(int, input().split())) 
    else: return list(map(int, input().split(sep)))
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##

def gcd(a, b): return b if a == 0 else gcd(b % a, a)

## main ##
N = ri()
A = ria()

L = [0] * N
R = [0] * N

L[0] = A[0]
for i in range(1, N): L[i] = gcd(A[i], L[i - 1])
R[N-1] = A[N-1]
for i in range(1, N): R[N - 1 - i] = gcd(A[N - 1 - i], R[N - 1 - i + 1])
if N > 2 : ma = max(R[1], L[N-2])
else: ma = max(A)
for i in range(1, N - 1): ma = max(ma, gcd(L[i - 1], R[i + 1]))
#print(L)
#print(R)


print(ma)







Measured memory_bytes: 14204
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            //ここから

            int N = IO.ReadLineToInt();
            List<Pair> list = new List<Pair>();
            long sum = 0;
            string ans = "Yes";

            for(int i = 0; i < N; i++)
            {
                long[] temp = IO.ReadLineToLongArray();
                Pair pair = new Pair();
                pair.A = temp[0];
                pair.B = temp[1];
                list.Add(pair);
                sum += temp[0];
            }

            list = list.OrderByDescending(l => l.B).ToList();

            for(int i = 0; i < N; i++)
            {
                if (sum > list[i].B)
                {
                    ans = "No";
                    break;
                }
                else
                {
                    sum -= list[i].A;
                }
            }

            //ここまで
            Console.WriteLine(ans);
            Console.ReadKey();
        }
    }
    
    class Pair
    {
        public long A;
        public long B;
    }

    class Func
    {
        long mod = 1000000007;
        static public void Swap<T>(ref T a, ref T b) { T temp = a; a = b; b = temp; }
        static public long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }
        static public long LCM(long a, long b) { return (long)a * b / GCD(a, b); }
        static public int Factorial(int a) { return a == 1 ? a : a * Factorial(a - 1); }
        static public int Conbin(int n, int m) { return Factorial(n) / (Factorial(n - m) * Factorial(m)); }
        static public void Factoring(long num, ref long[] vs)
        {
            if (num == 1)
            {
                vs[1]++;
            }
            for (long i = 2; i < (long)Math.Sqrt(num); i++)
            {
                if (num % i == 0)
                {
                    vs[i]++;
                    Factoring(num / i, ref vs);
                }
            }
            vs[1]++;
        }
    }

    class IO
    {
        static public string ReadLineToString() { return Console.ReadLine(); }
        static public int ReadLineToInt() { return int.Parse(Console.ReadLine()); }
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public string[] ReadLineToStringArray() { return Console.ReadLine().Split(' ').ToArray(); }
        static public int[] ReadLineToIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] ReadLineToLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<string> ReadLineToStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> ReadLineToIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    }
}

Measured memory_bytes: 35972
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
vector<vector< pair<int, ll> > > path(100010);
ll dist[100010];

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

void visit(int from, int to, ll depth)
{
    //cout << from << "to" << to << endl;
    dist[to] = depth;
    for(int i = 0; i <= path[to].size() - 1; i++){
        //cout << i << "  " << path[to][i].first << endl;
        if(path[to][i].first == from){
            continue;
        }
        visit(to, path[to][i].first, path[to][i].second + depth);
    }
    return;
}

int main() {
    //cout.precision(10);
    int n, q, k;
    cin >> n;
    for(int i = 1; i <= n - 1; i++){
        int a, b;
        ll c;
        cin >> a >> b >> c;
        pair<int, ll> in1;
        in1.first = a;
        in1.second = c;
        path[b].push_back(in1);
        in1.first = b;
        path[a].push_back(in1);
    }
    /*for(int i = 1; i <= n; i++){
        cout << i << " size " << path[i].size() << endl; 
        for(int j = 0; j <= path[i].size() - 1; j++){
            cout << path[i][j].first << endl;
        }
    }*/
    //cout << path[2][0].first  << path[2][1].first << endl;
    cin >> q >> k;
    //cout << k << endl;
    visit(0, k, 0);
    /*for(int i = 1; i <= n; i++){
        cout << i << " " << dist[i] << endl;
    }*/
    for(int i = 0; i < q; i++){
        int x, y;
        cin >> x >> y;
        cout << dist[x] + dist[y] << endl;
    }
    return 0;
}

Measured memory_bytes: 14336
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	string S;
	cin >> S;
	bool includeC = false;
	
	for (int i = 0; i < S.size(); i++) {
	    if(S[i] == 'C') includeC = true;
	    
	    if(includeC == true and S[i] == 'F') {
	        std::cout << "Yes" << std::endl;
	        return 0;   
	    }
	}
	std::cout << "No" << std::endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
summmer = [""]*n
for i in range(n):
    summmer[i] = list(map(int,input().split()))
happy = [0]*(n+1)
for i in range(n+1):
    happy[i] = [0]*3
yesterday = -1
for i in range(1,n+1):
    happy[i][0] = max(happy[i-1][1] + summmer[i-1][0],happy[i-1][2] + summmer[i-1][0]) 
    happy[i][1] = max(happy[i-1][0] + summmer[i-1][1],happy[i-1][2] + summmer[i-1][1]) 
    happy[i][2] = max(happy[i-1][0] + summmer[i-1][2],happy[i-1][1] + summmer[i-1][2]) 
# print(happy)
print(max(happy[-1]))



Measured memory_bytes: 100272
public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		for(int i = 1; i <= 9; i++) {
			for(int j = 1; j <= 9; j++) {
				System.out.println(i + "x" + j + "=" + (i*j));
			}
		}
	}
}


Measured memory_bytes: 24256
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
    char c;
    int i=0;
    while(cin>>c){
        i++;
        if(i%2==1) cout<<c;
    }
    cout<<endl;
    return 0;
} 



Measured memory_bytes: 256
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define deb(x) cout << #x << " is " << x << "\n";

using namespace std;
using namespace __gnu_pbds;

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s, t;
	cin >>s >>t;
	int n = s.size();
	int m = t.size();
	vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			if(s[i-1] == t[j-1]) {
				dp[i][j] = 1 + dp[i-1][j-1];
			}
			else {
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
			}
		}
	}
	int i = n, j = m;
	stack<char> st;
	while(i > 0 && j > 0) {
		if(s[i-1] == t[j-1]) {
			st.push(s[i-1]);
			i--;
			j--;
		}
		else if(dp[i-1][j] > dp[i][j-1]) {
			i--;
		}
		else {
			j--;
		}
	}
	while(!st.empty()) {
		cout <<st.top();
		st.pop();
	}
	return 0;
}


Measured memory_bytes: 35584
#include<stdio.h>
int main(void)
{
  int n,m;
  int a[100],b[100];
  int result[100];
  scanf("%d %d",&n,&m);
  for(int i=0;i<m;i++){
    scanf("%d %d",&a[i],&b[i]);
  }
  for(int i=0;i<n;i++){
    result[i]=0;
  }
  for(int i=0;i<m;i++){
    result[a[i]-1]++;
    result[b[i]-1]++;
  }
  for(int i=0;i<n;i++){
    printf("%d\n",result[i]);
  }
  return 0;
}


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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define fff ff
#define sss ss.ff
#define ttt ss.ss
#define INF (1 << 30)
#define LLF (1ll << 60)
#define PRIME (1000000007)
#define FASTIO std::ios::sync_with_stdio(false)
#ifdef DEBUG
#define debug(x) cerr << #x << " = " << x << endl
#else
#define debug(x)
#endif
#define rep(i, begin, end)                            \
  for (__typeof(end) i = (begin) - ((begin) > (end)); \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define FILE_INPUT                  \
  freopen("input.txt", "r", stdin); \
  freopen("output.txt", "w", stdout)

#define all(x) x.begin(), x.end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef pair<ll, ii> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<string> vs;

/*-----------------END TEMPLATE-----------------*/

ll ed[1001][1001];
vi idx(1001, 0);

int main() {
  FASTIO;
  ll n;
  scanf("%lld", &n);
  assert(n <= 1000);
  ll m = n - 1;

  // 10^6
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < n; j++) {
      ll a;
      scanf("%lld", &a);
      ed[i][j - 1] = a;
    }
  }
  ll days = 0;
  vi foi(n + 1, -1);
  ll cc = 1;
  while (cc) {
    cc = 0;

    // 10^3
    for (int i = 1; i <= n; i++) {
      if (foi[i] == days) continue;

      ll idxi = idx[i];
      if (idxi >= m) continue;
      ll opponent = ed[i][idxi];
      ll idxo = idx[opponent];
      if (idxo >= m || foi[opponent] == days) continue;
      if (ed[opponent][idxo] != i) continue;

      foi[i] = days;
      foi[opponent] = days;
      idx[i]++;
      idx[opponent]++;
      cc++;
    }
    days++;
  }
  ll ans = days;
  rep(i, 1, n + 1) {
    if (idx[i] < m) ans = 0;
  }

  printf("%lld\n", ans - 1);
}


Measured memory_bytes: 8064
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <cctype>
#include <sstream>
#include <algorithm>
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define pr(a) cout << (a) << endl
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000000;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main() {
  string s;
  cin >> s;
  int ans=0;
  rep(i,s.size()) {
    if(s[i]=='O') {
      int cnt=0;
      while(s[i+cnt]=='O' && i+cnt<s.size()) cnt++;
      bool ck=true;
      rep(j,cnt) {
	if(i-j-1<0 || s[i-j-1]!='J') {
	  ck=false;
	  break;
	}
	if(i+j+cnt>=s.size() || s[i+j+cnt]!='I') {
	  ck=false;
	  break;
	}
      }
      if(ck) ans=max(ans,cnt);
      i+=cnt;
    }
  }
  pr(ans);
  return 0;
}


Measured memory_bytes: 2052
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
import numpy as np
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    n = int(readline())
    a = np.array(readline().split(), np.int64)
    a -= np.arange(1, n + 1)
    median = np.median(a).astype(np.int64)

    print(np.abs(a - median).sum())



if __name__ == '__main__':
    main()



Measured memory_bytes: 40104
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         fozubaoyou    pass System Test!
*/


//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    string s;
    cin >> s;
    string x = "ABC";
    if(s == x){
        cout << "ARC";
    }else{
        cout << "ABC";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3612
import java.io.*;

class Main{
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			int q = Integer.parseInt(br.readLine());
			String cmd[], wrk;
			int a, b, idx;
			for(int i=0; i<q; i++){
				cmd = br.readLine().split(" ", 0);
				a = Integer.parseInt(cmd[1]);
				b = Integer.parseInt(cmd[2]);
				if(cmd[0].equals("print")){
					System.out.println(str.substring(a, b+1));
				} else if(cmd[0].equals("reverse") || cmd[0].equals("replace")){
					wrk = "";
					if(a!=0) wrk += str.substring(0, a);
					if(cmd[0].equals("reverse")){
						for(idx=b; idx>=a; idx--){
							wrk += str.charAt(idx);
						}
					} else{
						wrk += cmd[3];
					}
					if(b+1!=str.length()) wrk += str.substring(b+1, str.length());
					str = wrk;
				}
			}
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	}
}

Measured memory_bytes: 55584
a, b = map(int, input().split())

x = a // 0.08
y = b // 0.10
x, y = int(x), int(y)
minv = min(x, y)
maxv = max(x, y)
ans = []

for i in range(minv, maxv+2):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        ans.append(i)

if len(ans) == 0:
    print(-1)
else:
    print(min(ans))


Measured memory_bytes: 9220
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);


int n;string str;
int a[300000], b[300000];
signed main(){
  cin >> n >> str;str = " " + str;
  rrep(i,n)if(str[i] == '#'){a[i]++;}
  rrep(i,n)if(str[i] == '.'){b[i]++;}
  int ans = INF;
  rrep(i,n){a[i] += a[i-1];b[i] += b[i-1];}
  rep(i,n+1){
    int sum = a[i]-a[0] + b[n]-b[i];
    ans = min(ans, sum); 
  }
  cout << ans << endl;
  return 0;
}






Measured memory_bytes: 4160
l, r = list(map(int, input().split()))
# b = list(map(int, input().split()))
# 2019=3*673
ans = 2019
for i in range(l, r+1):
    for j in range(i+1, r+1):
        if (i*j) % 2019 == 0:
            print(0)
            exit()
        else:
            if (i*j) % 2019 < ans:
                ans = (i*j) % 2019

print(ans)


Measured memory_bytes: 2940
#include <iostream>

int main()
{
	long double x1, y1, x2, y2, x3, y3, x4, y4;
	int num_of_instance;
	std::cin >> num_of_instance;
	for (int i=0; i<num_of_instance; i++) {
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		long double tAB = (y2-y1) / (x2-x1);
		long double tCD = (y4-y3) / (x4-x3);
		if (tAB == tCD) std::cout << "YES" << std::endl;
		else std::cout << "NO" << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3076
#include <ctype.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tgmath.h>

int main(int argc, char **argv)
{
    int n, m;
    scanf("%d %d", &n, &m);
    printf(n == m ? "Yes" : "No");
    return EXIT_SUCCESS;
}


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


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n, m = LI()
G = [[] for _ in range(n)]
for _ in range(m):
    l, r, c = LI()
    G[l - 1] += [(r - 1, c)]


for i in range(n - 1):
    G[i + 1] += [(i, 0)]


def dijkstra(G, s=0):
    hq = [(0, s)]
    dist = [INF] * n
    dist[s] = 0
    checked = [0] * n
    while hq:
        min_dist, u = heappop(hq)
        if checked[u]:
            continue
        checked[u] = 1
        for v, c in G[u]:
            if checked[v]:
                continue
            elif dist[u] + c < dist[v]:
                dist[v] = dist[u] + c
                heappush(hq, (dist[u] + c, v))
    return dist


ans = dijkstra(G)[-1]
if ans == INF:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 80592