akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    ll N, x;
    cin >> N >> x;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(all(A));
    ll sum = 0;
    int i = 0;
    while(i < N && sum < x) {
        sum += A[i];
        i++;
    }
    if (x == sum) {
        cout << i << endl;
    } else {
        cout << i - 1 << endl;
    }
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")*/

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
#define mp make_pair
#define what_is(x) cerr << #x << " is " << x << endl;

typedef tree<
        int,
        null_type,
        less<int>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;


const int p = 1e9 + 7;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

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

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

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

vector<int> Z(vector<int> s)
{
    int n = s.size();
    vector<int> z(n);
    int L = 0, R = 0;
    for (int i = 1; i < n; i++) {
        if (i > R) {
            L = R = i;
            while (R < n && s[R-L] == s[R]) R++;
            z[i] = R-L; R--;
        } else {
            int k = i-L;
            if (z[k] < R-i+1) z[i] = z[k];
            else {
                L = i;
                while (R < n && s[R-L] == s[R]) R++;
                z[i] = R-L; R--;
            }
        }
    }
    return z;
}

mt19937 rnd(time(0));
/*
struct Line {
    mutable ll k, m, p;
    bool operator<(const Line& o) const { return k < o.k; }
    bool operator<(ll x) const { return p < x; }
};

struct CHT : multiset<Line, less<>> {
    // (for doubles, use inf = 1/.0, div(a,b) = a/b)
    const ll inf = LLONG_MAX;
    ll div(ll a, ll b) { // floored division
        return a / b - ((a ^ b) < 0 && a % b); }
    bool isect(iterator x, iterator y) {
        if (y == end()) { x->p = inf; return false; }
        if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
        else x->p = div(y->m - x->m, x->k - y->k);
        return x->p >= y->p;
    }
    void add(ll k, ll m) {
        auto z = insert({k, m, 0}), y = z++, x = y;
        while (isect(y, z)) z = erase(z);
        if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
        while ((y = x) != begin() && (--x)->p >= y->p)
            isect(x, erase(y));
    }
    ll query(ll x) {
        assert(!empty());
        auto l = *lower_bound(x);
        return l.k * x + l.m;
    }
};
*/

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

    int n, k;
    cin>>n>>k;
    string s;
    cin>>s;
    int cnt = 0;
    for (int i = 0; i<n-1; i++) if (s[i]!=s[i+1]) cnt++;
    cnt = max(0, cnt-2*k);
    cout<<n-1 - cnt;
}

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

/** 
 * @brief Topological Sort
 * O(v + e)
 */

#define int long long
const int INF = 1 << 29;
const int N = 1e5 + 10;

vector<int> g[N];
int n, m;
int deg[N];
bool viisted[N];


int32_t main(){
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++){
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    deg[y]++;
  }
  queue<int> Q;
  for (int i = 0; i < n; i++){
    if (deg[i] == 0)
      Q.push(i);
  }
  vector<int> ret;
  while (!Q.empty()){
    int u = Q.front();
    Q.pop();
    ret.push_back(u);
    for (auto it : g[u]){
      if (--deg[it] == 0)
        Q.push(it);
    }
  }
  // topological ordering
  for (auto it : ret)
    cout << it << endl;
}


Measured memory_bytes: 6344
import Data.Char
import qualified Data.Map.Strict as M
import Data.Map.Strict ((!))

main = putStrLn . (results!) . (\[l,r] -> compare l r) . map digitToInt . filter isHexDigit =<< getLine

results = M.fromDistinctAscList [(LT,"<"), (EQ,"="), (GT,">")]


Measured memory_bytes: 380
n = int(input())
a = [[0 for i in range(10)]for j in range(10)]
for i in range(1,n+1):
    s = str(i)
    a[int(s[0])][int(s[len(s)-1])]+=1
ans = 0
for i in range(1,10):
    for j in range(1,10):
        if i!=j:
            ans += a[i][j]*a[j][i]
        else:
            ans += a[i][i]*(a[i][i]-1)+a[i][i]
print(ans)

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


void solve(long long N, std::string S){
    REP(i, S.size()){
        S.at(i) = 'A' + (char)((N + (ll)(S.at(i) - 'A')) % 26);
    }
    cout << S << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        HashMap<String, Integer> ans = new HashMap<>();
        for (int i = 0; i < N; i++) {
            String t = scan.next();
            ans.merge(t, 1, Integer::sum);
        }
        // AC, WA, TLE, RE
        System.out.println("AC x " + ans.getOrDefault("AC", 0));
        System.out.println("WA x " + ans.getOrDefault("WA", 0));
        System.out.println("TLE x " + ans.getOrDefault("TLE", 0));
        System.out.println("RE x " + ans.getOrDefault("RE", 0));
    }
}


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

int n,x,t;
int main(){    
    cin >> n >> x >> t;
    if(n%x == 0){
        cout << (n/x) * t << endl;
    }else{
        cout << ((n/x) + 1) * t << endl;
    }
    return 0;
}


Measured memory_bytes: 3616
s,i,x,m;
main(n,a,b){
	for(scanf("%d%d%d",&n,&a,&b);i++<n;){
		x=i;
		m=0;
		while(x)m+=x%10,x/=10;
		if(a<=m&&m<=b)s+=i;
	}
	printf("%d",s);
}


Measured memory_bytes: 128
from math import radians, cos
a, b, h, m = map(int, input().split())
s = 30 * h + (1 / 2) * m
l = 6 * m
theta = radians(abs(s - l))
ans = (a ** 2 + b ** 2 - (2 * a * b * cos(theta))) ** (1 / 2)
print(ans)

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

int n,hed[5010],sz[5010],cnt;
long long f[5010][5010],g[5010],dp[5010];
const long long mod=1e9+7;
struct node
{
	int to,next;
}a[200010];
inline void add(int from,int to)
{
	a[++cnt].to=to;
	a[cnt].next=hed[from];
	hed[from]=cnt;
}
inline void dfs(int x,int fa)
{
	sz[x]=1;
	f[x][1]=1;
	for(int i=hed[x];i;i=a[i].next)
	{
		int y=a[i].to;
		if(y==fa)
		continue;
		dfs(y,x);
		for(int j=0;j<=sz[x]+sz[y];++j)
		dp[j]=0;
		for(int j=1;j<=sz[x];++j)
		{
			for(int k=0;k<=sz[y];++k)
			{
				dp[j+k]=(dp[j+k]+f[x][j]*f[y][k]%mod)%mod;
			}
		}
		sz[x]+=sz[y];
		for(int j=1;j<=sz[x];++j)
		f[x][j]=dp[j];
	}
	for(int i=2;i<=sz[x];i+=2)
	f[x][0]=(f[x][0]+mod-f[x][i]*g[i]%mod)%mod;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n-1;++i)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	g[0]=1;
	for(int i=2;i<=n;i+=2)
	g[i]=g[i-2]*(i-1)%mod;
	dfs(1,0);
	printf("%lld\n",(mod-f[1][0])%mod);
	return 0;
}

Measured memory_bytes: 195712
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll N;
    ll A[MAX_N];
    ll answer = 0;
    ll n;
    
    cin >> N;
    n = N;
    //rep(i, N) cin >> A[i];
    rep(i, 10){
        answer += N % 10;
        N /= 10;
    }
    if (n %answer ==0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

int main() {
  long N, A, B;
  cin >> N >> A >> B;
  
  if ((A == 0) && (B == 0)) cout << 0 << endl;
  else {
    long Q = N / (A + B);
    long R = N % (A + B);
  
    if(R <= A) cout << Q * A + R << endl;
    else cout << Q * A + A << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
#define pie 3.14159265358979323846
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;


template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int mod =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
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;
}

ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}
bool greater_pair(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first!=b.first){
        return a.first>b.first;
    }else{
        return a.second>b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    int S=in();
    int W=in();
    if(W>=S){
        cout<<"unsafe"<<endl;
    }else{
        
        cout<<"safe"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3656
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        long[] a = new long[n];

        for(int i = 0; i < n; i++){
            a[i] = sc.nextLong();
        }

        long ans = 0;
        long sum = 0;
        for(int i = 1; i < n; i++){
            sum += a[i - 1];
            sum %= 1000000007;
            ans += (a[i] * sum);
            ans %= 1000000007L;
        }

        System.out.println(ans);

    }
}

Measured memory_bytes: 61456
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int H;

signed main(){
	cin>>H;
	int ans=0;
	int R=Log2(H);
	for(int i=0;i<=R;i++){
		ans+=pow2(2,i);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <algorithm>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <queue>
#include <vector>
#include <cstdlib>
#include <stack>
#include <ctime>
#define lld long long int
#define rep(i,start,end) for(lld i = start;i<end;i++)
#define newline cout << endl
#define fastio ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define in insert
#define mp make_pair
#define se second
#define fi first
#define starttime chrono::time_point<chrono::system_clock> start, end; start = chrono::system_clock::now()
#define showtime end = chrono::system_clock::now();  chrono::duration<double> elapsed_seconds = end - start; time_t end_time = chrono::system_clock::to_time_t(end); cout << "elapsed time: " << elapsed_seconds.count() << "s\n"
#define INF 1e16+1
#define MOD (lld)(1e9+7)
#define mh make heap
#define ph push_heap
#define poph pop_heap
#define openf   freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
using namespace std;
lld add(long long a, long long b){return ((a%MOD)+(b%MOD))%MOD;}

lld mul(long long a, long long b){return ((a%MOD)*(b%MOD))%MOD;}
lld modInverse(lld a){   lld m = MOD,m0 = m, y = 0, x = 1;  if (m == 1) return 0;   while (a > 1) {  lld q = a / m, t = m;  m = a % m, a = t, t = y;          y = x - q * y, x = t;   } if (x < 0)  x += m0; return x; } 
lld gcd(lld a, lld b){if (b == 0) return a; return gcd(b, a % b);}
void MAIN();
int get(){lld t;cin>>t; return t;}
int log(string name){cout<<name<<endl; return 0;}
void test(int t) { while(t--){MAIN();} }
#define all(v) (v).begin(),(v).end()

void MAIN(){    

    lld n,m;
    cin >> n >> m;
   cout << (n*(n-1))/2 + (m*(m-1))/2;
   
}





int main(){ 
    fastio;
    test(1);
    return 0;
}


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

namespace AtCoder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int[] vs = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
			int N = vs[0];
			int M = vs[1];
			Lamp[] k = new Lamp[M];
			for (int i = 0; i < M; i++) {
				vs = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
				k[i] = new Lamp() { SwCount = vs[0], SwList = vs.Skip(1).Select(p => p - 1).ToArray() };
			}
			vs = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
			for (int i = 0; i < M; i++) {
				k[i].p = vs[i];
			}
			int ans = 0;
			for (int i = 0; i < 0x1 << N; i++) {
				bool f = true;
				foreach (var lamp in k) {
					int c = 0;
					foreach (var sw in lamp.SwList) {
						if ((i & 0x1 << sw) != 0) {
							c++;
						}
					}
					if (c % 2 != lamp.p) {
						f = false;
						break;
					}
				}
				if (f) {
					ans++;
				}
			}
			Console.WriteLine(ans);
		}
	}

	public class Lamp
	{
		public int SwCount;
		public int[] SwList;
		public int p;
	}
}


Measured memory_bytes: 11348
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;
#[allow(dead_code)]
const MOD:i64 = 1e9 as i64 + 7;


fn main() {
    input!{a:[i64;3]};
    let set:HashSet<_> = a.iter().collect();
    println!("{}", set.len());
}


Measured memory_bytes: 4352
oira = str()
S = str()
for i in range(3):
	s = input().split()
	S += s[0] + s[1]
if (S.count('1') == 3)|(S.count('2')==3)|(S.count('3')==3)|(S.count('4')==3):
	print('NO')
else:
	print('YES')

Measured memory_bytes: 3060
/*input
4
ushi
tapu
nichia
kun
*/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

void run() {
	int n;
	cin >> n;
	map<string, int> mp;
	int mx = 0, i;
	for(i=0; i<n; i++) {
		string s;
		cin >> s;
		mp[s]++;
		mx = max(mx, mp[s]);
	}
	for(auto it = mp.begin(); it != mp.end(); it++) {
		if(it->second == mx) {
			cout << it-> first << endl;
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);		
	int t = 1;
	// cin >> t;
	while(t--) {
		run();
	}
}


Measured memory_bytes: 23808
#include<bits/stdc++.h>
#define ul unsigned long
using namespace std;
int main(){
  cin.tie(0);ios::sync_with_stdio(false);
  ul n;ul tmp;ul m=0;
  cin>>n;
  vector<pair<ul,ul> >l(n+1);vector<ul long>ans(n);
  for(ul i=0;i<n;++i){cin>>tmp;l[i]=make_pair(tmp,i);}
  l[n]=make_pair(0,n);
  stable_sort(l.rbegin(),l.rend());
  for(auto it=l.cbegin(),tar=l.cbegin();it!=l.cend()-1;){
    if(tar->second>it->second)tar=it;
    ans[tar->second]+=(it->first-(++it)->first)*++m;
  }
  for(auto x:ans)cout<<x<<'\n';cout.flush();
  return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vi A(N);
  rep(i,N) {
    cin >> A[i];
  }
  ll m = 1000;
  rep(i,N-1) {
    ll s = 0; 
    if(A[i]<A[i+1]) {
      s = m / A[i];
    }
    m += (A[i+1]-A[i])*s;
  }
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 3616
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
N,K = map(int,input().split())
if K % 2 == 1:
    x = N // K
    print(x**3)
else:
    k = K // 2
    x = N // k
    if x % 2 == 0:
        y = x // 2
        print(2*(y**3))
    else:
        y = x // 2
        print(y**3+(y+1)**3)


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

using namespace std;

int main(){
	string A,B;
	cin >> A >> B;
	bool equal = true;
	if(A.size() > B.size()) cout << "GREATER" << endl;
	else if(A.size() < B.size()) cout << "LESS" << endl;
	else{
		for(int i = 0; i < A.size(); i++){
			if(A[i] != B[i]){
				equal = false;
				if(A[i] > B[i])  cout << "GREATER" << endl;
				else  cout << "LESS" << endl;
				break;
			}
		}
		if(equal) cout << "EQUAL" << endl;
	}
	return 0;
}

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

queue<string> Q;
int n;

	int a,b,c;
	int l[8];

void make() {
	Q.push("0");
	Q.push("1");
	Q.push("2");
	Q.push("3");

	while((int)Q.size() < (int)pow(4.0, n)) {
		string q = Q.front(); Q.pop();
		string q0 = q+"0";
		string q1 = q+"1";
		string q2 = q+"2";
		string q3 = q+"3";
		Q.push(q0);
		Q.push(q1);
		Q.push(q2);
		Q.push(q3);
	}
}

int cnt(string q){

	int fora = 0, forb=0, forc=0;
	int mp = 0;
	bool flag1 = true, flag2 = true, flag3 = true;
	rep(i,(int)q.size()) {
		if (q[i] == '1') {
			fora += l[i];
			if (flag1) {
				flag1 = false;
			} else {
				mp += 10;
			}
		} else if (q[i] == '2') {
			forb += l[i];
			if (flag2) {
				flag2 = false;
			} else {
				mp += 10;
			}
		} else if (q[i] == '3') {
			forc += l[i];
			if (flag3) {
				flag3 = false;
			} else {
				mp += 10;
			}
		}
	}
	mp += abs(fora - a) + abs(forb - b) + abs(forc - c);

	return mp;

}
bool valid(string q) {
	bool f1=false,f2=false,f3=false;
	rep(i, (int)q.size()) {
		if (q[i] == '1') {
			f1 = true;
		} else if (q[i] == '2') {
			f2 = true;
		} else if (q[i] == '3') {
			f3 = true;
		}
	}
	if (f1 && f2 && f3) {
		return true;
	} else {
		return false;
	}
}

int main(){

	cin >> n >> a >> b >> c;
	rep(i,n) {
		cin >> l[i];
	}
	make();

	int mi = 4000;
	while(!Q.empty()) {
		string q = Q.front(); Q.pop();

		// 1,2,3全部含んでないとだめ
		if (valid(q)) {
		mi = min(mi, cnt(q));
		}
	}
	cout << mi << endl;
}


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


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

    // 1, 2, N
    vector<tuple<char,char,char>> inits;
    if (s[0] == 'o') {
        inits.push_back(make_tuple('S', 'S', 'S'));
        inits.push_back(make_tuple('S', 'W', 'W'));
        inits.push_back(make_tuple('W', 'S', 'W'));
        inits.push_back(make_tuple('W', 'W', 'S'));
    } else {
        inits.push_back(make_tuple('S', 'S', 'W'));
        inits.push_back(make_tuple('S', 'W', 'S'));
        inits.push_back(make_tuple('W', 'S', 'S'));
        inits.push_back(make_tuple('W', 'W', 'W'));
    }
    bool is_ok = false;
    vector<char> a(N);
    for (auto init : inits) {
        a = vector<char>(N);
        a[0] = get<0>(init);
        a[1] = get<1>(init);
        char a_N = get<2>(init);
        for (int i = 1; i < N - 1; i++) {
            if (a[i] == 'S') {
                if (s[i] == 'o') {
                    a[i + 1] = a[i - 1];
                } else {
                    a[i + 1] = a[i - 1] == 'S' ? 'W' : 'S';
                }
            } else { // 'W'
                if (s[i] == 'o') {
                    a[i + 1] = a[i - 1] == 'S' ? 'W' : 'S';
                } else {
                    a[i + 1] = a[i - 1];
                }
            }
        }
        if (a[N - 1] != a_N) continue;
        if (a[N - 1] == 'S') {
            if (s[N - 1] == 'o') {
                if (a[N - 2] == a[0]) { is_ok = true; break; }
            } else {
                if (a[N - 2] != a[0]) { is_ok = true; break; }
            }
        } else { // 'W'
            if (s[N - 1] == 'o') {
                if (a[N - 2] != a[0]) { is_ok = true; break; }
            } else {
                if (a[N - 2] == a[0]) { is_ok = true; break; }
            }
        }
    }
    if (is_ok) {
        for (char c : a) cout << c;
        cout << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3804
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll X, A, B;
  cin >> X >> A >> B;
  ll ans = X - A - ((X - A) / B) * B;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	x := make([]int, n)
	y := make([]int, n)
	h := make([]int, n)

	xt := 0
	yt := 0
	ht := 0

	for i := 0; i < n; i++ {
		x[i], y[i], h[i] = nextInt(), nextInt(), nextInt()
		if h[i] > 0 {
			xt, yt, ht = x[i], y[i], h[i]
		}
	}

	for cx := 0; cx <= 100; cx++ {
		for cy := 0; cy <= 100; cy++ {
			Ht := ht + abs(xt-cx) + abs(yt-cy)
			cnt := 0

			for i := 0; i < n; i++ {
				if h[i] == max(0, Ht-abs(cx-x[i])-abs(cy-y[i])) {
					cnt++
				}
				// if h[i-1] == 0 {
				// 	continue
				// }

				// hh = abs(x[i]-cx) + abs(y[i]-cy) + h[i]

				// prevh = abs(x[i-1]-cx) + abs(y[i-1]-cy) + h[i-1]

				// if hh == prevh && max(hh-abs(x[i]-cx)-abs(y[i]-cy), 0) == h[i] {
				// 	continue
				// } else {
				// 	can = false
				// 	break
				// }
			}
			// fmt.Printf("%d %d %d\n", cx, cy, hh)

			// if can {
			// 	fmt.Printf("%d %d %d\n", cx, cy, hh)
			// 	return
			// }
			if cnt == n {
				fmt.Printf("%d %d %d\n", cx, cy, Ht)
				return
			}
		}
	}

}

func abs(a int) int {
	if a < 0 {
		return -1 * a
	}
	return a
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}


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

const int INF = 1<<28;
const int MAXH = 60;
const int MAXW = 30;
const int dx[13] = {0,0,0,0,0,   1,1,1,  -1,-1,-1, 2, -2};
const int dy[13] = {2,1,0,-1,-2, 1,0,-1, 1,0,-1,   0, 0};

int w, h;
char s[MAXH][MAXW];

struct State {
  int lx, ly, rx, ry, f, cost;

  bool operator < (const State &s) const {
    if(lx != s.lx) return lx < s.lx;
    if(ly != s.ly) return ly < s.ly;
    if(rx != s.rx) return rx < s.rx;
    if(ry != s.ry) return ry < s.ry;
    if(f != s.f) return f < s.f;
    return false;
  }

  bool ok() const {
    return lx < rx && abs(lx-rx) + abs(ly-ry) <= 3 &&
      0 <= min(lx,rx) && max(lx,rx) < w &&
      0 <= min(ly,ry) && max(ly,ry) < h;
  }
};

struct GT {
  bool operator () (const State &a, const State &b) const {
    return a.cost > b.cost;
  }
};

int main() {
  while(cin >> w >> h && (w|h)) {
    for(int i = 0; i < h; ++i) {
      for(int j = 0; j < w; ++j) {
        cin >> s[i][j];
      }
    }
    try {
      map<State, int> cost;
      priority_queue<State, vector<State>, GT> que;
      for(int x = 0; x < w; ++x) {
        for(int y = 0; y < h; ++y) {
          if(s[y][x] != 'S') continue;
          State src = {x, y, x, y, 0, 0};
          src.f = 0;
          cost[src] = 0;
          que.push(src);
          src.f = 1;
          cost[src] = 0;
          que.push(src);
        }
      }
      while(que.size()) {
        const State a = que.top();
        que.pop();
        if(cost.count(a) && a.cost > cost[a]) continue;
        for(int k = 0; k < 13; ++k) {
          State b; int x, y;
          if(a.f) {
            b = (State){a.rx+dx[k]-1, a.ry+dy[k], a.rx, a.ry, !a.f, a.cost};
            x = b.lx, y = b.ly;
          } else {
            b = (State){a.lx, a.ly, a.lx+dx[k]+1, a.ly+dy[k], !a.f, a.cost};
            x = b.rx, y = b.ry;
          }
          if(!b.ok()) continue;
          if(s[y][x] == 'X') continue;
          if(s[y][x] == 'T') throw a.cost;
          if(s[y][x] != 'S') b.cost += s[y][x] - '0';
          if(cost.count(b) && b.cost >= cost[b]) continue;
          cost[b] = b.cost;
          que.push(b);
        }
      }
      throw -1;
    } catch(int res) {
      cout << res << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3248
n = gets.to_i
@a = gets.split.map(&:to_i)

@a << 0
(n-1).times {|i| @a[i+1] += @a[i]}

INF = 1 << 50

@memo = Array.new(n) {Array.new(n)}

def calc(l, r)
    return @memo[l][r] if @memo[l][r]
    return @memo[l][r] = 0 if l == r

    t = INF
    l.upto(r-1) do |i|
        u = calc(l, i) + calc(i+1, r)
        t = u if t > u
    end

    @memo[l][r] = @a[r] - @a[l-1] + t
end

p calc(0, n-1)

Measured memory_bytes: 16036
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))

k = int(input())

for i in range(1,10):
    if (k % i == 0):
        if (k // i < 10):
            print("Yes")
            exit()
print("No")




Measured memory_bytes: 9012
#ifdef __GNUC__
#pragma GCC target("avx2")
#pragma GCC optimize ("O20")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC optimize("unroll-loops")
#define iss std::cin
#endif
#include "bits/stdc++.h"
#define rep(i, times) for(ll i = 0; i < (times); ++i)
#define p(x) (cout << x << "\n")
using ll = long long; using ld = long double; using namespace std;

#ifndef __GNUC__
string text =
R"X(
8
7 3 5 4 2 1 6 8
3 8 2 5 4 6 7 1
)X";
stringstream iss{text};
#endif

class CountOrder
{
	ll N{0};
	vector<ll> p, q;
	void inp( ) {
		iss >> N; p.resize(N); q.resize(N);
		rep(n, N) { iss >> p[n]; }
		rep(n, N) { iss >> q[n]; }
		//for_each(begin(p), end(p), [](auto x) { cout << x << "\n"; });
	}
	void change( ) {
		ll sa{0};
		if (p > q) swap(p, q);
		do {
			if (p == q) break;
			++sa;
		} while (next_permutation(begin(p), end(p)));
		p(sa);
	}
public:
	void procedures( ) {
		inp( );
		change( );
	}
};
//https://atcoder.jp/contests/abc145/tasks/abc145_c
int main( ) {
	cin.tie(0);	ios::sync_with_stdio(0);
	cout << fixed << setprecision(15);
	class CountOrder a; a.procedures( );
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<functional>
#include<stack>
#include<utility>

using namespace std;

int T[1000], P[1000], R[1000], tID[1000][500], pID[1000][500], Time[1000][500], msg[1000][500], n = 0;

int main() {
	while (cin >> T[n] >> P[n] >> R[n]) {
		if (T[n] == 0)break;
		for (int j = 0; j < R[n]; j++) {
			string messege;
			cin >> tID[n][j] >> pID[n][j] >> Time[n][j] >> messege;
			if (messege == "CORRECT")msg[n][j] = 1;
			else msg[n][j] = 0;
		}
		n++;
	}
	for (int i = 0; i < n; i++) {
		vector<pair<int, int> > AP, temp;
		AP.resize(T[i]);
		int WA[50][10]{ 0 };
		for (int j = 0; j < R[i]; j++) {
			if (msg[i][j] == 0) {
				WA[tID[i][j] - 1][pID[i][j] - 1]++;
			}
			else {
				AP[tID[i][j] - 1].first--;
				AP[tID[i][j] - 1].second += Time[i][j] + WA[tID[i][j] - 1][pID[i][j] - 1] * 1200;
			}
		}
		temp = AP;
		sort(temp.begin(), temp.end());
		int j = 0, k = 0, memo[50]{0};
		while (j < T[i]) {
			if (memo[k] > 0) {
				k++;
				continue;
			}
			if (temp[j] == AP[k]) {
				cout << k + 1 << " " << -temp[j].first << " " << temp[j].second << endl;
				j++;
				memo[k]++;
				k = 0;
			}
			else k++;
		}
	}
	return 0;
}

Measured memory_bytes: 3648
import numpy as np
n,k = map(int,input().split())
item = [int(input()) for i in range(n)]
item = np.array(item)
item = np.sort(item)

ans = []

for i in range(len(item)-k+1):
  temp = item[i+k-1]-item[i]
  ans.append(temp)
  
ans = np.array(ans)
print(ans.min())

Measured memory_bytes: 18208
N, K, C = map(int, input().split())
S = input()

ls = []
nex = -1
for i in range(N):
    if S[i] == "o" and i > nex:
        ls.append(i + 1)
        nex = i + C
        
    if len(ls) == K:
        break

rs = []
nex = N
for i in reversed(range(N)):
    if S[i] == "o" and i < nex:
        rs.append(i + 1)
        nex = i - C
        
    if len(rs) == K:
        break
        
for l, r in zip(ls, rs[::-1]):
    if l == r:
        print(l)


Measured memory_bytes: 56700
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,d;
  int x[15][15];
  int count=0;
  double s=0;

  cin>>n>>d;
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
      cin>>x[i][j];
    }
  }

  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      s=0;      
      for(int k=0;k<d;k++){    
	s+=abs(x[i][k]-x[j][k])*abs(x[i][k]-x[j][k]);
      }
      s=sqrt(s);
      if(s==(int)s) count++;
    }
  }

  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int readint() { return readln.chomp.to!int; }

void main() {
    string s = readln.chomp;
    int k = readint();
    int n = s.length.to!int;

    string[] subs;
    foreach (st; 0..n) foreach(len; 1..n+1-st) {
        if (len > 5) break;
        subs ~= s[st..st+len];
    }
    subs.sort().uniq.array[k - 1].writeln;
}

Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <set>
#include <utility>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <climits>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

int main()
{
	int n;
	ll a[100000], b[100000], c[100000];
	ll num[114514] = {0};
	ll num2[114514] = {0};
	cin >> n;
	rep(i, n){
		scanf("%lld", &a[i]);
	}
	rep(i, n){
		scanf("%lld", &b[i]);
	}
	rep(i, n){
		scanf("%lld", &c[i]);
	}

	sort(a, a+n);
	sort(b, b+n);
	sort(c, c+n);

	rep(i, n){
		ll *k= lower_bound(a, a+n, b[i]);
		num[i]=(ll)(k-a);
	}
	ll tmp = 0;
	rep(i, n){
		num2[i] = tmp+num[i];
		tmp += num[i];
	}
	ll sum = 0;
	rep(i, n){
		ll *k = lower_bound(b, b+n, c[i]);
		sum += num2[(ll)(k-b-1)];
	}
	cout << sum << endl;
}



Measured memory_bytes: 4480
#include<stdio.h>
int main(void)
{
	int a,flg,i,x,y,w,r,X,S;
	scanf("%d",&a);
	for(i=0;i<a;i++){
		flg=1;
		X=0; S=0;
		scanf("%d%d%d%d",&x,&y,&w,&r);
		if(w>=5&&r>=2){
			X=(x*w+y*r)*0.8;
			flg=0;
		}
		else{
			X=x*w+y*r;
		}
		while(1){
			if(flg==0){
				printf("%d\n",X);
				break;
			}
			else{
				if(w<5){
					w=5;
				}
				if(r<2){
					r=2;
				}
				S=(x*w+y*r)*0.8;
			}
			if(X<S){
				printf("%d\n",X);
				break;
			}
			else{
				printf("%d\n",S);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLD = vector<PLD>;

const int INF = numeric_limits<int>::max();

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

    LL x;
    cin >> x;

    LL ans = 0, tmp = 0;
    while(ans<x)
    {            
        tmp += 1;
        ans += tmp;
    }

    cout << tmp << endl;

    return 0;
}


Measured memory_bytes: 3564
# -*- coding:utf-8 -*-
import sys

sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
mod = 1000000007
inf = float("INF")


def II(): return int(input().rstrip())


def IF(): return float(input().rstrip())


def IS(): return str(input().rstrip())


def LI(): return list(map(int, input().rstrip().split()))


def LI_(): return list(map(lambda x: int(x) - 1, input().rstrip().split()))


def LF(): return list(map(float, input().rstrip().split()))


def S(): return input().rstrip()


def LS(): return S().split()


# def IR(n): return [II() for _ in range(n)]
# def LIR(n): return [LI() for _ in range(n)]
# def FR(n): return [IF() for _ in range(n)]
# def LFR(n): return [LI() for _ in range(n)]
# def LIR_(n): return [LI_() for _ in range(n)]
# def SR(n): return [S() for _ in range(n)]
# def LSR(n): return [LS() for _ in range(n)]

print(S().replace('2017','2018'))

Measured memory_bytes: 8932
import itertools
N,M,X = map(int, input().split())
S = []
N_list = list(range(1,N+1))
for _ in range(N):
    c = list(map(int, input().split()))
    S.append(c)
min = 1200001
for i in range(1,N+1):
    c = list(itertools.combinations(N_list, i))
    for v in c:
        A = [0]*M
        money = 0
        flag =0
        for i in range(len(v)):
            book = v[i]
            book_list = S[book-1]
            money += book_list[0]
            for t in range(M):
                A[t] += book_list[t+1]
        for s in A:
            if s<X:
                flag = 1
                break
        if flag == 0:
            if money <= min:
                min = money

if min == 1200001:
    print(-1)
else:
    print(min)

Measured memory_bytes: 9392
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define RPT(i, b, e) for (int i = (b); i <= (e); i++)
#define RPT0(i, n) RPT(i, 0, n - 1)

int ans;

int CountChars(vector<set<int>> &v, int l, int r)
{
    int cnt = 0;
    for (char c = 'a'; c <= 'z'; c++) {
        auto it = v[c - 'a'].lower_bound(l);
        if (it != v[c - 'a'].end() && *it <= r) cnt++;
    }
    return cnt;
}

void resolve()
{
    int N, Q;
    string S;
    cin >> N >> S >> Q;

    vector<set<int>> v(26);
    RPT0(i, N) v[S[i] - 'a'].insert(i);

    RPT0(i, Q)
    {
        int type;
        cin >> type;
        if (type == 1) {
            int i;
            char c;
            cin >> i >> c;
            i--;
            v[S[i] - 'a'].erase(i);
            S[i] = c;
            v[c - 'a'].insert(i);
        } else {
            int l, r;
            cin >> l >> r;
            int cnt = CountChars(v, l - 1, r - 1);
            cout << cnt << endl;
        }
    }
}

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


Measured memory_bytes: 24220
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

int main()
{
    long double l;
    std::cin >> l;

    printf("%.10Lf\n", l * l * l / 27);
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    int A[11];
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    int ans = 0;
    for (int i = 0; i < pow(3, N); i++) {
        int tmp = i;
        int mul_num = 1;
        for (int j = 0; j < N; j++) {
            int now_digit = tmp % 3;
            tmp /= 3;
            if (now_digit == 0) mul_num *= A[j];
            else if (now_digit == 1) mul_num *= A[j] - 1;
            else mul_num *= A[j] + 1;
        }
        if (mul_num % 2 == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <stdint.h>
#include <map>
#include <vector>

using namespace std;

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

  vector<int> A;
  A.reserve(N);

  map<int, uint64_t> mapA;
  
  for (int n=0; n<N; ++n) {
    int a;
    cin >> a;
    A.push_back(a);

    auto itr = mapA.find(a);
    if (itr==mapA.end())
      mapA.emplace(a,1);
    else
      itr->second++;
  }

  uint64_t ans_base = 0;
  for (auto kv : mapA) {
    ans_base += kv.second * (kv.second-1)/2;
  }

  for (int n=0; n<N; ++n) {
    uint64_t ans = ans_base;

    int a = A[n];

    uint64_t a_count = mapA[a];
    
    ans -= (a_count * (a_count-1) / 2);

    if (a_count > 2)
      ans += ((a_count-2) * (a_count-1) / 2);
    
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 10240
#include<bits/stdc++.h>
using namespace std;
int geth(int n)
{
	while(n>=10)n/=10;
	return n;
}
int gett(int n)
{
	return n%10;
}
int rev(int a)
{
	return geth(a)+gett(a)*10;
}
typedef long long LL;
int main()
{
	//while(true)
	//{
	LL n;
	cin>>n;
	map<int,int> mpaa;
	map<int,int> mpab;
	for(LL i=1;i<=n;i++)
	{
		int head = geth(i);
		int tail = gett(i);
		if(head == tail)
		{
			if( mpaa.find(head) == mpaa.end( ))
				mpaa[head] = 1;
			else
				mpaa[head]++;
		}
		else if(tail!=0)
		{
			int key = head*10+tail;
			if(mpab.find(key) == mpab.end())
			{
				mpab[key] = 1;
			}
			else
			{
				mpab[key]++;
			}
		}
	}
	map<int,int>::iterator it;
	LL sum = 0;
	for(it=mpaa.begin();it!=mpaa.end();it++)
	{
	
		sum+=(LL)it->second*it->second;
		//cout<<"aa:"<<it->first<<" count:"<<it->second<<" sum:"<<sum<<endl;
	}
	for(it=mpab.begin();it!=mpab.end();it++)
	{
		int key = it->first;
		int ba = rev(key);
		//cout<<"ab:"<<it->first<<" count:"<<it->second;
		if(mpab.find(ba)!=mpab.end())
		{
			sum += it->second * mpab[ba];
			//cout<<"ba:"<<ba<<" count:"<<mpab[ba]<<" sum:"<<sum<<endl;
		}
	}
	cout<<sum<<endl;
//}
	return 0;
}

Measured memory_bytes: 256
s=list(str(input()))
n=len(s)
t=True
c=0
for i in range(n):
    if i == 0:
        if s[i]=="A":
            t=t and True
        else:
            t=False
    elif i == 1:
        if s[i]>="a" and s[i]<="z":
            t=t and True
        else:
            t = False
    else:
        if i!=n-1 and s[i] == "C":
            c+=1
        elif s[i]>="a" and s[i]<="z":
            t=t and True
        else:
            t = False
if c==1:
    t=t and True
else:
    t=False
if t:
    print("AC")
else:
    print("WA")

Measured memory_bytes: 3064
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<cmath>
#include<time.h>
using namespace std;

const int n_MAX = 2000;
const int l_MAX = 1000;

int main() {
  int n;
  int l[n_MAX] = {0};
  vector<int> v;

  cin >> n;
  for (int i = 0; i < n; ++i) cin >> l[i];
  for (int i = 0; i < n; ++i) v.push_back(l[i]);

  int cnt = 0;

  sort(v.begin(), v.end());

  for (int i = (n - 1); 0 <= i; --i) {
    for (int j = (i - 1); 0 <= j; --j) {
      vector<int>::iterator itr = lower_bound(v.begin(), v.end(), (v[i] + v[j]));
      int ng = distance(itr, v.end());
      cnt += (n - 1 - i) - ng;
    }
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 384