akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author khokharnikunj8
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int m = in.scanInt();
            boolean flag = true;
            String s = in.scanString();
            for (int i = 0; i < n; i++) if (!Character.isDigit(s.charAt(i))) flag = false;
            if (s.charAt(n) != '-') flag = false;
            for (int i = n + 1; i < n + m + 1; i++) if (!Character.isDigit(s.charAt(i))) flag = false;
            if (flag) out.println("Yes");
            else out.println("No");
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        public String scanString() {
            int c = scan();
            if (c == -1) return null;
            while (isWhiteSpace(c)) c = scan();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = scan();
            } while (!isWhiteSpace(c));
            return res.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  int rt = 0;
  cin >> A >> B;
  for (int i = A; i <= B; i++) {
    string str = to_string(i);
    string copy(str);
    reverse(str.begin(), str.end());
    if (copy == str){
    rt++;}
  }
 cout << rt << endl;
}

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

int count(vector<int> &A) {
  int cnt = 0;
  for (int i = 0; i < A.size(); i++) {
    if (A.at(i) % 2 == 0) {
      A.at(i) /= 2;
    }
    else {
      cnt = 1;
      break;
    }
  }
  if (cnt == 1) return 0;
  else return 1;
}

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int out = 0;
  while (count(A) ==1 ) {
    out++;
  }
  cout << out;
}


Measured memory_bytes: 256
//love yjl forever
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int INF=0x3f3f3f3f;
int n;
string s;
bool ok(string x)
{
	bool f=1;
	for(int i=0;i<x.size();i++)
	{
		if(x[i]!=x[x.size()-1-i]) f=0;
	}
	return f;
}
int main()
{
/*	freopen("","r",stdin);
	freopen("","w",stdout);*/
	int i;
	cin>>s;
	n=s.size();
	if(ok(s)&&ok(s.substr(0,(n-1)/2))&&ok(s.substr((n+3)/2-1,(n-(n+3)/2+1) ) ))
		cout<<"Yes"<<endl;
	else 
		cout<<"No"<<endl;
}

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

int main(){
    using namespace std;
    cout << []{
        using fp = atcoder::static_modint<998244353>;
        const unsigned long N{[]{unsigned long ret; cin >> ret; return ret;}()};
        const auto semifact{[&N]{
            vector<fp> ret(N + 1);
            ret[0] = 1;
            for(unsigned long i{1}; i <= N; ++i)ret[i] = ret[i - 1] * (2 * i - 1);
            return ret;
        }()};
        vector<fp> r{[&N, &semifact]{
            const auto fact{[&N]{
                vector<fp> ret(2 * N + 1);
                ret[0] = 1;
                for(unsigned long i{1}; i <= 2 * N; ++i)ret[i] = ret[i - 1] * i;
                return ret;
            }()};
            const auto ifact{[&N, &fact]{
                vector<fp> ret(2 * N + 1);
                ret.back() = 1 / fact.back();
                for(unsigned long i{2 * N}; i--; )ret[i] = ret[i + 1] * (i + 1);
                return ret;
            }()};
            const auto& binom{[&fact, &ifact](const unsigned long n, const unsigned long r) -> fp {
                return ifact[r] * ifact[n - r] * fact[n];
            }};
            const auto& comp{[](const vector<fp>& a, const vector<fp>& b) -> bool {
                return a.size() == b.size() ? &a < &b : a.size() > b.size();
            }};
            priority_queue<vector<fp>, vector<vector<fp>>, decltype(comp)> pq(comp, move([&N, &binom, &semifact]{
                vector<unsigned long> hist(100000);
                for(unsigned long i{0}, h; i < 2 * N; ++i){
                    cin >> h;
                    ++hist[h - 1];
                }
                vector<vector<fp>> ret;
                for(const auto& i : hist)if(i){
                    const auto& sz{i / 2 + 1};
                    vector<fp> tmp(sz);
                    for(unsigned long j{0}; j < sz; ++j)tmp[j] = binom(i, 2 * j) * semifact[j];
                    ret.emplace_back(move(tmp));
                }
                return ret;
            }()));
            while(pq.size() > 1){
                vector<fp> f{pq.top()};
                pq.pop();
                vector<fp> g{pq.top()};
                pq.pop();
                pq.emplace(move(atcoder::convolution(move(f), move(g))));
            }
            return pq.top();
        }()};
        fp ret{0};
        for(unsigned long i{size(r)}; i--;)ret = r[i] * semifact[N - i] - ret;
        return ret.val();
    }() << endl;
    return 0;
}


Measured memory_bytes: 10476
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#include<stack>
#include<queue>
#include <cassert>
using namespace std;

 
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

signed main()
{
  int k;
  scanf("%d",&k);


  int x = 0, y = 0;
    for( int i = 2; i <=  k; i += 2 ){
      x += 1;
    }

    for( int i = 1; i <= k; i += 2 ){
      y += 1;
    }

  printf("%d\n",x * y);

  return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll dp[101010][3];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		if(i==0) {
			cin>>dp[i][0]>>dp[i][1]>>dp[i][2];
		}
		else {
			int X[3];
			cin>>X[0]>>X[1]>>X[2];
			dp[i][0]=max({dp[i-1][1]+X[0],dp[i-1][2]+X[0]});
			dp[i][1]=max({dp[i-1][0]+X[1],dp[i-1][2]+X[1]});
			dp[i][2]=max({dp[i-1][0]+X[2],dp[i-1][1]+X[2]});
		}
	}
	cout<<max({dp[N-1][0],dp[N-1][1],dp[N-1][2]})<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 2560
/******************************************
* AUTHOR : RAJAGOPALAN *
* NICK : ARNO *
* INSTITUTION : VIT *
******************************************/
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define alli(a, n, k) (a+k),(a+n+k)
#define FP(i, a, b, k) for(__typeof(a) i = a;i < b;i += k)
#define FS(i, a, b, k) for(__typeof(a) i = a;i > b;i -= k)
#define IT(it, a) for(__typeof(a.begin()) it = a.begin();it != a.end(); ++it)
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template<class T> inline T gcd(T x, T y) { if (!y) return x; return gcd(y, x%y);}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector< pair<int, int> > VPII;
typedef vector< pair<int, PII > > VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
    return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
    assert(__gcd(a, m) == 1);
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;

        m = a % m, a = t;
        t = y;

        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
    if (y == 0)
        return 1LL;
    else if (y == 1)
        return x;
    else
    {
        ll ans = modPow(x, y / 2, m) % m;
        if (y & 1)
        {
            return (((ans * ans) % m) * x) % m;
        }
        else
        {
            return (ans * ans) % m;
        }
    }
}

int main(int argc, char* argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,a,b;
    cin>>n>>a>>b;
    cout<<min(n*a,b);
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
li_q = list()
for i in range(m):
    li_q.append(tuple(input().split()))

ac_count = 0
wa_count = 0

s_ac = set()
d_wa = dict()
for l in li_q:
    if l[1] == 'AC':
        if l[0] not in s_ac:
            s_ac.add(l[0])
            ac_count += 1
            wa_count += d_wa.get(l[0], 0)
        else:
            pass
    elif l[1] == 'WA':
        d_wa[l[0]] = d_wa.get(l[0], 0) + 1

print(ac_count, wa_count)


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

#define uint unsigned int
#define int long long
#define ull unsigned long long
#define ld long double
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define ret(a) return cout<<a,0;
using namespace std;
int n , m , d , ans , l =1; 
int a , b;

main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	cin >> a >> b;
	if( a > 0)
		puts("Positive");
	else if(b < 0){
		a = abs(a);
		b = abs(b);
		int tmp = b - a ;
		if(tmp & 1)
			puts("Positive");
		else 
			puts("Negative");
	}
	else
		puts("Zero");
		 
}

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

#define SIZE 2000000

int myatoi(const char* p)
{
  int n;
  while (*p!='\n' && *p!='\r') {
    n = n*10+*p-'0';
    p++;
  }
  return n;
}

int main() {
  int A[SIZE];
  int H=0;
  int i, l, largest, tmp;
  char com[21];
  do {
    fgets(com, 20, stdin);
    if (com[0] == 'i') {
      A[++H] =atoi(com+7);
      for (i=H; i>1 && A[i/2]<A[i];i/=2) {
        tmp = A[i/2];
        A[i/2] = A[i];
        A[i] = tmp;
      }

    } else if (com[1]=='x') { // extract
      printf("%d\n", A[1]);
      A[1] = A[H];
      i = 1;
      while (1) {
        l = i*2;
        largest = i;
        if (l < H && A[l] > A[i])        largest = l;
        if (l+1 < H && A[l+1] > A[largest])  largest = l+1;
        if (largest == i) break;
        tmp = A[i];
        A[i] = A[largest];
        A[largest] = tmp;
        i = largest;
      }
      H--;
    }
  } while (com[2]!='d');
  return 0;
}


Measured memory_bytes: 5620
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(char &c){
  int i;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i;
  int sz = 0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
int N;
char S[102];
char T[102];
int ress;
char res[202];
int main(){
  int i;
  rd(N);
  rd(S);
  rd(T);
  for(i=(0);i<(N);i++){
    res[ress++] = S[i];
    res[ress++] = T[i];
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200119-1

// --- original code ---
// int N; char S[102], T[102];
// int ress; char res[202];
// {
//   rd(N,S,T);
//   rep(i,N){
//     res[ress++] = S[i];
//     res[ress++] = T[i];
//   }
//   wt(res);
// }


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>

using namespace std ;
int main () {
  int N,X;
  int m[100];
  int cnt;
  cin >> N >> X;
  for(int i=0;i<N;i++) {
    cin >> m[i];
  }
  for(int i=0;i<N;i++) {
    X = X-m[i];
  }
  cnt = N;
  sort(m,m+N);
  cnt = cnt + X/m[0];
  cout << cnt << endl ;
  return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Printer{
    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T>
    void print(vector<T> v){
        rep(i, v.size()){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class T>
    void print(vector<vector<T> > vv){
        rep(i, vv.size()){
            rep(j, vv[i].size()){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void print(pair<int, int> p){
        cout << "(" << p.first << ", " << p.second << ")" << endl;
    }
};
using namespace Printer;

//--global--//

vector<ll> sum(vector<ll> x, vector<ll> y){
    rep(i, x.size()){
        x[i] += y[i];
    }
    return x;
}

vector<ll> calc(int h, int w, int x, string out){
    vector<ll> res(3);
    if(out.size() == w-1){
        // print(out);
        if(x-1 >= 0){
            if(out[x-1] == '1'){
                res[0]++;
                return res;
            }
        }
        if(x <= out.size()-1){
            if(out[x] == '1'){
                res[2]++;
                return res;
            }
        }
        res[1]++;
        return res;
    }

    vector<ll> tmp;
    tmp = calc(h, w, x, out + '0');
    res = sum(res, tmp);
    if(out.size()==0 || out[out.size()-1] != '1'){
        tmp = calc(h, w, x, out+ '1');
        res = sum(res, tmp);
    }
    return res;
} 


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

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<ll> > dp(h+1, vector<ll>(w));
    rep(i, h){
        fill(ALL(dp[i]), 0);
    }
    dp[0][0] = 1;

    rep2(i, 0, h){
        // print("-"+to_string(i));
        rep(j, w){
            string foo = "";
            vector<ll> tmp = calc(h, w, j, foo);
            // print(tmp);
            if(j-1>=0){
                dp[i+1][j-1] += dp[i][j] * tmp[0];
                dp[i+1][j-1] %= MOD;
            }
            if(j+1 <= w-1){
                dp[i+1][j+1] += dp[i][j] * tmp[2];
                dp[i+1][j+1] %= MOD;
            }
            dp[i+1][j] += dp[i][j] * tmp[1];
            dp[i+1][j] %= MOD;

        }
    }
    // print("dp");
    // print(dp);
    // print("res");
    print(dp[h][k-1]);
    
    
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#define MAX 100000

int  partition(int,int);
int a[MAX];

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

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

  m=partition(0,n-1);

  for(i=0;i<n;i++){
    if(i>0) printf(" ");
    if(i==m) printf("[");
    printf("%d",a[i]);
    if(i==m) printf("]");
  }
  printf("\n");

  return 0;
}

int partition(int x,int y){
  int l,m,i,j;
  l=a[y];
  i=x-1;
  for(j=x;j<y;j++){
    if(a[j]<=l){
      i++;
      m=a[i];
      a[i]=a[j];
      a[j]=m;
    }
  }
  m=a[i+1];
  a[i+1]=a[y];
  a[y]=m;
  
  return i+1;
}



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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll K, N;
    cin >> K >> N;
    vec A(N);
    REP(i,0,N) cin >> A[i];

    ll min = K;
    REP(i,0,N-1) min = MIN(min,K-(A[i+1]-A[i]));
    min = MIN(min,A[N-1]-A[0]);
    PR(min);

    return 0;
}

/*



*/

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

int main() {
	// your code goes here
	int n;
	cin>>n;
	int A[n+1];
	
	
	map<int, int> contains;
	for(int i = 1; i <= n; i++) {
		cin>>A[i];
		contains[A[i]]++;
	}
	
	
	if(contains[1] == 1) {
		cout<<1<<endl;
		return 0;
	}
	
	sort(A+1, A+n+1);
	
	

int count = 0;	
	for(int i = n; i >= 1;  i--) {
		
		bool isSpecial = true;
		for(int j = 1; j*j <= A[i]; j++) {
			
			if(A[i] % j == 0) {
			int a = A[i]/j;
			int b= j;
			
			if(a == A[i]) {
				if(contains[b] > 0 || contains[a] > 1) {
									isSpecial = false;
									break;
				}
			} else {
			// cout<<a<<" "<<b<<endl;
			if(contains[a] > 0 || contains[b] > 0) {
				isSpecial = false;
				break;
			}
			}
			}
		}
		
		if(isSpecial) {
			count++;
		}
		
	}
	
	cout<<count<<endl;
	
	return 0;
}

Measured memory_bytes: 33176
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

typedef long long ll;

long long inv(int a, int p) { return a==1 ? 1 : (1-p*inv(p%a,a))/a+p; }
static const int MODVAL = 1000000007;
struct mint {
  int val;
  mint():val(0){}
  mint(int x):val(x%MODVAL) { if(val<0) val+= MODVAL; }
  mint(size_t x):val(x%MODVAL) {}
  mint(long long x):val(x%MODVAL) { if(val<0) val+= MODVAL; }
  mint& operator+=(mint y) { val+=y.val; if(val>=MODVAL) val-=MODVAL; return *this; }
  mint& operator-=(mint y) { val-=y.val; if(val<0) val+= MODVAL; return *this; }
  mint& operator*=(mint y) { val=(val*(long long)y.val)%MODVAL; return *this; }
  mint& operator/=(mint y) { val=(val*inv(y.val,MODVAL))%MODVAL; return *this; }
};
inline mint operator+(mint x, mint y) { return x+=y; }
inline mint operator-(mint x, mint y) { return x-=y; }
inline mint operator*(mint x, mint y) { return x*=y; }
inline mint operator/(mint x, mint y) { return x/=y; }
mint POW(mint x, long long n) { mint r(1); for(;n;x*=x,n>>=1) if(n&1) r*=x; return r; }
mint FAC(int n) { static vector<mint> FAC_(1,1);
  while(int(FAC_.size())<=n) FAC_.push_back(FAC_.back()*FAC_.size()); return FAC_[n]; }
inline mint CMB(int n, int k) { return k<0||n<k ? 0 : FAC(n) / (FAC(k) * FAC(n-k)); }
inline ostream& operator<<(ostream& os, mint a) { return os << a.val; }

ll vs[100000+10];

int main(void) {
  int N, K;
  scanf("%d%d", &N, &K);
  REP(i, N) {
    scanf("%lld", &vs[i]);
  }
  sort(vs, vs + N);
  mint res = 0;
  REP(i, N) {
    mint forMin, forMax;
    forMin = CMB(N-i-1, K-1);
    res -= vs[i] * forMin;
    forMax = CMB(i, K-1);
    res += vs[i] * forMax;
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 1660
#include <iostream>
#include <vector>
#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()
{
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(q);
    vector<int> ans(n);
    rep(i, q){
        cin >> a[i];
    }
    rep(i, n){
        ans[i] = k - q;
    }
    rep(i, q){
        ans[a[i]-1]++;
    }
    rep(i, n){
        if(ans[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
K = int(input())

A = 7
ans = 1

while ans <= K:
  if K % 2 == 0 or K % 5 == 0:
    print('-1')
    break
  if A % K == 0:
    print(ans)
    break
  A = (A * 10 + 7) % K
  ans = ans + 1





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

long gdb(long ma, long mi) {
	if (ma%mi) {
		return gdb(mi, ma%mi);
	} else {
		return mi;
	}
}

int main() {
	long N, X;
	cin >> N >> X;
	long x;
	cin >> x;
	long s = abs(X-x);
	for (int i = 1; i < N; i++) {
		cin >> x;
		long tmp = abs(X-x);
		long under, up;
		if (s > tmp) {
			up = s;
			under = tmp;
		} else {
			up = tmp;
			under = s;
		}
		s = gdb(up, under);
	}
	cout << s << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	var sum int
	scores := make([]int, n)
	for i := range scores {
		fmt.Scan(&scores[i])
		sum += scores[i]
	}

	ans := availableScore(sum, scores)
	fmt.Println(ans)
}

func availableScore(max int, scores []int) int {
	if bugCal(max) != 0 {
		return max
	}
	sort.Ints(scores)
	for _, s := range scores {
		available := max - s
		if bugCal(available) != 0 {
			return available
		}
	}
	return 0
}

func bugCal(score int) int {
	if score%10 == 0 {
		return 0
	}
	return score
}


Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
    int n;
    int data[101];
    cin>>n;
    for(int i=0;i<n;i++){
        scanf("%d",&data[i]);
    }
    for(int i=0;i<n-1;i++){
        printf("%d ",data[i]);
    }printf("%d\n",data[n-1]);
    
    for(int i=1;i<n;i++){
        int v = data[i];
        int j = i-1;
        while(j >= 0 && data[j] > v){
            data[j+1] = data[j];
            j--;
        }
        data[j+1]=v;
        for(int i=0;i<n-1;i++){
            printf("%d ",data[i]);
        }printf("%d\n",data[n-1]);
    }
}


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

int main(){
	char str[1005];
	int counter=0;
	scanf("%s", str); getchar();
	int len=strlen(str);
	for(int i=0; i<len; i++){
		if(str[i]!=str[len-1]){
			counter++;
		}
		len--;
	}
	//printf("counter: %d", counter);
	if(counter==0){
		printf("Yes\n");
	}
	else{
	printf("No\n");}
	return 0;
}

Measured memory_bytes: 256
/**
 * @author torith
 * @date 2018-10-10
 */

#include <bits/stdc++.h>

using namespace std;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int H,W;
    cin >> H >> W;

    char s[50][50];
    for (int i = 0; i < W; ++i) {
        for (int j = 0; j < H; ++j) {
            cin >> s[j][i];
        }
    }

    for (int i = 0; i < W; ++i) {
        for (int j = 0; j < H; ++j) {
            if (s[j][i] == '#'){
                if(j != 0 && s[j-1][i] == '#') continue; // 上
                else if(j != W-1 && s[j+1][i] == '#') continue; // 下
                else if(i != 0 && s[j][i-1] == '#') continue;   // 左
                else if(i != H-1 && s[j][i+1] == '#') continue; // 右
                cout << "No" << "\n";
                return 0;
            }
        }
    }
    cout << "Yes" << "\n";

    return 0;
}



Measured memory_bytes: 256
/**
 * author  : UshanGhosh
 * created : 2020-09-20 15:01:00
**/ 

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

#define    ll      long long
#define    pii     pair<int,int>
#define    vii     vector<int>
#define    vcc     vector<char>
#define    pll     pair<long long, long long>
#define    mem     memset
#define    sof     sizeof
#define    co1     __builtin_popcountll
#define    PB      push_back
#define    UB      upper_bound
#define    LB      lower_bound
#define    MP      make_pair
#define    TS      to_string
#define    F       first
#define    S       second
#define    pi      acos(-1)
#define    mod     (int)1e9+7
#define    inf     (long long)1e18
#define    endl    '\n'

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    long long a,b,c,d,e,f,i,j,k,m,n,o,x,y;
    ll tar;
    cin>>tar;
    if(tar<3){
      cout<<0<<'\n';
      return 0;
    }
    vii v;
    for(i=3;i<=tar;i++) v.PB(i);
    n = v.size();
    ll ar[tar+1];
    memset(ar,0,sizeof(ar));
    ar[0] = 1;
    for(i=3;i<=tar;i++){
        for(j=0;j<n;j++){
            if(i-v[j]>=0){
                ar[i] += ar[i-v[j]];
                ar[i]%=mod;
            }
        }
    }
    cout<<ar[tar]<<"\n";
}

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

#include <map>
#include <set>
#include <algorithm>
#include <vector>
using namespace std;


#define int unsigned long long

signed main()
{
    vector <int > d;
    
    int a,b,c;
    cin >> a >> b >> c;
    
    if(a%2==0 || b%2==0 || c%2==0)
    {
        cout << 0 << endl;
    }
    else
    {
        d.push_back(a);
        d.push_back(b);
        d.push_back(c);
        sort(d.begin(),d.end());
        
auto itr =         d.begin();
        auto itrr = itr;
        itr ++ ;
        
        cout << *itrr * *itr<< endl;
    }
    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            long power = 1;

            for(int i = 1; i <= N; i++)
            {
                power *= i;
                power %= (long)Math.Pow(10,9)+7;
            }

            Console.WriteLine(power);
        }
    }
}


Measured memory_bytes: 11092
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

STEP = [-1,0,1]

def main():
    K = int(input())

    if K < 10:
        print(K)
        exit()

    l = [x for x in range(1,10)]
    c = 9

    while True:
        nxt = []
        for x in l:
            tail = int(str(x)[-1])
            for diff in STEP:
                if tail + diff >= 0 and tail + diff < 10:
                    c += 1
                    nxt.append(int(str(x) + str(tail + diff)))
                    if c == K:
                        print(nxt[-1])
                        exit()
        l = nxt



if __name__ == "__main__":
    main()

Measured memory_bytes: 6068
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <utility>
#include <random>
#include <chrono>

using namespace std;

#define ll long long

int n;
ll a[2005];

ll f[2005][2005];
int idx[2005];

ll absolute(ll val)
{
    return val < 0LL ? -val : val;
}

bool cmp(int A, int b)
{
    return a[A] > a[b];
}

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%lld", a + i); idx[i] = i;
    }
    sort(idx + 1, idx + n + 1, cmp);
    for (int i = 0; i < n; i++) {
        ll curactive = a[idx[i+1]];
        ll curpos = idx[i+1];
        for (int l = 0; l <= i; l++) {
            int r = i - l;
            f[i+1][l+1] = max(f[i+1][l+1], f[i][l] + curactive * absolute(curpos - (l + 1)));
            f[i+1][l] = max(f[i+1][l], f[i][l] + curactive * absolute(curpos - (n - r)));
        }
    }
    ll ans = 0;
    for (int i = 0; i <= n; i++) ans = max(ans, f[n][i]);
    printf("%lld", ans);
    return 0;
}


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

using namespace std;

int main()
{
  int s,sum=0,a,b;
  cin>>s;
  int n=s;
  while(s){
    a=s%10;
    sum +=a;
    s /=10;
  }
  a=n%sum;
  if(a==0) cout<<"Yes"<<endl;
  else {cout<<"No"<<endl;}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;

const int N = 200005;

int main(){
    int n;
    long long t;
    cin >> n >> t;

    pair<long long,long long> p[N];
    rep(i,n){
        long long a;
        cin >> a;
        p[i] = make_pair(a,a + t);
    }

    vector<pair<long long,long long>> v;
    v.emplace_back(p[0]);
    range(i,1,n){
        if(v.back().second >= p[i].first){
            v.back().second = p[i].second;
        }else{
            v.emplace_back(p[i]);
        }
    }

    long long sum = 0;
    for(auto it:v){
        sum += it.second - it.first;
    }
    cout << sum << endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int X,Y,Z;
  cin>>X>>Y>>Z;
  X-=Y+2*Z;
  int ans=1;
  ans+=X/(Y+Z);
  cout<<ans;
  }


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0

using namespace std;

vector<string> grid;
int h, w, n;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
string s, t;
struct Point{int x; int y;};

bool die(Point p)
{
    if(min(p.x, p.y) < 1 || p.x > h || p.y > w) return true;
    return false;
}

int s_offset[100];
int t_offset[100];

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int x, y;
    cin >> h >> w >> n >> x >> y >> s >> t;
    
    for(int i = 0; i < s.size(); i++)
    {
        int s_idx = s[i] - 'A';
        int t_idx = t[i] - 'A';
        s_offset[s_idx] += 1;
        
        
        
        // go right
        if(die(Point{x, y + s_offset['R'-'A'] - t_offset['L'-'A']}))
        {
            cout << "NO" << endl;
            return 0;
        }
        
        // go left
        if(die(Point{x, y - s_offset['L'-'A'] + t_offset['R'-'A']}))
        {
            cout << "NO" << endl;
            return 0;
        }
        
        //go down
        if(die(Point{x + s_offset['D'-'A'] - t_offset['U'-'A'], y}))
        {
            cout << "NO" << endl;
            return 0;
        }
        
        // go up
        if(die(Point{x - s_offset['U'-'A'] + t_offset['D'-'A'], y}))
        {
            cout << "NO" << endl;
            return 0;
        }
        
        
        t_offset[t_idx] += 1;
        
        
        int offset = min(s_offset['L'-'A'], t_offset['R'-'A']);
        s_offset['L'-'A'] -= offset;
        t_offset['R'-'A'] -= offset;
        
        offset = min(s_offset['R'-'A'], t_offset['L'-'A']);
        s_offset['R'-'A'] -= offset;
        t_offset['L'-'A'] -= offset;
        
        offset = min(s_offset['U'-'A'], t_offset['D'-'A']);
        s_offset['U'-'A'] -= offset;
        t_offset['D'-'A'] -= offset;
        
        offset = min(s_offset['D'-'A'], t_offset['U'-'A']);
        s_offset['D'-'A'] -= offset;
        t_offset['U'-'A'] -= offset;
        
        
        
        
        
        
        if(t[i] == 'L')
        {
            if(y - t_offset[t_idx] < 1)
            {
                t_offset[t_idx] -= 1;
            }
        }
        else if(t[i] == 'R')
        {
            if(y + t_offset[t_idx] > w)
            {
                t_offset[t_idx] -= 1;
            }
        }
        else if(t[i] == 'U')
        {
            if(x - t_offset[t_idx] < 1)
            {
                t_offset[t_idx] -= 1;
            }
        }
        else if(t[i] == 'D')
        {
            if(x + t_offset[t_idx] > h)
            {
                t_offset[t_idx] -= 1;
            }
        }
        
        
    }
    
    
    
    
    cout << "YES" << endl;

    return 0;
}


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

int main(void)
{
    char s[101] = {0};
    int len = 0;

    scanf("%s", s);
    
    len = strlen(s);
   
    printf("\%c\%d\%c\n", s[0], len - 2, s[len - 1]);
    return 0;
    
}

Measured memory_bytes: 128
#include "cstring"
#include "math.h"
#include "iostream"

using namespace std;

int main()
{
	int a, b;

	cin >> a >> b;
	if (a % 2 == 0)
		cout << "No";
	else if(b%2==0)
		cout << "No";
	else cout << "Yes";
	
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

int main() {
    int n, k;
    cin >> n >> k;

    int cnt = 0;
    while(0 < n){
        n = n / k;
        cnt++;
    }
    OP(cnt);
}


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

int main() {
        int N;
        string S;
        cin >> N >> S;
        int rc, bc;
        rc = bc = 0;
        for (int i=0; i<N; ++i) {
                if (S[i] == 'R') {
                        rc++;
                } else {
                        bc++;
                }
        }
        if (rc > bc) {
                cout << "Yes";
        } else {
                cout << "No";
        }
        cout << endl;
        return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
from collections import Counter

n,q = map(int,input().split())

d = {}

for i in range(n-1):
    _a,_b = map(int,input().split())
    d[_b] = _a

ans = [0]*n

for i in range(q):
    _p,_x = map(int,input().split())
    ans[_p-1]+=_x


for i in range(1,n):
    ans[i] += ans[d.get(i+1)-1]

#print(ans)
print(" ".join(map(str,ans)))

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

int parent(int);
int left(int);
int right(int);
void maxHeapify(int *,int);
void buildMaxHeap(int *);

int N;

int main(){
  int i,p,l,r;

  scanf("%d",&N);
  int *ARRAY;
  ARRAY=(int *)malloc(sizeof(int)*N);

  for(i=1;i<=N;i++){
    scanf("%d",&ARRAY[i]);
  }

  buildMaxHeap(ARRAY);

  for(i=1;i<=N;i++){
    printf(" %d",ARRAY[i]);
  }
  printf("\n");

  return 0;
}

void buildMaxHeap(int *x){
  int i;
  for(i = N/2;i>=1;i--){
    maxHeapify(x, i);
  }
}

void maxHeapify(int *x,int i){
  int largest,l,r,a;
  l = left(i);
  r = right(i);
  // ????????????????????????????????§???????????§????????????????????¶
  if(l <= N && x[l] > x[i]){
    largest = l;
  }
  else {
    largest = i;
  }
  if(r <= N && x[r] > x[largest]){
    largest = r;
  }

  if(largest != i){ // i ???????????????????????§????????´???
    //  A[i] ??¨ A[largest] ?????????
    a=x[i];
    x[i]=x[largest];
    x[largest]=a;
    maxHeapify(x, largest); // ?????°??????????????????
  }
}

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i + 1;
}

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

int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> V(N);
  for (int i = 0, x, y; cin >> x >> y; i++) V.at(i) = {x, y};
  
  sort(V.begin(), V.end());
  
  int cnt = 0;
  long double sum = 0;
  do {
    for (int i = 0; i + 1 < N; i++) {
      sum += hypot(V.at(i).first - V.at(i + 1).first, V.at(i).second - V.at(i + 1).second);
    }
    cnt++;
  } while (next_permutation(V.begin(), V.end()));

  cout << fixed << setprecision(100) << sum / cnt << "\n";
}

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

using namespace std;

#define int long long

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

#define MAX_N 500005

using vint = vector<int>;
using Graph = vector<vint>;

int n;
Graph graph;

int dp1[MAX_N];
void dfs1(int u) {
  dp1[u] = 2-graph[u].size();
  for(int v : graph[u]) {
    dfs1(v);
    dp1[u] += dp1[v];
  }
}

int dp2[MAX_N];
int depth[MAX_N];
void dfs2(int u) {
  dp2[u] = dp1[u];
  for(int v : graph[u]) {
    //dp2[v] += dp2[u] + dp1[v];
    depth[v] = depth[u] + 1;
    dfs2(v);
    dp2[u] += dp2[v];
  }
}

int dp3[MAX_N];
void dfs3(int u) {
  for(int v : graph[u]) {
    dfs3(v);
  }
  if(graph[u].size() == 2) {
    int l = graph[u][0], r = graph[u][1];
    //dp3[u] = max({dp3[l]+dp3[r], dp3[l]+dp2[u]-depth[u], dp3[r]+dp2[u]-depth[u]});
    dp3[u] = min({dp3[l]+1+dp3[r]+1+depth[u], dp3[l]+1+dp2[r]+dp1[r], dp2[l]+dp1[l]+dp3[r]+1});
  } else if(graph[u].size() == 1) {
    int ch = graph[u][0];
    //dp3[u] = max({dp3[ch], dp2[u]-depth[u]});
    dp3[u] = min({dp3[ch]+1+1+depth[u], dp3[ch]+1+1, 1+dp2[ch]+dp1[ch]});
  } else {
    dp3[u] = dp1[u];//dp2[u]-depth[u];
  }
}

signed main() {
  cin >> n;
  graph.resize(n);
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    if(a != n-1) graph[i].push_back(a);
    if(b != n-1) graph[i].push_back(b);
  }
  dfs1(0);
  dfs2(0);
  dfs3(0);
  int leaf = 0;
  rep(i, n-1) leaf += 2-graph[i].size();
  /*
  int sum = leaf;
  reps(i, 1, n-1) sum += dp1[i];
  int ans = 0;
  rep(i, n-1) ans = max(ans, dp3[i]);
  //cout << sum << " " << ans << endl;
  cout << sum - ans << endl;
  */
  cout << dp3[0] << endl;

  return 0;
}



Measured memory_bytes: 69296
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(int i =(a);i<(n);i++)
#define urep(i,a,n) for(int i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;

ll W, H, N,ans,a,b,w,n,m,d;
ll A[200000];
vector<int> v;
string s;
int main() {
	cin >> N;
	ans = 0;
	rep(i, 0, N)cin >> A[i];
	rep(i, 1, N) {
		if (A[i - 1] == A[i]) {
			ans++;
			A[i] = -1;
		}
	}
	cout << ans << endl;
	cin >> ans;
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i,n) cin >> h[i];
	reverse(h.begin(), h.end());
	int ans = 0;
	int val = 0;
	for (int i = 1; i < n; i++) {
		if (h[i-1] <= h[i]) val++;
		else val = 0;
		ans = max(ans, val);
	}
	
	cout << ans << endl;
	return 0;
	
}

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

using namespace std;

constexpr int MAXS = 10;

char S[MAXS + 2], T[MAXS + 2], U[MAXS + 2];

int main() {
	int A, B;
	cin >> S >> T >> A >> B >> U;
	if(strcmp(S, U) == 0) --A;
	if(strcmp(T, U) == 0) --B;
	cout << A << ' ' << B << '\n';
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 10000

int main(){
    
    int x;
    
    for(int i = 1;i < MAX + 1;i++){
        scanf("%d",&x);
        if(x==0)
            break;
        printf("Case %d: %d\n",i,x);
    }
    return 0;
}

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

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

#define rep(i, s, n) for (Int i = s; i < (Int)(n); i++)
#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
double EPS = 1e-10;
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int n, m;
    cin >> n >> m;
    vector<Int> a(m);
    rep(i, 0, m) cin >> a[i];
    if (n >= m) {
        dump(0);
        return 0;
    }
    sort(all(a));
    vector<Int> b(m - 1);
    rep(i, 0, m - 1) b[i] = a[i + 1] - a[i];
    sort(all(b), greater<Int>());
    Int sub = 0;
    rep(i, 0, n - 1) sub += b[i];
    dump(accumulate(all(b), 0LL) - sub);
    return 0;
}

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

int main(){
    int N, M, C;
    cin >> N >> M >> C;
    int B[M+1];
    rep1(i, M) cin >> B[i];
    int A[N+1][M+1];
    rep1(i, N) rep1(j, M) cin >> A[i][j];

    int ans = 0;
    int sum;

    rep1(i, N){
        sum = 0;
        rep1(j, M){
            sum += A[i][j] * B[j];
        }
        sum += C;

        if(sum > 0) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
//#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int t1,x1,y1;
    int t,x,y;
    cin>>t1>>x1>>y1;
    if(t1-x1-y1<0||(t1-x1-y1)%2!=0)
    {
        for(int i=1; i<n; i++)
        {
            cin>>t>>x>>y;
        }
        cout<<"No"<<endl;
        return 0;
    }
    int flag=1;
    for(int i=1; i<n; i++)
    {
        cin>>t>>x>>y;
        if(flag==1)
        {
            t1=t-t1;
            x1=abs(x-x1);
            y1=abs(y-y1);
            if(t1-x1-y1<0||(t1-x1-y1)%2!=0)
            {
            	flag=0;
                cout<<"No"<<endl;
            }
            t1=t;
            x1=x;
            y1=y;
        }
    }
	if(flag==1){
		cout<<"Yes"<<endl;
	}




    return 0;
}


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

int max_n=100;
int main(){
  int h,w;
  std::cin >> h>>w;
  char a[max_n][max_n];
  bool han[max_n][max_n];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      /* code */
      han[i][j]=true;
    }
    /* code */
  }
  for (int i = 0; i < h; i++) {
    /* code */
    for (int j = 0; j < w; j++) {
      /* code */
      std::cin >> a[i][j];
    }
  }

  for (int i = 0; i < h; i++) {
    /* code */
    bool hoge=false;
    for (int j = 0; j < w; j++) {
      /* code */
      if(a[i][j]=='#')hoge=true;
    }
    if(not hoge){
      for (int j = 0; j < w; j++) {
        /* code */
        han[i][j]=false;
      }
    }
    
  }
  
  for (int i = 0; i < w; i++) {
    /* code */
    bool hoge=false;
    for (int j = 0; j < h; j++) {
      /* code */
      if(a[j][i]=='#')hoge=true;
    }
    if(not hoge){
      for (int j = 0; j < h; j++) {
        /* code */
        han[j][i]=false;
      }
    }
    
  }
  for (int i = 0; i < h; i++) {
    int j;
    bool hoge=false;
    for ( j = 0; j < w; j++) {
      /* code */
      if(han[i][j]){
        std::cout <<a[i][j];
        hoge=true;
      }
    }
    /* code */
    if(hoge)std::cout   << std::endl;
  }
  
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        
        while (true) {
            int a = sc.nextInt();
            char op = sc.next().charAt(0);
            int b = sc.nextInt();
            
            if (op == '?') {
                break;
            } else if (op == '+'){
                System.out.println(a + b);
            } else if (op == '-') {
                System.out.println(a - b);
            } else if (op == '*') {
                System.out.println(a * b);
            } else if (op == '/') {
                System.out.println(a / b);
            } else {
                System.out.println("error");
                break;
            }
        }
    }
}


Measured memory_bytes: 26400
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <sstream>
#include <complex>

using namespace std;

using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using iii = pair<int, ii>;
using viii = vector<iii>;

using ll = long long int;
using vc = vector<char>;
using vb = vector<bool>;
using ib = pair<int, bool>;
using vib = vector<ib>;

#define MOD 1000 * 1000 * 1000 + 7
#define INF 1000 * 1000 * 1000
#define EMPTY -10
#define mp(a, b) make_pair(a,b)



bool resuelveCaso() {
	int n;
	cin >> n;
	if (!cin) return false;
	int m;
	cin >> m;

	if (n == 2 || m == 2) cout << "No\n";
	else cout << "Yes\n";

	return true;
}



int main() {
	while (resuelveCaso()) {}
	return 0;
}

Measured memory_bytes: 256