akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int dp[100010][4];

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

	string S;

	cin >> S;
	dp[0][0] = 1;
	rep(i, 0, SZ(S))
	{
		if (S[i] == '?' || S[i] == 'A')
		{
			dp[i + 1][0] += dp[i][0];
			dp[i + 1][1] += dp[i][1];
			dp[i + 1][2] += dp[i][2];
			dp[i + 1][3] += dp[i][3];
			dp[i + 1][1] += dp[i][0];
		}
		if (S[i] == '?' || S[i] == 'B')
		{
			dp[i + 1][0] += dp[i][0];
			dp[i + 1][1] += dp[i][1];
			dp[i + 1][2] += dp[i][2];
			dp[i + 1][3] += dp[i][3];
			dp[i + 1][2] += dp[i][1];
		}
		if (S[i] == '?' || S[i] == 'C')
		{
			dp[i + 1][0] += dp[i][0];
			dp[i + 1][1] += dp[i][1];
			dp[i + 1][2] += dp[i][2];
			dp[i + 1][3] += dp[i][3];
			dp[i + 1][3] += dp[i][2];
		}
		rep(j, 0, 4)dp[i + 1][j] %= MOD;
	}

	cout << dp[SZ(S)][3] << endl;

	return 0;
}

Measured memory_bytes: 3664
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		System.out.println(String.format("%d %d %f",a/b,a%b,(double)a/b));
	}
}


Measured memory_bytes: 26516
import sys
sys.setrecursionlimit(10 ** 7)


N, Q = map(int, input().split())
AB = [[] for i in range(N + 1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    AB[a].append(b)

X = [0] * (N + 1)
for _ in range(Q):
    p, x = map(int, input().split())
    X[p] += x


def recursive(p):
    for c in AB[p]:
        X[c] += X[p]
        recursive(c)


recursive(1)
print(" ".join(map(str, X[1:])))


Measured memory_bytes: 225832
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)1e3+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,m,a,b;

int d[MAXN][MAXN];

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	cin >> n >> m >> a >> b;

	TRACE2(n-b,a);

	for (int i = 0; i < n-b; ++i)
		for (int j = 0; j < a; ++j)
			d[i][j] = 1;

	for (int i = n-b; i < n; ++i)
		for (int j = a; j < m; ++j)
			d[i][j] = 1;

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
			cout << d[i][j];
		cout << endl;
	}

}


Measured memory_bytes: 5120
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N = int(input())
K = 10**5+1
P = [i for i in range(K)]

def par(a):
    if P[a] == a:
        return a
    t = par(P[a])
    P[a] = t
    return t
def cb(a, b):
    pa = par(a)
    pb = par(b)
    if pa != pb:
        P[pa] = pb

X = [[] for _ in range(K)]
Y = [[] for _ in range(K)]
for _ in range(N):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    Y[y-1].append(x-1)
for i in range(K):
    for j in range(len(Y[i])-1):
        cb(Y[i][j], Y[i][j+1])

M = [[] for _ in range(K)]
for i in range(K):
    M[par(i)].append(i)
ans = -N
for i in range(K):
    S = []
    for j in M[i]:
        for k in X[j]:
            S.append(k)
    S = list(set(S))
    ans += len(S)*len(M[i])
print(ans)

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

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

    if (N / 100 == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    N %= 100;
    if (N / 10 == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    N %= 10;
    if (N == 7) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef vector<lo> vl;
typedef vector<vl>vll;
#define all(v) (v).begin(), (v).end()
#define debug(x) cerr<<#x<<" = "<<x<<endl;
#define REPV(a, b, c) for (lo(a) = b; (a) < (c); (a)++) 
#define REP(a,b) for(lo i =(a) ;i<(b);i++)

template <typename T>

istream &operator>>(istream &in, vector<T> &v)
{
	for (unsigned i = 0; i < v.size(); i++)
		in >> v[i];
	return in;
}


void solve(){
lo X; cin>>X;
lo ans;
if(X>=400&&X<=599)ans = 8;
else if(X>=600&&X<=799)ans = 7;
else if(X>=800&&X<=999)ans = 6;
else if(X>=1000&&X<=1199)ans = 5;
else if(X>=1200&&X<=1399)ans = 4;
else if(X>=1400&&X<=1599)ans = 3;
else if(X>=1600&&X<=1799)ans = 2;
else if(X>=1800&&X<=1999)ans = 1;
cout<<ans<<endl;

}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout.precision(20);
	solve();
	return 0;
}

Measured memory_bytes: 3688
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;
#define lol long long

int main()
{
	string S;
	cin >> S;
	vector<bool> AC(S.size(), false);
	vector<int> ans(10, 0);
	int M = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
			AC[i] = true;
		}
	}
	for (int i = 0; i < S.size(); i++) {
		if (AC[i] == true) {
			ans[M]++;
		}
		else {
			M++;
		}
	}
	sort(ans.begin(), ans.end());
	cout << ans[9] << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define endl "\n"
#define all(x) (x).begin(),(x).end()
const int MOD = 1e9+7;
const int mxN = 2e5+3;

void solve(){
	int n;
	cin >> n;
	int x[n], y[n];
	for(int i = 0; i < n; ++i)cin >> x[i] >> y[i];
	int sum[n], diff[n];
	for(int i = 0; i < n; ++i){
		sum[i] = x[i] + y[i];
		diff[i] = x[i] - y[i];
	}
	sort(sum, sum + n);
	sort(diff, diff + n);
	int ans = max(sum[n-1] - sum[0], diff[n-1] - diff[0]);
	cout << ans << endl;
}

int32_t main(){
	IO;
	
	int nT = 1;
	//cin >> nT;
	for(int i = 1; i <= nT; ++i)
		solve();
	return 0;
}


Measured memory_bytes: 9900
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>

using namespace std;

#line 2 "tmp.cpp"

bool f(ll x, const ll k, const vl &a) {
  int n = a.size();
  vl b(n);
  REP(i, n) { b[i] = a[i] % x; }
  sort(ALL(b));
  vl cum1(n), cum2(n);
  cum1[0] = b[0];
  FOR(i, 1, n) { cum1[i] = cum1[i - 1] + b[i]; }

  cum2[n - 1] = (x - b[n - 1]) % x;
  for (int i = n - 2; i >= 0; i--) {
    cum2[i] = cum2[i + 1] + (x - b[i]) % x;
  }

  REP(i, n - 1) {
    if (abs(cum1[i] - cum2[i + 1]) % x == 0 && max(cum1[i], cum2[i + 1]) <= k) {
      return true;
    }
  }

  bool equ = true;
  REP(i, n) { equ = equ && b[i] == 0; }
  return equ;
}

int main() {
  ll n, k;
  cin >> n >> k;
  ll sum = 0;
  vl a(n);
  REP(i, n) {
    cin >> a[i];
    sum += a[i];
  }
  ll ans = 0;
  vl candidate;
  FOR(i, 1, sqrt(sum) + 1) {
    if (sum % i == 0) {
      candidate.push_back(i);
      candidate.push_back(sum / i);
    }
  }
  for (const auto c : candidate) {
    if (f(c, k, a)) {
      ans = max(c, ans);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>

using namespace std;
typedef long long ll;

int main(){
    int n, m;
    priority_queue<int> pq;
    int temp;
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        cin >> temp;
        pq.push(temp);

    }
    for (int i = 0; i < m; i++)
    {
        temp = pq.top();
        pq.pop();
        pq.push(temp / 2);
    }
    ll ans = 0;
    while (!pq.empty())
    {
        ans += pq.top();
        pq.pop();
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 892
N = int(input())
a,b = map(int,input().split())

P = list(map(int,input().split()))

 
A = []
B = []
C = []
for i in P:
    if i<=a:
        A.append(i)
    elif i<=b:
        B.append(i)
    else :
        C.append(i)

ans = min([len(A),len(B),len(C)])
print(ans)

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

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

    int a, b, k;
    cin >> a >> b >> k;

    int player = 1; // 1: Takahashi, 2: Aoki
    rep(_, k){
        if(player){
            if(a%2) a -= 1;
            b += a/2;
            a /= 2;
        }

        else{
            if(b%2) b -= 1;
            a += b/2;
            b /= 2;
        }

        player = 1 - player; // Switch the player
    }

    cout << a << " " << b << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
long long dp[100001];
int h[100001];
const long long INF = 1LL << 60;
int main()
{
    int n,k;
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> h[i];
        dp[i] = INF;
    }
        

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

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

int main(){
  double A,B,H,M;
  cin>>A>>B>>H>>M;
  double C,D;
  C=2*M_PI*(H*60+M)/720;
  D=2*M_PI*M/60;
  double E=C-D;
  double r;
  r=sqrt(A*A+B*B-2*A*B*cos(E));
 
  cout << fixed << setprecision(12);
  cout << r <<endl;  
  
}

Measured memory_bytes: 4176
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] array = new int[n];
    int count = 0;
    int max = 0;

    for(int i=0; i<n; i++){
      array[i] = sc.nextInt();
      if(max<=array[i]){
        count += 1;
        max = array[i];
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 22608
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <cmath>
int main(){
  long X;
  std::cin >> X;
  std::map<long, std::pair<long, long>> M;
  for(long i = 0; i < 200; ++i){
    for(long j = 0; j < 200; ++j){
      long ans1 = i*i*i*i*i - j*j*j*j*j;
      long ans2 = i*i*i*i*i + j*j*j*j*j;
      if(M.find(ans1) == M.end()){
        M.insert(std::make_pair(ans1, std::make_pair(i,j)));
      }
      if(M.find(ans2) == M.end()){
        M.insert(std::make_pair(ans2, std::make_pair(i,-j)));
      }
    }
  }
  std::cout << M[X].first << " " << M[X].second << std::endl;
  return 0;
}


Measured memory_bytes: 7324
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<map>
#include<cmath>

using namespace std;

typedef long long ll;
#define INF 1000000007

int main(){
    int n; cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; i++)
    {
        cin >> h[i];
    }

    vector<int> dp(100005, INF);
    dp[0] = 0;

    for(int i = 1; i < n; i++)
    {
        dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if(i > 1){
            dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        }
    }
    cout << dp[n - 1] << "\n";
    return 0;
}


Measured memory_bytes: 1024
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

int main() {
    int H, W, K;
    cin >> H >> W >> K;
    vector<vector<char>> c(H,vector<char>(W,0)); // 0が白、1が黒
    rep(i,0,H) rep(j,0,W) {
        char c_;
        cin >> c_;
        if (c_ == '#') c[i][j] = 1;
    }

    int ans = 0;
    rep(bit1, 0, 1<<H) rep(bit2, 0, 1<<W) {
        int tmp = 0;
        rep(i,0,H) rep(j,0,W) {
            if (!(bit1 & (1<<i)) && !(bit2 & (1<<j)) && c[i][j]) tmp++;
        }
        if (tmp == K) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int ans = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).Sum() % 24;
        Console.WriteLine(ans);
    
    }



    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"



23 2



";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 11220
a = list(map(int, input().split()))
count5 = 0
count7 = 0
for a in a:
  if a == 5:
    count5 += 1
  elif a == 7:
    count7 += 1

if count5 == 2 and count7 == 1:
  print('YES')
else:
  print('NO')




Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
int main()
{

    double x1, y1, x2, y2;
    std::cin >> x1 >> y1 >> x2 >> y2;

    std::cout <<std::setprecision(12) << std::sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)) << "\n";
    return 0;
}


Measured memory_bytes: 3264
import sys

input = sys.stdin.readline

def main():
    ans = 0
    N, M = map(int, input().split())
    m = [0]*N
    for _ in range(M):
        a, b = map(int, input().split())
        m[a-1] += 1
        m[b-1] += 1
    for i in range(N):
        print(m[i])

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
using datas=pair<ll,ll>;
using tdata=pair<datas,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}

int main(){
  ll i,N,K,ans=0,cnt=0;
  cin>>N>>K;
  string s;cin>>s;
  rep1(i,N){
    if(s[i-1]==s[i]){
      ans++;
    }else{
      cnt++;
    }
  }
  if(ans==N-1){
    cout<<ans<<endl;
    return 0;
  }
  if(cnt<=2*K){
    cout<<N-1<<endl;
    return 0;
  }
  cout<<ans+2*K<<endl;
  return 0;
}

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

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

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

int main() {
    ll n;
    cin >> n;
    for (ll i = 1;i < 3501;++i) for (ll j = 1;j < 3501;++j) {
        ll a = n*i*j,b = 4*i*j-n*i-n*j;
        if (b > 0 && a%b == 0) {
            cout << i << " " << j << " " << a/b << endl;
            return 0;
        }
    }
}

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


int main()
{
 int A;
 int B;
 int C;
 
 cin>>A>>B>>C;
 
 int a=max({A,B,C});
 int c=min({A,B,C});
 int b=A+B+C-a-c;
 if((b-c)%2==0){
	 cout<<(b-c)/2+a-b<<endl;
     }else{
		 if((a-b)%2==0){
			 cout<<(a-b)/2+(a+1-c)/2+1<<endl;}
else{cout<<(a-c)/2+(a+1-b)/2+1<<endl;}}

}


Measured memory_bytes: 256
operator fun String.times(n:Int):String {
    var res:String = ""
    for (x in 1..n) {
        res += this
    }
    return res
}

fun main(args:Array<String>) {
    val (a,b) = readLine()!!.split(" ")
    var ls:MutableList<String> = mutableListOf(a * b.toInt(), b * a.toInt())
    ls.sort()
    println(ls[0])
}

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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)

        {
            long n = long.Parse(Console.ReadLine());
            var s = Console.ReadLine().ToArray();
            //string ss = "";
            ulong ans = 1;

            for(long i = 1; i < n; i++)
            {
                if (s[i-1] != s[i])
                {
                    ans++;
                    
                }

                //Console.WriteLine(ss);
            }

            // ans++;


            Console.WriteLine(ans);
        
            
        }
    }
}


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

using namespace std;

int n;
int v[3010];

long long dp[3010][3010][2];

int main() {
    memset(dp, -1, sizeof dp);
    cin >> n;
    for (int i = 0; i < n; ++i) 
        cin >> v[i];


    auto f = [&](auto &Self, int i, int j, int flag) -> long long {
        if(i > j) return 0;
        auto &ans = dp[i][j][flag];
        if(ans != -1) return ans;
        ans = flag ? -1e18 : 1e18;

        if(flag) {
            ans = max(ans, Self(Self, i + 1, j, !flag) + v[i]);
            ans = max(ans, Self(Self, i, j - 1, !flag) + v[j]);
        } else {
            ans = min(ans, Self(Self, i + 1, j, !flag) - v[i]);
            ans = min(ans, Self(Self, i, j - 1, !flag) - v[j]);
        }
        return ans;
    };
    
    cout << f(f, 0, n - 1, 1) << "\n";
    //cout << dp[0][n - 1][1] << "\n";
    return 0;
}


Measured memory_bytes: 141952
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
  
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int main() {

    int W,a,b; cin >> W >> a >> b;

    if (a > b) {
        cout << max(0, a - b - W) << endl;
    } else {
        cout << max(0, b - a - W) << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>

#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD=(LL)1e9+7;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

#define INF 1LL << 50



int main(){
    LL X,Y;
    cin>>X>>Y;
    if(abs(X-Y)<=1LL){
        cout<<"Brown"<<endl;
    }else{
        cout<<"Alice"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
class Combination():
    def __init__(self, n, mod):
        self.n = n
        self.mod = mod
        self.fact = self.make_fact(n)
        self.fact_inv = self.make_fact_inv(n)
    def make_fact(self, n):#0~nの階乗を求める
        res = [1]*(n+1)
        for i in range(1, n+1):
            res[i] = res[i-1]*i%self.mod
        return res
    def make_fact_inv(self, n):#0~nの階乗のmodに関する逆元を求める
        fact_inv = [1]*(n+1)
        fact_inv[n] = pow(self.fact[n], self.mod-2, self.mod)#フェルマーの小定理
        for i in range(n, 0, -1):
            fact_inv[i-1] = fact_inv[i]*i%self.mod
        return fact_inv
    def comb(self, m, k):
        return self.fact[m]*self.fact_inv[k]*self.fact_inv[m-k]%self.mod
    


lim=998244353
n,m,k=map(int,input().split())

#n,m,k = 60522, 114575, 7559
sum_ = 0
comb=Combination(n,lim)
for j in range(k+1):
    ans = m %lim
    #print(m-j-1,n,j)
    ans = (ans *pow(m-1,n-j-1,lim)) % lim
    ans = (ans * comb.comb(n-1,j)) % lim
    #print(ans)
    sum_ = (sum_+ans) % lim
print(sum_)

Measured memory_bytes: 74536
n, a, b = map(int, input().split())
if (a - b) % 2 == 0:
	print(abs(a - b) // 2)
else:
	if a - 1 < n - b:
		print(((a - 1) + (b - 1)) // 2 + 1)
	else:
		print(((n - a) + (n - b)) // 2 + 1)

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits.h>
#include <climits>
#include <map>
#include <unordered_map>
#include <cmath>
#include <set>
#include <unordered_set>
#include <iterator>
#include <deque>
#include <assert.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
ull min(ull x, ull y){ if (x<y) return x; return y;}
ull max(ull x, ull y){ if (x<y) return y; return x;}
ll min(ll x, ll y){ if (x<y) return x; return y;}
ll max(ll x, ll y){ if (x<y) return y; return x;}
double min(double x, double y){ if (x<y) return x; return y;}
double max(double x, double y){ if (x<y) return y; return x;}
ull gcd(ull x, ull y){
    if (!x) return y;
    if (!y) return x;
    if (x>y) swap(x,y);
    return gcd(x, y%x);
}
ull inv(ull a, ull c){ // a,c are coprime and a<c
    if (a==1){
        return 1;
    }
    return ((c-(c/a))*inv(c%a,c))%c;
}


int main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    int k;
    cin>>k;

    queue<string> q;
    for (int i = 1; i <= 9; i++){
        char c = (char)((int)'0' + i);
        string s;
        s+=c;
        q.push(s);
    }

    int cnt = 0;
    string ans;

    while (cnt<k){
        string u = q.front();
        q.pop();
        int d = u.back() - '0';
        for (int i = d - 1; i <= d + 1; i++){
            if ((i>=0) && (i<10)){
                char c = (char)((int)'0' + i);
                string s = u;
                s+=c;
                q.push(s);
            }
        }
        cnt++;
        if (cnt==k) ans = u;
    }
    cout<<ans<<"\n";
    return 0;
    
}



Measured memory_bytes: 13824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#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(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
bool isATCG(char c){
    bool isatcg = false;
    if(c == 'A'||c == 'T'||c=='C'||c=='G'){
        isatcg = true;
    }
    return isatcg;
}
int main()
{
    INIT;
    string s;
    cin >> s;
    int ma = -1;
    int l = 0;
    FOR(i,0,s.size()){
        if(isATCG(s.at(i))) l++;
        else{
            ma = max(ma, l); 
            l = 0;
        }
    }
    ma = max(ma,l);
    cout << ma << endl;
    return 0;
} 

Measured memory_bytes: 256
#include<cstdio>
typedef long long ll;
const ll base = 1'000'000'000 + 7;
const ll half = 500'000'004; // 1/2 mod base
int n, Q;
ll d[3333][3333];
ll a[3333];
int main()
{
	scanf("%d%d", &n, &Q);
	for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (i == j) continue;
			if (a[i] < a[j]) d[i][j] = 1;
		}
	}
	for (int q = 1; q <= Q; q++)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		d[u][v] = d[v][u] = ((d[u][v] + d[v][u]) * half) % base;
		for (int i = 1; i <= n; i++)
		{
			if (i == u || i == v) continue;
			// prob that a[i]<a[u]
			d[i][u] = d[i][v] = ((d[i][u] + d[i][v]) * half) % base;
			// prob that a[u]<a[i]
			d[u][i] = d[v][i] = ((d[u][i] + d[v][i]) * half) % base;
		}
	}
	ll pow2 = 1;
	for (int i = 1; i <= Q; i++) pow2 = (pow2 << 1) % base;
	ll ans = 0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j < i; j++)
		{
			ans = (ans + d[i][j] * pow2) % base;
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 80376
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {
    private static final StringBuilder builder = new StringBuilder();
    public static void main(String[] args) {
        int n = readInt();
        System.out.print((n - 2) * 180);
    }

    private static void read() {
        builder.setLength(0);
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) {
                    break;
                } else {
                    builder.appendCodePoint(b);
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static int readInt() {
        read();
        return Integer.parseInt(builder.toString());
    }

    private static int readInt(int radix) {
        read();
        return Integer.parseInt(builder.toString(), radix);
    }

    private static long readLong() {
        read();
        return Long.parseLong(builder.toString());
    }

    private static long readLong(int radix) {
        read();
        return Long.parseLong(builder.toString(), radix);
    }

    private static BigInteger readBigInteger() {
        read();
        return new BigInteger(builder.toString());
    }

    private static BigInteger readBigInteger(int radix) {
        read();
        return new BigInteger(builder.toString(), radix);
    }

    private static double readDouble() {
        read();
        return Double.parseDouble(builder.toString());
    }

    private static BigDecimal readBigDecimal() {
        read();
        return new BigDecimal(builder.toString());
    }

    private static float readFloat() {
        read();
        return Float.parseFloat(builder.toString());
    }

    private static void skipLine() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == '\n' || b == -1) {
                    break;
                }
            } catch (IOException e) {
                break;
            }
        }
    }

    private static void skip() {
        while (true) {
            try {
                int b = System.in.read();
                if (b == ' ' || b == '\n' || b == -1) break;
            } catch (IOException e) {
                break;
            }
        }
    }

}


Measured memory_bytes: 32276
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int n, t, x, y;
    bool f = true;
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> t >> x >> y;
        if(t >= x + y && (x + y) % 2 == t % 2){}
        else{
            f = false;
        }
    }

    if(f){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   vector<int> vis(4,0);
   int a,b;
   cin >> a >> b;
   vis[a] = vis[b] = 1;
   f(i,1,4){
      if(!vis[i]){
         cout << i << '\n';
      }
   }
   return 0;
}

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

int main()
{
	long long n, k;
	cin >> n >> k;
	long long a, b;
	long long array[100000] = { 0 };

	for (int i = 0; i < n; i++)
	{
		cin >> a >> b;
		array[a - 1] += b;
	}

	for (long long i = 0; i < 100000; i++)
	{
		k -= array[i];
		if (k <= 0)
		{
			cout << i + 1 << "\n";
			break;
		}
	}
	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n; cin >> n;
    vector<pair<int,int>> a(n);

    for(int i = 0;i < n; i++){
        cin >> a[i].first;
        a[i].second = i+1;
    }

    sort(a.begin(), a.end());

    for(int i = 0;i < n; i++){
        cout << a[i].second << " ";
    }
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(void){

  char a,b,c;
  int count=0;
  cin >> a >> b >> c;
  char num[3]={a,b,c};
for(int i=0;i<3;i++){
	if(num[i] == '1'){
      count++;
    }
      
}
  
cout << count << endl;

}

Measured memory_bytes: 3600
def main():
    a, b, c = map(int, input().split())

    ans = 0
    if a == b:
        ans += 1
    if a == c:
        ans += 1
    if b == c:
        ans += 1
    if ans == 1:
        print('Yes')
    else:
        print('No')


main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int k=0;
    int a[3][3];
    int n;
    for(int i=0;i<3;i++)cin>>a[0][i];
    for(int i=0;i<3;i++)cin>>a[1][i];
    for(int i=0;i<3;i++)cin>>a[2][i];
    cin>>n;
    int b[n];
    for(int i=0;i<n;i++){
        cin>>b[i];
        for(int j=0;j<3;j++){
            if(b[i]==a[0][j]){
                a[0][j]=200;
            }
            else if(b[i]==a[1][j]){
                a[1][j]=200;
            }
            else if(b[i]==a[2][j]){
                a[2][j]=200;
            }
        }
    }
    if(a[0][0]==200&&a[0][1]==200&&a[0][2]==200){
        k++;
    }
    else if(a[1][0]==200&&a[1][1]==200&&a[1][2]==200){
        k++;
    }
    else if(a[2][0]==200&&a[2][1]==200&&a[2][2]==200){
        k++;
    }
    else if(a[0][0]==200&&a[1][0]==200&&a[2][0]==200){
        k++;
    }
    else if(a[0][1]==200&&a[1][1]==200&&a[2][1]==200){
        k++;
    }
    else if(a[0][2]==200&&a[1][2]==200&&a[2][2]==200){
        k++;
    }
    else if(a[0][0]==200&&a[1][1]==200&&a[2][2]==200){
        k++;
    }
    else if(a[2][0]==200&&a[1][1]==200&&a[0][2]==200){
        k++;
    }
    if(k!=0){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define anD &&
#define oR ||
#define max(a,b) ((a)>(b))?(a):(b)
#define min(a,b) ((a)<(b))?(a):(b)
#define rep(n) for((i)=0;(i)<(n);(i)++)

int main(){
	char t[1001],w[11],esa[]="END_OF_TEXT";
	int st,i,total=0;
	scanf("%s",&w);
	while(scanf("%s",&t)!='\0'){
		if(strcmp(t,esa)==0)break;
		st = strlen(t);
		rep(st){
			if(t[i]>='A' anD t[i]<='Z') t[i] = t[i]-'A'+'a';
		}
		if(strcmp(t,w)==0)total++;
	}
	printf("%d\n",total);
	return 0;
}

Measured memory_bytes: 548
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REP(i,a,b) for(ll i=(a);i<(b);++i)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define endl '\n'
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ld EPS=10e-8;
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

int main(){
    ll N,v,T=1,C=0;
    cin>>N;
    vector<ll> V;
    rep(i,N){
        cin >> v;
        V.pb(v);
    }
    sort(ALL(V));
    reverse(ALL(V));
    rep(i,V.size()-1){
        if(V[i]==V[i+1]){
            C++;
            T*=V[i];
            i++;
            if(C==2){
                cout << T << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
}

Measured memory_bytes: 1400
import sys
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    if a[i]==0:
        print(0)
        sys.exit()
ans=1
for i in range(n):
    ans*=a[i]
    if ans>10**(18):
        print('-1')
        sys.exit()
print(ans)

Measured memory_bytes: 21668
# -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

import copy
import math
import itertools

from functools import lru_cache
#@lru_cache(maxsize = None)

PPP = 1000000007

# 整数の入力
a = int(input())
s = input()

# スペース区切りの入力
#n, x = input().split()

# スペース区切りの整数の入力
#a, b = map(int, input().split())
#n, x = map(int, input().split())
#print("sp", n, k, file=sys.stderr)
#a = [int(x) for x in input().split()]
#b = [int(x) for x in input().split()]
#print("a", a, file=sys.stderr)
#p, q, r = map(int, input().split())
#s = [int(x) for x in input().split()]
#t = [int(x) for x in input().split()]

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))
#  a.append([int(x) for x in input().split()])
#b = []
#for x in range(m):
#  b.append([int(x) for x in input().split()])
#p = [int(x) for x in input().split()]
#a.sort()
#print(l, file=sys.stderr)

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

#cache = dict()

import re
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def ton(n, k, x):
  s = ""
  while n > 0:
    s = str(n%k) + s
    n //= k
  return s


#print("a", a, file=sys.stderr)
#print("b", b, file=sys.stderr)

def getEnergy():
  for y in b:
    yield y

def doit2(s = s):
  res = 0
  prev = None
  now = None
  for x in s:
    if now == None:
      now = x
    else:
      now += x
    if prev == now:
      now += x
    else:
      res += 1
      prev = now
      now = None
    print(prev, now, res, file=sys.stderr)

  #print(res, file=sys.stderr)
  return res

def doit():
  if a < 3200:
    return "red"
  return s

def yn():
  if doit():
    return "YES"
  else:
    return "NO"

#print(doit([0] * 4))
#doit(a)
#print(doit())
try:
  #doit()
  print(doit())
  #print(yn())
except Exception as e:
  print("e", e, file=sys.stderr)


Measured memory_bytes: 5776
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int r,g,b,n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    int nr = 0;
    while(nr*r <= n){
        int ng = 0;
        while(nr*r + ng*g<=n){
            if((n-nr*r-ng*g)%b == 0){
                ans += 1;
            }
            ng += 1;
        }
        nr += 1;
    }
    cout << ans;
}


Measured memory_bytes: 256
S = input()
List = list(S)

ans = 0
arr = []
for i in range(len(List)):
  if List[i] == "A" or List[i] == "C" or List[i] == "G" or List[i] == "T":
    ans += 1
  else:
    arr.append(ans)
    ans = 0
    
arr.append(ans)

print(max(arr))


Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        int N = S.length();

        long ret = 0;

        for (int i = 0; i < Math.pow(2, N - 1); i++) {
            int p = N - 1;

            for (int j = 0; j < N - 1; j++) {
                if (((i >> j) & 1) == 1) {
                    String str = S.substring(N - 1 - j, p + 1);
                    p = (N - 1 - j) - 1;
                    ret += Long.parseLong(str);
                }
            }

            ret += Long.parseLong(S.substring(0, p + 1));
        }

        System.out.println(ret);
    }
}

Measured memory_bytes: 21716
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

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

int a, b, c, d;
int op1, op2, op3;

int p[2] = { -1,1 };
string m = "-+";

int main()
{
	string s;
	cin >> s;
	a = (int)(s[0] - '0');
	b = (int)(s[1] - '0');
	c = (int)(s[2] - '0');
	d = (int)(s[3] - '0');
	//cout << a << " " << b << " " << c << " " << d << endl;

	int f, g, h;

	
	for (int j = 0; j < 2; j++) {
		for (int k = 0; k < 2; k++) {
			for (int l = 0; l < 2; l++) {
				f = b*p[j];
				g = c*p[k];
				h = d*p[l];
				//cout << f + g + h << endl;
				//cout <<j << " " << k<< " " << l << endl;
				if ( a + f + g + h == 7) {
					op1 = j; 
					op2 = k;
					op3 = l;
					//cout << j << " " << k << " " << l << endl;
					break;
				}
			}
		}
	}
	
	cout << a << m[op1] << b << m[op2] << c << m[op3] << d << "=7" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long long ll;
typedef pair<long long, long long> l4;
typedef vector<long long> vll;
typedef double db;
typedef vector<double> vdb;
typedef pair<double, double> dd;
typedef set<int> si;
typedef set<long long> sll;
#define fi first
#define se second
#define matrix(a) vector< vector<a> >
#define sz(a) int((a).size()) 
#define lop(i,a,b) for (int i=a; i<=b; i++)
#define vlop(i,v) lop(i,0,sz(v)-1)
#define vlop1(i,v) lop(i,1,sz(v)-1)
#define rlop(i,a,b) for (int i=b; i>=a; i--)
#define vrlop(i,v) rlop(i,0,sz(v)-1)
#define vrlop1(i,v) rlop(i,1,sz(v)-1)
#define printv(i,v) vlop(i,v)cout<<v[i]<<" "
#define printv1(i,v) vlop1(i,v)cout<<v[i]<<" "
#define all(s) (s).begin(),(s).end()
#define pb push_back
#define enter cout<<'\n'
#define lb(i,v) int(lower_bound(all(v),i)-v.begin())
#define ub(i,v) int(upper_bound(all(v),i)-v.begin())
 
const ll M=1e9+7;
const int inf=1e5+2;
vll fact, invfact;
 
ll euclidean(ll a, ll b) {
	vll r = { a,b };
	vll s = { 1,0 };
	while (true) {
		int i = sz(r) - 1;
		r.push_back(r[i - 1] % r[i]);
		ll q = r[i - 1] / r[i];
		s.push_back(s[i - 1] - s[i] * q);
		if (!r.back())break;
	}
	int i=sz(r)-2;
	if (s[i]<0)s[i] += b;
	if (s[i] >= b)s[i] -= b;
	return s[i];
}
void factorio() {
	fact.resize(inf + 1, 1);
	invfact.resize(inf + 1, 1);
	vlop1(i, fact) {
		fact[i] = fact[i - 1] * i%M;
		invfact[i] = euclidean(fact[i], M);
	}
	return;
}
 
ll comb(int a, int b) {
	if(a<b)return 0;
	return fact[a] * invfact[a - b] % M*invfact[b] % M;
}
 
int main(){
ios::sync_with_stdio(false);
	factorio();
	int n,p1,p2;
	cin>>n;
	vi a(n+1),count(n+1);
	vlop(i,a){
		cin>>a[i];
		if(count[a[i]])p2=i;
		else count[a[i]]=1;
	}
	vlop(i,a){
		if(a[i]==a[p2]){
			p1=i;
			break;
		}
	}
	lop(i,1,n+1)cout<<(comb(n,i)+comb(n,i-1)-comb(n-p2+p1,i-1)+M)%M<<'\n';
	return 0;
}

Measured memory_bytes: 3584
N, K = list(map(int, input().split()))
X = list(map(int, input().split()))

minus = []
plus = []

for x in X:
    if x < 0:
        minus.append(-x)
    else:
        plus.append(x)

minus.reverse()
ans = float('inf')


for i in range(min(K+1, len(minus)+1)):
    p = K - i
    if i == 0:
        if len(plus) >= p:
            ans = min(ans, plus[K-1])
    elif i == K:
        if len(minus) >= K:
            ans = min(ans, minus[K-1])
    else:
        if len(plus) >= p and len(minus) >= i:
            a = plus[p-1]
            b = minus[i-1]
            if a < b:
                ans = min(ans, 2 * a + b)
            else:
                ans = min(ans, b * 2 + a)

print(ans)


Measured memory_bytes: 63000
#maspyさんの

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
 
from heapq import heappush, heappushpop
 
N,M = map(int,input().split())
tasks = [[] for _ in range(M+1)] # 価値、締切
for _ in range(N):
    a,b = map(int,input().split())
    if a <= M:
        tasks[M-a].append(b)
 
q = []
for day in range(M+1):
    for v in tasks[day]:
        if len(q) < day+1:
            heappush(q,v)
        else:
            heappushpop(q,v)
 
answer = sum(q)
print(answer)

Measured memory_bytes: 18408
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

int main(){
    i64 n;
    cin>>n;
    if(n%1000==0){
        cout<<0<<endl;
    }
    else{
        cout<<1000-(n%1000)<<endl;
    }
    return 0;
}

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

#define ll long long int
ll mod=1e9+7;

// vector<ll> g[200005];
// ll vis[200005];
// queue<ll> q;
// ll level[200005];

// void dfs(ll i)
// {
//     vis[i] = 1;
//     for(ll j=0;j<g[i].size();j++)
//     {
//         ll child = g[i][j];
//         if(vis[child] == 0)
//         {
//             dfs(child);
//         }
//     }
// }

// void bfs(ll i)
// {
//     vis[i] = 1;
//     while(!q.empty())
//     {
//         ll top = q.front();
//         ll len_adj = g[top].size();
//         ll j;
//         for(j=0;j<len_adj;j++)
//         {
//             ll v = g[top][j];
//             if(vis[v]==0)
//             {
//                 vis[v]=1;
//                 q.push(v);
//                 level[v] = level[top] + 1;
//             }
//         }   
//         q.pop();
//     }
// }

vector<ll> DecToBinary(ll num,ll trailing_zero, ll nbits)
{
    vector<ll> bits;
    while(num > 0)
    {
        bits.push_back(num%2);
        num /= 2;
    }

    if(trailing_zero == 1)
    {
        while(bits.size() < nbits)
        {
            bits.push_back(0);
        }
    }

    return bits;
}

long long int BinaryToDec(vector<ll> bits)
{
    ll number = 0;
    ll i;
    for(i=bits.size()-1;i>=0;i--)
    {
        number += (bits[i] * (long long)pow((ll)2 , i));
    }
    return number;
}



ll modular_exponentiation(ll base, ll power)
{
    ll ans = 1;
    base = base % mod;
    while (power > 0)
    {
        if (power & 1)
        {
            ans = (ans * base) % mod;
        }

        power /= 2;
        base = (base * base) % mod;
    }
    return ans;
}



int main()
{
    /* Faster input ouput */
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);

    /* To read input from a file and output to a file */
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    
    ll t = 1;
    // cin >> t;
    while(t--)
    {        
        ll n,i,j,x;
        cin >> x >> n;
        vector<ll> arr(n);

        for(i=0;i<n;i++)
        {
            cin >> arr[i];
        }

        sort(arr.begin(),arr.end());

        ll closest = INT_MAX;

        for(i=x;i>=0;i--)
        {
            auto it = find(arr.begin(),arr.end(),i);
            if(it == arr.end())
            {
                if(abs(x-i) < abs(x-closest))
                {
                    closest = i;
                    break;
                }
            }
        }

        for(i=x+1;i<=101;i++)
        {
            auto it = find(arr.begin(),arr.end(),i);
            if(it == arr.end())
            {
                if(abs(x-i) < abs(x-closest))
                {
                    closest = i;
                    break;
                }
            }
        }

        cout << closest << '\n';



    }

    
    
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define re(n) for (int i = 0; i < (n); ++i)
#define rej(n) for (int j = 0; j < (n); ++j)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef pair <int, int> pii;
typedef vector <pair <int, int>> vii;

const ld PI = acos((ld)-1);

int main() {
    #ifndef LOCALDEBUG
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #endif  // LOCALDEBUG
    int n;
    cin >> n;
    vi l(n);
    re(n) cin >> l[i];
    sort(all(l));
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < i; ++j) {
            ans += max(0ll, (ll)(lower_bound(l.begin(), l.end(), l[i] + l[j]) - l.begin()) - i - 1);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <string>
#include <map>
#include <set> 
using namespace std;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n;
	cin >> n;
	vector<int> numbers(n);
	for (int i = 0; i < n; ++i) {
		cin >> numbers[i];
		--numbers[i];
	}
	int count = 0;
	for (int i = 0; i < n; ++i) {
		if (numbers[numbers[i]] == i) ++count;
	}
	cout << count / 2 << endl;


	return 0;
}

Measured memory_bytes: 640