akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int a,b,c;
    cin>>a>>b>>c;
    cout<<max(0,c-(a-b))<<endl;

    return 0;
}


Measured memory_bytes: 256
H,W=map(int,input().split())
S=["."*(W+2)]
for i in range(H):
  S.append("."+input()+".")
S.append("."*(W+2))
print("Yes" if all(S[i][j]=="." or (S[i+1][j]=="#" or S[i-1][j]=="#" or S[i][j+1]=="#" or S[i][j-1]=="#") for i in range(1,H+1) for j in range(1,W)) else "No")

Measured memory_bytes: 3064
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{
  string s;
  cin >> s;

  ll ans = LLONG_MAX;
  for(char c : s)
  {
    ll tmp = 0;
    ll res = 0;
    for(ll i = 0; i < sz(s); ++i)
    {
      if(c != s[i])
      {
        tmp++;
      }
      else
      {
        res = max(res,tmp);
        tmp = 0;
      }
    }
    res = max(res,tmp);
    
    ans = min(ans,res);
  }

  cout << ans << endl;

}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
int main()
{
    IOS
 	// freopen("input.txt","r",stdin);
 	// freopen("output.txt","w",stdout);
 	// freopen("error.txt","w",stderr);
 	char c;
 	cin>>c;
 	c++;
 	cout<<c<<endl;
    return 0;
}

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

main() {
    int A,B; cin >> A >> B;
    if(A==B) cout << A*2 << endl;
    else if(A>B) cout << A+A-1 << endl;
    else cout << B+B-1 << endl;

    return 0;
}

Measured memory_bytes: 256
#-swank
(unless (member :child-sbcl *features*)
  (quit
	:unix-status
	(process-exit-code
	  (run-program *runtime-pathname*
				   `("--control-stack-size" "128MB"
					 "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
					 "--eval" "(push :child-sbcl *features*)"
					 "--script" ,(namestring *load-pathname*))
				   :output t :error t :input t))))

(let ((a (read)) (b (read)))
  (princ (if (> a b)
		   "GREATER"
		   (if (< a b)
			 "LESS"
			 "EQUAL"))))


Measured memory_bytes: 7476
/*
 * Kakezan
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2424
 */

#include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;

int main() {
  int n;
  cin >> n;
  REP(_, n){
    string m;
    cin >> m;
    int cnt = 0;
    while(m.length() > 1) {
      cnt ++;
      int ma = 0;
      FOR(i, 1, m.length()){
        int a = stoi(m.substr(0, i));
        int b = stoi(m.substr(i, m.length() - i));
        // LOG("%d %d, %d\n", a, b, a * b);
        ma = max(ma, a * b);
      }
      m = to_string(ma);
      // LOG("%d \n", ma);
    }
    cout << cnt << endl;
  }
}

Measured memory_bytes: 3256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <math.h>
#include <time.h>

typedef int32_t i32;
typedef int64_t i64;
typedef double f64;

void *const null=(void *)0;
i64 const llinf=4611686018427387903LL;
i64 const mod=1000000009LL;
f64 const pi=3.141592653589793;
f64 const rad=57.295779513082323;

#define CODE_

i32 main(void){
    i64 i=0LL,x;
    while(1){
        scanf("%lli",&x);
        if(x==0LL) break;
        ++i;
        printf("Case %lli: %lli\n",i,x);
    }
    return 0;
}



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

int main(){
	cin >> n;
  	bool check = false;
  	for (int i = 0; i <= 30; i++)
      for (int j = 0; j <= 20; j++)
        if (4*i + 7*j == n){
          check = true;
          break;
        }
  	if (check) cout << "Yes";
 	else cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int A,B;
  char op;
  cin >> A >> op >> B;

  if (op == '+') cout << A + B << endl;
  else cout << A - B << endl;
}


Measured memory_bytes: 3624
#include<stdio.h>
int main(){
  int a,a2,b,b2,c,c2,d,d2;
  int s,t;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  scanf("%d %d %d %d",&a2,&b2,&c2,&d2);
  s=a+b+c+d;
  t=a2+b2+c2+d2;
  if(t>=s)
    printf("%d\n",t);
  else
    printf("%d\n",s);
  return 0;
}

Measured memory_bytes: 1020
import java.io.*;
import java.util.*;
import java.lang.*;
import java.awt.*;
import java.awt.geom.*;
import java.math.*;
import java.text.*;
import java.math.BigInteger.*;
import java.util.Arrays; 

public class   Main
{
  BufferedReader in;
  StringTokenizer as;
  int nums[],nums2[];
  int[] nums1[];
  boolean con = true;
  
  ArrayList < Integer >  ar = new ArrayList < Integer >();
  ArrayList < Integer >  fi = new ArrayList < Integer >();
  Map<Integer,Integer > map = new HashMap<Integer, Integer>();
  public static void main (String[] args)
  {
    new Main  ();
  }
  
  public int GCD(int a, int b) {
    if (b==0) return a;
    return GCD(b,a%b);
  }
  
  public int LIS(int arr[])
  {
    int n = arr.length;
    int sun[] = new int [n];
    int cur = 0;
    for(int x = 0;x<n;x++)
    {
      int temp = Arrays.binarySearch(sun,0,cur,arr[x]);
      if(temp < 0)
        temp = -temp -1;
      sun[temp] = arr[x];
      if(temp == cur)
        cur++;
    }
    return cur;
    
  }
  
  
  
  
  public Main  ()
  {
    try
    {
      
      in = new BufferedReader (new InputStreamReader (System.in));
      int a = nextInt()-1;
      nums = new int [a];
      int sum = 0;
      for(int x = 0;x<a;x++)
      {
        
        nums[x] = nextInt();
      }
      sum += nums[0] + nums[a-1];
      for(int x = 1;x<a;x++)
      {
        sum += Math.min(nums[x],nums[x-1]);
      }
      System.out.println(sum);
                        
    }
    catch(IOException e)
    {
      
    }
  }
  
  
  
  
  
  
  
  String next () throws IOException
  {
    while (as == null || !as.hasMoreTokens ())
    {
      as = new StringTokenizer (in.readLine ().trim ());
    }
    
    
    return as.nextToken ();
  }
  
  
  
  long nextLong () throws IOException
  {
    return Long.parseLong (next ());
  }
  
  
  int nextInt () throws IOException
  {
    return Integer.parseInt (next ());
  }
  
  
  double nextDouble () throws IOException
  {
    return Double.parseDouble (next ());
  }
  
  
  String nextLine () throws IOException
  {
    return in.readLine ().trim ();
  }
}

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

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


#define print(x) for(auto it : x) cout<< it << ' '; cout << '\n';
typedef long long ll;
typedef unsigned long long ull;

const int MOD = 1e9 + 7;
ll mod(ll a) { return (ll) (a % MOD + MOD) % MOD; }
ll mul(ll a, ll b) { return (ll) mod(mod(a) * mod(b));}

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int num; cin >> num;
        if ((i % 2)&& (num % 2)) {
            ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}


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

int main(){
    int n,m;cin>>n>>m;
    int ans=0;
    vector<vector<int>> swi(m);
    vector<int> p(m);
    for(int i=0;i<m;i++){
        int k;cin>>k;
        for(int j=0;j<k;j++){
            int s;cin>>s;
            swi[i].push_back(s);
        }
    }
    for(int i=0;i<m;i++) cin>>p[i];
    for(int bit=0;bit<(1<<n);bit++){
        vector<int> s_c(m);
        for(int j=0;j<n;j++){
            if(bit>>j&1){
                for(int i=0;i<m;i++){
                    for(int k=0;k<swi[i].size();k++){
                        if(swi[i][k]==j+1) s_c[i]++;
                    }
                }
            }
        }
        for(int l=0;l<m;l++){
            s_c[l]%=2;
            if(s_c[l]!=p[l]) break;
            if(l==m-1){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}

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

int main() {
	int ma,mb,mc,ans;
	cin >> ma >> mb >> mc;
	ans = mc-(ma-mb);
	if(ans<0){
		cout << "0\n";
	}else{
		cout << mc-(ma-mb) << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	static int TwoSwitches(int p, int q, int r, int s){
		if(q<=r)return 0;
		else if(p<=r && r<=q && q<=s)return q-r;
		else if(r<=p && q<=s)return q-p;
		else if(p<=r && s<=q)return s-r;
		else if(r<=p && p<=s && s<=q)return s-p;
		else return 0;
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		System.out.println(TwoSwitches(a, b, c, d));
	}
}

Measured memory_bytes: 23252
def f(A):
    dct = {}
    B = []
    i = 0
    for a in A:
        try:
            dct[a]
        except:
            dct[a] = i
            i += 1
        B.append(dct[a])
    return B


S = f(list(input()))
T = f(list(input()))
if S == T:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 8340
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N,P;
    cin >> N >> P;
    map<ll,ll> m;
    while(P != 1){
        bool didDiv = false;
        for (int i = 2; i < sqrt(P + 2); ++i) {
            if(P % i == 0){
                P /= i;
                m[i]++;
                didDiv = true;
                break;
            }
        }
        if(!didDiv){
            m[P]++;
            P/=P;
        }

    }
    auto begin = m.begin();auto end = m.end();
    ll res = 1;
    for (auto i = begin; i != end; ++i) {
        //cout << i->first << "," << i->second << endl;
        for (int j = 0; j < i->second/N; ++j) {
            res *= i->first;
        }
    }
    cout << res << endl;
}


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

const int N = (int) 2e6 + 10 ;
const int inf = (int) 2e9 ;

int main(){
//    freopen("in.txt" , "r" , stdin ) ;
    int n ; scanf("%d" , &n ) ;
    if( n < 1000 ) printf("ABC\n") ;
    else printf("ABD\n") ;
    return 0 ;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s; cin>>s;
	bool yes=true;
	if(s.front()!='A')yes=false;
	int cnt=0;
	for(int i=2;i<=s.size()-2;++i){
		if(s.at(i)=='C')++cnt;
	}
	if(cnt!=1)yes=false;
	cnt=0;
	for(int i=0;i<s.size();++i){
		if(s.at(i)>='a'&&s.at(i)<='z')++cnt;
	}
	if(cnt!=s.size()-2)yes=false;
	cout<<(yes?"AC"s:"WA"s)<<"\n"s;
}

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

ll a[214514],b[214514],c[214514];

int main(){
	ll n;
	cin>>n;
	ll cnt=0;
	while(n){
		cnt++;
		n/=2;
	}
	ll ans=1;
	for(int i=0;i<cnt;i++)ans*=2;
	ans--;
	cout<<ans;
	return 0;
}


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

#define lint long long
#define P pair<int, int>


int main() {
    int N, M;
    cin >> N >> M;
    
    bool used[N + 1];
    memset(used, false, sizeof used);
    
    vector<vector<P>> List(N);
    for(int i = 0; i < M; ++i){
        int l, r, d;
        cin >> l >> r >> d;
        List[l - 1].push_back(make_pair(r - 1, d));
        List[r - 1].push_back(make_pair(l - 1, -d));
    }
    
//    for(int i = 0; i < N; ++i){
//        for(auto e : List[i]){
//            cout << i << " " << e.first << " " << e.second << endl;
//        }
//    }
//    cout << endl;
    
    for(int i = 0; i < N; ++i){
        queue<P> que;
        map<int, int> res;
        if(!used[i]){
            used[i] = true;
            res[i] = 0;
            for(auto e : List[i]){
                que.push(e);
            }
            
            while(!que.empty()){
                P tmp = que.front(); que.pop();
//                cout << tmp.first << " " << tmp.second << " " << used[tmp.first]<< endl;
                if(used[tmp.first]){
                    if(res[tmp.first] != tmp.second){
                        cout << "No" << endl;
                        return 0;
                    }
                } else {
                    used[tmp.first] = true;
                    res[tmp.first] = tmp.second;
                    
                    for(auto e : List[tmp.first]){
                        que.push(make_pair(e.first, e.second + tmp.second));
                    }
                }
            }
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 15604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;

// sum[j][i] = 1^i+2^i+…+j^i
ll beki[404][404], sum[404][404];
ll dp[404][404];

int main(){
  rep(i,404) beki[i][0]=1;
  for(int i=1;i<404;i++){
    for(int j=1;j<404;j++){
      beki[i][j]=i*beki[i][j-1]%MOD;
    }
  }
  for(int i=0;i<404;i++){
    for(int j=1;j<404;j++){
      sum[j][i]=(sum[j-1][i]+beki[j][i])%MOD;
    }
  }
  int N,C; cin>>N>>C;
  ll A[N],B[N];
  rep(i,N) cin>>A[i];
  rep(i,N) cin>>B[i];
  dp[0][0]=1;
  rep(i,N) rep(j,C+1) if(dp[i][j]){
    for(int k=0;j+k<=C;k++){
      ll x=sum[B[i]][k]-sum[A[i]-1][k];
      if(x<0) x+=MOD;
      (dp[i+1][j+k]+=dp[i][j]*x)%=MOD;
    }
  }

 
  cout<<dp[N][C]<<endl;
  return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
    	string s; cin >> s;
    	int cnt[30] = {}, ans = 0;
    	for(size_t i=0; i<s.length(); i++) cnt[ s[i] - 'a' ]++;
    	for(int i=0; i<26; i++) if(cnt[i] % 2) ans++;
    	cout << ans / 2 << endl;
    	return 0;
    }

Measured memory_bytes: 3188
#template
def inputlist(): return [int(k) for k in input().split()]
#template
N,M,Q = inputlist()
l = [0]*Q
for i in range(Q):
    l[i] = inputlist()
li = [int(i) for i in range(1,M+1)]
from itertools import combinations_with_replacement
h = combinations_with_replacement(li,N)
ans = 0
for v in h:
    va = list(v)
    tmp = 0
    for i in range(Q):
        a,b,c,d = l[i]
        a-=1
        b-=1
        if va[b] - va[a] == c:
            tmp += d
    ans = max(tmp,ans)
print(ans)

Measured memory_bytes: 9224
AC = 0
WA = 0
N, M =map(int, input().split())
A = [0]*N
for i in range(M):
    p, S = input().split()
    q = int(p)-1
    if S == 'AC' and A[q] != -1:
        AC += 1
        WA += A[q]
        A[q] = -1
    elif S == 'WA' and A[q] != -1:
        A[q] += 1
print(AC, WA)

Measured memory_bytes: 50648
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}

signed _main(){
  /*
  string S,T; cin >> S >> T;
  rep(i,S.size()){
    if(S[i]==T[i]);
    else{
      No
      return 0;
    }
  }
  Yes
  */
  int A,B,C,K; cin >> A >> B >> C >> K;
  if(K<=A) cout << K << endl;
  else if(K<=A+B) cout << A << endl;
  else{
    cout << A-min(max(K-A-B,0LL),C) << endl;
  }
  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>
#include <queue>

using namespace std;



int main()
{
	int P, Q, R;

	cin >> P >> Q >> R;

	int max_l;
	int ans;
	
	max_l = max(P,Q);
	max_l = max(max_l, R);

	ans = P + Q + R - max_l;

	printf("%d",ans);

	return 0;
}



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

int main() {


	int n;
	int i;
	int k = 0;
	long long int j = 0;
	//int j = 0;
	long long int ans = 0;


	cin >> n;
	vector<int>a(n), b(n), c(n);
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	for (i = 0; i < n; i++) {
		cin >> b[i];
	}
	sort(b.begin(), b.end());
	for (i = 0; i < n; i++) {
		cin >> c[i];
	}
	sort(c.begin(), c.end());	   
	for (i = 0; i < n; i++) {
		while (a[j] < b[i] && j < n)j++;
		while (c[k] <= b[i] && k < n)k++;
		ans += j * (n - k);
	}
	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int n,ans=0;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int j=i,tmp=0;
		while(j) j/=10,tmp++;
		if(tmp&1) ans++;
	}
	printf("%d\n",ans);
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
  int res = 1;
  x = x % p;
  while (y > 0)
  {
    if (y & 1)
      res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res % p;
}
 
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc;
  tc = 1;
  //cin >> tc;
  while(tc--)
  {
    int n, m;
    cin >> n;
    int a[n];
    map<int, int> mp;
    for (int i = 1; i < n;i++)
    {
      cin >> a[i];
      mp[a[i]]++;
    }
    for (int i = 1; i <= n;i++){
      cout << mp[i] << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 17724
process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});
process.stdin.on('end', function() {
    main(g_input.split(/\r?\n/));
});

// 解答
function main(inputs){

    // ビンゴカード
    var bingoCard = [inputs[0].split(" "), inputs[1].split(" "), inputs[2].split(" ")];
    var hit = [[0,0,0],[0,0,0],[0,0,0]];
    // 選ばれた数
    var selectedNum = inputs[3];

    // 選ばれた数値の当たり判定
    for (var i = 0; i < selectedNum; i++) {

        if (bingoCard[0].indexOf(inputs[i + 4]) != -1) {

            hit[0][bingoCard[0].indexOf(inputs[i + 4])] = 1;
        } else if (bingoCard[1].indexOf(inputs[i + 4]) != -1) {

            hit[1][bingoCard[1].indexOf(inputs[i + 4])] = 1;
        } else if (bingoCard[2].indexOf(inputs[i + 4]) != -1) {

            hit[2][bingoCard[2].indexOf(inputs[i + 4])] = 1;
        }
    }

    // ビンゴ判定
    if (hit[0][0] + hit[0][1] + hit[0][2] === 3
       || hit[1][0] + hit[1][1] + hit[1][2] === 3
       || hit[2][0] + hit[2][1] + hit[2][2] === 3
       || hit[0][0] + hit[1][0] + hit[2][0] === 3
       || hit[0][1] + hit[1][1] + hit[2][1] === 3
       || hit[0][2] + hit[1][2] + hit[2][2] === 3
       || hit[0][0] + hit[1][1] + hit[2][2] === 3
       || hit[0][2] + hit[1][1] + hit[2][0] === 3) {

        console.log('Yes');
    } else {

        console.log('No');
    }
}

Measured memory_bytes: 7500
x,k,d=map(int,raw_input().split(' '))


if x<0:
	d*=-1

if k%2==1:
	x-=d

d*=2
k/=2


v1=x-k*d
n=x/d
v2=x-n*d if (n<=k) else v1
v3=x-(n+1)*d if(n+1<=k) else v1

print min(abs(v1),abs(v2),abs(v3))

Measured memory_bytes: 64344
n = int(input())
ls = list(map(int, input().split()))
p = 50
ans = 0
if p>n:p=n

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

def cul(n, x):
    l = len(x)
    b = [x[i] for i in range(l)]
    b.pop(n)
    tmp = b[0]
    for i in range(1, l-1):
        tmp = gcd(tmp, b[i])
    return tmp
    
for i in range(p):
    s = cul(i,ls[:p])
    if s > ans:
        ans = s
print(ans)


Measured memory_bytes: 14584
#include <iostream>
#include <string>

std::string S;

int main()
{
  std::cin >> S;
  
  int s = 0, t = S.size()-1;

  int ans = 0;
  while( s < t )
  {
    if( S[s] == S[t] )
      ++s, --t;
    else
    {
      if( S[s] == 'x' )
        ++s, ++ans;
      else if( S[t] == 'x' )
        --t, ++ans;
      else
      {
        puts("-1");

        return 0;
      }
    }
  }

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

  return 0;
}

Measured memory_bytes: 512
import sys
N= int(input())
if N==1:
    print(0)
    sys.exit()
if N>=2:
    a=10
    b=9
    c=8
    for i in range(N-1):
        a=a*10
        b=b*9
        c=c*8
        if a>(10**9+7):
            if b>(10**9+7):
                if c>(10**9+7):
                    a=a%(10**9+7)
                    b=b%(10**9+7)
                    c=c%(10**9+7)
s=(a-2*b+c)%(10**9+7)
print(s)

Measured memory_bytes: 9184
import java.util.*;
public class Main {
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int a = sc.nextInt();
                int b = sc.nextInt();
                int c = sc.nextInt();
                sc.close();
                int yono = -1;
                while(b >= 0){
                        b -= a;
                        yono++;
                }
                System.out.println(Math.min(c , yono));
        }
}

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

int main() {
	int n;
	cin >> n;
	vector<int> crr(n-1);
	for (auto &it: crr) {
		cin >> it;
	}
	int ans = crr[0];
	for (int i = 0; i < n - 2; i++) {
		ans += min(crr[i], crr[i + 1]);
	}
	ans += crr[n - 2];
	cout << ans << '\n';
	return 0;
}

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

using namespace std;

const int MaxN = 1e5 + 15;
const int INF = 1e9;
const long double eps = 1e-9;

int dp[3][MaxN];
int a[3][MaxN];
int n;

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

//    freopen("input.txt", "r", stdin);

    cout.precision(9);

    cin >> n;
    for(int i = 1; i <= 2; ++i)
        for(int j = 1; j <= n; ++j)
        {
            cin >> a[i][j];
            dp[i][j] = a[i][j] + max(i > 1 ? dp[i - 1][j] : 0, j > 1 ? dp[i][j - 1] : 0);
        }

    cout << dp[2][n] << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll,ll>
#define PP pair<P,P>
using namespace std;

int main(){
    int n,k; cin >> n >> k;
    vector<ll> s(n+1);
    s[0]=0;
    rep(i,n){
        int a; cin >> a;
        s[i+1]=s[i]+a;
    }
    map<int,int> num;
    ll ans=0;
    rep(i,n+1){
        if(i>=k) num[(s[i-k]-(i-k))%k]--;
        ans+=num[(s[i]-i)%k];
        num[(s[i]-i)%k]++;
        //cout << ans << endl;
    }

    cout << ans << endl;
return 0;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<(n);i++)
#define Fr(i,n) for(int i=0;i++<(n);)
#define ifr(i,n) for(int i=(n)-1;i>=0;i--)
#define iFr(i,n) for(int i=(n);i>0;i--)

int main(){
    int n,m,ans=0;
    cin>>n>>m;
    vector<int> k(m),p(m);
    vector<vector<int>> s(m);
    fr(i,m){
        cin>>k[i];
        s[i].resize(k[i]);
        fr(j,k[i]){
            cin>>s[i][j];
            s[i][j]--;
        }
    }
    fr(i,m){
        cin>>p[i];
        p[i]%=2;
    }
    fr(i,1<<n){
        int kari=0;
        fr(j,m){
            int cnt=0;
            fr(l,k[j]){
                //cout<<i<<" "<<j<<" "<<l<<" "<<s[j][l]<<endl;
                if((i>>s[j][l])&1){
                    //cout<<i<<" "<<j<<" "<<l<<endl;
                    cnt++;
                }
            }
            if(cnt%2==p[j]) kari++;
        }
        //cout<<i<<" "<<kari<<endl;
        if(kari==m) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        
        var prefix = int.Parse(s.Substring(0, 2));
        var suffix = int.Parse(s.Substring(2, 2));

        var format = "NA";
        if (1 <= prefix && prefix <= 12 && 1 <= suffix && suffix <= 12)
        {
            format = "AMBIGUOUS";
        }
        else if (1 <= prefix && prefix <= 12)
        {
            format = "MMYY";
        }
        else if (1 <= suffix && suffix <= 12)
        {
            format = "YYMM";
        }

        Console.WriteLine(format);
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define DBG(v) cerr << #v << " = " << (v) << endl;

const int mod = 998244353;

ll modPow(ll n, ll k) {
	ll res = 1;
	for (n %= mod; k; k >>= 1) {
		if (k & 1)
			res = res * n % mod;
		n = n * n % mod;
	}
	return res;
}

ll modInv(const ll x) {
	return modPow(x, mod - 2);
}

const int MaxFact = (int) 25e5 + 9;

ll fact[MaxFact + 9];
ll factInv[MaxFact + 9];

ll C(const int n, const int k) {
	return fact[n] * factInv[k] % mod * factInv[n - k] % mod;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);

	fact[0] = factInv[0] = 1;
	for (int i = 1; i <= MaxFact; ++i) {
		fact[i] = fact[i - 1] * i % mod;
		factInv[i] = modInv(fact[i]);
	}

	int N, M;
	cin >> N >> M;
	const int S = 3 * M;
	const int R = M - 1;

	ll res = 0;
	for (int odd = 0; odd <= min(N, M); ++odd)
		if ((S - odd) % 2 == 0)
			(res += C(N, odd) * C((S - odd) / 2 + N - 1, N - 1)) %= mod;

	DBG(res);

	res -= N * C(R + N - 1, N - 1);
	cout << (res % mod + mod) % mod;
	return 0;
}


Measured memory_bytes: 39296
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007

int main()
{
	ll a[3],r;
     cin>>a[0]>>a[1]>>a[2];
     sort(a,a+3);
     r=a[2]*10;
     r+=a[0]+a[1];
     cout<<r;
}


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

int main()
{
  static const int M = 1299709;
  vector<int> primes;
  vector<bool> sieve(M+1, false);
  sieve[1] = true;
  for (int i = 2; i <= M; i++) {
    if (!sieve[i]) {
      primes.push_back(i);
      for (int j = i+i; j <= M; j += i) {
        sieve[j] = true;
      }
    }
  }

  int k;
  while (cin >> k && k != 0) {
    vector<int>::const_iterator it = lower_bound(primes.begin(), primes.end(), k);
    if (*it == k) {
      cout << 0 << endl;
    } else {
      cout << (*it - *(it-1)) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    cin >> N;
    int d[N];
    cins(d, d + N);
    int ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int _b=(b),i=(a);i<=_b;++i)
#define ROF(i, b, a) for(int _a=(a),i=(b);i>=_a;--i)
#define REP(n) for(int _n=(n);_n--;)
#define _1 first
#define _2 second
#define PB(x) push_back(x)
#define SZ(x) int((x).size())
#define ALL(x) (x).begin(), (x).end()
#define MSET(m,v) memset(m,v,sizeof(m))
#define MAX_PQ(T) priority_queue<T>
#define MIN_PQ(T) priority_queue<T,vector<T>,greater<T>>
#define IO(){ios_base::sync_with_stdio(0);cin.tie(0);}
#define cint1(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
typedef long long int ll; typedef pair<int,int> PII;typedef unsigned long long int ull;
typedef vector<int>VI; typedef vector<ll> VL; typedef vector<PII> VP;
template<class A,class B>inline bool mina(A &x,const B &y){return(y<x)?(x=y,1):0;}
template<class A,class B>inline bool maxa(A &x,const B &y){return(x<y)?(x=y,1):0;}

int x[55];
ll dp[55][3025];
int main() {
	IO();
	cint2(N, A);
	FOR(i, 1, N) cin >> x[i];
	//MSET(dp, 0);
	dp[0][0] = 1;
	int tot = 0;
	FOR(i, 1, N) {
		ROF(j, i-1, 0) {
			FOR(k, 0, tot) {
				dp[j+1][x[i] + k] += dp[j][k];
			}
		}
		tot += x[i];
	}
	ll res = 0;
	FOR(i, 1, N) res += dp[i][i*A];
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
using namespace std;

typedef long long ll;

int main()
{
    int N,T;
    cin >> N >> T;
    int ans_c=100000;
    for(int i=0; i<N; i++){
        int c,t;
        cin >> c >> t;
        if(T>=t){
            ans_c=min(ans_c, c);
        }
    }
    if(ans_c==100000) cout << "TLE";
    else cout << ans_c;


    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int A,B,C;
  cin >> A >> B;
  C = A + B;
  if(A%3==0 || B%3==0 || C%3==0)cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}


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

int main(){
    long long a,b,c;
    cin>>a>>b>>c;
    if(a%2&&b%2&&c%2) cout<<min(a,b)*min(c,max(a,b))<<endl;
    else cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#define REP(i, n) for(int i=0;i<n;++i)
#define INF 100000000
#define ll long long

using namespace std;

typedef pair<int, int> P;
typedef priority_queue<int> Pque;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

int n;
int a[2][100];
int sum = 0;
int ans;

int main(){
  cin >> n;
  REP(i, 2) REP(j, n) cin >> a[i][j];

  sum += a[0][0];
  REP(i, n){
    sum += a[1][i];
  }
  ans = sum;

  if(n >= 2){
    REP(i, n-1){
      sum -= a[1][i];
      sum += a[0][i+1];
      ans = max(ans, sum);
    }
  }

  cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
T = input().split()
t = [int(s) for s in T] #リストの文字をintに変換
t_sum = 0
for i in range(len(t)):
    t_sum = t_sum + t[i]
m = int(input())
PX = []
for i in range(m):
    PX.extend(input().split())
px = [int(s) for s in PX]
for j in range(0,2*m-1,2):
    print(t_sum - t[(px[j]-1)] + px[j+1])

Measured memory_bytes: 38416
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
int main() {
	int n, x;
	cin >> n >> x;
	if (x==2*n-1||x==1) {
		cout << "No" << endl;
		return 0;
	}
	else {
		cout << "Yes" << endl;
	}
	if (n == 2) {
		cout << 1 << endl << 2 << endl << 3 << endl;
	}
	else if (x != 2*n - 2) {
		vi A;
		A.push_back(0);
		for (int i = 1; i <= 2 * n - 1; i++) {
			if (i<x - 1 || i>x + 2) {
				A.push_back(i);
			}
		}
		for (int i = 1; i <= n-2; i++) {
			cout << A[i] << endl;
		}
		cout << x + 2 << endl;
		cout << x  << endl;
		cout << x -1 << endl;
		cout << x + 1 << endl;
		for (int i = n - 1; i <= 2 * n - 5;i++) {
			cout << A[i] << endl;
		}
	}
	else {
		vi A;
		A.push_back(0);
		for (int i = 1; i <= 2 * n - 1; i++) {
			if (i<x - 2 || i>x + 1) {
				A.push_back(i);
			}
		}
		for (int i = 1; i <= n - 2; i++) {
			cout << A[i] << endl;
		}
		cout << x - 2 << endl;
		cout << x << endl;
		cout << x + 1 << endl;
		cout << x - 1 << endl;
		for (int i = n - 1; i <= 2 * n - 5;i++) {
			cout << A[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 2548
#!/usr/bin/env python3

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

abc.sort()

diff1 = abc[2]-abc[0]
diff2 = abc[2]-abc[1]

if (diff1+diff2) % 2 == 0:
    print((diff1+diff2)//2)
else:
    print((diff1+diff2+3)//2)


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(int i = (int)k; i < (int)n; i++)
#define rrep(i, n) RREP(i, 0, n)
#define RREP(i, k, n) for(int i = (int)n-1; i > (int)k-1; i--)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define ALL(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " " << x << endl;

typedef long long ll;

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

int N, A;
int x[51];
long long dp[51][51][2600];

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

    cin >> N >> A;
    REP(i,1,N+1) cin >> x[i];

    // int X = max(*max_element(x+1,x+N+1), A);

    dp[0][0][0] = 1;
    // REP(xi,1,N+1) {
    //     rep(ch_n,xi+1) {
    //         rep(sum,2501) {
    //             if(sum<x[xi])
    //                 dp[xi][ch_n][sum] = dp[xi-1][ch_n][sum];
    //             else if(ch_n>=1)
    //                 dp[xi][ch_n][sum] = dp[xi-1][ch_n][sum] + dp[xi-1][ch_n-1][sum-x[xi]];
    //         }
    //     }
    // }
    rep(xi,N) {
        rep(ch_n,N) {
            rep(sum,2500) {
                if(dp[xi][ch_n][sum]) {
                    dp[xi+1][ch_n][sum] += dp[xi][ch_n][sum];
                    dp[xi+1][ch_n+1][sum+x[xi+1]] += dp[xi][ch_n][sum];
                }
            }
        }
    }

    // rep(i,N+1) {
    //     cout << i << ":" << endl;
    //     rep(j,N+1) {
    //         rep(k,25) {
    //             cout << dp[i][j][k] << " ";
    //         } cout << endl;
    //     } cout << endl << endl;
    // }

    ll ans = 0;
    REP(ch_n,1,N+1)
        ans += dp[N][ch_n][A*ch_n];

    cout << ans << endl;
}


Measured memory_bytes: 50176
def resolve():
    d,g = map(int,input().split())
    pc = [list(map(int, input().split())) for _ in range(d)]
    ans = 10**9
    for i in range(2**d):
        count = 0
        total = 0
        nokori = [1 for _ in range(d)]
        for j in range(d):
            if (i>>j & 1):
                total += pc[j][0] * (j+1)* 100 + pc[j][1]
                count += pc[j][0]
                nokori[j] = 0
        if total >= g:
            ans = min(ans, count)
        else:
            for k in reversed(range(len(nokori))):
                if nokori[k] == 0:
                    continue
                else:
                    if total + (pc[k][0]-1) * (k+1) *100 >= g:
                        count += (((g-total) + (k+1)*100)-1)//((k+1)*100)
                        ans = min(ans, count)
                        break
                    else:
                        total += (pc[k][0]-1) * (k+1) *100
                        count += (pc[k][1]-1)
    print(ans)
resolve()

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

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int[] numArray = parseInt(getSplitLine(line));

		if (numArray[0] < numArray[1] && numArray[1] < numArray[2]) {
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
	}

	private static String[] getSplitLine(String line) {
		return line.split("\\s");
	}

	private static int[] parseInt(String[] line) {
		int[] numArray = new int[line.length];
		for (int i = 0; i < line.length; i++) {
			numArray[i] = Integer.parseInt(line[i]);
		}
		return numArray;
	}
}

Measured memory_bytes: 17036
import fractions
a, b, c, d = list(map(int, input().split()))
e = c * d // fractions.gcd(c, d)

cko = b//c - (a-1)//c
dko = b//d - (a-1)//d
eko = b//e - (a-1)//e
print(b-a+1-cko-dko+eko)

Measured memory_bytes: 5048
#include<iostream>
#include<cmath>

int main() {
  int N;
  int T;
  int A;
  std::cin >> N >> T >> A;
  double out_t;
  int out_n;
  for (int i=0; i<N; i++) {
    double temp_t;
    std::cin >> temp_t;
    temp_t = T-0.006*temp_t;
    if (i==0) {
      out_t = std::abs(A - temp_t);
      out_n = i;
    }
    else {
      if (out_t > std::abs(A-temp_t)) {
        out_t = std::abs(A-temp_t);
        out_n = i;
      }
    }
  }
  std::cout << out_n+1 << std::endl;
}

Measured memory_bytes: 256
#include <iomanip>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <cmath>

using namespace std;

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

typedef long long ll;
typedef unsigned int uint;
typedef long double ld;

const int INT_INF=1e9;
const ll LONG_INF=1e18;
const double pi = acos(-1);
const int MAXN = 2e6;
const int MAXM = 1e6;

int gcd(int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }

    return a;
}

void solve() {
    int n;
    cin >> n;
    vector<int> used(MAXN, 0);
    int cur = 0;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        cur = gcd(cur, a);
        ++used[a];
    }

    bool pr_cp = true;

    for (int i = 2; i < used.size(); ++i) {
        int num = 0;
        for (int j = i; j < used.size(); j += i) {
            num += used[j];
        }
        if (num > 1) {
            pr_cp = false;
            break;
        }
    }
    if (pr_cp && cur == 1) {
        cout << "pairwise coprime\n";
    } else if (cur == 1) {
        cout << "setwise coprime\n";
    } else {
        cout << "not coprime\n";
    }
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(9);
#ifdef LOCAL
    freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
#endif
    solve();

#ifdef LOCAL
    cout << "Time:\n";
    cout << static_cast<double>(clock()) / CLOCKS_PER_SEC << '\n';
#endif

}


Measured memory_bytes: 11124
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<complex>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 400, MAX_C = 400, MAX_X = 400, MOD = 1e9+7;
int N, C;
int A[MAX_N+1], B[MAX_N+1];
ll dp[MAX_N+1][MAX_C+1];
ll sum_pow[MAX_C+1][MAX_X+1];

int main() {
  cin >> N >> C;
  for (int i = 1; i <= N; ++i) cin >> A[i];
  for (int i = 1; i <= N; ++i) cin >> B[i];

  for (int x = 1; x <= MAX_X; ++x) sum_pow[0][x] = x;
  for (int c = 1; c <= MAX_C; ++c) {
    for (int x = 1; x <= MAX_X; ++x) {
      sum_pow[c][x] = (sum_pow[c][x-1] + (sum_pow[c-1][x]-sum_pow[c-1][x-1]+MOD)%MOD*x) % MOD;
    }
  }

  dp[0][0] = 1;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= C; ++j) {
      for (int k = 0; k <= j; ++k) {
        ll add = (sum_pow[k][B[i]] - sum_pow[k][A[i]-1]+ MOD)%MOD;
        (dp[i][j] += dp[i-1][j-k]*add) %= MOD;
      }
    }
  }


  cout << dp[N][C] << endl;

  return 0;
}


Measured memory_bytes: 2816
#include<iostream>
    #include<string>
    using namespace std;
     
    int main() {
    	int a, b;
    	string str(50, '\0');
     
    	cin >> a >> b;
    	cin >> str;
     
    	str[b-1] += 'a' - 'A';
     
    	cout << str << endl;
     
    	return 0;
    }

Measured memory_bytes: 256