akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int n, w[105], ans[105], cnt = 0, cnt2 = 0, cnt3;
	cin >> n;
	rep(i, n) cin >> w[i];
	for(int t = 1; t < n+1; t++){
		for(int i = 0; i < t; i++){
			cnt += w[i];
		}
		for(int j = t; j < n; j++){
			cnt2 += w[j];
		}
		cnt3 = cnt - cnt2;
		ans[t-1] = abs(cnt3);
		cnt = 0; cnt2 = 0;
	}
	qsort(ans, n, sizeof(int), comp);
	cout << ans[0] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////



int main() {

	string S;
	cin >> S;
	ll N = S.size();

	vector<bool> y(N + 1, 0);
	y[0] = 1;

	repn(i, N) {
		if (i >= 5) {
			if (S.substr(i - 5, 5) == "dream"&&y[i-5]==1) { y[i] = 1; }
			if (S.substr(i - 5, 5) == "erase"&&y[i-5]==1) { y[i] = 1; }
		}

		if (i >= 6) {
			if (S.substr(i - 6, 6) == "eraser"&&y[i - 6] == 1) { y[i] = 1; }
		}

		if (i >= 7) {
			if (S.substr(i - 7, 7) == "dreamer"&&y[i - 7] == 1) { y[i] = 1; }
		}
	}

	if (y[N] == 1) { cout << "YES"; }
	else { cout << "NO"; }
	system("PAUSE");
}

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

int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];

    int res = 0;
    for (int i = 0; i < N; i++) {
        res = gcd(res, A[i]);
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1020
N = int(input())
a_list = list(map(int,input().split()))

count = 0
def odd_counter(L,c):
    for i in range(N):
        if a_list[i]%2==0:
            a_list[i]/=2
        else:
            return c
    c+=1
    return odd_counter(a_list,c)

print(odd_counter(a_list,count))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main() {
  INIT;
  VAR(int,i);
  if(i==1){
    OUT("Hello World")BR;
  }else{
    VAR(int,a,b);
    OUT(a+b)BR;
  }
  
  return 0;
}


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

int a;
int b;
int product=1;

int main()
{
    cin>>a>>b;

    for (int i=a; i<=b; i++)
    {
        if (i<0)
        {
            product=product*-1;
        }

        if (i==0)
        {
            cout<<"Zero"<<endl;
            return 0;
        }
    }

    if (product>0)
    {
        cout<<"Positive"<<endl;
    }

    else 
    {
        cout<<"Negative"<<endl;
    }
    //te
}

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

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

#define vint(v, n) vector<int> v(n); REP(i,n) cin >> v[i];
#define vvint(v, w, n) vector<int> v(n); vector<int> w(n); REP(i,n) cin >> v[i] >> w[i];
#define vlint(v, n) vector<ll int> v(n); REP(i,n) cin >> v[i];
#define vdouble(v, n) vector<double> v(n); REP(i,n) cin >> v[i];
#define vvdoube(v, n1, n2) vector<vector<double> > v(n1, vector<double>(n2, 0)); REP(i,n1) REP(j,n1) cin >> v[i][j];
#define string(x) string x; cin >> x;
#define vstring(v, n) vector<string> v(n); REP(i,n){string a; std::cin >> a; v.push_back(a); }

#define all(v) (v).begin(), (v).end()
#define rall(v) (v).begin(), (v).end(), std::greater<int>()
#define len(v) (v).length()
#define FIND(s, n) (s.find(n) != s.end())
#define SORT(a) sort(all(a))

static const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
static const long long MOD = 1000000007;
static const double PI=3.1415926535897932;
static const int INF = 0x3f3f3f3f;
static const int INFTY = (1 << 29);
static const long long LINFTY = (1LL << 32);

static const int dy4[]={0, 0, 1, -1};
static const int dx4[]={1, -1, 0, 0};
static const int dx8[] = {1, 1, 1, 0, 0, -1, -1, -1};
static const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};

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

  long long int N, M;
  cin >> N >> M;

  if(2*N >= M) cout << M/2 << endl;
  else{
    long long int num = (M-2*N)/4;
    if(num >= 0) cout << N+num << endl;
    else cout << N << endl;
  }

}


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

#define ll long long 
#define pb push_back
#define pu push
#define in insert
#define f(s,e) for(i=s;i<e;i++)
#define loop(i) while(i--)
#define bg(v) v.begin()
#define ed(v) v.end()
#define sz(v) v.size()
#define len(v) v.length()

int main(){
    ll t,op,i,j,k,n,m,d,h;
    cin>>i>>j;
    if(j>=i)cout<<"unsafe";
    else cout<<"safe";
	return 0; 
} 

Measured memory_bytes: 3636
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back

int N;
int x[100],y[100];
int ans=0;
signed main(){
    scanf("%lld",&N);
    rep(i,N){
        scanf("%lld %lld",&x[i],&y[i]);
    }
    ans=N;
    int p=0,q=0;
    int max_pq=0;
    rep(i,N){
        rep(j,N){
            int pq=1;
            if(i==j)continue;
            p=x[i]-x[j];q=y[i]-y[j];
            rep(k,N){
                if(k==i)continue;
                rep(m,N){
                    if(m==k)continue;
                    if(p==x[k]-x[m]&&q==y[k]-y[m]){pq++;}
                }
            }
            max_pq=max(max_pq,pq);
        }
    }
    ans-=max_pq;
    printf("%lld\n",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
signed main() {
  // you should not use coupon more than 30
  int N, M, a; cin >> N >> M;
  priority_queue<int> A;
  for (int i = 0; i < N; i++) {
    cin >> a;
    A.push(a);
  }
  for (int i = 0; i < M; i++) {
    a = A.top()/2;
    A.pop();
    A.push(a);
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += A.top();
    A.pop();
  }
  cout << ans << endl;
}


Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

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

// a と b の最大公約数を返す
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}


ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}



// 素数判定
bool is_prime(ll N) {
    if (N == 1) return false;
    for (ll i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}


// 約数列挙
vector<ll> enum_divisors(ll N) {
    vector<ll> res;
    for (ll i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            if (N/i != i) res.push_back(N/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}


// 素因数分解
vector<pair<ll, ll>> prime_factorize(ll N){
    vector<pair<ll, ll>> res;
    for(ll i = 2; i * i <= N; i++){
        if(N % i != 0)  continue;
        ll ex = 0;

        while(N % i == 0){
            ex++;
            N /= i;
        }

        res.push_back({i, ex});
    }

    if(N != 1)  res.push_back({N, 1});
    return res;
};



int main(){
    int N; ll X;
    cin >> N >> X;
    vector<ll> x(N);
    for(int i = 0; i < N; i++){
        cin >> x[i];
    }

    x.push_back(X);
    sort(x.begin(), x.end());

    ll res = x[1] - x[0];
    for(int i = 2; i < N+1; i++){
        res = gcd(res, x[i] - x[i-1]);
    }

    cout << res << endl;


    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define arep(i, v) for (auto i : v)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
// #include <atcoder/all>
// using namespace atcoder;
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 T>
inline void dump(T &v) {
    irep(i, v) { cout << (*i) << ((i == --v.end()) ? '\n' : ' '); }
}
template <class T, class U>
inline void dump(map<T, U> &v) {
    irep(i, v) { cout << i->first << " " << i->second << '\n'; }
}
inline string getline() {
    string s;
    getline(cin, s);
    return s;
}
inline void yn(const bool b) { b ? fin("yes") : fin("no"); }
inline void Yn(const bool b) { b ? fin("Yes") : fin("No"); }
inline void YN(const bool b) { b ? fin("YES") : fin("NO"); }
struct io {
    io() {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL << 61;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-11;

/* --------------------   ここまでテンプレ   -------------------- */

map<ll, ll> prime;
int factorize(ll n) {
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            prime[i]++;
            n /= i;
        }
    }
    if(n != 1) {
        prime[n] = 1;
    }
    ll res=1;
    for(auto it:prime){
        res*=it.second+1;
    }
    return res;
}


int main() {
    
    int n;
    cin>>n;
    ll ans=0;
    for(int c=1;c<n;c++){
        int nc=n-c;
        prime.clear();
        ans+=factorize(nc);
    }
    fin(ans);
}


Measured memory_bytes: 3680
N = int(input())
X = [int(d) for d in input().split()]

max_ = max(X)
X.remove(max_)

center = max_/2
abs_ = float('inf')
t_index = None


for i in range(N-1):
	if abs(center - X[i]) < abs_:
		abs_ = abs(center - X[i])
		t_index = i

print(max_,X[t_index])

Measured memory_bytes: 14064
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string str1,str2;
  int n,count1=0,count2=0;

  cin >> n;

  for(int i=0;i<n;i++){
  	cin >> str1 >> str2;
  	if(str1 > str2) count1+=3;
  	else if(str1 == str2) {
  		count1++;
  		count2++;
  	}
  	else count2+=3;

  }

  cout << count1 << " " << count2 << endl;


  return 0;
}


Measured memory_bytes: 3192
# AtCoder
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
sc = sorted(c.items(), key=lambda x: x[0], reverse=True)
sides = []
for side, nums in sc:
    if nums >= 4:
        sides.append(side)
        sides.append(side)
    elif nums >= 2:
        sides.append(side)
if 1 >= len(sides):
    print(0)
    exit()

s = sorted(sides, reverse=True)
ans = s[0]*s[1]
print(ans)


Measured memory_bytes: 72344
#include <bits/stdc++.h>
//#pragma once
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<double,double> P;
const ll INF = 1e18;
const int MOD = 1000000007;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main(){
  int a, b, c;cin>>a>>b>>c;
  int x = c-a-b;
  if(x < 0)cout << "No" << endl;
  else if(4*a*b < (c-a-b)*(c-a-b))cout << "Yes" << endl;
  else cout << "No" << endl;  
}


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

typedef pair<double, int> P;

bool used[101];
double x[101], y[101], z[101], r[101];
vector<P> edge[101];

double sq(double x)
{
    return x * x;
}

double dis(int i, int j)
{
    double d = sqrt(sq(x[i] - x[j]) + sq(y[i] - y[j]) + sq(z[i] - z[j]));
    return max(0.0, d - r[i] - r[j]);
}

int main()
{
    int n;
    double res;

    while(cin >> n && n)
    {
        res = 0.0;
        for (int i = 0; i < n; ++i) {
            edge[i].clear();
            cin >> x[i] >> y[i] >> z[i] >> r[i];
            for (int j = 0; j < i; ++j) {
                double d = dis(i, j);
                edge[i].push_back(P(d, j));
                edge[j].push_back(P(d, i));
            }
        }
        priority_queue<P, vector<P>, greater<P>> h;
        fill_n(used, n, false);
        h.push(P(0.0, 0));
        while (n) {
            P p = h.top(); h.pop();
            int v = p.second;
            if (used[v]) continue;
            --n;
            res += p.first;
            used[v] = true;
            for (size_t j = 0; j < edge[v].size(); ++j)
                if (! used[edge[v][j].second])
                    h.push(edge[v][j]);
        }
        cout << fixed << setprecision(3) << res << endl;
    }
}

Measured memory_bytes: 1628
#include <iostream>

using namespace std;

int main () {
  int n,max,min,i;
  long long sum;
  int date[10001] ={0};
  cin >> n;
  for( i=0 ; i<n ; i++){
    cin >> date[i];
  }
  max=date[0];
  min=date[0];
  sum=date[0];

  for( i=1 ; i<n ; i++ ){ 
    if( max<date[i] )
      max=date[i];
    if( min>date[i] )
      min=date[i];
    sum+=date[i];
  }cout << min <<" "<< max <<" "<< sum << endl;
  return 0;
}

Measured memory_bytes: 1212
#include <stdio.h>

int main()
{
    int n;
    int c;

    while (scanf("%d", &n), n != 0) {
        int cnt[10] = {};

        for (int i = 0; i < n; i++) {
            scanf("%d", &c);

            cnt[c]++;
        }

        for (int i = 0; i < 10; i++) {
            if (cnt[i] == 0) {
                putchar('-');
            }
            else {
                for (int j = 0; j < cnt[i]; j++) {
                    putchar('*');
                }
            }

            putchar('\n');
        }
    }

    return 0;
}



Measured memory_bytes: 1924
def main2():
    n, m, k = list(map(int, input().split()))
    a_books = list(map(int, input().split()))
    b_books = list(map(int, input().split()))

    a, b = [0], [0]
    
    for i in range(len(a_books)):
        a.append(a[i] + a_books[i])

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


if __name__ == '__main__':
    main2()



Measured memory_bytes: 47548
N = int(input())
dic = [input()]
check = 0
for n in range(N-1):
    s = input()
    if s in dic:
        print('No')
        check = 1
        break
    else:
        if dic[-1][-1] == s[0]:
            dic.append(s)
        else:
            print('No')
            check = 1
            break
if check == 0:
    print('Yes')

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

int main() {
	// cin.tie(0);
	// ios::sync_with_stdio(false);
	/*
	    7!=7*2*3*5*2*2*3*2
	      = 2^4 * 3^2 * 5^1 * 7^1

	    2の数
	    7/2 = 3
	    3/2 = 1
	    1/2 = 0
	*/
	int N;
	scanf("%d", &N);

	//エラトステネスの篩
	vector<bool> isPrime(N + 1, true);
	isPrime[0] = false;
	isPrime[1] = false;
	for (int i = 2; i <= N; i++) {
		if (isPrime[i]) {
			for (int j = 2; j * i <= N; j++) {
				isPrime[j * i] = false;
			}
		}
	}
	// for (int i = 0; i < N; i++) {
	// 	cout << i << " " << isPrime[i] << "\n";
	// }

	long long result = 1;
	for (int i = 2; i <= N; i++) {
		if (isPrime[i]) {
			int j = N;
			int j_num = 0;
			while (j >= 1) {
				j /= i;
				j_num += j;
			}
			// cout << i << " " << j_num << "\n";
			result = (result * (j_num + 1)) % 1000000007;
		}
	}

	cout << result;
	return 0;
}

Measured memory_bytes: 256
L,R=map(int,input().split())
mod_min=2019
zero_judge=0
for i in range(L,R):
    if zero_judge==1:
        break
    else:
        for j in range(i+1,R+1):
            mod_calc=(i*j)%2019
            if mod_calc<mod_min:
                mod_min=mod_calc
                if mod_min==0:
                    zero_judge=1
                    break

print(mod_min)

Measured memory_bytes: 3060
#include<stdio.h>

int main() {
    int a,b,c;
    int t;

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

    if (a > b) {
        t = b;
        b = a;
        a = t;
    } 

    if (b > c) {
        t = c;
        c = b;
        b = t;
    }

    if (a > b) {
        t = b;
        b = a;
        a = t;
    }

    printf("%d %d %d\n",a,b,c);

    return 0;
}


Measured memory_bytes: 2040
import java.util.*

fun main(args: Array<String>) {
	val cin = Scanner(System.`in`)
	val n = cin.nextInt()
	val a = mutableListOf<Int>()

	for (i in 0 until n) {
		a.add(cin.nextInt())
	}
	a.reverse()

	println(a.joinToString(" "))
}


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

using namespace std;

string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < (int)s.length(); ++i) {
        if (i == 0) {
            cout << s[0];
        }
        if (i > 0 && i < (int)s.length() - 1 ) {
            cnt++;
        }
        if (i == (int)s.length() - 1) {
            cout << cnt << s[(int)s.length() - 1];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
# GaussJordan
module GaussJordan
  def self.calc(a)
    a.length.times do |k|
      pivot = a[k][k]
      i = k

      i.upto(a[k].length - 1) do |j|
        a[k][j] /= pivot
      end

      a.length.times do |j|
        if j != k
          d = a[j][k]
          l = k
          l.upto(a[k].length - 1) do |m|
            a[j][m] -= d * a[k][m]
          end
        end
      end
    end

    a
  end
end

while line = gets
  a, b, c, d, e, f = line.chomp.split.map(&:to_f)
  g = [[a, b, c], [d, e, f]]
  answer = GaussJordan.calc(g)
  puts sprintf('%.3f %.3f', answer[0][2] + 0.0, answer[1][2] + 0.0)
end

Measured memory_bytes: 8660
import sys


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    check = [0 for _ in range(N)]
    for a in A:
        check[a - 1] += 1
    for c in check:
        print(c)


if __name__ == "__main__":
    main()


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

int n, m;

int main() {
    cin >> n >> m;
    cout << (n + m) % 24 << endl;
    return 0;
}


Measured memory_bytes: 3608
#include<cstdio>
#include<algorithm>
#include<vector>
#include<deque>
#include<stack>
#include<queue>
#include<string>
#include<iostream>
#include<tuple>
#include<utility>
#include<set>
#include<queue>
#include<iomanip>
#include<iterator>
#include<map>
//#include<chrono>
//cout<<setprecision(12)
//fixed
//#include<random>
using namespace std;
typedef long long int llint;
typedef long double lldo;
const llint big=1e9+100000;
const int mod=1e9+7;
const lldo eps=1e-9;
const long double pai=3.141592653589793238462643;
#define mt make_tuple
#define mp make_pair
#define fir first
#define sec second
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define res resize
#define ins insert
#define era erase
#define dme(in) cout<<in<<endl;return 0
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
int main(void){
	int n;cin>>n;
	llint st=0,ue=1,mae=0;
	//st maeそのものの数
	//ue mae+1回合成する
	for(int i=0;i<=n;i++){
		llint q;
		if(i!=n){cin>>q;}else{q=1;}
		llint bai=0;
		for(bai=0;(1LL<<bai)<q;bai++){}
		if((1LL<<bai)==q){
			//cout<<"da"<<bai<<endl;
			st=min(st+abs(mae-bai),ue+abs(mae+1-bai));
			ue=st+1;
		}else{
			bai--;
			//cout<<"de"<<bai<<endl;
			llint nst=min(st+abs(bai-mae),ue+abs(bai-mae-1));
			llint nue=min(st+abs(bai+1-mae),ue+abs(bai+1-mae-1));
			ue=nst+1;
			st=nue+1;
		}
		mae=bai;
	}
	cout<<st/2<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <algorithm>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;

int main(){
  long n, k, sum; //モンスターの数、必殺技の数
  cin >> n >> k;
  long *h = new long[n];
  for(int i=0; i<n; i++){
    cin >> h[i]; //i番目のモンスターの体力
  }

  std::sort(h, h + n, std::greater<>());
  
  for(int i=0; i<n; i++){
    //cout << h[i];
    if(i < k){

    }else{
      sum+=h[i];
    }
  }

  cout << sum;
}

Measured memory_bytes: 1792
#include<stdio.h>


void sort(int data[], int n){
    int temp;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            if(data[i] > data[j]){
                temp = data[i];
                data[i] = data[j];
                data[j] = temp;

            }
        }
    }
}

double calc_max_mean(int data[], int n){
    double mean = 0;
    sort(data, n);
    for(int i = 0; i < n; i++){
        if(i == 0){
            mean = data[i];
        }else{
            mean = (mean + data[i]) / 2;
        } 
    }
    return mean;
}

int main(void){
    int n;
    scanf("%d", &n);
    int data[n];
    for(int i = 0; i < n; i++){
        scanf("%d", &data[i]);
    }
    printf("%lf\n", calc_max_mean(data, n));
    return 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main{
  Scanner cin = new Scanner(System.in);
  int N,M,K;
  P[] ps;
  private class P implements Comparable<P>{
    int a,b;
    public P(int a,int b){
      this.a = a;
      this.b = b;
    }

    public int compareTo(P p){
      if(this.a > p.a)return -1;
      if(this.a < p.a)return 1;

      if(this.b > p.b)return -1;
      if(this.b < p.b)return 1;
      return 0;
    }
  }

  public void solve(){
    N = cin.nextInt();
    M = cin.nextInt();
    K = cin.nextInt();
    ps = new P[N];
    for(int i = 0;i < N;i++){
      ps[i] = new P(cin.nextInt(),0);
    }

    for(int i = 0;i < N;i++){
      ps[i].b = cin.nextInt();
    }
    Arrays.sort(ps);
    int ans = 0;

    for(int i = 0;i < 1 << N;i++){
      int cnt = 0;
      for(int j = 0;j < N;j++){
        if(((i >> j) & 1 )== 1){
          cnt++;
        }
      }

      if(cnt <= K){
        int remain = M;
        int sum = 0;
        for(int j = 0;j < N;j++){
          if(((i >> j) & 1) == 1){
            sum += ps[j].a * Math.min(remain,ps[j].b);
            remain = remain - Math.min(remain,ps[j].b);
          }
        }
        ans = Math.max(ans,remain + sum);
      }
    }

    System.out.println(ans);

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

Measured memory_bytes: 26592
#include <iostream>
#include <algorithm>

int ndiv2( int x )
{
	int cnt = 0;
	while( x % 2 == 0 ) {
		x = x / 2;
		cnt += 1;
	}

	return cnt;
}

int main()
{
	int n;
	std::cin >> n;

	int a[ n ];
	for( int i = 0; i < n; i++ ) {
		std::cin >> a[ i ];
		a[ i ] = ndiv2( a[ i ] );
	}

	std::sort( a, a + n );
	std::cout << a[ 0 ] << std::endl;
	return 0;
}


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

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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

const int MAX = 1000000;
const int MOD = 1000000007;


int main(){
    int n;
    cin >> n;
    set<ll>st;
    rep(i, 0, n){
        ll p;
        cin >> p;
        st.insert(p);
    }
    if(st.size()==n){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()

using ll = std::int64_t;
using vint = std::vector<int>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

void Main() {
    int n;
    cin >> n;
    vint a(n);
    for (auto& x : a)
    {
        cin >> x;
    }

    vint left(n + 1), right(n + 1);
    left[0] = 0;
    right[0] = 0;
    for (int i = 0; i < n; ++i) {
        left[i + 1] = gcd(left[i], a[i]);
        right[i + 1] = gcd(right[i], a[n - 1 - i]);
    }

    int max_gcd = 1;
    rep(i, n) {
        int cur_gcd = gcd(left[i], right[n - 1 - i]);
        if (max_gcd < cur_gcd)max_gcd = cur_gcd;
    }
    cout << max_gcd << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1408
#include <iostream> 
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
long long x,y,n,d;
int ans = 0;
bool vis[1010101];
int main() {
	int k;
	scanf("%d",&k);
	int now = 7%k,ans = 1;
	while (now) {
		if (vis[now]) {
			printf("-1");
			return 0;
		}
		vis[now] = 1;
		now = (now*10+7)%k;
		ans++;
	}
	printf("%d\n",ans);
	return 0;
}
/*
4
8 3
2 3 2 1 3 3 2 1
6 3
2 3 2 3 2 3
8 3
2 3 2 1 3 3 2 1
12 4
1 2 3 4 4 3 2 1 2 4 1 3

*/

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

const int max_M = 100 + 21;

int N,M,cnt,A[max_M],b[max_M];

int main(){
	scanf("%d%d",&N,&M);
	for(int i=1;i<=M;++i){
		scanf("%d",A+i);
		if(A[i]&1)++cnt;
	}
	if(M==1){
		if(N==1)puts("1\n1\n1");
		else printf("%d\n2\n%d 1\n",N,N-1);
	}
	else{
		if(cnt>2)puts("Impossible");
		else{
			for(int i=1;i<=M;++i)
				if(A[i]&1){
					std::swap(A[1],A[i]);
					break;	
				}
			for(int i=M;i>1;--i)
				if(A[i]&1){
					std::swap(A[i],A[M]);
					break;	
				}
			for(int i=1;i<=M;++i)
				printf("%d%c",A[i]," \n"[i==M]);
			memcpy(b+1,A+1,sizeof(int)*M);
			--b[1],++b[M];
			if(!b[1]){
				printf("%d\n",M-1);
				for(int i=2;i<=M;++i)
					printf("%d%c",b[i]," \n"[i==M]);
			}
			else{
				printf("%d\n",M);
				for(int i=1;i<=M;++i)
					printf("%d%c",b[i]," \n"[i==M]);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())

f=[10**7 for x in range(2**n)]
for i in range(m):
  a,b = map(int,input().split())
  c = [int(x) for x in input().split()]
  s = 0
  for j in c:
    s += 2**(j-1)
  f[s]=min(f[s],a)

l=[]
for i in range(2**n):
  if f[i] != 10**7:
    l.append([i,f[i]])

v=[10**7 for x in range(2**n)]
v[0]=0

for s,a in l:
  for j in range(2**n):
    if v[j] != 10**7:
      v[j|s] = min(v[j|s], v[j]+a)

print(v[2**n-1] if v[2**n-1] != 10**7 else -1)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main() {
	int n;
	cin >> n;

	vector<int> vi(n);

	for (int i = 0; i < n; i++) {
		cin >> vi[i];
	}

	sort(vi.begin(), vi.end());

	int ans = 0;

	int abc = vi[n / 2 - 1];
	int arc = vi[n / 2 ];

	cout << arc - abc << endl;

}


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

int main() {
   int n;
   int ans = 0;
   int next = 1;
   cin >> n;
   vector<int> a(n);
   for (int i=0; i<n; i++) {
       cin >> a.at(i);
   }
   
   for (int i=0; i<n; i++) {
      ans++;
      if (a.at(next-1) == 2) {
          break;
      }
      next = a.at(next-1);
      if (i == n-1) {
          ans = -1;
      }
   }
   
   cout << ans << endl;

}

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

#define ll long long
#define ld long double
#define xx first
#define yy second
#define vi vector<int>
#define pii pair<int,int>
#define all(v) v.begin(),v.end()

#define MAX 400005

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

    ll x, n, p;
    cin >> x >> n;

    map<ll,ll> mp;
    for(int i=1;i<=n;i++)
    {
        cin >> p;
        mp[p]++;
    }

    ll d= INT_MAX, ans = 0;
    for(int i=-500;i<=500;i++)
    {
        if(mp[i]) continue;

        if(abs(i-x) < d)
        {
            ans = i;
            d = abs(i-x);
        }
    }


    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3680
S = input()

def F(L,R):
  # cnt, sum
  if R < L:
    return 1,0
  if L == R:
    return 1, int(S[L])
  c,s = 0,0
  for r in range(L,R+1):
    x = int(S[L:r+1])
    c1,s1 = F(r+1,R)
    c += c1
    s += x * c1 + s1
  return c,s

answer = F(0,len(S)-1)[1]
print(answer)

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

int main() {
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    rep(i,n) {
        ll h;
        cin >> h;
        if (h>=k) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#include <stdlib.h>
#include <stdio.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(10) << ans << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n,m;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


signed main(){
    cin >> n;
    vec(a,n);
    int ans=0;
    int x;
    REP(i,n){
        cin >> a[i];
    }
    for(int i = n-1;i >= 0;i--){
        int tmp1 = i+1;
        int tmp2 = tmp1*2;
        while(tmp2<=n){
            if(a[tmp2-1]%2==1){
                a[i]++;
            }
            tmp2 += tmp1;
        }
        if(a[i]%2 == 1){
            ans++;
        }
        
    }
    print(ans)
    REP(i,n){
        if(a[i]%2==1){
            cout << i+1 << " ";
        }
    }

    cout << endl;
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
int N;
int main(){
    cin>>N;
    LL ans=1;
    REP(i,N){
        ans*=(i+1);
        ans%=1000000007;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
 
template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}
 
const int N=5005,mod=1e9+7,inv2=(mod+1)/2;
int f[N][N],fac[N],rev[N],g[N],sz[N],t[N],n,x,y;
vi e[N];
 
int power(int x,int p){
	int res=1;
	for(;p;p>>=1,x=(ll)x*x%mod)
		if(p&1)res=(ll)res*x%mod;
	return res;
}
 
void dfs(int u,int fa){
	f[u][1]=sz[u]=1;
	for(auto v:e[u])
		if(v!=fa){
			dfs(v,u);
			fill(g,g+sz[u]+sz[v]+1,0);
			rep(a,1,sz[u])rep(b,0,sz[v])
				g[a+b]=(g[a+b]+(ll)f[u][a]*f[v][b])%mod;
			sz[u]+=sz[v];
			rep(a,1,sz[u])f[u][a]=g[a];
		}
	int sum=0;
	rep(i,1,sz[u])
		if(i%2==0&&f[u][i])
			sum=(sum+(ll)f[u][i]*t[i])%mod;
	f[u][0]=mod-sum;
}
 
int main(){
	read(n);
	fac[0]=1;
	rep(i,1,n)fac[i]=(ll)fac[i-1]*i%mod;
	rev[n]=power(fac[n],mod-2);
	per(i,n,1)rev[i-1]=(ll)rev[i]*i%mod;
	rep(i,1,n)if(i%2==0)
		t[i]=(ll)fac[i]*rev[i/2]%mod*power(inv2,i/2)%mod;
	rep(i,1,n-1){
		read(x),read(y);
		e[x].pb(y),e[y].pb(x);
	}
	dfs(1,0);
	printf("%d\n",(mod-f[1][0])%mod);
	return 0;
}

Measured memory_bytes: 97536
#include<iostream>

using namespace std;

int main(){
	int A,B,C,D;
	cin>>A>>B>>C>>D;
	
	if(A*B>C*D)cout<<A*B;
	else if(A*B<C*D)cout<<C*D;
	else cout<<A*B;
	
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <cmath>
#include <cstdio>

#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <map>
#include <set>
#include <vector>

using namespace std;

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

int h;
int n;

vector<int> a;

void input() {
  cin >> h >> n;
  
  a = vector<int>(n);
  for (auto&& i : a)
    cin >> i;
}

void solve1() {
  if (accumulate(a.cbegin(), a.cend(), 0ll) < h) {
    cout << "No";
    
    exit(0);
  }
  
  cout << "Yes";
}

int main() {
  preambule();
  input();
  solve1();
}

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

using namespace std;

#define MAXN 22

int men[MAXN];

long long  dp[MAXN][1<<MAXN];

int a[MAXN][MAXN];

int w;

#define mo 1000000007

vector <int> v[MAXN];

int main() {
    int n;
    cin >> n;

    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
            w += a[i][j] << j;
            men[i] += a[i][j] << j;
        }

    for (int mask = 0; mask < (1<<n);  mask++) {
        int ans = 0;
        int tmp = mask&men[0];
        //cout << "tmp = " << tmp << "    ";
        for (int k = 0; k < n; k++) {
            if ((tmp&(1<<k)) != 0) ans++;
        }
        dp[0][mask] += ans;
        //cout << "dp[0][" << mask << "] = " << ans << endl;
    }


    for (int mask = 1; mask < (1<<n); mask++) {
        int ans = 0;
        for (int k = 0; k < n; k++) {
            if ((mask>>k) & 1) {
               ans++;
            }
            //cout << ((mask>>k)&1) << " ";
        }
        //cout << "        " << ans << endl;
        v[ans].push_back(mask);
    }

    for (int i = 1; i < n; i++) {
        for (int mask: v[i+1]) {
            int tmp = mask & men[i];
            for (int k = 0; k < n; k++) {
                if (((tmp & mask) >> k) & 1) {
                   dp[i][mask] = (dp[i][mask] + dp[i-1][mask - (1 << k)]) % mo;

                }
            }

            //dp[i][mask]
            //cout << dp[i][(1<<n)-1] << endl;
        }
    }
    cout << dp[n-1][(1<<n)-1];
}

Measured memory_bytes: 343484
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
ll MOD = 1000000007;
#define INF (1e9)

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll M, N;
    cin >> N >> M;
    vector<string> A(N);
    vector<string> B(M);
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];
    bool flag = false;
    rep(i, N - M+1) {
        rep(j, N-M+1) {
            flag = false;
            rep(s, M) {
                rep(t, M) {
                    if (A[i+s][j+t] != B[s][t]) flag = true;
                }
            }
            if (!flag) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
s= gets.chomp
count=0
flag = false
flag2 = true
s[2..s.size-2].split("").each do |a|
  if a=="C"
    count+=1
    flag=true
  end
  if count>=2
    flag = false
    break
  end
end

s[1..s.size-1].split("").each do |a|
  if (a >="A" && "B">=a) || (a >="C" && "Z">=a)
    flag2==false
  break
  end
end

  if s[0]== "A" && flag ==true && flag2==true && (!(s[1] >="A" && "Z">=s[1])) && (!(s[s.size-1] >="A" && "Z">=s[s.size-1]))
  puts "AC"
else
  puts "WA"
end


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int a[15];
int main()
{
    int n,m;
    cin>>n>>m;
    a[1]=31;a[2]=29;a[3]=31;a[4]=30;a[5]=31;a[6]=30;a[7]=31;a[8]=31;a[9]=30;a[10]=31;a[11]=30;a[12]=31;
    if(a[m]==a[n])cout<<"Yes"<<endl;
    else  cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    string s;
    cin >> s;

    if((s[2] == s[3] )&&( s[4] == s[5])){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

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

int main() {
	ios_base::sync_with_stdio( false );

	string S;
	cin >> S;

	int64_t ans = 0;
	int x = 0;
	for( int i = 0; i < S.size(); ++i ) {
		if( S[i] == 'B' ) {
			x += 1;
		}
		else if( S[i] == 'W' ) {
			ans += x;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 720
#include<stdio.h>
#define N 200000

int main()
{
  int i, n, max, min;
  int R[N];
  
  scanf("%d",&n);
  
  for(i = 0; i < n; i++){
    scanf("%d",&R[i]);
  }

  min=R[0];
  max=R[1]-R[0];
  for(i = 1; i < n; i++){
    if(max < R[i]-min) max=R[i]-min;
    if(R[i] < min) min=R[i];
  }
  
  printf("%d\n", max);
  return 0;
}

Measured memory_bytes: 1376
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] input = sc.nextLine().split("[\\s]+");
        int N = Integer.parseInt(input[0]);
        int K = Integer.parseInt(input[1]);
        if(N % K == 0) {
            System.out.println(0);
        } else {
            System.out.println(1);
        }
    }
}

Measured memory_bytes: 22608
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Threading.Tasks;

class Sobaya
{
    static void Main(){
      new Sobaya().calc();
      return;
    }
      
    Scanner cin;
    
    void calc(){
        cin = new Scanner();
        int n = cin.nextInt();
        int i1;
        long[] a = new long[n+1];
        long[] b = new long[n];
        for(i1=0; i1<n+1; i1++) a[i1]=cin.nextInt();
        for(i1=0; i1<n; i1++) b[i1]=cin.nextInt();
        
        long remain=0;
        long ans = 0;
        for(i1=0; i1<n; i1++){
            remain = a[i1] + a[i1+1];
            if(remain<b[i1]){
                a[i1] = 0;
                a[i1+1] = 0;
                ans += remain;
            }else if(a[i1]<b[i1]){
                
                a[i1+1] -= b[i1]-a[i1];
                a[i1] = 0;
                ans += b[i1];
                //Console.WriteLine(a[i1+1]+"a");
            }else{
                ans+= b[i1];
            }
            //Console.WriteLine(ans);
        }
        Console.WriteLine(ans);

    }
}




class Scanner
{
    string[] s;
    int i;
 
    char[] cs = new char[] { ' ' };
 
    public Scanner()
    {
        s = new string[0];
        i = 0;
    }
 
    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }
 
    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }
 
    public long nextLong()
    {
        return long.Parse(next());
    }
 
    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }
 
    public double nextDouble()
    {
        return double.Parse(next());
    }
 
 
    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

int main()
{
	char str1[15];
	char str2[15];
	char str3[15];
	scanf("%s %s %s", str1, str2, str3);
	int len1;
	len1= strlen(str1);
	int len2;
	len2= strlen(str2);
	int len3;
	len3= strlen(str3);
	
	if (str1[len1-1] == str2[0] && str2[len2-1] == str3[0]){
			printf("YES\n");
		}
		else{
			printf("NO\n");
	}
		
	return 0;
}

Measured memory_bytes: 1656
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, m = [int(x) for x in input().split()]
    g = defaultdict(set)
    for _ in range(m):
        a, b = [int(x) for x in input().split()]
        g[a].add(b)
        g[b].add(a)
    
    for i in range(2, n):
        if 1 in g[i] and n in g[i]:
            print("POSSIBLE")
            return
    print("IMPOSSIBLE")



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

abc

"""


Measured memory_bytes: 83392
#include<stdio.h>
 int main(void){
  int x,i;
    int a[4];
  for(i=0;i<4;i++){
    scanf("%d",&a[i]);
    x =a[0]+a[1]+a[2]+a[3];
  }
  printf("%d\n", x/60);
  printf("%d\n", x%60);
  return 0;
}

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

int main(){
    int n; cin >> n;
    int p[n]; rep(i,n) cin >> p[i];
    int ans = 0;
    int now_min = p[0];
    rep(i,n){
        if(now_min >= p[i]){
            ans++;
            now_min = p[i];
        }
    }
    cout << ans << endl;
}

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

int main(){
	int a,b,c;
	int ansG,ansL1,ansL2;
	while(cin>>a>>b){
		ansL1=a;ansL2=b;
		if(a<b){
			int hoge=a;
			a=b;
			b=hoge;
		}
		while(true){
			if(a%b==0){
				ansG=b;
				break;
			}
			else{
				c=a%b;
				a=b;
				b=c;
			}
		}
		ansL1=ansL1/ansG;
		ansL2=ansL2/ansG;
		cout<<ansG<<" "<<ansG*ansL1*ansL2<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160