akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int main(){
    int l,r,d;
    cin>>l>>r>>d;
    int ans=0;
    for(int i=l;i<=r;i++){
        if(i%d==0){
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3604
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    cin >> n;
    cout << n + n*n + n*n*n;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFLL = LLONG_MAX / 3;
const double eps = (1e-9);


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

  int n; cin >> n;
  string s; cin >> s;
  int n_open = 0;
  int n_close = 0;
  int count = 0;
  rep(i, s.size()) {
    if (s[i] == '(') count++;
    else if (s[i] == ')') count--;
    if (count < 0) {
      n_open -= count;
      count = 0;
    }
  }

  n_close = count;

  cout << string(n_open, '(') << s << string(n_close, ')') << endl;

  return 0;
}


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

int main() {
    string w;
    cin >> w;

    vector<int> res(30);
    for (int i = 0; i < w.size(); i++) {
        res[w[i] - 'a']++;
    }

    bool flag = true;
    for (int i = 0; i < 30; i++) {
        if (res[i] % 2 != 0) {
            flag = false;
        }
    }

    if (flag) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
def bfs(start_y,start_x,goal_y,goal_x):
    bfs_map = [[-1 for x in range(w)] for y in range(h)]
    move_y = [1,-1,0,0]
    move_x = [0,0,1,-1]
    data_y = [start_y]
    data_x = [start_x]
    bfs_map[start_y][start_x] = 1
    while len(data_x) != 0:
        y = data_y.pop(0)
        x = data_x.pop(0)
        for i in range(4):
            y += move_y[i]
            x += move_x[i]
            if y >= 0 and y < h and x >= 0 and x < w:
                if y == goal_y and x == goal_x:
                    return "Yes"
                if bfs_map[y][x] == -1 and stage[y][x] == ".":
                    bfs_map[y][x] = 1
                    data_y.append(y)
                    data_x.append(x)
            y -= move_y[i]
            x -= move_x[i]
    return "No"
h,w,d,n = map(int, input().split())
stage = [input() for i in range(h)]
r = list(map(int, input().split()))
da = [list(map(int, input().split())) for i in range(n)]
ma = [[0 for x in range(w)] for y in range(h)]
for x,y,s in da:
    if s == d:
        for i in range(h):
            for j in range(w):
                ma[i][j] += 1
    if s < d:
        for i in range(y-r[s], y+r[s]+1):
            for j in range(x-r[s], x+r[s]+1):
                if i >= 0 and i < h and j >= 0 and j < w:
                    ma[i][j] += 1
    if s != 0:
        for i in range(y-r[s-1], y+r[s-1]+1):
            for j in range(x-r[s-1], x+r[s-1]+1):
                if i >= 0 and i < h and j >= 0 and j < w:
                    ma[i][j] -= 1
ans = []
for i in range(h):
    for j in range(w):
        if stage[i][j] == "D":
            o = i
            l = j
        if ma[i][j] == n and stage[i][j] != "#":
            ans.append([i,j])
if len(ans) == 0:
    print("Broken")
    quit()
key = ["Broken" for i in range(len(ans))]
for i in range(len(ans)):
    key[i] = bfs(o,l,ans[i][0],ans[i][1])
    if o == ans[i][0] and l == ans[i][1]:
        key[i] = "Yes"
for i in range(1,len(key)):
    if key[i] != key[i-1]:
        print("Unknown")
        quit()
print(key[0])


Measured memory_bytes: 5816
#include <stdio.h>

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

    if (a >= b )
        if (a <= c)
            printf("%d", 10*c + a + b);
        else
            printf("%d", 10*a + b + c);
    else 
        if (b <= c)
            printf("%d", 10*c + a + b);
        else
            printf("%d", 10*b + a + c);
        
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
ll INF = 1LL<<58;

string strMax(string a, string b){
    if(a.size() > b.size()){
        return a;
    }else if(a.size() < b.size()){
        return b;
    }else{
        if(a > b){
            return a;
        }else{
            return b;
        }
    }
}

int main() { 
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int map[10] = {0,2,5,5,4,5,6,3,7,6};
    
    int N, M;
    cin >> N >> M;
    vector<string> dp(N+9,"-");
    dp[0] = "";
    vector<int> A(M);
    REP(i, M){
        cin >> A[i];
    }
    REP(i, N){
        if(dp[i] == "-") continue;
        for(auto a : A){
            if(i+map[a] <= N){
                dp[i+map[a]] = strMax(dp[i+map[a]], dp[i] + (char)('0' + a));
            }
        }
    }
    cout << dp[N] << endl;
    
    return 0;
}


Measured memory_bytes: 43776
import math
from functools import reduce
n = int(input())

n_frac = math.factorial(n)

_n_frac = n_frac
prime_numbers = {}

for i in range(2, n_frac +1):
    if _n_frac == 1:
        break
    while True:
        div, mod = divmod(_n_frac, i)
        if mod != 0:
            break
        _n_frac = div
        if i in prime_numbers:
            prime_numbers[i] += 1
        else:
            prime_numbers[i] = 1

n_divisor = reduce(lambda x,y:x*(y+1), prime_numbers.values(), 1 )
result = n_divisor % (10**9 +7)

print(result)


Measured memory_bytes: 3572
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	cout << (((A + B) % 2 == 0) ? (A + B) / 2 : (A + B) / 2 + 1);
}


Measured memory_bytes: 256
n,k = map(int,input().split())
X = list(map(int,input().split()))
ans = []
for l in range(n-k+1):
  r = l+k-1 
  ans.append(min(abs(X[l])+abs(X[l]-X[r]),abs(X[r])+abs(X[r]-X[l])))
print(min(ans))

Measured memory_bytes: 14392
#include <iostream>

using namespace std;

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

    int c[n];
    for (int i = 1; i <= n - 1; i++) {
        c[i] = n;
    }

    int a, b;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        if (c[a] > b - 1) {
            c[a] = b - 1;
        }
    }

    bool removed[n];
    for (int i = 1; i <= n - 1; i++) {
        removed[i] = false;
    }

    for (int i = 1; i <= n - 1; i++) {
        if (c[i] != n) {
            int max = c[i];
            for (int j = i + 1; j <= max; j++) {
                if (c[j] != n) {
                    if (c[j] < max) {
                        max = c[j];
                    }
                }
            }
            removed[max] = true;
            i = max;
        }
    }

    int numOfRemoved = 0;
    for (int i = 1; i <= n - 1; i++) {
        if (removed[i]) {
            numOfRemoved++;
        }
    }

    cout << numOfRemoved << endl;

    return 0;
}


Measured memory_bytes: 768
import java.util.Scanner;

public class Main{
  static String[] str;
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String A = sc.next();
    str = A.split("/",0);
    int Toshi = Integer.parseInt(str[0]);
    int Tuki = Integer.parseInt(str[1]);
    int Aate = Integer.parseInt(str[2]);

    if(Toshi>2019){
      System.out.println("TBD");
    }
    else if(Tuki>4){
      System.out.println("TBD");
    }
    else if(Aate>30){
      System.out.println("TBD");
    }
    else{
      System.out.println("Heisei");
    }
  }
}


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

int main() {
	int N,c=0;
	string s;
	cin >> N >> s;

	rep(i,N)
		c += (s.at(i) == 'R');
	cout << ((c*2>N) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
a, b, c = map(int, input().split())
k = int(input())

ans = 0
for i in range(10**5):
    if a < b*(2**i):
        b = b*(2**i)
        break
    ans += 1
for i in range(10**5):
    if b < c*(2**i):
        break
    ans += 1
if ans <= k:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9092
#include <algorithm> //STLͨ���㷨
#include <cmath> //������ѧ����
#include <cstdio> //��������/�������
#include <iostream> //����������/���
#include <cstring> //�ַ�������
#include <string> //�ַ�����
#include <ctime> //�������ʱ��ĺ���
#define itn int
#define fro for
#define ll long long
#define reg register
#define inf 1234567890
#define rep(i,a,b,c) for (int i=a;i<=b;i+=c)
/*#include <bitset> //STLλ������
#include <cstype> //�ַ�����
#include <cerrno> //���������
#include <complex> //������
#include <clocale> //���屾�ػ�����
#include <cstdlib> //������������ڴ���亯��
#include <deque> //STL˫�˶�������
#include <exception> //�쳣������
#include <fstream> //�ļ�����/���
#include <functional> //STL�������㺯��(���������)
#include <limits> //�����������������ֵ����
#include <list> //STL�����б�����
#include <map> //STLӳ������
#include <iomanip> //����������/���
#include <ios> //��������/���֧��
#include <iosfwd> //����/���ϵͳʹ�õ�ǰ������
#include <istream> //����������
#include <ostream> //���������
#include <queue> //STL��������
#include <set> //STL��������
#include <sstream> //�����ַ�������
#include <stack> //STL��ջ����
#include <stdexcept> //��׼�쳣��
#include <streambuf> //�ײ�����/���֧��
#include <utility> //STLͨ��ģ����
#include <vector> //STL��̬��������
#include <cwchar.h>//���ַ�����������/���
#include <cwctype.h> //���ַ�����*/

using namespace std;

int ans;

int max(int x,int y){return x>y?x:y;}

int min(int x,int y){return x<y?x:y;}

int abs(int x){return x>0?x:-x;}

int gcd(int x,int y){return (!y)?x:gcd(y,x%y);}

void exgcd(int a,int b,int &d,int &x,int &y){if (!b){d=a,x=1,y=0;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}


inline char read() {
	static const int IN_LEN = 1000000;
	static char buf[IN_LEN], *s, *t;
	return (s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin), (s == t ? -1 : *s++) : *s++);
}
template<class T>
inline void read(T &x) {
	static bool iosig;
	static char c;
	for (iosig = false, c = read(); !isdigit(c); c = read()) {
		if (c == '-') iosig = true;
		if (c == -1) return;
	}
	for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');
	if (iosig) x = -x;
}

char sr[10000000],z[20];int C=-1,Z=0;
void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(int x){
	if (x<0) sr[++C]='-',x=-x;
    while(z[++Z]=x%10+48,x/=10);
    while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
//int find(int x){return fa[x]=fa[x]==x?x:find(fa[x]);}

//void add(int x,int y,int z){to[++cnt]=y;v[cnt]=z;Next[cnt]=head[x];head[x]=cnt;}
const int mod=998244353,N=512;
int a[N][N],s[N][N];

int quick_power(ll a,int b){ll r=1;for (;b;b>>=1,a=a*a%mod)if (b&1) r=r*a%mod;return r;}

int main()
{
	int n,m;
	read(n);read(m);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++) read(a[i][j]);
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=m;j++)
		{
			if (a[i][j])
			{
				if (!s[j][j])
				{
					for (int k=j;k<=m;k++) s[j][k]=a[i][k];
					ans++;
					break;
				}
				else
				{
					for (int k=j;k<=m;k++) a[i][k]^=s[j][k];
				}
			}
		}
	}
	ans=1ll*(quick_power(2,n)-quick_power(2,n-ans))*quick_power(2,m-1)%mod;
	(ans+=mod)%=mod;
	cout<<ans;
	return 0;
}









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

int main() {
  int64_t H, W;
  cin >> H >> W;

  int64_t ans;
  
  if (H == 1 || W == 1) ans = 1;
  else ans = ((H*W)+1)/2;
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  sort(a.rbegin(), a.rend());
  int ans = a[0];
  int cnt = n - 2;
  for(int i = 1; i < n; i++){
    if(cnt > 0){
      ans += a[i]; cnt--;
    }
    if(cnt > 0){
      ans += a[i]; cnt--;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4748
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
#define ll long long 
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define RREP(i,n) for (int i=(n-1); i>=0; i--)
#define ALL(x) x.begin(),x.end()
#define SZ(x) x.size()
#define MNTO(a,b) a = min(a,(__typeof__(a))(b))
#define MXTO(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define debug(x) cerr<<#x<<" is "<<x<<endl
using namespace std;

// #define int ll

const int maxn = 1e5+5;
const int iinf = 1<<29;
const ll inf = 1ll<<60;
const ll mod = 1e9+7;


void GG(){cout<<"No\n"; exit(0);}


main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    bool nn = 0;
    int n; cin>>n;
    vector<ll> a(n);
    ll S = 0;
    ll mn = inf;
    REP(i,n) {
    	cin>>a[i]; S+=abs(a[i]); MNTO(mn, abs(a[i])); if (a[i]<0) nn^=1;
    }
    if (nn){
    	cout<<S-mn*2<<endl;
    }else{
    	cout<<S<<endl;
    }

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
int main()
{
    char s[200002],t[200002];
    int count=0;
    cin>>s>>t;

    for(int i=0;i<strlen(s);i++){
        if(s[i]!=t[i]){ count++;}


    }
    cout<<count<<endl;


}



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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

struct mint {
    // Preparation: MOD is already defined.
    ll value;

    mint(ll value = 0) : value((value % MOD + MOD) % MOD) {}

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint pow(mint m) const {
        return pow(m.value);
    }

    mint inv() const {
        ll a = value, b = MOD, u = 1, v = 0;
        while (b) {
            ll t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        return u;
    }

    mint &operator+=(const mint a) {
        if ((value += a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((value += MOD - a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (value *= a.value) %= MOD;
        return *this;
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

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

    SPC(12);
    ld div3 = n / 3.0;
    ld ans = div3 * div3 * div3;
    out(ans);
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	i, err := strconv.Atoi(readString())
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func vi(n int, args ...int) []int {
	res := make([]int, n)
	if len(args) == 0 {
		return res
	}
	v := args[0]
	if v == 0 {
		return res
	}
	for i := 0; i < n; i++ {
		res[i] = v
	}
	return res
}

func vvi(n int, args ...int) [][]int {
	res := make([][]int, n)
	m := n
	if len(args) > 0 {
		m = args[0]
	}
	v := 0
	if len(args) > 1 {
		v = args[1]
	}
	for i := 0; i < n; i++ {
		res[i] = vi(m, v)
	}
	return res
}

type UF struct {
	parent []int
	rank   []int
}

func NewUF(n int) *UF {
	u := &UF{
		parent: make([]int, n),
		rank:   make([]int, n),
	}

	for i := range u.parent {
		u.parent[i] = i
		u.rank[i] = 0
	}

	return u
}

func (u *UF) findParent(i int) int {
	if u.parent[i] == i {
		return i
	}
	p := u.findParent(u.parent[i])
	u.parent[i] = p
	return p
}

func (u *UF) Union(i, j int) {
	pi := u.findParent(i)
	pj := u.findParent(j)

	if pi == pj {
		return
	}

	if u.rank[pi] > u.rank[pj] {
		u.parent[pj] = pi
	} else {
		u.parent[pi] = pj
		if u.rank[pi] == u.rank[pj] {
			u.rank[pj]++
		}
	}
}

func (u *UF) IsSame(i, j int) bool {
	pi := u.findParent(i)
	pj := u.findParent(j)

	return pi == pj
}

func main() {
	defer stdout.Flush()

	// readString() string
	// readInt() int
	// readIntSlice(n int) []int
	// readLengthAndSlice() []int

	N := readInt()
	M := readInt()
	p := vi(N + 1)
	for i := 1; i <= N; i++ {
		p[i] = readInt()
	}
	x := vi(M)
	y := vi(M)
	for i := range x {
		x[i] = readInt()
		y[i] = readInt()
	}

	uf := NewUF(N + 1)

	for i := 0; i < M; i++ {
		uf.Union(p[x[i]], p[y[i]])
	}

	count := 0
	for i := 1; i <= N; i++ {
		if uf.IsSame(i, p[i]) {
			count++
		}
	}
	println(count)
}


Measured memory_bytes: 6400
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = dict()
ans = 0
for i in s:
    if "".join(sorted(i)) in dic:
        ans += dic["".join(sorted(i))]
        dic["".join(sorted(i))] +=1
    else:
        dic["".join(sorted(i))] = 1
print(ans)

Measured memory_bytes: 104568
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();


int main(){
  int n,m;
  string res;
  
  cin >> n >> m;
  if(n-m!=0)
    res = "No";
  else
    res = "Yes";
  cout << res << endl;

}


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

pair<int,int> a[200010];
int pos[200010];

int main() {
	int n;
	scanf("%d",&n);
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d",&x);	
		a[i] = make_pair(x,i);
	}
	sort(a,a+n);
	for (int i = 0; i < n; i++) pos[a[i].second] = i;
	for (int i = 0; i < n; i++) {
		if (pos[i] < n/2) printf("%d\n",a[n/2]);
		else printf("%d\n",a[n/2-1]);
	}
	
}

Measured memory_bytes: 4480
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef int64_t lint;
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using lb = long double;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define debug(x) cerr << #x << ": " << x << "\n"//手動デバッグ
#define YES(c) cout<<((c)?"YES\n":"NO\n"),0
#define Yes(c) cout<<((c)?"Yes\n":"No\n"),0
#define O(p) cout<<p<<"\n",0
#define OS(p) cout<<p<<" ",0
#define ON(p) cout<<p,0
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define endl "\n"//endlを置き換える
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定

const int dy[4]={1,0,-1,0};
const int dx[4]={0,1,0,-1};//^>v<

template<class T=int> T in(){
    T x;
    cin>>x;
    return (x);
}
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;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
//------------------------------------------------------------





//------------------------------------------------------------
int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
//------------------------------------------------------------
    int n;cin>>n;
    vector<ll> L(n);
    rep(i,n){
        cin>>L[i];
    }
    if(n<=2){
        O(0);
        return 0;
    }
    ll ans=0;
    rep(i,n-2){
        FOR(j,i+1,n-1){
            FOR(k,j+1,n-1){
                if(L[i]!=L[j] && L[j]!=L[k] && L[k]!=L[i]){
                    ll l=max(L[i],max(L[j],L[k]));
                    if(L[i]+L[j]+L[k]-l>l){
                        ans++;
                    }
                }
            }
        }
    }
    
    O(ans);
    
//------------------------------------------------------------
	return 0;
}


Measured memory_bytes: 3660
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int2(int *a1, int64_t *a2) {
  scanf("%d %lld", a1, a2);
  return 0;
}

int fget_array(int *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        scanf("%d", &arr[i]);
    }
    return 0;
}

#define NUM_MAX 100000

int main(void) {
    int num;
    int64_t limit;
    get_int2(&num, &limit);
    static int arr[NUM_MAX+1];
    // arr[0] = 0; // for guard
    fget_array(&arr[1], num);

    int i;
    int sum = 0;
    int64_t ans = 0;
    for(i = 1; i < num+1; i++) {
        // update arr[i]
        if(sum + arr[i] > limit) {
            // ensure that sum <= limit
            int dec = sum + arr[i] - limit;
            arr[i] -= dec;
            ans += dec;
        }
#ifdef DEBUG
        printf("ans: %lld\n", ans);
#endif
        // update sum
        sum += arr[i];
        sum -= arr[i-1];
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(void){
        int n,num[100],i=0;
        scanf("%d",&n);
        for(i=0;n>i;i++){
        scanf("%d",&num[i]);
        }
        for(i=n-1;i>0;i--){
                printf("%d ",num[i]);
        }
        printf("%d\n",num[0]);
}


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

int main() {
  int k;
  int a,b;
  cin >> k;
  cin >>a >> b;
 
  for(int i=a;i<=b;i++){
    if(i % k == 0){
      cout << "OK" << endl;
      return 0;
    }
  }
  
  cout << "NG" << endl;
  
}

Measured memory_bytes: 3636
#include "iostream"
#include <vector>
using namespace std;
typedef long long ll;

int main() {
    ll N, X, tmp_l;
    ll di=0, pre_di=0;
    vector<int> L;
    cin >> N >> X;
    for (ll i = 0; i < N; i++) {
        cin >> tmp_l;
        L.push_back(tmp_l);
    }
    ll i;
    for (i = 1; i < N+1 && di <= X; i++) {
        di = pre_di + L[i-1];
        pre_di = di;
        if (di > X) {
            break;
        }
//        cout << di << endl;
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
int main(){
	int ans = 1;
	LL a,b;
	cin >> a >> b;
	LL c = a;
	for(int i = 1;;i++){
		a*=2;
		if(a<=b)
			ans++;
		if(a>b)
			break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.InputStream;

import java.io.PrintWriter;

@SuppressWarnings("unchecked")
public class Main {
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);

        final int N = nextInt();

        int[] c = new int[3];

        for (int i = 0; i < N; i++) {
            int a = nextInt();
            if (a % 4 == 0) c[2]++;
            else if (a % 2 == 0) c[1]++;
            else c[0]++;
        }

        if (0 < c[1]) c[0]++;

        out.println(c[0] - 1 <= c[2] ? "Yes" : "No");

        out.flush();
    }

    // FastScanner start
    static final InputStream in = System.in;
    static final byte[] buffer = new byte[1024];
    static int ptr = 0;
    static int buflen = 0;
    static boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    static int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    static boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    static String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    static long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if(b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    static int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
    static double nextDouble() {
        return Double.parseDouble(next());
    }
    // FastScanner end
}


Measured memory_bytes: 22228
#include<bits/stdc++.h>
using namespace std; 
using lint  =                           long long int;
using pint  =                           pair<int, int>;
using plint =                           pair<lint, lint>;
#define vli                             vector<lint>
#define pb                              push_back
#define ALL(x)                          begin(x),end(x)
#define inf                             (1LL<63)-1
#define MOD                             1000000007
#define SZ(x)                           ((lint)(x).size())
#define                                 FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define                                 IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define                                 REP(i, n) FOR(i,0,n)
#define                                 IREP(i, n) IFOR(i,0,n)
#define                                 f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define                                 debug(x) cerr << #x << " " << (x) << endl
struct fast_ios                         { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T>                    istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T>                    bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T>                    bool mmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }


/* -------
         |
    **   |
   -------      
   |
   ---------------------------------------------------------------------------------------------------------------------------------*/

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

   int count = 0;

   while(N){
      int r = N%10;
      N/=10;

      if(r == 7) ++count;
   }  

   if(count )  cout << "Yes" << endl;
   else        cout << "No" << endl;
}

int main(){   
  
 solve();

 return 0;
}


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

int main() {
  int N, T;
  cin >> N >> T;
  int c_i, t_i, i;
  int bestroute_cost = 1000000;
  for (i = 0; i < N; i++) {
    cin >> c_i >> t_i;
    if (t_i <= T && c_i < bestroute_cost)
      bestroute_cost = c_i;
  }
  if (bestroute_cost > 100000)
    cout << "TLE" << endl;
  else
    cout << bestroute_cost << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int xxx(int n)
{
	int s=0;
	while(n)
	{
		s+=n%10;
		n/=10;
	}
	return s;
}
int main()
{
	int n,i,minn=0x7fffffff;
	scanf("%d",&n);
	for(i=1;i<=n/2;i++)
	{
		minn=min(minn,xxx(i)+xxx(n-i));
	} 
	printf("%d",minn);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1000000007;
const ll N=998244353;
ll power(ll x,ll n){ll res=1;while(n>0){if(n&1) res=res*x%MOD;x=x*x%MOD;n>>=1;}return res;}
ll modinverse(ll a){return power(a, MOD-2);}
ll r, c, k;
vector<vl> mat(r, vl(c, 0));
ll dp[3002][3002][4];
ll ans(ll i, ll j, ll times)
{
	if(i>=r||j>=c)
		return 0;
	if(dp[i][j][times]!=-1)
		return dp[i][j][times];
	if(mat[i][j])
	{
		if(times==3)
		{
			dp[i][j][times]= max({ans(i+1, j, 0), ans(i, j+1, times)});
			return dp[i][j][times];
		}
		else
		{
			dp[i][j][times]= max({mat[i][j]+ans(i+1, j, 0), 
				ans(i+1, j, 0),
				mat[i][j]+ans(i, j+1, times+1),
				ans(i, j+1, times)
			});
			return dp[i][j][times];
		}
	}
	else
	{
		dp[i][j][times]= max({ans(i+1, j, 0), ans(i, j+1, times)});
		return dp[i][j][times];
	}
}
void solve()
{
    cin>>r>>c>>k;
    forr(i, r+1)
    {
    	forr(j, c+1)
    	{
    		forr(k, 4)
    			dp[i][j][k]=-1;
    	}
    }
    mat.resize(r, vl(c, 0));
    forr(i, k)
    {
    	ll x, y, w;
    	cin>>x>>y>>w;
    	--x, --y;
    	mat[x][y]=w;
    }
    cout<<ans(0, 0, 0);
}
int main()
{
	#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(v) (v).begin(),(v).end()

const int MOD = 1000000007;
const int N = 3005;
const double PI =4*atan(1);

string ans,sh,ch;
ll dp[N][N];
ll n,m;


int main(){
    ios::sync_with_stdio(0);
    //freopen("baklava.in","r",stdin);
    cin.tie(0);
    cout.tie(0);
    //start
    cin >> ch >> sh;
    n=ch.size();
    m=sh.size();
    for(int i=0;i<=n;i++){
    	for(int j=0;j<=m;j++){
    		if(i==0 || j==0){
    			dp[i][j]=0;
    		}
    		else if(ch[i-1]==sh[j-1]){
    			dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
    		}else{
    			  dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
    		}
    	}
    }
    int i=n;
    int j=m;
    ans="";
    //cout << dp[i][j]<< endl;
    if(dp[i][j]==0){cout << "";return 0;}
    while(i>0 && j>0){
    	if(ch[i-1]==sh[j-1]){
    		ans+=ch[i-1];
    		i--;
    		j--;
    	}else if(dp[i-1][j]>dp[i][j-1]){
			i--;
    	}else{
    		j--;
    	}
    }
    reverse(ans.begin(),ans.end());
    cout << ans;

    return 0;
}


Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define txt freopen("ip.txt", "r", stdin); freopen("op.txt", "w", stdout)
#define a3 INT_MAX
#define i3 INT_MIN
#define a6 INT64_MAX
#define i6 INT64_MIN
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define div2(a) (!(a&1))
#define deb(x) cout<<(#x)<<" "<<(x)<<"\n";
#define newl cout<<"\n" 
#define all(s) s.begin(),s.end()
#define pi 3.14159265358979323846
#define fp(x) fixed<<setprecision(x)<<
template<class T>
T mod(T a){
    if(a < 0){
        a += 1000000007;
    }
    return a%1000000007; 
}
template<class T>
T addmod(T a, T b){
    return (mod(a) + mod(b)) % 1000000007;
}
template<class T>
T prodmod(T a, T b){
    return (mod(a) * mod(b)) % 1000000007;
}
template<class T>
T bin_exp(T a, T b)
{
    T res = 1;
    T temp = 1;
    if (b <= 1)
        return a;
    if (b %2 == 0)
        res = bin_exp(a * a, b / 2);
    else
    {
        res *= a;
        temp = bin_exp(a, --b);
    }
    return res * temp;
}
template<class T>
T bin_expmod(T a, T b)
{
    T res = 1;
    T temp = 1;
    if (b <= 1)
        return a;
    if (b %2 == 0)
        res = bin_expmod(prodmod(a,a), b / 2);
    else
    {
        res = prodmod(a,res);
        temp = bin_exp(a, --b);
    }
    return prodmod(res , temp);
}

template<class T>
int digit(T a)
{
    vector<long long> dig = {
        0,
        9,
        99,
        999,
        9999,
        99999,
        999999,
        9999999,
        99999999,
        999999999,
        9999999999,
        99999999999,
        999999999999,
        9999999999999,
        99999999999999,
        999999999999999,
        9999999999999999,
        99999999999999999,
        999999999999999999,
        INT64_MAX};
    auto it = lower_bound(dig.begin(), dig.end(), a);
    int idx = (it - dig.begin());
    return idx;
}
template<class T>
int sumAllInts(T n){
    int a = 1;
    int su = 0;
    while(n){
        su += n%10;
        n/=10;
    }
    return su;
}
template<class T>
void split(char c,T s){
    int n = s.size();
    int i = 0;
    while ((cout<<s[i],i+=1) && (i<n) && (cout<<c<<' '));
}

void solve(){
    long long int N,M;
    cin>>N>>M;
    vector<int> A(N);
    for(int i=1;i<=N;i++) A[i]=0;
    for(int i=0;i<M;i++)
    {
        int temp1,temp2;
        cin>>temp1>>temp2;
        A[temp1]++;
        A[temp2]++;
    }
    for(int i=1;i<=N;i++) cout<<A[i]<<endl;
}
int main(){
    quickie;
    //txt;
    int t=1;
    while(t--){
        solve(); 
        newl; 
    } 
    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
// abc048 D
int main()
{
	string s;
	cin >> s;
	int n = (int)s.length();
	bool first;
	if(s[0] == s[n-1]) {
		if(n % 2 == 0) first = true;
		else first = false;
	} else {
		if(n % 2 == 0) first = false;
		else first = true;
	}
	
	if(first) {
		puts("First");
	} else {
		puts("Second");
	}
}


Measured memory_bytes: 3760
n, t = map(int, input().split())
a = list(map(int, input().split()))

a = a[::-1]
m = [0] * n


for i in range(n):
    if i == 0:
        m[i] = a[i]
    else:
        m[i] = max(a[i], m[i-1])

a = a[::-1]
m = m[::-1]

#print(m)

sa = [0] * n
for i in range(n):
    sa[i] = m[i] - a[i]

#print(sa)

ans_max = max(sa)
ans = sa.count(ans_max)
print(ans)

Measured memory_bytes: 15020
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
int cmp(int a,int b)
{
    return a>b;
}
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        ll a[100010];
        for(int i=0;i<n;++i)
        {
            scanf("%lld",&a[i]);
        }
        sort(a,a+n,cmp);
        int ans1,ans2;
        ans1=ans2=0;
        int flag = 0;
        ll sum = 1;
        for(int i=1;i<n;++i)
        {
            if(a[i] == a[i-1])
            {
                sum*=a[i];
                ++i;
                flag++;
            }
            if(flag == 2)
                break;
        }
        if(sum == 1 && flag != 2)
            printf("0\n");
        else
            printf("%lld\n",sum);
    }
}

Measured memory_bytes: 1024
#include<stdio.h>

#define MAX 5000000
#define INFTY 2000000000

int L[MAX / 4], R[MAX / 4];
int cnt;

void merge(int A[], int n, int left, int mid, int right){

  int i, j, k;

  int n1 = mid - left;
  int n2 = right - mid;

  for(i = 0; i < n1; i++)
    L[i] = A[left + i];

  for(i = 0; i < n2; i++)
    R[i] = A[mid + i];

  L[n1] = R[n2] = INFTY;

  i = 0; j = 0;

  for(k = left; k < right; k++){
    cnt++;
    if(L[i] <= R[j])
      A[k] = L[i++];
    else
      A[k] = R[j++];
  }
}

void mergeSort(int A[], int n, int left, int right){

  int mid;

  if(left + 1 < right){
    mid = (left + right) / 2;

    mergeSort(A, n, left, mid);
    mergeSort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

int main(){

  int A[MAX], n, i;
  cnt = 0;

  scanf("%d", &n);

  for(i = 0; i < n; i++)
    scanf("%d", &A[i]);

  mergeSort(A, n, 0, n);

  for(i = 0; i < n; i++){
    if(i == n - 1)
      printf("%d\n", A[i]);
    else printf("%d ", A[i]);
  }
  printf("%d\n", cnt);

  return 0;
}


Measured memory_bytes: 5636
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main(){
    int n;
    double ans=0.0;
    cin>>n;
    for(int i=0;i<n;i++){
        double x;
        string s;
        cin>>x>>s;
        if(s=="BTC") x*=380000.0;
        ans+=x;
    }
    printf("%f5\n",ans);
    return 0;
}

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

int main(){
    int N,M; cin >> N >> M;
    vector <P> P(M);
    rep(i,M) cin >> P[i].first >> P[i].second;
    
    rep(i,1000){
        string S=to_string(i);
        int keta=S.length();
        
        if (keta!=N) continue;
        bool ans=true;
        rep(i,M){
            if (S[P[i].first-1]!=P[i].second+'0') ans=false;
        }
        if (ans){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
N,x = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
ans = 0
for i in range(N):
  if A[i] <= x:
    if i == N-1:
      if x == A[i]:
        ans += 1
    else:
      x -= A[i]
      ans += 1
  else:
    break
print(ans)


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

int main()

{

    ll n;
    ll ans = 0;
    cin >> n;
    for(ll num = 1; num <= n; num++)
    {

        ll cnt  = 0;
        if(num%2==0) continue;
        for(ll i=  1; i<= num; i++)
        {

            if(num%i==0) cnt++;
        }
        if(cnt==8) ans++;
    }
    cout << ans;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
s = [input() for _ in range(h)]
ans = [[0 for i in range(w)] for j in range(h)]

for i in range(h):
    mines_id = [m_i for m_i, word in enumerate(s[i]) if word == '#']
    if mines_id == []:
        continue
    else:
        for mine_id in mines_id:
            if i - 1 >= 0:
                ans[i - 1][mine_id] += 1
            if i + 1 <= h - 1:
                ans[i + 1][mine_id] += 1
            if mine_id - 1 >= 0:
                ans[i][mine_id - 1] += 1
            if mine_id + 1 <= w - 1:
                ans[i][mine_id + 1] += 1
            if i - 1 >= 0 and mine_id - 1 >= 0:
                ans[i - 1][mine_id - 1] += 1
            if i + 1 <= h - 1 and mine_id + 1 <= w - 1:
                ans[i + 1][mine_id + 1] += 1
            if i + 1 <= h - 1 and mine_id - 1 >= 0:
                ans[i + 1][mine_id - 1] += 1
            if i - 1 >= 0 and mine_id + 1 <= w - 1:
                ans[i - 1][mine_id + 1] += 1

for i in range(h):
    mines_id = [m_i for m_i, word in enumerate(s[i]) if word == '#']
    if mines_id == []:
        continue
    else:
        for mine_id in mines_id:
            ans[i][mine_id] = '#'

for a in ans:
    print(''.join(map(str, a)))

Measured memory_bytes: 3064
import sys

input = sys.stdin.readline

def query(i):
    '''
    a[0] + a[1] + … + a[i-1] を求める
    O(logN)
    '''
    res = 0
    while i > 0:
        res += BIT[i]
        i -= i & -i
    
    return res


def update(i, x):
    '''
    a[i-1]にxを加算
    O(logN)
    '''
    while i <= n:
        BIT[i] += x
        i += i & -i


n, q = map(int, input().split())
c = list(map(int, input().split()))
query_ = [list(map(int, input().split())) + [i] for i in range(q)]

query_.sort(key=lambda x: x[1])

res = [0] * q
pos = [-1] * n
BIT = [0] * (n+1)
p = 0
for l, r, idx in query_:
    for i in range(p, r):
        if pos[c[i]-1] != -1:
            update(pos[c[i]-1]+1, -1)
        update(i+1, 1)
        pos[c[i]-1] = i
    
    res[idx] = query(r) - query(l-1)
    p = r

print(*res, sep='\n')

Measured memory_bytes: 230476
#include <iostream>

int main() {
    int x, y;
    while (true) {
        std::cin >> x >> y;
        if (x == 0 and y == 0) {
            break;
        }
        if (x > y) {
            std::cout << y << ' ' << x << '\n';
        } else {
            std::cout << x << ' ' << y << '\n';
        }
    }
    return 0;
}



Measured memory_bytes: 3068
n = int(input())
memo = {}

for _ in range(n):
    s = input()
    if s in memo: memo[s] += 1
    else: memo[s] = 1

memo = sorted(memo.items(), key=lambda x:x[1], reverse=True)
mn = memo[0][1]

alist = []
for val in memo:
    a, b = val
    if b == mn: alist.append(a)
    else: break

alist.sort()
for ans in alist:
    print(ans)

Measured memory_bytes: 113060
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
    #include "lib/dump.hpp"
#else
    #define dump(...) 42
    #define dump_1d(...) 42
    #define dump_2d(...) 42
    #define cerrendl 42
#endif
//}}}

signed main() {
    int n,c;cin>>n>>c;

    vvi d(c, vi(c));
    rep(i, c)rep(j, c) cin>>d[i][j];
    dump_2d(d, c, c);

    vvi g(n, vi(n));
    rep(i, n)rep(j, n) cin>>g[i][j];
    dump_2d(g, n, n);

    vvi t(3);
    rep(i, n)rep(j, n){
        t[(i+j)%3].pb(g[i][j]);
    }

    rep(i, 3){
        dump(t[i]);
    }

    // vector<int> used(c+1);
    // vi cs;
    // auto dfs = [&](const auto& dfs, int p) -> void {
    //     rep(i, 1, c+1){
    //         if (used[i]) continue;
    //         cs.pb(i);
    //         used[i] = true;
    //
    //         if (p<2) dfs(dfs, p+1);
    //         else {
    //             dump(cs);
    //         }
    //         used[i] = false;
    //         cs.pop_back();
    //     }
    // };
    // dfs(dfs, 0);

    int ans = INF;

    vvi cost(3, vi(c+1));
    rep(i, 3)rep(j, 1, c+1){
        each(el, t[i]) cost[i][j] += d[el-1][j-1];
    }

    rep(i, 1, c+1){
        rep(j, 1, c+1){
            rep(k, 1, c+1){
                if (i==j || j==k || k==i) continue;

                int res = 0;
                res += cost[0][i];
                res += cost[1][j];
                res += cost[2][k];
                chmin(ans, res);
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4400