akhauriyash/Code-Regression huggingface dataset:
/*    特徴    */

/*    教訓    */

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

using ll = long long;
using ld  = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

// #define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; i++ )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define p_b push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに


// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// -------- template end - //


// - library ------------- //



// --------- library end - //


int main(){

  string s = is(); // [0, len-1]
  ll len = s.size();

  ll K = il(); // 残り何回操作するか

  // まずは、でかい桁から貪欲にaにする
  rep(i, len){
    if (s[i]!='a' && K >= ('z'+1) - s[i]){
      // aにする
      K -= ('z'+1) - s[i];
      s[i] = 'a';
      if (K == 0) break;
    }
    else{
      continue;
    }
  }

  if (K != 0){
    s[len-1] =  s[len-1] + K % 26;
    if (s[len-1] > 'z') s[len-1] = s[len-1] - 26;
  }

  cout << s << endl;


  
}

Measured memory_bytes: 3796
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int x = sc.nextInt();
		
		// 計算
		int result = 0;
		if(400 <= x) result = 8;
		if(600 <= x) result = 7;
		if(800 <= x) result = 6;
		if(1000 <= x) result = 5;
		if(1200 <= x) result = 4;
		if(1400 <= x) result = 3;
		if(1600 <= x) result = 2;
		if(1800 <= x) result = 1;
		
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 25336
import           Control.Applicative
import           Data.List

split :: [[Double]] -> [(Double, [Double])]
split xss = unfoldr f xss
  where
    f []          = Nothing
    f [_]         = Nothing
    f (as:bs:css) = Just ((head as, bs), css)

sd :: (Double, [Double]) -> Double
sd (n, ds) = sqrt $ (sum $ fmap (\d -> (d - m) ^ 2) ds) / n
  where
    m = sum ds / n

main :: IO ()
main = do
    xss <- fmap (fmap read . words) . lines <$> getContents :: IO [[Double]]
    let answer = fmap sd $ split xss
    mapM_ print answer



Measured memory_bytes: 5088
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt(); 
        int A = sc.nextInt();
        int B = sc.nextInt();
        for(int i = 1; i <= 1000; i++){
          int ans = K * i;
          if(ans >= A && ans <= B){
            System.out.println("OK");
            break;
          }else if(ans >= B){
            System.out.println("NG");
            break;
          }
        }  
    }
}

Measured memory_bytes: 35820
#include <cstdio>
#include <cmath>
#define loop_input(fmt,...) while(~scanf(fmt,__VA_ARGS__))
#define PI 3.14159265359

int main() {
    double r;
    loop_input("%lf", &r) {
        printf("%lf %lf\n", PI * r * r, 2 * PI * r);
    }
    return 0;
}


Measured memory_bytes: 2676
import java.util.Scanner;

 class Main{
	
public static int bubbleSort(int A[],int N){
    int i,j,r=0,temp;
    boolean flag=true;
    for(i=0;flag;i++){
    	flag=false;
        for(j=N-1;j>=i+1;j--){
        	if(A[j]<A[j-1]){
        		temp=A[j];
        		A[j]=A[j-1];
        		A[j-1]=temp;
        flag=true;
        r++;      	
        }
}
}
    return r;
}
   
public static void main(String[] args){
         
		 Scanner sc= new Scanner(System.in);
	         int N=sc.nextInt();
             int A[]=new int[100];
             
             int i,j;
             for(i=0;i<N;i++){
            	 A[i] = sc.nextInt();
             }
	       
        int loop = bubbleSort(A,N);
        for(i=0;i<N;i++){
      	  if(i>0)
      	   System.out.print(" ");
         System.out.print(A[i]);
        }
        System.out.println();
        System.out.println(loop);
        sc.close();
}
}

Measured memory_bytes: 26224
import sys
import heapq
import math
import itertools

INF = float("inf")


def dis(x1, y1, x2, y2):
    return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)


def main():
    N = int(input())
    x = [0] * N
    y = [0] * N

    for i in range(N):
        x[i], y[i] = map(int, input().split())

    ans = 0
    data = [i for i in range(0, N)]
    routes = list(itertools.permutations(data))
    for route in routes:
        # print(route)
        for i in range(0, len(route) - 1):
            # print(x[i], y[i], x[i+1], y[i+1])
            test = dis(x[route[i]], y[route[i]], x[route[i+1]], y[route[i+1]])
            # print(test)
            ans += test

    print(ans / len(routes))


if __name__ == '__main__':
    main()


Measured memory_bytes: 45424
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long Int;
int main(){
  string s;
  cin>>s;
  Int ans=0;
  vector<Int> b,w;
  for(Int i=0;i<s.length();i++){
    if(s[i]=='B') b.push_back(i);
    else w.push_back(i);
  }
  for(Int i=0;i<w.size();i++){
    ans+=w[i]-i;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 2808
def affine(word, alpha, beta):
    word = list(word)
    for i in range(len(word)):
        ascii = ((ord(word[i]) - ord('a')) * alpha + beta) % 26;
        word[i] = chr(ascii + ord('a'));
    return ''.join(word)
    
alphas = [1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25]

for x in range(int(input())):
    words = input().split(' ')
    for alpha in range(26):
        for beta in range(26):
            string = list(map(lambda x: affine(x, alpha, beta), words))
            if 'that' in string or 'this' in string:
                print(*string)
                break
        else:
            continue
        break


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
string s,ss;
ll ar[100009];
ll br[100009];
vector<char>v;
char ch;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll a,b,n,ans,res,i,j,c=0,f=0,len1,len2;
    cin>>s>>ss;
    len1=s.size();
    for(i=0;i<len1;i++){
     if(s[i]==ss[i])c++;
    }
    cout<<c<<endl;
   return 0;

}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt(),b = sc.nextInt(),c = sc.nextInt(),d = sc.nextInt();
    int result= a+b-c-d;
    if(result>0){
      System.out.println("Left");
    }else if(result==0){
      System.out.println("Balanced");
    }else{
      System.out.println("Right");
    }
  }
}


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

#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to));
#define sort(a) sort(a.begin(), a.end())

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;

  cout << max(max(a + b, a - b), a * b) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#include<string.h>
#include <iomanip>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n) cin >> a[i];
    vector<int>b(n);
    rep(i,n) {
        b[a[i]-1] = i+1;
    }
    rep(i,n) {
        if(i==n-1) {
            cout << b[i] << endl;
            break;
        }    
        cout << b[i] << " ";
    }
}

Measured memory_bytes: 1664
import math


def abc162c_sum_of_gcd_of_tuples():
    k = int(input())
    total = 0
    memo = [[-1] * k for _ in range(k)]
    for a in range(1, k + 1):
        for b in range(1, k + 1):
            if memo[a - 1][b - 1] == -1:
                memo[a - 1][b - 1] = math.gcd(a, b)
            g = memo[a - 1][b - 1]
            for c in range(1, k + 1):
                if memo[g - 1][c - 1] == -1:
                    memo[g - 1][c - 1] = math.gcd(g, c)
                total += memo[g - 1][c - 1]
    print(total)

abc162c_sum_of_gcd_of_tuples()

Measured memory_bytes: 9412
import java.util.*;

/**
 * Created by DELL on 2017/7/1.
 */
public class Main {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        List<Integer>list=new ArrayList<>();
        List<Integer>list1=new ArrayList<>();
        for (int i = 0; i <n ; i++) {
            list.add(in.nextInt());
        }
        if(n%2==0){
            for (int i = 0; i <n/2 ; i++) {
                list1.add(list.get(n-2*i-1));
            }
            for (int i = 0; i <n/2 ; i++) {
                list1.add(list.get(2*i));
            }
        }
        else{
            for (int i = 0; i <n/2+1 ; i++) {
                list1.add(list.get(n-2*i-1));
            }
            for (int i = 0; i <n/2 ; i++) {
                list1.add(list.get(2*i+1));
            }
        }
        for (int i = 0; i <list1.size() ; i++) {
            System.out.print(list1.get(i)+" ");
        }


    }
}


Measured memory_bytes: 98832
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

    if(x==7 or x==5 or x==3)cout << "YES" <<endl;
    else  cout << "NO" << endl;
 
    
    return 0;

}


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

int main(){

    int N, M;
    cin >> N >> M;

    
    int max;

    for( int i = M/N; i > 0; i-- ){
        if( M % i == 0 && M/i >= N ){
            max = i;
            break;
        }
    }
    
    cout << max << endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <limits.h>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#include <vector>

using namespace std;
typedef long long ll;
const int maxn = 1e6 + 7;
const int mod = 1e9 + 7;

int x[maxn], y[maxn];
int p[4][maxn];

int main(void)
{
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++ )
	{
		cin >> x[i] >> y[i];
		p[0][i] = x[i] + y[i];
		p[1][i] = -x[i] + y[i];
		p[2][i] = x[i] - y[i];
		p[3][i] = -x[i] - y[i];
	}
	for(int i = 0; i < 4; i ++ ) sort(p[i] + 1, p[i] + 1 + n);
	int ans =0 ;
	for(int i = 0; i < 4; i ++ )
	{
		ans = max(ans, p[i][n] - p[i][1]);
	}
	cout << ans;
}




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

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static long[] Luca;

        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            long n = long.Parse(Console.ReadLine());

            Luca = new long[n + 1];

            Luca[0] = 2;
            Luca[1] = 1;

            Console.WriteLine(Lucas(n));

            Console.Out.Flush();
        }

        public static long Lucas(long n)
        {
            if(Luca[n] != 0) {
                return Luca[n];
            }

            Luca[n] = Lucas(n - 1) + Lucas(n - 2);

            return Luca[n];
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}

int power(int N, int M) {return M ? power(N * N, M / 2) * (M % 2 ? N : 1) : 1;}

int mystoi(string S){
    int num = 0;
    for (int i = (int) S.length()-1; i >= 0; i--){
        num += (S[i]-'0') * power(10,S.length()-1-i);
    }
    return num;
}

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int K;
    cin >> K;

    if (K % 2 == 0) {
        print(-1);
        return 0;
    }

    int S = 7;
    ans = 1;
    while (S % K != 0) {
        S = S*10 + 7;
        S %= K;
        ans++;
        if (ans > K) {
            ans = -1;
            break;
        }
    }


    cout << ans << endl;

    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc174/abc174_c && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc174/abc174_c && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc174/abc174_c && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll a, b, c;
  cin >> a >> b >> c;
  if(a==b&&b==c)
    print("Yes");
    else
      print("No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) {
 if (a < b) { a = b; return true; } return false; 
 }
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
 }
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  
  ll u,v;
  cin>>n>>u>>v;
  u--;
  v--;
  vvll ki(n,vll(0));
  vb ch(n,false);
  rep(i,n-1){
    ll a,b;
    cin>>a>>b;
    a--;
    b--;
    ki[a].pb(b);
    ki[b].pb(a);
  }
  vll uu(n);
  vll vv(n);
  queue<ll> p;
  p.pu(u);
  while(sz(p)){
    ll t=p.front();
    p.pop();
    ch[t]=true;
    for(auto pp:ki[t]){
      if(ch[pp]) continue;
      uu[pp]=uu[t]+1;
      p.pu(pp);
    }
  }
  p.pu(v);
  rep(i,n){
    ch[i]=false;
  }
  while(sz(p)){
    ll t=p.front();
    p.pop();
    ch[t]=true;
    for(auto pp:ki[t]){
      if(ch[pp]) continue;
      vv[pp]=vv[t]+1;
      p.pu(pp);
    }
  }
  ll ans=0;
  rep(i,n){
    if(uu[i]<=vv[i]){
      ans=max(ans,vv[i]-1);
    }
  }
  COUT(ans);
}

Measured memory_bytes: 8064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

const int MAX = 1e6+10;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    COMinit();

    int X,Y; cin >> X >> Y;
    if((X+Y)%3 != 0){
        cout << 0 << endl;
        return 0;
    }

    int h = (X+Y) / 3;

    if(abs(X-Y) > h){
        cout << 0 << endl;
        return 0;
    }

    int n = abs(abs(X-Y) - h) / 2;
    cout << COM(h,n) << endl;


}


Measured memory_bytes: 23680
#include <stdio.h>
#include <string.h>

int main(void) {
	int K;
	char S[101];
	int i;

	scanf("%d", &K);
	scanf("%s", &S);

	if (strlen(S) <= K) {
		printf("%s\n", S);
	}
	else {
		for (i = 0; i < K; i++) {
			printf("%c", S[i]);
		}
		printf("...\n");
	}

}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define yes(n) cout << ((n) ? "yes" : "no") << endl

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

void chmin(int &a, int b) { if (a > b) a = b; }

template<typename T>
T gcd(T a, T b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}


int main() {
    long double l; cin >> l;
    cout << fixed << setprecision(7) <<  (l * l * l) / 27 << endl;
}


Measured memory_bytes: 256
import bisect
X,N = map(int,input().split())

if N == 0:
    print(X)
else:
    p = list(map(int,input().split()))
    p.sort()
    q = list(range(p[-1]+2))
    pq=list(set(p)^set(q))
    ind = bisect.bisect_left(pq, X)
    #print("pq",pq,"ind",ind)

    if abs(X-pq[ind]) >= abs(X-pq[ind-1]):
        print(pq[ind-1])
    else:
        print(pq[ind])


#print(min(abs(X-pq[ind]),abs(X-pq[ind]-1)))


Measured memory_bytes: 9212
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

ll A[57];

int main() {
    ll N,M,B,C;
    cin >> N >> M; 
    rep(i,M){
        cin >> B >> C;
        A[B-1]++;
        A[C-1]++;
    }
    rep(i,N){
        cout << A[i] << endl;
    }
}

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

#define     FasterIO        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     bug(a,b)        cout<<a<<"\t"<<b<<"\n";
#define     Case(a,b)       cout<<"Case "<<a<<": "<<b<<"\n";
#define     precision(a,b)  fixed<<setprecision(a)<<b
#define     lp(i,a,b)       for(int i=a;i<b;i++)
#define     Endl            "\n"
#define     tab             "\t"
#define     reset(a,b)      memset(a,b,sizeof(a));
#define     sf(a)           scanf(" %d", &a);
#define     sfl(a)          scanf(" %lld", &a);
#define     srt(a)          sort(a.begin(),a.end());
#define     ALL(a)          a.begin(),a.end()
#define     pb(a)           push_back(a)
#define     pi              2*acos(0.0)

typedef long long int ll;
typedef unsigned long long int ull;

const int sz=1e5+9 , infP=INT_MAX , infN=INT_MIN ,mod=1e9+7, eps=1e-9;


void ini(){

    return;
}

int dp[1005][1005];

void solve(){
    ll n , m, k, l, ans=0,r,c;
    cin>>r>>c;

    string g[r];

    for(auto &i:g)cin>>i;
    dp[0][0]=1;
    for(int i=0;i<r;i++){

        for(int j=0;j<c;j++){
            if(g[i][j]=='#')continue;
            if(i!=0)dp[i][j]+=dp[i-1][j];
            dp[i][j]%=mod;
            if(j!=0)dp[i][j]+=dp[i][j-1];
            dp[i][j]%=mod;
        }
    }

    cout<<dp[r-1][c-1]<<Endl;



}

int main(){
    FasterIO;
    #ifndef ONLINE_JUDGE
        freopen("input.in","r",stdin);
        freopen("output.in","w",stdout);
    #endif
    // ini();
    int t=1;
    // cin>>t;
    while(t--)
        solve();
}


Measured memory_bytes: 8580
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#define rep(index,num) for(int index=0;index<num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
int main(){
	int R;
	scan(R);
	if(R<1200){
		prin("ABC");
	}
	else if(R<2800){
		prin("ARC");
	}
	else{
		prin("AGC");
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
int main(){
    int s,w;
    cin>>s>>w;
    if(s<=w){
        cout<<"unsafe"<<endl;
    }
    else{
        cout<<"safe"<<endl;
    }
}

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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)


#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////

int main()
{
    FASTIO;

    ll a , b , k;

    cin >> a >> b >> k;

    if(k<=a)
    {
        cout << a-k << " " << b << endl;
    }
    else if(k<=(a+b))
    {
        cout << 0 << " " << b-(k-a) << endl;
    }
    else
    {
        cout << 0 << " " << 0 << endl;
    }






    return 0;
}


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

int main() {
	while(1) {
		int n, m;
		cin >> n >> m;
		if (n == 0 && m == 0) break;
		int taro[101], hanako[101];
		int taroTotal = 0, hanakoTotal = 0;
		
		for (int i = 0; i < n; i++) {
			cin >> taro[i];
			taroTotal += taro[i];
		}
		for (int i = 0; i < m; i++) {
			cin >> hanako[i];
			hanakoTotal += hanako[i];
		}
		
		int a = 0x7ffffff, b = 0x7ffffff;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (taroTotal - taro[i] + hanako[j] == hanakoTotal - hanako[j] + taro[i])
				if (taro[i] + hanako[j] < a + b) {
					a = taro[i];
					b = hanako[j];
				}
			}
		}
		if (a == 0x7ffffff && b == 0x7ffffff) cout << -1 << endl;
		else cout << a << " " << b << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

template<typename T>
struct BellmanFord {
	struct Edge {
		const int from;
		const int to;
		const T cost;
		Edge(const int from, const int to, const T cost) :
			from(from),
			to(to),
			cost(cost)
			{}
	};
	const int V;
	vector<vector<Edge>> G;
	int start;
	const T INF = numeric_limits<T>::max();
	vector<T> dist;
	bool hasNegativeCycle = false;
	vector<bool> negative;
	vector<int> rec;
	BellmanFord(const int V) :
		V(V),
		G(vector<vector<Edge>>(V, vector<Edge>())),
		negative(vector<bool>(V))
		{}
	void addEdge(const int from, const int to, const T cost) {
		G[from].emplace_back(from, to, cost);
	}
	bool negativeCycle() {
		return hasNegativeCycle;
	}
	bool build(const int start) {
		(*this).start = start;
		dist = vector<T>(V, INF);
		rec = vector<int>(V, -1);
		dist[start] = 0;
		for(int i = 0; i < V; ++i) {
			bool update = false;
			for(int from = 0; from < V; ++from) {
				if(dist[from] == INF) continue;
				for(Edge e : G[from]) {
					if(dist[e.from] + e.cost < dist[e.to]) {
						dist[e.to] = dist[e.from] + e.cost;
						rec[e.to] = e.from;
						update = true;
					}
				}
			}
			if(not update) break;
			if(i == V - 1) hasNegativeCycle = true;
		}
		for(int i = 0; i < V; ++i) {
			bool update = false;
			for(int from = 0; from < V; ++from) {
				if(dist[from] == INF) continue;
				for(Edge e : G[from]) {
					if(dist[e.from] + e.cost < dist[e.to]) {
						dist[e.to] = dist[e.from] + e.cost;
						negative[e.to] = true;
						update = true;
					}
					if(negative[e.from]) {
						negative[e.to] = true;
					}
				}
			}
			if(not update) break;
		}
	}
	T distance(const int to) {
		if(negative[to]) throw "INVALID";
		return dist[to];
	}
	vector<int> route(int to) {
		distance(to);
		vector<int> ret;
		while(to != start) {
			ret.push_back(to);
			to = rec[to];
		}
		ret.push_back(start);
		reverse(ret.begin(), ret.end());
		return ret;
	}
};

int main() {
	int n, m, p; cin>>n>>m>>p;
	BellmanFord<int64_t> bf(n);
	for(int i=0;i<m;i++){
		int a,b,c; cin>>a>>b>>c;
		a--;b--;
		bf.addEdge(a,b,-(c-p));
	}
	bf.build(0);
	try {
		cout << max<int64_t>(0, -bf.distance(n - 1)) << '\n';
	}
	catch(...) {
		cout << -1 << '\n';
	}
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main ()
{
    int n, t,d,sum=0,tmp;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d%d",&t,&d);
     if (d<t){
        tmp = t ;
        t =  d;
        d = tmp;
        }
       
        sum = sum + d-t+1;
        
    }
    printf("%d\n",sum);
    return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-------------------------------------------------

int n, m;
string s, t;

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}

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

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

	cin >> n >> m >> s >> t;
	if (n < m) {
		int TMP = n;
		string tmp = s;
		s = t, t = tmp;
		n = m, m = TMP;
	}
	ll l = lcm(n, m);
	int g = gcd(n, m);
    REP(i, g) {
		if (s[i * (l / m)] != t[i * (l / n)]) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << l << endl;

    return 0;
}




Measured memory_bytes: 640
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> d(n, 0);
    for(int i = 0; i < m; ++i){
        ll a, b;
        cin >> a >> b;
        a--; b--;
        d.at(a)++;
        d.at(b)++;
    }
    for(ll x : d){
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

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

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

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

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

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

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

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}
void judgement(int a){
  if(a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  if(a){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}

int main(){
  startupcpp();
  ll A,B;
  cin>>A>>B;
  if(A*B%2){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	long long int a;
	long long int b = 0, c = 0;
	cin >> a;
	for (long long int i = 2; i*i <= a; i++)
	{
		if (a%i == 0)
		{
			b = i;
			c = 1;
		}
	}
	if (c == 0)
	{
		cout << a - 1;
	}
	else if (c == 1)
	{
		cout << b + a / b - 2;
	}
}

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

typedef pair<string, int> P;

string input;
set<string> checked;
queue<P> que;

bool check_all_same(string s)
{
	char color = s[0];
	for (int i=1; i<s.length(); i++)
	{
		if (color != s[i]) return false;
	}
	return true;
}

char get_other(char a, char b)
{
	//             r     g     b
	bool arr[3] = {true, true, true};
	if (a == 'r') arr[0] = false;
	if (a == 'g') arr[1] = false;
	if (a == 'b') arr[2] = false;
	if (b == 'r') arr[0] = false;
	if (b == 'g') arr[1] = false;
	if (b == 'b') arr[2] = false;
	rep(i,3)
	{
		if (arr[i])
		{
			if (i == 0) return 'r';
			else if (i == 1) return 'g';
			else return 'b';
		}
	}
}

vector<string> get_next_str(string in)
{
	vector<string> ret;

	for (int i=0; i<in.length()-1; i++)
	{
		if (in[i] != in[i + 1])
		{
			string next(in);
			char new_char = get_other(in[i], in[i + 1]);
			next[i] = new_char;
			next[i + 1] = new_char;

			ret.push_back(next);
		}
	}

	return ret;
}

signed main()
{
	/*
	vector<string> nexts = get_next_str("rbgrg");
	for (int i=0; i<nexts.size(); i++)
	{
		cout << nexts[i] << endl;
	}
	*/

	while (true)
	{
		cin >> input;
		if (input == "0") break;

		checked.clear();
		checked.insert(input);

		queue<P> empty;
		swap(que, empty);
		que.push(P(input, 0));

		bool find = false;

		while (que.size())
		{
			P p = que.front(); que.pop();
			if (check_all_same(p.first))
			{
				printf("%d\n", p.second);
				find = true;
				break;
			}

			vector<string> nexts = get_next_str(p.first);
			rep(i,nexts.size())
			{
				if (checked.find(nexts[i]) == checked.end())
				{
					que.push(P(nexts[i], p.second + 1));
					checked.insert(nexts[i]);
				}
			}
		}

		if (!find) printf("NA\n");
	}
}

Measured memory_bytes: 2680
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
using namespace std;

int main(){
    string S;
    cin >> S;
    int tempcount = 0;
    int maxcount = 0;
    for (int i = 0; i < S.length(); i++){
        if(S[i] == 'A' ||
           S[i] == 'T' ||
           S[i] == 'C' ||
           S[i] == 'G'){
               tempcount++;
        }
        else {
            tempcount = 0;
        }
        maxcount = max(maxcount, tempcount);
    }
    cout << maxcount << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[]d = new int[6];
		d[0]=2;
		for(int i=1;i<6;i++) {
			d[i]=d[i-1]*2;
		}
		if(N==1)System.out.print(1);
		else if(d[5]<=N)System.out.print(d[5]);
		else {
			for(int i=0;i<6;i++) {
				if(N<d[i]) {
					System.out.print(d[i-1]);
					break;
				}
			}
		}
		sc.close();
	}
}

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


int main(int argc, char const *argv[])
{
	int n,k;
	cin>>n>>k;
	ll d;
	ll sm =0;
	ll arr[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>arr[i]	;
	}
	sort(arr,arr+n);
	if(k>=n) cout<<0;
	else{
		for (int i = 0; i < n-k; ++i)
		{
			sm+=arr[i];
		}
		cout<<sm;
	}
	return 0;
}

Measured memory_bytes: 1792
N,K = map(int,input().split())
A = list(map(int,input().split()))
dp = []
for i in range(N):
  L = [0]*(K+1)
  dp.append(L)
for i in range(A[0]+1):
  dp[0][i] = 1
for i in range(1,N):
  cur = [0]*(K+2)
  for j in range(K+1):
    cur[j+1] = (cur[j]+dp[i-1][j])%(10**9+7)
  for k in range(K+1):
    if k > A[i]:
      dp[i][k] = cur[k+1]-cur[k-A[i]]
    else:
      dp[i][k] = cur[k+1]
print(dp[N-1][K]%(10**9+7))

Measured memory_bytes: 135000
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
using namespace std;

int a, b;

int main()
{
	scanf("%d %d", &a, &b);
	printf("%d\n", b * 2 - a);
	return 0;
}

Measured memory_bytes: 256
mod = 10**9+7

n, m = gets.to_s.split.map{|t|t.to_i}

stairs = [1] * (n+1)

m.times do
  stairs[gets.to_s.to_i] = 0
end

2.upto(n) do |i|
  next if stairs[i] == 0
  stairs[i] = stairs[i-1] + stairs[i-2]
  stairs[i] %= mod if stairs[i] >= mod 
end

puts stairs[-1] % (10**9+7)

Measured memory_bytes: 2812
let ( *> ) f g x = g (f x);;
Scanf.scanf" %f %f %f"@@fun n m->(function
| 0. -> 1. /. n
| d  -> (2. *. (n -. d)) /. n /. n) *> ( *. ) (m -. 1.) *> Printf.printf"%.12f"

Measured memory_bytes: 384
#include <iostream>

using namespace std;
int main(){
	int i,n,a[110],mx=0,mn=1000,b[100];
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
		mx = max(mx,a[i]);
		mn = min(mn,a[i]);
		b[i] = 0;
	}
	for(i=0;i<n;i++){
		b[a[i]]++;
	}
	if(mx%2==1){
		if(mn!=(mx+1)/2){
			cout << "Impossible" << endl;
			return 0;
		}
		for(i=mx;i>=mn;i--){
			if(b[i]<2){
				cout << "Impossible" << endl;
				return 0;
			}
		}
		if(b[mn]!=2){
			cout << "Impossible" << endl;
			return 0;
		}
		cout << "Possible" << endl;
	}else{
		if(mn!=mx/2){
			cout << "Impossible" << endl;
			return 0;
		}
		for(i=mx;i>mn;i--){
			if(b[i]<2){
				cout << "Impossible" << endl;
				return 0;
			}
		}
		if(b[mn]!=1){
			cout << "Impossible" << endl;
			return 0;
		}
		cout << "Possible" << endl;
	}
}
		

Measured memory_bytes: 256
/* 

 */
/* ID: thanhvq1
LANG: C++14
PROB: namenum
*/

#pragma GCC optimize ("O2")
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;

// defines
#define int long long
typedef long long ll;
#define double long double
#define vec vector
#define vi vector<int>
#define vvi vector<vector<int>>
#define FZ(n) memset((n),0,sizeof())
#define FMO(n) memset((n),-1,sizeof(n))
#define unset unordered_set
#define ii pair<int, int>
#define vii vector<ii>
#define F first
#define S second
#define mp make_pair
#define PB push_back
#define ALL(x) begin(x),end(x)
#define SZ(x) ((int)(x).size())
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
#define reset(x, y) memset(x, y, sizeof(x))
#define uni(x) (x).erase(unique(all(x)), (x).end());
#define debug(x) cout << #x << " = " << (x) << endl
#define debug2(x, y) cout<<#x<<" = "<<(x)<<", "<<#y<<" = "<<(y)<< endl
#define debug3(x, y, z) cout<<#x<<" = "<<(x)<<", "<<#y<<" = "<<(y)<<", "<<#z<<" = "<<(z)<<endl
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)
#define max3(a, b, c) max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c) min(a, b) < min(b, c) ? min(a, b) : min(b, c)

//permanent constants
const long long INF64 = 1e18; const int INF32 = 1e9; const int BIG = (int)(1e9 + 239);
const int MOD = 998244353; //1e9 + 7;  const ll MOD2 = (ll)MOD * (ll)MOD;
const double PI = 2.0*acos(0.0); //acos(-1.0L);
const double EPS = static_cast<double>(1e-10);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int dx[4] = {0, 1, 0, -1}; const int dy[4] = {1, 0, -1, 0};
//const ll INF = (ll)(1e18 + 239);

//random
mt19937 rnd(239); //(chrono::high_resolution_clock::now().time_since_epoch().count());

void FILEIO() {  freopen("in.txt", "r", stdin);  freopen("out.txt", "w", stdout); }
//void FILEIO()   {freopen("in.txt", "w", stdout);}
//void FILEIO() {  freopen("namenum.in", "r", stdin);  freopen("namenum.out", "w", stdout); }
void input() {   }

int cost[10][10][10][10]; // cost[s][k][x][y] = min cost to get k from s, with counter x - y 


void solve() {
	int k, x; cin >> k >> x;
	FORE(i, x-k+1, x+k-1) cout << i << " ";
	cout << endl;
}

signed main() {
  ios_base::sync_with_stdio(false); cin.tie();
//  FILEIO();
//auto beginProgram = chrono::steady_clock::now();

//	int const T=10, N = 100000;
//	cout << T << endl;
//	FOR(i, 0, T) {
//		cout << N << endl;
//		FOR(i, 0, N) cout << "0 " ;
//		cout << endl;
//	}

//  int test = 0;
//  int t; cin >> t;
//  while(t--)
  {
//	  cout << "Case " << ++test << ": ";
	  solve();
  }

//  auto endProgram = chrono::steady_clock::now();
//  cout << chrono::duration_cast<chrono::milliseconds>(endProgram - beginProgram).count() << " ms" << endl;

  return 0;
}



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

typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;
#define pb push_back
#define rep(i,a,b) for (int i = a; i < b; i++)


int main(){
	string s, s1;
	cin >> s >> s1;

	s1.pop_back();

	if (s==s1) cout << "Yes";
	else cout << "No";


	return 0;
}


Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int main(void){
 int N,K,P;
 cin >> N;
 for (int i = 0; i < N; i++) {
     cin >> K >> P;
     if (K % P) {
         cout << K % P << endl;
     }
     else {
         cout << P << endl;
     }
 }
}


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

int main() {
	long n;
	while(cin>>n) {
		if(!n) break;
		long long cnt=0;
		for(long i=0;i<n;i++) {
			int x,y,h,w; cin >> x >> y >> h >> w ;
			int v=x+y+h;
			if(v<=60 && w<=2) cnt+=600;
			else if(v<=80 && w<=5) cnt+=800;
			else if(v<=100 && w<=10) cnt+=1000;
			else if(v<=120 && w<=15) cnt+=1200;
			else if(v<=140 && w<=20) cnt+=1400;
			else if(v<=160 && w<=25) cnt+=1600;
		}
		cout << cnt << '\n' ;
	}
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
//cin.tie(0);ios::sync_with_stdio(false);

signed main()
{
    int a = 0, b = 0, ans = 0,cnt=1;
    cin >> a >> b;
    if(b==1){
        cout<<0<<endl;
        return 0;
    }

    for (int i = 1; ; i++)
    {
        cnt+=a-1;
        ans++;
        if(cnt>=b)break;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int x,y,z;
  cin>>x>>y>>z;
  cout<<(x-z)/(y+z)<<endl;
}


Measured memory_bytes: 256