akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

//((Cで割りきれない)かつ(Dで割りきれない))の補集合は((Cで割りきれる)または(Dで割り切れる))
//補集合で考えてみる
//1からBまでと1からA-1までの二つのグループで見てみる

int GCD(long long i, long long j) {
    long long k, l;
    if (i >= j) {
        k = i;
        l = j;
    }else{
        k = j;
        l = i;
    }
    long long m;
    m = k % l;
    if (m == 0) {
        return l;
    }else{
        return GCD(l, m);
    }
}
long long LCM(long long i, long long j) {
    return i*j/GCD(i, j);
}
    
int main() {
    long long A, B, C, D;
    cin >> A >> B >> C >> D;
    long long p, q, r, ans1;
    p = (A-1) / C;
    q = (A-1) / D;
    r = (A-1) / LCM(C, D);
    //1からA-1までの補集合
    ans1 = p + q - r;
    long long s, t, u, ans2;
    s = B / C;
    t = B / D;
    u = B / LCM(C, D);
    //1からBまでの補集合
    ans2 = s + t - u;
    long long ans;
    ans = B - A + 1 - (ans2 - ans1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
   set<int> s;
   int q;
   cin >> q;
   for(int i = 0; i < q; i++){
	  int cmd;
	  cin >> cmd;
	  if (cmd == 0){
		   int val;
		   cin >> val;
		   s.insert(val);
		   cout << (int)s.size() << endl;
		}
      if (cmd == 1){
		  int val;
		  cin >> val;
		  if (s.find(val) == s.end()) cout << 0 << endl;
		  else cout << 1 << endl;  
		}   
	}
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int area1 = a * b, area2 = c * d;
    if (area1 > area2)
        OP(area1);
    else
        OP(area2);
    return 0;
}

Measured memory_bytes: 384
use std::cmp;

fn main(){
  let nk: Vec<usize> = read_vec();
  let n = nk[0];
  let k = nk[1];

  let mut bk: Vec<Vec<usize>> = vec![Vec::new(); 11];

  for _ in 0 .. n {
    let cg: Vec<usize> = read_vec();
    let c = cg[0];
    let g = cg[1];
    bk[g].push(c);
  }

  for i in 1 .. 11 {
    bk[i].sort();
  }

  let mut cv: Vec<Vec<usize>> = vec![vec![0];11];

  for g in 1 .. 11 {
    let mut c = 0;
    let l = bk[g].len();
    
    for i in 1 .. l+1 {
      c += bk[g][l-i];
      cv[g].push(c + i * (i-1));
    }
  }

  let mut dp0: Vec<usize> = vec![0; k + 1];
  
  for i in 0 .. cmp::min(cv[1].len(), k + 1) {
    dp0[i] = cv[1][i];
  }
  
  for g in 2 .. 11 {
    let mut dp1: Vec<usize> = vec![0; k + 1];
    
    for i in 1 .. k + 1 {
      let mut c : usize = 0;
      
      for j in 0 .. cmp::min(cv[g].len(), i + 1) {
        c = cmp::max(c, dp0[i-j] + cv[g][j]);
      }
      
      dp1[i] = c;
    }
    
    dp0 = dp1;
  }
  
  println!("{}", dp0[k]);
}

fn read_vec<T>() -> Vec<T>
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.split_whitespace().map(|e| e.parse().unwrap()).collect()
}



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

int main(){
    int x, n;
    cin >> x;
    n = x / 100;

    for(int i = 1; i <= x;i++ ){
        if(100 * i  <= x && x <= 105  * i){
            cout << 1;
            return 0;
        }
    }
    cout << 0;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = sc.nextInt();
    int t = sc.nextInt();
    int count = 0;
    int now = 0;
    while(n>now){
      count++;
      now += x;
    }
    System.out.println(count * t);
  }
}


Measured memory_bytes: 35608
import collections

n = int(input())
a = list(map(int,input().split()))

#累積和
s = [0]*(n+1)
for i in range(n):
    s[i+1] = s[i] + a[i]

count = list(collections.Counter(s).values())#sの中で重複しているものの数のリストをcountの中に収納

ans = 0
for i in count:
    ans += (i)*(i-1)//2
print(ans)


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

int main() {
  int p, q, r;
  cin >> p >> q >> r;
  
  int ans = p + q + r - max(p, max(q, r));
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(ll (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(ll (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define MAX 100005
using namespace std;
const ll MOD=1e9+7;

ll gcd(ll a, ll b) {
  if(a==0) return b;
  if(a>b) return gcd(a%b, b);
  else return gcd(b%a, a);
}
ll lcm(ll a, ll b) {
  ll tmp=gcd(a,b);
  ll ta=a/tmp,tb=b/tmp;
  return ta*tb*tmp;
}

int main(){
  ll N,sum;
  cin >> N;
  cin >> sum;
  rep(i,N-1){
    ll tmp;
    cin >> tmp;
    sum=lcm(sum,tmp);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
h, w = map(int,input().split())
picture = [input() for _ in range(h)]
flag = True

for i in range(h):
    for j in range(w):
        if picture[i][j] == "#":
            if i == 0:
                if j == 0:
                    if picture[i+1][j] != "#" and picture[i][j+1] != "#":
                        flag = False
                        break
                elif j == w-1:
                    if picture[i+1][j] != "#" and picture[i][j-1] != "#":
                        flag = False
                        break
                else:
                    if picture[i+1][j] != "#" and picture[i][j+1] != "#" and picture[i][j-1] != "#":
                        flag = False
                        break
            elif i == h-1:
                if j == 0:
                    if picture[i-1][j] != "#" and picture[i][j+1] != "#":
                        flag = False
                        break
                elif j == w-1:
                    if picture[i-1][j] != "#" and picture[i][j-1] != "#":
                        flag = False
                        break
                else:
                    if picture[i-1][j] != "#" and picture[i][j+1] != "#" and picture[i][j-1] != "#":
                        flag = False
                        break
            else:
                if j == 0:
                    if picture[i+1][j] != "#" and picture[i-1][j] != "#" and picture[i][j+1] != "#":
                        flag = False
                        break
                elif j == w-1:
                    if picture[i+1][j] != "#" and picture[i-1][j] != "#" and picture[i][j-1] != "#":
                        flag = False
                        break
                else:
                    if picture[i+1][j] != "#" and picture[i-1][j] != "#" and picture[i][j+1] != "#" and picture[i][j-1] != "#":
                        flag = False
                        break

if flag:
    print("Yes")
else:
    print("No")

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

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(a) (a).begin(),(a).end()

int main() {
    int n;
    cin >> n;
    vector<int> s(n);
    REP(i, n) cin >> s[i];

    int q;
    cin >> q;
    int ans = 0;
    REP(i, q) {
        int t;
        cin >> t;
        if (binary_search(ALL(s), t)) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
char itoa(int n) { return n + '0';}
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 = in();
  ll ans = 0;
  rrep(i,n) {
    if (!(i%3==0 || i%5==0)) ans += i;
  }
  cout << ans << endl;
  return 0;
}

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

//vector<int> to[100005], co[100005]; 

int main() {
    int n;
    cin >> n;
    vector<vector<int>> to(n), co(n);
    rep(i,n-1) {
      int a, b, w;
      cin >> a >> b >> w;
      a--; b--;
      to[a].push_back(b); co[a].push_back(w);
      to[b].push_back(a); co[b].push_back(w);
    }
    vector<int> ans(n, -1);
    queue<int> q;
    ans[0] = 0;
    q.push(0);
    while (!q.empty()) {
      int v = q.front(); q.pop();
      rep(i,to[v].size()) {
        int u = to[v][i];
        int w = co[v][i];
        if (ans[u] != -1) continue;
        ans[u] = (ans[v]+w)%2;
        q.push(u);
      }
    }
    rep(i,n) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 14368
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		String[] line = br.readLine().split(" ");
		int n = Integer.parseInt(line[0]);
		int m = Integer.parseInt(line[1]);
		int l = Integer.parseInt(line[2]);
		int[][] A = new int[n][m];
		int[][] B = new int[m][l];
		long c = 0;

		for(int i = 0; i < n; i++) {
			String row = br.readLine();
			String[] elem = row.split(" ");
			for(int j = 0; j < m; j++) {
				A[i][j] = Integer.parseInt(elem[j]);
			}
		}

		for(int i = 0; i < m; i++) {
			String row = br.readLine();
			String[] elem = row.split(" ");
			for(int j = 0; j < l; j++) {
				B[i][j] = Integer.parseInt(elem[j]);
			}
		}

		for(int i = 0; i < n; i++) {
			for(int j = 0; j < l; j++) {
				c = 0;
				for(int k = 0; k < m; k++) {
					c += A[i][k] * B[k][j];
				}
				sb.append(c);
				if(j != l-1) {
					sb.append(" ");
				}
			}
			sb.append("\n");
		}
		System.out.print(sb);
	}
}

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

using namespace std;

vector<int> solve(int N, const vector<int>& vs) {
    vector<int> balls(N + 1);

    for (int i = N; i > 0; i--) {
        int cnt = 0;
        for (int j = i; j <= N; j += i) {
            cnt += balls[j];
        }
        cnt %= 2;
        if (vs[i] != cnt) {
            balls[i] = 1;
        }
    }

    vector<int> result;
    for (int i = 1; i <= N; i++) {
        if (balls[i] > 0) {
            result.push_back(i);
        }
    }

    return result;
}

int main() {
    int N; cin >> N;
    vector<int> vs(N + 1);
    for (int i = 1; i <= N; ++i) {
        cin >> vs[i];
    }

    vector<int> result = solve(N, vs);
    cout << result.size() << endl;

    for (int i = 0; i < result.size(); ++i) {
        if (i) {
            cout << ' ';
        }
        cout << result[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 2428
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = GetInt();

            int ans = new int();

            int[] A = GetInts(N);
            int[] B = GetInts(N);
            int[] C = GetInts(N - 1);

            ans = B.Sum();

            for(int i = 1; i < N; i++)
            {
               if(A[i-1]+1 == A[i])
                {
                    ans += C[A[i - 1]-1];
                }
            }

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


public static class MyIO
{
    private static string[] args = null;
    private static int num = -1;
    private static int used = -1;

    private static string getArg()
    {
        if (used == num)
        {
            args = Console.ReadLine().Split(' ');
            num = args.Length;
            used = 0;
        }
        return args[used++];
    }

    public static int GetInt() => int.Parse(getArg());
    public static long GetLong() => long.Parse(getArg());
    public static double GetDouble() => double.Parse(getArg());
    public static string GetString() => getArg();
    public static char GetChar() => getArg()[0];
    public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
    public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
    public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
    public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define co(i) cout<<(i)<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
#define all(i) i.begin(),i.end()
#define pint pair<int, int>
#define vint vector<int>
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;
//const int MOD=998244353;

const int max_n=200001;
ll bit[max_n+1];
//1-index

ll find_max(int i){
	ll s=-INF;
	while(i>0){
		s=max(s,bit[i]);
		i -= i & -i;
	}
	return s;
}

//iの値にx加える
void add(int i, ll x){
	while(i<=max_n){
		bit[i]=max(x,bit[i]);
		i += i & -i;
	}
}

ll a[max_n],dp[max_n+1];
int main(){
	int n; cin>>n;
	int h[max_n];
	FOR(i,0,n) cin>>h[i];
	FOR(i,0,n) cin>>a[i];
	FOR(i,0,n){
		dp[h[i]]=find_max(h[i])+a[i];
		add(h[i],dp[h[i]]);
	}
	ll ans=0;
	FOR(i,0,n+1){
		ans=max(ans,dp[i]);
	}
	co(ans);
}


Measured memory_bytes: 5760
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;

int main(){
	int N;
	scanf("%d", &N);
	int x[N], y[N], h[N];
	for (int i = 0; i < N; ++i){
		scanf("%d %d %d", x + i, y + i, h + i);
	}
	for (int C_X = 0; C_X <= 100; ++C_X){
		for (int C_Y = 0; C_Y <= 100; ++C_Y){
			int isnt0 = 0;
			while(!h[isnt0]) isnt0++;
			int h_top = h[isnt0] + abs(x[isnt0] - C_X) + abs(y[isnt0] - C_Y);
			bool flag = true;
			for (int i = 0; i < N; ++i){
				if(max(h_top - abs(x[i] - C_X) - abs(y[i] - C_Y), 0) != h[i]){
					flag = false;
					break;
				}
			}
			if(flag){
				printf("%d %d %d\n", C_X, C_Y, h_top);
				return 0;
			}
		}
	}
	return 0;
}

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

    using namespace std;

    typedef long long int ll;
    #define MOD (ll)(1e9+7)
    #define endl "\n"
    #define pb push_back
    #define TEST_CASES  ll t;cin>>t;while(t--)
    #define forn(i,a,n) for (int i = a; i < n; ++i)
    #define f first
    #define s second
    #define all(x) x.begin(), x.end()

    void __print(int x) {cerr << x;}
    void __print(long x) {cerr << x;}
    void __print(long long x) {cerr << x;}
    void __print(unsigned x) {cerr << x;}
    void __print(unsigned long x) {cerr << x;}
    void __print(unsigned long long x) {cerr << x;}
    void __print(float x) {cerr << x;}
    void __print(double x) {cerr << x;}
    void __print(long double x) {cerr << x;}
    void __print(char x) {cerr << '\'' << x << '\'';}
    void __print(const char *x) {cerr << '\"' << x << '\"';}
    void __print(const string &x) {cerr << '\"' << x << '\"';}
    void __print(bool x) {cerr << (x ? "true" : "false");}

    template<typename T, typename V>
    void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
    template<typename T>
    void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
    void _print() {cerr << "]\n";}
    template <typename T, typename... V>
    void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
    #ifndef ONLINE_JUDGE
    #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
    #else
    #define debug(x...)
    #endif
    ll powD(ll x,ll y){
      ll res = 1;
      while(y > 0){
        if(y & 1)
          res = (res*x)%MOD;
        x = (x*x)%MOD;
        y = y>>1;
      }
      return res;
    }

  
  

    /*CHECK FOR CORNER CASES FOR GOD'S SAKE*/
    int main()
    {
      //freopen("input.txt", "r", stdin);
      //freopen("output.txt", "w", stdout);
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      string s,t;
      cin>>s>>t;
      int n = s.size();
      int m = t.size();
      int minm = n+1;
      forn(i,0,n){
        string temp = s.substr(i,m);
        if(temp.size() < m)
          continue;
        int cnt = 0;
        forn(j,0,m){
          if(temp[j] != t[j])
            cnt++;
        }
        minm = min(cnt,minm);
      }
      cout<<minm<<endl;

  } 


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,m,i,j;
	cin>>a>>b;
	for(i=1;;i++)
	{
		j=i+1;
		m=i*j/2-a;
		if(m>0&&m==j*(j+1)/2-b)
		{
			cout<<m;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }
ll n,m;
vector<ll> a;

int main(){
    string a,b;
    cin>>a>>b;
    string ans;
    if(a.size()>b.size()){
        cout<<"GREATER"<<endl;return 0;
    }
    else if(a.size()<b.size()){
        cout<<"LESS"<<endl;return 0;
    }
    else{
        if(a>b){
            cout<<"GREATER"<<endl;
        }
        else if(a<b){
            cout<<"LESS"<<endl;
        }
        else{
            cout<<"EQUAL"<<endl;
        }
    }
    return 0;
}

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

    int check = 0;
    int pre = a[0];
    int count = 1;
    for(int i=1; i<n; ++i){
        if(pre == a[i] && check == 0){
            continue;
        }
        else if(pre >= a[i] && check >= 0){
            check = 1;
        }
        else if(pre <= a[i] && check <= 0){
            check = -1;
        }
        else{
            check = 0;
            ++count;
        }
        pre = a[i];
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 640
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}
var bellmanFord = (function(){
  var INF = 1e9;
  function f(graph,start){
    return new bellmanFord(graph,start);
  }
  function bellmanFord(graph,start){
    var n = graph.length, n2 = n << 1;
    var dist = this.d = Array(n).fill(INF);
    dist[start] = 0;
    for(var i = 0; i < n2; i++){
      for(var v = 0; v < n; v++){
        if(dist[v] === INF)continue;
        for(var k = 0; k < graph[v].length; k++){
          var e = graph[v][k];
          if(dist[e.to] > dist[v] + e.cost){
            if(i >= n-1)dist[e.to] = -INF;
            else dist[e.to] = dist[v] + e.cost;
          }
        }
      }
    }
  }
  bellmanFord.prototype.dist = function(i){
    return this.d[i];
  };
  return f;
})();

console.log(main());
function main(){
  var n = o.a();
  var m = o.a();
  var p = o.a();
  var graph = xArray("[]",n);
  for(var i = 0; i < m; i++){
    var t = o.l(), a = t[0]-1, b = t[1]-1, c = t[2];
    graph[a].push({to:b,cost:p-c});
  }
  var bf = bellmanFord(graph,0);
  if(bf.dist(n-1) === -1e9)return -1;
  if(bf.dist(n-1) >= 0)return 0;
  return -bf.dist(n-1);
}

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

using namespace std;

#define pb push_back

const int N = (int)2e5 + 7;

int a[N];
int cnt[N];
vector < int > vec;

main () {
    int n, k; scanf ("%d %d", &n, &k);
    for (int i = 1; i <= n; i++) {
        scanf ("%d", a + i);
        cnt[a[i]]++;
    }
    for (int i = 1; i <= n; i++) {
        if (cnt[i]) vec.pb(cnt[i]);
    }
    sort(vec.begin(), vec.end());
    int ans = 0;
    int i = 0;
    while (int(vec.size()) - k > 0) {
        ans += vec[i];
        i++;
        k++;
    }
    cout << ans;
}


Measured memory_bytes: 2936
#include <bits/stdc++.h>
 
//#include <unistd.h>
//#include <iostream>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
//#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'

signed main() {
	fio();
	int k, q;
	cin >> k >> q;
	vl d(k);
	rep (i, k) cin >> d[i];
	while (q--) {
		int n, x, m;
		cin >> n >> x >> m;
		vl d2 = d;
		rep (i, k) {
			d2[i] %= m;
			if (d2[i] == 0) d2[i] = m;
		}
		x %= m;
		vl sum(k + 1);
		rep (i, k) {
			sum[i + 1] = sum[i] + d2[i];
		}
		ll m1 = (n - 1) / k;
		ll m2 = (n - 1) % k;
		ll ans = x + sum[k] * m1 + sum[m2];
		cout << n - 1 - ans / m << endl;
	}
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }

set<set<int>> f(string s) {
	set<int> g[26];
	for (int i = 0; i < sz(s); i++) g[s[i] - 'a'].insert(i);
	return set<set<int>>(g, g + 26);
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	string s, t; read(s, t);
	die(f(s) == f(t) ? "Yes" : "No");
}


Measured memory_bytes: 29204
class UnionFind:
    def __init__(self, n):
        # 親要素のノード番号を格納　par[x] == x の時そのノードは根
        self.par = [i for i in range(n+1)]
        # 木の高さを格納する（初期状態では0)
        self.rank = [0] * (n+1)
        # 各々の集合の要素数（根が代表して値を持っておく）
        self.count = [1] * (n+1)

    # 検索
    def find(self, x):
        # 根ならその番号を返す
        root = x
        queue = [x]
        data = []
        while queue:
            now = queue.pop()
            if self.par[now] == now:
                root = now
            else:
                # 根でないなら親の要素で再検索
                data.append(now)
                queue.append(self.par[now])
        # 検索する過程で親を更新
        for y in data:
            self.par[y] = root
        return root

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        t = (x == y)
        if UnionFind.same_check(self, x, y):
            return t
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.count[y] += self.count[x]
            self.count[x] = 0
        else:
            self.par[y] = x
            self.count[x] += self.count[y]
            self.count[y] = 0
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
        return t

    # 同じ集合に属しているか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    # 属している集合の要素数
    def size(self, x):
        q = UnionFind.find(self, x)
        return self.count[q]


n = int(input())
vertex = []
for i in range(n):
    xi,yi = map(int,input().split())
    vertex.append((xi, yi, i))

edge = []
vertex.sort()
for i in range(1, n):
    edge.append((vertex[i][0] - vertex[i - 1][0], vertex[i][2], vertex[i - 1][2]))

vertex.sort(key= lambda x:x[1])
for i in range(1, n):
    edge.append((vertex[i][1] - vertex[i - 1][1], vertex[i][2], vertex[i - 1][2]))

edge.sort()
u = UnionFind(n)
ans = 0
for d, i, j in edge:
    if u.union(i, j):
        continue
    ans += d

print(ans)


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

using namespace std;
typedef long long ll;

const ll INF = (ll)1e16 + 12;
const ll MAX = (ll)1e6 + 6;
vector<ll> h(MAX);
vector<ll> dp(MAX, INF);

ll func(ll n, ll k, ll m)
{
    if (n <= 0)
    {
        return (INF << 1);
    }
    if (dp[n] != INF)
    {
        return dp[n];
    }
    else
    {
        for (int x = 1; x <= k; x++)
        {
            if (n - x <= 0)
                break;
            dp[n] = min(dp[n], func(n - x, k, m) + abs(h[n] - h[n - x]));
        }
        return dp[n];
    }
}

int main()
{
    ll n, k;
    cin >> n >> k;
    for (int x = 1; x <= n; x++)
    {
        cin >> h[x];
    }
    dp[0] = (ll)1e18 + 18;
    h[0] = dp[0];
    dp[1] = 0;
    func(n, k, n);
    cout << dp[n] << endl;
}

Measured memory_bytes: 23680
#pragma GCC optimize (2)
#include<bits/stdc++.h>
using namespace std;

inline int read()
{
    int x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
    return x*f;
}

int main()
{
	int a=read(), b=read();
	printf("%.10f\n", (double)1.0*a/b);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  int h[100005];
  int dp[100005];

  cin>>n>>k;
  for(int i=0;i<n;i++) cin>>h[i];

  dp[0]=0; dp[1]=abs(h[0]-h[1]);

  for(int i=2;i<n;i++){
    dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
    for(int j=2;j<=k;j++){
      if(i-j>-1) dp[i]=min(dp[i],dp[i-j]+abs(h[i-j]-h[i]));
    }
  }

  cout<<dp[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	int sum=0;
	cin>>s;
	if(s=="0") 
	{
		cout<<"Yes";
		return 0;
	}
	int len=s.size();
	for(int i=0;i<len;i++)
		sum+=s[i]-'0';
	if(sum%9==0) cout<<"Yes";
	else cout<<"No";
	return 0;
} 

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

typedef long long ll;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;

#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define MOD 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  int t = 10000000;
  int ans = 0;
  rep(i, n) {
    cin >> p[i];
    if (t > p[i]) {
      ans += 1;
      t = p[i];
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int h, w;
string s[51];
bool used[51][51];
int dis[51][51];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

int main(int argc, char const* argv[])
{
	cin >> h >> w;
	int sum = 0;
	for(int i = 0; i < h; i++){
			cin >> s[i];
			for(int j = 0; j < w; j++){
					if(s[i][j] == '#')sum++;
					used[i][j] = false;
					dis[i][j] = -1;
			}
	}
	queue<P> q;
	q.push(mk(0, 0));
	dis[0][0] = 0;
	used[0][0] = true;
	while(!q.empty()){
			P p = q.front(); q.pop();
			for(int i = 0; i < 4; i++){
					int nx = p.first + dx[i];
					int ny = p.second + dy[i];
					if(nx >= 0 && nx < h && ny >= 0 && ny < w && !used[nx][ny] && s[nx][ny] != '#'){
							used[nx][ny] = true;
							q.push(mk(nx, ny));
							dis[nx][ny] = dis[p.first][p.second] + 1;
					}
			}
	}
	if(dis[h-1][w-1] != -1)cout << h * w - sum - dis[h-1][w-1] -1 << endl;
	else cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>   
using namespace std;
#define N 50   
#define REP(i, n) for(int i=0; i<n; i++)
long a,b,x;
long ans=0;
int main(void){
    cin>>a>>b>>x;
    long t=(a+x-1)/x *x;
    if(b-t>=0)printf("%ld",(b-t)/x+1);
    if(b-t<0)printf("0");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}


void solve(void){
    int N;
    cin >> N;
    vector <ll> as(N);
    rep(N, i) cin >> as[i];
    as.pb(0LL);
    int i = 0;
    ll ans = 0LL;
    while (i < N) {
        ans += as[i]/2;
        if (as[i] & 1 && as[i+1] > 0) {
            ans++;
            as[i+1]--;
        }
        i++;
    }
    cout << ans << endl;
}

int main(void){
  solve();
  //cout << "yui(*-v・)yui" << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;//daikin
  int a;//1yen
  cin >> n;
  cin >> a;
  
  if(n >= 500){
    n = n % 500;
  }
  if(n <= a){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
/*
  Author : lifehappy
*/
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const double pi = acos(-1.0);
const double eps = 1e-7;
const int inf = 0x3f3f3f3f;

inline ll read()   {
  ll f = 1, x = 0;
  char c = getchar();
  while(c < '0' || c > '9') {
    if(c == '-')    f = -1;
    c = getchar();
  }
  while(c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return f * x;
}

void print(ll x) {
  if(x < 10) {
    putchar(x + 48);
    return ;
  }
  print(x / 10);
  putchar(x % 10 + 48);
}

int main() {
  // freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
  // ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n = read(), ans = 0;
  for(int i = 1; i <= n; i++) {
    int temp = read();
    if((i & 1) && (temp & 1))  ans++;
  }
  print(ans), putchar('\n');
  return 0;
}

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

// Let's just be lazy in typing "typedef"
#define td typedef

// Data types
td long long ll;
td unsigned long long int ull;
td long double ld;

// Containers
td vector<int> vi;
td vector<ll> vll;
td map<int, int> mii;
td map<ll, ll> mll;
td pair<int, int> pii;
td pair<ll, ll> pll;

// Container functions
#define pb push_back
#define mp make_pair
#define n1 first // for pairs
#define n2 second
#define fill(x,v) memset(x,v,sizeof(x))

// Important Constants
#define inf (int)1e9
#define eps (ld)1e-12
#define mod (ll)(1e9 + 7)
#define endl '\n'

// Traversing containers
#define tr(x,itr) for( typeof(x.begin()) itr  = x.begin(); itr!= x.end(); itr++) //Use iterator to iterate from beginning of a data structure to its end
#define all(x) x.begin(),x.end() // all the elements of a DS
#define rep(i,n) for(int i=0;i<n;i++) // increasing for loop from 0 to n
#define inc(i,a,b) for(int i=a;i<=b;i++) //increasing for loop from a to b
#define dec(i,a,b) for(int i=b;i>=a;i--) //decreasing for loop from b to a
#define in(a,b)( (b).find(a) != (b).end()) // check if a is inside b
#define cases ll t;cin>>t;while(t--) // declare testcases, take input and start while loop

#define abs(x) (x<0 ? -x : x)
#define sqr(x) (x*x)

// I/O declare n and take input
#define cint(n) int n;cin>>n

// I/O optimizations
#define io1 ios::sync_with_stdio(false)
#define io2 cin.tie(NULL)

// Important functions
ll gcd(int a, int b){
    return b==0?a:gcd(b, a%b);
}

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

ll n,a,b,c;
vll dpa, dpb, dpc,A,B,C;

int main(){
    io1;
    io2;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c;
        A.pb(a);
        B.pb(b);
        C.pb(c);
    }

    dpa.assign(n, 0l);
    dpb.assign(n, 0l);
    dpc.assign(n, 0l);

    dpa[0] = A[0];
    dpb[0] = B[0];
    dpc[0] = C[0];

    for(int i = 1; i < n; i++) {
        dpa[i] = max(dpb[i-1], dpc[i-1]) + A[i];
        dpb[i] = max(dpa[i-1], dpc[i-1]) + B[i];
        dpc[i] = max(dpa[i-1], dpb[i-1]) + C[i];
    }

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

    return 0;
}

Measured memory_bytes: 5216
def pow(base, nod):
  MOD = 10**9+7
  ans = 1
  tmp = base
  while nod>0:
    if nod%2==1: ans=ans*tmp%MOD
    tmp = tmp**2
    tmp %= MOD
    nod /= 2
  return ans

n=int(raw_input())
a=map(int,raw_input().split())
d={}
for i in xrange(n):
  if a[i] not in d: d[a[i]]=0
  d[a[i]]+=1
isValid=True
if n%2==0:
  for k,v in d.items():
    if k%2!=1 or v!=2:
      isValid=False
else:
  for k,v in d.items():
    if k%2!=0 or (k==0 and v!=1) or (k!=0 and v!=2):
      isValid=False
if isValid:
  print pow(2, n/2)
else:
  print 0

Measured memory_bytes: 14328
#include <stdio.h>
#include <string.h>
#include <ctype.h>

char u2l(char c);

int main(void) {
	char W[10], T[1000];
	static long long cnt;

	scanf("%s\n", W);

	for (int i = 0; i < strlen(W); i++) {
		W[i] = u2l(W[i]);
	}

	while (true) {
		scanf("%s", T);
		if (!strcmp(T, "END_OF_TEXT")) break;
		
		for (int i = 0; i < strlen(T); i++) {
			T[i] = u2l(T[i]);
		}
		
		if (!strcmp(T, W)) cnt++;
	}
	printf("%lld\n", cnt);
	return 0;
}

char u2l(char c) {
	if (isupper(c)) c = c - 'A' + 'a';
	return c;
}

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

using namespace std;

// first := 入れ子レベル second := 数字(1,2,...) もしくは op(+: -1, * -2)
// stack<int,int>  
// 直前の入れ子のレベルより下がったら、
// 直前の入れ子レベルの数字と、演算子を取りだして、計算して、結果をスタックにプッシュ
// スタックから取りだすのは、入れ子レベルが下がった時、入力が終わったとき

int main()
{
    int n;
    while(cin >> n, n) {
        string s;
        stack<pair<int,int>> stk;
        while(n--) {
            cin >> s;
            int num = 0;
            if(s.back() >= '0' && s.back() <= '9') num = s.back() - '0';
            else if(s.back() == '+') num = -1;
            else num = -2;
            int ireko = s.size() -1;

            // 直前の入れ子レベルと比較
            while(!stk.empty() && stk.top().first > ireko) {
                // 直前の入れ子レベルがirekoよりも高いものをすべて計算する
                // 演算子が出てくるまで全て取りだす。
                vector<int> Nums;
                while(!stk.empty() && stk.top().second >= 0) {
                    Nums.push_back(stk.top().second);
                    stk.pop();
                }
                // tmp: 計算結果
                int tmp;
                // スタックの一番上が演算子
                if(stk.top().second == -1) {
                    // 全て足す
                    tmp = 0;
                    for(int x : Nums) tmp += x;
                }
                else {
                    tmp = 1;
                    for(int x : Nums) tmp *= x;
                }
                // スタックにプッシュする入れ子レベル == 演算子の入れ子レベル
                int i = stk.top().first;
                // スタックの一番上の演算子を取りだす
                stk.pop();
                // 計算結果をプッシュ
                stk.push(make_pair(i, tmp));
            }
            // 入力したものをプッシュ
            stk.push(make_pair(ireko, num));

            // デバッグ
            // cout << "size: " << stk.size() << " top.first: " << stk.top().first << " top.second: " << stk.top().second << endl;
        }

        // 最後、残っているものを計算する
        // スタックの上にあるものの入れ子レベルが1なら、計算が終わってなくて
        // スタックの上にあるものの入れ子レベルが0なら、もう計算がすんでいる
        while(stk.top().first > 0) {
            // 演算子が出てくるまで全て取りだす。
            vector<int> Nums;
            while (!stk.empty() && stk.top().second >= 0)
            {
                Nums.push_back(stk.top().second);
                stk.pop();
            }
            // tmp: 計算結果
            int tmp;
            // ↓ここでスタックが空になっている(1つ目サンプル)
            assert(stk.size() != 0);
            // スタックの一番上が演算子
            if (stk.top().second == -1)
            {
                // 全て足す
                tmp = 0;
                for (int x : Nums)
                    tmp += x;
            }
            else
            {
                tmp = 1;
                for (int x : Nums)
                    tmp *= x;
            }
            // スタックにプッシュする入れ子レベル == 演算子の入れ子レベル
            int i = stk.top().first;
            // スタックの一番上の演算子を取りだす
            stk.pop();
            // 計算結果をプッシュ
            stk.push(make_pair(i, tmp));
        }
        // 最後にのこったものを出力
        cout << stk.top().second << endl;
    }
    return 0;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair < int, int >;

const int mod = 1e9 + 7;
void add_self (int & a, int b) {
	a += b;
	if (a >= mod) a -= mod;
}

int main() {
	int N;
	scanf ("%d", &N);
	vector < double > p (N);
	for (double & d : p) scanf ("%lf", &d);
	vector < double > dp (N + 1);
	dp[0] = 1.0;
	for (int i = 0; i < N; i++) {
		vector < double > dp_new (N + 1);
		dp_new[0] = (1 - p[i]) * dp[0];
		for (int j = 1; j <= i + 1; j++) {
			dp_new[j] = p[i] * dp[j - 1] + (1 - p[i]) * dp[j];
		}
		dp = dp_new;
	}
	double answer = 0.0;
	for (int i = (N/2) + 1; i <= N; i++) {
		answer += dp[i];
	}
	printf ("%.9lf\n", answer);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a[2001],b[2001],f[2001][2001];
const int mod=1000000007;
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	} 
		for(int j=1;j<=m;j++){
		cin>>b[j];
	} 
	for(int i=0;i<=n;i++){
		f[i][0]=1;
	}
		for(int j=1;j<=m;j++){
		f[0][j]=1;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			f[i][j]=((long long)f[i-1][j]+f[i][j-1]-f[i-1][j-1]+mod)%mod;
			if(a[i]==b[j]){
				f[i][j]=(f[i][j]+f[i-1][j-1])%mod;
			}
		}
	}
	
	cout<<f[n][m]<<endl;
} 

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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    ll x,y;
    cin >> x >> y;
    int ans = 0;
    while (x <= y) {
        ans++;
        x *= 2;
    }
    cout << ans << newl;
}

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

int main(){
  char S[4];
  scanf("%s", S);
  sort(S, S + 4);
  if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  int A;
  int B;
  cin >>A>>B;
  int C=A+B;
  int D=A-B;
  int E=A*B;
  int F=max(max(C,D),E);
  cout << F<< endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define LL long long
#define endl '\n'
using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, h[101];
        cin >> n;
    int v = 0, e = 0;
    REP(i, n) {
        cin >> h[i];
        v += h[i];
    }

    REP(i, n - 1) {
        e += min(h[i], h[i + 1]);
    }
    cout << v - e << endl;
    return 0;
}

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

int main(){ 
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (b < c || a > d) cout << 0 << endl;
  else cout << abs(max(a,c) - min(b,d)) << endl;
  return 0;
} 

Measured memory_bytes: 256