akhauriyash/Code-Regression huggingface dataset:
#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>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


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

    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;

    return 0;
}


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

using namespace std;

#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define rep(i, n) reps(i, 0, (n))
#define all(v) (v).begin(), (v).end()

int main() {
    set<int> a, b, c;
    int n; cin >> n;
    while (n--) {
        int x; cin >> x; a.insert(x);
    }
    int m; cin >> m;
    while (m--) {
        int x; cin >> x; b.insert(x);
    }
    set_difference(all(a), all(b), inserter(c, c.begin()));
    for (auto& x : c) {
        cout << x << endl;
    }
}


Measured memory_bytes: 31192
#include<bits/stdc++.h>
#define cin std::ios::sync_with_stdio(false);cin
using namespace std;
int main()
{
	char a[105];
	int i,j,l;
	gets(a);
	l=strlen(a);
	for(i=0;i<l;i++)
	{
	for(j=i+1;j<l;j++)
	if(a[i]=='C'&&a[j]=='F')
	{
	cout<<"Yes";
	return 0;
	}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n, w;
    cin >> n >> w;
    vector<int> v(n);
    vector<int> u(n);
    REP(i, n) cin >> v[i] >> u[i];

    vector<int> dp(w + 1, 0);

    REP(i, w + 1) {
        REP(j, n) {
            if (i - u[j] >= 0) chmax(dp[i], dp[i - u[j]] + v[j]);
        }
    }
    int ans = 0;
    REP(i, w + 1) chmax(ans, dp[i]);
    cout << ans << endl;
}



Measured memory_bytes: 3212
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.io.InputStream;

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

    static class CLowElements {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            int n = s.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = s.nextInt();
            TreeSet<Integer> ts = new TreeSet<>();
            int res = 0;
            for (int i = 0; i < n; i++) {
                if (ts.isEmpty() || ts.first() >= a[i])
                    res++;
                ts.add(a[i]);
            }
            w.println(res);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 38000
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>	tree_set;
typedef long long ll;
typedef long double ld;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

ll mod=1e9 + 7;

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

    ll ans = max(a+b , max(a-b , a*b));
    cout<<ans;


}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
void a(vector<string> &A,string S,int j,int k){
  if(S.size()==k){
    A.push_back(S);
    return;
  }
  for(int i=-1;i<2;i++)
    if(0<=j+i && j+i<10)
      a(A,S+to_string(j+i),j+i,k);
}
signed main(){
  int K;
  cin>>K;
  vector<string> A(0);
  for(int j=1;j<=10;j++)
    for(int i=1;i<10;i++)
      a(A,to_string(i),i,j);
  cout<<A.at(K-1)<<endl;
}

Measured memory_bytes: 11696
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[]) {
  int X, Y, Z, K;
  std::cin >> X >> Y >> Z >> K;
  std::vector<long long> A(X);
  std::vector<long long> B(Y);
  std::vector<long long> C(Z);
  std::vector<long long> AB;
  std::vector<long long> ABt;
  std::vector<long long> ABC;
  for(int i=0;i<X;i++) std::cin >> A[i];;
  for(int i=0;i<Y;i++) std::cin >> B[i];;
  for(int i=0;i<Z;i++) std::cin >> C[i];;

  for(int i=0;i<X;i++){
    for(int j=0;j<Y;j++){
      AB.push_back(A[i] + B[j]);
    }
  }
  sort(AB.begin(), AB.end());
  reverse(AB.begin(), AB.end());
  for(int i = 0;i<min(X*Y, K);i++) ABt.push_back(AB[i]);
  for(int i=0;i<min(X*Y, K);i++){
    for(int j=0;j<Z;j++){
      ABC.push_back(ABt[i] + C[j]);
    }
  }
  sort(ABC.begin(), ABC.end());
  reverse(ABC.begin(), ABC.end());
  for(int i=0;i<K;i++) std::cout << ABC[i] << '\n';
  return 0;
}

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

int main() {
  int x;cin>>x;
  if(400<=x&&x<=599)cout<<8<<endl;
  else if(600<=x&&x<=799)cout<<7<<endl;
  else if(800<=x&&x<=999)cout<<6<<endl;
  else if(1000<=x&&x<=1199)cout<<5<<endl;
  else if(1200<=x&&x<=1399)cout<<4<<endl;
  else if(1400<=x&&x<=1599)cout<<3<<endl;
  else if(1600<=x&&x<=1799)cout<<2<<endl;
  else cout<<1<<endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <ctime>
#include <sstream>
#define weewoo ios::sync_with_stdio(false);cin.tie(0)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define ll long long
#define se second
#define fi first
#define ctoi(x) (x-'0')
#define pi (acos(-1))
#define llputin(a,n) for(int i=0;i<n;i++){ll x;cin >> x;a.push_back(x);}
#define iputin(a,n) for(int i=0;i<n;i++){int x;cin >> x;a.push_back(x);}

#define MOD ((ll) 1e9 + (ll) 7)
using namespace std;

ll pw(ll x,ll a){
    if(a==0)
        return 1;
    ll t = pw(x,a/2);
    if(a%2==0)
        return (t*t);
    else
        return (t*t*x);
}

bool prime(int x)
{
    if(x < 2) return false;
        for(int i=2; i<= sqrt(x); i++) {
            if ((x%i) == 0) return false;
        }
    return true;
}



int main()
{
    weewoo;
    string x,y;
    cin >> x >> y;
    cout << y << x << endl;
    return 0;
}


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

// 2 5
// 1 WA
// 2 AC
// 2 WA
// 1 AC
// 2 WA
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] firstArr = sc.nextLine().split(" ");
        System.out.println(solve(getInputAsArray(sc, firstArr[1])));
    }

    private static List<String[]> getInputAsArray(Scanner sc, String count) {
        List<String[]> result = new ArrayList<>();
        IntStream.range(0, Integer.parseInt(count)).forEach(i -> result.add(sc.nextLine().split(" ")));
        return result;
    }

    private static Long[] convertStrToInt(String[] strArray) {
        return Arrays.stream(strArray).map(e -> new Long(Long.parseLong(e))).toArray(Long[]::new);
    }

    private static long outputResult(long a, long b) {
        return LongStream.range(0, b).reduce((long) 0, (sum, i) -> sum += (Math.pow(10, i) * a));
    }

    private static String solve(List<String[]> input) {
        Map<String, Integer> map = new HashMap<>();
        Map<String, Boolean> acMap = new HashMap<>();

        input = input.stream().sorted((e1,e2)->e1[0].compareTo(e2[0])).collect(Collectors.toList());

        int acCountTotal = 0;
        int wcCount = 0;
        int wcCountTotal = 0;
        String beforeStr = "";
        boolean changed = true;
        boolean accepted = false;

        int count = 1;
        for (String[] strArr : input) {
            // System.out.println(String.valueOf(count++));
            changed = !beforeStr.equals(strArr[0]);
            beforeStr = strArr[0];

            if (!changed && accepted) {
                continue;
            }

            if (changed) {
                // System.out.println("changed");
                wcCount = 0;
                accepted = false;
            }
            if (strArr[1].equals("WA")) {
                // System.out.println("wsws");
                wcCount++;
            } else {
                // System.out.println("acac");
                accepted = true;
                acCountTotal++;
                wcCountTotal += wcCount;
                wcCount = 0;
            }
        }
        return String.valueOf(acCountTotal) + " " + String.valueOf(wcCountTotal);
    }
}

class Resp {
    private long min = Long.MAX_VALUE;
    private int cont = 0;

    public Resp(long min, int cont) {
        this.min = min;
        this.cont = cont;
    }

    public long getMin() {
        return this.min;
    }

    public void setMin(long min) {
        this.min = min;
    }

    public int getCont() {
        return this.cont;
    }

    public void setCont(int cont) {
        this.cont = cont;
    }

    public void addCont() {
        this.cont++;
    }

}


Measured memory_bytes: 123012
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (c > a - b) {
		cout << c - (a - b) << endl;
	}
	else {
		cout << "0" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<fstream>
#include<queue>
#include<set>
#include<string>
using namespace std;
void fast(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(0);
}

int main()
{
	fast();

	int a, b;
	cin >> a >> b;
	if (a <= 8 && b <= 8 && (a + b) <= 16)
		cout << "Yay!" << endl;
	else
		cout << ":(" << endl;
}



Measured memory_bytes: 3656
/* ***************************************
Author        :Scau.ion
Created Time  :2016/10/26 10:41:52 UTC+8
File Name     :ion.cpp
*************************************** */

#include <bits/stdc++.h>

#define LL long long
#define ULL unsigned long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<PII>
#define X first
#define Y second
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define IN freopen("in", "r", stdin);
#define OUT freopen("out", "w", stdout);

using namespace std;

const int maxn=310;

char s[maxn][maxn];
int cost[maxn][maxn],dp[maxn][maxn];

int main()
{
    IOS;
	int h,w;
    cin>>h>>w;
    for (int j=1;j<=h;++j)
        cin>>(s[j]+1);
    int ans=0;
    for (int j=1;j<w;++j)
    {
        for (int k=1;k<=h;++k)
        {
            for (int l=1;l<=h;++l)
            {
                cost[k][l]=cost[k-1][l-1]+(s[k][j]==s[l][j+1]);
                dp[k][l]=min(dp[k-1][l],dp[k][l-1])+cost[k][l];
            }
        }
        ans+=dp[h][h];
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

ll modpow(ll a, ll n){
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}
 
int main(){
    ll N, K;
    cin >> N >> K;

    ll ans = 0;
    ll num[K+1];
    for(ll i=K;i>=1;i--){
        num[i] = modpow(K/i, N);
        for(ll j=2;i*j<=K;j++)
            num[i] = (num[i] - num[i*j] + MOD) % MOD;
        ans = (ans + i*num[i]) % MOD;
    }

    cout << ans << endl;

}

Measured memory_bytes: 4372
import sys
rl = sys.stdin.buffer.readline


def solve():
    N, M = map(int, rl().split())
    graph = [set() for _ in range(N)]
    for _ in range(M):
        a, b = map(lambda x: int(x) - 1, rl().split())
        graph[a].add(b)
        graph[b].add(a)
    
    for child in graph[0]:
        if N - 1 in graph[child]:
            print('POSSIBLE')
            exit()
    print('IMPOSSIBLE')


if __name__ == '__main__':
    solve()


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

int main(){
    int N;
    cin >> N;
    vector<pair<pair<string,int>, int>> v;
    v.reserve(N);
    rep(i, N) {
        string s;
        int p;
        cin >> s >> p;
        pair<string, int> x(s, i + 1);
        v.emplace_back(x, p);
    }
    sort(v.begin(), v.end(), [](const pair<pair<string,int>, int> &a, const pair<pair<string,int>, int> &b) {
        if (a.first.first != b.first.first)
            return a.first.first < b.first.first;
        else
            return a.second > b.second;
    });
    for (auto x : v) {
        cout << x.first.second << endl;
    }
}

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

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<i64> a(n);
  REP(i, n) cin >> a[i];
  i64 money = 1000;
  i64 stock = 0;
  for (int i = 1; i < n; ++i) {
    if (a[i] > a[i - 1]) {
      i64 s = money / a[i - 1];
      money -= s * a[i - 1];
      money += s * a[i];
    }
  }
  cout << money << endl;
}


Measured memory_bytes: 3644
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
  
K = int(input())
count = 0
for i in range(1,K-1):
  for j in range(i+1,K):
    for k in range(j+1,K+1):
      count += 6*(gcd(i,j,k))
      
for i in range(1,K):
  for j in range(i+1,K+1):
    count += 6*(gcd(i,j))

for i in range(1,K+1):
  count += i
      
print(count)

Measured memory_bytes: 9640
n=int(input())
a=[]
b=[[] for _ in range(n)]
for i in range(n):
    s=input()
    a.append(s)
a=sorted(a)
d=0
b[0].append(a[0])
for i in range(1,n):
    if a[i]!=a[i-1]:
        d+=1
    b[d].append(a[i])
x=max(len(b[i]) for i in range(n))
for i in range(n):
    if len(b[i])==x:
        print(b[i][0])
    
        
        
    
    
    
    
        


Measured memory_bytes: 43840
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    int N; cin >> N;
    vector<int> alphabets(26);
    map<vector<int>, ll> m;
    rep(i, N){
        string s; cin >> s;
        alphabets.assign(26, 0);
        rep(j, 10){
            alphabets[s[j] - 'a']++;
        }
        m[alphabets]++;
    }
    ll ans = 0;
    for(auto x:m){
        ans += x.second * (x.second - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 22352
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    for (int i = 0; i < a; ++i)
        if (!isdigit(s[i]))
            return cout << "No", 0;
    for (int i = a + 1; i < s.size(); ++i)
        if (!isdigit(s[i]))
            return cout << "No", 0;
    if (s[a] != '-')
        return cout << "No", 0;
    cout << "Yes";
}


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

int main() {
	int a, b; cin >> a >> b;
	int c, d; cin >> c >> d;
	while (true) {
		c -= b;
		if (c <= 0) {
			cout << "Yes" << endl;
			break;
		}
		a -= d;
		if (a <= 0) {
			cout << "No" << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define MAXN 10000001
typedef long long int ll;
int spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)
        spf[i] = i;
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        if (spf[i] == i)
        {
            for (int j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}
int countDivisors(int x)
{
      int result = 1;
      int currentDivisor = spf[x];
      int currentCount = 1;
      while (currentDivisor != 1) {
        x /= currentDivisor;
        int newDivisor = spf[x];
        if (newDivisor != currentDivisor) {
          result *= currentCount + 1;
          currentDivisor = newDivisor;
          currentCount = 1;
        } else {
          currentCount++;
        }
      }
      if (x != 1) {
        result *= currentCount + 1;
      }

      return result;
}
int main()
{
    sieve();
    int n;
    ll ans = 0;
    cin>>n;
    for(int i=1;i<n;i++)
        ans += countDivisors(n-i);
    cout<<ans<<endl;
}


Measured memory_bytes: 42700
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,n;
	cin>>h>>n;
	vector<int> A;
	for(int i=0;i<n;i++){
        int x;
        cin>>x;
        A.push_back(x);
	}
	int sum=0;
	for(auto i:A) sum+=i;
	if(sum<h) cout<<"No"<<endl;
	else cout<<"Yes"<<endl;

}


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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> A(N);
  rep(i,N) cin >> A[i];
  int sum = accumulate(A.begin(),A.end(),0);
  sort(A.rbegin(),A.rend());
  rep(i,M) {
    if(sum > A[i]*4*M) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <chrono>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <queue>
#include <bitset>

using namespace std;
using ll = long long;
using triplet = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vi>;

ll kMod = 1000000007;

ll Add(ll x, ll v)
{
    return (x+v)%kMod;
}

ll Mul(ll x, ll y)
{
    return (x*y)%kMod;
}

int main()
{
#ifdef LOCAL_TEST
    freopen("data.txt", "r", stdin);
#endif
    
    int n, m;
    scanf("%d %d\n", &n, &m);
    
    vll X(n);
    for (int i = 0; i < n; ++i) scanf("%lld ", &X[i]);
    
    vll Y(m);
    for (int i = 0; i < m; ++i) scanf("%lld ", &Y[i]);
    
    ll xSum = 0, ySum = 0;
    for (ll k = 0; k < n; ++k)
    {
        xSum = Add(xSum, Mul(2*k - n + 1, X[k])); // k*X[k] - (n-1-k)*X[k]
    }
    for (ll k = 0; k < m; ++k)
    {
        ySum = Add(ySum, Mul(2*k - m + 1, Y[k]));
    }
    
    ll result = Mul(xSum, ySum);
    printf("%lld\n", result);
    
    return 0;
}


Measured memory_bytes: 1792
A = input()

def bfs(i, f):
    if i == 3:
        if eval(f) == 7:
            print(f+'=7')
            exit()
        else:
            return None
    bfs(i+1, f+'+'+A[i+1])
    bfs(i+1, f+'-'+A[i+1])
    return None

print(bfs(0, A[0]))

Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}
int main() {
	int s, w;
	cin >> s >> w;
	if (s <= w) {
		cout << "unsafe" << endl;
	}
	else {
		cout << "safe" << endl;
	}
	return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;

  int Ans = 0;
  for (int i=A; i<=B; i++) {
    if (((i%10) == (i/10000%10)) && ((i/10%10) == (i/1000%10))) Ans++;
  }

  cout << Ans << endl;
}


Measured memory_bytes: 3632
H = gets.to_i
nodes = gets.split.map(&:to_i)
nodes.each_with_index do |n, i|
  parent_key = ''
  left_key = ''
  right_key = ''
  if ((i + 1) / 2).positive?
    parent_key += 'parent key = ' + nodes[(i + 1) / 2 - 1].to_s + ', '
  end
  if (i + 1) * 2 <= nodes.length
    left_key += 'left key = ' + nodes[(i + 1) * 2 - 1].to_s + ', '
  end
  if (i + 1) * 2 + 1 <= nodes.length
    right_key += 'right key = ' + nodes[(i + 1) * 2].to_s + ', '
  end
  puts "node #{i + 1}: key = #{n}, #{parent_key}#{left_key}#{right_key}"
end



Measured memory_bytes: 6876
#include <iostream>

using namespace std;

int main() {
	int a;
	int b;
	string op;


	while (op != "?") {
		cin >> a >> op >> b;

		double ans;
		if (op == "+") {
			ans = a + b;
			cout << (int)ans << endl;
		}
		else if (op == "-") {
			ans = a - b;
			cout << (int)ans << endl;
		}
		else if (op == "*") {
			ans = a * b;
			cout << (int)ans << endl;
		}
		else if (op == "/") {
			ans = a / b;
			cout << (int)ans << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3144
N, M=map(int, input().split())
lst=[list(map(int, input().split())) for _ in range(M)]
maxL, minR=-1, N
for L, R in lst:
  L, R=L-1, R-1
  maxL=max(maxL, L)
  minR=min(minR, R)
if minR>=maxL:
  print(minR-maxL+1)
else:
  print(0)

Measured memory_bytes: 27332
# temp
import string
s = input()
result = float('inf')
for last in string.ascii_lowercase:
    t = list(s)
    while not all(c == last for c in t):
        for i in range(len(t)):
            if last in t[i : i + 2]:
                t[i] = last
        t.pop()
    result = min(result, len(s) - len(t))
print(result)

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

int main(){


    char s[101],p[101];
    int Scount,Pcount;

    for(int i=0;i<101;i++){
        scanf("%c",&s[i]);
        if(s[i] == '\n'){
            Scount = i;
            break;
        }
    }
    for(int i=0;i<101;i++){
        scanf("%c",&p[i]);
        if(p[i] == '\n'){
            Pcount = i;
            break;
        }
    }

    char ROUND[Scount],WORDS[Pcount];


    for(int i=0;i<Scount;i++){
        ROUND[i] = s[i];
        //printf("%c",ROUND[i]);
    }
    for(int i=0;i<Pcount;i++){
        WORDS[i] = p[i];
        //printf("%c",WORDS[i]);
    }

    bool Ans = false;

    for(int i=0;i<Scount;i++){
        for(int j = 0;j<Pcount;j++){
            if(ROUND[(i+j) % Scount] != WORDS[j]){
                break;
            }else if(j == Pcount-1){
                Ans = true;
            }
        }
    }

    if(Ans){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}



Measured memory_bytes: 2692
/*ANKON GHOSH
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define MAX 4003
#define mod 1000000007
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) cout<<"Case #"<<i<<": "
#define pf(a) printf("%lld\n",a)
#define pfsn printf("NO\n")
#define pfs  printf("YES\n")
#define pff(a,b) printf("%lld %lld\n",a,b)
#define pfff(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define pffff(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll r=x;r<=y;r++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p(a,b) make_pair(a,b)
#define p_b(a) push_back(a)
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
map<ll,ll>mp1,mp;
vector<pair<ll,pair<ll,ll> > >vpp,vpp1;
vector<pair<ll,ll> >vp,fin;
vector<ll>v,v1,v2,dummy;
map<pair<ll,ll>,bool>mbb;
map<ll,bool>mb;
ll n,k,a,b,c,d,ta,sum=0,cnt=0,m,l,req,sz,maxi;
bool sortbysec(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b)
{
    return (a.second < b.second);
}
vector<ll>power;
int main()
{
    cin>>n;
    FOR(i,n)
    {
        ll x,y;
        cin>>x>>y;
        vpp.p_b(m_p(i,m_p(x,y)));
    }
    ll cnt=0;
    double sum=0;
    do{
        FOR1(i,n-1)
        {
            ll x1=vpp[i].ss.ff;
            ll y1=vpp[i].ss.ss;
            ll x2=vpp[i-1].ss.ff;
            ll y2=vpp[i-1].ss.ss;
            ll x=abs(x1-x2);
            ll y=abs(y1-y2);
            x*=x;
            y*=y;
            sum+=(sqrt(x+y));
        }
        cnt++;
    }while(next_permutation(vpp.begin(),vpp.end()));
    double ans=((sum*1.00)/(cnt*1.00))*1.00;
    printf("%.10lf",ans);
    return 0;
}


Measured memory_bytes: 256
A=input()
if A=='A' or A=='B' or A=='C' or A=='D' or A=='E' or A=='F' or A=='G' or A=='H' or A=='I' or A=='J' or A=='K' or A=='L' or A=='M' or A=='N' or A=='O' or A=='P' or A=='Q' or A=='R' or A=='S' or A=='T' or A=='U' or A=='V' or A=='W' or A=='X' or A=='Y' or A=='Z':
    print('A')
else:
    print('a')

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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    ll A[N]; rep(i, N) cin >> A[i];
    int ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            for(int k = j+1; k < N; k++){
                ll temp[] = {A[i], A[j], A[k]};
                sort(temp, temp+3);
                if(temp[0] != temp[1] && temp[1] != temp[2] && temp[0]+temp[1] > temp[2]) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>
#include <stack>
#include <numeric>
int main() {
	int n; std::cin >> n;
	std::vector<int> town(n + 1), braver(n); for (auto& a : town) std::cin >> a; for (auto& b : braver) std::cin >> b;
	const long long int sum = std::accumulate(town.begin(), town.end(), 0LL);
	for (int i = n - 1; i >= 0; --i) {
		auto erase = std::min(town[i + 1], braver[i]);
		town[i + 1] -= erase;
		braver[i] -= erase;
		erase = std::min(town[i], braver[i]);
		town[i] -= erase;
		braver[i] -= erase;
	}
	const long long int rest = std::accumulate(town.begin(), town.end(), 0LL);
	std::cout << sum - rest << std::endl;
}

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

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; }
const long long INF = 1LL<<60;

void send(int numNode, vector<vector<int>>& nodes, vector<int>& counter) {
    for (auto node : nodes[numNode]) {
        counter[node] += counter[numNode];
        send(node, nodes, counter);
    }
}

int main(void)
{
    int N, Q;
    cin >> N >> Q;

    vector<vector<int>> nodes(N);

    rep(i, N-1) {
        int a, b;
        cin >> a >> b;
        nodes[a-1].push_back(b-1);
    }

    vector<int> counter(N, 0);

    rep(i, Q) {
        int p, x;
        cin >> p >> x;
        counter[p-1] += x;
    }

    send(0, nodes, counter);

    for (auto count : counter) {
        cout << count << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 23552
from operator import mul
from functools import reduce
import numpy as np
#def ConZ(i):
    #z_num = i+int(i*(i-1)/2)
    #return z_num
#def ConN(i):
    #n_num = int(i*(i-1)/2)
    #return n_num

def cmb(n):
    over = reduce(mul, range(n, n - 2, -1))
    under = reduce(mul, range(1,2 + 1))
    return over // under


S = input()[::-1]
keta = 1
A_num = 0
x = 0
mod = np.array([0]*2019)
mod[0] += 1
for i in range(len(S)):
    A_num += int(S[i:i+1])*keta
    if A_num >= 2019:
        A_num = A_num%2019
    mod[A_num] +=1
    #keta*=10
    keta = keta * 10 % 2019
#print(mod)
#x += ConZ(mod[0])
#del mod[0]

#for j in range(len(mod)):
    #x+=cmb(mod[j])
#print(x)
print(int(np.sum(mod* (mod - 1) /2)))


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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

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

    vector<int> cnt(1000006, 0);
    for_(i,0,N) {
        int A;
        cin >> A;
        cnt[A]++;
    }

    int ans = 0;
    for_(i,1,1000006) {
        if (cnt[i] > 0) {
            if (cnt[i] == 1) ++ans;
            for (int j=i; j<1000006; j+=i) cnt[j] = 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 7216
#include <bits/stdc++.h>
#include <iomanip> 
using namespace std; 
#define rep(i,a,b)		for(long int i=a;i<=b;i++)
#define MOD 1e9+7

int n,a[102],alice=0,bob=0;
int main() 
{ 
	ios::sync_with_stdio(false);
    cin.tie(NULL);  
    
    
	cin>>n;
	rep(i,1,n)
		cin>>a[i];
	sort(a+1,a+n+1);
	int j=n;
	for(int k=1;k<=n;k++)
	{
		if(k&1)
			alice+=a[j--];
		else
			bob+=a[j--];
	}
	cout<<abs(bob-alice);

}
	

Measured memory_bytes: 3568
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let n = read::<usize>();
  let k = read::<i32>();

  let mut memo = vec![-1; n + 1];

  for i in 0..n {
    let mut index = i + 1;
    if memo[index] != -1 {
      continue;
    }

    let mut current: i32 = (i + 1) as i32;
    let mut count = 0;
    while current < k {
      current = current * 2;
      count += 1;
    }
    while count > 0 && index < n + 1 {
      memo[index] = count;
      index = index * 2;
      count -= 1;
    }
  }

  memo.remove(0);
  let mut answer: f64 = 0.0;

  for v in memo.iter() {
    if *v == -1 {
      answer += 1.0 / n as f64;
      continue;
    }

    let percent = (1.0 / n as f64) * (0.5 as f64).powf(*v as f64);
    answer += percent;
  }
  println!("{}", answer);
}


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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#include <set>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if (a != b && b != c) {
        cout << b << endl;
    } else if (a != b && a != c) {
        cout << a << endl;
    } else {
        cout << c << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    map<int,int>p;
    for (int i=0;i<n;i++){
        int q;
        cin>>q;
        p[q]+=1;
    }
    cout<<p.size()<<endl;
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 10000000000
#define MAX 1000010
#define MOD 1000000007
  
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  int H,W; cin>>H>>W;
  int N; cin>>N;
  queue<int> Q;
  rep1(i,N+1){
    int a;  cin>>a;
    rep(j,a)Q.push(i);
  }
  vector<vector<int>> res(H,vector<int> (W));
  rep(i,H){
    if(i%2==0){
      rep(j,W){
        int q = Q.front();
        Q.pop();
        res.at(i).at(j)=q;
      }
    }else{
      for(ll j = W-1; j >= 0; j--){
        int q = Q.front();
        Q.pop();
        res.at(i).at(j)=q;        
      }
    }
  }
  rep(i,H){
    rep(j,W){
      cout<<res.at(i).at(j)<<" ";
    }
    cout<<endl;
  }
}

Measured memory_bytes: 384
import fractions
a,b,c,d=map(int,input().split())
x1=b//c-(a-1)//c #ｃの割れるやつ
x2=b//d-(a-1)//d #ｄの割れるやつ
sks=c * d // fractions.gcd(c,d)#最小公倍数　普通ならmathメソッドにある
x3=b//sks-(a-1)//sks#ｃ＊ｄの割れるやつ
ans=b-a+1-(x1+x2-x3)
print (ans)


Measured memory_bytes: 5560
#include <iostream>
#include <stack>
#include <vector>
#include <algorithm>
namespace Mylib{
    using namespace std;

    
}



int main(void){
    using namespace std;
    int N,K;
    cin >> N >> K;
    vector<long> HP;
    stack<long> sLong;
    long tempLong;
    for(int i=0;i<N;i++){
        cin >> tempLong;
        HP.push_back(tempLong);
    }
    sort(HP.begin(),HP.end());
    for(int i=0;i<N-K;i++)sLong.push(HP[i]);
    long long AttackCount=0;
    for(int i=0;0!=sLong.size();i++){
        AttackCount+=sLong.top();
        sLong.pop();
    }
    cout << AttackCount << endl;
    
    return 0;
    
}

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

const long long MOD = 1000000007;

void solve(long long N, std::string S){
    long long res = 1;
    if(S[0]!='B'){
        cout<<0<<endl;
        return;
    }
    long long k=1;
    for(int i=1;i<2*N;++i){
        if((S[i]=='B')^(k%2==1)){
            k++;
        }
        else{
            res*=k;
            res%=MOD;
            k--;
        }
    }
    for(long long t=1;t<=N;++t){
        res*=t;
        res%=MOD;
    }
    if(k!=0){
        cout<<0<<endl;
        return;
    }
    cout<<res<<endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


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

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int N, K; cin >> N >> K;
	vector<int> A(N, 0);
	rep (i, N){
		cin >> A[i];
	} // end rep

	sort(ALL(A));

	int g = __gcd(A[0], A[1]);
	for (int i = 2; i < N; ++i){
		g = __gcd(g, A[i]);
	} // end for

	cout << (K <= A[N-1] && K % g == 0 ? "POSSIBLE" : "IMPOSSIBLE") << endl;

	return 0;
}

Measured memory_bytes: 640
def calculate_summary_of_digits(n):
    result = 0
    while n != 0:
        result += (n % 10)

        n //= 10

    return result


n = int(input())

sum_of_digits = calculate_summary_of_digits(n)
print("Yes" if n % sum_of_digits == 0 else "No")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
#define MOD 1000000007
//setprecision(15)
// 素因数分解O(√n)
map<int, int> prime_factor(int n) {
	map<int, int> res;
	for (int i = 2; i*i <= n; i++) {
		while (n % i == 0) {
			++res[i];
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}
int pow_i(int x, int n) {
	if (x == 0) return 1;
	int ans = x;
	for (int i = 1; i < n; i++) {
		ans *= x;
	}
	return ans;
}

int main() {
	int a, b; cin >> a >> b;
	int d = 1;
	int tmp = b;
	while (1) {
		if (tmp / 10 == 0) break;
		else {
			tmp /= 10; d++;
		}
	}
	tmp = pow_i(10, d);
	tmp = tmp * a + b;
	map<int, int> ma = prime_factor(tmp);
	for (auto i = ma.begin(); i != ma.end(); i++) {
		if (i->second % 2 != 0 ) {
			cout << "No" << endl; return 0;
		}
	}
	cout << "Yes" << endl; return 0;
}

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

int gcd(int a, int b) {
    if (a%b == 0)  return b;
    else return gcd(b, a%b);
}

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll b_ = b/d-(a-1)/d;
    ll c_ = b/c-(a-1)/c;
    ll s = c*d/gcd(c, d);
    ll b_c = b/s-(a-1)/s;
    cout << (b-a+1)-b_-c_+b_c << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
ll GCD(ll a, ll b){
    return b ? GCD(b, a%b) : a;
}
ll LCM(ll a, ll b){
    return a/GCD(a,b)*b;
}
int main(){
    int r;
    cin>>r;
    cout<<r*r<<endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var ss string
	fmt.Scan(&ss)
	slice := strings.Split(ss, "")
	var count int
	for _, s := range slice {
		if s == "1" {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
 
#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>
 
using namespace std;

int main(){
  int x,t;
  cin >> x >> t;
  if(x < t){
    cout << 0 << endl;
    return 0;
  }
  cout << x - t << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+18
#define MOD 1000000007
using namespace std;



int main(){
    double T,X;
    cin >> T >>X;
    cout<<T/X<<endl;
    return 0;
}


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

int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    if(s.length()<6){
        cout << "No";
    }else{
        if(s[2]==s[3] && s[4]==s[5]){
            cout << "Yes";
        }else{
            cout << "No";
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std; 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
#define int long long
#define endl '\n'
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fi first
#define se second
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void solve(){
    int n;;
    cin>>n;
    int x=n/500;
    n=n-x*500;
    int ans=x*1000;
    int tmp = n/5 * 5;
    ans+=tmp;
    cout<<ans<<endl;
}

signed main()
{
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);

    int tests=1;
    // cin >> tests;
    while (tests--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
def sum(arg):
  ans = 0
  for i in arg:
    ans += i
  return ans

N, M = map(int, input().split())
ac = [0]*N
wa = [0]*N
pe = [0]*N
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if si == "AC" and ac[pi-1] == 0:
    ac[pi-1] = 1
    pe[pi-1] = wa[pi-1]
  if si == "WA" and ac[pi-1] == 0:
    wa[pi-1] += 1
print(sum(ac), sum(pe))

Measured memory_bytes: 5364
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    vector<pair<int,int>> hoge(m);
    map<int,vector<int>> fuga;
    
    for(int i=0;i<m;i++){
        cin>>hoge.at(i).first>>hoge.at(i).second;
        fuga[hoge.at(i).first].push_back(hoge.at(i).second);
    }
    
    for(int a=1;a<=n;a++){
        sort(fuga[a].begin(),fuga[a].end());
    }
    
    for(auto at:hoge){
        int a=at.first;
        int b=at.second;
        
        int fst=a;
        int ed=0;
        
        int left=0;
        int right=fuga[a].size()-1;
        
        while(left<=right){
            int mid=(left+right)/2;
            
            if(fuga[a].at(mid)==b){
                ed=mid+1;
                break;
            }else if(fuga[a].at(mid)>b){
                right=mid-1;
            }else{
                left=mid+1;
            }
        }
        
        string mae=to_string(fst);
        string usiro=to_string(ed);
        
        while(mae.size()<6){
            mae="0"+mae;
        }
        
        while(usiro.size()<6){
            usiro="0"+usiro;
        }
        
        cout<<mae+usiro<<endl;
    }
    
    return 0;
}

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

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

    int n, s;
    cin >> n >> s;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    vector<ll> dp(s + 1, 0);

    dp[0] = 1;

    REP(i, n) {
        vector<ll> tmp(s + 1, 0);
        swap(dp, tmp);
        REP(j, s + 1) {
            dp[j] += tmp[j] * 2;
            dp[j] %= mod;
            if (j + a[i] <= s) {
                dp[j + a[i]] += tmp[j];
                dp[j + a[i]] %= mod;
            }
        }
    }

    cout << dp[s] << '\n';
    return 0;
}


Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
string n;
int u[20];
int main()
{
	cin>>n;
    for(int s=2;s<n.size();s++)
    {
    	if(n[s]==n[s-1]&&n[s]==n[s-2])
    	{
    		cout<<"Yes"<<endl;
    		return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	cs := []rune(s)
	var r, g, b int
	for _, c := range cs {
		switch c {
		case 'R':
			r++
		case 'G':
			g++
		case 'B':
			b++
		}
	}

	not := 0
	for i := range cs {
		for j := 1; i+j*2 < len(cs); j++ {
			if s[i] != s[i+j] && s[i] != s[i+j*2] && s[i+j] != s[i+j*2] {
				not++
			}
		}
	}

	fmt.Printf("%d\n", r*g*b-not)
}


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

int main(){
	int A,B,T,ans(0);
  	scanf("%d%d%d",&A,&B,&T);
  	for(int i = 1 ; i <= T ; i ++){
      	if(i % A == 0){
          	ans += B;
        }
    }
  	printf("%d",ans);
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <string>
#include <string.h>
#include <cstdlib>
#include <iomanip>
#include <stdio.h>

using namespace std;


int main(){

        int h,w;

        while(1){
                scanf("%d %d\n",&h,&w);
                if(h==0 && w==0)
                        return 0;
                for(int j=0;j<h;j++){
                        for(int i=0;i<w;i++) {
                                putchar('#');

                        }
                        putchar('\n');
                }
                putchar('\n');
        }
}


Measured memory_bytes: 3124