akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<55)+1e9; // ~ 3.6 * 1e16
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

Int sum(Int n){
  string s = to_string(n);
  Int res = 0;
  for(Int ch:s) res += ch - '0';
  return res;
}

signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int n;
  cin>>n;

  Int ans = INF;
  for(Int a = 0; a < n;a++){
    Int b = n - a;
    if(a == 0 || b== 0) continue;
    Min(ans, sum(a) + sum(b));
  }

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


Measured memory_bytes: 256
def main():
    N = int(input())
    C = [0]*N
    S = [0]*N
    F = [0]*N
    for i in range(N-1):
        C[i],S[i],F[i] = map(int,input().split())
    for i in range(N):
        t = 0
        for j in range(i,N-1):
            if t < S[j]:
                t = S[j]
            elif t%F[j] != 0:
                t += F[j] - t%F[j]
            t += C[j]
        print(t)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n , sum=0; cin>> n;
  vector<int>d(n);
  for(int i=0;i<n;i++) cin >> d[i];
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      sum+=d[i]*d[j];
    }
  }
  cout<<sum<<endl;  
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
    string S1, S2;
    cin >> S1 >> S2;
    if(S1[0] == S2[2] && S1[2] == S2[0] && S1[1] == S2[1]){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

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

int main() {
	int n;
	cin>>n;
	int ans=max(n%10,max(n/10%10,n/10/10));
	if( n/10/10<ans )
		ans=n/10/10+1;
	cout<<(ans+ans*10+ans*100)<<endl;
	return 0;
	}


Measured memory_bytes: 256
/* ****devACE**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005
int dp[N];
int h[N];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		int n,k,i,j;
		cin>>n;
      	k=2;

		for(i=0;i<n;i++)cin>>h[i];
		for(i=0;i<N;i++)dp[i]=hell;

		dp[0]=0;
		for(i=0;i<n;i++)
		{
			for(j=i+1;j<=min(i+k,n);j++)
			{
				dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
			}
		}

		cout<<dp[n-1];
	}
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using Enu = System.Linq.Enumerable;

public class Program
{
    public void Solve()
    {
        var A = Reader.String().Select(c => c - '0').ToArray();
        int K = Reader.Int();
        var Bad = Reader.IntLine();
        var OK = Enu.Range(0, 10).Where(i => !Bad.Contains(i)).ToArray();
        int FirstNotZero = OK[0] != 0 ? OK[0] : OK[1];

        if (A.Any(c => c > OK[OK.Length - 1]))
            Console.WriteLine(FirstNotZero + "" + new string((char)('0' + OK[0]), A.Length));
        else if (A.All(a => OK.Contains(a)))
            Console.WriteLine(string.Join("", A));
        else
        {
            int i = Array.FindIndex(A, a => !OK.Contains(a));
            A[i] = OK.First(a => a > A[i]);
            Console.WriteLine(string.Join("", A.Take(i + 1)) + 
                              new string((char)('0' + OK[0]), A.Length - i - 1));
        }
    }
}

class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    static string[] Split(string s) { return s.Split(separator, op); }
    static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

string SA, SB, SC;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> SA;
	cin >> SB;
	cin >> SC;

	int i=0, j=0, k=0, win=0;
	char c = SA[0];
	i++;
	while(true){
		if(c == 'a'){
			if(i >= SA.size()){
				win = 1;
				break;
			}
			c = SA[i];
			i++;
		}
		else if(c == 'b'){
			if(j >= SB.size()){
				win = 2;
				break;
			}
			c = SB[j];
			j++;
		}
		else if(c == 'c'){
			if(k >= SC.size()){
				win = 3;
				break;
			}
			c = SC[k];
			k++;
		}
	}
	if(win == 1){
		printf("A\n");
	}
	else if(win == 2){
		printf("B\n");
	}
	else if(win == 3){
		printf("C\n");
	}
	return 0;
}

Measured memory_bytes: 3648
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <fstream>

#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

ll GCD(ll a, ll b) { if(b==0) return a; else return GCD(b, a%b); }
ll LCM(ll a, ll b) { return a/GCD(a,b)*b; }

class CSplittingPile {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll n;in>>n;
        vector<ll> a(n);
        rep(i,n) in>>a[i];
        ll sum = accumulate(all(a),0LL);

        ll res = 1e18;
        ll cnt = 0;
        for (int j = 0; j < n-1; ++j) {
            cnt+=a[j];
            res = min(res,abs(cnt-(sum-cnt)));
        }
        out<<res<<endl;
	}
};


int main() {
	CSplittingPile solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1792
N = int(input())
A = list(map(int,input().split()))
A.sort()
cntA = [0 for _ in range(10**5)]
for a in A:
        cntA[a] += 1
sumA = [0 for _ in range(10**5)]
sumA[0] = cntA[0]
sumA[1] = cntA[0] + cntA[1]
for i in range(2,10**5):
    sumA[i] = cntA[i] + cntA[i-1] + cntA[i-2]
print(max(sumA))

Measured memory_bytes: 13964
#include <cstdio>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int main() {
	int r, D, x;
	scanf("%d %d %d", &r, &D, &x);
    for (int i=0; i < 10; i++) {
        int x1;
        x1 = r * x -D;
        printf("%d\n", x1);
        x = x1;
    }
    
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

int main(){
    cin.sync_with_stdio(false);
    string s;
    cin >> s;
    int mini = INF, n = s.size();
    rep(i, n) {
        if (s[i - 1] != s[i]) minch(mini, max(i, n - i));
    }
    if (mini == INF) mini = 0;
    cout << mini << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Set<String> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            set.add(sc.next());
        }
        if (set.contains("Y")) {
            System.out.println("Four");
            return;
        }
        System.out.println("Three");
    }

}


Measured memory_bytes: 21844
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int a, b;
	string N;
	cin >> N;
	if (N == "1"){ cout << "Hello World" << endl; }
	else if (N == "2"){ cin >> a >> b; cout << a + b << endl; }
	system("pause");
	return 0;
}


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

int main() {
    int h, w; cin >> h >> w;
    char c[h][w];
    for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) cin >> c[i][j];
    for (int i = 0; i < 2 * h; i++) for (int j = 0; j < w; j++) {
            cout << c[i / 2][j];
            if (j == w - 1) cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll A, B, C, X;
  std::cin >> A >> B >> C >> X;

  ll cnt = 0LL;
  for (ll a = 0; a <= A; a++) {
    for (ll b = 0; b <= B; b++) {
      ll res = X - 500 * a - 100 * b;
      if (res >= 0 && res % 50 == 0 && res / 50 <= C) {
	cnt++;
      }
    }
  }

  print(cnt);
  return 0;
}


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

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

const int mo=1e9+7;
const int inv2=5e8+4;
const int maxn=100003;

int qpow(int x,int p){
	int rt=1;
	while(p){
		if(p&1)rt=(1ll*rt*x)%mo;
		x=(1ll*x*x)%mo;
		p>>=1;
	}
	return rt;
}
int fac[maxn],pw[maxn],sz,n,k,res;
int main(){
	scanf("%d%d",&n,&k);
	vector<int> v;
	for(int i=1;1ll*i*i<=n;++i){
		if(n%i==0){
			fac[++sz]=i;
			pw[sz]=qpow(k,i/2+i%2);
			if(1ll*i*i!=n)v.push_back(n/i);
		}
	}
	for(int i=v.size()-1;i>=0;--i){
		int j=v[i];
		fac[++sz]=j;
		pw[sz]=qpow(k,j/2+j%2);
	}
//	for(int i=1;i<=sz;++i)printf("%d %d ^\n",fac[i],pw[i]);
	for(int i=1;i<=sz;++i){
		for(int j=1;fac[j]<fac[i];++j)
			if(fac[i]%fac[j]==0)
				(pw[i]-=pw[j])%=mo;
		int x=1ll*pw[i]*fac[i]%mo;
		if(fac[i]%2==0)x=1ll*inv2*x%mo;
		res=(res+x)%mo;
//		printf("%d %d !\n",fac[i],pw[i]);
	}
	printf("%d\n",(res+mo)%mo);
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  long long min, max, s = 0;
  min = n*(n+1)/2;
  max = min;
  //
  for (int i = 0; i < n-k+2; i++) {
    s += max-min+1;
    if (s>1000000000+7) {
      s = s%1000000007;
    }
    max -= i;
    min -= n-i;
    // cout << max << ' ' << min << ' ' << s << endl;
  }
  cout << s << endl;
}

//n=4,k=2

//5c5
//min:0+1+2+3+4=10
//max:0+1+2+3+4=10
//max-min+1=10-10+1=1

//5c4
//min:0+1+2+3=6
//max:1+2+3+4=10
//max-min+1=10-6+1=5

//5c3
//min:0+1+2=3
//max:2+3+4=9
//max-min+1=9-3+1=7

//5c2
//min:0+1=1
//max:3+4=7
//max-min+1=7-1+1=7

//5c1
//min:0=0
//max:4=4
//max-min+1=4-0+1=5


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

#define xx first
#define yy second

#define MAX_N 100000

using namespace std;

typedef long long lint;

const lint MOD = (lint)(1e9) + 7;

int a[MAX_N + 1];

int n;

lint p2[MAX_N + 1];

lint rez = 0;

void modd(lint &a)
{
    if(a >= MOD)
        a -= MOD;

    if(a < 0)
        a += MOD;
}

void euclid(lint a, lint b, lint &x, lint &y, lint &d)
{
    if(b == 0)
    {
        x = 1;
        y = 0;

        d = a;

        return;
    }

    lint xx, yy, q = a / b;
    euclid(b, a % b, xx, yy, d);
    x = yy;
    y = xx - yy * q;
}

void poz(lint &a)
{
    if(a < 0)
        a = MOD + a % MOD;
}

lint fact[MAX_N + 1];
lint invf[MAX_N + 1];

lint getComb(int n, int k)
{
    if(k > n)
        return 0;

    return fact[n] * invf[k] % MOD * invf[n - k] % MOD;
}

int k;

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

    p2[0] = 1;
    for(int i = 1; i <= n; i ++)
        p2[i] = (p2[i - 1] << 1) % MOD;

    fact[0] = 1;
    for(int i = 1; i <= n; i ++)
        fact[i] = fact[i - 1] * i % MOD;

    lint x, y, d;
    euclid(fact[n], MOD, x, y, d);
    poz(x);
    invf[n] = x;

    for(int i = n - 1; i >= 0; i --)
        invf[i] = invf[i + 1] * (i + 1) % MOD;

    for(int i = 1; i <= n; i ++)
        cin >> a[i];

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

    for(int i = 1; i <= n; i ++)
    {
        rez -= getComb(n - i, k - 1) * a[i] % MOD;
        modd(rez);



        rez += getComb(i - 1, k - 1) * a[i] % MOD;
        modd(rez);

    }

    cout << rez << "\n";

    return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
#define INFL 2e+13

ll D[305][305];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m, l;
  cin >> n >> m >> l;

  REP(i, n) REP(j, n) {
    if(i != j)
      D[i][j] = INFL;
    else
      D[i][j] = 0;
  }
  REP(i, m) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    D[a][b] = c;
    D[b][a] = c;
  }
  REP(k, n) REP(i, n) REP(j, n) D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
  REP(i, n) REP(j, n) {
    if(i != j) {
      if(D[i][j] <= l)
        D[i][j] = 1;
      else
        D[i][j] = INFL;
    } else
      D[i][j] = 0;
  }
  REP(k, n) REP(i, n) REP(j, n) D[i][j] = min(D[i][j], D[i][k] + D[k][j]);

  int q;
  cin >> q;
  REP(i, q) {
    int s, t;
    cin >> s >> t;
    s--, t--;
    ll ans = D[s][t];
    if(ans == INFL)
      ans = -1;
    else
      ans--;
    cout << ans << '\n';
  }
  return 0;
}


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

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	ll m,v,p ;cin >> m >> v >> p;
	vector<ll> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a.rbegin(),a.rend());
	vector<ll> cnt(n+1,0);
	for(int i=0;i<n;i++){
		cnt[i]+=a[i];
		if(i){
			cnt[i]+=cnt[i-1];
		}
	}
	if(v<=p){
		ll border=a[p-1];
		ll ans=p;
		for(int i=p;i<n;i++){
			if(border<=a[i]+m)ans++;
		}
		cout << ans << endl;
		return 0;
	}
	v-=(p-1);
	ll ans=p;
	ll border=a[p-1];
	for(int i=p;i<=n-v;i++){
		if(border<=a[i]+m)ans++;
	}
	// ここ以下を治す
	for(int i=n-1;i>=n-v+1;i--){
		ll k=i-(n-v);
		if(a[i]+m<border)continue;
		if(k*m<=(a[i]+m)*(i-p+1)-(cnt[i-1]-cnt[p-2]))ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1920
#include<algorithm>
#include<clocale>
#include<cmath>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<iostream>
#include<istream>
#include<map>
#include<math.h>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
using namespace std;
int n,m,c,b[1010],a[1010][1010],num,sum;
int main(){
	cin>>n>>m>>c;
	for (int i=0;i<m;i++) cin>>b[i];
	for (int i=0;i<n;i++)
		for (int j=0;j<m;j++)
			cin>>a[i][j];
	for (int i=0;i<n;i++){
		sum=c;
		for (int j=0;j<m;j++) sum+=a[i][j]*b[j];
		if (sum>0) num++;
	}
	cout<<num<<endl;
	return 0;
}

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


void push(int);
int pop(void);
int top,s[1000];

int main() {
  int x,y,top=0,b,i;
  char S[1000];
  while(scanf("%s",S)!=EOF){
    if(S[0]=='+'){
      x=pop();
      y=pop();
      push(x+y);
    }else if(S[0]=='-'){
      y=pop();
      x=pop();
      push(x-y);
    }else if(S[0]=='*'){
      x=pop();
      y=pop();
      push(x*y);
    }else push(atoi(S));
  }
  printf("%d\n",s[1]);
 
  return 0;
}

void push(int a){
  top++;
  s[top]=a;
}
int pop(){
  top--;
  return s[top+1];
}



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

bool check(int i, int j, int H, int W) {
  if (i >= 0 && i < H && j >= 0 && j < W) {
    return true;
  }
  return false;
}

int main()
{
  int H, W;
  string S[50];
  int answer[50][50] = {0};

  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    cin >> S[i];
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '#') { // 爆弾ますならば、周囲8マスをカウントアップする
        // 左上
        if (check(i - 1, j - 1, H, W)){ // 配列の外に出ていない場合だけ処理する
          if (S[i - 1][j - 1] == '.') { // .ならば、カウントアップする
            answer[i - 1][j - 1]++;
          } else if (S[i - 1][j - 1] == '#') { // #ならばそのままにしたい。出力の際に-1ならば#を出力する
            answer[i - 1][j - 1] = -1;
          }
        }
        // 上
        if (check(i, j - 1, H, W)){
          if (S[i][j - 1] == '.') {
            answer[i][j - 1]++;
          } else if (S[i][j - 1] == '#') {
            answer[i][j - 1] = -1;
          }
        }
        // 右上
        if (check(i + 1, j - 1, H, W)){
          if (S[i + 1][j - 1] == '.') {
            answer[i + 1][j - 1]++;
          } else if (S[i + 1][j - 1] == '#') {
            answer[i + 1][j - 1] = -1;
          }
        }
        // 左
        if (check(i - 1, j, H, W)){
          if (S[i - 1][j] == '.') {
            answer[i - 1][j]++;
          } else if (S[i - 1][j] == '#') {
            answer[i - 1][j] = -1;
          }
        }
        // 右
        if (check(i + 1, j, H, W)){
          if (S[i + 1][j] == '.') {
            answer[i + 1][j]++;
          } else if (S[i + 1][j] == '#') {
            answer[i + 1][j] = -1;
          }
        }
        // 左下
        if (check(i - 1, j + 1, H, W)){
          if (S[i - 1][j + 1] == '.') {
            answer[i - 1][j + 1]++;
          } else if (S[i - 1][j + 1] == '#') {
            answer[i - 1][j + 1] = -1;
          }
        }
        // 下
        if (check(i, j + 1, H, W)){
          if (S[i][j + 1] == '.') {
            answer[i][j + 1]++;
          } else if (S[i][j + 1] == '#') {
            answer[i][j + 1] = -1;
          }
        }
        // 右下
        if (check(i + 1, j + 1, H, W)){
          if (S[i + 1][j + 1] == '.') {
            answer[i + 1][j + 1]++;
          } else if (S[i + 1][j + 1] == '#') {
            answer[i + 1][j + 1] = -1;
          }
        }
      }
    }
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '#') {
        cout << '#';
      } else {
        cout << answer[i][j];
      }
    }
    cout << endl;
  }
  cout << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] arg){
		Scanner in = new Scanner(System.in);
		int x,y = 0;
		char op;
		while(true){
			String[] line = in.nextLine().split(" ");
			x = Integer.parseInt(line[0]);	
			op  = line[1].charAt(0);	
			y = Integer.parseInt(line[2]);
			if (op == '?')break;
			
			switch(op){
			case '+':System.out.println(x+y);break;
			case '-':System.out.println(x-y);break;
			case '*':System.out.println(x*y);break;
			case '/':System.out.println(x/y);break;
			}
		}	
	}
}

Measured memory_bytes: 17288
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n, k, x, y, ans = 0;
  cin >> n >> k >> x >> y;
  if (k < n) ans += k * x + (n - k) * y;
  else ans += n * x;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def I(): return int(input())
def LI(): return list(map(int,input().split()))
n = I()
h = LI()
dp = [float('INF')]*n
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2,n):
  dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print(dp[-1])

Measured memory_bytes: 13980
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll MOD = 1000000007;
ll beki(ll x, ll n, ll mod){
	if(n==0) return 1;
	
	ll res = beki((x*x)%mod, n/2, mod);
	if(n%2==1) res = (res*x)%mod;
	return res;
}

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

	ll X=1,X2=1, Y=1, Y2=1;
	for(int i=0;i<a;i++){
		X = (X*(n-i))%MOD;
		Y = (Y*(i+1))%MOD;
	}
	X = (X*beki(Y, MOD-2, MOD))%MOD;

	for(int i=0;i<b;i++){
		X2 = (X2*(n-i))%MOD;
		Y2 = (Y2*(i+1))%MOD;
	}
	X2 =(X2*beki(Y2, MOD-2, MOD))%MOD;

	//cout << beki(1, MOD-2, MOD) <<endl;
	//cout << beki(2, MOD, MOD) <<endl;
	//cout << X <<endl;
	//cout << X2 <<endl;

	ll sum = (beki(2, n, MOD)-1)%MOD;
	cout << (2*MOD + sum - X - X2)%MOD <<endl;
	
    
  	return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<62;




int main(){
    LL n,m;cin >> n >> m;
    for(int i=m;i>=1;i--){
        LL sum=i*n;
        if(sum<=m&&m%i==0){
            cout << i << endl;
            return 0;
        }
    } 
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
 
class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
 
 
    void solve()
    {
        int N = cin.nextint;
        var A = cin.scanint;
        var B = cin.scanint;
        var C = cin.scanint;
        Array.Sort(A);
        Array.Sort(B);
        Array.Sort(C);
 
        var BB = new long[N];
        for (int i = 0; i < N; i++)
        {
            BB[i] =  N - upper_bound(C, B[i]);
        }
        for (int i = 1; i < N; i++)
        {
            int k = N - i - 1;
            BB[k] += BB[k + 1];
        }
        long ans = 0;
        for (int i = 0; i < N; i++)
        {
            int b = upper_bound(B, A[i]);
            if (b == N) break;
            ans += BB[b];
        }
        WriteLine(ans);
 
    }
 
    int upper_bound(int[] arr, int val)
    {
        int low = 0, high = arr.Length;
        int mid;
 
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid] <= val) low = mid + 1;
            else high = mid;
        }
        return low;
    }
 
}
 
class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

// #define multitest 1
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.first << ", " << p.second << ']';
	return out;
}
template <typename Arg>
void PC(const char *name, Arg &&arg)
{
	std::cerr << name << " { ";
	for (const auto &v : arg)
		cerr << v << ' ';
	cerr << " }\n";
}
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#define pc(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;
auto TimeStart = chrono::steady_clock::now();

const int nax = 2e5 + 10;

void solve()
{
	int n;
	cin >> n;
	vector<int> A(n + 1), B(n);
	for (auto &x : A)
		cin >> x;
	for (auto &x : B)
		cin >> x;
	long long ans = 0;
	for (int i = n - 1; i >= 0; --i)
	{
		int a = min(A[i + 1], B[i]);
		B[i] -= a;
		ans += a;
		a = min(A[i], B[i]);
		B[i] -= a;
		A[i] -= a;
		ans += a;
	}
	cout << ans;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
#ifdef TIME
	cerr << "\n\nTime elapsed: " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " seconds.\n";
#endif
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	long long N;
	cin >> N;
	if (N == 1000000000){cout << "Yes"; return 0;}
	long long A = N;
	long long n = 0;
	for (int i = 1; i <= 9; i++) {
		n += A % 10;
		A /= 10;
	}
	if (N % n == 0)cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
def main():
	num = 0

	_ = input()
	s_set = set(map(int, input().split()))

	_ = input()
	t_set = set(map(int, input().split()))
	for t in t_set:
		if t in s_set:
			num +=1
	
	print(num)

if __name__ == '__main__':
	main()

Measured memory_bytes: 8012
#include<stdio.h>
int main()
{
   char N[4];
   scanf("%s",N);
   if(N[0] == '7' || N[1] == '7' || N[2]== '7' || N[3] == '7' || N[4] == '7'){
     puts("Yes\n");
   }
   else{
     puts("No\n");
   }
   return 0;
}


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

typedef long long ll;

int n;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    if (n == 3 || n == 5 || n == 7)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}



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

int main(){
  int N,L,s=0;
  cin >> N >> L;
  for(int i=0; i<N; i++){
    s+=L+i;
  }
  if(L>=0){
    s-=L;
  }
  else if(L<=(-1)*N){
    s-=L+N-1;
  }
  cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
数値の区切り位置を誤読しない
cout << fixed;
cout << setprecision(n) << ans;
 */

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    bool poor=false;
    if(a==b && a!=c)poor=true;
    if(b==c && a!=c)poor=true;
    if(a==c && a!=b)poor=true;
    if(poor)cout << "Yes";
    else cout << "No";


    
}

/*
*/



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;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

int main() {
    int N;cin>>N;
    vector<vector<int>> tbl(N,vector<int>(N));
    int cnt = 0;
    rep(i,N-1) {
        for (int j = i+1;j<N;j++) {
            tbl[i][j] = cnt;
            tbl[j][i] = cnt;
            cnt++;
        }
    } 
    vector<vector<int>> a(N,vector<int>(N-1));
    rep(i,N) {
        rep(j,N-1) {
            int b;cin>>b;
            b--;
            a[i][j] = b;
        }
    }
    vector<vector<int>> graph(N*(N-1)/2,vector<int>());
    vector<int> indeg(N*(N-1)/2,0);
    rep(i,N) {
        rep(j,N-2) {
            graph[tbl[i][a[i][j]]].push_back(tbl[i][a[i][j+1]]);
            indeg[tbl[i][a[i][j+1]]]++;
        }
    }
    vector<int> depth(N*(N-1)/2,0);
    queue<int> qu;
    vector<int> topo;
    rep(i,N*(N-1)/2) {
        if(indeg[i]==0) {
            qu.push(i);
            topo.push_back(i);
        }
    }
    int mx = 0;
    while(!qu.empty()) {
        int now = qu.front();
        qu.pop();
        for(auto nxt : graph[now]) {
            if(indeg[nxt]!=0) {
                indeg[nxt]--;
                depth[nxt] = max(depth[nxt],depth[now]+1);
                mx = max(mx,depth[nxt]);
                if(indeg[nxt]==0) {
                    qu.push(nxt);
                    topo.push_back(nxt);
                }
            }
        }
    }
    if(topo.size()!=N*(N-1)/2) {
        cout<<-1<<endl;
    } else {
        cout<<mx+1<<endl;
    }

}

Measured memory_bytes: 44372
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
from collections import Counter
import bisect
def main():
    N = I()
    cnt = 0
    for i in range(N):
        d_1, d_2 = MI()
        if d_1 == d_2:
            cnt += 1
        else:
            cnt = 0
        if cnt == 3:
            print('Yes')
            exit()
    print('No')
if __name__ == "__main__":
    main()



Measured memory_bytes: 68408
# cook your dish here
import sys,math
try:sys.stdin,sys.stdout=open('input.txt','r'),open('out.txt','w')
except:pass
from sys import stdin,stdout;mod=int(1e9 + 7);from statistics import mode
from collections import *;from math import ceil,floor,inf,factorial,gcd,log2,sqrt,log
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()
# print('{:.3f}'.format(1),round(1.123456789,4))
# sys.setrecursionlimit(500000)
def lcm(a,b): return (a*b)//gcd(a,b)
def setbits(n):return bin(n).count('1')
def resetbits(n):return bin(n).count('0')
def modinv(n,p):return pow(n,p-2,p)
def ncr(n,r):
    num,den=1,1;r=min(n,n-r)
    for i in range(r):num*=(n-i);den*=(i+1)
    return num//den
def ncr_p(n, r, p):
    num,den=1,1;r=min(r,n-r)
    for i in range(r):num = (num * (n - i)) % p ;den = (den * (i + 1)) % p
    return (num * modinv(den,p)) % p
def isPrime(num) :
    if num<=1:return False
    if num==2 or n==3:return True
    if (num % 2 == 0 or num % 3 == 0) :return False
    m = int(num**0.5)+1
    for i in range(5,m,6):
        if (num % i == 0 or num % (i + 2) == 0) :return False
    return True
def bin_search(s, low, high, val):
    while low <= high:
        mid = low + (high - low) // 2;
        if s[mid] == val:return mid
        elif s[mid] < val:low = mid + 1
        else:high = mid - 1
    return -1
def sumofdigit(num):
    count=0;
    while num : count+=num % 10;num //= 10;
    return count;
def inputmatrix():
    r,c=iia();mat=[0]*r;
    for i in range(r):mat[i]=iia();
    return r,c,mat;
def prefix_sum(n,s):
    for i in range(1,n):s[i]+=s[i-1]
    return s;
def binomial(n, k):
    if 0 <= k <= n:
        ntok = 1;ktok = 1
        for t in range(1, min(k, n - k) + 1):ntok *= n;ktok *= t;n -= 1
        return ntok // ktok
    else:return 0
def divisors(n):
    res = [];
    for i in range(1,ceil(sqrt(n))+1):
        if n%i == 0:
            if i==n//i:res.append(i)
            else:res.append(i);res.append(n//i)
    return res;
#code here
n = int(input())
points=[]
D,d,S,s=-inf,inf,-inf,inf
for i in range(n):
    a,b=iia()
    D=max(D,a-b);d=min(d,a-b);S=max(S,a+b);s=min(s,a+b)
print(max(D-d,S-s))



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

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set
    
    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }
    
    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }
    
    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main() {
    int N; cin >> N;
    int Q; cin >> Q;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];
    
    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) {
            return rights[i] < rights[j];});

    BIT<int> bit(N+5);
    vector<int> prev(1100000, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]]+2, r+2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i]+1, lefts[i]+2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << endl;
}

Measured memory_bytes: 21728
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class Data{
public:
	int v,w;
	ll d;
	char t;
	string name;
	bool operator<(const Data& rhs){
		if(v==rhs.v){
			if(w==rhs.w){
				if(t==rhs.t){
					if(d==rhs.d){
						return name<rhs.name;
					}
					return d<rhs.d;
				}
				return t<rhs.t;
			}
			return w<rhs.w;
		}
		return v<rhs.v;
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N=in();
	vector<Data> P(N);
	REP(i,N){
		P[i].v=in();
		P[i].w=in();
		P[i].t=in<char>();
		P[i].d=in<ll>();
		P[i].name=in<string>();
	}
	sort(ALL(P));

	REP(i,N){
		out(P[i].v,P[i].w,P[i].t,P[i].d,P[i].name);
	}
	return 0;
}


Measured memory_bytes: 11056
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <bitset>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10



int main() {
	int N, X; cin >> N >> X;
	vector<int>m(N);
	REP(i, N) cin >> m[i];
	sort(m.begin(), m.end());
	int cnt = 0;
	REP(i, N) {
		cnt++;
		X -= m[i];
	}
	while (X >= m[0]) {
		cnt++;
		X -= m[0];
	}
	print(cnt);


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int a, b, k;
  cin >> a >> b >> k;
  for(int i = a; i < min(k+a, b); i++)cout << i << endl;
  for(int i = max(b-k+1, min(k+a, b)); i <= b; i++)cout << i << endl;
  return 0;
}

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

#define f(i,a,b) for (int i = a; i < b; i++)
#define fr(i,a,b) for (int i = b-1; i>=a; i--)

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k;
	cin >> n >> k;
	int a[n];
	f(i,0,n) cin>>a[i];
	stringstream ss;
	ss << "Impossible" << endl;
	f(i,0,n-1) {
		if (a[i] + a[i+1] >= k) {
			ss = stringstream();
			ss << "Possible" << endl;
			f(j,0,i) ss << j+1 << endl;
			fr(j,i+1,n-1) ss << j+1 << endl;
			ss << i+1 << endl;
			break;
		}		
	}
	cout << ss.str();
	return 0;
}



Measured memory_bytes: 2564
// atcoder 
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(){
    int N, K;
    cin >> N >> K;
    vector<long long> a(N);
    for(int i=0; i<N; i++) cin >> a[i];
    vector<long long> B(N*(N+1)/2);
    vector<long long> a_sum(N+1);
    for(int i=0; i<N; i++) a_sum[i+1] = a_sum[i] + a[i];
    int b = 0;
    for(int i=0; i<N; i++){
        B[b] = a[i];
        b += 1;
        int j=i+1;
        while(j<N){
            B[b] = a_sum[j+1] - a_sum[i];
            b += 1;
            j += 1;
        }
    }
    long long ans = 0;
    for(int i = 40; i>=0; i--){
        long long count = 0;
        long long y = ans + pow(2, i);
        for(int j=0; j<N*(N+1)/2; j++){
            if((B[j] & y) == y) count += 1;
        }
        if(count >= K) ans = y;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(){
  int n,k,ans=0,ansa=0,keta=0,co=0;cin>> n>>k;
  int num=n,d[10],f[10-k];fill(d,d+10,10);
  for(int i=0;i<k;i++){
    int kari;
    cin >> kari;
    d[kari]=kari;
  }
  for(int i=0;i<10;i++){
    if(d[i]!=i){f[co]=i;co++;}
  }
  while(num!=0){
    num=num/10;
    keta++;
  }
  int mo=0,mon[keta];fill(mon,mon+keta,0);
  while(true){
    mo=0;
    for(int i=0;i<keta;i++){
      mo+=(int)pow(10,i)*f[mon[i]];
    }
    
    mon[0]++;
    for(int i=0;i<keta-1;i++){
      if(mon[i]>=co){mon[i]=0;mon[i+1]++;}
    }
    if(mon[keta-1]>co){
      mo=0;
      for(int i=0;i<keta+1;i++){
        mo+=(int)pow(10,i)*f[0];
      }
      if(mo==0){
        mo=(int)pow(10,keta)*f[1];
      }
      break;
    }
    if(mo>=n){break;}
  }
  cout << mo <<endl;
}

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

#define MAX 100

int main() {
  int n;
  int i, j;
  int buf;
  int j_max;
  int x[MAX];
  
  cin >> n;
  
  for (i = 0; i < n; i++) {
    cin >> buf;
    
    if (i == 0) {
      x[0] = buf;
      j_max = 1;
    } else {
      for (j = 0; j < j_max; j++) {
        if (buf == x[j])
          break;
      }
      
      if (j == j_max) {
        x[j] = buf;
        j_max++;
      }
    }
  }
  cout << j_max << endl;
}

Measured memory_bytes: 256
def main():
    n, a, b = map(int, input().split())
    ms = [int(input()) for i in range(n)]

    ms.sort()

    times = [0 for i in range(n)]
    for i in range(n):
        times[i] = (ms[i]+b-1) // b

    left, right = -1, max(times)
    while right - left > 1:
        mid = (left+right) // 2
        center = 0
        for i in range(n):
            if ms[i] - mid * b > 0:
                exd = a - b
                center += (ms[i]-mid*b+exd-1) // exd

        if center - mid > 0:
            left = mid
        else:
            right = mid

    print(right)


if __name__ == '__main__':
    main()


Measured memory_bytes: 11296
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;
 
int main() {
    double n,k;
    cin>>n>>k;
    double su = 1/n;
    double koin = 0.5;
    double ko= 0;
    for(int i = 1;i<=n;i++){
      int tokuten = i;
      double ura = 1;
      double kakuritu = su;
      if(tokuten < k){
        for(int j = 0;;j++){
          tokuten = tokuten*2;
          ura = ura*koin;
          if(tokuten >= k) break;
        }     
      }
      kakuritu *=ura;
      ko+= kakuritu;
    }
	cout << fixed << setprecision(10) << ko << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a_list = [int(x) for x in input().split()]

ans = 0
temp_xor = a_list[0]
temp_sum = a_list[0]
r = 0
for l in range(n):
    while r < n:
        if temp_xor != temp_sum:
            break
        r += 1
        if r < n:
            temp_xor ^= a_list[r]
            temp_sum += a_list[r]
    ans += r - l
    temp_xor ^= a_list[l]
    temp_sum -= a_list[l]
print(ans)

Measured memory_bytes: 23560
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<lli> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void solve()
{

    string s;
    cin>>s;
    s[3] = '8';
    cout<<s;
    cout<<"\n";
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


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

using namespace std;

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

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

int a, b;
int main(){
    while(cin>> a>> b){
        if(a<b) swap(a, b);
        printf("%d %lld\n", gcd(a, b), lcm(a, b));
    }
}

Measured memory_bytes: 3072