akhauriyash/Code-Regression huggingface dataset:
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

/*
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
*/

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}
ll a[MAXN];
ll b[MAXN];


int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int n = readInt();
    for (int i = 1; i <= n; i++) {
    	a[i] = readInt(), b[i] = readInt();
    }
    ll add = 0;
    for (int i = n; i >= 1; i--) {
		a[i] += add;
		a[i] %= b[i];
		//ans += (a[i]);
		add += (a[i] == 0 ? 0 : b[i] - a[i]);    
    }
    cout << add;
    return 0;
}

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

int main() {
 vector<char> f(3) ;
 vector<char> s(3) ;
  
  for(int i = 0 ; i < 3 ; i++){
    cin >> f[i] ;
  }
  for(int i = 0 ; i < 3 ; i++){
    cin >> s[i] ;
  }
  reverse(s.begin(),s.end()) ;
  
  if(f==s) cout << "YES" << endl;
  else cout << "NO" << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<deque>
#include<queue>
#include<math.h>
#include<string>
#include<string.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<iomanip>
#include<map>
#include<unordered_map>
 
#include<unordered_map>
#include<algorithm>
#define inf 0x3f3f3f3f
#define sup_inf 2e18
#define pb push_back
 
#define ii pair<int,int>
#define f first
#define s second
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define iii pair<int, ii >
#define in freopen("entrada","r",stdin);
#define out freopen("myfile.txt", "w", stdout);
#define eps 1e-9
#define id pair<int ,double > 
#define di pair<double, int>
 
#define pi 3.14159265359
#define nl (no<<1)
#define nr ( (no<<1)|1)
//~ #define mid l + ( (r-l)>>1)
 
using namespace std;
 
const int maxn = 1e5 + 10;
const int MAX = 5e3 + 10;
typedef long long ll;
typedef vector< int> vi;		
 
//~ https://codeforces.com/contest/645/problem/D


 

int n, x;
int main (){
	//~ in
	
	cin >> n >> x;
	int cnt = 0;
	int e;
	for(int i = 0 ;i < n;i++)
		cin >> e, cnt+=(e>=x);
		
	cout << cnt << '\n';
}
 
		


Measured memory_bytes: 256
#create date: 2020-06-29 23:17

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def main():
    n = ni()
    a = na()
    l = [1] * n
    l[0] = a[0]
    r = [1] * n
    r[n-1] = a[n-1]
    for i in range(1, n):
        l[i] = gcd(l[i-1], a[i])
    for i in list(range(0, n-1))[::-1]:
        r[i] = gcd(r[i+1], a[i])
    ans = max(r[1], l[n-2])
    for i in range(1, n-1):
        ans = max(ans, gcd(l[i-1], r[i+1]))
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 22132
import sys
import heapq
sys.setrecursionlimit(10**8)


#最大公約数
def gcd(a,b):
	while b:
		a,b = b, a%b
	return a
	
#最小公倍数
def lcm(a,b):
	return a*b // gcd(a,b)



N,X = map(int,input().split())

ans = N

a = min(X,N-X)
b = max(X,N-X)

while True:	#a<b
	n = b//a 
	ans += n * 2 * a
	
	if n*a == b:
		ans -= a
		print(ans)
		sys.exit()
		
		
	a, b = b-n*a, a

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std ;
#define pb push_back
#define ll long long


int main() {

    string s ;
    cin >> s ;
    reverse(s.begin(),s.end()) ;
    ll n = s.size() , i , ans= 0 ;
    ll cnt[2020]={1,0} ;
    ll x , base = 1 , sum=0  ;
    for ( i = 0 ; i< n ; i++) {
        x = (int)s[i]-'0' ;
        sum+= (base*x) ;
        sum%=2019 ;
        base*=10 ;
        base%=2019 ;
        ans+=cnt[sum] ;
        cnt[sum]++ ;
      //  cout << sum  << endl ;
    }
    cout << ans << endl ;

    return 0 ;
}


Measured memory_bytes: 3752
import itertools

n = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

lst = list(itertools.permutations(P))

a = 0
b = 0
for i in lst:
    if i <= P:
        a += 1
    if i <= Q:
        b += 1

print(abs(a-b))


Measured memory_bytes: 8052
#include<stdio.h>
#define MAX 100

/*
  unvisited 0
  visited 1
  finished search 2
  
 */
int g[MAX][MAX], labels[MAX], n, d[MAX], f[MAX], time;


void dfs(int u) {
    int v;
    labels[u] = 1;
    d[u] = ++time;
    for(v=0; v<n; v++){
	if (g[u][v] && labels[v] == 0) {
	    dfs(v);
	}
    }
    labels[u] = 2;
    f[u] = ++time;
	
}

int main() {
    
    int i,u,k,v,j;
    scanf("%d",&n);
    for(i=0;i<MAX;i++){
	for(j=0;j<n;j++){
	    g[i][j]=0;
	}
    }
    for(i=0;i<n;i++){
	scanf("%d %d",&u, &k);
	for(j=0;j<k;j++){
	    scanf("%d",&v);
	    g[u-1][v-1]=1;
	}
    }

    time = 0;
    
    for(i=0; i<MAX; i++) {
	labels[i]=0;
    }
    

    /* ?????????????????????????¨????????????°dfs?????? */
    for(i=0; i<n; i++) {
	if (labels[i]==0) dfs(i);
    }
    /*print result */

    for(i=0; i<n; i++){
	printf("%d %d %d\n", i+1, d[i], f[i]);
    }
    
    return 0;

    
}

Measured memory_bytes: 640
/**
 *     author: qodjf
 *     created: 04.17.2020 12:47:47
 */
#include <bits/stdc++.h>
using namespace std;

string to_string(string s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) 42
#endif

#define mst(x, a) memset(x, a, sizeof(x))

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9 + 7;

int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};

int main() {
  string s, t;
  cin >> s >> t;
  int ssize = s.size(), tsize = t.size();
  string ans(ssize, 'z');
  bool succ = false;
  for (int i = 0; i < ssize; i++) {
    bool match = true;
    for (int j = 0; j < tsize; j++) {
      if (!(i + j < ssize && (s[i + j] == '?' || s[i + j] == t[j]))) {
        match = false;
        break;
      }
    }
    if (!match) continue;
    string ts = s;
    for (int j = 0; j < tsize; j++) {
      ts[i + j] = t[j];
    }
    for (int j = 0; j < ssize; j++) {
      if (ts[j] == '?') ts[j] = 'a';
    }
    ans = min(ans, ts);
    succ = true;
  }

  if (!succ) {
    cout << "UNRESTORABLE\n";
  } else {
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
N = int(input())
A = [list(map(int,input().split())) for _ in range(N)]
A.insert(0,[0,0,0])
for i in range(len(A)-1):
    dt = A[i+1][0]-A[i][0]
    dist = abs(A[i+1][1]-A[i][1])+abs(A[i+1][2]-A[i][2])
    if dist>dt:
        print("No")
        quit()
    if dist%2!=dt%2:
        print("No")
        quit()
print("Yes")

Measured memory_bytes: 27380
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int h, w, n;
    cin >> h >> w >> n;

    int sr, sc;
    cin >> sr >> sc;
    sr--; sc--;

    string s, t;
    cin >> s >> t;

    //駒が残るならtrueを返す
    auto f = [&](int k, char l, char r, int ss) {
        int x0 = 0, x1 = k - 1;//青木君が勝てる範囲
        for (int i = n - 1; i >= 0; i--) {
            if (t[i] == r && x0 > 0) x0--;
            if (t[i] == l && x1 < k - 1) x1++;

            if (s[i] == l) x0++;
            if (s[i] == r) x1--;
            if (x0 > x1) return false;
        }
        return x0 <= ss && ss <= x1;
    };

    //高橋君は、出せるなら出す 青木君は、出せるならパスする
    //青木君には、N回全部パスするという手がある 高橋君は少なくとも自力で脱出できる必要がある
    //縦と横のゲームがあり、高橋君はその片方に勝てばいい 1次元の場合だけ考えればいい
    //高橋君は左に脱出することができるか 高橋君は左を選択し左以外をパスする 青木君は右を選ぶが行きすぎても負ける
    //最後からi個を見て、LRの数で高橋君のLが青木君のRより3多ければ3左へ進める いや違う 高橋君を後攻と考えたほうがいいのでは
    //各時刻にどの範囲にあれば青木君が勝てるか

    cout << ((f(h, 'U', 'D', sr) && f(w, 'L', 'R', sc)) ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 920
#include <stdio.h>
int main(void)
{
    int i,j,k,n,m,l,a[100][100],b[100][100];
    long int s;
    scanf("%d%d%d",&n,&m,&l);
    
    
    for(i=0;i<n;i++)
        for(j=0;j<m;j++){
            scanf("%d",&a[i][j]);
        }
    for(i=0;i<m;i++)
        for(j=0;j<l;j++){
            scanf("%d",&b[i][j]);
        }
    for(i=0;i<n;i++)
        for(j=0;j<l;j++){
        s=0;
        for(k=0;k<m;k++)
        s+=a[i][k]*b[k][j];
        printf("%ld",s);
        if(j+1==l)
        printf("\n");
        else
        printf(" ");
        }
    return 0;
    
}



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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


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

    ll N, K;
    cin >> N >> K;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];
    sort(rall(H));
    if (N <= K) {
        cout << 0 << endl;
        return 0;
    }
    ll cnt = 0;
    REP(i, K, N) {
        cnt += H[i];
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1792
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

S=get_nsp
N=S.size
ans=0
(N-1).times do|i|
  ans+=1 if S[i]!=S[i+1]
end
puts ans

Measured memory_bytes: 6908
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> l(N);
  for (int i=0; i<N; i++) cin >> l.at(i);
  sort(l.begin(), l.end(), greater<int>());
  int sl=0;
  for (int i=0; i<K; i++)
    sl += l.at(i);
  cout << sl << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>

using namespace std;

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

    if (A >= 13)
    {
        cout << B << endl;
    }
    else if (A <= 12 && 6 <= A)
    {
        cout << B / 2 << endl;
    }
    else
    {
        cout << '0' << endl;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    
    static int[][] p;
    //static int h;
    //static int score;
    //static boolean end;
    
    static int check(int h, int score) {
        for(int i = 1; i <= 9; i++) {
            String c = String.valueOf(i);
            String s5 = c + c + c + c + c;
            String s4 = c + c + c + c;
            String s3 = c + c + c;
            for(int j = 0; j < h; j++) {
                String t = "";
                for(int k = 0; k < 5; k++) {
                    t += String.valueOf(p[j][k]);
                }
                if(t.indexOf(s5) != -1) {
                    score += i * 5;
                    p[j][0] = p[j][1] = p[j][1] = p[j][3] = p[j][4] = 0;
                }else if(t.indexOf(s4) != -1) {
                    score += i * 4;
                    int in = t.indexOf(s4);
                    p[j][in] = p[j][in+1] = p[j][in+2] = p[j][in+3] = 0;
                }else if(t.indexOf(s3) != -1) {
                    score += i * 3;
                    int in = t.indexOf(s3);
                    p[j][in] = p[j][in+1] = p[j][in+2] = 0;
                }
            }
        }
//        for(int i = 0; i < h; i++) {
//            for(int j = 0; j < 5; j++) {
//                System.out.print(p[i][j] + " ");
//            }
//            System.out.println();
//        }
        return score;
    }
    
    static void down(int h) {
        for(int j = 0; j < 5; j++) {
        	String s = "";
        	for(int i = 0; i < h; i++) {
        		s += String.valueOf(p[i][j]);
        		p[i][j] = 0;
        	}
        	s = s.replaceAll("0", "");
        	for(int i = 0; i < s.length(); i++) {
        		p[i][j] = Integer.parseInt(s.substring(i, i+1));
        	}
        }
    }
    
//    static void swap(int a, int b) {
//        int temp = a;
//        a = b;
//        b = temp;
//    }
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
            int h = sc.nextInt();
            if(h == 0) break;
            p = new int[h][5];
            for(int i = h-1; i >= 0; i--) {
                for(int j = 0; j < 5; j++) {
                    p[i][j] = sc.nextInt();
                }
            }
            
            int score = 0;

            while(true) {
                int oldscore = score;
                score = check(h, score);
                //System.out.println(score);
                if(score == oldscore) {
                    System.out.println(score);
                    break;
                }
                down(h);
//                for(int i = 0; i < h; i++) {
//                    for(int j = 0; j < 5; j++) {
//                        System.out.print(p[i][j] + " ");
//                    }
//                    System.out.println();
//                }
            }
        }        
    }
}


Measured memory_bytes: 107804
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
A = int(input())

if A == 1:
    print(0)
else:
    ls = factorization(int(A)) 
    ans = 0
    for n in range(len(ls)):
        ans += int((ls[n][1]*2 +1/4)**(1/2)-(1/2))
    print(ans)

Measured memory_bytes: 9496
a = int(input())
b = int(input())
def aez(n, k):
    s = str(n)
    ln = len(s)-1
    n1 = int(s[0])
    if len(s) < k:
        return 0
    else:
        if k == 1:
            return 9 * ln + n1 
        elif k == 2:
            return (81 * ln * (ln-1) // 2) + aez(int('9'*ln), 1)*(n1-1) + aez(int(s[1:]), 1)
        else:
            return (729*ln*(ln-1)*(ln-2)//6) + aez(int('9'*ln), 2)*(n1-1) + aez(int(s[1:]), 2)
print(aez(a, b))

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>

int toKey(char i)
{
    char c = i;
    if ('A' <= i && i <= 'Z') {
        c += ('z' - 'Z');
    }

    return (int)(c - 'a');
}

int main()
{

    int count[26] = {};
    std::string line;

    while (std::getline(std::cin, line)) {
        for (std::size_t i = 0; i < line.length(); ++i) {
            if ('A' <= (char)line[i] && (char)line[i] <= 'z') {
                int c = toKey(line[i]);
                count[c] += 1;
            }
        }
    }

    for (std::size_t i = 0; i < 26; ++i) {
        std::cout << (char)(i + 'a') << " : " << count[i] << std::endl;
    }

    return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;


int main(){
   ll a,b;cin >>a>>b;
   ll g=__gcd(a,b);
   map<ll,int>co;
    for (ll p = 2; p*p<= g; ++p) {
        while(g%p==0) {
            co[p]++;
            g /= p;
        }
    }
    if(g!=1)co[g]++;
    ll ans=co.size()+1;
    cout <<ans <<endl;
    return 0;
}

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

typedef struct p
{
    string name;
    int time;
} P;

#define LEN 100005
P Q[LEN + 1];
int head, tail, n;

void enqueue(P x)
{
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

P dequeue()
{
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}

int main()
{
    int elaps = 0, c;
    int i, q;
    P u;
    scanf("%d %d", &n, &q);

    for (i = 1; i <= n; i++)
    {
        string s;
        int t;
        cin >> s >> t;
        Q[i].name = s;
        Q[i].time = t;
    }
    head = 1;
    tail = n + 1;
    while (head != tail)
    {
        P p = dequeue();
        if (p.time > q)
        {
            p.time -= q;
            elaps += q;
            enqueue(p);
        }
        else
        {
            elaps += p.time;
            cout << p.name << " " << elaps << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 7148
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
ll rui(ll a,ll b){
    ll res=1;
    ll x=a;
    while(b){
        if(b&1)res=res*x%mod;
        b/=2;
        x=x*x%mod;
    }
    return res;
}
ll invmod(ll a){
    return rui(a,mod-2);
}
signed main(){
    ll n;cin>>n;
    ll s;cin>>s;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    ll k=invmod(2);
    vector<vector<ll> >dp(n+1,vector<ll>(s+1));
    dp[0][0]=rui(2,n);
    rep(i,n){
        rep(j,s+1){
            dp[i+1][j]=(dp[i+1][j]+dp[i][j])%mod;
            if(j+a[i]>s)continue;
            dp[i+1][j+a[i]]=(dp[i+1][a[i]+j]+dp[i][j]*k%mod)%mod;
        }
    }
    cout<<dp[n][s]<<endl;
}

Measured memory_bytes: 73680
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));
  $a = array_map('intval', explode(" ", trim(fgets(STDIN))));

  $ans=0;
  $max=$a[0];
  for($i=1;$i<$n;$i++){
    if($max > $a[$i]){
      $ans+=($max-$a[$i]);
    }else{
            $max=$a[$i];
    }
  }
  echo $ans;

Measured memory_bytes: 37960
str = gets.chomp
q = gets.chomp.to_i
q.times do
  statement, a, b, p = gets.chomp.split(/\s/)
  a = a.to_i
  b = b.to_i
  case statement
  when "print" then
    puts str[a..b]
  when "reverse" then
    str[a..b] = str[a..b].reverse
  when "replace" then
    str[a..b] = p
  end
end

Measured memory_bytes: 8724
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
int n,k,ans;
int a[111111];
signed main(){
	cin>>n;
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			for(int k=1;k<=100;k++){
				int num=i*i+j*j+k*k+i*j+j*k+k*i;
				if(num>n)continue;
				a[num]++;
			}
		}
	}
	for(int i=1;i<=n;i++){
		cout<<a[i]<<endl;
	}
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, ans = 0;
  cin >> n;
  vector<ll> d(n + 1);
  for (ll i = 1; i <= n; ++i)
  {
    for (ll j = i; j <= n; j += i)
    {
      d[j]++;
    }
  }
  for (ll i = 1; i <= n; ++i)
  {
    ans += d[i] * i;
  }
  cout << ans << endl;
}

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

#define YES(condition) if(condition){ cout << "YES" << endl; }else{ cout << "NO" << endl; }
#define Yes(condition) if(condition){ cout << "Yes" << endl; }else{ cout << "No" << endl; }
#define POSS(condition) if(condition){ cout << "POSSIBLE" << endl; }else{ cout << "IMPOSSIBLE" << endl; }
#define Poss(condition) if(condition){ cout << "Possible" << endl; }else{ cout << "Impossible" << endl; }
long power(long base, long exponent, long mod){ if(exponent % 2){ return power(base, exponent - 1, mod) * base % mod; }else if(exponent){ long root_ans = power(base, exponent / 2, mod); return root_ans * root_ans % mod; }else{ return 1; }}

int main(){
    int N;
    cin >> N;
    long nums[N];
    for(int i = 0; i < N; i++){
        cin >> nums[i];
    }
    sort(nums, nums + N);
    int near_half_max_index = 0;
    for(int i = 1; i < N; i++){
        if(abs(nums[near_half_max_index] * 2 - nums[N - 1]) > abs(nums[i] * 2 - nums[N - 1])){
            near_half_max_index = i;
        }
    }
    cout << nums[N - 1] << " " << nums[near_half_max_index] << endl;
}




Measured memory_bytes: 1024
s=input()
t=[0]*len(s)
count=1
a=[]
for i in range(1,len(s)):
  
  if s[i]==s[i-1]:
    count+=1
  else:
    a.append(count)
    count=1
a.append(count)
u=0
for i in range(len(a)):
  if i%2==0:
    u+=a[i]
    t[u-1]+=-(-a[i]//2)
    t[u]+=a[i]//2

  else:
    t[u-1]+=a[i]//2
    t[u]+=-(-a[i]//2)
    u+=a[i]
print(' '.join(map(str,t)))




Measured memory_bytes: 11260
#include<bits/stdc++.h>
using namespace std;
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define pa pair<int,int>
#define mod 998244353
#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define cl(x) memset(x,0,sizeof x)
#ifdef Devil_Gary
#define bug(x) cout<<(#x)<<" "<<(x)<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define bug(x)
#define debug(...)
#endif

const int INF = 0x7fffffff;
const int N=1e5+5;
/*
char *TT,*mo,but[(1<<15)+2];
#define getchar() ((TT==mo&&(mo=(TT=but)+fread(but,1,1<<15,stdin),TT==mo))?-1:*TT++)//*/
inline int read(){
    int x=0,rev=0,ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')rev=1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
    return rev?-x:x;
}
ll n,a[N],b[N],x[N],y[N],p[N];
ll ans[N]; 
void dfs(int i,int s,int sum){
	if(i==n+1){
		ll tmp=0;
		for(int j=1;j<=sum;j++){
			int t=a[j];
//			cout<<t<<" ";
			ll tt=min(abs(x[t]),abs(y[t]));
//			bug(tt);
			for(int k=1;k<=s;k++){
				
				if(b[k]>15){
//					bug(y[b[k]]);
					tt=min(tt,abs(y[t]-y[b[k]-15]));
				}
				else{
					tt=min(tt,abs(x[t]-x[b[k]]));
				}
			}
//			bug(tt);
			tmp+=tt*p[t];
		}
		ans[s]=min(ans[s],tmp);
//		puts("\n");
		return;
	}
	
	a[sum+1]=i;
	dfs(i+1,s,sum+1);
	
	b[s+1]=i;
	dfs(i+1,s+1,sum);
	
	b[s+1]=15+i;
	dfs(i+1,s+1,sum);
}
int main(){
#ifdef Devil_Gary
    freopen("in.txt","r",stdin);
//  freopen("out.txt","w",stdout);
#endif
	n=read();
	for(int i=1;i<=n;i++){
		x[i]=read(),y[i]=read(),p[i]=read();
	}
	for(int i=0;i<=n;i++) ans[i]=LONG_LONG_MAX/2;
	dfs(1,0,0);
	for(int i=0;i<=n;i++) cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<map>

using namespace std;

int main(){
    string w;
    map<char, int> score;
    unsigned int i;
    cin >> w;

    for (i=0; i<w.length(); i++){
        score[w[i]]++;
    }

    for (const auto& [key, value] : score){
        if (value % 2 == 1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main() {
	string s;
	cin >> s;
	int z = s.size();
	string ans = "AC";

	if (s[0] != 'A') ans = "WA";

	int a = 0;
	for (int i = 1; i < z; i++) {
		if (isupper(s[i])) {
			if (i == 1 || i == z - 1 || s[i] != 'C') {
					ans = "WA";		
			}
	    	a++;
		}
	}
	if ( a != 1)ans = "WA";


	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]
N,M=map(int,input().split())
a = list(map(int, input().split()))
k=0
t=a[0]
while 1:
    if t%2==0:
        k+=1
        t//=2
    else:
        break
K=2**k
from fractions import gcd
l=t
for i in a:
    if i%K==0 and (i//K)%2==1:
        t=i//K
        l=l*t//gcd(l,t)
        if l>M:
            print(0)
            break
    else:
        print(0)
        break
else:
    print((M-l*K//2)//(K*l)+1)

Measured memory_bytes: 14244
import itertools
N,M=map(int,input().split())
a=[]
b=[]
for i in range(M):
  a1,b1=map(int,input().split())
  a.append(a1)
  b.append(b1)

count=0

s=[i for i in range(1,N+1)]
x=list(itertools.permutations(s))
for i in x:
  if(i[0]!=1):
    break
  else:
    #print(i)
    flag=0
    for j in range(N-1):
      for k in range(len(a)):
        if((a[k]==i[j] and b[k]==i[j+1])or(b[k]==i[j] and a[k]==i[j+1])):
          flag+=1
          break
    if(flag==N-1):
      count+=1
print(count)

Measured memory_bytes: 8052
public class Main {
    public static void main(String args[]) {
        StringBuilder sb = new StringBuilder();
        
        
        for(int i = 1; i <= 9; i++) {
            for(int j = 1; j <= 9; j++) {
                System.out.printf("%dx%d=%d\r\n", i, j, i*j);
            }
        }
    }
}

Measured memory_bytes: 17952
h, w = [int(n) for n in input().split()]
i = min(h, w)
j = max(h, w)
area = i * j
if i % 3 == 0 or j % 3 == 0:
    print(0)
else:
    lst = []
    for r, s in [(i, j), (j, i)]:
        
        p = s // 3 + 1
        q = s // 3 
        a1 = r * p
        a2 = r * q
        b1 = r // 2 * (s - p)
        bb1 = (r // 2 - 1) * (s - p)
        b2 = r // 2 * (s - q)
        bb2 = (r // 2 - 1) * (s - q)
        c1 = (s - p) // 2 * r
        cc1 = ((s - p) // 2- 1) * r
        c2 = (s - q) // 2 * r
        cc2 = ((s - q) // 2 - 1) * r
        tup = [(a1, b1), (a2, b2), (a1, c1), (a2, c2),
               (a1, bb1), (a2, bb2), (a1, cc1), (a2, cc2)]
        lst.extend([abs(max(a, b, area - a - b) - min(a, b, area - a - b))
                    for a, b in tup])
    print(min(lst))

Measured memory_bytes: 3064
# n 枚の帽子を持っている。i番目の帽子には番号ai
# n 頭のラクダが輪っかになっててそこに帽子をかぶせる
# 3 ^ 5 = 011 ^ 101 = 110

n = int(input())
A = list(map(int, input().split()))
num = 0
for a in A:
    num = num ^ a

if num == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14212
n = int(input())
v = input().split()
c = input().split()
v = list(map(int, v))
c = list(map(int, c))
diff = list()
for i in range(n):
    if v[i] - c[i] > 0:
        diff.append(v[i] - c[i])

diff.sort()
diff.reverse()
if len(diff) >= 2:
    print(sum(diff))

elif len(diff) == 1:
    print(diff[0])

elif len(diff) == 0:
    print(0)

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

int n;
long long int k;

long long int h[52];
long long int p[52];
long long int pat(int lv, long long int shf);

int main()
{
scanf("%d %lld",&n,&k);
p[0]=1;
h[0]=1;
for(int i=1;i<=50;i++)
{
h[i]=h[i-1]*2+3;
p[i]=p[i-1]*2+1;
}
long long int ans=0;
if(k==h[n]){k--;}
if(k<=1+h[n-1])
{
ans=pat(n-1,k-1);
}
else{ans= p[n-1]+1+pat(n-1,k-2-h[n-1]); }
printf("%lld\n",ans);

}

long long int pat (int lv, long long int shf)
{
if(lv==0){if(shf==1){return 1;} else{return 0;}}
if(shf==h[lv]){shf--;}
long long int get;
if(shf==0){get=0;}
else if(shf<=1+h[lv-1]){get= pat(lv-1, shf-1);}
else
{
get = p[lv-1] + pat(lv-1, shf-h[lv-1]-2) +1;
}
return get;
}

Measured memory_bytes: 128
import math
a,b,x = map(int,input().split())

if b*a**2 == x:
	print(0)
	exit()

s = 2*x/(a*b)
if s < a:
	print(math.atan(b/s)/math.pi*180)
else:
	s = 2*b-2*x/(a**2)
	print(90-math.atan(a/s)/math.pi*180)

Measured memory_bytes: 3444
#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>;
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; }

const ll INF = ll(1e18)+1;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; ll k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    ll l = -INF, r = INF;
    while(l+1 < r){
    	ll x = (l+r)/2;
    	bool ok = [&]{
    		ll tot = 0;
    		rep(i, n){
    			if(a[i] < 0){
    				int l = -1, r = n;
    				while(l+1 < r){
    					int c = (l+r)/2;
    					if(a[c]*a[i] < x) r = c;
    					else l = c;
    				}
    				tot += n-r;
    			}
    			else{
    				int l = -1, r = n;
    				while(l+1 < r){
    					int c = (l+r)/2;
    					if(a[c]*a[i] < x) l = c;
    					else r = c;
    				}
    				tot += r;
    			}
    			if(a[i]*a[i] < x) tot--;
    		}
    		tot /= 2;
    		return tot < k;
    	}();
    	if(ok) l = x;
    	else r = x;
    }
    cout << l << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define ll long long
int main(){
    int l, r, d;
    cin >> l >> r >> d;
    cout << r/d - (l - 1)/d << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
int main(void){
    // Your code here!
 int n;
 string s;
 cin >> s;
 n=s.length();
 if(s[n-1]=='s')
 s.append(1,'e');
 s.append(1,'s');
 cout << s;
 return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9

int main(){
	int n,y;
	cin>>n>>y;
	rep(i,n+1)rep(j,n-i+1){
	    if(i*10000+j*5000+(n-i-j)*1000==y){cout<<i<<" "<<j<<" "<<n-i-j<<endl;return 0;}
	}
	cout<<"-1 -1 -1"<<endl;
	return 0;
}


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

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

  while (n--) {
    int y, m, d;
    cin >> y >> m >> d;

    int ans = 0;
    for (int i = y; i < 1000; ++i) {
      for (int j = (i == y ? m : 1); j <= 10; ++j) {
        for (int k = (i == y && j == m ? d : 1); k <= (j & 1 || i % 3 == 0 ? 20 : 19); ++k) {
          ans++;
        }
      }
    }

    cout << ans << endl;
  }
}

Measured memory_bytes: 2984
#include <iostream>

struct Node {
    Node(int key): key(key) {}
    Node *left=nullptr, *right=nullptr, *parent=nullptr;
    int key;
};


void insert(Node * &root, int k) {
    Node *y = nullptr;
    Node *x = root;
    while (x != nullptr) {
        y = x;
        if (k < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    Node * z = new Node(k);
    z->parent = y;
    if (y == nullptr) {
        root = z;
    } else if (z->key < y->key) {
        y->left = z;
    } else {
        y->right = z;
    }
}

void find(Node * root, int k) {
    if (root == nullptr) {
        std::cout << "no" << std::endl;
        return;
    }
    if (root->key == k) {
        std::cout << "yes" << std::endl;
        return;
    }
    if (k < root->key) {
        find(root->left, k);
    } else {
        find(root->right, k);
    }
}

void print_lef(Node * n) {
    if (n->left != nullptr) {
        print_lef(n->left);
    }
    std::cout << " " << n->key;
    if (n->right != nullptr) {
        print_lef(n->right);
    }
}

void print_mid(Node *n) {
    std::cout << " " << n->key;
    if (n->left != nullptr) {
        print_mid(n->left);
    }
    if (n->right != nullptr) {
        print_mid(n->right);
    }
}


int main(int argc, char ** argv) {
    int m;
    std::cin >> m;
    
    Node * root = nullptr;

    for (int i = 0; i < m; i++) {
        std::string command;
        std::cin >> command;
        if (command == "insert") {
            int k;
            std::cin >> k;
            insert(root, k);
        } else if (command == "find") {
            int k;
            std::cin >> k;
            find(root, k);
        } else {
            print_lef(root);
            std::cout << std::endl;
            print_mid(root);
            std::cout << std::endl;
        }
    }
}



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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 100010

string S, T;

bool IsMatch(string s, string t) {
    REP(i, s.length()) {
        if(s[i] != t[i] && s[i] != '?') { return false; }
    }
    if(s.length() != t.length()) { return false; }
    return true;
}

signed main()
{
    cin >> S >> T;
    ll t_ind = -1;
    REP(i, S.length() - T.length() + 1) {
        if(IsMatch(S.substr(i, T.length()), T)) { t_ind = i; }
    }
    if(t_ind == -1) {
        printf("UNRESTORABLE\n");
        return 0;
    }
    string ans = "";
    REP(i, S.length()) {
        if(i == t_ind) {
            ans += T;
            i += T.length() - 1;
        } else {
            ans += (S[i] == '?') ? 'a' : S[i];
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <cstring>
#include <tuple>
using namespace std;
typedef long long ll;
int main() {
    int a, b, c;
    cin >> a >> b >> c;

    if (a < b && b < c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 1156
# coding: utf-8
def get_ln_inputs():
    return input().split()


def get_ln_int_inputs():
    return list(map(int, get_ln_inputs()))


def main():
    prices = get_ln_int_inputs()
    N = get_ln_int_inputs()[0]
    M = N * 4

    prices_per_8litre = [prices[i] * (1 << (3 - i)) for i in range(4)]
    price_rank = [prices_per_8litre.index(price_per_8l) for price_per_8l in sorted(prices_per_8litre)]

    result = [0, 0, 0, 0]

    idx = 0
    if price_rank[idx] == 3:
        result[3] += M // 8
        M %= 8
        idx += 1
    
    cp = price_rank[idx]
    result[cp] += M // (1 << cp)

    print(sum(prices[i] * result[i] for i in range(4)))
    return


main()


Measured memory_bytes: 3064
from collections import defaultdict
from math import sqrt
n, p = list(map(int, input().split()))
# pの素因数をnで分配する
insu = defaultdict(int)
while True:
    flag = True
    for i in range(2, int(sqrt(p))+1):
        if not p%i:
            insu[i] += 1
            p = p//i
            flag = False
            break
    if flag:
        insu[p] += 1
        break
ans = 1
for k, v in insu.items():
    ans *= k**(v//n)
print(ans)


Measured memory_bytes: 3700
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    int n,x=0,ans=0;
    string s;
    cin>>n>>s;
    for(int i=0;i<n;i++){
        if(s[i]=='I')x++;
        else x--;
        if(ans<x) ans=x;
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int i, p, sumA=0, sumB=0;
int main () {
    for (i=1; i<=4; i++) {
        cin >> p;
        sumA += p;
    }
    for (i=1; i<=4; i++) {
         cin >> p;
         sumB += p;
    }
    cout << max(sumA,sumB) << endl;
    return 0;
}

Measured memory_bytes: 3080
n, k = map(int, input().strip().split())

rr = [0] * n

for i in range(k):
  d = map(int, input().strip().split())
  aa = map(int, input().strip().split())
  for a in aa:
    rr[a-1] += 1

print(sum(1 for r in rr if r == 0))


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

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

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

const int N = 100010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 1023456789;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

// OrderedSet
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template < typename T > using ordered_set = tree < T, null_type, greater < T >, rb_tree_tag, tree_order_statistics_node_update >;

int n;

char s[N];

int main(){
  fastScan(n);
  scanf("%s", s);
  int r = 0, b = 0;
  for(int i = 0; s[i] ; i++){
    if(s[i] == 'R') r++;
    else b++;
  }
  puts(r > b ? "Yes" : "No");
}


Measured memory_bytes: 256
<?php
  fscanf(STDIN,'%d',$N);
  $arr = str_split($N);
  $sum=0;
  for($i=0;$i<count($arr);$i++){
    $sum = $sum + $arr[$i];
  }
  if($N%$sum==0){
  echo 'Yes';
  }else{
  echo 'No';
  }

  
  
  
  
  ?>

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,m;
    cin >> n >> m;
    vector<ll> x(n);
    vector<ll> y(n);
    vector<ll> z(n);
    for(i = 0;i < n;++i){
        cin >> x.at(i) >> y.at(i) >> z.at(i);
    }
    ll ans = 0;
    for(i = 0;i < 8;++i){
        ll tans = 0;
        vector<ll> tx = x;
        vector<ll> ty = y;
        vector<ll> tz = z;
        if(i & 1){
            rep(j,n){
                tx.at(j) *= -1;
            }
        }
        if(i & 2){
            rep(j,n){
                ty.at(j) *= -1;
            }
        }
        if(i & 4){
            rep(j,n){
                tz.at(j) *= -1;
            }
        }
        vector<ll> tv;
        rep(j,n){
            ll tmp = tx.at(j) + ty.at(j) + tz.at(j);
            tv.push_back(tmp);
        }
        sort(all(tv));
        for(j = 0;j < m;++j){
            tans += tv.at(n-1-j);
        }
        ans = max(ans, tans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#include <bitset>
#include <complex>
#include <cassert>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define GI(i) (scanf("%d",&i))
#define GLL(i) (scanf("%lld",&i))
#define GD(i)  (scanf("%lf",&i))
#define PB          push_back
#define MP          make_pair
#define MT          make_tuple
#define GET0(x)     (get<0>(x))
#define GET1(x)     (get<1>(x))
#define GET2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       (1LL<<60)
#define LLMIN       -(1LL<<50)
#define IMAX        (1<<30)
#define IMIN        -(1<<30)
typedef long long LL;
using namespace std;

LL N,M;
LL X[1000],Y[1000],Z[1000];
LL DP[1000+1][1000+1];

int main(void){
    GLL(N);GLL(M);
    REP(i,N){
        GLL(X[i]);GLL(Y[i]);GLL(Z[i]);
    }
    LL ans = LLMIN;
    for(LL xflag=-1;xflag<2;xflag+=2)
        for(LL yflag=-1;yflag<2;yflag+=2)
            for(LL zflag=-1;zflag<2;zflag+=2){
                for(LL i=0;i<N;i++){
                    LL v = X[i]*xflag + Y[i]*yflag + Z[i]*zflag;
                    for(LL j=0;j<=M;j++){
                        if(i==0){
                            if(j==0)
                                DP[i][j] = 0;
                            else if(j==1)
                                DP[i][j] = v;
                            else
                                DP[i][j] = LLMIN;
                        }else if(j==0)
                            DP[i][j] = 0;
                        else{
                            DP[i][j] = max(DP[i-1][j-1] + v, DP[i-1][j]);
                        }
                    }
                }
                ans = max(ans, DP[N-1][M]);
            }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
signed main(){
  int a;
  cin>>a;
  vector<int> b(a),c(a-1);
  fo(i,a)
    cin>>b[i];
  Sort(b);
  int d=b[a-1],e=1000000008,f;
  fo(i,a-1){
    if(d%2==0)
      c[i]=abs(b[i]-(d/2));
    else
       c[i]=min<int>(abs(b[i]-(d/2)),abs(b[i]-(d/2+1)));
  }
  fo(i,a-1){
    if(e>=c[i]){
      e=c[i];
      f=i;
    }
  }
  cout<<d<<' '<<b[f]<<endl;
}

Measured memory_bytes: 1792
#include <cstdio>

int abs(int a) {
    if (a < 0) return -a;
    return a;
}

int main() {
    int N = 0, K = 0;
    scanf("%d %d", &N, &K);

    int (*candle) = new int[N]();
    for (int i = 0; i < N; i++) {
        scanf("%d", &(candle[i]));
    }

    if (K == 1) {
        printf("%d\n", abs(candle[0]));
        return 0;
    }

    int i = 0, j = 0;
    long sum = 0, rlt = ((unsigned long)-1) >> 1;

    for (; j + 1 < K; j++) {
        sum += abs(candle[j] - candle[j + 1]);
    }

    for (; j < N; i++, j++) {
        // printf("[DEBUG] [%d][%ld][%d]\n", candle[i], sum, candle[j]);
        long temp = (abs(candle[i]) < abs(candle[j])) ? (sum + abs(candle[i])) : (sum + abs(candle[j]));
        // printf("[DEBUG] rlt = %ld -> %ld\n", rlt, temp);
        if (temp < rlt) {
            rlt = temp;
        }

        sum = sum - abs(candle[i + 1] - candle[i]) + abs(candle[j + 1] - candle[j]);
    }
    printf("%ld\n", rlt);

    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(){
	int high[4];
	int i,j,n;
	for(i=0;i<3;i++){
		high[i]=0;
	}
	for(i=0;i<10;i++){
		scanf("%d",&high[3]);
		for(j=2;j>=0;j--){
			if(high[j]<high[j+1]){
				n=high[j];
				high[j]=high[j+1];
				high[j+1]=n;
			}
		}
	}
	for(i=0;i<3;i++){
		printf("%d\n",high[i]);
	}
	return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().Split(' ');
        var d = new int[n];
        for (int i = 0; i < n; i++)
        {
            d[i] = int.Parse(s[i]);
        }

        var maps = new[] {
            new Dictionary<int, int>(),
            new Dictionary<int, int>()
        };

        for (int i = 0; i < d.Length; i++)
        {
            if (maps[i % 2].ContainsKey(d[i]))
            {
                maps[i % 2][d[i]]++;
            }
            else
            {
                maps[i % 2][d[i]] = 1;
            }
        }

        var maxs = new[] {
            new[] { new KeyValuePair<int, int>(), new KeyValuePair<int, int>(), },
            new[] { new KeyValuePair<int, int>(), new KeyValuePair<int, int>(), },
        };

        for (int i = 0; i < 2; i++)
        {
            var max = maxs[i];
            var map = maps[i];

            foreach (var item in map)
            {
                if (max[1].Value < item.Value)
                {
                    if (max[0].Value < item.Value)
                    {
                        max[1] = max[0];
                        max[0] = item;
                    }
                    else
                    {
                        max[1] = item;
                    }
                }
            }
        }

        var dx = new[] { 0, 0, 1 };
        var dy = new[] { 0, 1, 0 };

        var ans = int.MinValue;

        for (int i = 0; i < 3; i++)
        {
            if (maxs[0][dx[i]].Key != maxs[1][dy[i]].Key)
            {
                ans = Math.Max(ans, maxs[0][dx[i]].Value + maxs[1][dy[i]].Value);
            }
        }

        Console.WriteLine(n - ans);
    }
}

Measured memory_bytes: 24160