akhauriyash/Code-Regression huggingface dataset:
module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

main :: IO ()
main = do
  s <- getLine
  putStrLn $ map (\x -> if x /= ',' then x else ' ') s

------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFmt :: Double -> String
doubleFmt = Text.Printf.printf "%.12f"



Measured memory_bytes: 508
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef long long ll;
struct P {
	ll time, pos;
};
struct T {
	ll time, can;
};
struct B {
	ll time, to;
};
ll a[100000];
T b[100000];
vector<B>e[100000];
const ll inf = 800000000000000;
int main() {
	map<int, int>a;
	a.insert(map<int, int>::value_type(2, 0));
	a.insert(map<int, int>::value_type(3, 1));
	a.insert(map<int, int>::value_type(4, 2));
	a.insert(map<int, int>::value_type(5, 3));
	a.insert(map<int, int>::value_type(6, 4));
	a.insert(map<int, int>::value_type(7, 5));
	a.insert(map<int, int>::value_type(8, 6));
	a.insert(map<int, int>::value_type(9, 7));
	a.insert(map<int, int>::value_type(10, 8));
	a.insert(map<int, int>::value_type(11, 9));
	a.insert(map<int, int>::value_type(12, 10));
	a.insert(map<int, int>::value_type(13, 11));
	a.insert(map<int, int>::value_type(1, 12));
	int c, d;
	cin >> c >> d;
	c = a[c];
	d = a[d];
	if (c > d) cout << "Alice" << endl;
	else if (c < d) cout << "Bob" << endl;
	else cout << "Draw" << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define debug(...) \
    { cerr << "# " << __VA_ARGS__ << "\n"; }
#else
#define debug(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
   public:
    i64 lcm(i64 a, i64 b) {
        return a * b / __gcd(a, b);
    }
    void solve() {
        i64 n, m;
        cin >> n >> m;
        vector<i64> a(n);
        for (int i = 0; i < n; ++i) cin >> a[i];
        i64 b = 1;
        for (int i = 0; i < n; ++i) {
            b = lcm(b, a[i] / 2);
            if (b > m) {
                cout << 0;
                return;
            }
        }
        for (int i = 0; i < n; ++i) {
            if ((b / (a[i] / 2)) % 2 == 0) {
                cout << 0;
                return;
            }
        }
        cout << 1 + (m - b) / 2 / b << '\n';
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
	int64_t n;
	cin >> n;
	vector<int64_t> a(n);
	for (int i = 0; i < n; i++)cin >> a.at(i);
	vector<int64_t> b = a;
	sort(b.begin(), b.end());
	reverse(b.begin(), b.end());
	int64_t max = b.at(0);
	int64_t max_2 = b.at(1);
	for (int i = 0; i < n; i++) {
		if (a.at(i) == max) cout << max_2 << endl;
		else cout << max << endl;
	}
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <iomanip>
#include <math.h>
#include <time.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define all(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 1147483600;
const ll infl = 1e18 + 5;
const char ENDL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    vll a(n);
    ll s = 0;
    ll AL = 1;
    rep(i, n){
        AL *= 3;
        AL %= MOD;
        cin >> a[i];
        s += a[i];
    }
    vll dp(s + 1, 0);
    dp[0] = 1;
    rep(i,n){
        repr(j,s,-1){
            if (j+a[i]<=s)
                dp[j + a[i]] = (dp[j + a[i]] + dp[j]) % MOD;
            dp[j] = (dp[j] * 2) % MOD;
        }
    }
    vll dp2(s + 1, 0);
    dp2[0] = 1;
    rep(i,n){
        repr(j,s,-1){
            if (j+a[i]<=s)
                dp2[j + a[i]] = (dp2[j + a[i]] + dp2[j]) % MOD;
        }
    }
    repf(i,(s+1)/2,s+1){
        AL = (AL + MOD - ((dp[i] * 3) % MOD)) % MOD;
    }
    if (s%2==0){
        AL += dp2[s / 2] * 3 % MOD;
        AL %= MOD;
    }
    cout << AL << ENDL;
}

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

using namespace std;

int main() {
  int N;
  long long K;
  cin >> N >> K;
  int A[N + 1];
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }

  bool used[N + 1];
  for (int i = 1; i <= N; i++) {
    used[i] = false;
  }
  vector<int> sol;
  int pos[N + 1];
  int now_town = 1;

  while (K) {
    if (used[now_town]) {
      int pos_town = pos[now_town];
      cout << sol[pos_town + K % (long long)(sol.size() - pos_town + 1) - 1] << '\n';
      return 0;
    }

    used[now_town] = true;
    sol.push_back(now_town);
    pos[now_town] = sol.size();

    now_town = A[now_town];
    K--;
  }

  cout << now_town << '\n';

  return 0;
}

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

int main(){

	string s;
	cin>>s;
	int n = s.size();
	int end1 = (n-1)/2;
	int start2 = (n+3)/2; 
	string check1 = s.substr(0,end1);
	string check2 = s.substr(start2-1,n-start2+1);
	
	int i=0,j=n-1;
	while(i<j){
		if(s[i]!=s[j]){
			cout<<"No";
			return 0;
		}
		i++;
		j--;
	}
	i=0;
	j = check1.size()-1;
	while(i<j){
		if(check1[i]!=check1[j]){
			cout<<"No";
			return 0;
		}
		i++;
		j--;
	}
	i=0;
	j=check2.size()-1;
	while(i<j){
		if(check2[i]!=check2[j]){
			cout<<"No";
			return 0;
		}
		i++;
		j--;
	}
	cout<<"Yes";
}

Measured memory_bytes: 384
// 問題の URL を書いておく
// 

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

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

using ll = int64_t;

int main(int, const char**)
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    rep(i, (int)s.size())
    {
        auto c = s[i];
        c = (c - 'A' + n) % 26 + 'A';
        s[i] = c;
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3620
// Problem : E - This Message Will Self-Destruct in 5s
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

    
/*
CODED BY               
**************
DARSHAN JAIN
darshanjain31
**************
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define MOD 1000000007

#define MAX 100005
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll ans=0;
    map<ll,ll> mp; 
    for(int i=1;i<=n;i++){
        ll a;
         cin>>a;
        ll val=i-a;
        if(mp.count(val)) 
        ans+=mp[i-a];
        mp[i+a]++;
    }
    ll b=10;
    if(b==10)
    cout<<ans<<endl;
    else
    cout<<ans<<endl;
}




Measured memory_bytes: 16116
#include <iostream>

using namespace std;

int main() {

    int N;
    cin >> N;
    unsigned long long Li[100] = { 2,1 };
    for (int i = 0; i < N - 1; i++) {
        Li[i + 2] = Li[i + 1] + Li[i];
    }
    cout << Li[N] << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<double> a(n);
  rep(i,n) cin >> a[i];
  double ans=0;
  rep(i,n)
    ans +=1/a[i];

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


Measured memory_bytes: 256
/*
 * author: Tran Minh Khoa
 * Ho Chi Minh University of Science
 */

#include <bits/stdc++.h>

using namespace std;

const int inf = (int) 1e9 + 7;
const long long INF = (long long) 1e18 + 7;

const int N = 123456;
const int M = 1010;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) (int) a.size()
#define all(a) a.begin(), a.end()
#define sqrt(x) (x) * (x)

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define DEBUG(x) cerr << #x << " = " << x << '\n';
#define PR(x, a, b) { cerr << #x << " = "; REP(i, a, b) cerr << x[i] << ' '; cerr << '\n'; }
                 
int main() {
  #ifdef KM777
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
  #endif
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr); cout.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n + 1), b(n + 1), c(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }      
  vector<vector<int>> dp(n + 1, vector<int>(3));
  for (int i = 1; i <= n; i++) {
    dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
    dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i];
    dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c[i];
  }
  int result = 0;
  for(int i = 0; i < 3; i++) {
    result = max(result, dp[n][i]);
  }
  cout << result << '\n';
  return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}


int main()
{
	int n,m;
	cin>>n>>m;
	vector<vector<int>> g(n);
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	queue<int> que;
	vector<int> ans(n,-1);
	que.push(0);
	ans[0]=0;
	while(!que.empty()){
		int cur = que.front();que.pop();
		for(auto next: g[cur]){
			if(ans[next]>=0)continue;
			ans[next]=cur;
			que.push(next);
		}
	}
	cout<<"Yes"<<endl;
	repi(i,1,n)cout<<ans[i]+1<<endl;

	return 0;
}

Measured memory_bytes: 10220
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <limits>
#include <iterator>
#include <cmath>
#include <numeric>
using namespace std;

int main()
{
	long long n, m;
	long long ans = 0;
	cin >> n >> m;
	
	multimap<long, long> a;

	for (int i = 0;i < n;i++)
	{
		long long temp1, temp2;
		cin >> temp1 >> temp2;
		a.insert(make_pair(temp1, temp2));
	}

	for (auto itr = a.begin();itr != a.end();++itr)
	{
		if (itr->second < m)
		{
			ans += itr->first * itr->second;
			m -= itr->second;
		}
		else
		{
			ans += itr->first * m;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6528
#　入力
n,m,k = map(int,input().split())

A = list(map(int,input().split()))
B = list(map(int,input().split()))

# A,Bの累積和を取る
sumA = [0]*(n+1)
sumB = [0]*(m+1)
for i in range(n):
    sumA[i+1] = sumA[i] + A[i]
for i in range(m):
    sumB[i+1] = sumB[i] + B[i]

ans = 0
# しゃくとり法
j = m
for i,a in enumerate(sumA):
    while j >= 0 and a + sumB[j] > k:
        j -= 1
    if j < 0:break
    ans = max(ans,i+j)
print(ans)


Measured memory_bytes: 47296
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<lli> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

lli n, w;
lli W[102], V[102];
lli cache[102][N];

lli dp(lli idx, lli weight) {

    if(weight < 0) {
        return -mod;
    }

    if(idx > n + 1) {
        return 0;
    }

    lli &ans = cache[idx][weight];

    if(ans != -1) {
        return ans ;
    }

    ans = max(V[idx] + dp(idx + 1, weight - W[idx]), dp(idx + 1, weight));

    return ans ;

}

void solve()
{

    cin>>n>>w;

    memset(cache, -1, sizeof cache);

    for(int i = 1; i <= n; i ++) {
        cin>>W[i]>>V[i];
    }

    lli ans = dp(1, w);

    cout<<ans;

    cout<<"\n";
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 239744
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
using namespace std;

const long long INF = 100100100100100100;
const int MOD = 1000000007;
const int inf = 1001001001;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

bool ok(long long key,vector<long long> &cost,vector<long long> &food,long long border){
    //全員がkey以下の時間で食べるために必要な修行の回数がborderを越えるか
    long long syugyou = 0;
    for(int i = 0;i<cost.size();i++){
        long long miniCost = key/food.at(i);
        syugyou += max(cost.at(i)-miniCost,(long long)0);
    }
    if(syugyou > border) return true;
    else return false;
}

const long long MAX = 100000000000000;

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

    int N;long long K;cin >> N >> K;
    vector<long long> cost(N),food(N);
    for(int i = 0;i<N;i++){
        cin >> cost.at(i);
    }
    for(int i = 0;i<N;i++){
        cin >> food.at(i);
    }
    //costが高い人に食べにくさが低い食べ物を与えるのが良い
    sort(cost.begin(),cost.end(),greater<long long>());
    sort(food.begin(),food.end());

    long long ans;
    long long left = -1,right = MAX;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        if(ok(mid,cost,food,K)){
            left = mid;
        }
        else{
            right = mid;
        }
    }
    cout << right << endl;

}

Measured memory_bytes: 6340
#include<bits/stdc++.h>
using namespace std;
int n,l,r,a[200005];
int pd(int x,int k){
	if ((a[x]>=k)&&(a[x+1]>=k))return 1;
	if ((a[x]<k)&&(a[x+1]<k))return -1;
	return 0;
}
bool check(int k){
	for(int i=0;i<n;i++){
		if (pd(n-i-1,k))return (pd(n-i-1,k)+1)/2;
		if (pd(n+i,k))return (pd(n+i,k)+1)/2;
	}
	return a[1]>=k;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<2*n;i++)scanf("%d",&a[i]);
	l=1,r=2*n-1;
	while (l<r){
		int mid=(l+r+1>>1);
		if (check(mid))l=mid;
		else r=mid-1;
	}
	printf("%d",l);
}

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
int N;
bool inrange(int i) { return 0 <= i&&i < N; }

signed main() {
	for (; cin >> N&&N;) {
		vector<int> v(N); rep(i, 0, N) { cin >> v[i]; }
		int ans = INF;
		rep(i, 0, N)rep(j, 1, 4) {
			int tmp = N;
			int l = i - 1, r = i + 1;
			int color = j;
			int cnt = 1;
			while (true) {
				while (true) {
					if (!inrange(l))break;
					if (v[l] != color)break;
					l--, cnt++;
				}
				while (true) {
					if (!inrange(r))break;
					if (v[r] != color)break;
					r++, cnt++;
				}
				if (cnt >= 4) {
					tmp -= cnt;
					cnt = 0;
					if (inrange(l))color = v[l];
					else if (inrange(r))color = v[r];
					else break;
				}
				else break;
			}
			chmin(ans, tmp);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3084
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

int main()
{
	char str[128]={0};
	int i, j, r;
	
	while(scanf("%s", str) != EOF){
		i=0;
		while(1){
			if(str[i] == 0)
				break;
			if(str[i] != '@'){
				printf("%c", str[i]);
				i++;
			} else {
				r = str[i+1] - '0';
				for(j=0; j<r; j++)
					printf("%c", str[i+2]);
				i += 3;
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 524
using System;

namespace AizuOnLine
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] data = Console.ReadLine().Split(' ');
            var num1 = Convert.ToInt32(data[0]);
            var num2 = Convert.ToInt32(data[1]);
            var floatAns = string.Format("{0:f8}", (double)num1 / (double)num2);

            string ans = string.Format("{0} {1} {2}", num1 / num2, num1 % num2, floatAns);
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 9276
#include <bits/stdc++.h>
using namespace std;
int main(){
  while (1){
    int n;
    cin >> n;
    if (n == 0){
      break;
    }
    vector<int> a(n);
    for (int i = 0; i < n; i++){
      cin >> a[i];
    }
    long long sum = 0;
    for (int i = 0; i < n; i++){
      sum += a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++){
      if ((long long) a[i] * n <= sum){
        ans++;
      }
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 3120
import itertools
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
count=0
a=0
b=0

for i in itertools.permutations(range(1,n+1)):
  count+=1
  if i == p:
    a=count
  if i==q:
    b=count
print(abs((count-a)-(count-b)))





Measured memory_bytes: 72916
using System;
using System.Collections.Generic;
using System.Linq;

namespace MyProgram{
    class AtCoder{
        static void Main(){
            long[] input = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
            long N = input[0];
            long M = input[1];
            var a = new List<long>((int)M);
            for(var i=0;i<M;i++){
                a.Add(long.Parse(Console.ReadLine()));
            }
            var dp = new long[N+1];
            dp[0] = 1;
            for(var i=1;i<=N;i++){
                if(a.BinarySearch(i-1)<0)dp[i] += dp[i-1];
                if(a.BinarySearch(i-2)<0&&i>=2)dp[i] += dp[i-2];
                dp[i] %= 1000000007;
            }
            Console.WriteLine(dp[N]);
        }
    } 
}


Measured memory_bytes: 14432
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()
const int INF = 1e9;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef long long ll;
//typedef pair<int, int> P;

/* struct P {
	int x, y, n;
	P(int n, int x, int y):n(n), x(x), y(y){}
	P(){}
}; */


/** 幾何ライブラリ **/
// to do : 1183

#include <complex>

#define X real()
#define Y imag()

const double EPS = 1e-11;

typedef double D;
typedef complex<D> P; // Point

// 共役複素数 conj(a);

// 符号
int sig(D a, D b=0) { return a < b - EPS ? -1 : (a > b + EPS ? 1 : 0); }

// 内積
D dot_product(P a, P b) { return (conj(a)*b).real(); }

// 外積
D cross_product(P a, P b) { return (conj(a)*b).imag(); }

/** Problem0021 : Parallelism **/
int main()
{
	int N; cin>>N;
	rep(i, N) {
		P a, b;
		D x1, y1, x2, y2;
		cin>>x1>>y1>>x2>>y2;
		a.X = (x2 - x1);
		a.Y = (y2 - y1);
		
		cin>>x1>>y1>>x2>>y2;
		b.X = (x2 - x1);
		b.Y = (y2 - y1);
		
		if (abs(cross_product(a, b))<EPS) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
}

Measured memory_bytes: 1228
#import<iostream>
#import<map>
#import<queue>
#import<cstdlib>
#import<cstring>
using namespace std;struct B{int z[2];char s[14];bool operator<(const B&r)const{return strcmp(s,r.s)<0;}};main(){int a[13][5]={{2,-1},{2,5,-1},{0,1,3,6,-1},{2,7,-1},{5,-1},{1,4,6,9,-1},{2,5,7,10,-1},{3,6,8,11,-1},{7,-1},{5,10,-1},{6,9,11,12,-1},{7,10,-1},{10,-1},},gx[]={2,1,2,3,0,1,2,3,4,1,2,3,2},gy[]={0,1,1,1,2,2,2,2,2,3,3,3,4},v,d,s,i,j,t,u;B g={0,0,"0123456789:;0"};for(;;){map<B,int>m;queue<B>q;B b={-1,-1};for(i=0;i<13;i++){cin>>v;if(v<0)return 0;b.s[i]=48+v;if(!v)b.z[b.z[0]!=-1]=i;}b.s[13]=0;m[b]=1;for(q.push(b);!q.empty();q.pop()){B&b=q.front();if(!strcmp(b.s,g.s))break;d=0;for(i=13;i--;){v=b.s[i]-48;if(v)d+=abs(gx[v]-gx[i])+abs(gy[v]-gy[i]);}s=m[b];if(s+d<22)for(j=2;j--;)for(i=0;~a[u=b.z[j]][i];i++){B n=b;t=n.z[j]=a[u][i];if(t-n.z[1-j]){swap(n.s[u],n.s[t]);int&r=m[n];if(!r)r=s+1,q.push(n);}}}printf(m[g]?"%d\n":"NA\n",m[g]-1);}}

Measured memory_bytes: 1484
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
#define LL long long
#define MX 200500

LL dp[MX];
LL num[26];
char s[MX];

int main()
{
	scanf("%s",s+1);
	int len = strlen(s+1);
	dp[0]=1;
	for (int i=1;i<=len;i++)
    {
        dp[i]=dp[i-1];
        for (int j=0;j<26;j++)
        {
            if (s[i]=='a'+j) continue;
            dp[i] += num[j];
        }
        num[ s[i]-'a' ]++;
    }
    printf("%lld\n",dp[len]);
	return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include<algorithm>
#include <stdio.h>
#include <string>
#include <string.h>
#include <map>
#include <math.h>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <deque>
//#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
const int N=1e5+7;

int main()
{
    int f=0;
    char ch[10];
    cin>>ch;
    for(int i=1;i<4;i++)
    {
        if(ch[i]==ch[i-1])
        {
            f=1;
            break;
        }
    }
    if(f==1)
        cout<<"Bad"<<endl;
    else
        cout<<"Good"<<endl;
    return 0;
}

Measured memory_bytes: 256
import itertools
import math

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# M, D = map(int, input().split())
# A = list(map(int, input().split()))
# S = input()
X = []
Y = []
for i in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)

tot = 0

_ = []
for i in range(N):
    _.append(i)
l = list(itertools.permutations(_))

def distance(x1, y1, x2, y2):
    return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

for l_1d in l:
    for i in range(N - 1):
        tot += distance(x1 = X[l_1d[i + 1]], y1 = Y[l_1d[i + 1]], x2 = X[l_1d[i]], y2 = Y[l_1d[i]])

print(tot / len(l))

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

#define rep(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a);i>(b);i--)
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  int n; cin >> n;
  
  vi a(n);
  rep(i,n){
    cin >> a[i];
    a[i]--;
  }

  int next = 0;
  rep(i,n){
    next = a[next];
    if(next==1){
      cout << i+1 << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


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

using namespace std;

#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define sort_unique(x) sort(ALL(x)); x.resize(distance(x.begin(), unique(ALL(x))))
#define MP make_pair
#define PB push_back
#define X first
#define Y second

typedef long long int lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(15);
    cout << fixed;

	int a, b;
	cin >> a >> b;

	for (int i = 0; i < max(a, b); i++) {
		cout << min(a, b);
	}
	cout << '\n';
    
    return 0;
}

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

int main(){
  int n, x;

  cin>>n;
  for(int i=1;i<=n;i++){
    x=i;
    if(x%3==0) cout<<" "<<i;
    else{
      while(x){
	if(x%10==3){
	  cout<<" "<<i;
	  break;
	}
	x/=10;
      }
    }
  }
  cout<<endl;
  
  return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
int main(){
  int n;
  cin>>n;
  vector<bool> a (1001001000,false);
  rep(i,n){
    int x;cin>>x;
    if(a[x]){
      cout<<"NO"<<endl;
      return 0;
    }
    a[x]=true;
  }
  cout<<"YES"<<endl;
}

Measured memory_bytes: 122496
#include<bits/stdc++.h>
#define pii pair<int,int>
#define ff first
#define ss second
#define ll long long int
#define vi vector<int>
#define vvll vector<ll>
#define vll(a) vector<ll> a(MAXN)
#define pb push_back
#define fo(a) for(auto&a1:(a))
#define fd(a,b) for(int i=(a);i>=(b);i--)
#define fk(a,b) for(int k=(a);k<(b);k++)
#define fj(a,b) for(int j=(a);j<(b);j++)
#define f(a,b) for(ll i=(a);i<(b);i++)
#define forni(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define fdk(a,b) for(int k=(a);k>=(b);k--)
#define fe(a,b,c) for(int a=b;a<c;a++)
#define fdj(a,b) for(int j=(a);j>=(b);j--)
#define ri(n) scanf("%d",&(n));
#define rll(n) scanf("%lld",&(n));
#define T(t) int t;scanf("%d",&(t));while((t)--)
#define MAXN2 10000005
#define pll pair<ll,ll>
#define PI 3.14159265
#define mset(a) memset((a),0,sizeof((a)))
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sortv(a) sort(a.begin(),a.end())
#define v2d vector<vvll>
#define v3d vector<v2d>
#define max_value(a,b) a=max(a,b)
#define min_value(a,b) a=min(a,b)
using namespace std;
const ll MAXN=1005;
const ll mod=1e9+7;
ll h,w;
ll c1,c2,d1,d2;
ll ans[MAXN][MAXN];
bool vis[MAXN][MAXN];
bool nxin[MAXN][MAXN];
bool grid[MAXN][MAXN];
queue<pll> bfs;
void mark_cal(ll i,ll j,ll vl)
{
	if(i<0 || i>=h || j<0 || j>=w || vis[i][j] || !grid[i][j])
	return;
	vis[i][j]=1;
	ans[i][j]=vl;
	mark_cal(i+1,j,vl);mark_cal(i-1,j,vl);mark_cal(i,j+1,vl);mark_cal(i,j-1,vl);
	fe(k,max((ll)0,i-2),min(h,i+3))
	fe(l,max((ll)0,j-2),min(w,j+3))
	{
		if(!nxin[k][l] && grid[k][l] && !vis[k][l])
		{
			nxin[k][l]=1;
			bfs.push({k,l});
			ans[k][l]=vl+1;
		}
	}
}
int main()
{
	cin>>h>>w>>c1>>c2>>d1>>d2;
	c1--;c2--;d1--;d2--;
	char ch;
	f(0,h)
	fj(0,w)
	{
		cin>>ch;
		grid[i][j]=(ch=='.');
	}
	f(0,h)
	fj(0,w)
	ans[i][j]=-1;
	bfs.push({c1,c2});
	ans[c1][c2]=0;
	while (!bfs.empty())
	{
		pll curr=bfs.front();
		bfs.pop();
		mark_cal(curr.ff,curr.ss,ans[curr.ff][curr.ss]);
	}
	cout<<ans[d1][d2]<<"\n";
    return 0;
}


Measured memory_bytes: 14488
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sca = new Scanner(System.in);
		long x = sca.nextLong();
		long money = 100;
		int year = 1;
		boolean flag = false;

		do {
			money = money + (money/100);
			if(money >= x) {
				System.out.println(year);
				flag = true;
			}
			year++;
		} while(!flag);

		// 後始末
		sca.close();
	}
}

Measured memory_bytes: 35760
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, a=0, b=0, c=0; cin>>n;
	int arr[n]; bool ans;
	for(int i=0; i<n; i++) {
		cin>>arr[i];
		if(arr[i]%4==0) c++;
		else if(arr[i]%2==0) b++;
		else a++;
	}
	if(a==0 || b!=0 && a<=c || b==0 && a<=c+1) ans=true;
	else ans = false;
	if(ans==true) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


Measured memory_bytes: 892
#include <cstdio>
#include <utility>

using namespace std;

//???????????????????????¢??° write ?????????

void write( int A[], int N ){

    for( int i = 0 ; i < N ; i++ ){

        if( i > 0 ){

            printf(" ");
            
        }

        printf("%d", A[i] );

    }

    printf("\n");

}

//?????????????????? insertion_sort ??????????????????

void selection_sort( int A[], int N ){

    int i, j, minj, count;

    count = 0;

    for( i = 0 ; i < N ; i++ ){

        minj = i;

        for( j = i ; j < N ; j++ ){
        
            if( A[j] < A[minj] ){

                minj = j;

            }

        }
 
        if( i != minj ){

            count++;

        } 

        swap( A[i], A[minj] );

    }    

    write( A, N );
    printf("%d\n", count);

}

//??¬???

int main(){

    int i, n, count;

    scanf("%d", &n);
 
    int A[n];
 
    for( i = 0 ; i < n ; i++ ){
 
        scanf( "%d", &A[i] );
 
    }

    selection_sort( A, n );

    return 0;

}

Measured memory_bytes: 2628
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007



int main() {
	int x;
	cin >> x; if (x == 7 || x == 5 || x == 3)print("YES"); else print("NO");




	return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
X=list(map(int,input().split()))
X.sort()
if N>=M:
  ans=0
else:
  D=X[M-1]-X[0]
  xm=[]
  for i in range(M-1):
    xm.append(X[i+1]-X[i])
  xm.sort()
  ans=sum(xm[:M-N])
print(ans)

Measured memory_bytes: 13968
import itertools
k = int(input())
def a(b):
    list_ = []
    for i in b:
        ii = str(i)
        z = int(ii[-1])
        if z==0:
            list_.append(int(ii+'0'))
            list_.append(int(ii+'1'))
        elif z==9:
            list_.append(int(ii+'8'))
            list_.append(int(ii+'9'))
        else:
            list_.append(int(ii+str(z-1)))
            list_.append(int(ii+str(z)))
            list_.append(int(ii+str(z+1)))
    return list_

l1 = [[1]]

for _ in range(9):
    l1.append(a(l1[-1]))

c1 = list(itertools.chain.from_iterable(l1))
l2 = [[2]]

for _ in range(9):
    l2.append(a(l2[-1]))
c2 = list(itertools.chain.from_iterable(l2))
l3 = [[3]]

for _ in range(9):
    l3.append(a(l3[-1]))
c3 = list(itertools.chain.from_iterable(l3))

l4 = [[4]]
for _ in range(9):
    l4.append(a(l4[-1]))
c4 = list(itertools.chain.from_iterable(l4))
l5 = [[5]]

for _ in range(9):
    l5.append(a(l5[-1]))
c5 = list(itertools.chain.from_iterable(l5))

l6 = [[6]]

for _ in range(9):
    l6.append(a(l6[-1]))
c6 = list(itertools.chain.from_iterable(l6))
l7 = [[7]]

for _ in range(9):
    l7.append(a(l7[-1]))
c7 = list(itertools.chain.from_iterable(l7))
l8 = [[8]]

for _ in range(9):
    l8.append(a(l8[-1]))
c8 = list(itertools.chain.from_iterable(l8))

l9 = [[9]]

for _ in range(9):
    l9.append(a(l9[-1]))
c9 = list(itertools.chain.from_iterable(l9))

cc = c1+c2+c3+c4+c5+c6+c7+c8+c9


cc.sort()

print(cc[k-1])



Measured memory_bytes: 15604
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define MAXN 15
#define INF 1000000000
int K[MAXN][MAXN];
int n;

int main(void) {
    while (1) {
        cin >> n;
        int num = 0;
        if (n == 0) break;
        for (int i = 0; i < MAXN; i++)
            for (int j = 0; j < MAXN; j++)
                K[i][j] = INF;
        for (int i = 0; i < MAXN; i++) K[i][i] = 0;
        for (int i = 0; i < n; i++) {
            int a, b, c;
            cin >> a >> b >> c;
            num = max(num, max(a, b));
            K[a][b] = K[b][a] = c;
        }
        for (int k = 0; k <= num; k++) {
            for (int i = 0; i <= num; i++) {
                for (int j = 0; j <= num; j++) {
                    if (K[i][j] > K[i][k] + K[k][j]) {
                        K[i][j] = K[i][k] + K[k][j];
                    }
                }
            }
        }
//        for (int i = 0; i <= num; i++) {
//            for (int j = 0; j <= num; j++) {
//                cout << K[i][j] << " ";
//            }
//            cout << endl;
//        }
        int ans = INF, index = 0; 
        for (int i = 0; i <= num; i++) {
            int all = 0;
            for (int j = 0; j <= num; j++) {
                all += K[i][j];
            }
            if (all < ans) {
                index = i;
                ans = all;
            }
        }
        cout << index << " " << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  string T;
  cin >> T;
  rep(i,T.size()) {
    if(T[i]=='?') T[i]='D';
  }
  
  cout << T << endl;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 
#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

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

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define mod 1000000007
#define maxn 100009
#define maxr 100009
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	ll a,b;
	rl2(a,b);
	cout<<max(max(a-b,a*b),a+b)<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val s = sc.nextLine()
    println(s[0] + 1)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 29344
#include <stdio.h>

int main() {

    int k;

    scanf("%d", &k);

    

    if(k==1)

        printf("ACL");

    else if(k==2)

        printf("ACLACL");

    else if(k==3)

        printf("ACLACLACL");

    else if(k==4)

        printf("ACLACLACLACL");

    else

        printf("ACLACLACLACLACL");

        

    return 0;

}

Measured memory_bytes: 1724
#include<bits/stdc++.h>
 
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define pb push_back
#define popb pop_back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi
#define se second
 
#define forz(i,n) for(long long int i=0;i<n;i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0) 
 
using namespace std;

int main()
{
	string s;
	cin >> s;
	if (s== "AAA" || s== "BBB")
	{
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes"<< endl;
	}
	return 0;
}


Measured memory_bytes: 256
h,w=map(int,input().split())
grid=[]
grid2=[]
grid3=[]
for i in range(h):
  grid.append(list(input().replace(" ","")))
for i in range(len(grid)):
  if grid[i].count('.')==len(grid[i]):
    pass
  else:
    grid2.append(grid[i])
for i in grid2:
  grid3.append([])
for j in range(len(grid2[0])):
  for i in range(len(grid2)):
    if grid2[i][j]=='#':
      for k in range(len(grid3)):
        grid3[k].append(grid2[k][j])
      break
for i in grid3:
  print(''.join(i))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000+20;
const int INF = 0x3f3f3f3f;
int p[maxn], v[maxn];
int dp[10000+50];
int main()
{
    int n, m;
    while(scanf("%d %d", &m, &n)!=EOF) {
        for(int i = 1; i <= n; i++) {
            scanf("%d %d", &v[i], &p[i]);
        }
        memset(dp, INF, sizeof(dp));
        dp[0] = 0;
        for(int i = 1; i <= n; i++) {
            for(int j = v[i]; j <= 10000; j++) {
                dp[j] = min(dp[j], dp[j-v[i]] + p[i]);
            }
        }

        int maxx = dp[m];
        int ans = m;
        for(int i = m; i <= 10000; i++) {
            if(dp[i] <= maxx) {
                maxx = dp[i];
                ans = i;
            }
        }
        printf("%d\n",maxx);

    }


    return 0;
}



Measured memory_bytes: 256
package main

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

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	stdInScanner.Scan()
	i, _ := strconv.Atoi(stdInScanner.Text())
	return i
}

func nextString() string {
	stdInScanner.Scan()
	return stdInScanner.Text()
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	N := nextInt()
	counter := map[string]int{}
	key := ""
	for i := 0; i < N; i++ {
		key = nextString()
		if _, ok := counter[key]; ok {
			counter[key] += 1
		} else {
			counter[key] = 1
		}
	}
	fmt.Println(len(counter))
}


Measured memory_bytes: 18284
#include <bits/stdc++.h>
#define hell 1000000007
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll long long int
#define pi 3.1415926536
using namespace std;
vector<ll> adj[100005];
vector<ll> visited(100005,-1);
ll r;
ll dfs(ll i)
{
	if(visited[i]!=-1)
	return visited[i];
	if(adj[i].size()==0)
	return(visited[i]=0);
	ll temp=0;
	for(ll j=0;j<adj[i].size();j++)
	{
		//if(visited[adj[i][j]]==-1)
		temp=max(temp,dfs(adj[i][j]));
		
	}
	return(visited[i]=temp+1);
}
void solve()
{ll n,m,x,y,z,d,p=0,b=0,q,l=INT_MAX,k,mini=0,prev;
 cin>>n>>m;
 for(ll i=0;i<m;i++)
 {
 	cin>>x>>y;
 	adj[x].pb(y);
 }r=0;
 for(ll i=1;i<=n;i++)
 {
 
 		dfs(i);
	
 }
 cout<<*max_element(visited.begin(),visited.end());
}

int main()
{
  fast
ll t=1;

while(t--)
{solve();
 //cout<<ma<<endl;
}
return 0;}

Measured memory_bytes: 8576
#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<cctype>
#include<cmath>
#include<queue>
#include<stack> 
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
//const int MAX_V=105;

int main(){
  int top,end;
  int j;
  string S;
  cin >> S;
  rep(i,S.size()){
    if(S[i]=='A'){
      top=i;
      break;
    }
  }
  for(j=S.size()-1;j>=0;j--){
    if(S[j]=='Z'){
      end=j;
      break;
    }
  }
  cout << end-top+1 << endl;

    return 0;
}
 

Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b, c;
		a = sc.nextInt();
		b = sc.nextInt();
		c = a * b;
		if (c % 2 == 0) {
			System.out.println("Even");
		} else {
			System.out.println("Odd");
		}
		sc.close();
	}

}


Measured memory_bytes: 22740
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	x := readInt()

	ans := 0
	if x >= 500 {
		ans += (x / 500) * 1000
		x = x % 500
	}

	if x >= 5 {
		ans += (x / 5) * 5
	}
	fmt.Println(ans)
}


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

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

    if (a == 0) {
        cout << 1 << endl;
    } else if (b == 0) {
        cout << 2 << endl;
    } else if (c == 0) {
        cout << 3 << endl;
    } else if (d == 0) {
        cout << 4 << endl;
    } else {
        cout << 5 << endl;
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
#define MOD 1000000007
#define INF 1000000
#define PI 3.14159265358979323846

int main()
{
  int N;cin>>N;
  vector<int> H(N+1);
  for (int i=1;i<=N;i++)
  {
    cin>>H[i]; 
  }
  
  if (N==1)
  {
    cout<<"Yes"<<endl;
    return (0);
  }
  
  for (int i=N;i>=2;i--)
  {
    if (H[i]<H[i-1]) H[i-1]--; 
  }
  
  //for (int i=1;i<=N;i++)
    //cout<<H[i]<<endl;
  
  for (int i=1;i<=N-1;i++)
  {
    if (H[i]>H[i+1])
    {
      cout<<"No"<<endl;
      return (0);
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int mod = 998244353;

int extgcd(int a, int b ,int &x, int&y){
  int d = a;
  if( b != 0 ){
    d = extgcd(b,a%b,y,x);
    y-=(a/b)*x;
  }else{
    x=1,y=0;
  }
  return d;
}
int mod_inverse( int a, int m ){
  int x, y ;
  extgcd( a, m , x, y);
  return (m+x%m)%m;
}
int main(){
   int N,M,K;
   cin >> N >> M >> K;
   long long ans = 0;
   long long base[N];
   base[0]=M;
   for(int i = 1 ; i < N; i++){
      base[i]= base[i-1]*(M-1);
      base[i]%= mod;
   }
   long long comb=1;
   int cur = N-1;
   for(int i = 0 ; i<=K ; i++){
      ans += base[N-1-i] * comb;
      comb*=mod_inverse(i+1,mod);
      comb%=mod;
      comb*=cur;
      comb%=mod;
      cur--;
      ans %=mod;
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 5184
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String s = in.next();
		String t = in.next();
		char[] S = new char[s.length()];
		char[] T = new char[t.length()];
		for(int i = 0; i < s.length(); i++)S[i] = s.charAt(i);
		for(int i = 0; i < t.length(); i++)T[i] = t.charAt(i);
		Arrays.sort(S);
		Arrays.sort(T);
		String sS = "";
		for(int i = 0; i < s.length(); i++)sS += S[i];
		String sT = "";
		for(int i = 0; i < t.length(); i++)sT += T[t.length()-i-1];
		if(sS.compareTo(sT)<0)System.out.println("Yes");
		else System.out.println("No");
	}
}

Measured memory_bytes: 22868
#include<iostream>
using namespace std;
int n,k,a[110],d[110],cnt[110];
int main()
{
	cin>>n>>k;
	for(int i=0;i<k;i++)
	{
		cin>>a[i];
		for(int j=0;j<a[i];j++)
		{
			cin>>d[j];
			cnt[d[j]-1]++;
			//cout<<cnt[d[j]-1]<<" "<<d[j]-1<<endl;
		}
	}
	int ans=0;
	for(int i=0;i<n;i++)
	{
		if(cnt[i]==0)
		{
		ans++;
		//cout<<i<<" "<<cnt[i]<<endl;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3192
#include<iostream>
#include<stdio.h>

using namespace std;

int main()
{
	int num;

	cin >> num;

	for (int i = 1; i <= num; i++){
		int x = i;

		if ((i % 3) == 0){
			cout << " " << i;
			x = 0;
		}

		while (x){
			if (x % 10 == 3){
				cout << " " << i;
				break;
			}
			x /= 10;
		}
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
 
  if (a * b % 2 == 1) {
    cout << "Odd" << endl;
  }
  
  else if (a * b % 2 == 0) {
    cout << "Even" << endl;
  }
  
}

Measured memory_bytes: 256