akhauriyash/Code-Regression huggingface dataset:
N = int(input())
Data = list(map(int,input().split()))
Dic = {}
for d in Data:
    if d in Dic.keys():
        Dic[d] += 1
    else:
        Dic[d] = 1
ans = 0
for k,v in Dic.items():
    if k == v:
        pass
    elif k < v:
        ans += (v-k)
    else:
        ans += v
print(ans)

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

int main() {
	int n; cin >> n;
	string s; cin >> s;
	vector<int>W(n + 1, 0), E(n + 1, 0);
	for (int i = 0; i < s.size(); i++) {
		W[i + 1] = W[i] + (s[i] == 'W');
		E[i + 1] = E[i] + (s[i] == 'E');
	}
	int ans = 1e9;
	for (int i = 0; i < n; i++) {
		ans = min(ans, W[i] + E[n] - E[i + 1]);
	}
	cout << ans << endl;
	return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

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

    int n;
    cin >> n;
    vector<pair<string, int> > rest(n);
    map<pair<string,int>, int > map;

    int p;
    string name;

    REP(i,n){
        cin >> name >> p;
        rest[i] = make_pair(name,100-p);
        map[rest[i]] = i+1;
    }

    sort(All(rest));

    REP(i,n){
        cout << map[rest[i]] << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using AR2 = array<int, 2>;
constexpr int MOD{1000000000 + 7};
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int dx[4]{1, 0, -1, 0};
constexpr int dy[4]{0, 1, 0, -1};
int gcd(int a, int 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;
}
constexpr int div_roundup(int a, int b)
{
    return (a + b - 1) / b;
}
// vector<vector<int>> vec(n_rows, vector<int>(n_cols, value));
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(0);

    ll a, b;
    ll c, d;
    cin >> a >> b >> c >> d;

    ll all = b - a + 1;
    const ll cd = c * d / gcd(c, d);

    ll c_div = b / c - (a - 1) / c;
    ll d_div = b / d - (a - 1) / d;
    ll cd_div = b / cd - (a - 1) / cd;

    cout << all - (c_div + d_div - cd_div) << endl;
}


Measured memory_bytes: 256
class UnionFind():
    n=1
    par=[0]
    rnk=[0]
    def __init__(self,size):
        self.n=size
        self.par=[i for i in range(self.n)]
        self.rnk=[0 for i in range(self.n)]
    def find(self,vertex1):
        if self.par[vertex1]==vertex1:
            return vertex1
        else:
            self.par[vertex1]=self.find(self.par[vertex1])
            return self.par[vertex1]
    def unite(self,vertex1,vertex2):
        vertex1=self.find(vertex1)
        vertex2=self.find(vertex2)
        if vertex1==vertex2:
            return
        if (self.rnk[vertex1]<self.rnk[vertex2]):
            self.par[vertex1]=vertex2
        else:
            self.par[vertex2]=vertex1
            if(self.rnk[vertex1]==self.rnk[vertex2]):
                self.rnk[vertex1]+=1
    def same(self,vetrex1,vertex2):
        return self.find(vetrex1)==self.find(vertex2)

N,M=map(int,input().split())
G=UnionFind(N)
for i in range(M):
    a,b=map(int,input().split())
    G.unite(a-1,b-1)
D=dict()
for i in range(N):
    if G.find(i) in D:
        D[G.find(i)]+=1
    else:
        D[G.find(i)]=1
X=[]
for k in D:
    X.append(D[k])
print(max(X))


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



int main() {
	long long n,a,b;
	vector<pair<long long, long long> > vp;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a >> b;
		vp.push_back(make_pair(a,b));
	}
	long long sum=0;
	for(int i=n-1;i>=0;i--){
		long long x = vp[i].first+sum;
		if(x%vp[i].second==0) continue;
		
		long long y=x%vp[i].second;
		if(x>vp[i].second){
			sum+=vp[i].second-y;
		}
		else{
			sum+=vp[i].second-x;
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 2548
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;


public class Main {

    static void solve() {
        Scanner scan = new Scanner(System.in);

        int d = scan.nextInt();
        int t = scan.nextInt();
        int s = scan.nextInt();

        int tt = 0;
        if(d%s == 0) {
            tt = d/s;
        } else {
            tt = d/s + 1;
        }
        if(tt <= t) {
            System.out.println("Yes");
        } else{
            System.out.println("No");
        }


//        int t = scan.nextInt();
//        for (int i = 0; i < t; i++) {
////            solveCase();
//        }


//        long t = scan.nextLong();

//        for (int i = 0; i < t; i++) {
//            int n = scan.nextInt();
////            scase(n);
//        }
    }


    static void solveCase(int zero1, int one1, int two1, int zero2, int one2, int two2) {

    }

    static void scase(int[] arr1, int[] arr2) {
    }


    public static void main(String[] args) {

        solve();
    }


    static class LoggerNode {
        String message;
        int ts;
    }


    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }
}

Measured memory_bytes: 27068
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	vector<int> a(10);
	for(int i=0;i<10;i++)cin>>a[i];
	sort(a.begin(),a.end(), std::greater<int>());
	for(int i=0;i<3;i++)cout<<a[i]<<endl;
}


Measured memory_bytes: 3116
n,k=map(int,input().split())
x=list(map(int,input().split()))
ans=10**18

for i in range(n-k+1):
    temp=0
    temp+=(min(abs(x[i]),abs(x[i+k-1]))+abs(x[i]-x[i+k-1]))
    ans=min(ans,temp)
print(ans)

Measured memory_bytes: 20060
// Gracias, Rodolfo
// Gracias, MarcosK
// Gracias, Graphter
// Obrigado, Dilson
//#pragma GCC optimize ("Ofast,unroll-loops")
//#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define fastio ios::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for (Long i = a; i < b; i++)
#define roF(i,a,b) for (Long i = a; i >= b; i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) (v).begin(),(v).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

typedef long long Long;
typedef long double Double;
typedef unsigned long long ULong;
typedef pair<Long, Long> Pair;
typedef vector<Long> Vector;
typedef vector<Pair> PairVector;

const int N = 1e6;
const Long INF = 1e18;
const Double EPS = 10e-9;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
Long random(Long a, Long b) { return uniform_int_distribution<Long> (a, b) (rng); }

void solve() {
	Long n, k;
	cin >> n >> k;
	Long ans = 0;
	For(i,0,n) {
		Long x;
		cin >> x;
		if (x >= k) ans++;
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 3608
#D問題
N,K = map(int,input().split())
A = list(map(int,input().split()))
Abin = []
Kbin = []
count = 0

for a in A:
    b = bin(a)
    b = b.lstrip("0b")
    blen = len(b)
    for j in range(40-blen):
        b = "0"+b
    Abin.append(b)
    
for i in range(40):
    t = 40-i-1
    if (2**t)+count > K:
        Kbin.append(0)
    else:
        count0 = 0
        count1 = 0
        for j in range(N):
            nbit = Abin[j][i]
            if nbit == "0":
                count0+=1
            else:
                count1+=1
        #print(count0,count1)
        if count0 >= count1:
            Kbin.append(1)
            count+=(2**t)
        else:
            Kbin.append(0)
            
#print(Kbin)
Bin = 0
for i in range(40):
    t = 40-i-1
    Bin+=(Kbin[i]*(2**t))
ans = 0
for a in A:
    ans+=(Bin^a)
print(ans)
    

Measured memory_bytes: 19396
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

//pow(llpow,modpow)
template<class T> ll llpow(T x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    int n,t;
    cin>>n>>t;
    vi time(n);
    rep(i,n)cin>>time[i];
    ll sum=0;
    rep(i,n-1){
        int dif=time[i+1]-time[i];
        if(dif<t){
            sum+=dif;
        }
        else {
            sum+=t;
        }
    }
    sum+=t;
    cout<<sum<<endl;
    return 0;
}




Measured memory_bytes: 1024
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type Abbreviation ---------- */
using ll = long long;

/* ---------- Constants ---------- */
const ll MOD = 1e9 + 7;
const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */
template <typename T>
T gcd(T a, T b) {
    if (a > b) return gcd(b, a);
    return a == 0 ? b : gcd(b % a, a);
}

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b /* % MOD */;
    if (n % 2 == 0) {
        return mypow(b * b /* % MOD */, n / 2);
    } else {
        return mypow(b, n - 1) * b /* % MOD */;
    }
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

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

    int ret = INF;

    for (int i = 0; i <= 1; i++) { // 偶数 or 奇数
        for (int j = 0; j <= 2; j++) { // A, B, Cのどれに合わせるか
            int a = A;
            int b = B;
            int c = C;

            int sum = 0;

            if (i == 0) {
                if (a % 2 == 1) {
                    a--;
                    sum++;
                }
                if (b % 2 == 1) {
                    b--;
                    sum++;
                }
                if (c % 2 == 1) {
                    c--;
                    sum++;
                }
            } else {
                if (a % 2 == 0) {
                    a--;
                    sum++;
                }
                if (b % 2 == 0) {
                    b--;
                    sum++;
                }
                if (c % 2 == 0) {
                    c--;
                    sum++;
                }
            }

            if (j == 0) {
                if (a < b || a < c) continue;
                sum += abs(a - b) / 2 + abs(a - c) / 2;
            } else if (j == 1) {
                if (b < a || b < c) continue;
                sum += abs(b - a) / 2 + abs(b - c) / 2;
            } else {
                if (c < a || c < b) continue;
                sum += abs(c - a) / 2 + abs(c - b) / 2;
            }

            ret = min(ret, sum);
        }
    }

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P  = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    int H, W;
    int K;
    cin >> H >> W >> K;
    vector<vector<char>> C(H);

    rep(i, H)rep(j, W)
    {
        char x;
        cin >> x;
        C[i].push_back(x);
    }
    uint32_t h = 0x0;
    uint32_t w = 0x0;
    int a = 0;
    int ans = 0;
    for(uint32_t h= 0; h < (1<<H); h++)for(uint32_t w = 0; w < (1<<W) ; w++)
    {
        vector<vector<char>> tmp = C;
        rep(i, H)
        {
            if(!(h&(1<<i))) continue;
            rep(j, W) tmp[i][j] = 'R';
        }
        rep(j, W)
        {
            if(!(w&(1<<j))) continue;
            rep(i, H) tmp[i][j] = 'R';
        }
        // //cout << a++ << h << w << endl;
        int cnt = 0;
        rep(i, H)rep(j, W)
        {
            if(tmp[i][j] == '#') cnt++;
        }
        if(cnt == K) ++ans;
      
    }
    cout << ans << endl;
    // rep(i, H)
    // {
    //     rep(j, W)
    //     {
    //         cout << C[i][j] ;
    //     }
    //     cout << endl;
    // }
    return 0;
}

Measured memory_bytes: 3628
function main(input){
  const args = input.split(' ');
  const a = parseInt(args[0],10);
  const b = parseInt(args[1],10);
  
  if((a*b) % 2 === 0){
    console.log('Even');
  } else {
    console.log('Odd');
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

int g[10][10];
int f[10][10];

void solve() {
  int M;
  cin >> M;
  int ans = -1;
  int sum = 0;

  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      int a = i+j;
      g[i][j] = a/10+a%10;
      f[i][j] = a >= 10 ? 2 : 1;
    }
  }

  int amari = 0;
  while (M--) {
    int c, d; cin >> d >> c;

    while (c > 1) {
      if (c%2 == 1) {
        c--;
        ans += f[amari][d];
        amari = g[amari][d];
      }

      c /= 2;
      ans += c * f[d][d];
      d = g[d][d];
    }

    ans += f[amari][d];
    amari = g[amari][d];
  }

  cout << ans << endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 3196
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

w,h,n = map(int,input().split())

l = [0,0]
r = [w,h]

for i in range(n):
    x,y,a = map(int,input().split())

    if a==1:
        l[0] = max(x,l[0])
    elif a==2:
        r[0] = min(x,r[0])
    
    elif a==3:
        l[1] = max(y,l[1])
    elif a==4:
        r[1] = min(y,r[1])

if (r[0]-l[0]) <= 0 or (r[1]-l[1])<=0:
    print(0)
else:
    print((r[0]-l[0])*(r[1]-l[1]))

Measured memory_bytes: 3064
#include <stdio.h>
     
    int main(void){
      	char s[11];
      	char t[12];
    	scanf("%s",s);
      	scanf("%s",t);
      
      	for(int i=0;i<11;i++){
          //printf("%d",t[]);
            if(s[i]=='\0'){
            	if(t[i+1]=='\0'){
                	printf("Yes");
                  	return 0;
                }
            }
        	if(s[i]!=t[i]){
            	printf("No");
              	return 0;
            }
        }
      
      	return 0;
    }

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

int main() {
	double w;
	while (cin >> w) {
		if (w <= 48) {
			cout << "light fly" << endl;
		} else if (w <= 51) {
			cout << "fly" << endl;
		} else if (w <= 54) {
			cout << "bantam" << endl;
		} else if (w <= 57) {
			cout << "feather" << endl;
		} else if (w <= 60){
			cout << "light" << endl;
		} else if (w <= 64) {
			cout << "light welter" << endl;
		} else if (w<=69){
			cout << "welter" << endl;
		} else if (w <= 75) {
			cout << "light middle" << endl;
		} else if (w <= 81) {
			cout << "middle" << endl;
		} else if (w <= 91){
			cout << "light heavy" << endl;
		} else {
			cout << "heavy" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3140
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int H,W;

int main(){
    cin>>H>>W;
    char c[H][W];
    int ans[H+2][W+2];
    rep(i,H){
        rep(j,W){
            ans[i+1][j+1]=0;
            cin>>c[i][j];
        }
    }
    rep(i,H){
        rep(j,W){
            if(c[i][j]=='#'){
                rep(k,3){
                    rep(l,3){
                        ans[i+k][j+l]++;
                    }
                }
            }
        }
    }
    rep(i,H){
        rep(j,W){
            if(c[i][j]=='#')printf("#");
            else cout<<ans[i+1][j+1];
        }
        cout<<endl;
    }
}


Measured memory_bytes: 256
# Problem
# Python 2nd Try
import sys


def solver(allNumber, eachNum, useRange):
    answer = sys.maxsize
    counter = [0]*allNumber
    for j in useRange:
        while True:
            if eachNum[j] % 2 == 0:
                counter[j] = counter[j] + 1
                eachNum[j] = eachNum[j] / 2
            else:
                break

    for j in useRange:
        if counter[j] <= answer:
            answer = counter[j]
    return answer


if __name__ == "__main__":
    N = int(input())
    Ai = list(map(int, input().split(' ')))
    print(solver(N, Ai, range(0, N)))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int h[n];
    ll sum = 0;
    rep(i, 0, n) {
        cin >> h[i];
        sum += h[i];
    }

    ll ans = 0;
    while(sum > 0) {
        int area = 1;
        if (h[0] == 0) area = 0;
        rep(i, 0, n) {
            if (h[i] == 0) {
                if (i != n - 1) {
                    if (h[i + 1] != 0) {
                        area++;
                    }
                }
            } else {
                h[i]--;
                sum--;
            }
        }
        ans += area;
    }

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    string s; cin >>s;

    s[5] = ' ';
    s[13] = ' ';

    cout << s << endl;
    return 0;
}




Measured memory_bytes: 256
x1,y1,x2,y2 = map(int,input().split())
xx = x2 - x1
yy = y2 - y1

xxt = -yy
yyt = xx
x4 = x1 + xxt
y4 = y1 + yyt
x3 = x2 + xxt
y3 = y2 + yyt
print(x3,y3,x4,y4)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long

using namespace std;

ll A, B, N;
ll Check(ll x) {
    return (A*x) / B - A * (x / B);
}

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

    cout << max(Check(min(N, B - 1)), Check(min(N, B))) << '\n';
    return 0;
}


Measured memory_bytes: 3576
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define REP(i,n) for(long long i(0);(i)<(n);(i)++)

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::string S){
    if(N & 1){
        cout << NO << endl;
        return;
    }
    if(S.substr(0, N/2) == S.substr(N/2, N/2)){
        cout << YES << endl;
    }
    else{
        cout << NO << endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
//#undef LOCAL
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#ifdef LOCAL
#define show(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}


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

    int n;
    cin >> n;
    int eve = 0, odd = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (n % 2 == 0) {
            if (i % 2 == 0) eve ^= x;
            else odd ^= x;
        } else {
            eve ^= x;
        }
    }
    if (!eve && !odd) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

#define MAX 100005
 
typedef long long ll;
typedef pair<int, int> P;

int partition(vector<int> &a, int p, int r)
{
    int x = a[r];
    int i = p - 1;
    for (int j = p; j < r; j++) {
        if (a[j] <= x) {
            i++;
            swap(a[i], a[j]);
        }
    }
    swap(a[r], a[i+1]);
    return i+1;
}

int main(int, char**)
{
    int n;
    cin >> n;

    vector<int> a(n);
    rep(i,n) cin >> a[i];

    int par = partition(a, 0, n-1);
    rep(i,n) {
        if (i > 0) cout << " ";
        if (i == par) cout << "[" << a[i] << "]";
        else cout << a[i]; 
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3096
#include <iostream>

using namespace std;

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

    if (a > b)
      cout << "a > b" << endl;

    if (a < b)
      cout << "a < b" << endl;

   if (a == b)
      cout << "a == b" << endl;
} 


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

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

using namespace std;

long long int wop(long long int x, long long int y) {
    long long int ret=1;
    for(;y>0;y/=2) {
        if(y&1)ret*=x;
        x*=x;
    }
    return ret;
}

int main () {
    long long int a, n, ans=0;
    cin >> a >> n;
    for(int i = 0 ; i< n ; i++ ) {
        long long int x;
        cin >> x;
        ans+=x;
    }
    if(ans>=a) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }
}


Measured memory_bytes: 256
#include<cstdio>
#include<set>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<cstdlib>
#include<time.h>
#include<string>
#include<stack>
#include<cmath>
#include<iostream>
#include<cstring>
#include<complex>

using namespace std;
#define FOR(i,j,k) for(int i=j;i<k;i++)
#define FORR(i,j,k) for(int i=j;i>=k;i--)
#define ll long long
//Make sure no overflow problems
//#define int long long
#define pii  pair<int, int>
#define vi vector<int >
#define pb push_back
#define mp make_pair

#define VAR(i,n) __typeof(n) i = (n)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();i++)
#define FORDEACH(i,c) for( VAR(i,(c).rbegin()),i!=(c).rend();i++)
#define REP(i,n) FOR(i,0,n)
#define ld long double
const int INF = 1e9 + 7;

const long long INFLL = (ll)INF * (ll)INF;
const ld EPS = 10e-9;

using namespace std;

int main(void)
{
    int N;
    cin >> N;

    vector<int> activities(3);
    vector<int> dp(3, 0);

    for (int day = 0; day < N; day++)
    {
        vector<int> new_dp(3, 0);
        for (int i = 0; i < 3; i++)
        {
            cin >> activities[i];
        }

        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (i != j)
                {
                    new_dp[j] = max(new_dp[j], dp[i] + activities[j]);
                }
            }
        }
        dp = new_dp;
    }

    cout << max({dp[0], dp[1], dp[2]}) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <deque>
#include <array>
#include <iostream>
#include <string>

int main()
{
    std::deque<char> data;
    {
        std::string s;
        std::cin >> s;

        data = std::deque<char>{s.begin(), s.end()};
    }

    bool reverse = false;

    int Q;
    std::cin >> Q;

    for (auto i = 0; i < Q; i++) {
        int T;
        std::cin >> T;

        if (T == 1) {
            reverse = !reverse;
        }

        if (T == 2) {
            int F;
            char C;
            std::cin >> F >> C;

            if ((F == 1) != reverse) {
                data.push_front(C);
            } else {
                data.push_back(C);
            }
        }


        // std::cout << i << ": ";
        // if (reverse) {
        //     for (auto iter = data.crbegin(); iter != data.crend(); iter++) {
        //         std::cout << *iter;
        //     }
        // } else {
        //     for (auto c : data) {
        //         std::cout << c;
        //     }
        // }
        // std::cout << std::endl;

    }

    if (reverse) {
        for (auto iter = data.crbegin(); iter != data.crend(); iter++) {
            std::cout << *iter;
        }
    } else {
        for (auto c : data) {
            std::cout << c;
        }
    }

    return 0;
}	

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

#define int long long

const int N = 2e5 + 10, mod = 1e9 + 7;
int n, m, k, ans, fac[N], inv[N];

int sum(int a, int b) {
	return a + b >= mod? a + b - mod: a + b < 0? a + b + mod: a + b;
}

int mul(int a, int b) {
	a %= mod;
	b %= mod;
	return (a * b) % mod;
}

void _sum(int &a, int b) {
	a = sum(a, b);
}

void _mul(int &a, int b) {
	a = mul(a, b);
}

template <typename Head, typename ...Tail>
int mul(Head H, Tail ...T) {
	return mul(H, mul(T...));
}

template <typename Head2, typename ...Tail2>
int sum(Head2 H, Tail2 ...T) {
	return sum(H, sum(T...));
}

int pw(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1)
			_mul(res, a);
		_mul(a, a);
		b /= 2;
	}
	return res;
}

int C(int i, int j) {
	return i > j? 0: mul(fac[j], inv[i], inv[j - i]);
}

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	fac[0] = inv[0] = 1;
	for (int i = 1; i < N; i++) {
		fac[i] = mul(i, fac[i - 1]);
		inv[i] = pw(fac[i], mod - 2);
	}
	
	cin >> n >> m >> k;
	int tmp = C(k - 2, n * m - 2), s = 0;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			s += i + j;
	
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++) {
			_sum(ans, mul(s, tmp));
			
			if (j == m - 1) 
				s -= m * (n - 1 - i);
			else
				s += (n - i - 1) * (j + 1) - (n - i) * (m - j - 1);
		}
	cout << ans << endl;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
    using namespace std;
    #define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
    #define M 1000000007
    #define ll long long
    #define db double
    #define pb push_back
    #define F first
    #define S second
    #define vl vector<ll>
    #define vvl vector<vl>
    #define pii pair<int,int>
    #define mkp make_pair
     
    vector<ll> g[5];
    int main()
    {
    	for(ll i=0;i<3;i++)
        {
          ll x,y;
          cin >> x >> y;
          g[x].pb(y); g[y].pb(x);
        }
      for(ll i=1;i<=4;i++)
      {
      	if(g[i].size()==0 || g[i].size()>2)
        {
        	
        cout << "NO" << endl; return 0;}
      }
      
      cout << "YES" << endl;
    }

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

int main(){
	int n, x;
	cin>>n;
	vector<int> A;
	for(int i=0; i<n; i++){
		cin>>x;
		A.push_back(x);
	}
	sort(A.begin(),A.end());
	int cnt =0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			for(int k=j+1; k<n; k++){
				if(A[i] + A[j] > A[k] and A[i]!= A[j] and A[j]!=A[k] and A[i]!= A[k]){
					cnt++;
				}
			}
		}
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 3632
from collections import deque
from collections import defaultdict


while True:
    W,H = map(int,input().split())
    if W==0 and H==0:
        break

    grid = defaultdict()

    raw_grid = []

    for _ in range(0,2*H-1):
        raw_grid.append(list(map(int, input().split())))

    for i in range(W):                           # 縦移動
        for j in range(1, 2 * H - 2, 2):
            p = int(i+W*(j-1)/2)
            q = int(i+W*(j+1)/2)
            grid[(p, q)] = raw_grid[j][i]
            grid[(q, p)] = grid[(p, q)]

    for j in range(0,2*H-1,2):                  # 横移動
        for i in range(W-1):
            p = int(i+W*j/2)
            q = int(i+1+W*j/2)
            grid[(p, q)] = raw_grid[j][i]
            grid[(q, p)] = grid[(p, q)]

    for i in range(W):              # 縦の壁
        grid[(i,i-W)] = 1
        grid[(i-W,i)] = 1
        grid[(W*(H-1)+i,W*H+i )] = 1
        grid[(W*H+i, W*(H-1)+i)] = 1
    for j in range(H):              # 横の壁
        grid[(W*j,W*j-1)] = 1
        grid[(W*j-1,W*j)] = 1


    move = [1,-1, W, -W]
    start = 0

    se = set([start]) # 到達可能

    next_set = deque()
    next_set.append((start, 0))
    flg =False

    while next_set:    # q = [] になったら止める
        p, t = next_set.popleft()     # 要素を消去して、消去した要素を出力
        for dx in move:
            q = p + dx
            if (q < 0 or q > W * H - 1):
                continue
            if grid[(p, q)] == 1 or q in se:
                continue
            if q == W*H-1:
                print(t + 2)
                flg = True
                break
            se.add(q)   # すでに到達した道を記憶
            next_set.append((q, t + 1))     # yに移動
        if flg:
            break
    if not flg:
        print(0)






Measured memory_bytes: 6524
#include <stdio.h>
int main(void) {
	int c, ascii[127] = {0};

	while (1) {
		c = getchar();
		if (c == EOF)
			break;
		ascii[c] += 1;
	}
	for (c = 'a'; c <= 'z'; c++) {
		printf("%c : %d\n", c, ascii[c] + ascii[c-0x20]);
	}
	return 0;
}

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

int main() {
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  string ans="";
  for (int i =0 ;i< (tx - sx); i++) ans += "R";
  for (int i =0 ;i< (ty - sy); i++) ans += "U";
  for (int i =0 ;i< (tx - sx); i++) ans += "L";
  for (int i =0 ;i< (ty - sy); i++) ans += "D";
  ans += "D";
  for (int i =0 ;i< (tx - sx + 1); i++) ans += "R";
  for (int i =0 ;i< (ty - sy +1); i++) ans += "U";
  ans += "LU";
  for (int i =0 ;i< (tx - sx +1); i++) ans += "L";
  for (int i =0 ;i< (ty - sy +1); i++) ans += "D";
  ans += "R";
  
  cout << ans << endl;
}


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

int main()
{
	int32_t N, M;
	cin >> N >> M;

	vector<vector<bool>> g(N);
	for (int32_t i = 0; i < N; i++) {
		g[i].resize(N);
		fill(begin(g[i]), end(g[i]), false);
	}

	vector<pair<int32_t, int32_t>> edges(M);
	for (int32_t i = 0; i < M; i++) {
		int32_t a, b;
		cin >> a >> b;
		a--;
		b--;
		edges[i] = make_pair(a, b);
		g[a][b] = true;
		g[b][a] = true;
	}

	int32_t res = 0;
	for (int32_t i = 0; i < M; i++) {
		pair<int32_t, int32_t> edge = edges[i];
		int32_t a = edge.first, b = edge.second;

		g[a][b] = false;
		g[b][a] = false;

		queue<int32_t> nodes;
		for (int32_t col = 0; col < N; col++) {
			if (g[0][col])
				nodes.push(col);
		}

		vector<bool> connected(N);
		fill(begin(connected), end(connected), false);
		while (!nodes.empty()) {
			int32_t node = nodes.front();
			nodes.pop();
			if (connected[node])
				continue;
			connected[node] = true;
			for (int32_t col = 0; col < N; col++) {
				if (g[node][col])
					nodes.push(col);
			}
		}

		bool all_connected = true;
		for (int32_t j = 0; j < N; j++) {
			if (!connected[j]) {
				all_connected = false;
				break;
			}
		}
		if (!all_connected)
			res++;

		g[a][b] = true;
		g[b][a] = true;
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, b) for (ll i = (a); i < (b); ++i)

using namespace std;
using ll = long long;

/**
 * main
 */
int main () {
  ll K; cin >> K;
  ll N; cin >> N;

  vector<ll> A(N);

  REP(i, 0, N) cin >> A[i];

  // sort(A.begin(), A.end());

  ll min_d = K;

  REP(i, 0, N) {
    ll from = i;
    ll to = (i - 1 + N) % N;
    ll d = (A.at(to) - A.at(from) + K) % K;

    if (d < min_d) min_d = d;
  }

  cout << min_d << endl;
}


Measured memory_bytes: 1920
n = int(input())
for i in range(1, n + 1):
  if i % 3 == 0:
    print(f" {i}", end = "")
  else:
    x = i
    while x:
      if x % 10 == 3:
        print(f" {i}", end = "")
        break
      x //= 10
print()


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

int main(){
    int a, b;
    char op;
    
    do{
        cin >> a >> op >> b;
        if(op == '?') break;
        int res;
        switch(op){
        case '+': res = a+b; break;
        case '-': res = a-b; break;
        case '*': res = a*b; break;
        case '/': res = a/b; break;
        }
        cout << res << endl;
    }while(1);
    
    return 0;
}


Measured memory_bytes: 3084
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<stack>
using namespace std;



int main() {

	int n, q;
	cin >> n >> q;

	vector< stack <int> > s(n);

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

		int a, t, x;
		cin >> a;
		if (a == 0) {
			cin >> t >> x;

			s[t].push(x);

		}

		if (a == 1) {
			cin >> t;
			if (!s[t].empty()) {
				cout << s[t].top() << endl;
			}
		}

		if (a == 2) {
			cin >> t;
			if (!s[t].empty()) {
				s[t].pop();

			}


		}

	}



	return 0;
}





Measured memory_bytes: 4288
use std::io::{stdin, stdout, BufReader, BufRead, StdinLock, Write, BufWriter};

fn main() {
    let (std_in, std_out) = (stdin(), stdout());
    let mut br = BufReader::new(std_in.lock());
    let mut bw = BufWriter::new(std_out.lock());
    
    let n: usize = rn(&mut br);
    let a = rvn::<usize>(&mut br);
    let mut res = vec![0; n];
    for i in (0..n).rev() {
        let mut k = 2 * i + 1;
        let mut wa = 0;
        while k < n {
            wa += res[k];
            k += i+1;
        }
        res[i] = a[i] ^ (wa % 2);
    }
    let mut m = 0;
    for x in &res {
        m += *x;
    }
    writeln!(&mut bw, "{}", m);
    for i in 0..n {
        if res[i] == 1 {
            write!(&mut bw, "{} ", i+1);
        }
    }
}


//////////////////////////////////////////////////////////////////////////////////
#[allow(dead_code)]
fn rs(br: &mut BufReader<StdinLock>) -> Vec<char> {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().chars().collect()
}

#[allow(dead_code)]
fn rn<T: std::str::FromStr>(br: &mut BufReader<StdinLock>) -> T {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn rvs(br: &mut BufReader<StdinLock>) -> Vec<Vec<char>> {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().split_whitespace().map(|e| e.chars().collect()).collect()
}

#[allow(dead_code)]
fn rvn<T: std::str::FromStr>(br: &mut BufReader<StdinLock>) -> Vec<T> {
    let mut buf = String::new();
    br.read_line(&mut buf).ok();
    buf.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 9212
def main():
  line = input()
  
  ki = ['R', 'U', 'D']
  gu = ['L', 'U', 'D']

  for i in range(len(line)):
    if (i+1) % 2 == 0:
      if line[i] not in gu:
        print("No")
        return
    else:
      if line[i] not in ki:
        print("No")
        return
      
  print("Yes")
  return

main()

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>

#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
//cout << fixed << setprecision(10) << ans << endl;
//int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main(){
    string s,t;
    cin >> s >> t;
    int a,b;
    cin >> a >> b;
    string ss;
    cin >> ss;
    if(s==ss){
        cout << a-1 << " " << b;
        cout << endl;
    }
    else{
        cout << a << " " << b-1;
        cout << endl;
    }



    return 0;
}

Measured memory_bytes: 256
l = list(map(int, input().split()))

if l[0] % 2 == 0 or l[1] % 2 == 0 or l[2] % 2 == 0:
  print(0)
else:
  ans = 1
  max_idx = l.index(max(l))
  for i in range(3):
    if i != max_idx:
      ans *= l[i]
  print(ans)

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

int main()
{
    int A, B, K;
    cin>>A>>B>>K;
    int min = (A>B?B:A);
    vector<int> num;
    for(int i = 1;i<=min;i++){
        if(0 == A%i && 0 == B%i){
            num.push_back(i);
        }
    }
    cout<<num[num.size()-K];
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby

result = []
dice = gets.split.map(&:to_i)
loop_number = gets.to_i
loop_number.times do |index|
    face = gets.split.map(&:to_i)
    case face[0]
    when dice[0] then
        case face[1]
        when dice[1] then
            result << dice[2]
        when dice[2] then
            result << dice[4]
        when dice[3] then
            result << dice[1]
        when dice[4] then
            result << dice[3]
        end
    end

    case face[0]
    when dice[1] then
        case face[1]
        when dice[2] then
            result << dice[0]
        when dice[0] then
            result << dice[3]
        when dice[3] then
            result << dice[5]
        when dice[5] then
            result << dice[2]
        end
    end

    case face[0]
    when dice[2] then
        case face[1]
        when dice[0] then
            result << dice[1]
        when dice[1] then
            result << dice[5]
        when dice[4] then
            result << dice[0]
        when dice[5] then
            result << dice[4]
        end
    end

    case face[0]
    when dice[3] then
        case face[1]
        when dice[0] then
            result << dice[4]
        when dice[1] then
            result << dice[0]
        when dice[4] then
            result << dice[5]
        when dice[5] then
            result << dice[1]
        end
    end

    case face[0]
    when dice[4] then
        case face[1]
        when dice[0] then
            result << dice[2]
        when dice[2] then
            result << dice[5]
        when dice[3] then
            result << dice[0]
        when dice[5] then
            result << dice[3]
        end
    end

    case face[0]
    when dice[5] then
        case face[1]
        when dice[1] then
            result << dice[3]
        when dice[2] then
            result << dice[1]
        when dice[3] then
            result << dice[4]
        when dice[4] then
            result << dice[2]
        end
    end
end

puts result


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

int main(){
    int k;
    char s[128], w[128];
    scanf("%d", &k);
    scanf("%128s", s);
    if(strlen(s) <= k){
        puts(s);
    }else{
        strncpy(w, s, k);
        w[k] = '.';
        w[k + 1] = '.';
        w[k + 2] = '.';
        w[k + 3] = '\0';
        puts(w);
    }

    return 0;
}

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

int main(void){
    int r,g,b;
    cin >> r >> g >> b;
    int mul = 100*r + 10*g + 1*b;

    if(mul%4==0) {cout<<"YES"<<endl;}
    else {cout<<"NO"<<endl;}    

    return (0);
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <math.h>
#include <string>

using namespace std;



int main(){
    string s,t;

    cin>>s>>t;

    if(s==t){
        cout<<"EQUAL"<<endl;
    }else if(s.size()==t.size()){
        for(int i=0;i<s.size();i++){
            if(s[i]==t[i]){
                continue;
            }else if(s[i]>t[i]){
                cout<<"GREATER"<<endl;
                break;
            }else if(s[i]<t[i]){
                cout<<"LESS"<<endl;
                break;
            }
        }
    }else if(s.size()>t.size()){
        cout<<"GREATER"<<endl;
    }else if(s.size()<t.size()){
        cout<<"LESS"<<endl;
    }

    return 0;

}

Measured memory_bytes: 256
a=input()
op1,op2,op3="+","+","+"

if int(a[0])+int(a[1])+int(a[2])+int(a[3])==7:
    op1,op2,op3="+","+","+"
elif int(a[0])-int(a[1])+int(a[2])+int(a[3])==7:
    op1,op2,op3="-","+","+"
elif int(a[0])+int(a[1])-int(a[2])+int(a[3])==7:
    op1,op2,op3="+","-","+"
elif int(a[0])+int(a[1])+int(a[2])-int(a[3])==7:
    op1,op2,op3="+","+","-"
elif int(a[0])+int(a[1])-int(a[2])-int(a[3])==7:
    op1,op2,op3="+","-","-"
elif int(a[0])-int(a[1])-int(a[2])-int(a[3])==7:
    op1,op2,op3="-","-","-"
elif int(a[0])-int(a[1])+int(a[2])-int(a[3])==7:
     op1,op2,op3="-","+","-"
elif int(a[0])-int(a[1])-int(a[2])+int(a[3])==7:
    op1,op2,op3="-","-","+"

print((a[0])+op1+str(a[1])+op2+str(a[2])+op3+str(a[3])+"=7")

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,n,t,p=0;
    string s;
    cin>>s;
    for(i=0;i<s.size();i++){
        if(s[i]=='1'){
            p++;
        }
    }
    cout<<p<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b;
    
    if(a > b) {
        int arr[4];
        int B = b;
        for(int i = 0; i < a; i++) {
            arr[i] = (B++);
        }

        int x = 0;
        for(int j = 0; j < a; j++) {
            x = (a * b * arr[j]);
            if(x % 2 == 1) {
                c = arr[j];
            }
            else {
                c = 0;
            }
        }
    }
    else {
        int arr[4];
        int A = a;
        for(int i = 0; i < b; i++) {
            arr[i] = (A++);
        }
        int x = 0;
        for(int i = 0; i < b; i++) {
            x = (a * b * arr[i]);
            if(x % 2 == 1) {
                c = arr[i];
            }
            else {
                c = 0;
            }
        }
    }
    
    if(c == 0) cout << "No\n";
    else cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<stack>
#include<string>
#include<deque>
#include<queue>
#include<vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;
const double PI = acos(-1);  // PI = 3.141593...

int main() {
    int d;
    cin >> d;
    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(d, vector<int>(26));
    rep(i, d) rep(j, 26) cin >> s[i][j];

    rep(i, d) {
        vector<int>::iterator m = max_element(s[i].begin(), s[i].end());
        cout << distance(s[i].begin(), m)+1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3692
from collections import Counter

n = int(input())
d = list(map(int, input().split()))
mod = 998244353

c = Counter(d)
if c[0] != 1 or d[0] != 0:
    print(0)
else:
    ans = 1
    for i in range(1, max(d)+1):
        ans *= c[i-1] ** c[i]
        ans = ans % mod
    print(ans)

Measured memory_bytes: 19936
while True:
    m,f,r=map(int,input().split())
    if(m == -1 and f == -1 and r == -1):
        break
    if(m == -1 or f == -1):
        print("F")
    elif(m+f >= 80):
        print("A")
    elif(65 <= m+f):
        print("B")
    elif(50 <= m+f):
        print("C")
    elif(30 <= m+f and 50 > r):
        print("D")
    elif(30 <= m+f and 50 <= r):
        print("C")
    else:
        print("F")


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

int main(){
  int n, x, t;
  cin >> n >> x >> t;
  int ans = n / x;
  if(n % x == 0){
    cout << t * ans << "\n";
  }
  else{
    ans++;
    cout << t * ans << "\n";
  }

}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    ll ans=0;
    cin>>n;
    ll a[n+1],b[n];
    for(int i=0;i<=n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++){
        if(a[i]>b[i]){
            ans+=b[i];
        }
        else{
            ans+=a[i];
            b[i]-=a[i];
            if(a[i+1]>b[i]){
                ans+=b[i];
                a[i+1]-=b[i];
            }
            else{
                ans+=a[i+1];
                a[i+1]=0;
            }
        }
    }
    cout << ans<<endl;

    return 0;
}



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

int main(){
  int N;
  cin >> N;
  int a[100];
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  sort(a,a+N);
  long long A=0,B=0;
  for(int i=0;i<N;i++){
    if(i%2==0)A+=a[N-1-i];
    else B+=a[N-1-i];
  }
  cout << abs(A-B) << endl;
  return 0;
}

Measured memory_bytes: 256