akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <bitset>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

const int MAXN = 5005;
const ll MOD = 1000000007;

struct Edge
{
	int to;
	int nxt;
}edge[MAXN << 1];

int n,id;
int first[MAXN];
int sz[MAXN];

ll fac[MAXN];
ll g[MAXN][2];
ll f[MAXN][MAXN][2];

void addE(int u,int v)
{
	edge[++id] = (Edge){v,first[u]};
	first[u] = id;
}

void dfs(int u,int fa)
{
	sz[u] = 1;
	f[u][1][0] = 1;
	for (int i = first[u];i;i = edge[i].nxt)
		if (edge[i].to != fa)
		{
			dfs(edge[i].to,u);
			for (int j = 0;j <= sz[u];j++)
			{
				g[j][0] = f[u][j][0];
				g[j][1] = f[u][j][1];
				f[u][j][0] = f[u][j][1] = 0;
			}
			for (int j = 0;j <= sz[u];j++)
				for (int k = 0;k <= sz[edge[i].to];k++)
				{
					(f[u][j + k][0] += g[j][0] * f[edge[i].to][k][0] + g[j][1] * f[edge[i].to][k][1]) %= MOD;
					(f[u][j + k][1] += g[j][0] * f[edge[i].to][k][1] + g[j][1] * f[edge[i].to][k][0]) %= MOD;
				}
			sz[u] += sz[edge[i].to];
		}
	if (~sz[u] & 1)
	{
		for (int i = 2;i <= sz[u];i += 2)
		{
			(f[u][0][0] += f[u][i][1] * fac[i]) %= MOD;
			(f[u][0][1] += f[u][i][0] * fac[i]) %= MOD;
		}
	}
}

int main()
{
	scanf("%d",&n);
	fac[0] = 1;
	for (int i = 2;i <= n;i += 2)
		fac[i] = fac[i - 2] * (i - 1) % MOD;
	for (int u,v,i = 1;i < n;i++)
	{
		scanf("%d%d",&u,&v);
		addE(u,v);
		addE(v,u);
	}
	dfs(1,0);
	printf("%lld\n",(f[1][0][1] - f[1][0][0] + MOD) % MOD);
	return 0;
}

Measured memory_bytes: 390912
package main

import (
	"fmt"
)

func gcd(a,b int64) int64 {
	if b==0 {
		return a
	}
	return gcd(b, a%b)
}

func main() {
	var a,b int64
	var c,d int64
	fmt.Scan(&a, &b, &c, &d)
	var l int64
	if c >= d {
		l = c/gcd(c,d) * d
	}else {
		l = d/gcd(d,c) * c
	}

	var minus int64 = (b/c - a/c) + (b/d - a/d) - (b/l - a/l)
	if a%c == 0 {
		minus++
	}
	if a%d == 0 {
		minus++
	}
	if a%l == 0 {
		minus--
	}
	var ans int64 = (b-a+1) - minus
	fmt.Println(ans)
}

Measured memory_bytes: 512
n = gets.to_i
a = 2.times.map{gets.split.map(&:to_i)}
for i in 1..n-1
  a[0][i] += a[0][i-1]
  a[1][-1-i] += a[1][-i]
end
ans = 0
for i in 0..n-1
  ans = [ans,a[0][i]+a[1][i]].max
end
puts ans

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

int findSumOfDigits (int n) {
  int sum =0;
  while (n>0) {
    int dig = n %10;
    sum = sum + dig;
    n = n/10;
  }
  return sum;
}

int main () {
  int n;
  cin >>n;
  
  int k = findSumOfDigits(n);
 // cout << "各桁の和 : "<< k << endl;
    
  if ((n%k) == 0){
  cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}
  

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

int main ()
{
  	typedef pair<int,int> pair; 
    int H,W;
    int A[500][500];
    cin >> H >> W;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> A[i][j];
        }
    }
  	vector<pair> P;
  	int N=0;
  	int cnt=0;
  	bool motteru=false;
  	for(int i=0;i<H;i++){
      if(i%2==0){
      	for(int j=0;j<W;j++){
        	if(motteru){
          	P.push_back(pair(i+1,j+1));//置く
        	}
        	if(A[i][j]%2==1){
          	motteru=!motteru;
        	}
        	if(motteru && (j!=W-1 || i!=H-1)){
          	P.push_back(pair(i+1,j+1));//拾う(最後は拾わない）
        	}
      	}
      }else if(i%2==1){
      	for(int j=W-1;j>=0;j--){
        	if(motteru){
          	P.push_back(pair(i+1,j+1));//置く
        	}
        	if(A[i][j]%2==1){
          	motteru=!motteru;
        	}
        	if(motteru && (j!=0 || i!=H-1)){
          	P.push_back(pair(i+1,j+1));//拾う(最後は拾わない）
        	}
      	}
      }
    }
  //出力
  cout << P.size()/2 << endl;
  for(int i=0;i<P.size()/2;i++){
    cout << P.at(2*i).first << " " << P.at(2*i).second << " " 
      << P.at(2*i+1).first << " " << P.at(2*i+1).second << endl;
  }
     
    return 0;
}








Measured memory_bytes: 5232
//
//  abc170_c.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
ll mod = 998244353;
ll INF = 1000000000000000000;
#define PI 3.14159265

ll limitpow (int x, int n) {
  if (n==0) return 1;
  ll u = limitpow(x, n/2);
  if (u > 1000000000 || u < 0) return -1;
  u = (u*u);
  if (u > 1000000000 || u < 0) return -1;
  if (n%2==1) u = (u*x);
  if (u > 1000000000 || u < 0) return -1;
  return u;
}

int main() {
  int x, n;
  cin >> x >> n;
  std::priority_queue<int> q;

  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    q.push(p);
  }

  int ans = 1003;
  for (int i = 101; i > -2; i--) {
    if (!q.empty()) {
      if (i == q.top()) {
        q.pop();
        continue;
      }
    }
    if (abs(i-x) <= abs(ans-x)) {
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main()
{
    long long N, K;
    cin >> N >> K;
    long long A[500] = {};
    long long sum = 0;
    vector<long long> d;
    for (long long i = 0; i < N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    for (long long i = 1; i * i <= sum; i++) {
        if (sum % i == 0) {
            d.push_back(i);
            if (i * i != sum) d.push_back(sum / i);
        }
    }

    sort(d.begin(), d.end(), greater<long long>());

    for (long long i = 0; i < d.size(); i++) {
        vector<long long> mod;
        for (long long j = 0; j < N; j++) {
            if (A[j] % d[i] > 0) mod.push_back(A[j] % d[i]);
        }
        if (mod.empty()) {
            cout << d[i] << endl;
            return 0;
        }
        sort(mod.begin(), mod.end());
        long long mod_sum = accumulate(mod.begin(), mod.end(), 0);
        if (mod_sum % d[i] > 0) continue;
        long long nstep = mod_sum;
        for (long long j = mod.size() - 1; j >= 0; j--) {
            nstep += - mod[j] + (d[i] - mod[j]);
            mod_sum -= d[i];
            if (mod_sum == 0) break;
        }
        if (mod_sum != 0) continue;
        nstep /= 2;
        if (nstep <= K) {
            cout << d[i] << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define strep(it,v) for(it=v.begin();it!=v.end_();++it)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
long long readLI(){  register char c;  for(c = getchar(); !(c>='0' && c<='9'); c = getchar());  register long long a=c-'0';
    for(c = getchar(); c>='0' && c<='9'; c = getchar())
        a = (a<<3)+(a<<1)+c-'0';
    return a;
}
const ll N = 1031;
ll n,i,k,a[N],ans;
int main()
{
   std::ios_base::sync_with_stdio(false); cin.tie(NULL);
   cin>>n>>k;
   rep(i,0,n){
      cin>>a[i];
      ans = ans + min(2*a[i],2*llabs(a[i] - k));
   }
   cout<<ans;
   return 0;
}


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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i=0; i<n; ++i) cin >> a.at(i);
  
  vector<int> cnt(1e5+1);
  for (int x : a) cnt.at(x)++;
  int res = -1;
  for (int i=1; i<1e5; ++i) {
    if (res < cnt.at(i-1) + cnt.at(i) + cnt.at(i+1)) res = cnt.at(i-1) + cnt.at(i) + cnt.at(i+1);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>                                                                       
using namespace std;                                                                           
                                                                                               
int main(){                                                                                    
                                                                                               
        string s;                                                                              
        cin >> s;                                                                              
        if(s == "ABC"){                                                                        
                cout << "ARC";                                                                 
        } else if(s == "ARC"){                                                                 
                cout << "ABC";                                                                 
        }                                                                                      
                                                                                               
        return 0;                                                                              
}   

Measured memory_bytes: 3576
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Author: z0marlin
Title: b.cpp
Time: 15-08-2019T14:10:09+0530 
I suck at CP T_T
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
#include <bits/stdc++.h>
#if DEBUG
#define dprintf(...) printf(__VA_ARGS__)
#else
#define dprintf(...)
#endif
#define FOR(i, a, n) for(int i = a; i < n; ++i)
#define FORE(a, v) for(auto a:v)
#define MAX(a, b) ((a>b)?a:b)
#define MIN(a, b) ((a<b)?a:b)
#define MP(i, j) make_pair(i, j)
#define PB(a) push_back(a)
#define PPB(a) pop_back(a)
#define all(a) a.begin(), a.end()

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii_t;
typedef pair<ll,ll> pll_t;
typedef vector<int> vi_t;
typedef vector<ll> vll_t;

const int MAX_SZ=1e6+2;
const int MOD=1e9+7;
int t = 1, n, m, q, ql, qr;
char ch;

int solve(){
    return 0;
}

int main(){
    // scanf("%d", &t);
    while(t--){
        q=0;
        scanf("%d", &n);
        FOR(i,1,n+1){
            scanf("%d", &m);
            if(m!=i) q++;
        }
        if(q>2) printf("NO\n");
        else printf("YES\n");
    }
}

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

int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  if (a + b + c == 17) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if(b>c)swap(b,c);
if(a>b)swap(a,b);
if(b>c)swap(b,c);
printf("%d"" " "%d"" " "%d\n",a,b,c);

return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n,m;
    cin >> n >> m;
    vector<int32> a(n);
    int64 ans = 0;
    REP(i,n){
        cin >> a[i];
        ans += a[i];
    }
    vector<pii> cb(m);
    REP(i,m){
        int32 b,c;
        cin >> b >> c;
        cb[i] = mp(c,b);
    }
    sort(ALL(cb), greater<pii>());
    int32 cbIndex = 0;
    int32 c,b;
    tie(c, b) = cb[cbIndex];
    sort(ALL(a));
    REP(i,n){
        if(b <= 0){
            cbIndex++;
            if(cbIndex >= m)break;
            tie(c, b) = cb[cbIndex];
        }
        if(a[i] >= c)continue;
        ans += c - a[i];
        b--;
    }
    // REP(i,n)cout << a[i] << " ";
    ANS(ans);
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

using cat = long long;

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector< pair<int, int> > A(N);
	for(int i =0; i < N; i++) {
		cin >> A[i].ff;
		A[i].ss = i;
	}
	sort(begin(A), end(A));
	vector<cat> ans(N, 0);
	set<int> S;
	for(int i = N-1; i >= 0; i--) {
		S.insert(A[i].ss);
		if(i == 0 || A[i-1].ff != A[i].ff)
			ans[*begin(S)] += (cat) S.size() * (A[i].ff - ((i == 0) ? 0 : A[i-1].ff));
	}
	for(int i = 0; i < N; i++) cout << ans[i] << "\n";
	return 0;}

// look at my code
// my code is amazing


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005

int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
    	ll i,j,k,l,m,n;
    	cin>>n>>k;
    	map<ll,ll> ma;
    	for(i=0;i<k;i++)
    	{
    		cin>>m;
    		for(j=0;j<m;j++)
    		{
    			cin>>l;
    			ma[l]=1;
    		}
    	}
    	ll ans=0;
    	for(i=1;i<=n;i++)
    		if(ma[i]==0) ans++;
    	cout<<ans;
    }
    return 0;
}

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

int n;
ll S[201010];
ll a[201010], K;
map<ll, ll> mp;
void solve() {
	scanf("%d%lld", &n, &K);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", a + i);
		S[i] = (S[i - 1] + a[i] - 1) % K;
		//sum-n%K=0;
	}
	ll ans = 0;
	for (int i = 0; i <= n; ++i) {
		ans += mp[S[i]];
		++mp[S[i]];
		if (i >= K - 1)--mp[S[i - K + 1]];
	}
	printf("%lld\n", ans);
}
int main() {
	solve();

	return 0;
}

Measured memory_bytes: 15872
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  int N;
  i64 a[105];

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

  i64 ans = INF;
  for (int k = -200; k <= 200; ++k) {
    i64 sum = 0;
    for (int i = 0; i < N; ++i) {
      sum += (a[i] - k) * (a[i] - k);
    }
    chmin(ans, sum);
  }

  cout << ans << endl;

  return 0;
}



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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		double xa = A * Math.Cos(Math.PI / 2.0 - (H + M / 60.0) * (Math.PI * 2.0 / 12.0));
		double ya = A * Math.Sin(Math.PI / 2.0 - (H + M / 60.0) * (Math.PI * 2.0 / 12.0));
		double xb = B * Math.Cos(Math.PI / 2.0 - M * (Math.PI * 2.0 / 60.0));
		double yb = B * Math.Sin(Math.PI / 2.0 - M * (Math.PI * 2.0 / 60.0));
		Console.WriteLine(Math.Sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb)));
		
	}
	int A,B,H,M;
	public Sol(){
		var d = ria();
		A = d[0]; B = d[1]; H = d[2]; M = d[3];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 18676
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int N, A, B;
	cin >> N >> A >> B;

	int ans1 = min(A, B);
	int ans2 = max(0, A + B - N);

		cout << ans1 << " ";
		cout << ans2 << "\n";		

	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    X = list(map(int, lines.pop(0).split(' ')))
    X.sort(reverse=True)
    sum_x  = X[0] - X[1]
    sum_x += X[0] - X[2]
    if sum_x % 2 == 0:
        print(sum_x // 2)
    else:
        print((sum_x // 2) + 2)

#
# main
#
lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Measured memory_bytes: 3060
#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(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n,t;
	vector <int> v;

	cin >> n;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		v.push_back(t);
	}

	int res = 0;

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

	cout << res << '\n';
	return 0;
}

Measured memory_bytes: 892
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		scan.close();
		
		n = n % 10;
		
		if(n == 3) {
			System.out.println("bon");
		}else if(n == 0 || n == 1 || n == 6 || n == 8) {
			System.out.println("pon");
		}else {
			System.out.println("hon");
		}
	}

}


Measured memory_bytes: 26996
#include<stdio.h>
#include<queue>
#include<algorithm>
using namespace std;
int a[100];
int main(){
int n;
a[1]=1;
a[2]=1;
scanf("%d",&n);
  for (int i=3;i<=n+1;i++)
    a[i]=a[i-1]+a[i-2];
    printf("%d\n",a[n+1]);
return 0;}

Measured memory_bytes: 2752
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e6 + 10;
int A, B, m;
int a[N], b[N];

int ans;
signed main() {
	ans = 1e9;
	cin >> A >> B >> m;
	int ans2 = 1e9;
	int ans3 = 1e9;
	for (int i = 1; i <= A; i++) {
		cin >> a[i];
		ans2 = min(ans2, a[i]);
	}
	for (int i = 1; i <= B; i++) {
		cin >> b[i];
		ans3 = min(ans3, b[i]);
	}

	for (int i = 1; i <= m; i++) {
		int x, y, c;
		cin >> x >> y >> c;
		ans = min(ans, a[x] + b[y] - c);
	}
	cout << min(ans, ans2 + ans3) << endl;
	
	return 0;
}

Measured memory_bytes: 5120
import java.util.Arrays;

public class Main {
  private static void solve() {
    int n = ni();
    long[] c = nal(n);
    Arrays.sort(c);

    int mod = (int) 1e9 + 7;

    long ret = 0;
    for (int i = 0; i < n; i++) {
      ret += c[n - i - 1] * (i + 2);
      ret %= mod;
    }
    System.out.println(pow(4, n - 1, mod) * ret % mod);


  }


  public static long pow(long a, long n, long mod) {
    // a %= mod;
    long ret = 1;
    int x = 63 - Long.numberOfLeadingZeros(n);
    for (; x >= 0; x--) {
      ret = ret * ret % mod;
      if (n << 63 - x < 0)
        ret = ret * a % mod;
    }
    return ret;
  }


  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


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

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

const int maxn = 200100;
const int offset = (1<<18);
const long long int inf = 1e18;

int n, m;

vector <vector <pair <int, int> > > izb;
vector <pair <int ,int> > vpii;

long long int dp[maxn];
long long int rj = 0;

struct tournament
{
    long long int maxi[2 * offset];
    long long int prop[2 * offset];
    void build()
    {
        REP(i, 0, 2 * offset) {maxi[i] = 0; prop[i] = 0;}
        return;
    }
    void saljiprop(int cvor)
    {
        int l = cvor * 2, r = cvor * 2 + 1;
        prop[l] += prop[cvor];
        maxi[l] += prop[cvor];
        prop[r] += prop[cvor];
        maxi[r] += prop[cvor];
        prop[cvor] = 0;
        return;
    }
    void update(int cvor, int a, int b, int l, int r, long long int kolko)
    {
        //cout << cvor << " " << a << " " << b << " " << l << " " << r << " " << kolko << endl;
        if(l > b || r < a) return;
        if(l >= a && r <= b)
        {
            prop[cvor] += kolko;
            maxi[cvor] += kolko;
            return;
        }
        saljiprop(cvor);
        int mid = (l + r) / 2;
        update(cvor * 2, a, b, l, mid, kolko);
        update(cvor * 2 + 1, a, b, mid + 1, r, kolko);
        maxi[cvor] = max(maxi[cvor * 2], maxi[cvor * 2 + 1]);
        return;
    }
    long long int dajmax(int cvor, int a, int b, int l, int r)
    {
        if(l > b || r < a) return -inf;
        if(l >= a && r <= b) return maxi[cvor];
        saljiprop(cvor);
        int mid = (l + r) / 2;
        return max(dajmax(cvor * 2, a, b, l, mid), dajmax(cvor * 2 + 1, a, b, mid + 1, r));
    }
}T;

int main()
{
    T.build();
    int l, r, a;
    scanf("%d%d", &n, &m);
    izb.insert(izb.begin(), n, vpii);
    REP(i, 0, m)
    {
        scanf("%d%d%d", &l, &r, &a);
        l--; r--;
        izb[r].push_back(make_pair(l, a));
        T.update(1, l, offset - 1, 0, offset - 1, -a);
    }
    REP(i, 0, n)
    {
        dp[i] = -T.dajmax(1, i, i, 0, offset - 1);
        //cout << dp[i] << endl;
        dp[i] = max(dp[i], dp[i] + T.dajmax(1, 0, i - 1, 0, offset - 1));
        T.update(1, i, i, 0, offset - 1, dp[i]);
        REP(j, 0, (int)izb[i].size())
        {
            T.update(1, izb[i][j].first, offset - 1, 0, offset - 1, izb[i][j].second);
        }
        rj = max(rj, dp[i]);
    }
    printf("%lld\n",rj);
    return 0;
}


Measured memory_bytes: 20992
import Data.List
import qualified Data.Map.Strict as M

main = do
    [n,_] <- map read . words <$> getLine
    m <- M.fromDistinctAscList . map (\xs -> (head xs, length xs)) . group . sort . map read . words <$> getContents
    let rs = map (\x -> M.findWithDefault 0 x m) [1..n]
    mapM_ print rs


Measured memory_bytes: 892
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var s = ReadLine();var min = int.MaxValue;
        for(var i=0;i<s.Length-2;i++)
        {
            var sd = ToInt32(s.Substring(i, 3));
            min = Min(Abs(sd - 753), min);
        }
        WriteLine(min);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 13268
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();	
		int[] a = new int[n];
		int sum = 0;
		int ans = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			sum+=a[i];
		}
		for(int i = 0; i < n; i++) {
			if(a[i]>=(double)sum/(4*m)) {
				ans++;
			}
		}
		if(ans>=m) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {

  int N;
  string S;
  cin >> N >> S;

  string ans = "Yes";
  if(N % 2 != 0) ans = "No";

  if(S.substr(0,N/2) != S.substr(N/2,N/2)) ans = "No";

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	unsigned int a;
	unsigned int b;
	unsigned int d;
	unsigned int  r;
	double f;

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

	if( a<0 || a>10000000000 || b<0 || b>10000000000 )
	{
		return 1;
	}

	d = a/b;
	r = a%b;
	f = (double)a/b;

	printf("%d %d %lf\n", d, r, f);

	return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#include <cmath>
#include <bitset>
#include <functional>
#include <limits>
#include <map>
using namespace std;

typedef long long ll;
#define rep2(i, n) for(ll i = 2; i <=(ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i <=(ll)(n); i++)
#define rep0(i, n) for(ll i = 0; i <=(ll)(n); i++)

ll pow(ll a, ll n) { //compute a^n with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}

ll pow(ll a, ll n, ll mod) { //compute a^n (mod mod) with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

const int MAX = 199;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//順列計算
ll PER(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[n - k] % MOD) % MOD;
}

int main(){
    ll x;
    cin >> x;
    if(x == 0) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

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

namespace test
{

    class Program
    {
        static void Main(string[] args)
        {
            List<string> resultList = new List<string>();

            string input;
            while ((input = Console.ReadLine()) != null)
            {
                string[] array = input.Split(',');
                double BMI = double.Parse(array[1]) / Math.Pow(double.Parse(array[2]), 2);

                if (BMI >= 25.0)
                {
                    resultList.Add(array[0]);
                }

            }

            if (resultList.Count == 0)
            {
                Console.WriteLine("該当なし");
            }
            else
            {
                foreach (string s in resultList)
                {
                    Console.WriteLine(s);
                }
            }


        }


        
    }
}

Measured memory_bytes: 5740
#include<iostream>

using namespace std;

bool is_prime(int n){
    if(n == 1) return false;
    if(n == 2 || n == 3 || n == 5) return true;
    for(int d = 2;d*d <= n;d++){
        if(n % d == 0) return false;
    }
    return true;
}

int main(){
    int N,pcnt = 0;
    cin >> N;
    for(int i=0;i < N;i++){
        int a;
        cin >> a;
        if(is_prime(a)) pcnt++;
    }
    cout << pcnt << endl;
    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#include <cstdint>
#include <sys/time.h>

typedef std::int_fast32_t  s32;
typedef std::uint_fast32_t u32;
typedef std::int_fast64_t  s64;
typedef std::uint_fast64_t u64;

const unsigned long mod = 1000000007;
const double EPS = 0.00000001;
const int INF = (1 << 29);

typedef std::pair<int, int> pii;

template<typename T>
void print_array(T *A_, s32 size) {
  //printf("%d\n", size);
  if( size != 0 ) {
    for(int i = 0; i < size - 1; ++i) {
      printf("%d ", A_[i]);
    }
    printf("%d\n", A_[size - 1]);
  }
}

int solve(int m, int i, int j, int k, int l) {
  int total = i * 10 + j * 50 + k * 100 + l * 500; 
  if( total < m ) return -1;
  int diff = total - m;
  int res = 0;
  res += (diff / 10 % 10) % 5 + (diff / 10 % 10) / 5;
  res += (diff / 100 % 10) % 5 + (diff / 100) / 5;
  return res;
}
  

auto main() -> int {

  for(int t = 0; ; ++t) {
    int m;
    std::cin >> m;
    if( m == 0 ) break;

    int a, b, c, d;
    std::cin >> a >> b >> c >> d;

    int res[4] = {};
    int res2 = INF;
      
    for(int i = 0; i <= a; ++i) {
      for(int j = 0; j <= b; ++j) {
        for(int k = 0; k <= c; ++k) {
          for(int l = 0; l <= d; ++l) {
            int x;
            if( (x = solve(m, i, j, k, l)) >= 0 ) {
              if( res2 > a + b + c + d - i - j - k - l + x ) {
                res2 = a + b + c + d - i - j - k - l + x;
                res[0] = i;
                res[1] = j;
                res[2] = k;
                res[3] = l;
              }
            }
          }
        }
      }
    }

    if( t != 0 ) std::cout << std::endl;
    if( res[0] != 0 ) std::cout << 10 << ' ' << res[0] << std::endl;
    if( res[1] != 0 ) std::cout << 50 << ' ' << res[1] << std::endl;
    if( res[2] != 0 ) std::cout << 100 << ' ' << res[2] << std::endl;
    if( res[3] != 0 ) std::cout << 500 << ' ' << res[3] << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int n;
int main()
{
cin>>n;
if(n==25)cout<<"Christmas"<<endl;
if(n==24)cout<<"Christmas Eve"<<endl;
if(n==23)cout<<"Christmas Eve Eve"<<endl;
if(n==22)cout<<"Christmas Eve Eve Eve"<<endl;

return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include<vector>
#include<queue>
#define ll long long
#define inf INT_MAX
int d[200000][3];
main()
{
memset(d,0,sizeof(d));
 ll int n;
 cin>>n;
 int a[n][3];
 for(int i=0;i<n;i++)
 {
 	for(int j=0;j<3;j++)
 	cin>>a[i][j];
 }
 for(int i=0;i<3;i++)
 {
 	d[0][i]=a[0][i];
 }
 for(int i=1;i<n;i++)
 {
 	for(int j=0;j<3;j++)
 	{
 		if(j==0)
 		d[i][j]=max(d[i-1][1]+a[i][0],d[i-1][2]+a[i][0]);
 		if(j==1)
 	    d[i][j]=max(d[i-1][0]+a[i][1],d[i-1][2]+a[i][1]);
 	    if(j==2)
 	    d[i][j]=max(d[i-1][1]+a[i][2],d[i-1][0]+a[i][2]);
	 }
 }
/* for(int i=0;i<n;i++)
 for(int j=0;j<3;j++)
 cout<<d[i][j]<<" ";
 cout<<endl;*/
 cout<<max(d[n-1][0],max(d[n-1][1],d[n-1][2]))<<endl;;
}


Measured memory_bytes: 3712
N,P = map(int,input().split())
A = list(map(int,input().split()))

A = [a % 2 for a in A]

acc = [1] * 60
for i in range(60):
  if i == 0:
    continue
  acc[i] = acc[i-1] * i

odd = sum(A)
even = N - odd

ans = 0
if P == 0:
  # 奇数から偶数個
  j = 0
  for i in range(0,odd+1,2):
    j += acc[odd] // (acc[odd-i] * acc[i])

else:
  # 奇数から奇数個
  j = 0
  for i in range(1,odd+1,2):
    j += acc[odd] // (acc[odd-i] * acc[i])
  
ans = 0
for i in range(even+1):
  k = acc[even] // (acc[even-i] * acc[i])
  ans += k * j
  
print(ans)
                        


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

char s[2];
int cnt[1000];
int main() {
	int n;
	while (scanf("%d", &n), n) {
		set<int>se;
		memset(cnt, 0, sizeof(cnt));
		int t = 0;
		rep(i, n) {
			int h, m, p; scanf("%*d/%*d%d:%d%s%d", &h, &m, &s, &p);
			h = h * 60 + m;
			if (se.count(0)) {
				for (int j : se)cnt[j] += h - t;
			}
			t = h;
			if (s[0] == 'I')se.insert(p);
			else se.erase(p);
		}
		printf("%d\n", *max_element(cnt + 1, cnt + n));
	}
}

Measured memory_bytes: 3128
package main

import (
	"fmt"
)

func main() {
  var a, b int
  fmt.Scanf("%d %d", &a, &b)
  ans := a * b
  if a > 9 {
    ans = -1
  }
  if b > 9 {
    ans = -1
  }
  
  fmt.Printf("%d\n", ans)
}

Measured memory_bytes: 1832
import java.util.Scanner;

public class Main{
	public static Scanner sc;
	public static void main(String[] args){
		sc=new Scanner(System.in);
		int a=sc.nextInt(),b=sc.nextInt();
		Double C=Math.PI*(sc.nextInt())/180;
		Double S=a*b*(Math.sin(C))/2;
		Double c=Math.sqrt(a*a+b*b-2*a*b*(Math.cos(C)));
		Double L=a+b+c;
		Double h=2*S/a;
		System.out.println(S);
		System.out.println(L);
		System.out.println(h);
	}

}

Measured memory_bytes: 26232
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

int main() {
	string s;
	cin >> s;
	int K;
	cin >> K;

	set<string> st;
	for (int i = 1; i <= K; ++i) {
		for (int j = 0; j < s.size(); ++j) {
			if (i + j <= s.size()) {
				string sub = s.substr(j, i);
				st.insert(sub);
			}
		}
	}
	
	auto itr = st.begin();
	for (int i = 1; i < K; ++i) { ++itr; }

	cout << *itr << endl;

	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define bit(x) (1LL << x)
#define PI acos(-1.0)
#define EPS 1e-9

#define mod 1000000007
#define maxn 105

using namespace std;

using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///All indexing is 0-based
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

typedef long long ll;
typedef double ld;
typedef pair<int, int> par;

ll N,a,b,c,d;
char s[maxn];
int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> N >> s;

    a = strlen(s);
    if(a<=N)
        cout << s;
    else{
        s[N]='\0';
        cout << s << "...";
    }
















}


Measured memory_bytes: 3612
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    string s;
    cin >> s;
    cout << s.substr(0, 3) << endl;
    return 0;
}

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

using namespace std;
int main(){
	string s;
	cin >> s;
	int i,j,n = s.size(),ans = 0;
	for(i=0;i<n;i++){
		for(j=i;j<n;j++){
			if(s[j]!='A' && s[j]!='G' && s[j]!='C' && s[j]!='T'){
				ans = max(ans,j - i);
				break;
			}
			if(j==n-1) ans = max(ans,j - i + 1);
		}
	}
	cout << ans << endl;
}
			

Measured memory_bytes: 256
while True:
    H,W=map(int, input().split())
    if H == 0 and W == 0:
        break
 
    for i in range(H):
        for j in range(W):
            if (i+j)%2 == 0:
                print("#", end="")
            else:
                print(".", end="")
        print("")
    print("")



Measured memory_bytes: 7008
#include<stdio.h>

int main(){

  int A[45],n,i;

  scanf("%d",&n);

  A[0] = 1;
  A[1] = 1;

  for(i=2;i<n+1;i++)
    A[i] = A[i-1] + A[i-2];

  printf("%d\n",A[n]);

  return 0;
}

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

int main() {
  int N, K, s;
  cin >> N >> K;
  s = 0;
  vector<int> math(N);
  for (int i = 0; i < N; i++) {
    cin >> math.at(i);
    int s1, s2;
    s1 = math.at(i);
    s2 = K - math.at(i);
    if (s1 < s2) {
      s += s1;
    }
    else {
      s += s2;
    }
  }
  cout << s*2 << endl;
}

Measured memory_bytes: 256
a = raw_input().split(" ")
W = int(a[0])
H = int(a[1])
x = int(a[2])
y = int(a[3])
r = int(a[4])
if (x - r) >= 0 and (x + r) <= W and (y - r) >= 0 and (y + r) <= H:
    print "Yes"
else:
    print "No"

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

namespace ConsoleApp19
{
    class Program
    {
        static void Main(string[] args)
        {
            string moji = Console.ReadLine();
            int a = moji.Length;
            string[] ijmo = new string[a];
            for (int i = 0; i < a; i += 1)
            {
                char c = moji[a-i-1];
                ijmo[i] = c.ToString();
            }
            if (a == 0)
            {
                Console.WriteLine();
                Console.ReadLine();
            }
            else
            {
                string ans = ijmo[0];
                for (int i = 1; i < a; i += 1)
                {
                    ans = ans + ijmo[i];
                }

                Console.WriteLine(ans);
                Console.ReadLine();
            }
        }
    }
}



Measured memory_bytes: 7724
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int r, g, b;
	cin >> r >> g >> b;
	int a = (r * 100) + (g * 10)+ b;
	
	if(a % 4 == 0){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

void calc(string s, string t) {
    ulong start = 0;
    ptrdiff_t p;
    while ((p = s.indexOf(t, start)) != -1) {
        writeln(p);
        start = p + 1;
    }
}

void main() {
    auto s = readln.chomp;
    auto t = readln.chomp;
    calc(s, t);
}

Measured memory_bytes: 2528
#include <array>
#include <iostream>
#include <string>

int main() {
  uint32_t N = 0;
  std::cin >> N;

  std::array<uint32_t, 100> A;
  for (size_t i = 0; i < N; i++) std::cin >> A[i];

  for (size_t i = 0; i < N; i++) {
    uint32_t a_i = A[i];
    for (size_t j = 0; j < i; j++) {
      if (A[(i - 1) - j] < a_i) break;

      A[(i - 1) - j + 1] = A[(i - 1) - j];
      A[(i - 1) - j] = a_i;
    }

    for (size_t k = 0; k < N - 1; k++) std::cout << A[k] << " ";
    std::cout << A[N - 1] << std::endl;
  }

  return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll)x.size()
#define hell            1000000007
#define inf             (ll)1e18 + 5
#define PI              (double)3.14159265358979323844
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n,m;
    cin>>n>>m;
    ll arr[n];
    rep(i,0,n)cin>>arr[i];
    vi a[n+1];
    rep(i,0,m){
    	ll x,y;
    	cin>>x>>y;
    	a[x].pb(y);
    	a[y].pb(x);
    }
    ll ans=0;
    rep(i,1,n+1){
    	bool flag=1;
    	rep(j,0,sz(a[i])){
    		if (arr[a[i][j]-1]>=arr[i-1]){
    			flag=0;
    		}
    	}
    	if (flag){
    		ans++;
    	}
    }
    cout<<ans<<endl;
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 10220
#include <iostream>
#include <algorithm>
#define llint long long

using namespace std;

llint n;
llint p[8], q[8];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 0; i < n; i++) cin >> p[i];
	for(int i = 0; i < n; i++) cin >> q[i];
	
	for(int i = 0; i < n; i++){
		if(p[i] < q[i]) break;
		if(p[i] > q[i]){
			for(int j = 0; j < n; j++) swap(p[j], q[j]);
			break;
		}
	}
	
	llint cnt = 0;
	do{
		bool flag = true;
		for(int i = 0; i < n; i++){
			if(p[i] != q[i]) flag = false;
		}
		if(flag) break;
		cnt++;
	}while(next_permutation(p, p+n));
	cout << cnt << endl;
	
	return 0;
}

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

typedef long long ll;

int main(void) {
	ll A, B, N;
	cin >> A >> B >> N;

	ll x = N;
	if (N > B - 1)
		x = B - 1;
	ll ans = (A * x) / B - A * (x / B);

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A+B>C+D){
    cout << "Left" << endl;
  }
  else if(A+B==C+D){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n;
    cin >> n;
    multiset<int> rest;
    for(int i=0; i<(1<<n); ++i){
        int a;
        cin >> a;
        rest.insert(a);
    }

    multiset<int> curr;
    curr.insert(*rest.rbegin());
    rest.erase(--rest.end());

    for(int i=0; i<n; ++i){
        multiset<int> next = curr;
        for(int a : curr){
            auto it = rest.lower_bound(a);
            if(it == rest.begin()){
                cout << "No" << endl;
                return 0;
            }
            -- it;
            next.insert(*it);
            rest.erase(it);
        }
        curr = move(next);
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 18688
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdio>
using namespace std;
int a[26]; bool OK = false; string S;
int main() {
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		a[S[i] - 'a']++;
	}
	for (int i = 0; i < 26; i++)if (a[i] % 2 == 1)OK = true;
	if (OK == false)cout << "Yes" << endl;
	else { cout << "No" << endl; }
	return 0;
}


Measured memory_bytes: 256