akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long K = sc.nextLong();

        TreeMap<Integer, ArrayList<Integer>> map = new TreeMap<>();
        for (int i = 0; i < N; i++) {
            int k = sc.nextInt();
            int v = sc.nextInt();
            if (map.containsKey(k)) {
                map.get(k).add(v);
            } else {
                map.put(k, new ArrayList<Integer>(Arrays.asList(v)));
            }

        }

        long ans = 0;
        long count = 0;

        for (Map.Entry<Integer, ArrayList<Integer>> e : map.entrySet()) {
            for (Integer i : e.getValue()) {
                count += i;
            }
            if (count >= K) {
                System.out.println(e.getKey());
                return;
            }
        }

    }
}

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

using namespace std;

using ll = long long;
const ll mod = 1e9 + 7;

#define mem(a, b) memset(a, b, sizeof(a))
#define REP(i, a) for (int i = 0; i < a; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(a) a.begin(), a.end()

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed << setprecision(10);
}

inline void print_vector(vector<int> &A){
    for (auto&& x : A){
        cout << x << " ";
    }
    cout << endl;
}

inline void print_array(const int A[], int n) {
    REP(i, n) {
        if (i < n - 1) {
            cout << A[i] << " ";
        } else {
            cout << A[i] << endl;
        }
    }
}

inline void solve() {
    int n;
    cin >> n;

    vector<int> x(n, 0);
    vector<int> y(n, 0);

    REP(i, n) {
        cin >> x[i];
        cin >> y[i];
    }

    ll res = 0;
    int xpy_max = -INT_MAX, xpy_min = INT_MAX;
    int xmy_max = -INT_MAX, xmy_min = INT_MAX;

    REP(i, n) {
        xpy_max = max(xpy_max, x[i] + y[i]);
        xpy_min = min(xpy_min, x[i] + y[i]);
        xmy_max = max(xmy_max, x[i] - y[i]);
        xmy_min = min(xmy_min, x[i] - y[i]);
    }

    cout << max(xpy_max - xpy_min, xmy_max - xmy_min) << endl;
}

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    int t = 1;

    for (int _ = 0; _ < t; _++) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 4780
/*
 *  Created on: 13 / 9 / 2020
 *  Author:     Eslam Waheed
 */

#define _CRT_SECURE_NO_WARNINGS
 //#define __USE_MINGW_ANSI_STDIO

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

#define Eslam__Waheed ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

#define ll   long long
#define ull  unsigned ll
#define ld   long double

#define all(c)  c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define stp(n)  cout << fixed << setprecision(n);
#define iq(v)   v.resize(unique(v.begin(),v.end())-v.begin())
#define sz(s)   s.size()
#define endl    '\n'

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

//const ld PI = acos(-1);
//const ll mod = 1e9 + 7;
//const ld EPS = 1e-8;
/*
 you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )
*/
int main()
{
    //stp(0)
    Eslam__Waheed;
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll x = a * c, y = a * d, z = b * c, h = b * d;
    cout << max({ x,y,z,h });
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;
typedef pair<int, string> PSI;

int n, q;
int m;


int main(){
	while (cin >> n >> q&&n + q){
		int num, ans = 0, ma = q;
		int cnt[100] = {};
		REP(i, n){
			cin >> m;
			REP(j, m){
				cin >> num;
				cnt[num]++;
			}
		}
		REP(i, 100){
			ma = max(ma, cnt[i]);
		}
		REP(i, 100){
			if (ma == cnt[i]){
				ans = i;
				break;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
import java.util.*;
public class Main{
  public static void main(String args[])
  {
    	Scanner in = new Scanner(System.in);
    	String n = in.nextLine();
    	if(n.equals("ABC"))
        {
          System.out.println("ARC");
        }
    	else
        {
          System.out.println("ABC");
        }
  }
}

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

int main(){
    int N;
    cin >> N;
    vector<double> v(N);
    for(int i=0;i<N;i++) cin >> v[i];
    sort(v.begin(),v.end());
    while(v.size()!=1){
        v[1] = (v[0]+v[1])/2;
        v.erase(v.begin());
        sort(v.begin(),v.end());
    }
    cout << v[0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<iostream>
#include<map>
#include<cstring>
#define INF 0x3f3f3f3f
using namespace std;
map<int,int>degree;
set <int> bpf;
set <int> pf;
int n,a[100005],num=0,minn=INF;
long long ans;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        if(a[i]<0)
            num++;
        minn=min(minn,abs(a[i]));
        ans+=abs(a[i]);
    }
    if(num%2)
        ans-=2*minn;
    printf("%lld",ans);
}


Measured memory_bytes: 3580
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int num = Integer.parseInt(scanner.nextLine());
    String[] value = scanner.nextLine().split(" ");
    String[] cost = scanner.nextLine().split(" ");
    
    ArrayList list = new ArrayList<Integer>();
    int tmp = 0;
    for (int i = 0; i < num; i++) {
      if ((tmp = Integer.parseInt(value[i]) - Integer.parseInt(cost[i])) > 0) {
        list.add(tmp);
      }
    }
    if (list.size() == 0) {
      System.out.println("0");
    }
    else {
      Collections.sort(list, Comparator.reverseOrder());
      int sum = 0;
      for (int i = 0; i < list.size(); i++) {
        sum += (Integer)list.get(i);
      }
      System.out.println(sum);
    }
  }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<int,int>

using namespace std;

int main(){

    int N,M;cin>>N>>M;
    vector<pii> sense[N+1];
    REP(i,M){
        int l,r,x;cin>>l>>r>>x;
        sense[r].push_back({l,x});
    }

    LL dp[N+1][N+1][N+1];
    fill(dp[0][0],dp[N+1][0],0);
    REP(i,N+1)dp[0][0][0]=1;

    LL inf = 1e9+7;

    REP(r,N+1)REP(g,N+1)REP(b,N+1){
                int next = max({r,g,b})+1;
                for(pii p :sense[next-1]){
                    int cnt=0;
                    if(r>=p.first)cnt++;
                    if(g>=p.first)cnt++;
                    if(b>=p.first)cnt++;
                    if(cnt!=p.second)dp[r][g][b]=0;
                }
                if(next<=N){
                    dp[next][g][b]=(dp[next][g][b]+dp[r][g][b])%inf;
                    dp[r][next][b]=(dp[r][next][b]+dp[r][g][b])%inf;
                    dp[r][g][next]=(dp[r][g][next]+dp[r][g][b])%inf;
                }
            }


    LL ans =0;
    REP(i,N)REP(j,N)ans = (ans + dp[N][i][j]+dp[i][N][j]+dp[i][j][N])%inf;

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 213376
#include <bits/stdc++.h>
using namespace std;
 
	int main() {
		int a;
		cin>>a;
		string s;
		cin>>s;
		int b=0;
		int c=0;
for (int i = 0; i < a; i++)
{
	if(s.at(i)=='I'){
b++;
if(b>c)
c=b;
}
else
b--;
}
cout<<c;
	}

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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n-1; i >= 0; i--)
#define FOR(i, n, m) for(int i = n; i < (int)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18

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; }

ll MOD = 1000000007;

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];
    vector<ll> one(60);
    REP(i, N) {
        REP(j, 60) {
            one[j] += (A[i] >> j) & 1;
        }
    }
    ll ans = 0;
    REP(i, 60) {
        ll tmp = ((1LL << i) % MOD) * one[i];
        tmp %= MOD;
        tmp *= (N-one[i]);
        tmp %= MOD;
        ans += tmp;
        ans %= MOD;
    }
    PRINT(ans);
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <utility>
#include <set>
#include <cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define all(v) v.begin(),v.end()
#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))
using namespace std;
typedef pair<int,int> point;
typedef complex<double> P;
typedef long long ll;

const double eps = 1e-8;
const double INF = 1e12;


double dot(P a,P b){
	return a.real()*b.real()+a.imag()*b.imag();
}
double cross(P a,P b){
	return a.real()*b.imag()-a.imag()*b.real();
}

bool is_orthogonal(P a1,P a2,P b1,P b2){
	return EQ(dot(a1-a2,b1-b2),0.0);
}
bool is_parallel(P a1,P a2,P b1,P b2){
	return EQ(cross(a1-a2,b1-b2),0.0);
}

bool is_point_on_line(P a,P b,P c){
	return EQ(cross(b-a,c-a),0.0);
}

bool is_point_on_linesegment3(P a,P b,P c){
	return (abs(a-c)+abs(c-b)<abs(a-b)+EPS);
}

double distance_l_p(P a,P b,P c){
	return abs(cross(b-a,c-a))/abs(b-a);
}


double distance_ls_p(P a,P b,P c){
	if(dot(b-a,c-a)<EPS)return abs(c-a);
	if(dot(a-b,c-b)<EPS)return abs(c-b);
	return abs(cross(b-a,c-a))/abs(b-a);
}

int main(){
	int m,n,l;
	while(cin>>l,l){
		int ans=-1;
		rep(i,12){
			cin>>m>>n;
			l-=(m-n);
			if(l<=0 && ans==-1){
				ans=i+1;
			}
		}
		if(ans==-1)cout<<"NA"<<endl;
		else cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	if a == 1 && b == 2 {
		fmt.Println(3)
	} else if a == 1 && b == 3 {
		fmt.Println(2)
	} else if a == 2 && b == 1 {
		fmt.Println(3)
	} else if a == 2 && b == 3 {
		fmt.Println(1)
	} else if a == 3 && b == 1 {
		fmt.Println(2)
	} else if a == 3 && b == 2 {
		fmt.Println(1)
	}

}


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

int main() {
  	int a, b, c, d;
  	cin >> a >> b >> c >> d;
  	for(int i = 0; i >=0; i++){
      c = c - b;
      a = a - d;
  	if(c <= 0){
    	cout << "Yes" << endl;
      	break;
    }
  	else if(a <=0){
    	cout << "No" << endl;
      	break;
    } 
  }
}

Measured memory_bytes: 3488
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
//#define mod 998244353
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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 out(T a){ cout << a << '\n'; }
void YN(bool ok){if(ok) cout << "Yes" << endl; else cout << "No" << endl;}
//void YN(bool ok){if(ok) cout << "YES" << endl; else cout << "NO" << endl;}


const ll INF=1e18;
const int mx=200005;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    V<int> a(n),cnt(100003,0);
    set<int> st;
    rep(i,n){
        cin>>a[i];
        st.insert(a[i]);
        cnt[a[i]]++;
    }
    int c=0;
    for(int i=1;i<=100000;i++){
        if(cnt[i]>0&&cnt[i]%2==0) c++;
    }
    if(c%2==0) out(st.size());
    else{
        int tmp=st.size();
        out(tmp-1);
    }
}

Measured memory_bytes: 8540
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<math.h>
#include<set>
using namespace std;

const int N=3e5+5;
int h,w,n,ans[N];
pair<int,int> p[N];
set<int> S[N];

int main()
{
	int i,pr;
	scanf("%d%d%d",&h,&w,&n);
	pr=h;
	for(i=1;i<=n;++i)
	{
		scanf("%d%d",&p[i].first,&p[i].second);
		S[p[i].second].insert(p[i].first);
	}
	
	ans[1]=1;
	for(i=2;i<=w;++i)
	{
		ans[i]=ans[i-1]+1;
		set<int>::iterator it;
		for(it=S[i].begin();it!=S[i].end();++it)
			if((*it)==ans[i])
				++ans[i];
	}
	
	for(i=1;i<=n;++i)
		if(ans[p[i].second]<p[i].first)
			pr=min(pr,p[i].first-1);
	
	printf("%d\n",pr);
	return 0;
}

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

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

const int INF=1e9;
const int MOD=1e9+7;

int main(){
    int N; cin >> N;
    int a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    int b[N];
    for(int i=0;i<N;i++){
        cin >> b[i];
    }
    int ans=0;
    ll p=0;
    vector<int> c;
    for(int i=0;i<N;i++){
        if(b[i]-a[i]>0){
            p+=b[i]-a[i];
            ans++;
        }else c.push_back(a[i]-b[i]);
    }
    sort(c.begin(),c.end(),greater<int>());
    for(auto tmp:c){
        if(p<=0) break;
        p-=tmp;
        ans++;
    }
    if(p>0){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
}

Measured memory_bytes: 4552
ans = 0
def dfs(v, visitedNode, graph):
    visitedNode[v] = 1
    if all(visitedNode):
        global ans
        ans += 1
        return
    for node in graph[v]:
        if visitedNode[node]:
            continue
        else:
            dfs(node, visitedNode[:], graph)


N, M = map(int, input().split())
v = 0
visitedNode = [0] * N


# 隣接リストを作成する
graph = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)


# 深さ優先探索で経路数を数える
dfs(v, visitedNode, graph)
print(ans)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int K, N;
    cin >> K >> N;
    if (K % 2 == 0) {
        cout << K / 2;
        rep(i, N - 1)cout << ' ' << K;
        cout << endl;
        return 0;
    }

    int back = N;
    vi ans(N, (K + 1) / 2);
    rep(ITER, N >> 1) {
        if (ans[back - 1] == 1) {
            ans[--back] = K;
        } else {
            ans[back - 1]--;
            back = N;
        }
    }
    rep(i, back)cout << ans[i] << (i != back - 1 ? ' ' : '\n');
}


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

using namespace std;

#define ll long long int

#define DEBUG (0)
int main()
{
    int N = 0, K = 0;
    cin >> N >> K;
    vector<int> A(N,0);
    vector<int> ans(N,0);
    int d = 0;
    int sum = 0;

    for(int i = 0; i < N; i++){
        cin >> d;
        for(int j = 0; j < d; j++){
            cin >> A[j];
            ans[A[j]-1] = 1;
        }
    }

    for(int i = 0; i < N; i++){
        sum += ans[i];
    }

    cout << N - sum << "\n";

#if DEBUG
    cout << "N:" << N << ", K:" << K << ", d:" << d << endl;
    for(int i = 0; i < N; i++){
        cout << ans[i] << " ";
    }
    cout << endl;
    
#endif

}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res *= a; if(mod>=1) res %= mod;
        }
        a *= a; if(mod>=1) a %= mod;
        n >>= 1;
    }
    return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int a[LIMIT2]={0};
  char s[LIMIT1];
  char t[LIMIT1];
  
  scanf("%s",s);
  scanf("%s",t);
  n = strlen(s);
  m = strlen(t);
  if(strncmp(s,t,n)==0&&n+1==m) printf("Yes");
  else printf("No");
  
  return 0;
}



Measured memory_bytes: 1764
A,B,C,D,E,F = map(int,input().split())

ans_con = -1
max_con = E/(100+E)*100

a = 0
while F >= 100*A*a:
    b = 0
    while F-100*A*a >= 100*B*b:
        water = 100*(A*a+B*b)
        c = 0
        while F-water >= C*c:
            sugar = C*c+D*max(min(((F-water-C*c)//D),(water*E/100-C*c)//D),0)
            mass = water + sugar
            if 0 < mass <= F:
                con = sugar/mass*100
                if ans_con < con <= max_con:
                    ans_con = con
                    ans_mass = mass
                    ans_sugar = sugar
            c += 1
        b += 1
    a += 1

print(int(ans_mass), int(ans_sugar))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define bear ryan
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define ends ' '
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

void debug_out(){
   cerr << endl;
}

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
   cerr << " " << to_string(H);
   debug_out(T...);
}

#define LOCAL
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] : ", debug_out(__VA_ARGS__)
#else
#define debug(...) 917
#endif

const ll inf = 1e9;
const ll mod = 998244353;

void rmax(ll& r, ll x) { r = max(r, x); }

ll power(ll a, ll b) {
    ll r = 1, t = a;
    while(b) {
        if(b & 1)   r = r * t % mod;
        t = t * t % mod;
        b >>= 1;
    }
    return r;
}

const int maxn = 3e5 + 10;

ll n, m, k, x, y;
ll a[maxn], b[maxn];

int main(void) {
    fastio;
    string s, t;    cin >> s >> t;
    for(int i = 0; i < s.size(); ++i) if(s[i] != t[i]) {
        cout << "No";
        return 0;
    }
    cout << "Yes";
    return 0;
}


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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int X;
    cin >> X;

    int ans = 1;
    bool finish = false;
    for (int i = X; i >= 1; i--) {
        for (int j = 40; j >=2; j--) {
            int tmp = i;
            int cnt = 0;
            while (tmp%j==0) {
                tmp /= j;
                cnt++;
            }
            if (tmp == 1 && cnt > 1) {
                finish = true;
                ans = max(ans, i);
                break;
            }
        }
        if (finish) break;
    }
    print(ans);
}

signed main() {
    solve();
}


Measured memory_bytes: 256
from itertools import accumulate
N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ans = 0
acc = [0] + list(accumulate(A))
for i, a in enumerate(A):
    ans += ((acc[-1] - acc[i + 1]) * a) % MOD
    ans %= MOD

print(ans % MOD)


Measured memory_bytes: 31180
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int D;

int calc_score(vector<int>& t, vector< vector<int> >& s, vector<int>& c) {
    vector<int> last(26, 0);
    int ans = 0;
    FOR(d, 1, D) {
        ans += s[d-1][t[d-1] - 1];
        last[t[d-1] - 1] = d;
        REP(i, 26) {
            ans -= c[i] * (d - last[i]);
        }
        // cerr << "day "<< d << " : " << ans << endl;
    }
    return ans;
}

int main() {
    
    cin >> D;
    vector<int> c(26);
    REP(i, 26) cin >> c[i];
    vector< vector<int> > s(D+1, vector<int>(26));
    REP(i, D) REP(j, 26) cin >> s[i][j];

    vector<int> t(D);
    REP(i, D) cin >> t[i];

    // int ans = calc_score(t, s, c);
    // cerr << "final score = " << ans << endl;

    int M;
    cin >> M;
    vector<P> query(M);
    REP(i, M) {
        cin >> query[i].first >> query[i].second;
    }

    REP(i, M) {
        t[query[i].first - 1] = query[i].second;
        int v = calc_score(t, s, c);
        cout << v << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3976
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>  // https://boostjp.github.io/tips/math.html
#include <boost/dynamic_bitset.hpp>  // https://boostjp.github.io/tips/dynamic_bitset.html

constexpr int64_t DIV1097 = 1000000007LL;

using namespace std;

int main()
{
    std::string S;
    std::cin >> S;

    std::vector<int> N;
    N.push_back(boost::lexical_cast<int>(S[0]));
    N.push_back(boost::lexical_cast<int>(S[1]));
    N.push_back(boost::lexical_cast<int>(S[2]));
    N.push_back(boost::lexical_cast<int>(S[3]));

    for (uint8_t i = 0; i < (1 << 3); ++ i) {
        int ans = N[0];
        char op1, op2, op3;
        if (i & (1 << 2)) {
            ans += N[1];
            op1 = '+';
        }
        else {
            ans -= N[1];
            op1 = '-';
        }

        if (i & (1 << 1)) {
            ans += N[2];
            op2 = '+';
        }
        else {
            ans -= N[2];
            op2 = '-';
        }
        if (i & (1 << 0)) {
            ans += N[3];
            op3 = '+';
        }
        else {
            ans -= N[3];
            op3 = '-';
        }

        if (ans == 7) {
            std::cout << N[0] << op1 << N[1] << op2 << N[2] << op3 << N[3] << "=7" << std::endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N;
    cin >> N;
    for( int i = 0; i <= 100/4; i++ )
    {
        for( int j = 0; j <= 100/7; j++ )
        {
            int res = i*4 + j*7;
            if( res == N )
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int mod = (int)1e9 + 7;
int mult(int a, int b) {
    return (1LL * a * b) % mod;
}

int pw(int a, int b) {
    if (b == 0) return 1;
    if (b & 1) return mult(a, pw(a, b - 1));
    int res = pw(a, b / 2);
    return mult(res, res);
}

int sub(int a, int b) {
    int s = a - b;
    if (s < 0) s += mod;
    return s;
}

int sum(int a, int b) {
    int s = a + b;
    if (s >= mod) s -= mod;
    return s;
}

const int maxN = 505;

int fact[maxN], invfact[maxN], inv[maxN];

void init() {
    inv[1] = invfact[1] = invfact[0] = fact[0] = fact[1] = 1;
    for (int i = 2; i < maxN; i++) {
        fact[i] = mult(fact[i - 1], i);
        inv[i] = mult(inv[mod % i], mod - mod / i);
        invfact[i] = mult(invfact[i - 1], inv[i]);
    }
}
int n;
int cnt[maxN];
int x;
int dp[maxN][maxN];
int ndp[maxN][maxN];
int hpw[maxN][maxN];
void add(int& a, int b) {
    a += b;
    if (a >= mod) a -= mod;
}
// sum, how many
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    init();
    cin >> n >> x;
    for (int i = 1; i <= n; i++) {
        int l;
        cin >> l;
        cnt[l]++;
    }
    for (int i = 0; i < maxN; i++) {
        for (int j = 0; j < maxN; j++) {
            hpw[i][j] = pw(i, j);
        }
    }
    x++;
    dp[0][0] = 1;
    for (int i = x; i >= 1; i--) {
        for (int take = 0; take <= x; take++) {
            for (int sum = 0; sum <= x; sum++) {
                if (!dp[take][sum]) continue;
                for (int will_take = 0; will_take * i <= x - sum; will_take++) {
                    add(ndp[take + will_take][sum + will_take * i], mult(dp[take][sum], invfact[will_take]));
                }
            }
        }
        for (int take = 0; take <= x; take++) {
            for (int sum = 0; sum <= x; sum++) {
                if (!ndp[take][sum]) {
                    dp[take][sum] = 0;
                    continue;
                }
                dp[take][sum] = ndp[take][sum];
                if (cnt[i]) {
                    int coef = sum - take * i;
                    dp[take][sum] = mult(dp[take][sum], hpw[coef][cnt[i]]);
                }
                ndp[take][sum] = 0;
            }
        }
    }
    int ans = 0;
    for (int cnt = 0; cnt <= x; cnt++) {
        int coef = mult(fact[cnt], dp[cnt][x]);
        if (!(cnt & 1)) ans = sub(ans, coef);
        else ans = sum(ans, coef);

    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
}
int main(){
    ll n,m;cin >> n >>m;
    vvl v(m);
    rep(i,n){
        ll a,b;cin >> a >>b;a--;
        if(a>=m)continue;
        v[a].pb(b);
    }
    priority_queue<ll,vl,less<ll>> que;
    ll ans=0;
    rep(i,m){
        for(auto x:v[i])que.push(x);
        if(que.empty())continue;
        ans+=que.top();
        que.pop();
    }
    cout <<ans <<endl;
}

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

int main() {
  ll D,N;
  cin >> D >> N ;
  if(N == 100) N = 101;
  if(D == 0) {
    cout << N << endl;
  } else if(D == 1) {
    cout << N*100 << endl;
  } else {
    cout << N*10000 << endl;
  }
  return 0;
}
  

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

typedef long long int ll;

bool cmp(pair <string,ll> &a, pair <string,ll> &b)
{
    if(a.first < b.first){
        return true;
    }
    if(a.first > b.first){
        return false;
    }

    if(a.second > b.second){
        return true;
    }
    return false;
}

int main()
{

    ll n;
    cin>>n;

    vector < pair <string , ll> > vec;
    vector < pair <string , ll> > vec2;



    for(ll i=0;i<n;i++)
    {
        string s;
        cin>>s;
        ll sd;
        cin>>sd;
        vec.push_back({s,sd});
        vec2.push_back({s,sd});
    }

    sort(vec.begin(),vec.end(),cmp);

    for(ll i=0;i<n;i++)
    {

        for(ll j=0;j<n;j++)
        {
            if(vec2[j].first == vec[i].first){
                if(vec2[j].second == vec[i].second){
                    cout<<j+1<<endl;break;
                }
            }
        }

    }

}


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

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 s: String = read();
    let p: String = read();
    let s2 = format!("{}{}", s, s);
    if s2.contains(&p) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 5024
#include <iostream>
#include <algorithm>
using namespace std;
#define ct(string) cout << string << endl

int main() {
  int ma=0, mi=124;
  for (int i=0; i<5; i++) {
    int c;
    cin >> c;
    ma = max(ma, c);
    mi = min(mi, c);
  }
  int k;
  cin >> k;
  if (k < ma-mi) ct(":(");
  else ct("Yay!");
}


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

long long fib(int n){
    long long  a = 1, b = 1, tmp = 0;
    while (n--){
        tmp = a;
        a += b;
        b = tmp;
    }
    return b;
}

int main()
{
    int n = 0;
    cin >> n;
    cout << fib(n) << endl;
    
    return 0;
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n, a, b; cin >> n >> a >> b;
	ll v[n];
	for(ll i = 0; i < n; ++i) cin >> v[i];
	pair<ll, ll> dp[n + 1];
	for(ll i = 0; i <= n; ++i)dp[i] = pair<ll, ll>(0, i == 0);
	for(ll i = 0; i < n; ++i){
		pair<ll, ll> nextdp[n + 1];
		for(ll j = 0; j <= n; ++j)nextdp[j] = dp[j];
		for(ll j = 0; j < n; ++j){
			if(dp[j].first + v[i] > dp[j + 1].first) nextdp[j + 1] = pair<ll, ll>(dp[j].first + v[i], dp[j].second);
			else if(dp[j].first + v[i] == dp[j + 1].first) nextdp[j + 1].second += dp[j].second;
		}
		for(ll j = 0; j <= n; ++j)dp[j] = nextdp[j];
	}
	pair<ll, ll> now = pair<ll, ll>(dp[a].first, a);
	ll ans = dp[a].second;
	for(ll i = a + 1; i <= b; ++i){
		if(now.first * i < dp[i].first * now.second){
			now = pair<ll, ll>(dp[i].first, i);
			ans = dp[i].second;
		}else if(now.first * i == dp[i].first * now.second){
			ans += dp[i].second;
		}
	}
	printf("%.1919f\n%lld\n", (double)now.first / now.second, ans);
	return 0;
}

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

using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ll = long long int;
using vll = vector<ll>; using vvll = vector<vll>; using vvvll = vector<vvll>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using cdouble = complex<double>;

const double eps = 1e-7;
const double INFD = numeric_limits<double>::infinity();
#define Loop(i, n) for(int i = 0; i < int(n); i++)
#define Loopll(i, n) for(ll i = 0; i < ll(n); i++)
#define Loop1(i, n) for(int i = 1; i <= int(n); i++)
#define Loopll1(i, n) for(ll i = 1; i <= ll(n); i++)
#define Loopr(i, n) for(int i = int(n) - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = ll(n) - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = int(n); i >= 1; i--)
#define Looprll1(i, n) for(ll i = ll(n); i >= 1; i--)
#define Foreach(buf, container) for(auto buf : container)
#define Loopdiag(i, j, h, w, sum) for(int i = ((sum) >= (h) ? (h) - 1 : (sum)), j = (sum) - i; i >= 0 && j < (w); i--, j++)
#define Loopdiagr(i, j, h, w, sum) for(int j = ((sum) >= (w) ? (w) - 1 : (sum)), i = (sum) - j; j >= 0 && i < (h); j--, i++)
#define Loopdiagsym(i, j, h, w, gap) for (int i = ((gap) >= 0 ? (gap) : 0), j = i - (gap); i < (h) && j < (w); i++, j++)
#define Loopdiagsymr(i, j, h, w, gap) for (int i = ((gap) > (h) - (w) - 1 ? (h) - 1 : (w) - 1 + (gap)), j = i - (gap); i >= 0 && j >= 0; i--, j--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(ex_i, vector.size()) { cout << vector[ex_i] << " "; } cout << endl;
#define printmx(matrix) Loop(ex_i, matrix.size()) { Loop(ex_j, matrix[ex_i].size()) { cout << matrix[ex_i][ex_j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
#define Comp(type_t) bool operator<(const type_t &another) const
#define fst first
#define snd second
#define INF INFINITY
bool feq(double x, double y) { return abs(x - y) <= eps; }
bool fge(double x, double y) { return x >= y - eps; }
double fsqrt(double x) { return feq(x, 0) ? 0 : sqrt(x); }
bool inrange(ll x, ll t) { return x >= 0 && x < t; }
bool inrange(vll xs, ll t) { Foreach(x, xs) if (!(x >= 0 && x < t)) return false; return true; }
int ceillog2(ll x) { int ret = 0;	x--; while (x > 0) { ret++; x >>= 1; } return ret; }
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (m * m <= x ? 0 : -1); }
ll ceilsqrt(ll x) { ll m = (ll)sqrt((double)x); return m + (x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

/*******************************************************/

int main() {
	quickio();
	ll a, p; cin >> a >> p;
	p += a * 3;
	cout << p / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

int main() {
    string s;
    cin >> s;
    int n = s.length();
    int ans = 0;
    deque<char> a;
    for (int i = 0, j = n - 1; j - i > 0;) {
        if (s[i] == s[j]) {
            i += 1;
            j -= 1;
        } else {
            if (s[i] == 'x') {
                ans += 1;
                i += 1;
            } else if (s[j] == 'x') {
                ans += 1;
                j -= 1;
            } else {
                ans = -1;
                break;
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 512
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
        int a=sc.nextInt(),
        b=sc.nextInt(),c=sc.nextInt();
        for(int i=1;i<=b;i++){
            if((a*i)%b==c){
                System.out.println("YES");
                System.exit(0);
            }
        }
        System.out.println("NO");
       sc.close();
    }
} 

 


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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("4 3");
            WillReturn.Add("2 3 1 4");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("3 3");
            WillReturn.Add("1 2 3");
            //1
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("8 3");
            WillReturn.Add("7 3 1 8 4 6 2 5");
            //4
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        int N = wkArr[0];
        int K = wkArr[1];

        int Answer = 0;
        int I = 1;
        while (I < N) {
            I += K - 1;
            Answer++;
        }
        Console.WriteLine(Answer);
    }
}


Measured memory_bytes: 15456
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;



int main(){
    ll a,b;
    cin >>a >>b;
    ll ans;
    if(a>=13){
        ans = b;
    }
    else if(a >= 6){
        ans = b/2;
    }
    else{
        ans = 0;
    }
    cout << ans << endl;
}


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

int main() {
 
  int n_ori;
  cin >> n_ori;
  int n = n_ori;
  
  int div = 0;
  while(1) {
    div += n % 10;
    n = n / 10;
    if(n == 0) {
      break;
    }
  }
  
  if(n_ori % div == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//STANDARD DATA TYPES
#define ll long long
#define llu unsigned long long
#define ld long double
//ADV DATA TYPES
#define pii pair < int , int >
#define pll pair < ll, ll >
#define mp make_pair
#define ff first
#define ss second
//C 9/++ DS
#define vi vector < int >
#define vll vector < ll >
#define pb push_back
#define pf push_front
#define iter :: iterator
#define all(x) x.begin(),x.end()
 
//priority_queue < pii, vector < pii >, greater < pii > > pq;
//lower_bound(v.begin(),v.end(),20);//for any sorted container
//CONSTANTS
#define MOD 998244353
#define INF 0x3f3f3f3f
#define MAXN (int)(2e4+20)

#define fori(i,n) for(int i=0; i<n; i++)
#define forl(i,n) for(ll i=0; i<n; i++)
//MOD OPERATIONS
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll addmod(ll a, ll val, ll p = MOD) {{if ((a = (a + val)) >= p) a -= p;} return a;}
inline ll submod(ll a, ll val, ll p = MOD) {{if ((a = (a - val)) < 0) a += p;}return a;}
inline ll mult(ll a, ll b, ll p = MOD) {return (ll) a * b % p;}
const  llu int_max = pow(2,32) - 1 ;

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.ff < j.ff;
}

int main(){
	fastio
	int a,b ;
	cin>>a>>b ;
	cout<<max(max(a+b,a-b),a*b);

	return 0;
}



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

int main() {
  int N, K;
  cin >> N >> K;
  vector< int > ls;
  for (int i = 0; i < N; i++) {
    int l;
    cin >> l;
    ls.push_back(l);
  }
  sort(ls.begin(), ls.end(), greater< int >());
  int ans = 0;
  for (int i = 0; i < K; i++) {
    ans += ls[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 888
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef long long ll;

template<class T>
inline bool chmin(T& a, const T& b) {
    if(b<a) {
        a=b;
        return true;
    }

    return false;
}

struct Edge {
    int to,cost;
    int h,r;
    Edge(int to,int cost,int h,int r) :
        to(to),cost(cost),h(h),r(r){}
};
struct Passport{
    int len;
    int d;
    int S;
    int comps[10];
};

int N,M,H,K;
vector<Edge> G[102];
vector<Passport> pass;

typedef pair<int,pair<int,int> > Pi;
int d[102][30];
int dijk(int s,int t,int S) {
    typedef pair<int,int> P;
    rep(i,102) rep(j,30) d[i][j]=INF;
    d[s][0]=0;

    priority_queue<Pi,vector<Pi>,greater<Pi> > que;
    que.push(Pi(0,P(s,0)));

    while(que.size()) {
        Pi pi=que.top(); que.pop();
        int v=pi.sc.fr;
        int h=pi.sc.sc;

        rep(i,G[v].size()) {
            Edge e=G[v][i];
            int cost = e.cost;
            if((S>>e.r)&1) {
                cost=0;
            }

            if(h+e.h<=H && chmin(d[e.to][h+e.h],d[v][h]+cost)) {
                que.push(Pi(d[e.to][h+e.h],P(e.to,h+e.h)));
            }
        }
    }

    int ret=INF;
    rep(i,H+1) chmin(ret,d[t][i]);

    return ret;
}

int dp[300][1<<8];
int calc_dp() {
    dp[0][0]=0;
    // dp[i][S] i???????????§S???????????¨??????????°??????????
    rep(i,pass.size()) rep(S,1<<8) {
        int d=pass[i].d;
        int S_n=S|pass[i].S;

        chmin(dp[i+1][S_n],dp[i][S]+d);
        chmin(dp[i+1][S],dp[i][S]);
    }

}

void solve() {
    rep(i,300) rep(j,1<<8) dp[i][j]=INF;
    int P;
    int s,t;
    rep(i,102) G[i].clear();
    pass.clear();
    rep(i,M) {
        int a,b,c,h,r;
        cin>>a>>b>>c>>h>>r;
        r--;
        G[a].pb(Edge(b,c,h,r));
        G[b].pb(Edge(a,c,h,r));
    }
    cin>>s>>t;
    cin>>P;
    pass.resize(P);
    rep(i,P) {
        int l,d;
        cin>>l>>d;
        pass[i].len=l;
        pass[i].d=d;
        int Set=0;
        rep(j,l) {
            int k;
            cin>>k;
            k--;
            Set|=1<<k;
            pass[i].S=Set;
        }
    }

    calc_dp();

    int ans=INF;
    // rep(i,1<<3) printf("%d %d\n",i,dp[2][i]);
    rep(S,1<<8) {
        chmin(ans, dijk(s,t,S)+dp[pass.size()][S]);
    }
    if(ans==INF) ans=-1;
    cout<<ans<<endl;

}

int main() {
    while(cin>>N>>M>>H>>K) {
        if(N+M+H+K==0) break;
        solve();
    }
    return 0;
}

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

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

	int ans = 0;
	if(s.at(0) == t.at(0)) ans++;
	if(s.at(1) == t.at(1)) ans++;
	if(s.at(2) == t.at(2)) ans++;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			int d = in.nextInt();
			int x = in.nextInt();
			int[] an = in.nextIntArray(n);

			int sum = 0;
			for (int i = 0; i < n; i++) {
				for (int j = 1; j <= d; j=j+an[i]) {
					sum++;
				}
			}

			out.println(x+sum);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 23380
import heapq
N,M=map(int,input().split())
bri=[[] for _ in range(N)]
for i in range(M):
  a,b,c=map(int,input().split())
  bri[a-1].append([b,c])
  bri[b-1].append([a,c])

ans=0  
for i in range(N):
  a=i+1
  nseen=list(range(1,N+1))
  dist=[float("inf")]*N
  dist[a-1]=0
  q=[[dist[i],i] for i in range(N)]
  heapq.heapify(q)
  while q:
    d,ind=heapq.heappop(q)
    if d<=dist[ind]:
      for n,c in bri[ind]:
        if dist[n-1]>d+c:
          dist[n-1]=d+c
          heapq.heappush(q,[dist[n-1],n-1])
  for b,c in bri[i]:
    if a<b:
      if dist[b-1]<c:
        ans+=1
        
print(ans)

Measured memory_bytes: 3348
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
typedef pair<int,int> pi;

ll N;

int main() {
	ios_base::sync_with_stdio(0); 
	cin.tie(0);
	cin >> N;
	if (N % 2ll != 0) {
		cout << 0;
	} else {
		ll ans = 0;
		for (ll i = 10; N / i >= 1; i*=5) {
			ans += N/i;
		}		
		cout << ans;
	}
	return 0;
}

Measured memory_bytes: 256