akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e2 + 10;
int getsum(int n, int x)
{
	int ret = 0;
	while (n)
	{
		n /= x;
		ret += n;
	}
	return ret;
}
bool check(int n)
{
	for (int i = 2; i * i <= n; i++)
	{
		if (n % i == 0) return false;
	}
	return true;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	LL ans = 1;
	for (int i = 2; i <= n; i++)
	{
		if (!check(i)) continue;
		ans = ans * (getsum(n, i) + 1) % INF;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
S = input()
if S == 'SUN':
    ans = 7
elif S == 'MON':
    ans = 6
elif S == 'TUE':
    ans = 5
elif S == 'WED':
    ans = 4
elif S == 'THU':
    ans = 3
elif S == 'FRI':
    ans = 2
else:
    ans = 1
print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(30) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  Vec(P,lli,N,0);
  rep(i,0,N)cin >> P[i];
  rep(i,1,N)P[i]+=P[i-1];
  sum=INF;
  rep(i,0,N-1)chmin(sum,abs(P[i]-(P[N-1]-P[i])));
  Out(sum);
}


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

namespace ConsoleApplication2
{ 
    class Program
    {
    static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = ab[0];
            var b = ab[1];
            Console.WriteLine("{0} {1}",a * b,(a + b) * 2);
        }
    }
}

Measured memory_bytes: 9560
/*input

*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;

		b>>=1;
	}
	return res;
}

int main(){
	IOS;
	int a,b,c;
	cin>>a>>b>>c;
	cout<<a+b+c-max({a,b,c});
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);                                            
    int R[200000],n;

    cin>>n;
    for(int i=0;i<n;i++)
        cin>>R[i];
    int maxv = -2000000000;
    int minv = R[0];

    for(int i=1;i<n;i++){                                          
        maxv=max(maxv,R[i]-minv);
        minv=min(minv,R[i]);
    }       
    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 3912
#include<iostream>
#include<string>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
using namespace std;
int n;
long long a[200500];
int main()
{
    ios::sync_with_stdio(false);
    int k,n,i;
    cin >> n >> k;
    for (i=1;i<=n;i++)
    {
        cin >> a[i];
    }
    long long ans=1e18+7;
    for (i=1;i+k-1<=n;i++)
    {
        long long tmp=a[i+k-1]-a[i];
        if ((a[i]<0) && (a[i+k-1]<0)) tmp+=abs(a[i+k-1]);
        if ((a[i]>0) && (a[i+k-1]>0)) tmp+=a[i];
        if ((a[i]<0) && (a[i+k-1]>0)) tmp+=min(-a[i],a[i+k-1]);
        ans=min(ans,tmp);
    }
    cout << ans;
    return 0;
}

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

using namespace std;
using ll = long long int;
const int MOD = 1e9 + 7;
ll dp[501][501];

ll func(int l, int r, int a[], ll pref[])
{
	if (l == r) return 0;
	auto &ret = dp[l][r];
	if (ret != -1) return ret;

	ret = pref[r+1] - pref[l] + func(l+1, r, a, pref);
	for (int pos = l+1; pos < r; ++pos)
		ret = min(ret, pref[r+1] - pref[l] + func(l, pos, a, pref) + func(pos+1, r, a, pref));
	return ret;
}

void solve()
{
	int n; cin >> n;
	int a[n];
	ll pref[n+1] = {0};
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		pref[i+1] = a[i] + pref[i];
		memset (dp[i], -1, sizeof dp[i]);
	}
	cout << func(0, n-1, a, pref);
}

//  ---------------------Template---------------------------
void InputSetup()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	#ifdef LOCAL
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	#endif
}

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

	InputSetup();
	solve();

	auto finish = chrono::high_resolution_clock::now();
	cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
}
//  ---------------------Template---------------------------

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

using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second

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

    ll n,m;
    cin >> n >> m;
    ll ans=n*(n-1)/2;
    ans += (m*(m-1)/2);
    cout << ans << "\n";

    return 0;
}


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

int main()
{
    long long a,b;
    std::cin >> a >> b;

    long long upper = (a*a - b*b);
    long long lower = (2*a - 2*b);

    if (upper%lower != 0) {
        std::cout << "IMPOSSIBLE" << std::endl;
        return 0;
    }

    long long k = upper/lower;

    std::cout << k << std::endl;

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def get_ints():
    return map(int, sys.stdin.readline().strip().split())


def main():
    L, R, d = get_ints()
    ans = 0
    for i in range(L, R + 1):
        if i % d == 0:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;

string s;
int cnt;

void solve() {
    char ch = s[0];
    for(int i = 1; i < s.size(); i++) {
        if(ch != s[i]) {
            cnt++;
            ch = s[i];
        }
    }
    cout << cnt << endl;
}

int main() {
    cin >> s;
    solve();
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int solve(string s){
    vector<int> a;
    vector<char> o;
    int j = 0;

    rep(i,s.size()){
        if(s[i]=='+'||s[i]=='-'){
            a.pb(stoi(s.substr(j, i - j)));
            j = i+1;
            o.pb(s[i]);
        }
    }
    a.pb(stoi(s.substr(j, s.size() - j)));
    int sum = a[0];

    rep(i,3){
        if(o[i]=='+'){
            sum += a[i+1];
        }
        else{
            sum -= a[i+1];
        }
    }
    return sum;
}
vector<string> cand;
void dfs(string s,int idx){
    if(idx==4){
        cand.pb(s);
        return;
    }
    string s1 = s,s2=s;
    s1.insert(idx+(idx-1),"+");
    s2.insert(idx+(idx-1),"-");
    dfs(s1, idx + 1);
    dfs(s2, idx + 1);
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string abcd;
cin >> abcd;
dfs(abcd, 1);
for(auto s:cand){
    if(solve(s)==7){
        cout << s+"=7" << endl;
        return 0;
    }
}

//system("pause");
return 0;
}

Measured memory_bytes: 256
from scipy.sparse import*
(n,m),*p=[map(int,t.split())for t in open(0)]
a,b,c=zip(*[(i,j+n-1,1)for i,q in enumerate(p)for j in list(q)[1:]])
print('YNEOS'[1in csgraph.connected_components(csr_matrix(((c,(a,b))),[n+m]*2))[1][:n]::2])

Measured memory_bytes: 61148
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <cmath>
#include <stack>
#include <queue>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

int k, n;
vector<int> dis;
vector<int> kankaku;

int main()
{
	cin >> k >> n;
	for (int i = 0; i < n; i++)
	{
		int tmp;
		cin >> tmp;
		dis.push_back(tmp);
	}
	sort(dis.begin(), dis.end());

	for (int i = 0; i < n - 1; i++)
	{
		kankaku.push_back(dis[i + 1] - dis[i]);
	}
	
	kankaku.push_back(k - dis[n - 1] + dis[0]);
	sort(kankaku.begin(), kankaku.end());

	long long sum = 0;
	for (int i = 0; i < n - 1; i++)
	{
		sum += kankaku[i];
	}
	cout << sum;
}


Measured memory_bytes: 33780
#include<bits/stdc++.h>
#define pb push_back
#define fori(j,n) for(int i=j ; i<n ; i++)
#define forj(i,n) for(int j=i ; j<n ; j++)
#define fork(i,n) for(int k=i ; k<n ; k++)
#define ppb pop_back()
#define umap unordered_map
#define uset unordered_set
#define lli long long int
#define mod 1000000007

using namespace std;

void solve()
{
	int n;cin>>n;
	vector<int>arr(n);
	for(int i=0 ; i<n ; i++)
		cin>>arr[i];

	int maxval=arr[0];
	lli cnt=0;
	for(int i=1 ; i<n ; i++)
	{
		if(arr[i]<maxval)
		{
			cnt += maxval-arr[i]; 
		}
		else maxval = arr[i];
	}
	cout<<cnt;
	
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	// int t;cin>>t;
	// while(t--)
	// {
		solve();
		// cout<<endl;
	// }

	return 0;

}


Measured memory_bytes: 3976
#include<iostream>
#include<iomanip>
#include<string>
#include<sstream>

using namespace std;

int main()
{
	int n;

	cin >> n;



	for (int i = 3; i <= n; i++) {
		if (i % 3 == 0) {
			cout << " " << i;
		}
		else {
			ostringstream os;
			string s;
			os << i;
			s = os.str();
			for (int j = 0; j < s.length(); j++) {
				if (s[j] == '3') {
					cout << " " << s;
					break;
				}
			}
		}
	}
	cout << "\n";
}

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

using namespace std;

const int maxn = 2e5 + 50;

int n , a[maxn];
long long sum[maxn];

int main( int argc , char * argv[] ){
	scanf( "%d" , & n );
	for(int i = 1 ; i <= n ; ++ i){
		scanf( "%d" , a + i );
		sum[i] = sum[i - 1] + a[i];
	}
	long long Mi = 1LL << 60;
	for(int i = 1 ; i < n ; ++ i){
		long long newret = abs( sum[i] - ( sum[n] - sum[i] ) );
		Mi = min( Mi , newret );
	}
	cout << Mi << endl;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main(){
    ll n,m;cin>>n>>m;
    ll a[n+1];rep(i,1,n)cin>>a[i];
    ll c[n+1];
    c[0]=0;
    ll Count=0;
    unordered_map<ll,ll> u;
    ll t[n];
    ll i=0;
    auto itr=u.find(c[0]);
    if(itr==u.end()){
        u[c[i]]=Count;
        t[Count]=1;
        Count++;
    }else{
        t[u[c[i]]]++;
    }
    rep(i,1,n){
        c[i]=(c[i-1]+a[i])%m;
        auto itr=u.find(c[i]);
        if(itr==u.end()){
            u[c[i]]=Count;
            t[Count]=1;
            Count++;
        }else{
            t[u[c[i]]]++;
        }
    }
    ll ans=0;
    rep(i,0,Count-1){
        ans=ans+(t[i]*(t[i]-1))/2;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5388
#include<iostream>
#include<sstream>
#include<iomanip>
#include<stdlib.h>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<utility>
#include<algorithm>
#include<complex>
using namespace std;
#define loop(i,l,r) for(int (i)=(int)(l);(i)<(int)(r);(i)++)
#define rloop(i,l,r) for(int (i)=(int)(l);(i)>(int)(r);(i)--)
#define rep(i,n) loop(i,0,n)
#define rrep(i,n) rloop(i,n-1,-1)
#define INF 0x3f3f3f3f
#define mod 1000000007LL
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef complex<double> C;

int main(){
	string s;
	cin>>s;
	cout<<string(s,0,4)<<" "<<string(s,4,8)<<endl;
}


Measured memory_bytes: 256
// atcoder/sumitrust2019/E/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

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

  const lli mod = 1000000007;

  int n;
  while (cin >> n) {
    vector<int> a(n);
    cin >> a;

    const int N = 100000 + 5;
    vector<int> idx[N];
    for (int i = 0; i < a.size(); ++i) {
      idx[a[i]].push_back(i);
    }
    bool f = true;
    for (int i = 0; i < n; ++i) {
      f = f && (idx[i + 1].size() <= idx[i].size());
      f = f && (idx[i].size() <= 3);
    }
    unless (f) {
      cout << 0 << endl;
      continue;
    }

    static lli dp[N];
    fill(dp, dp + N, 0);
    dp[0] = 1;

    const int m = *max_element(a.begin(), a.end());
    for (int i = 0; i < m; ++i) {
      const int j = i + 1;
      vector<int> x = idx[i];
      vector<int> y = idx[j];
      sort(y.begin(), y.end());
      sort(x.begin(), x.end());
      set<vector<int>> vis;
      do {
        vector<int> v;
        bool f = true;
        for (int k = 0; k < y.size(); ++k) {
          f = f && (x[k] <= y[k]);
          v.push_back(x[k]);
        }
        if (f && vis.count(v) == 0) {
          (dp[j] += dp[i]) %= mod;
          vis.insert(v);
        }
      } while (next_permutation(x.begin(), x.end()));
    }

    lli p;
    const int z = count(a.begin(), a.end(), 0);
    if (z == 1) p = 3;
    if (z == 2) p = 6;
    if (z == 3) p = 6;
    cout << (dp[m] * p) % mod << endl;
  }

  return 0;
}


Measured memory_bytes: 6912
n = list(input())

l = len(n)
if int(n[l-1]) in [2, 4, 5, 7, 9]:
    print('hon')
elif int(n[l-1]) in [0, 1, 6, 8]:
    print('pon')
elif int(n[l-1]) == 3:
    print('bon')


Measured memory_bytes: 9180
#[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)*}
    };
}

#[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, usize1) => {
        read_value!($next, usize) - 1
    };

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

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

fn main() {
    input!{
        s: chars,
    }
    let mut s = s;
    if s[0] != 'A' {
        println!("{}", "WA");
        return;
    }
    s[0] = 'a';

    let mut c = 0;
    for i in 2..s.len()-1 {
        if s[i] == 'C' {
            c += 1;
            s[i] = 'c';
        };
    }
    if c != 1 {
        println!("{}", "WA");
        return;
    }
    for i in 0..s.len() {
        if s[i].is_uppercase() {
            println!("{}", "WA");
            return;
        }
    }
    println!("{}", "AC");
}


Measured memory_bytes: 4352
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    if n & 1 == 1 {
        println!("0");
        return;
    }
    let mut count = 0;
    let mut pow5 = 10;
    while pow5 <= n {
        count += n / pow5;
        pow5 *= 5;
    }
    println!("{}", count);
}


Measured memory_bytes: 4352
O=input()
E=input()
ans=""
if len(O)==len(E):
    for i in range(len(O)):
        ans+=O[i]
        ans+=E[i]

    print(ans) 
else:
    for i in range(len(E)):
        ans+=O[i]
        ans+=E[i]
        
    ans+=O[len(O)-1]
    print(ans)
    

Measured memory_bytes: 3060
use proconio::input;

fn main() {
  input! {
    _n: usize,
    rw: String
  }

  let mut reds: Vec<usize> = vec![];
  let mut whites: Vec<usize> = vec![];
  let rw: Vec<char> = rw.chars().collect();
  for (i, c) in rw.iter().enumerate() {
    if *c == 'R' {
      reds.push(i);
    } else {
      whites.push(i);
    }
  }
  
  if whites.len() == 0 || reds.len() == 0 {
    println!("0");
    return
  }
  
  let mut count = 0;
  for i in 0..reds.len() {
    if rw[i] == 'W' {
      count += 1;
    }
  }
  println!("{}", count);
}

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

using namespace std;

using int64 = long long;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if(A > B && A > C) puts("A");
  else if(B > A && B > C) puts("B");
  else puts("C");


}


Measured memory_bytes: 3076
<?php

// ITP1_11 Dice IV

// read data
$n = trim(fgets(STDIN));
$data = [];
for ($i = 0; $i < $n; $i++) {
  $input = trim(fgets(STDIN));
  $labels = explode(" ", $input);
  $data[] = $labels;
}

// check
$cmp = false;
for ($i = 0; $i < $n-1 and !$cmp; $i++) {
  $dice1 = new Dice($data[$i]);
  for ($j = $i + 1; $j < $n and !$cmp; $j++) {
      $dice2 = new Dice($data[$j]);
      $cmp = compare_dice($dice1, $dice2);
  }
}

// answer
if ($cmp) {
  echo "No" . PHP_EOL;
} else {
  echo "Yes" . PHP_EOL;
}

//========================================

function compare_dice($dice1, $dice2)
{
  $dice1_top = $dice1->getLabel("T");

  $check_dirs = "NWSSSW";
  foreach (str_split($check_dirs) as $dir)
  {
    $dice2->roll($dir);
    $dice2_top = $dice2->getLabel("T");
    if ($dice1_top == $dice2_top) {
      for ($i = 0; $i < 4; $i++) {
        if ($dice1->isEqual($dice2)) {
          return true;
        }
        $dice2->roll("R");
      }
    }
  }
  return false;
}

//========================================

class Dice
{
  private $labels;
  private $TBL_ROLL = array(
    array(4, 0, 2, 3, 5, 1),  // -> S
    array(3, 1, 0, 5, 4, 2),  // -> E
    array(2, 1, 5, 0, 4, 3),  // -> W
    array(1, 5, 2, 3, 0, 4),  // -> N
    array(0, 3, 1, 4, 2, 5),  // -> sidespin : right
    array(0, 2, 4, 1, 3, 5)   // -> sidespin : left
  );

  public function __construct($labels)
  {
    $this->labels = $labels;
  }

  public function roll($dirs)
  {
    foreach (str_split($dirs) as $dir) {
      $idx = strpos("SEWNRL", $dir);
      if ($idx === false) {
        continue;
      }

      $old = $this->labels;
      for ($i = 0; $i < 6; $i++) {
        $this->labels[$i] = $old[$this->TBL_ROLL[$idx][$i]];
      }
    }
  }

  public function isEqual($dice) {
    return ($this->labels == $dice->getLabels());
  }

  public function getLabel($dir) {
    $idx = strpos("TSEWNB", $dir);
    if ($idx !== false) {
      return $this->labels[$idx];
    }
    return false;
  }

  public function getLabels() {
    return $this->labels;
  }

  public function getDirection($number) {
    $idx = array_search($number, $this->labels);
    if ($idx !== false) {
      return "TSEWNB"[$idx];
    }
    return false;
  }
}

Measured memory_bytes: 15536
n, k = gets.split.map(&:to_i)

x = (n - 1) * (n - 2) / 2
if k > x
    puts -1
    exit
end

ary = Array.new(n-1) {|i| "1 #{i+2}"}
i = 2
j = 3
(x-k).times do
    ary << "#{i} #{j}"
    if j == n
        i += 1
        j = i + 1
    else
        j += 1
    end
end

puts ary.size
puts ary

Measured memory_bytes: 2300
a, b, c = [int(i) for i in input().split()]
kawaiso = False

if a == b:
    if b == c:
        kawaiso = False
    else:
        kawaiso = True
else:
    if a == c or b == c:
        kawaiso = True
    else:
        kawaiso = False

if kawaiso:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long 
struct ss{
	int node,nxt;
}e[600005];
inline int read()
{
	int re=0,k=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')k=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){re=(re<<1)+(re<<3)+ch-48;ch=getchar();}
	return re*k;
}
int u,v,n,col[200005],f[200005],del[200005],s[200005],sz[200005],head[200005],tot,g[200005];
void add(int u,int v)
{
	e[++tot].nxt=head[u];
	e[tot].node=v;
	head[u]=tot;
}
void getsz(int x,int fa)
{
	for(int i=head[x];i;i=e[i].nxt)
	{
		int t=e[i].node;
		if(t==fa)continue;
		getsz(t,x);
		sz[x]+=sz[t];
	}
}
void dfs(int x,int fa)
{
	int lst=s[col[fa]];
	s[col[fa]]=x;
	if(s[col[x]])del[s[col[x]]]+=sz[x];
	else g[col[x]]+=sz[x];
	for(int i=head[x];i;i=e[i].nxt)
	{
		int t=e[i].node;
		if(t==fa)continue;
		dfs(t,x);
	}
	int now=sz[x]-del[x];
	//cerr<<col[fa]<<" "<<now<<" "<<sz[x]<<endl;
	f[col[fa]]+=now*(now+1)>>1;
	s[col[fa]]=lst;
}
signed main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		col[i]=read();sz[i]=1;
	}
	for(int i=1;i<=n-1;i++)
	{
		u=read();
		v=read();
		add(u,v);
		add(v,u);
	}
	getsz(1,0);
	dfs(1,0);
	for(int i=1;i<=n;i++)
		g[i]=(n-g[i])*(n-g[i]+1)>>1;
	int ans=n*(n+1)>>1;
	for(int i=1;i<=n;i++)
	{
		printf("%lld\n",ans-f[i]-g[i]);
	}
}

Measured memory_bytes: 36448
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	int k,x;
	cin>>k>>x;
	if(500*k<x)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;

	return 0;
}


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

class Point {
public:
  int x, y;
  bool exist;
  Point(int x = -1, int y = -1, bool exist = false) : x(x), y(y), exist(exist) {}
};

int main() {
  int n;
  cin >> n;
  bool first = true;
  for(int i = 0; i < n; i++) {
    int data[9][9];
    for(int y = 0; y < 9; y++) {
      for(int x = 0; x < 9; x++) {
	cin >> data[y][x];
      }
    }

    char judge[9][9];
    fill(&judge[0][0], &judge[8][8]+1, ' ');

    Point number[10];
    for(int y = 0; y < 9; y++) {
      fill(&number[0], &number[9]+1, Point(-1,-1,false));
      for(int x = 0; x < 9; x++) {
	if(!number[data[y][x]].exist) {
	  number[data[y][x]].exist = true;
	  number[data[y][x]].x = x;
	  number[data[y][x]].y = y;
	} else {
	  judge[y][x] = '*';
	  judge[number[data[y][x]].y][number[data[y][x]].x] = '*';
	}
      }
    }

    for(int x = 0; x < 9; x++) {
      fill(&number[0], &number[9]+1, Point(-1,-1,false));
      for(int y = 0; y < 9; y++) {
	if(!number[data[y][x]].exist) {
	  number[data[y][x]].exist = true;
	  number[data[y][x]].x = x;
	  number[data[y][x]].y = y;
	} else {
	  judge[y][x] = '*';
	  judge[number[data[y][x]].y][number[data[y][x]].x] = '*';
	}
      }
    }

    for(int j = 0; j < 9; j++) {
      fill(&number[0], &number[9]+1, Point(-1,-1,false));
      for(int k = 0; k < 3; k++) {
	for(int l = 0; l < 3; l++) {
	  int x = (j%3)*3+l;
	  int y = (j/3)*3+k;
	  if(!number[data[y][x]].exist) {
	    number[data[y][x]].exist = true;
	    number[data[y][x]].x = x;
	    number[data[y][x]].y = y;
	  } else {
	    judge[y][x] = '*';
	    judge[number[data[y][x]].y][number[data[y][x]].x] = '*';
	  }
	}
      }
    }


    if(!first) {
      cout << endl;
    } else {
      first = false;
    }
    for(int y = 0; y < 9; y++) {
      for(int x = 0; x < 9; x++) {
	cout << judge[y][x] << data[y][x];
      }
      cout << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C - ID
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int MAX_M = 100000;

/* typedef */

typedef pair<int,int> pii;

/* global variables */

int cs[MAX_N], ps[MAX_M], xs[MAX_M];
pii rs[MAX_M];

/* subroutines */

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);

  for (int i = 0; i < m; i++) {
    int pi, yi;
    scanf("%d%d", &pi, &yi);
    pi--;
    ps[i] = pi;
    rs[i] = pii(yi, i);
  }
  sort(rs, rs + m);

  for (int i = 0; i < m; i++) {
    int &j = rs[i].second;
    int &pj = ps[j];
    xs[j] = cs[pj]++;
  }

  for (int i = 0; i < m; i++)
    printf("%06d%06d\n", ps[i] + 1, xs[i] + 1);
  return 0;
}


Measured memory_bytes: 3456
import collections
n=int(input())
s=list(map(int, input().split()))
L=[i+a for i,a in enumerate(s)]
R=[i-a for i,a in enumerate(s)] 
t=collections.Counter(L)
u=collections.Counter(R)
ans = 0
for i in t.keys():
  ans+=t[i]*u[i]
print(ans)


Measured memory_bytes: 63528
// AtCode.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>

using namespace std;

int get_num(char& input) {
	if (input == '0') return 0;
	if (input == '1') return 1;
	if (input == '2') return 2;
	if (input == '3') return 3;
	if (input == '4') return 4;
	if (input == '5') return 5;
	if (input == '6') return 6;
	if (input == '7') return 7;
	if (input == '8') return 8;
	if (input == '9') return 9;
	return 0;
}

int main()
{
	string input;
	cin >> input;
	int ans = 0;
	bool find = false;
	int i = 0;
	for (i = 0; i < (1 << 3); i++) { // 1000 未満(111)までループを回す
		ans = 0;
		 // 0=+, 1=-とみなす

		for (int j = 0; j < 3; j++) { // 生成された+,-の組み合わせの合計値を計算
			if (i & (1 << j)) { // i番目のビットが1なら
				ans -= get_num(input[3-j]); // 3-j 文字目を引く
			}
			else {
				ans += get_num(input[3-j]); // 3-j 文字目を引く
			}
		}
		ans += get_num(input[0]); // 一番上の数字を足す

		if (ans == 7) {
			find = true;
			break;
		}
	}

	cout << input[0];
	if (i & (1 << 2)) cout << "-";
	else cout << "+";
	cout << input[1];
	if (i & (1 << 1)) cout << "-";
	else cout << "+";
	cout << input[2];
	if (i & (1 << 0)) cout << "-";
	else cout << "+";
	cout << input[3] << "=7" << endl;

	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <set>
using namespace std;

int main(){
    int n;
    while(cin>>n && n){
        vector<int> ok[31];
        for(int i=1;i<=n;i++){
            int f;cin>>f;
            for(int j=0;j<f;j++){
                int t;cin>>t;
                ok[t].push_back(i);
            }
        }
        vector<set<int>> met(n+1);
        for(int i=1;i<=n;i++){
            met[i].insert(i);
        }

        int ans=-1;
        for(int i=1;i<=30;i++){
            vector<set<int>> nmet(n+1);
            for(int j=1;j<=n;j++){
                nmet[j] = met[j];
            }
            set<int> s;
            for(int j=0;j<ok[i].size();j++){
                for(int x:met[ok[i][j]]){
                    s.insert(x);
                }
            }
            for(int j=0;j<ok[i].size();j++){
                nmet[ok[i][j]] = s;
            }

            for(int j=0;j<ok[i].size();j++){
                if(nmet[ok[i][j]].size()==n){
                    ans = i;
                    break;
                }
            }
            if(ans!=-1)break;
            met = nmet;
        }
        cout << ans << endl;
    }
}

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

int n;

int main(){
	cin>>n;
	int a[n],b[n],c[n];
	
	for(int i=0;i<n;i++)
		cin>>a[i]>>b[i]>>c[i];
	
	int dpa[n],dpb[n],dpc[n];
	
	dpa[0]=a[0];
	dpb[0]=b[0];
	dpc[0]=c[0];

	for(int i=1;i<n;i++){
		dpa[i]=max(dpb[i-1]+a[i],dpc[i-1]+a[i]);
		dpb[i]=max(dpc[i-1]+b[i],dpa[i-1]+b[i]);
		dpc[i]=max(dpa[i-1]+c[i],dpb[i-1]+c[i]);
	}

	cout<<max(dpa[n-1],max(dpb[n-1],dpc[n-1]));
}


Measured memory_bytes: 2560
s=input()
K=int(input())
li=[]
for i in range(len(s)):
  m=min(K,len(s)-i)
  for j in range(m):
    li.append(s[i:i+j+1])
li.sort(reverse=True)
st=[]
while len(st)<K:
  t=li.pop()
  if t not in st:
    st.append(t)
print(st[-1])

Measured memory_bytes: 4340
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size())cout << a[i] << " ";cout << "\n"
#define vecvec(a) vector<vector<(a)>>
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll I,O,T,J,L,S,Z;
    cin >> I >> O >> T >> J >> L >> S >> Z;
    ll ans = O;
    if(I % 2 == 1 && J % 2 == 0 && L % 2 == 0){
        ans += I / 2 * 2;
        ans += L + J;
    }
    else if(I % 2 == 0 && J % 2 == 1 && L % 2 == 1 && I){
        I--;
        ans += I / 2 * 2;
        ans += 3;
        ans += L - 1 + J - 1;
    }
    else{
        ans += I / 2 * 2;
        if(I % 2 == 1 && J && L){
            ans += 3;
            J--;L--;
        }
        ans += J / 2 * 2;ans += L / 2 * 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include<cstdio>
using namespace std;
int main(){
    int H[99999], W[99999];
    int num;
    int i = 0;
    while(true){        
        scanf("%d %d", &H[i], &W[i]);
       // printf("input is %d %d", H[i], W[i]);
        if(H[i] == 0 && W[i] == 0){
            num = i;
            break;
        }        
        i++;
    }
    //printf("i is %d\n", i);
    for(int i=0;i<num;i++){

        for(int k=0;k<W[i];k++)
            printf("#");
        printf("\n");

        for(int j=1;j<H[i]-1;j++){
            printf("#");
            for(int k=1;k<W[i]-1;k++){
                printf(".");
            }
            printf("#\n");        
        }

        for(int k=0;k<W[i];k++)
            printf("#");
        printf("\n");

        printf("\n");            
    }
    //printf("\n");    
    return 0;
}


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

const int MOD = 1e9 + 7;
vector<vector<int>> memo(200, vector<int>(200));
map<string, int> mp;
int mpidx = 0;

bool ok(string last4) {
  for (int i = 0; i < 4; i++) {
    string t = last4;
    if (i >= 1) {
      swap(t.at(i-1), t.at(i));
    }
    if (t.find("AGC") != string::npos) {
      return false;
    }
  }
  return true;
}

int dfs(int cur, string last3, int N) {
  if (mp.count(last3) == 0) {
    mp[last3] = mpidx;
    mpidx++;
  }
  if (memo.at(cur).at(mp[last3]) != 0) {
    return memo.at(cur).at(mp[last3]);
  }
  if (cur == N) {
    return 1;
  }
  int cnt = 0;
  for (int i = 0; i < 4; i++) {
    string acgt = "ACGT";
    char c = acgt.at(i);
    if (ok(last3 + c)) {
      cnt += dfs(cur + 1, last3.substr(1,2) + c, N);
      cnt %= MOD;
    }
  }
  memo.at(cur).at(mp[last3]) = cnt;
  return cnt;
}

int main() {
  int N;
  cin >> N;
  cout << dfs(0, "___", N) << endl;;
}

Measured memory_bytes: 384
import scala.annotation._

object Main{
	def main(args:Array[String]){
		val s = new java.util.Scanner(System.in)
		var n,v=s.nextInt
		for(i<-2 to n map(_=>s.nextInt))
			v=gcd(v,i)
		println(v)
	}
	@tailrec
	def gcd(a:Int,b:Int):Int = if(a % b < 1) b else gcd(b,a % b)
}

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

using namespace std;

int main() {
    int h, w, pos = 0;
    string a;
    cin >> h >> w;
    for (int i = 0; i < h; ++i) {
        cin >> a;
        if (a.at(pos) == '.') {
            cout << "Impossible" << endl;
            return 0;
        }
        for (int i = 0; i < pos; ++i) if (a.at(i) == '#') {
            cout << "Impossible" << endl;
            return 0;
        }
        for (; pos < w; ++pos) if (a.at(pos) == '.') break;
        for (int i = pos; i < w; ++i) if (a.at(i) == '#') {
            cout << "Impossible" << endl;
            return 0;
        }
        --pos;
    }
    cout << "Possible" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		String[] s1 = s.split("");
		int ans = 0;
		

		if(s1[0].equals("R") && s1[1].equals("R") && s1[2].equals("R")) {
			ans = 3;
		}
		else if(s1[0].equals("R") && s1[1].equals("R")) {
			ans = 2;
		}
		else if(s1[1].equals("R") && s1[2].equals("R")) {
			ans = 2;
		}
		else if(s1[0].equals("R") || s1[1].equals("R") || s1[2].equals("R")) {
			ans = 1;
		}
		else {
			ans = 0;
		}
		
		System.out.print(ans);
	}

}


Measured memory_bytes: 35708
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <limits>
#include <iomanip>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '

const int MAXN = 200;
//ll a[MAXN], ST[MAXN * 4], LZ[MAXN*4];

/*bool perfectSquare(ll x){
    ll s = sqrt(x);
    if(s *s == x) return true;
    else return false;
}*/
typedef long double ld;

int main() { 
    ios_base::sync_with_stdio(0); cin.tie(0); 
    int n = 0, m = 0;
    cin >> n >> m;
    int number = 0;
    for(int i = 0; i < m; ++i){
        cin >> number;
        n-=number;
    }
    if(n < 0){cout << -1 << endl;}
    else{cout << n << endl;}
  
    return 0; 
} 


Measured memory_bytes: 3184
#include<stdio.h>

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N],column[N];
int dpos[2*N-1],dneg[2*N-1];
int x[N][N];

void initialize();
void printboard();
void recursive(int);


int main(){
  int i,j,a,b,c;
  
  initialize();

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      x[i][j]=-1;
    }
  }

  scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d %d",&b,&c);
    x[b][c]=1;
  }

  recursive(0);

  return 0;
}

void initialize(){
  int i;

  for(i=0;i<N;i++){
    row[i]=FREE;
    column[i]=FREE;
  }

  for(i=0;i<2*N-1;i++){
    dpos[i]=FREE;
    dneg[i]=FREE;
  }
}

void printboard(){
  int i,j;

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(x[i][j]==1){
	if(row[i]!=j) return;
      }
    }
  }

  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(row[i]==j) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

void recursive(int i){
  int j;

  if(i==N){
    printboard();
    return;
  }

  for(j = 0 ; j < N ;j++){
    if(column[j]==NOT_FREE || dpos[i+j]==NOT_FREE || dneg[i-j+N-1]==NOT_FREE){
      continue;
    }

    row[i]=j;
    column[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;

    recursive(i+1);

    row[i]=column[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
  }
}



Measured memory_bytes: 2084
#include<iostream>
#include<cstdio>
using namespace std;
int n,m,i,j,k;
long long a,b,c,d;
long long gcd(long long x,long long y){
	if (y==0) return x; else return gcd(y,x%y);
}
long long p(long long x,long long y,long long z){
	if (z<x){x=x-(x-z)/y*y-y;if (x==z) x-=y;return x;
	}x=x+(z-x)/y*y;if (x==z) x-=y;return x;
}
bool f(long long a,long long b,long long c,long long d){
	if (b>d) return false;if (a<b) return false;
	long long x=p(a,gcd(b,d),b);if (x<b&&x>c) return false; else return true;
}
int main(){
	scanf("%d",&n);for (i=1;i<=n;i++){
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);if (f(a,b,c,d)) printf("Yes\n"); else printf("No\n");
	}return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	
	public static void main(String[] args) {
		Task task = new Task();
		task.solve();
	}

	public static class Task {
		static final long MOD = (long) 1e9 + 7;

		public void solve() {
			Scan sc = new Scan();
			int mx = 100007;
			int[] primes = new int[mx];
			int[] pre = new int[mx];
			primes[0] = 1;
			primes[1] = 1;
			for(int i = 2; i < mx; ++i){
				if(primes[i] == 0){
					for(int j = 2*i; j < mx; j+=i){
						primes[j] = 1;
					}
				}
			}
			for(int i = 2; i < mx; ++i){
				if(i <= mx && primes[i] == 0 && primes[(i+1)/2] == 0)
					++pre[i];
				pre[i] += pre[i-1];
			}
			int q = (int) sc.scanLong();
			StringBuilder sb = new StringBuilder();
			while(q-- > 0){
				int l = (int) sc.scanLong();
				int r = (int) sc.scanLong();
				sb.append(pre[r] - pre[l-1]).append('\n');
			}
			System.out.println(sb);
		}
	}

	public static class Scan {
		private byte[] buf = new byte[1024];
		private int index;
		private InputStream in;
		private int total;

		public Scan() {
			in = System.in;
		}

		public int scan() {
			if (total < 0)
				throw new InputMismatchException();
			if (index >= total) {
				index = 0;
				try {
					total = in.read(buf);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				if (total <= 0)
					return -1;
			}
			return buf[index++];
		}

		public long scanLong() {
			long integer = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n)) {
				if (n >= '0' && n <= '9') {
					integer *= 10;
					integer += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			return neg * integer;
		}

		public double scanDouble() throws IOException {
			double doub = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n) && n != '.') {
				if (n >= '0' && n <= '9') {
					doub *= 10;
					doub += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			if (n == '.') {
				n = scan();
				double temp = 1;
				while (!isWhiteSpace(n)) {
					if (n >= '0' && n <= '9') {
						temp /= 10;
						doub += (n - '0') * temp;
						n = scan();
					} else
						throw new InputMismatchException();
				}
			}
			return doub * neg;
		}

		public String scanString() {
			StringBuilder sb = new StringBuilder();
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			while (!isWhiteSpace(n)) {
				sb.append((char) n);
				n = scan();
			}
			return sb.toString();
		}

		public char scanChar() {
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			return (char) n;
		}

		private boolean isWhiteSpace(int n) {
			if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
				return true;
			return false;
		}
	}
}


Measured memory_bytes: 37972
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()

#define fp(a,i,c)   for ( int (a)=(i); (a)<(c); (a)++)
#define fm(a,b,c)  for (  int (a)=(b); (a)>=(c); (a)--)

int main()
{
	string s;
	cin >> s;
	fp(i,0,3)
	{
		cout << s[i];
	}
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  cin >> A.at(0);
  ll ans = 0;
  rep(i,N-1){
    cin >> A.at(i+1);
    if(A.at(i+1) < A.at(i)){
      ans += A.at(i) - A.at(i+1);
      A.at(i+1) = A.at(i);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4784
#include <stdio.h>

int main() {
  int a, b;
  scanf("%d %d", &a, &b);

  if (a%3==0 || b%3==0 || (a+b)%3==0) {
    printf("Possible\n");
  } else {
    printf("Impossible\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  vector<int> b(n);
  rep(i, n) cin >> b.at(i);
  vector<int> pl;
  int ans = 0;
  ll mi = 0;
  rep(i, n){
    if(a.at(i) > b.at(i)) pl.push_back(a.at(i)-b.at(i));
    else{
      mi += b.at(i)-a.at(i);
      if(b.at(i)-a.at(i) != 0) ans++;
    }
  }
  sort(ALL(pl), greater<int>());

  rep(i, pl.size()){
    if(mi <= 0) break;
    ans++;
    mi -= pl.at(i);
  }
  if(mi <= 0) cout << ans << endl;
  else cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 4456
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N=one_int()
X=many_int()

sort_X=sorted(X)
min_X = sort_X[0]
max_X = sort_X[-1]

min_num = 0
min_sum = 99999999999
for i in range(min_X, max_X+1):
    temp_sum = 0
    for j in X:
        temp_sum += (j-i)**2
    
    if temp_sum < min_sum:
        min_sum = temp_sum
        min_num = i

print(min_sum)

Measured memory_bytes: 38512