akhauriyash/Code-Regression huggingface dataset:
// Problem : B - 文字列大好きいろはちゃんイージー / Iroha Loves Strings (ABC Edition)
// Contest : AtCoder Beginner Contest 042
// URL : https://atcoder.jp/contests/abc042/tasks/abc042_b
// Memory Limit : 256.000000MB 
// Time Limit : 2000.000000milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

//1-1-20
#include<bits/stdc++.h>

#define Pi acos(-1.0)
#define U unsigned
#define ll long long
#define uu first
#define vv second
#define endl "\n"
#define scu(n) scanf("%u",&n)
#define scl(n) scanf("%d",&n)
#define scll(n) scanf("%lld",&n)

//Vector Macros
#define pb push_back
#define eb emplace_back
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end())
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c),0)

//Loop Macros
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,a,b)  for(int i=a;i<=b;i++)
#define For(i,n) for(int i=0;i<n;i++)

//Debug Macros
#define deb(a) cout << #a << " : " << a << " ";
#define debln(a) cout<< #a <<" : " << a << endl;
#define open  freopen("input.txt","r",stdin);
#define close freopen ("output.txt","w",stdout);

//Print Macros
#define print(v)  for(auto x : v) {  cout<<x;   }  cout<<endl;
#define PRINT(v)  for(auto x : v) { cout<<x.uu<<" "<<x.vv<<endl; }

/*
ll for_binarySearch(ll a,ll b,ll aa[],ll x){while(a<=b){ll mid=(a+b)/2;if(aa[mid]==x) return 1;else if(aa[mid] > x) b=mid-1;else a=mid+1;}return -1;}
ll for_gcd(ll a,ll b){if(a==0) return b;else return for_gcd(b%a,a);}
ll for_prime(ll x){for (ll i=2;i*i<=x;i++){if(x%i==0) return 0;}return 1;}
void for_swap(char *x,char *y){char temp;temp=*x;*x=*y;*y=temp;}
ll for_big_mod(ll b,ll p,ll m){if(p==0) return 1;else if(p%2==0){ll k=for_big_mod(b,p/2,m);return (k*k)%m;}else return ((b%m)*(for_big_mod(b,p-1,m)))%m;}
ll for_josephus(ll n,ll k){if(n==1) return 1;return (for_josephus(n-1,k)+k-1)%n+1;}
ll for_gcdExtended(ll a,ll b,ll *x,ll *y){if(a==0){*x=0;*y=1;return b;}ll x1,y1;ll gcd=for_gcdExtended(b%a,a,&x1,&y1);*x=y1-(b/a)*x1;*y=x1;return gcd;}
*/

#define fastio  ios::sync_with_stdio(false); cin.tie(nullptr);

using namespace std;

int main()
{
    //open
    //close
    // fastio
	
	int n,l;
	scl(n);
	scl(l);
	
	multiset<string>st;
	
	For(i,n){
		
		string s;
		cin>>s;
	    st.insert(s);
	}
	
	print(st);
    return 0;
}





Measured memory_bytes: 256
read N
ans=0
for ((i=0; i<N; i++)); do
    read x y
    if [[ $y == 'JPY' ]]; then
        ans=$(echo $ans $x | awk '$0=$1+$2')
    else
        ans=$(echo $ans $x | awk '$0=$1+$2*38e4')
    fi
done

echo $ans


Measured memory_bytes: 792
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <stack>
#include <set>
#include <algorithm>
using namespace std;
#define ll long long int

int main() {
  int n,ans = 1e6,tmp = 0;
  string s;
  cin >> n >> s;
  vector <int> r(n);
  for ( int i = 0; i < n; ++i ) {
    if ( s[i] == '#' ) r[i]++;
    if ( i == 0) continue;
    r[i] += r[i - 1];  
  }
  reverse( r.begin(), r.end() );
  reverse( s.begin(), s.end() );
  for ( int i = 0; i < n - 1; ++i ) {
    if ( s[i] == '.' ) {
      ans = min( ans, tmp + r[i] );
      ++tmp;
    }
  }
  ans = min(ans,tmp);
  cout << ans << endl;
  return 0;
}



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

int n, rt, f[101000];
vector<int>G[101000];

namespace f__k{
  int res, fir;
  
  void dfs(int x,int fff){
    int isrt=0;
    if (G[x].size()>2&&fir) fir=0, isrt=1;
    for (auto y:G[x]) if (y!=fff) dfs(y,x);
    int t=max(0,(int)G[x].size()+isrt-2-f[x]);
    f[fff]+=!!f[x]|!!t;
    res+=t;
    //printf(" %d %d\n",x,t);
  }
  
  int realmain(){
    res=0; fir=1;
    memset(f,0,sizeof f);
    dfs(rt,0);
    return max(res,1);
  }
}

namespace s__t{
  int realmain(){
    return 1e8;
  }
}

int main(){
  cin>>n;
  int x,y;
  for (int i=n-1;i--;){
    scanf("%d%d",&x,&y); ++x; ++y;
    G[x].push_back(y); G[y].push_back(x);
  }
  for (rt=1;G[rt].size()!=1;++rt);
  int ans=min(f__k::realmain(),s__t::realmain());
  cout<<ans<<endl;
}

Measured memory_bytes: 12416
#include <stdio.h>

int main(void) {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if(((a-b <= d && b-c <= d) && (a-b >= -d && b-c >= -d)) || (a-c <= d && a-c >= -d)) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main() {
	int i, fir, sec, thi, h[10];
	fir = 0;
	sec = 0;
	thi = 0;

	for (i = 0; i < 10; i++) {
		scanf("%d", &h[i]);
	}

	for (i = 0; i < 10; i++) {
		if (fir <= h[i]) {
			thi = sec;
			sec = fir;
			fir = h[i];
		}
		else if (sec <= h[i]) {
			thi = sec;
			sec = h[i];
		}
		else if (thi <= h[i]) {
			thi = h[i];
		}
	}

	printf("%d\n", fir);
	printf("%d\n", sec);
	printf("%d\n", thi);

	return 0;
}

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

int main() {
  int input;
  string ans = "No";
  cin >> input;
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      if (i*j == input) {
        ans = "Yes";
      }
    }
  }
  cout  << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>
#include<iomanip>

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const int MOD = 1000000007;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
template<class T>
int dp2csv(const vector<vector<T>>& dp, const string fname);
int range_check(int val, int min, int max) {
	if (val < min) {
		return min;
	}
	if (val > max) {
		return max;
	}
	return val;
}
int main() {
	int n;
	string str;
	cin >> n;
	cin >> str;
	REP(i, str.size()) {
		str[i] = 'A' + ((str[i] - 'A') + n) % 26;
	}
	cout << str << endl;
	return 0;
}
template<class T>
int dp2csv(const vector<vector<T>>& dp, const string fname) {
	ofstream ofs(fname);
	if (ofs.fail()) { cerr << "cannot open file. :" + fname << endl; return -1; }
	for (auto dp_row : dp) {
		for (auto dp_cell : dp_row) {
			ofs << dp_cell << ",";
		}
		ofs << endl;
	}
	ofs.close();
	return 0;
}


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

int main(){
    int n;
    static int a[200000], x;
    cin >> n;
    for(int i=0;i<n;++i){ cin >> a[i]; x ^= a[i]; }
    for(int i=0;i<n;++i) cout << (x ^ a[i]) << " \n"[i==n-1];
    
    return 0;
}

Measured memory_bytes: 4384
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

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

  int N;
  cin >> N;

  vector<int> A(N);
  for (size_t i = 0; i < N; i++) {
    cin >> A.at(i);
  }

  long long int kabu = 0;
  long long int money = 1000;

  for (size_t i = 0; i < N-1; i++) {
    if (A.at(i) < A.at(i+1)) {
      kabu = money / A.at(i);
      money -= kabu * A.at(i);
      money += kabu * A.at(i+1);
    }
  }
  cout << money;

  return 0;
}


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

int main(){
    
    int n, m, k;

    cin >> n >> m >> k;

    int row[300001], col[300001], r, c;

    map<pair<int, int>, int> chk;

    for (int i = 0; i < 300001; i++)
    {
        row[i] = 0;
        col[i] = 0;
    }

    for (int i = 0; i < k; i++)
    {
        cin >> r >> c;

        row[r-1]++;
        col[c-1]++;

        chk[{r-1, c-1}] = 1;
    }

    // for (int i = 0; i < n; i++)
    // {
    //     cout << row[i] << " ";
    // }

    // cout << endl;
    
    // for (int i = 0; i < m; i++)
    // {
    //     cout << col[i] << " ";
    // }

    // cout << endl;

    int rowMax = 0, colMax = 0, rind = 0, cind = 0;

    for (int i = 0; i < max(n, m); i++)
    {
        // cout << "rind = " << rind << " cind = " << cind << endl;
        // cout << "chk = " << chk[{rind, cind}] << endl;

        if (row[i] >= rowMax){
            if (row[i] == rowMax){
                if (chk[{i, cind}] != 1){
                    rind = i;
                    rowMax = row[i];
                }
            }

            else
            {
                rind = i;
                rowMax = row[i];
            }
        }

        if (col[i] >= colMax){

            if (col[i] == colMax){
                if (chk[{rind, i}] != 1){
                    cind = i;
                    colMax = col[i];
                }
            }

            else
            {
                cind = i;
                colMax = col[i];
            }
        }
    }

    // cout << "rind = " << rind << " cind = " << cind << endl;

    if (chk[{rind, cind}] == 1){
        // cout << "HI" << endl;
        cout << rowMax + colMax - 1 << endl;
    }

    else
    {
        // cout << "BYE" << endl;
        cout << rowMax + colMax << endl;
    }    

    return 0;
}

Measured memory_bytes: 62064
#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> A(N);
  rep(i,N) cin >> A[i];

  int ans=0;
  for (int i=0; i<N; i++) {
    while(i+1 < N && A[i] == A[i+1]) i++;

    if (i+1 < N && A[i] < A[i+1]) {
      while(i+1 < N && A[i] <= A[i+1]) i++;
    }
    else if (i+1 < N && A[i] > A[i+1]) {
      while(i+1 < N && A[i] >= A[i+1]) i++;
    }
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3640
count = int(input())
list = list(map(int,input().split()))
reverse_list = []
num = -1
while -num <= len(list):
    reverse_list.append(list[num])
    num -= 1
for i in range(len(reverse_list)-1):
    print(str(reverse_list[i])+" ",end="")
print(reverse_list[-1])



Measured memory_bytes: 5604
//g++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){
  int N;
  cin >> N;
  vector<double> p(N);
  rep(i,N)cin >> p[i];
  vector<vector<double>> dp(N+1,vector<double>(N+1,0.0));
  dp[0][0] = 1.0;
  for(int i = 1;i <= N;i++)dp[i][0] = dp[i-1][0] * p[i-1];
  for(int i = 1;i <= N;i++)dp[0][i] = dp[0][i-1] * (1.0-p[i-1]);
  for(int i = 1;i <= N;i++){
    for(int j = 0;j <= i;j++){
      if(j==0)continue;
      else if(i-j==0)continue;
      else dp[j][i-j] = dp[j-1][i-j]*p[i-1] + dp[j][i-j-1]*(1.0-p[i-1]);
    }
  }
  double ans = 0.0;
  rep(i,N+1)rep(j,N+1){
    if(i==0&&j==0)continue;
    if(i+j==N&&i>=j)ans += dp[i][j];
  }

  cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 70784
n, w = gets.chomp.split(' ').map(&:to_i)

$box = []

n.times do
  $box << gets.chomp.split(' ').map(&:to_i)
end

table = Array.new(n).map { Array.new(w + 1, 0) }

def max(a, b)
  a < b ? b : a
end

n.times do |i|
  (w + 1).times do |j|
    if j == 0
      table[i][j] = 0
      next
    end
    table[i][j] = if j < $box[i][1]
                    table[i - 1][j]
                  else
                    max(table[i - 1][j - $box[i][1]] + $box[i][0], table[i - 1][j])
                  end
  end
end

puts table[n - 1][w]



Measured memory_bytes: 14672
from sys import stdin
from collections import deque
X = (stdin.readline().rstrip())
stack = []
for i in X:
    if i == "S":
        stack.append(i)
    elif (i == "T" and stack == []):
        stack.append(i)
    elif (i == "T" and stack[-1] == "S"):
        stack.pop()
    else:
        stack.append(i)
print(len(stack))

Measured memory_bytes: 5348
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define ll long long
int main()
{
    ll t,n,i,j,k,l,m,a;
    double b,c,d;
    cin>>n>>t>>a;
    d=INT_MAX;
    for(i=0; i<n; i++)
    {
        cin>>k;
        b=k*0.006;
        c=t-b;
        if(abs(a-c)<d)
        {
            d=abs(a-c);
            j=i;
        }
    }
    cout<<j+1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repb(i, n) for(ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define reprb(i, a, b) for(ll i = (b)-1; i >= (a); i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
const ld EPS = 1e-12L;
const ld PI = 3.1415926535897932385L;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(ull x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class S, class T>inline bool chmax(S &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class S, class T>inline bool chmin(S &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n, y;
    cin >> n >> y;
    rep(i, n+1)rep(j, n+1){
        ll k = n-i-j;
        if(k >= 0 && k <= n && 10000*i+5000*j+1000*k == y){
            cout << i << " " << j << " " << k << endl;
            return 0;
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<int,int>Mp,mp;
ll  A[111115];
int main(){
    ll  n,ans=0,x=1,y=1;
    int f1=0,f2=0;cin>>n;
    for(int i=1;i<=n;i++){
        cin>>A[i];
        Mp[A[i]]++;}
    sort(A+1,A+1+n);
    for(int i=n;i>=1;i--){
        if(Mp[A[i]]>=2&&mp[A[i]]==0){
            mp[A[i]]=1;
            x*=A[i];
            ans++;
        }
        if(ans==2){
            f1=1;
            break;
        }
    }
    for(int i=n;i>=1;i--){
        if(Mp[A[i]]>=4){
            y*=(A[i]*A[i]);
            f2=1;
            break;
        }
    }
    if(f1||f2)cout<<max(x,y)<<endl;
	else cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);
const ll MD = 1000000007LL;
// fprintf(stderr, "%d %lld \n", x, xll);


ll N;
int main() {
	cin >> N;
	for(ll a = 1; a <= 3500; a++)
		for(ll b = 1; b <= 3500; b++)
		{
			ll n = N * a * b;
			ll d = 4 * a * b - N * b - N * a;
			if(d != 0 && n % d == 0 && n / d > 0){
				ll c = n / d;
				fprintf(stdout, "%lld %lld %lld\n", a, b, c);
				return 0;
			}
		}
}

Measured memory_bytes: 256
#![allow(dead_code, unused_variables, unused_macros, unused_imports)]

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes .by_ref() .map(|r|r.unwrap() as char) .skip_while(|c|c.is_whitespace()) .take_while(|c|!c.is_whitespace()) .collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

fn main() {
    input! {
        mut foods: [i32; 5],
    }

    foods.sort_by(|a, b| match (a % 10, b % 10) {
        (0, 0) => std::cmp::Ordering::Equal,
        (0, _) => std::cmp::Ordering::Greater,
        (_, 0) => std::cmp::Ordering::Less,
        (a, b) => a.cmp(&b),
    });
    let mut ans = foods[0];
    for &x in foods.iter().skip(1) {
        ans += if x % 10 == 0 { x } else { x / 10 * 10 + 10 };
    }
    println!("{}", ans);
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    ll m, n; cin >> n >> m;
    
    cout << mod_pow(n, m, mod) << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}



Measured memory_bytes: 7312
A, B, C, K = map(int, input().split())
sum_num = 0
if (K - A) > 0:
    K -= A
    sum_num += A
    if (K - B) > 0:
        K -= B
        sum_num -= K
    else:
        pass
else:
    sum_num = K

print(sum_num)


Measured memory_bytes: 9140
let n, m = Scanf.scanf " %d %d" @@ fun a b -> a, b
let ab_s = Array.init m @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a - 1, b - 1
let cs = Array.make n 0
let _ = Array.(iter (fun (a, b) -> cs.(a) <- cs.(a) + 1; cs.(b) <- cs.(b) + 1) ab_s; iter (Printf.printf "%d\n") cs)

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

int main()
{
	int i, n[26] = {0}, j;
	char c[1300] = {};
	
	for(j = 0 ; scanf("%c", &c[j]) != EOF; j++)
	{
		//scanf("%c", &c[j]);
	}
	for(i = 0 ; i < 1300 ; i++)
	{
		switch(c[i])
		{
//			case 1:
//				n[0]++;
//				break;
			case 'a': n[0]++;
			 break;
			case 'b': n[1]++; break;
			case 'c': n[2]++; break;
			case 'd': n[3]++; break;
			case 'e': n[4]++; break;
			case 'f': n[5]++; break;
			case 'g': n[6]++; break;
			case 'h': n[7]++; break;
			case 'i': n[8]++; break;
			case 'j': n[9]++; break;
			case 'k': n[10]++; break;
			case 'l': n[11]++; break;
			case 'm': n[12]++; break;
			case 'n': n[13]++; break;
			case 'o': n[14]++; break;
			case 'p': n[15]++; break;
			case 'q': n[16]++; break;
			case 'r': n[17]++; break;
			case 's': n[18]++; break;
			case 't': n[19]++; break;
			case 'u': n[20]++; break;
			case 'v': n[21]++; break;
			case 'w': n[22]++; break;
			case 'x': n[23]++; break;
			case 'y': n[24]++; break;
			case 'z': n[25]++; break;
			case 'A': n[0]++; break;
			case 'B': n[1]++; break;
			case 'C': n[2]++; break;
			case 'D': n[3]++; break;
			case 'E': n[4]++; break;
			case 'F': n[5]++; break;
			case 'G': n[6]++; break;
			case 'H': n[7]++; break;
			case 'I': n[8]++; break;
			case 'J': n[9]++; break;
			case 'K': n[10]++; break;
			case 'L': n[11]++; break;
			case 'M': n[12]++; break;
			case 'N': n[13]++; break;
			case 'O': n[14]++; break;
			case 'P': n[15]++; break;
			case 'Q': n[16]++; break;
			case 'R': n[17]++; break;
			case 'S': n[18]++; break;
			case 'T': n[19]++; break;
			case 'U': n[20]++; break;
			case 'V': n[21]++; break;
			case 'W': n[22]++; break;
			case 'X': n[23]++; break;
			case 'Y': n[24]++; break;
			case 'Z': n[25]++; break;
		}
	}
	
	for(i = 0, j = 97 ; i < 26 ; i++, j++)
	{
		printf("%c : %d\n", j, n[i]);
	}
	return 0;
 } 


Measured memory_bytes: 2032
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
void solve(){
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll sum=0;
    sum+=1*min(a,k);
    k-=sum;
    if(k==0)
    cout<<sum;
    else
    {
        sum+=0*min(b,k);
        k-=min(b,k);
        if(k==0)
        cout<<sum;
        else{
            sum+=-1*min(c,k);
            k-=min(c,k);
            cout<<sum;
        }
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3640
class Main{
    public static void main(String[] a){
        for(int count = 1; count <= 9;count++){
            for(int count2 = 1;count2 <= 9;count2++){
                int result = count * count2;
                System.out.println(count + "x" + count2 + "=" + result);
            }
        }
    }
}

Measured memory_bytes: 24176
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }


main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin >> x;
    for (; ; x++) {
        bool ok = true;
        for (int j = 2; j * j <= x; j++) {
            if (x % j == 0) {
                ok = false;
                break;
            }
        }
        if (ok) {
            cout << x << '\n';
            rr;
        }
    }
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int n=s.size();
  char c=s.at(n/2);
  int i=0;
  while(n/2+i<n){
    if(s.at((n-1)/2-i)!=c||s.at(n/2+i)!=c)
      break;
    i++;
  }
  cout<<n/2+i<<endl;
}

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

string s,t;
long long ans,a,now,ls,lt;

int main(){
    cin>>s>>t;
    ls=s.size();
    lt=t.size();
    vector<vector<long long>> abc(26);
    for(long long i=0;i<ls;i++){
        a=s[i]-97;
        abc[a].push_back(i);
    }
    now=-1;
    for(long long i=0;i<lt;i++){
        a=t[i]-97;
        if(abc[a].size()==0){
            cout<<-1<<endl;
            return 0;
        }
        if(now>=*(abc[a].end()-1)){
            ans++;
            now=abc[a][0];
        }
        else{
            now=*upper_bound(abc[a].begin(),abc[a].end(),now);
        }
    }
    cout<<ls*ans+now+1<<endl;
}

Measured memory_bytes: 1724
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main(){
	int n;

	cin >> n;

	double* x1 = new double[ n ];
	double* y1 = new double[ n ];
	double* x2 = new double[ n ];
	double* y2 = new double[ n ];
	double* x3 = new double[ n ];
	double* y3 = new double[ n ];

	for ( int i = 0; i < n; ++i ){
		cin >> x1[ i ] >> y1[ i ]
			>> x2[ i ] >> y2[ i ]
			>> x3[ i ] >> y3[ i ];
	}

	for ( int i = 0; i < n; ++i ){
		double x12, y12, b12, x23, y23, b23, ox, oy, r;
		x12 = x2[ i ] - x1[ i ];
		y12 = y2[ i ] - y1[ i ];
		b12 = x12 * ( x1[ i ] + x2[ i ] ) / 2.0 + y12 * ( y1[ i ] + y2[ i ] ) / 2.0;
		x23 = x3[ i ] - x2[ i ];
		y23 = y3[ i ] - y2[ i ];
		b23 = x23 * ( x2[ i ] + x3[ i ] ) / 2.0 + y23 * ( y2[ i ] + y3[ i ] ) / 2.0;
		oy = ( x12 * b23 - x23 * b12 ) / ( x12 * y23 - x23 * y12 );
		if ( x12 ){
			ox = ( b12 - y12 * oy ) / x12;
		}else{
			ox = ( b23 - y23 * oy ) / x23;
		}
		r = sqrt( pow( ox - x1[ i ], 2.0 ) + pow( oy - y1[ i ], 2.0 ) );

		cout << showpoint << setprecision( 3 ) << setiosflags( ios::fixed )
			 << ( ox == -0.0 ? 0.0 : ox ) << " "
			 << ( oy == -0.0 ? 0.0 : oy ) << " "
			 << r << endl;
	}

	delete[] x1, y1, x2, y2, x3, y3;
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>



int main()
{
   long a[3];
   long i,j,k;
   long f;
   long n;
   long q;
   long cnt = 0;
   long h;
   long left,right,mid;
   long ans = 0;
   char c;
   scanf("%ld %ld %ld",&a[0],&a[1],&a[2]);
   
    for (i = 0; i < 2; i++) {
        for (j = 2; j > i; j--) {
           if(a[j-1] > a[j]) {
              long tmp = a[j];
              a[j] = a[j-1];
              a[j-1] = tmp;
           }
        }
    }
    printf("%ld %ld %ld\n",a[0],a[1],a[2]);


   return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int a[111];

int main()
{
    int n, p, no = 0, ne = 0;
    cin>>n>>p;

    REP(i,n) {
        cin>>a[i];
        if (a[i] % 2) {
            no++;
        } else {
            ne++;
        }
    }

    if (ne == n) {
        if (p)
            cout<<0<<endl;
        else
            cout<<(1ull<<n)<<endl;
    } else {
        cout<<(1ull<<(n-1))<<endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,b) for(int i=b-1;i>=a;i--)
#define mod 1000000007
#define pb push_back
#define son ll t; cin>>t;while(t--)
#define fst ios_base::sync_with_stdio(false); cin.tie(NULL);
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define mpr make_pair
#define ff first
#define ss second
#define inf 5e18
#define dex(x,y) fixed<<setprecision(x)<<y
void start()
{
        #ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #endif
}

int32_t main()
{
    fst
    int n,k;
    cin>>n;
    int a[n][3];
    fr(i,0,n)
    cin>>a[i][0]>>a[i][1]>>a[i][2];
    int dp[n+1][3],mx=0;

   dp[0][0]=0;
   dp[0][1]=0;
   dp[0][2]=0;
    fr(i,1,n+1)
    {
      dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i-1][0];
      dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i-1][1];
      dp[i][2]=max(dp[i-1][1],dp[i-1][0])+a[i-1][2];
      mx=max({dp[i][0],dp[i][1],dp[i][2]});
     //   cout<<dp[i]<<' ';
    }
    cout<<mx<<endl;

}

Measured memory_bytes: 8236
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

const long long MOD = 1000000007;

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

long long COM(long long n, long long k) {
    long long ue = 1;
    long long shita = 1;
    rep(i, k) {
        ue *= (n - i);
        shita *= (i + 1);
        ue = ue % MOD;
        shita = shita % MOD;
    }
    return ue % MOD * modinv(shita, MOD) % MOD;
}

int main() {
    long long n, a, b;
    cin >> n >> a >> b;
    debug((modpow(2, n, MOD) - 1));
    debug(COM(n, a), COM(n, b));

    long long res = (modpow(2, n, MOD) - 1 - COM(n, a) - COM(n, b));
    if (res < 0) {
        cout << (res + 10 * MOD) % MOD << endl;
    } else if (res == 0) {
        cout << res << endl;
    } else {
        cout << res % MOD << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
const int SIZE = 1<<20;
struct RMQ{
	ll seg[SIZE*2];
	void init(){
		for(int i=0;i<SIZE*2;i++)seg[i]=0;
	}
	void update(int k,ll x){
		k += SIZE-1;
		seg[k]=x;
		while(k){
			k = (k-1)/2;
			seg[k]=max(seg[k*2+1],seg[k*2+2]);
		}
	}
	ll query(int a,int b,int k,int l,int r){
		if(r<=a||b<=l)return -LLINF;
		else if(a<=l&&r<=b)return seg[k];
		else return max(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));
	}
	ll query(int a,int b){
		if(a>=b)return 0ll;
		return query(a,b,0,0,SIZE);
	}
}seg;
int N;
int h[200100];
ll a[200100];
ll dp[200100];
int main(){
	cin >> N;
	for(int i=0;i<N;i++)cin >> h[i];
	for(int i=0;i<N;i++)cin >> a[i];
	seg.init();
	dp[0]=0ll;
	ll ans = 0ll;
	for(int i=0;i<N;i++){
		dp[i+1]=seg.query(0,h[i])+a[i];
		seg.update(h[i],dp[i+1]);
		ans = max(ans,dp[i+1]);
		//cout << dp[i+1] << endl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 20480
#include <bits/stdc++.h>
//↓✟MLE魔、TLE魔✟
#define int long long
//↑✟MLE魔、TLE魔✟
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
int gcd(int a,int b){
    if(a%b==0)return b;
    else return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
signed main(){
    int cnt=0,n;
    string s,t;
    cin>>n>>s>>t;
    rep(i,n){
        rep(j,n-i){
            if(s[i+j]!=t[j])break;
            if(j+1==n-i)cnt=max(cnt,n-i);
        }
    }
    cout<<n*2-cnt<<endl;
}

Measured memory_bytes: 256
import numpy as np
import math
import fractions


class KyoPro:
    AtCoder_Mod = 1000 * 1000 * 1000 + 7

    def ReadListOfNumbers():
        return list(map(int, input().split()))

    @staticmethod
    def MakeStringFromNumbers(a):
        if len(a) == 0:
            return
        s = str(a[0])

        for i in range(1, len(a)):
            s += ' ' + str(a[i])

        return s

    # 二分探索、配列、目的の値、比較の関数（必要なければNone）
    @staticmethod
    def BinarySearch(ls, target, func):
        if(func is None):
            def func(a, b): return a < b

        def eq(a, b): return (not func(a, b)) and (not func(b, a))

        left = 0
        right = len(ls) - 1

        while(True):
            if(right - left < 10):
                for i in range(left, right + 1):
                    if(eq(ls[i], target)):
                        return True
                return False

            center = (left + right) // 2
            if(eq(ls[center], target)):
                return True
            if(func(ls[center], target)):
                left = center
            if(func(target, ls[center])):
                right = center


class cin:
    InputList = []

    def __init__(self):
        pass

    def Read(self):
        cin.InputList += input().split()

    def ReadInt(self):
        if(len(cin.InputList) == 0):
            self.Read


def main():
    temp = KyoPro.ReadListOfNumbers()
    x = temp[0]
    y = temp[1]
    z = temp[2]

    y += z
    x -= z

    print(x // y)


main()


Measured memory_bytes: 13568
#include <iostream>
#include <algorithm>

using namespace std;

int main(void)
{
    int N, a[101], i;

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> a[i];
    }

    sort(a+1, a+N+1);

    cout << a[N]-a[1] << endl;

    return 0;
}

Measured memory_bytes: 256
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// -----------------------------------------------------------------------------
// main
// -----------------------------------------------------------------------------
fn main(){
    input!{
        a: i32,
        b: i32
    }
    println!("{}", (a-1)*(b-1));
}


Measured memory_bytes: 4352
package main

import "fmt"

func max(a []int) int {
	max := a[0]
	for _, i := range a {
		if i > max {
			max = i
		}
	}
	return max
}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	s := []int{a, b, c}
	fmt.Println(a + b + c - max(s))
}

Measured memory_bytes: 512
#include <stdio.h>
#include <numeric>
#include <time.h>
#include <bitset>
#include <string.h>
#include <stack>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <complex>
#include <functional>
#include <limits.h>
using namespace std ;
typedef long long ll ;
typedef long double ld ;
typedef unsigned long long ull ;
#ifdef _WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define pi (acos(-1.0))
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define lson (o<<1),l,mid
#define rson (o<<1|1),mid+1,r
#define MP make_pair
#define sqr(x) ((x)*(x))
#define ALL(v) (v).begin(),(v).end()
#define showtime fprintf(stderr,"time = %.15f\n",clock() / (double)CLOCKS_PER_SEC)
const double eps = 1e-9 ;
const int MOD=(int)1e9+7,BAS=233;
inline int sign(double x){return x<-eps?-1:x>eps;}
inline int clz(int x){return __builtin_clz(x);}
inline int clz(ll x){return __builtin_clzll(x);}
inline int lg2(int x){return !x ? -1 : 31-clz(x);}
inline int lg2(ll x){return !x ? -1 : 63-clz(x);}
int AP (char *s) {
	unsigned hash=0;
	for(int i=0; s[i]; i++){
		if (i & 1) hash ^= (~((hash<<11)^s[i]^(hash>>5)));
		else hash ^= ((hash<<7)^s[i]^(hash>>3));
   } return hash & 0x7FFFFFFF;
}

const int M = 100000+10;
int n;

int main () {
	scanf ("%d", &n);
	int cnt=0;
	for (int i=0,x; i<n; i++) {
		scanf ("%d", &x);
		if (x&1) cnt++;
	}
	if (cnt&1) puts ("NO");
	else puts ("YES");
	return 0;
}

Measured memory_bytes: 256
// ABC059 B - Comparison
#include <stdio.h>
#include <string.h>

int main(void)
{
    char A[102];
    char B[102];
    scanf("%s", A);
    scanf("%s", B);
    int alen, blen;
    alen = strlen(A);
    blen = strlen(B);

    // 桁数が異なる場合
    if (alen > blen) {
        printf("GREATER\n");
        return 0;
    } else if (alen < blen) {
        printf("LESS\n");
        return 0;
    }
    // 桁数が同じ場合は上位の桁から比較
    int i = 0;
    while (i <= alen) {
        if (A[i] > B[i]) {
            printf("GREATER\n");
            return 0;
        } else if (A[i] < B[i]) {
            printf("LESS\n");
            return 0;
        }
        i++;
    }
    printf("EQUAL\n");
    return 0;
}

Measured memory_bytes: 128
N, W = map(int, input().split())
dp = [0]*(W+1)
max_w = 0
for i in range(N):
    v, w, m = map(int, input().split())
    n = 1
    while m > 0:
        m -= n
        _v, _w = v*n, w*n
        max_w = W if max_w+_w > W else max_w+_w
        for k in range(max_w, _w-1, -1):
            if dp[k] < dp[k-_w] + _v:
                dp[k] = dp[k-_w] + _v
        n = m if n << 1 > m else n << 1

print(max(dp))

Measured memory_bytes: 7980
#include <algorithm>
#include <fstream>
#include <iostream>
using namespace std;

class DisjointSets {
    private:
        vector<int> f, h;
    public:
        DisjointSets(int n = 0) {
            f.assign(n + 1, 0);
            h.assign(n + 1, 1);
            for (int i = 1; i <= n; ++ i) {
                f[i] = i;
            }
        }
        int father(int x) {
            return x == f[x] ? x : (f[x] = father(f[x]));
        }
        void unite(int x, int y) {
            x = father(x);
            y = father(y);
            if (x == y) {
                return;
            }
            if (h[x] == h[y]) {
                h[x] += 1;
                f[y] = x;
            } else if (h[x] > h[y]) {
                f[y] = x;
            } else {
                f[x] = y;
            }
        }
};
vector< vector<int> > v, v2;
vector<int> answers;

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    DisjointSets s1(n), s2(n);
    for (int i = 1; i <= m; ++ i) {
        int x, y;
        cin >> x >> y;
        s1.unite(x, y);
    }
    for (int i = 1; i <= k; ++ i) {
        int x, y;
        cin >> x >> y;
        s2.unite(x, y);
    }
    v.assign(n + 1, vector<int>());
    v2.assign(n + 1, vector<int>());
    answers.assign(n + 1, 0);
    for (int i = 1; i <= n; ++ i) {
        v[s1.father(i)].push_back(i);
    }
    for (int i = 1; i <= n; ++ i) {
        if (!v[i].empty()) {
            for (auto x : v[i]) {
                v2[s2.father(x)].push_back(x);
            }
            for (auto x: v[i]) {
                answers[x] = v2[s2.father(x)].size();
            }
            // cout << i << endl;
            // return 0;
            for (auto x : v[i]) {
                if (v2[s2.father(x)].size()) {
                    v2[s2.father(x)].clear();
                }
            }
        }
    }
    
    for (int i = 1; i <= n; ++ i) {
        cout << answers[i] << (i == n ? "\n" : " ");
    }
    return 0;
}

Measured memory_bytes: 24832
#include <bits/stdc++.h>
using namespace std;
char s1[5];
int vis[5];
int main()
{
	scanf("%s",s1);
	for(int i=0;i<3;i++)
	{
		if(s1[i]=='A')
		{
			vis[1]++;
		}
		if(s1[i]=='B')
		{
			vis[2]++;
		}
	}
	if(vis[1] && vis[2])
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

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

total_length = sum(A)
left_length = 0
for i in range(N):
    left_length += A[i]
    if left_length == total_length / 2:
        print(0)
        break
    elif left_length > total_length / 2:
        right_length = total_length - left_length
        left_length -= A[i]
        if left_length < right_length:
            print(left_length + A[i] - right_length)
        else:
            print(right_length + A[i] - left_length)
        break

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

int main(){
	int n,x;
	cin >> n >> x;
	vector<int> d(n+1);

	d.at(0) = 0;
	rep(i, n){
		int t;
		cin >> t;
		d.at(i+1) = d.at(i) + t;
	}

	int ans = 0;
	rep(i, n+1){
		if(d.at(i) <= x)
			ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < n; i++)

// できること
// Sの２種類の文字を入れ替える
// Sの１種類の文字を使われていない文字で交換する

// 組み合わせを作れて並べられたら完成
// 各種類の文字数確認

// 位置と数が合っているかチェックすればok?

// string solve(string s, char c1, char c2) {
//   rep(i, s.size()) {
//     if (s[i] == c1) {
//       s[i] = c2;
//     } else if (s[i] == c2) {
//       s[i] = c1;
//     }
//   }
//   cout << s << endl;
//   return s;
// }

int main() {
  // string s;
  // cin >> s;
  // while (true) {
  //   char c1, c2;
  //   cin >> c1 >> c2;
  //   s = solve(s, c1, c2);
  // }

  string S, T;
  cin >> S >> T;
  // 各文字がどのindexにあるか
  map<char, vector<int>> s_map, t_map;
  for (int i = 0; i < S.size(); i++) {
    s_map[S[i]].push_back(i);
  }
  for (int i = 0; i < T.size(); i++) {
    t_map[T[i]].push_back(i);
  }

  set<int> skip_index;
  bool is_ok = true;
  for (int i = 0; i < S.size(); i++) {
    if (!skip_index.count(i)) {
      if (!equal(s_map[S[i]].cbegin(), s_map[S[i]].cend(),
                 t_map[T[i]].cbegin())) {
        is_ok = false;
        break;
      } else {
        for (int index : s_map[S[i]]) skip_index.insert(index);
      }
    }
  }

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

  return 0;
}


Measured memory_bytes: 11912
#include <bits/stdc++.h>
	
using namespace std;
	
#define endl "\n"
#define ll long long
#define vi vector <int >
#define vii vectir < pii >
#define vll vector <ll >
#define pii pair <int, int>
#define pdd pair< double, double>
#define piii pair < pii, int > 
#define pll pair<ll, ll >
#define umap unordered_map
#define pb push_back
#define pq priority_queue
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define rep(i,b,c) for(int i = (int)b; i < (int)c; i++)
#define a first
#define b second

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

	char c;

	cin >> c;
	cout << char(c + 1) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#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;
int main()
{
  string s,t;
  cin >> s >> t;
  int a,b;
  cin >> a >> b;
  string u;
  cin >> u;
  if(s==u) a--;
  else if(t==u) b--;
  cout << a << " " << b << "\n";
  return 0;
}


Measured memory_bytes: 256
n = int(input())
t,a = map(int, input().split())
h = list(map(int,input().split()))
ans = -1
mn = 10**9
for i in range(n):
    x = abs(t - h[i]*0.006 - a)
    if x < mn:
        mn = x
        ans = i+1
print(ans)  

Measured memory_bytes: 3060