akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n;
    cin >> n;
    vint a(n);
    rep(i, n) cin >> a[i];

    map<int, ll> mp;
    rep(i, n) mp[a[i]]++;

    ll all = 0;
    for (auto x : mp) {
        ll num = x.se;
        all += num * (num-1) / 2;
    }
    rep(i, n) {
        ll ans = all;
        ll num = mp[a[i]];
        ans -= num * (num-1) / 2;
        ans += (num-1) * (num-2) / 2;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 10240
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#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 all(x) (x).begin(), (x).end()
template <typename T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<vector<ll>> dp(3, vector<ll>(N + 10, 0));
    dp[0][1] = 8;
    dp[1][1] = 2;
    rep(i, 2, N + 1) {
        dp[0][i] = (dp[0][i - 1] * 8) % MOD;
        dp[1][i] = (dp[0][i - 1] * 2 + dp[1][i - 1] * 9) % MOD;
        dp[2][i] = (dp[1][i - 1] * 1 + dp[2][i - 1] * 10) % MOD;
    }
    cout << dp[2][N] << endl;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b != c) {
    cout << "Yes" << endl;
  }
  else if (a == c && c != b) {
    cout << "Yes" << endl;
  }
  else if (b == c && c != a) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string.h>
#include <queue>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;

ll arr[200005];

int main(){
    int n; cin >> n;
    arr[0] = 0;
    for(int i = 1; i <= n ; i++){
        ll tmp;
        cin >> tmp;
        arr[i] = arr[i-1]+tmp;
    }
    sort(arr, arr+1+n);
    ll cnt = 1;
    ll ans = 0;
    for(int i = 1 ; i <= n ; i++){
        if(arr[i]!=arr[i-1]){
            ans +=cnt*(cnt-1)/2;
            cnt = 1;
        }
        else {
            cnt++;
        }
    }
    ans += cnt*(cnt-1)/2;
    cout << ans;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,l;
  cin>>n>>l;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  deque<int> q;
  auto pb=[&](int x){
    while(!q.empty()&&a[q.back()]>=a[x]) q.pop_back();
    q.push_back(x);
  };
  for(int i=0;i<l;i++) pb(i);
  for(int i=l;i<n;i++){
    cout<<a[q.front()]<<" ";
    pb(i);
    while(!q.empty()&&q.front()<=i-l) q.pop_front();
  }
  cout<<a[q.front()]<<endl;
  return 0;
}

Measured memory_bytes: 10960
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;

using namespace std;

int main()
{
	int a,b,c;

	cin>>a>>b>>c;

	if(a+b+c >= 22)
	{
		cout << "bust";
	} else {
    cout << "win";
  }
  
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<ll> A(N), B(N), C(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) cin >> B[i];
  for (int i = 0; i < N; i++) cin >> C[i];

  multiset<ll> left, right;
  ll lsum = 0, rsum = 0;
  for (int i = 0; i < N; i++) {
    left.insert(A[i]);
    lsum += A[i];
    right.insert(C[i]);
    rsum += C[i];
  }
  ll ans = lsum - rsum;

  vector<ll> a(N + 1);
  a[0] = lsum;
  for (int i = 0; i < N; i++) {
    ll x = *left.begin();
    left.erase(left.find(x));
    lsum -= x;
    left.insert(max(B[i], x));
    lsum += max(B[i], x);
    a[i + 1] = lsum;
  }

  vector<ll> c(N + 1);
  c[0] = rsum;
  for (int i = 0; i < N; i++) {
    ll x = *right.rbegin();
    right.erase(right.find(x));
    rsum -= x;
    right.insert(min(B[N - 1 - i], x));
    rsum += min(B[N - 1 - i], x);
    c[i + 1] = rsum;
  }

  for (int i = 0; i < N + 1; i++) {
    ans = max(ans, a[i] - c[N - i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 13568
def t2s(t):
    h = t[:2]
    m = t[3:5]
    s = t[6:]
    return int(h)*3600+int(m)*60+int(s)



while (True):
    n = int(input())
    c = [0 for i in range(24*3600+1)]
    if (n == 0):
        break
    for i in range(n):
        tt = input()
        c[t2s(tt[:8])] += 1
        c[t2s(tt[9:])] -= 1
    cc = [0]
    for i in range(len(c)):
        cc.append(cc[-1] + c[i])
    print(max(cc))






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

int64_t get_nth_lucas_number(vector<int64_t> &lucas_numbers, int n) {
    if(lucas_numbers.at(n) != 0)
        return lucas_numbers.at(n);

    int64_t new_lucas_number = get_nth_lucas_number(lucas_numbers, n-1) + get_nth_lucas_number(lucas_numbers, n-2);
    lucas_numbers.at(n) = new_lucas_number;
    return new_lucas_number;
}

// n番目のLucas Numberを出力するプログラム
int main() { 
    int n;
    cin >> n;

    vector<int64_t> lucas_numbers(87,0);
    lucas_numbers.at(0) = 2;
    lucas_numbers.at(1) = 1;

    cout << get_nth_lucas_number(lucas_numbers, n) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A,amari;
  cin >> N >> A;
  amari=N%500;
  if (amari <=A) {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  
  }
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

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

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    string s, t;
    cin >> s >> t;

    int ans = 0;
    range(i, 0, s.size()) {
        if (s[i] != t[i]) ans++;
    }

    cout << ans << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 3844
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int a, b;
        List<Task> list = new ArrayList<>();
        for(int i = 0; i < n; i++){
            a = Integer.parseInt(sc.next());
            b = Integer.parseInt(sc.next());
            list.add(new Task(a, b));
        }
        
        list.sort((o1, o2) -> o1.limit - o2.limit);
        long time = 0;
        for(int i = 0; i < n; i++){
            time += list.get(i).time;
            if(time > list.get(i).limit){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}

class Task {
    int time;
    int limit;
    
    Task(int time, int limit){
        this.time = time;
        this.limit = limit;
    }
}

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

#define int long long
#define rep(i, a, n) for (int i = a; i < n; i++)
#define pb push_back
#define eb emplace_back
#define dump(x) cout << #x << " = " << (x) << endl
#define chk() cout << "now" << endl;
#define ALL(x) (x).begin(), (x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTG(c) sort(ALL(c), greater<int>());
#define fi first
#define se second
int INF = 1e9 + 7;

typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> mat;

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;
}

void solve() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;

  int a = h1 * 60 + m1;
  int b = h2 * 60 + m2;
  int diff = b - a;

  cout << diff - k << endl;
}

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

  // cout << fixed << setprecision(10);

  solve();

  return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>

int binarySearch(int);

int S[100000], n;

int main()
{
  int i, key, q, C = 0;

  scanf("%d", &n);

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

  scanf("%d", &q);

  for( i = 0 ; i < q ; i++ ){
    scanf("%d", &key);
    if( binarySearch(key) != 0 ) C++;
  }

  printf("%d\n", C);

  return 0;
}

int binarySearch(int k)
{
  int left = 0;
  int right = n;
  int mid;
  
  while( left < right ){
    mid = (left + right) / 2;
    if( S[mid] == k ) return 1;
    else if( k < S[mid] ) right = mid;
    else left = mid + 1;
  }

  return 0;
}

Measured memory_bytes: 988
import itertools

n, m, q = map(int, input().split())
a, b, c, d = [0] * q, [0] * q, [0] * q, [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int, input().split())

aa = [i for i in range(1, m+1)]
maxv = -1
for i in itertools.combinations_with_replacement(aa, n):
    cnt = 0
    for j in range(q):
        if i[b[j]-1] - i[a[j]-1] == c[j]:
            cnt += d[j]
    maxv = max(maxv, cnt)

print(maxv)

Measured memory_bytes: 67704
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;

int main() {
   int s[3];
   rep(i,3){
       cin>>s[i];
   }

  if(s[0]==s[1]&&s[1]==s[2]){
      cout<<"Yes"<<endl;
  }else{
      cout<<"No"<<endl;
  }

    return 0;
}


Measured memory_bytes: 256
s = list(input())

c = []
a = [0]
for i in range(len(s)):
    if s[i] != 'x':
        a.append(i)
        c.append(s[i])
a.append(len(s) - 1)
ans = 0
for i in range(len(c)):
    if c[i] != c[-i - 1]:
        ans = -1
        break
if ans != -1:
    x = []
    for i in range(len(a) - 1):
        x.append(a[i + 1] - a[i])
    for i in range(len(x) // 2):
        ans += abs(x[i] - x[-i - 1])
print(ans)

Measured memory_bytes: 56076
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int INF=1e9;
const long double eps=1e-9;
const double Pi=acos(-1.0);
const int maxn=1e2+10;
struct node{
	int x,y,id;
}a[maxn];
inline bool cmp(const node &lhs,const node &rhs){
	return lhs.x==rhs.x?lhs.y>rhs.y:lhs.x<rhs.x;
}
inline bool Cmp(const node &lhs,const node &rhs){
	return lhs.id<rhs.id;
}
int stk[maxn],ans[maxn],vis[maxn];
double Ans[maxn],slp[maxn];
inline int read(){
	int x=0,flag=1;
	char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')flag=-1,ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x*flag;
}
inline double Slope(int idx,int idy){
	if(a[idx].x==a[idy].x)return -INF;
	return (a[idx].y-a[idy].y)*1.0/(a[idx].x-a[idy].x);
}
inline double arcle(int idx,int idy){
	if(a[idx].x==a[idy].x){
		if(a[idx].y>a[idy].y)return 0;
		else return Pi;
	}
	if(a[idx].y==a[idy].y){
		if(a[idx].x<a[idy].x)return Pi/2;
		else return 3*Pi/2;
	}
	double slope=-1.0/Slope(idx,idy),arc=atan(slope);
	if(arc<0)arc+=Pi;
	if(a[idx].x<a[idy].x)return arc;
	else return arc+Pi;
}
int main(){
	int i,j,k,m,n,pos;
	n=read();
	for(i=1;i<=n;i++){
		a[i].x=read();a[i].y=read();a[i].id=i;
	}
	sort(a+1,a+n+1,cmp);
	stk[1]=1;stk[2]=2;int top=2;
	for(i=3;i<=n;i++){
		while(top>1 && Slope(stk[top],stk[top-1])>=Slope(i,stk[top]))top--;
		stk[++top]=i;
	}
	for(i=1;i<top;i++)ans[i]=a[stk[i]].id,vis[a[stk[i]].id]=1;pos=top;
	vis[a[1].id]=0;
	reverse(a+1,a+n+1);
	stk[1]=1;stk[2]=2;top=2;
	for(i=3;i<=n;i++){
		if(vis[a[i].id])continue;
		while(top>1 && Slope(stk[top],stk[top-1])>=Slope(i,stk[top]))top--;
		stk[++top]=i;
	}
	for(i=pos;i<pos+top-1;i++)ans[i]=a[stk[i-pos+1]].id;pos=pos+top-2;
	sort(a+1,a+n+1,Cmp);
	ans[0]=ans[pos];ans[pos+1]=ans[1];
	for(i=0;i<=pos;i++)slp[i]=arcle(ans[i+1],ans[i]);
	for(i=1;i<=pos;i++)Ans[ans[i]]=slp[i]-slp[i-1];
	for(i=1;i<=n;i++){
		if(Ans[i]<0)Ans[i]+=2*Pi;
		printf("%.15lf\n",Ans[i]/(2*Pi));
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>

using namespace std;
typedef long long ll;
int main() {
	int n;
	scanf("%d", &n);
	int m=0, a=0, r=0, c=0, h=0;
	for(int i=0; i<n; i++){
		char s[20];
		scanf("%s", s);
		if(s[0] == 'M') m++;
		if(s[0] == 'A') a++;
		if(s[0] == 'R') r++;
		if(s[0] == 'C') c++;
		if(s[0] == 'H') h++;
	}
	vector<int> v;
	v.push_back(m);
	v.push_back(a);
	v.push_back(r);
	v.push_back(c);
	v.push_back(h);
	ll ans = 0L;
	for(int i=0; i<v.size(); i++){
		for(int j=i+1; j<v.size(); j++){
			for(int k=j+1; k<v.size(); k++){
				ans += (ll)v[i] *(ll)v[j] *  (ll)v[k];
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define pb push_back
#define fi first
#define se second
#define eb emplace_back

using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
const int N = 1000007, inf = 0x3f3f3f3f;

int cnt[N], a[N];

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

	int n; cin >> n;

	ll sum = 0;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		cnt[a[i]]++;
		sum += a[i];
	}

	int q; cin >> q;

	while(q--) {
		int u, v; cin >> u >> v;
		sum -= ll(cnt[u]) * u;
		sum += ll(cnt[u]) * v;
		cnt[v] += cnt[u];
		cnt[u] = 0;
		cout << sum << '\n';
	}
}

Measured memory_bytes: 4396
k = int(input())
K = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
]
print(K[k-1])

Measured memory_bytes: 3060
n, k = [int(i) for i in  input().split(' ')]
r, s, p = [int(i)for i in  input().split(' ')]
t = input()

su  =  p*t.count('r') + r*t.count('s')  + s*t.count('p') 

ls = []
for i in range(len(t)-k):
    if t[i] == t[i+k]:
        ls.append(t[i])
        t = t[:i+k] + 'a' + t[i+k+1:]  #swap text

su2 = p*ls.count('r') + r*ls.count('s')  + s*ls.count('p') 
print(su-su2)


Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int main() {
    int H, W, N;
    cin >> H >> W >> N;
    cout << (N + max(H, W) - 1) / max(H, W) << endl;
    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};
vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
bool solve(ll n,vector<ll>a){
  ll tmpl=-1,tmpr=-1;
  rrep(i,1,n){
    if(a[i]==a[i-1]){
      tmpl=i;
      break;
    }
  }
  rep(i,n-1,2*n-2){
    if(a[i]==a[i+1]){
      tmpr=i;
      break;
    }
  }
  //debug(a,2*n-1);
  //cout<<tmpl spa tmpr<<endl;
  if(tmpl==-1&&tmpr==-1)return a[0];
  else if(tmpr==-1||n-1-tmpl<=tmpr-(n-1))return a[tmpl];
  else return a[tmpr];
}
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>a(2*n-1);
  rep(i,0,2*n-1)cin>>a[i];
  ll ok=1,ng=2*n;
  while(abs(ok-ng)>=2){
    ll mid=(ok+ng)/2;
    vector<ll>b(2*n-1);
    rep(i,0,2*n-1)b[i]=a[i]>=mid;
    if(solve(n,b))ok=mid;
    else ng=mid;
  }
  cout<<ok<<endl;
  return 0;
}

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

typedef long long ll;
#define rep(i,n) for(int i=0;i < (int)n;++i)

int main() {
    int n;cin>>n;
    int a[n],s[n+1];
    int sum=0;
    
    rep(i,n)cin>>a[i];
    s[0]=a[0];
    rep(i,n){
        sum+=a[i];
        s[i+1]=s[i]+a[i+1];
    }
    int ans = 99999999;
    rep(i,n){
        ans = min(ans,abs(s[i]-(sum-s[i])));
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3652
from bisect import bisect
from collections import deque

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

for i in range(1, len(A)):
    A[i] += A[i-1]
for i in range(1, len(B)):
    B[i] += B[i-1]
A.insert(0, 0)
indexB = len(B) - 1
results = [0]
for i in range(len(A)):
    time = A[i]
    if time > K:
        break
    enable_for_b = K - time
    results.append(i + bisect(B, enable_for_b))

print(max(results))

Measured memory_bytes: 40612
use proconio::input;
use std::collections::HashMap;
fn main() {
    input!(n: i128, x: i128, m: i128);
    let mut a = x;
    let mut res = x;
    let mut hashmap: HashMap<i128, i128> = HashMap::new();
    for i in 1..n {
        if hashmap.contains_key(&a) {
            let start = a;
            let mut next = a;
            let mut count = 1;
            let mut sum = a;
            loop {
                next = hashmap[&next];
                if next == start { break; }
                sum += next;
                count += 1;
            }
            let t = (n - i) / count;
            res += t * sum;
            next = hashmap[&a];
            for _ in 0..(n - (t * count + i)){
                res += next;
                next = hashmap[&next];
            }
            println!("{}", res);
            return;
        } else {
            let last_value = a;
            a = a * a % m;
            hashmap.insert(last_value, a);
            res += a;
        }
    }
    println!("{}", res);
}

Measured memory_bytes: 5408
#include<math.h>
#include<iostream>
#include <algorithm>
#include <string>
#include<vector>
#include <array>
#include<tuple>
#include<queue>
#include<stack>
#include<iomanip>
//AtCoderC++.cpp

using namespace std;

void solveB() {
	int N, L; cin >> N >> L;
	int min_abs = N + L;
	auto sum = 0;
	for (int i = 0; i < N; i++) {
		min_abs = min(min_abs, abs(L + i));
		sum += L + i;
	}
	cout << sum - min_abs << endl;
}

int main() {
	string s; cin >> s;
	bool bad = false;
	for (size_t i = 1; i < s.length(); i++) {
		if (s[i] == s[i - 1]) {
			bad = true;
			break;
		}
	}
	if (bad) {
		cout << "Bad" << endl;
	} else {
		cout << "Good" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

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

    int A, B; cin >> A >> B;
    int res;
    if (A >= 13) res = B;
    else if (A >= 6) res = B/2;
    else res = 0;

    cout << res << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]

    done = [int()]*(N)
    done_k = [0] * N


    i = 0
    q = 1
    while done_k[q-1] == 0:
        done[i] = q
        done_k[q-1] = 1
        i+=1
        q = A[q-1]

    f_q = done.index(q)
    r = i - f_q

    if K <= f_q:
        t = K
    else:
        k = (K - f_q)%r
        t = k + f_q

    print(done[t])        

    # q = A[0]
    # for _ in range(t-1):
    #     q=A[q-1]
    # print(q)



if __name__ == '__main__':
    main()


Measured memory_bytes: 95264
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

int main(void) {
  cout.precision(12);

  string S;
  cin >> S;

  long win = 0;
  long lose = 0;

  for (auto it: S) {
    if (it == 'o') win++;
    else lose++;
  }

  cout << (15 - lose >= 8 ? "YES" : "NO") << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <utility>
#include <stdlib.h>
#include <fstream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main() {
    FIO;
    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    int ans = 0;
    ans = ans + min(k, a);
    k-=min(k, a);
    k-=min(k, b);
    ans = ans - min(k, c);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3168
#include<iostream>
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int N;
int cnt[1<<20];
int all=0;
bool isp[1<<20];
main(){
	cin>>N;
	for(int i=0;i<N;i++){
		int A;cin>>A;
		cnt[A]++;
		all=gcd(all,A);
	}
	bool ok=true;
	for(int i=2;i<1<<20;i++){
		int sum=0;
		for(int j=i;j<1<<20;j+=i)
        	sum+=cnt[j];
		if(sum>1)
        	ok=false;
	}
	cout<<(ok?"pairwise coprime":all==1?"setwise coprime":"not coprime")<<endl;
}

Measured memory_bytes: 7552
#include <bits/stdc++.h>
#define INF 1000000000
using namespace std;

int main() {

    int N,K;
    cin >> N>>K;
   /* vector<int>A(N);
    for (int i = 0; i < N; i++) { cin >> A.at(i); }
    */
  if(N%K==0){cout<<0<<endl;}
    else{cout<<1<<endl;}
}
    


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
string int2string(int x){
        stringstream ss;
        ss << x;
        string tmp;
        ss >> tmp;
        return tmp;
    }
int string2int(string s){
    stringstream ss;
    ss << s;
    int x;
    ss >> x;
    return x;
}
long long power(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
long long bigpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    else return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
    ll r= a/gcd(a,b)*b;
    return r;
}
//***********************CODE*****************
int main(){
    
cin.tie(NULL);
cout.tie(NULL);
ios_base::sync_with_stdio(false);
long long n,a,b;
cin>>n>>a>>b;
if(a>=n)cout<<n<<endl;
else
{
	long long cnt=(n/(a+b))*a;
	n=n%(a+b);
	if(n<=a)cnt+=n;
	else cnt+=a;
	cout<<cnt<<endl;
}
    return 0;
}

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

import fractions
l = [0] * n
r = [0] * n
l[0] = An[0]
r[n-1] = An[n-1]
for i in range(1, n):
    l[i] = fractions.gcd(l[i-1], An[i])
for i in range(1, n):
    r[n-1-i] = fractions.gcd(r[n-i], An[n-1-i])

best = 0
for i in range(0, n):
    if i == 0:
        best = max(best, r[1])
    elif i == n-1:
        best = max(best, l[n-2])
    else:
        best = max(best, fractions.gcd(l[i-1], r[i+1]))
print(best)

Measured memory_bytes: 14584
n = int(input().strip())
s = [input().strip() for _ in range(n)]
dic = {}

for e in s:
    if e in dic:
        dic[e] += 1
    else:
        dic[e] = 1

ans = []
m = max(dic.values())
for k, v in dic.items():
    if v == m:
        ans.append(k)
ans.sort()
for e in ans:
    print(e)


Measured memory_bytes: 98816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

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

    while (1) {
        c -= b;
        if (c <= 0) {
            cout << "Yes\n";
            break;
        }
        a -= d;
        if (a <= 0) {
            cout << "No\n";
            break;
        }
    }
}


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

int main() {
  int N,M,a,b;
  cin >> N >> M; //都市、道路
  vector<int> vec(N,0);
  for (int i = 0; i < M; i++) {
  cin >> a >> b;
  vec.at(a-1)++;
  vec.at(b-1)++;
  }
  for (int i = 0; i < N; i++) {
    cout << vec.at(i) << endl;
  }
}


Measured memory_bytes: 256
import numpy as np

N = int(input())
A = np.zeros(N + 2, dtype = np.int64)
A[1:-1] = input().split()
np.cumsum(A, out = A)
total = A[-1]
A[-1] = 10 ** 18

left = np.searchsorted(A, A/2)
P1 = A[left - 1]
P2 = A[left]

Q1, Q2 = A - P1, A - P2

np.maximum(P1, Q2, out = P1)
np.minimum(P2, Q1, out = P2)
P, Q = P1, P2
right = np.searchsorted(A, (total + A)/2)
R1 = A[right - 1] - A
R2 = A[right] - A
S1 = total - A[right - 1]
S2 = total - A[right]
np.maximum(R1, S2, out = R1)
np.minimum(R2, S1, out = R2)
R, S = R1, R2

PQRS = np.vstack([P, Q, R, S])
x = np.max(PQRS, axis = 0) - np.min(PQRS, axis = 0)
answer = (x[1: -1].min())
print (answer)

Measured memory_bytes: 41416
#include <stdio.h>
#include<iostream>
#include<string>
#include <string.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <climits>
#include <map>
#include <cstring>
using namespace std;
int main() {
    int n,ans=0;
    long long d,x,y;
    cin>>n>>d;
    for(int i=1;i<=n;i++){
        scanf("%lld%lld",&x,&y);
        if(x*x+y*y<=d*d) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3716
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,A = inpl()
x = inpl()
dp = [[[0 for _ in range(n+5)] for i in range(3005)] for j in range(n+5)]
dp[0][0][0] = 1
for i in range(n):
    for j in range(sum(x)+1):
        for k in range(n):
            if j >= x[i]:
                dp[i+1][j][k+1] = dp[i][j-x[i]][k] + dp[i][j][k+1]
            else:
                dp[i+1][j][k] = dp[i][j][k]
# for i in range(n+1):
#     print(dp[i][:50])
ans = 0
for j in range(1,sum(x)+1):
    for k in range(1,n+1):
        if j/k == A:
            ans += dp[n][j][k]
print(ans)

Measured memory_bytes: 131928
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

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

int main()
{
  ll n,X;
  cin >> n >> X;
  vector<ll> x(n);
  rep(i,n) cin >> x[i];

  sort(ALL(x));

  vector<ll> gap(n);

  rep(i,n){
      gap[i] = abs(X - x[i]);
  }

  rep(i,n-1){
      gap[i+1] = gcd(gap[i],gap[i+1]);
  }

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

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

string s, leftstr, rightstr;

int main(){
	cin >> s;
	int n = s.size();

	for(int i=0; i<7; i++){
		leftstr = s.substr(0, i);
		rightstr = s.substr(i+n-7);

		if(leftstr + rightstr == "keyence"){
			cout << "YES" << endl;
			return 0;
		}
	}

	cout << "NO" << endl;
	return 0;
}

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


public class Main {

	private static final int BIG_NUM  = 2000000000;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int H,W;

		String work[] = new String[2];

		while(true){

			try {
				work = br.readLine().split("[\\s]+");
				if(work[0].equals("0") && work[1].equals("0"))break;

				H = Integer.parseInt(work[0]);
				W = Integer.parseInt(work[1]);

				for(int row = 0; row < H; row++){
					for(int col = 0; col < W; col++){
						System.out.printf("#");
					}
					System.out.printf("\n");
				}

				System.out.printf("\n");

			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}





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

int main(){
    int n;
    cin>>n;
    vector<int>x(n),a(n),b(n);
    rep(i,n){
        cin>>x[i];
        a[i]=x[i];
    }
    sort(a.begin(),a.end());
    rep(i,n){
        if(x[i]<=a[n/2-1])cout<<a[n/2]<<endl;
        else cout<<a[n/2-1]<<endl;
    }
}

Measured memory_bytes: 4480
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
int n,a,b;
int main(){
	scanf("%d%d%d",&n,&a,&b);
	if((b-a)%2==1) printf("Borys\n");
    else printf("Alice\n");
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)

//Map<String, Integer> map = new HashMap<String, Integer>(n);
/*for ( キーのデータ型 key : マップの名前.keySet() ) {
	データのデータ型 data = マップの名前.get( key );
	
	// keyやdataを使った処理;
}*/

//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")
//list.set(1,"walk");
public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	static long N;
	public static void main(String[] args) {
		int n=sc.nextInt();
		String s=sc.next();
		String t=sc.next();
		String v="";
		for(int i=0;i<n;i++) {
			v=v+s.charAt(i)+t.charAt(i);
		}
		p(v);
		
	}
	

	
	
	
}


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

#ifdef VAMP
    #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cout.write(names, comma - names) << " = " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif

#define MAX 200005
#define ll long long

struct info{
    int val, pos;
    bool operator < (const info &a) const{
        return val < a.val;
    }
}ar[MAX];

int main(){
    #ifdef VAMP
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif // VAMP
    int n; scanf("%d", &n);
    for(int i = 0; i < n ; i++){
        scanf("%d", &ar[i].val);
        ar[i].pos = i;
    }
    sort(ar, ar + n);
    set<int> S;
    ll res = 0;
    for(int i = n - 1; i >= 0; i--){
        ll a = -1, b = -1, c = n, d = n;
        auto it = S.upper_bound(ar[i].pos);
        if(it != S.end()){
            c = *it;
            it = next(it);
            if(it != S.end()){
                d = *it;
            }
        }
        it = S.upper_bound(ar[i].pos);
        if(it != S.begin()){
            it = prev(it);
            b = *it;
            if(it != S.begin()){
                it = prev(it);
                a = *it;
            }
        }
        int pos = ar[i].pos;
        ll add1 = (b - a) * (c - pos) * ar[i].val;
        ll add2 = (pos - b) * (d - c) * ar[i].val;
        res += add1 + add2;
//        debug(a, b, i, c, d, add1, add2);
        S.insert(pos);
    }
    printf("%lld\n", res);


    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
string s;
long ans=0;
void dfs(vector<int>A){
  if(A.size()==s.size()-1){
    long now=s.at(s.size()-1)-'0';
    long k=1;
    for(int i=A.size()-1;i>=0;i--){
      if(A.at(i)==1){
        k=1;
        now+=k*(s.at(i)-'0');
      }
      else{
        k*=10;
        now+=k*(s.at(i)-'0');
      }
    }
    ans+=now;
    return;
  }
  
  rep(i,2){
    A.push_back(i);
    dfs(A);
    A.pop_back();
  }
}
int main() {
  
  cin>>s;
  dfs(vector<int>());   
  cout<<ans<<endl;
}

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

namespace ConsoleApp5
{

    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string[] line = S.Split(' ');
            int A = int.Parse(line[0]);
            int B = int.Parse(line[1]);
            int T = int.Parse(line[2]);

            Console.WriteLine((T / A) * B);


        }
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
#include <stdlib.h>

void print_No(void);

int main(){
   int W, H, x, y, r, x_min, x_max, y_min, y_max;
   scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
   if((x_min=x-r)<0) print_No();
   if((x_max=x+r)>W) print_No();
   if((y_min=y-r)<0) print_No();
   if((y_max=y+r)>H) print_No();
   printf("Yes\n");
   return 0;
}

void print_No(void){
   printf("No\n");
   exit(0);
}

Measured memory_bytes: 584
#include<stdio.h>
#include<string.h>
#include<queue>
const int N=52,dx[]={0,1,0,-1,0};
char L[N][N],R[N][N];
struct S{int lx,ly,rx,ry;}s,t;
int F()
{
	static int b[N][N][N][N];
	memset(b,0,sizeof(b));
	std::queue<S>q;
	q.push(s);
	char l,r,i;
	while(q.size())
	{
		s=q.front(),q.pop();
		if(b[s.ly][s.lx][s.ry][s.rx])continue;
		b[s.ly][s.lx][s.ry][s.rx]=1;
		l=L[s.ly][s.lx];
		r=R[s.ry][s.rx];
		if(l=='%'&&r=='%')return 1;
		if(l=='%'||r=='%')continue;
		for(i=0;i<4;++i)
		{
			t=s;
			if(L[t.ly+=dx[i+1]][t.lx+=dx[i]]=='#')t=s;
			if(R[t.ry+=dx[i+1]][t.rx-=dx[i]]=='#')t.rx=s.rx, t.ry=s.ry;
			q.push(t);
		}
	}
	return 0;
}
int main()
{
	int h,w,i;
	char*p;
	while(scanf("%d%d",&w,&h),w)
	{
		for(i=1;i<=h;++i)
		{
			scanf("%s%s",L[i]+1,R[i]+1);
			if(p=strchr(L[i]+1,'L'))s.lx=p-L[i],s.ly=i;
			if(p=strchr(R[i]+1,'R'))s.rx=p-R[i],s.ry=i;
		}
		for(i=0;i<h+2;++i)L[i][0]=L[i][w+1]=R[i][0]=R[i][w+1]='#';
		for(i=0;i<w+2;++i)L[0][i]=L[h+1][i]=R[0][i]=R[h+1][i]='#';
		puts(F()?"Yes":"No");
	}
	return 0;
}

Measured memory_bytes: 32000
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main () {
cin >> a >> b >> c;
if (c >=  a && c <= b) {
	cout << "Yes" << endl;
}
else if (a == b == c){
	cout << "Yes" << endl;
}
else {
	cout << "No" << endl;
}
}


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

using namespace std;

using ll = long long;
using P = pair<string, string>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    map<P, ll> memo;
    for (int i = 0; i < (1 << n); i++) {
        string s1 = "", s2 = "";
        for (int j = 0; j < n; j++) {
            if (i & (1 << j)) {
                s1 += s[j];
            } else {
                s2 += s[j];
            }
        }
        reverse(s2.begin(), s2.end());
        memo[P(s1, s2)]++;
    }

    ll ans = 0;
    for (int i = 0; i < (1 << n); i++) {
        string s1 = "", s2 = "";
        for (int j = n; j < n * 2; j++) {
            if (i & (1 << (j - n))) {
                s1 += s[j];
            } else {
                s2 += s[j];
            }
        }
        reverse(s2.begin(), s2.end());
        ans += memo[P(s2, s1)];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 87040
#include<stdio.h>
int main(void){
  int n;
  scanf("%d", &n);
  if(700<=n&&n<=799){
    printf("Yes");
  }
  else if(n%10==7){
    printf("Yes");
  }
  else if(70<=n%100 && n%100<=79){
    printf("Yes");
  }
  else{
    printf("No");
  }
  return 0;
}
    


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

#define int long long
//typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif




signed main() {
    int N, A, B;
    cin >> N >> A >> B;
    if(A>B) swap(A,B);
    
    int ans;
    if((A-B)%2==0) ans=abs(A-B)/2;
    else{
        ans = max(A-1,B-1);
        ans = min(ans, max(N-A,N-B));
        // orikaeshi
        int t=0;
        t=A-1+1+(B-(A-1)-1-1)/2;
        ans = min(ans, t);
        
        t=(N-B)+1+(N-(A+N-B+1))/2;
        ans = min(ans, t);
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 256
from collections import defaultdict

N, M = map(int, input().strip().split())

d = defaultdict(lambda: 0)
A = list(map(int, input().strip().split()))
for a in A:
    d[a] += 1

for m in range(M):
    B, C = map(int, input().strip().split())
    d[C] += B

count_ = 0
score = 0
for i, (k, v) in enumerate(sorted(d.items(), key=lambda x: -x[0])):
    score = score + (k*v)
    count_ += v
    if count_ >= N:
        r = count_ - N
        score = score - (k*r)
        break

print(score)


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

using namespace std;
int main() {
    string s;
    cin>>s;
    long long sum = 0;
    int flag = 0;
    for(int i = 0 ;i < s.length();i++){
        if(s[i] == 'W'){
            sum += i - flag;
            flag++;
        }
    }
    cout<<sum;
    return 0;
}


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

int main() {
  int r,g,b;
  cin >> r >> g >> b;
  
  if((r*100+g*10+b*1)%4==0){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(int i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 1e18
#define five 100005;
#define six 1000005;
#define prllclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//___________________________________________________________________________________________________________________________________________________________
int main()
{
       map<string,string> mp;
       //cin>>s;
       mp["Sunny"] = "Cloudy";
       mp["Cloudy"]  = "Rainy";
       mp["Rainy"] = "Sunny";
       string s;
       cin>>s;
       cout<<mp[s];
}


Measured memory_bytes: 256