akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var I = G;
		WriteLine(Min(I[2], I[1] / I[0]));
	}
}


Measured memory_bytes: 13268
import java.util.*

fun main() {
    val sc = Scanner(System.`in`)
    val k = sc.nextInt()
    val (a, b) = (0 until 2).map { sc.nextInt() }
    var bdivk = b / k
    if (bdivk * k < a) {
        println("NG")
    } else {
        println("OK")
    }
}

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

int main(){
    long N, T;
    cin >> N >> T;
    vector <long> time(N);
    rep(i,N){
        cin >> time[i];
    }

    int ans = T;
    if(N == 1){
        cout << T << endl;
        return 0;
    }
    else{
        for(int i=1; i<N; i++){
            if((time[i] - time[i-1]) >= T){
                ans += T;
            }
            else{
                ans += time[i] - time[i-1];
            }
        }
        cout << ans << endl;
        return 0;
    }
}


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

int main(void)
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) { cin >> a.at(i); }
    ll count = 0;
    while (1) {
        for (auto &x : a) {
            if (x % 2) {
                cout << count << endl;
                return 0;
            }
            x >>= 1;
        }
        count++;
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define rep(i,n) for(long long  i = 0; i < n; i++)
#define rep2(i,a,n) for(long long  i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

using namespace std;

int main() 
{
    ll a,b,c,x,y;
    ll ans = INF;
    cin >> a >> b >> c >> x >> y;

    for(ll i = 1; i <= x; i++) {
        ans = min(ans, i * a + (x-i)*2*c + max(y-(x-i), (ll)0) * b);        
    }

    for(ll i = 1; i <= y; i++) {
        ans = min(ans, i * b + (y-i)*2*c + max(x-(y-i), (ll)0) * a);        
    }

    for(ll i = 1; i <= x; i++) {
        ans = min(ans, i*2*c + (x-i)*a + max(y-i, (ll)0) * b);        
    }

    for(ll i = 1; i <= y; i++) {
        ans = min(ans, i*2*c + (y-i)*b + max(x-i, (ll)0) * a);        
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
//AtCoder AGC032 A - Limited Insertion
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
#if LOCAL&0
    std::ifstream in("./test/sample-3.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#endif
    ll N; cin>>N;
    vector<ll> bn(N+1);
    FOR(i,1,N+1){
        cin>>bn[i];
    }
    //差分出す
    auto search = [&](ll n)->ll{
        vector<ll> ofsn(n,0);
        ll minofs=INT64_MAX;
        ll minofs_idx=-1;
        FOR(i,1,n){
            auto ofs=i-bn[i];
            if(ofs<0) return -1; //無理
            ofsn[i]=ofs;
            if(minofs>=ofs){
                minofs=ofs;
                minofs_idx=i;
            }
        }
        return minofs==0?minofs_idx:-1;
    };

    vector<ll> ans;
    while(bn.size()>1) {
        ll idx = search(bn.size());
        if(idx<0){
            cout<<-1<<endl;
			return 0;
		}
        ans.push_back(bn[idx]);
        bn.erase(bn.begin()+idx);
    }

    reverse(ans.begin(),ans.end()); //反対に
    for(const auto& a:ans){
        cout<<a<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys

def parent(i):
    return (i + 1) / 2 - 1

def left(i):
    return 2 * i + 1

def right(i):
    return 2 * i + 2

def sibling(i):
    if i % 2 == 0:
        return i - 1
    else:
        return i + 1

def insert(S, k):
    S.append(k)
    idx = len(S) - 1
    while True:
        p = parent(idx)
        if p < 0 or S[idx] <= S[p]:
            break
        else:
            S[idx], S[p] = S[p], S[idx]
            idx = p
    #print S

def extract(S):
    print S[0]
    S[0] = S[-1]
    S.pop()
    size = len(S)

    idx = 0
    while True:
        l, r = left(idx), right(idx)
        if l < size and S[idx] < S[l] and (r < size and S[r] <= S[l] or r >= size):
            S[idx], S[l] = S[l], S[idx]
            idx = l
        elif r < size and S[idx] < S[r]:
            S[idx], S[r] = S[r], S[idx]
            idx = r
        else:
            break
    #print S

if __name__ == "__main__":
    lines = sys.stdin.readlines()
    lines.pop()

    S = []
    for line in lines:
        if line[0] == "i":
            insert(S, int(line[7:]))
        else:
            extract(S)

Measured memory_bytes: 158848
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007;
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}
int main() {
    int a,b;
    cin >> a >> b;
    if(a >= 1 && a <= 9 && b >=1 && b <= 9){
        cout << a*b << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF INT_MAX 
#define mod 1000000007
using namespace std;
int main(){
    ll N;
    cin >> N;
    ll M=N;
    ll ans=1;
    int a[N+1];
    for(int i=0;i<N+1;i++){
        a[i] = 0;
    }
    while(M>1){
        int K=M;
        for(int i=2;i<=N;i++){
            while(K%i==0){
                a[i]++;
                K = K/i;
            }
        }
        M--;
    }
    for(int i=2;i<=N;i++){
        ans = ans * (a[i]+1);
        ans = ans%mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N, L, Q;
    cin >> N;
    vector<int> X(N + 2);
    rep(i, N) cin >> X[i];
    X[N] = X[N - 1] + 1;
    X[N + 1] = INT32_MAX;
    cin >> L >> Q;
    vector<pair<int, int>> ab(Q);
    rep(i, Q) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        if (a > b) swap(a, b);
        ab[i] = { a, b };
    }

    vv<int> rightLimit_dbl = vvec(18, N + 2, -1);

    rep(i, N + 1) {
        rightLimit_dbl[0][i] = (upper_bound(all(X), X[i] + L) - X.begin()) - 1;
    }

    rep(b, 1, 18) {
        rep(i, N + 1) {
            rightLimit_dbl[b][i] = rightLimit_dbl[b - 1][rightLimit_dbl[b - 1][i]];
        }
    }

    rep(i, Q) {
        int a = ab[i].first;
        int ans = 0;

        int k = 17;
        for (; a != ab[i].second && k >= 0; --k) {
            if (rightLimit_dbl[k][a] <= ab[i].second) {
                ans += 1 << k;
                a = rightLimit_dbl[k][a];
            }
        }
        if (k < 0 && a != ab[i].second) ans++;

        write(ans);
    }
}

Measured memory_bytes: 9080
from collections import deque
n,m,k=map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a,b=[0],[0]
for i in range(n):
  a.append(a[i]+A[i])
for i in range(m):
  b.append(b[i]+B[i])
ans, j = 0,m
for i in range(n+1):
  if a[i]>k: break
  while b[j] > k-a[i]:
    j -= 1
  ans = max(ans,i+j)
print(ans)

Measured memory_bytes: 49220
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define piii pair<pii, int>
#define pb push_back
#define fs first
#define sc second
#define ppb pop_back
//#define LOCAL
//#define endl "\n"
#define d0(x) cout<<x<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<endl
#define d5(x,y,z,w,s) cout<<x<<" "<<y<<" "<<z<<" "<<w<<" "<<s<<endl
#define fifo ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1e9+7;



void solve()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max(max(a*d,a*c),max(b*c,b*d))<<endl;
}


int main()
{
	fifo
	ll t=1;
	//cin>>t;
	//cout<<t<<endl;
	for(ll test_case=1;test_case<=t;++test_case)
	{
		//cout<<"#"<<test_case<<endl;
		solve();
	}
}


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

typedef long double LD;
typedef long long ll;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

#define pb              push_back
#define mp              make_pair
#define F               first
#define S               second
#define mod             1000000007
#define INF             2147483647
#define endl            "\n"
#define FasterIO        ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0) ;
#define precision(a)    cout << fixed << setprecision(a)
#define bug(a,b)        cout<<a<<"\t"<<b<<"\n";
#define Case(a,b)       cout<<"Case "<<a<<": "<<b<<"\n";
#define reset(a,b)      memset(a,b,sizeof(a));
#define For(x,n)        for(int i=x; i<n; i++)

const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

int strtoint(string str){
    stringstream ss(str);
    int x = 0;
    ss >> x ;
    return x ;
}
string intostr(int x){
    stringstream ss;
    ss << x;
    string str = ss.str();
    return str;
}
void rem(string &s, const string &c) {
	auto pos = s.find(c);
	if (pos == string::npos) {
		cout << -1 << endl;
		exit(0);
	}
	s.erase(0, pos + 1);
}
void println (int n){
    cout<<n<<"\n";
}
void printvec(vector <int> &a){
    for (int i=0;i<a.size();i++){
        cout<<a[i]<<" ";
    }
    cout<<"\n";
}

void printgraph(vector <int> g[],int e){
    for (int i=1;i<=e;i++){
        cout<<i<<" --> ";
        for (int j=0;j<g[i].size();j++){
            cout<<g[i][j]<<" ";
        }
        cout<<"\n";
    }
}

void printmap (map <int,int> &mymap){
    for (auto itr = mymap.begin(); itr != mymap.end(); ++itr) {
        cout << '\t' << itr->first
             << '\t' << itr->second << '\n';
    }
    cout << "\n";
}

vector <int> v[100005];
int dp [100005];
int visited [100005];
int temp=0;


int dfs (int k){
    if(visited[k]) return dp[k];

	visited[k] = 1;
	int res = 0;

	for(int i : v[k]){
		res = max(res, dfs(i) + 1 );
	}

	return dp[k] = res;
}

void solve(){
    int n,m;
    cin>>n>>m;
    for (int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        v[x].pb(y);
    }
    int ans = 0;
    for (int i=1;i<=n;i++){
        ans = max(ans,dfs(i));
    }
    cout<<ans<<endl;

    /*for (int i=0;i<n;i++){
        cout<<dp[i]<<" ";
    }*/
    //printgraph(v,n);


}


int main(){
    //FasterIO;

    solve();
    return 0;
}


Measured memory_bytes: 11872
<?php
// Your code here!
    $line = str_split(trim(fgets(STDIN)));
    
    $count=0;
    
    for($i=0;$i<3;$i++){
        if($line[$i] == "A"){
            $count++;
        }
    }
    if($count == 3 || $count == 0){
        echo "No";
    }else{
        echo "Yes";
    }
?>

Measured memory_bytes: 16228
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 998244353LL;
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
template <class T>
void chmin(T &a, T b) { a = min(a, b); }
template <class T>
void chmax(T &a, T b) { a = max(a, b); }
void debug() { cerr << "ok" << endl; }
template <class T>
void printv(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void readv(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    ll res = 0, r = 0, rg = 0, g = 0, gb = 0, b = 0, br = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R') {
            rg += g;
            br += b;
            r++;
            res += gb;
        } else if (s[i] == 'G') {
            rg += r;
            gb += b;
            g++;
            res += br;
        } else {
            br += r;
            gb += g;
            b++;
            res += rg;
        }
    }
    for (int l = 1; l <= n; l++) {
        for (int i = 0; i < n; i++) {
            int j = i + l, k = i + 2 * l;
            if (k >= n) continue;
            if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) {
                res--;
            }
        }
    }
    cout << res << '\n';
}

Measured memory_bytes: 3636
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{
    public void Proc()
    {

        int[] inpt = ScanInt();
        int ans = inpt[0] + (inpt[1] / 2);
        Console.WriteLine(ans);
    
    
    
    }


    private int[] ScanInt() {
        return Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
    }

    private long[] ScanLong() {
        return Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
    }

    private string[] ScanStr() {
        return Reader.ReadLine().Split(' ').ToArray();
    }

    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"



81 58





";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b)
{
    if(b==0){
        return a;
    }
    return gcd(b,a%b);
}
int main()
{
    long long int a,b,c,d,num1,num2,num3,num;
    cin>>a>>b>>c>>d;
    num=b-a+1;
    long long int lcd=(c*d)/gcd(c,d);
    if(a%c==0){
        num1=(b/c)-(a-1)/c;
    }
    else{
         num1=(b/c)-(a/c);
    }
    if(a%d==0){
        num2=(b/d)-(a-1)/d;
    }
    else{
         num2=(b/d)-(a/d);
    }
    if(a%lcd==0){
        num3=(b/lcd)-(a-1)/lcd;
    }
    else{
         num3=(b/lcd)-(a/lcd);
    }

   cout<<(num-num1-num2+num3);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,a) for(int i=start[(a)];i;i=e[i].next)
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
inline int read()
{
    int sum=0,p=1;char ch=getchar();
    while(!(('0'<=ch && ch<='9') || ch=='-'))ch=getchar();
    if(ch=='-')p=-1,ch=getchar();
    while('0'<=ch && ch<='9')sum=sum*10+ch-48,ch=getchar();
    return sum*p;
}


const int mod=1e9+7;

const int maxn=2e5+20;

struct node {
    int x,v;
};
node a[maxn];

int n,stmx[maxn][20],stmn[maxn][20];

inline void init()
{
    n=read();
    REP(i,1,n)
    {
	int x=read(),v=read();
	a[i]=(node){x,v};
    }
    sort(a+1,a+n+1,[](node a,node b) -> bool{ return a.v<b.v;});
    REP(i,1,n)stmx[i][0]=stmn[i][0]=a[i].x;
    for(int j=1;(1<<j)<=n;j++)
	REP(i,1,n-(1<<j)+1)stmx[i][j]=max(stmx[i][j-1],stmx[i+(1<<j-1)][j-1]),stmn[i][j]=min(stmn[i][j-1],stmn[i+(1<<j-1)][j-1]);
}

struct interval {
    int l,r;
};
interval b[maxn];
int dp[maxn],s[maxn];

inline void doing()
{
    REP(i,1,n)
    {
	int l=1;
	DREP(j,20,0)if(l+(1<<j)-1<=n && stmx[l][j]<a[i].x)l+=1<<j;
	b[i].l=l;
	int r=n;
	DREP(j,20,0)if(r-(1<<j)+1>=1 && stmn[r-(1<<j)+1][j]>a[i].x)r-=1<<j;
	b[i].r=r;
    }
    sort(b+1,b+n+1,[](interval a,interval b){ return a.r==b.r?a.l<b.l:a.r<b.r;});
    dp[0]=1; s[0]=1;
    int l=0;
    int ans=0;
    REP(i,1,n)
    {
	while(b[l].r<b[i].l-1)l++;
	dp[i]=(s[i-1]-(l?s[l-1]:0)+mod)%mod;
	if(b[i].r==n)ans=(ans+dp[i])%mod;
	s[i]=(s[i-1]+dp[i])%mod;
    }
    printf("%d\n",ans);
}

int main()
{
    init();
    doing();
    return 0;
}



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

const int N = 100 * 1000 + 5;
const int mod = 1000 * 1000 * 1000 + 7;

long long psw[2 * N];
long long psb[2 * N];
long long fac[2 * N];
int po(long long x, long long y) {
	if (y == 0)
		return 1; 
	long long ans = po(x, y / 2);
	ans *= ans;
	ans %= mod;
	if (y % 2) {
		ans *= x;
		ans %= mod;
	}
	return ans;
}
int chs(int x, int y) {
	if (x < y)
		return 0;
	if (x == y)
		return 1;
	long long ans = fac[x];
	ans *= po(fac[y], mod - 2);
	ans %= mod;
	ans *= po(fac[x - y], mod - 2);
	ans %= mod;
	return ans;
}
int main() {
	fac[0] = 1;
	for (int i = 1; i < 2 * N; i++) {
		fac[i] = fac[i - 1] * i;
		fac[i] %= mod;
	//	cout << "28 " << i << " " << fac[i] << endl;
	}
	int b, w;
	cin >> b >> w;
	for (int i = 1; i <= w + b; i++) {
		long long x = chs(i - 1, w - 1);
		long long y = chs(i - 1, b - 1);
	//	cout << "73 " << x << " " << y << endl;
		x *= po(2, 1ll * i * (mod - 2));
		y *= po(2, 1ll * i * (mod - 2));
		x %= mod;
		y %= mod;
		psw[i] = psw[i - 1] + x;
		psb[i] = psb[i - 1] + y;
		psw[i] %= mod;
		psb[i] %= mod;
		long long z = 1 - psw[i - 1] - psb[i - 1] + 2 * mod;
		z %= mod;
	//	cout << i << " " << x << " " << y << " " << psw[i] << " " << psb[i] << endl;
		long long ans = (long long) psw[i - 1] + z * po(2, mod - 2);
		ans %= mod;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 6912
#include<stdio.h>
#pragma warning(disable:4996)

int main(void) {

	char S[11];
	char T[12];
	int i, f = 0;
	scanf("%s", S);
	scanf("%s", T);
	

	for (i = 0; S[i] != '\0'; i++) {
		if (S[i] != T[i]) {
			f = 1;
			break;
		}
	
	} 
	T[i] = '\0';	
	if (f == 0) {
		printf("Yes");
	}
	else {
		printf("No");
	}
	return 0;

}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k,a,b,i,sum=0;
    cin>>k;
    cin>>a>>b;
    for(i=a;i<=b;i++){
        if(i%k==0){
            sum+=1;
        }
    }
    //cout<<sum<<endl;
    if(sum>=1){
        cout<<"OK"<<endl;
    }else{
        cout<<"NG"<<endl;
    }
}


Measured memory_bytes: 3636
a, b, c = map(int,input().split())
count = 0

c_yakusuu = []
for i in range(1, c+1):
    if c % i == 0:
        c_yakusuu.append(i)
        
for i in range(a,b+1):
    if i in c_yakusuu:
        count += 1
            
print(str(count))

    


    


Measured memory_bytes: 5600
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k==x:
                ans+=1
                break
print(ans)

Measured memory_bytes: 3060
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n+1];
    for(int i = 2;i<n+1;i++){
      int ty = sc.nextInt();
      a[ty]++;
    }
    for(int i = 1;i<n+1;i++){
      System.out.println(a[i]);
    }
  }
}


Measured memory_bytes: 61792
package main

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

var N, ans int

func main() {
	fmt.Scan(&N)
	reader := bufio.NewScanner(os.Stdin)
	reader.Split(bufio.ScanWords)

	a := make(SortBy, N)
	for i := 0; i < N; i++ {
		reader.Scan()
		a[i], _ = strconv.Atoi(reader.Text())
	}
	sort.Sort(a)

	var Alice, Bob int
	for 2 <= len(a) {
		Alice += a[0]
		Bob += a[1]
		a = append(a[2:])
	}
	if len(a) == 1 {
		Alice += a[0]
	}

	fmt.Println(Alice - Bob)
}

/*  ----------------------------------------  */
func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i] > a[j] }


Measured memory_bytes: 640
N = list(map(int, list(input())))
for i in range(2 ** 3):
    total = N[0]
    ans = []
    for j in range(3):
        if i >> j & 1:
            total += N[j + 1]
            ans.append('+')
        else:
            total -= N[j + 1]
            ans.append('-')
    if total == 7:
        joy = ''
        for i in range(3):
            joy += str(N[i])
            joy += str(ans[i])
        joy += str(N[-1])
        joy += '=7'
        print(joy)
        break


Measured memory_bytes: 9208
#include <bits/stdc++.h>
#define all(x) x.begin() , x.end()
#define sz(x) (x.size())
#define eb emplace_back
 using namespace std;
  map<int ,int > mi;
  vector<int> vi;
  int main(){
   int n;
   cin >> n;
   for(int i=0;i<n;i++){
    int a;
     cin  >> a;
     vi.eb(a);
     if(mi.find(a)!=mi.end()) mi[a]++;
     else mi[a] = 1;
   }
   sort(all(vi));
   vector<int> :: iterator it = unique(all(vi));
   vi.resize(distance(vi.begin() , it));
   for(auto &i : vi){
     if(mi[i]<2) i = INT_MAX;
   }
   sort(all(vi));
   while(!vi.empty()&&vi.back()==INT_MAX)vi.pop_back();
   long long int Ans  = 0;
   if(vi.size()==1){
     if(mi[vi.back()]>=4)Ans = (long long int )vi.back() * (long long int )vi.back();
   }else{
     if(mi[vi.back()]>=4) Ans = (long long int )vi.back() * (long long int )vi.back();
     else Ans = (long long int )vi.back() * (long long int )vi[vi.size()-2];
   }
   cout << Ans;
   }


Measured memory_bytes: 5368
#include <iostream>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;

int n;

int main(){
  while(cin >> n ,n){
    int ans[(n-1)/2];
    memset(ans,0,sizeof(ans));
    vector<int> v;
    vector<int> nv;
    int nn = n;

    for(int i = 1 ; i < nn ; i++){      
      v.push_back(i*i%n);
    }
    sort(v.begin(),v.end());
    for(int i = 1 ; i < nn ; i++){ 
      if(v[i] != v[i-1]){ 
	nv.push_back(v[i-1]);
      }       
    }
   
    for(int i = 0 ; i < nv.size(); i++){
      for(int j = 0 ; j < nv.size() ; j++){
	if(i == j) continue;

	int res = nv[i]-nv[j];
	if(res < 0){
	  res += nn;
	}
	if(res > (nn-1)/2){
	  res = nn - res;
	}
	ans[res-1]++;
      }
    }

    int i;
    for(i = 0 ; i < (n-1)/2 ; i++){
      cout << ans[i] << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 1344
#include <iostream>
#include <vector>

void print(std::vector<int>& array){
  bool first = true;
  for(int i = 0; i < array.size(); i++){
    if(!first){
      std::cout << " ";
    }else{
      first = false;
    }

    std::cout << array[i];
  }

  std::cout << std::endl;
}

int main(int argc,char* argv[]){
  int n;
  std::vector<int> array;

  std::cin >> n;

  for(int i = 0; i < n; i++){
    int tmp;
    std::cin >> tmp;
    array.push_back(tmp);
  }

  print(array);
  for(int j = 1; j < n; j++){
    int key = array[j];
    
    int i = j - 1;
    while(i >= 0 && array[i] > key){
      array[i+1] = array[i];
      i--;
    }

    array[i + 1] = key;
    print(array);
  }

  return 0;  
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
int main() {
    int d; long long g; cin >> d >> g;
    int n = 0;
    vector<int> p(d); vector<long long> c(d);
    for (int i = 0; i < d; i++) {
        cin >> p[i] >> c[i];
        n += p[i];
    }
    long long dp[d+1][n+1];
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < d; i++) {
        for (int j = 0; j <= n; j++) {
            for (int k = 0; k <= p[i]; k++) {
                if (j+k > n) break;
                dp[i+1][j+k] = max(dp[i+1][j+k], dp[i][j] + 100 * (i+1) * k + c[i] * (k == p[i]));
            }
        }
    }
    int ans = n;
    for (int i = n; i > 0; i--) {
        if (dp[d][i] >= g) ans = i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <string.h> 
#include <stdio.h> 
#include <stdlib.h>
#define max 50000000
struct N { 
    int K; 
    struct N *P, *N; 
}; 
 
struct N *nale; 
int k,ccc=0;
void l_ini();
void l_ins();
struct N* list_S(int );
void D_N(struct N *);
void D_F();
void D_L();
void D_K(int );
void print_L();
  


int main(void) { 
  int K, n, i; 
    int size = 0; 
    char com[20],comcomcom[max]; 
    int np = 0, nd = 0; 
    scanf("%d", &n); 
    l_ini(); 
    for (i = 0; i < n; i++) { 
        scanf("%s%d",com, &K); 
        if(com[0] == 'i') { 
            l_ins(K); 
            np ++; 
            size++; 
        }else if(com[0] == 'd') { 
            if(strlen(com) > 6) { 
                if( com[6] == 'F') { 
                    D_F(); 
                }else if(com[6] == 'L') { 
                    D_L(); 
                } 
            }else { 
                D_K(K); 
                nd ++; 
            } 
            size --; 
        }
	for(k=0;k<max;k++){ccc++;}
    } 
    print_L(); 
    return 0; 
} 




void l_ini() { 
    nale = (struct N *)malloc(sizeof(struct N)); 
    nale->N = nale; 
    nale->P = nale;for(k=0;k<max;k++){ccc++;}
    
} 
 
void l_ins(int K) { 
    struct N * xmen = (struct node *)malloc(sizeof(struct N)); 
    xmen->K = K; 
    xmen->N = nale->N; 
    nale->N->P = xmen; 
    nale->N = xmen; 
    xmen->P = nale; for(k=0;k<max;k++){ccc++;}
} 
 
struct N* list_S(int K) { 
    struct N *cur = nale->N; 
    while(cur != nale && cur->K != K ) { 
        cur = cur-> N; for(k=0;k<max;k++){ccc++;}
    } 
    return cur; 
} 
 
void D_N(struct N *t) { 
    if (t == nale) return; 
    t->P->N = t->N; 
    t->N->P = t->P; for(k=0;k<max;k++){ccc++;}
    free(t); 
} 
 
void D_F() { 
    D_N(nale->N);for(k=0;k<max;k++){ccc++;} 
} 
 
void D_L() { 
    D_N(nale->P); for(k=0;k<max;k++){ccc++;}
} 
void D_K(int K) { 
    D_N(list_S(K)); for(k=0;k<max;k++){ccc++;}
} 

void print_L() { 
    struct N *cur; 
    cur = nale->N; 
    int isf = 0; 

    while(1) { 
        if (cur == nale) break; 
        if(isf++ > 0) printf(" "); 
        printf("%d", cur->K); 
        cur = cur->N; for(k=0;k<max;k++){ccc++;}
    } 
    printf("\n"); 
}  



Measured memory_bytes: 32952
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: Meal Delivery
 */

#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 */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if (abs(x - a) < abs(x - b)) puts("A");
  else puts("B");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace         std;
#define                 int long long
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<endl
#define                 real signed
#define                 endl '\n'              
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 314159

signed main() 
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
     
    int a,b;
    cin>>a>>b;
    if(b%a)cout<<b-a;
    else cout<<a+b;



     return 0;

}

//       g++ -g c.cpp ; ./a.exe

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
int main() {
 int N,X;
 cin>>N>>X;
 vector<int>m(N);
 int sum=0;
 for(int i=0;i<N;i++){
     cin>>m[i];
     sum+=m[i];
 }
 cout<<N+(X-sum)/ *min_element(m.begin(),m.end())<<endl;
 return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int k,n;
    cin>>k>>n;
    int a[n];
    for(int i=0; i<n; i++)
        cin>>a[i];
    int sum=0;
    int c[n];
    c[0]=a[0];
    for(int i=1; i<n; i++)
    {
        c[i]=a[i]-a[i-1];
    }
    for(int i=1; i<n; i++)
    {
        sum=sum+c[i];
    }

    int sum1=k-a[n-1]+a[0];
    int m=-1;

    for(int i=1; i<n; i++)
    {
        m=max(m,c[i]);
    }

    if(m>sum1)
        cout<<sum+sum1-m;
    else
        cout<<sum<<endl;


}


Measured memory_bytes: 1792
#include<stdio.h>
#include<math.h>
#define pai 3.141592653

void koch(int n,double x1,double y1,double x2,double y2)
{
	if(!n) return;
	double sx,sy,tx,ty,ux,uy;
	
	sx = (x1 * 2 + x2)/3.0;
	sy = (y1 * 2 + y2)/3.0;
	tx = (x1 + x2 * 2)/3.0;
	ty = (y1 + y2 * 2)/3.0;
	
	ux = (tx-sx)*cos(pai/3)-(ty-sy)*sin(pai/3)+sx;
	uy = (tx-sx)*sin(pai/3)+(ty-sy)*cos(pai/3)+sy;
	
	koch(n-1,x1,y1,sx,sy);
	printf("%f %f\n",sx,sy);
	koch(n-1,sx,sy,ux,uy);
	printf("%f %f\n",ux,uy);
	koch(n-1,ux,uy,tx,ty);
	printf("%f %f\n",tx,ty);
	koch(n-1,tx,ty,x2,y2);
}

int main()
{
	int n;
	
	scanf("%d",&n);
	printf("%f %f\n",0.0,0.0);
	koch(n,0.0,0.0,100.0,0.0);
	printf("%f %f\n",100.0,0.0);
	return 0;
}



Measured memory_bytes: 2052
K=()
A=()
B=()

K=int(input(""))
A, B = map(int, input().split())
V=False
C=K
D=B+1

for i in range(0,D):
      K=C*i
      if K>=A and K<=B:
            V=True
            break
      else:
            V=False

if V==True:
      print("OK")
else:
      print("NG")

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--) 
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();

int main(){
 int r,res=0; cin>>r;
 

 cout<<3*pow(r,2)<<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int fg1=2147400000,fg2;
int main()
{
	cin >> s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='C') fg1=min(fg1,i);
		else if(s[i]=='F') fg2=max(fg2,i);
	}
	if(fg1<fg2) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var q = int.Parse(line[1]);
        var a = new List<int>[n];
        for (int i = 0; i < n; i++) a[i] = new List<int>();
        for (int i = 0; i < q; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var c = int.Parse(line[0]);
            var c2 = int.Parse(line[1]);
            if (c == 0)
            {
                var c3 = int.Parse(line[2]);
                a[c2].Add(c3);
            }
            else if (c == 1) print(a ,c2);
            else a[c2].Clear();
        }
    }
    public static void print(List<int>[] a  , int c2)
    {
        var ac = a[c2].Count();
        if (ac == 0) { Console.WriteLine(); return; }
        for (int i = 0; i < ac; i++)
        {
            if (i == ac - 1) Console.WriteLine(a[c2][i]);
            else Console.Write("{0} ", a[c2][i]);
        }
    }
}



Measured memory_bytes: 17176
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }


int n;
int a[110][110];

int main() {
    while (cin >> n) {
        for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) cin >> a[i+1][j+1];
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                a[i+1][j+1] += a[i+1][j];
                a[i+1][j+1] += a[i][j+1];
                a[i+1][j+1] -= a[i][j];
            }
        }
        
        //for (int i = 0; i <= n; ++i) {for (int j = 0; j <= n; ++j) cout << a[i][j] << ", "; cout << endl;}
            
        long long res = -1LL<<61;
        for (int i = 0; i < n; ++i) for (int j = i+1; j <= n; ++j) for (int k = 0; k < n; ++k) for (int l = k+1; l <= n; ++l) {
            long long tmp = a[j][l] - a[i][l] - a[j][k] + a[i][k];
            chmax(res, tmp);
        }
        
        cout << res << endl;
    }
    
    return 0;
}


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

int main(){
  /*
  int N;
    cin >> N;
    vector<int> a(N);
    for (int i=0; i<N; ++i){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    cout << a[N-1] - a[0] << endl;
    */
   int n; cin >> n;
   vector<ll> a(n);
   rep(i,n) cin >> a[i];
   sort(a.begin(), a.end());
   cout << a[n-1]-a[0] << endl;
}

Measured memory_bytes: 3588
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
ans = 0
if s == 'RRR':
    print(3)
elif 'RR' in s:
    print(2)
elif 'R' in s:
    print(1)
else:
    print(0)














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

#define MX 100005
#define ll long long
ll dp[MX];
int A[MX];

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

    dp[1] = 0;
    dp[2] = abs(A[1] - A[2]);
    for (int i = 3; i <= n; i++)
        dp[i] = min(dp[i-1] + abs(A[i] - A[i-1]),
                    dp[i-2] + abs(A[i] - A[i-2]));

//    for (int i = 1; i <= n; i++)
//        cout << i << "(" << A[i] << ") -> " << dp[i] << endl;
    printf("%lld\n", dp[n]);
    return 0;
}



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

int main(){
    int N, M;
    cin >> N >> M;
    string A[N], B[M];

    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    for (int i = 0; i < M; i++)
    {
        cin >> B[i];
    }

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            int flag = true;
            for (int k = 0; k < M; k++)
            {
                for (int l = 0; l < M; l++)
                {
//                    cout << i+k << "|" << j+l << endl;
                    if(i+k > N-1 || j+l > N-1){
                        flag = false;
                        break;
                    }else if(A[i+k][j+l] != B[k][l]){
                        flag = false;
                    }
                }
            }
            if(flag == true){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

void delete_space(char *x)
{
	while (*x != '\0')
	{
		if (*x == '\n')
		{
			*x = '\0';
		}
		x++;
	}
}

int main()
{
	char str[10];

	fgets(str, 10, stdin);
	delete_space(str);

	if (strcmp(str,"SUN") == 0)
	{
		printf("%d\n",7);
	}
	if (strcmp(str, "MON") == 0)
	{
		printf("%d\n", 6);
	}
	if (strcmp(str, "TUE") == 0)
	{
		printf("%d\n", 5);
	}
	if (strcmp(str, "WED") == 0)
	{
		printf("%d\n", 4);
	}
	if (strcmp(str, "THU") == 0)
	{
		printf("%d\n", 3);
	}
	if (strcmp(str, "FRI") == 0)
	{
		printf("%d\n", 2);
	}
	if (strcmp(str, "SAT") == 0)
	{
		printf("%d\n", 1);
	}

	return 0;

}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N,A,B,C,D;
int main(){
	cin>>N>>A>>B>>C>>D;
	for(int k=0;k<=N-1;++k)
		if(A+k*C-(N-1-k)*D<=B&&B<=A+k*D-(N-1-k)*C)return puts("YES"),0;
	return puts("NO"),0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;

int main() {
	int N, K;
	double ans = 0;
	cin >> N >> K;

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

		while (point < K) {
			cnt++;
			point *= 2;
		}

		ans += 1 / ((double)N * pow(2, cnt));
	}

	printf("%.10f", ans);
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <stack>
#include <string>
#include <iomanip>
#include <queue>
#include <deque>
#include<cstring>
#include<limits>
#include <sstream>
#include <stdio.h>
#include<unordered_map>
using namespace std;
#define sz(x) (x).size()
#define all(v) (v).begin(),(v).end()
#define m_p make_pair
void run()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
}
void fast()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int main()
{

	fast();
	long long n ,a=0, b=0, c=0,y;
	cin >> n >> y;
	for (int i = 0; i <= 2000; i++)
	{
		for (int j = 0; j <= 2000; j++)
		{
			if (i + j>n)
				break;
			long long ans = (i * 10000) + (j * 5000) + ((n - (i + j)) * 1000);
			if (ans == y)
			{
				cout << i << " " << j << " " << (n - (i + j)) << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;
return 0;

}

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

using namespace std;
#define ll long long int
#define mod 998244353
int main()
{
   ll t;
   t = 1;	
   //cin t;
   while(t--){
        ll n , s;
        cin >> n >> s;
        ll a[n];
        for(int i =0 ; i < n ; i ++)
        cin >> a[i];
        ll dp[n + 1][s + 1];
        for(int  i =0 ;  i <= n; i ++)
        {
            for(int j =0 ; j <= s ; j ++)
            dp[i][j] = 0;
        }     
        dp[0][0] = 1;
        for(int i = 1; i <= n ; i ++)
        {
            for(int j = 0; j <=s; j ++)
            {
                dp[i][j] = dp[i][j] % mod + dp[i - 1][j] * 2 % mod ;
                dp[i][j] %= mod;
                if(j >= a[i - 1])
                {
                    dp[i][j] = dp[i][j] % mod + dp[i - 1][j - a[i - 1]] % mod;
                }
                dp[i][j] %= mod;
            }
        }
        cout << dp[n][s] << endl;
   }
}


Measured memory_bytes: 74008
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, m;
  cin >> n >> m;
  int ans = (100 * n + 1800 * m) * pow(2, m);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
using namespace std;
#define ME 0
int main()
{
  int n,m;
  int a,b;
  while(cin>>n>>m,n|m){
    set<int>invited,friendsOfMine;
    set<int>::iterator sit,it;
    vector< set<int> >friends(n);
    for(int i=0;i<m;i++){
      cin>>a>>b;
      friends[b-1].insert(a-1);
      friends[a-1].insert(b-1);
    }
    for(it=friends[ME].begin();it!=friends[ME].end();it++){
      friendsOfMine.insert(*it);
      invited.insert(*it);
    }
    for(sit=friendsOfMine.begin();sit!=friendsOfMine.end();sit++){
      for(it=friends[*sit].begin();it!=friends[*sit].end();it++){
	invited.insert(*it);
      }
    }
    if(invited.size())cout<<invited.size()-1<<endl;
    else puts("0");
  }
}

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


typedef long long ll;
    typedef pair <int, int> ii;
typedef pair <int, ii> iii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

#define iINF (1<<30)
#define INF (1LL<<59)
#define forn(i) for(int i = 0;i < n; ++i)
#define form(i,n) for(int i = 0 ;i < n; ++i)
#define NIL -1

const ll mod = 998244353;
int n;
int m;
int ans;
string str;

int gcd(int x, int y){
    if(y>x)return gcd(y,x);
    if(y==0)return x;
    return gcd(y, x%y);
}
int main(){
    int a[100010];
    int la[100010];
    int ra[100010];
    cin>>n;
    forn(i)cin>>a[i];
    la[0]=a[0];
    ra[n-1]=a[n-1];
    for(int i=1;i<n;i++){
        la[i]=gcd(la[i-1], a[i]);
        ra[n-1-i]=gcd(ra[n-i],a[n-1-i]);
    }
    ans=max(la[n-2], ra[1]);
    for(int i=1; i<n-1;i++){
        ans=max(ans, gcd(la[i-1],ra[i+1]));
    }
    cout<<ans<<endl;
    return 0;
}

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

char str[128];
stack<char> st;

int main(){
	while(1){
		memset(str,0,sizeof(str));
		fgets(str,sizeof(str),stdin);
		if(str[0] == '.' && (str[1] == '\0' || (str[1] == '\n' && str[2] == '\0'))){
			break;
		}
		st = stack<char>();
		st.push('*');
		bool ok = true;
		for(int i = 0; i < sizeof(str) && ok; i++){
			switch(str[i]){
				case '(' :
					st.push('(');
					break;
				case ')' :
					if(st.top() == '('){
						st.pop();
					}
					else{
						ok = false;
					}
					break;
				case '[' :
					st.push('[');
					break;
				case ']' :
					if(st.top() == '['){
						st.pop();
					}
					else{
						ok = false;
					}
					break;
				default :
					break;
			}
		}
		if(ok && st.top() == '*'){
			puts("yes");
		}
		else{
			puts("no");
		}

	}

	return 0;
}



Measured memory_bytes: 3092
package main

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

const MaxBuf = 200100
var buf []byte = make([]byte,MaxBuf)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf,MaxBuf)
}

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

func readInt() int {
	sc.Scan()
	r,_ := strconv.Atoi(sc.Text())
	return r
}

func readInt64() int64 {
	sc.Scan()
	r,_ := strconv.ParseInt(sc.Text(),10,64)
	return r
}

func readFloat64() float64 {
	sc.Scan()
	r,_ := strconv.ParseFloat(sc.Text(),64)
	return r
}

func main() {
	h := readInt()
	_ = readInt()
	p := make([]string,h)
	for i := 0; i < h; i++ {
		p[i] = readString()
	}
	for _ ,v := range p {
		fmt.Println(v)
		fmt.Println(v)
	}

}

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

int main()
{
	long long a[3],sum;
	cin>>a[0]>>a[1]>>a[2];
	if((a[0]%2==0)||(a[1]%2==0)||(a[2]%2==0))
	{
		sum=0; 
	} 
	else 
	{
		sort(a,a+3);
		sum=a[0]*a[1];
	} 
	cout<<sum<<endl; 
} 


Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import Data.List
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector as V

main = abc132c

abc132c = do
    n  <- getIntList
    dL <- getIntList
    let (small, large) = getMedian dL
    print $ large - small
    
getMedian :: [Integer] -> (Integer, Integer)
getMedian dL = let sorted = V.fromList (sort dL)
                   num = V.length sorted
                   subs = V.drop (div num 2 - 1) sorted
                in (V.head subs, subs V.! 1)

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine

Measured memory_bytes: 17788
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a,b,c;
    cin >> a >> b >> c;
    cout << a*b/2 << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )

using namespace std;

typedef long long llong;

int N;
vector<llong> A, B;

int main(void) {
	scanf("%d", &N);

	REP(i, 0, N + 1) {
		llong x;
		scanf("%lld", &x);
		A.push_back(x);
	}

	REP(i, 0, N) {
		llong x;
		scanf("%lld", &x);
		B.push_back(x);
	}

	llong ans = 0;

	//A:monster
	//B:HERO

	REP(i, 0, N) {
		if ( A[i] >= B[i]) {
			ans += B[i];
		} else {
			ans += A[i]; B[i] -= A[i];
			if ( A[i + 1] >= B[i] ) { 
				ans += B[i]; A[i + 1] -= B[i];
			} else {
				ans += A[i + 1]; A[i + 1] = 0;
			}

		}
	}

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

	return 0;
}


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

int main() {
    vector<int> vec(3);
  for(int i =0; i<3; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  cout << (vec.at(0) * vec.at(1))/2 << endl;
      

}

Measured memory_bytes: 256