akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#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, n, m) for(int (i) = (n); (i) < (m); ++(i))

constexpr int INF = 1e9;
//constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;



int main(){
  int N, K;
  cin >> N >> K;
  vector<int> A(N, 0);
  priority_queue<int, vector<int>, greater<int>> left;
  priority_queue<pair<int, int>, vector<pair<int, int>> ,greater<pair<int, int>>> right, mi;
  REP(i, N){
    cin >> A[i];
  }
  
  int loop = min(50, K);
  while(loop--){
    REP(i, N){
      mi.push({i-A[i], i});
    }
    vector<int> B(N);
    REP(i, N){
      while(!mi.empty() && mi.top().first <= i){
        auto [x, id] = mi.top(); mi.pop();
        if(x <= i){
          left.push(id+A[id]);
        }
        else{
          right.push({id-A[id], id});
        }
      }
      while(!right.empty() && right.top().first <= i){
        auto [x, id] = right.top(); right.pop();
        left.push(id+A[id]);
      }
      while(!left.empty() && left.top() < i){
        left.pop();
      }
      B[i] = left.size() + right.size();
    }
    while(!mi.empty()){
      mi.pop();
    }
    while(!right.empty()){
      right.pop();
    }
    while(!left.empty()){
      left.pop();
    }
    A = B;
  }
  REP(i, N){
    cout << A[i] <<" ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 8152
import sys
p=['41412121','41212141','21414121','21214141','14141212','14121214','12141412','12121414']
g=lambda x:list(map(int,x))
for e in sys.stdin:
 d={}
 for f in p:d[sum(s-t for s,t in zip(g(e.split()),g(f))if s>t)]=f
 print(*list(d[min(d)]))


Measured memory_bytes: 5732
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
LL A[200001];
LL S[200001];
LL dp[200001];
map<LL,LL>m;
int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
		if(i!=0){
			S[i]=A[i]+S[i-1];
		}else{
			S[i]=A[i];
		}
	}
	REP(i,N){
		dp[i]=0;
	}
	REP(i,N){
		if(A[i]==0){
			if(i==0){
				dp[i]=1;
			}else{
				dp[i]=dp[i-1]+1;
			}
			m[S[i]]=i;
			continue;
		}
		if(m.count(S[i])!=0){
			dp[i]=dp[m[S[i]]]+1;
		}else if(S[i]==0){
			dp[i]=1;
		}
		m[S[i]]=i;
	}
	LL ans=0;
	REP(i,N){
		//cout<<dp[i]<<endl;
		ans+=dp[i];
	}
	cout<<ans<<endl;
	return(0);
}

Measured memory_bytes: 17408
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,fma")
#include <iostream>
#define f first
#define s second
#define fore(i,a,b) for(lli i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<lli,lli> ii;
#define deb(x) cout << #x": " << (x) << endl;

int main(){ _
    lli d,t,s;
    cin >> d >> t >> s;
    if(lli(d/s)==double(d)/double(s))
    {
      if(lli(d/s)<=lli(t))cout << "Yes" <<ENDL;
      else cout << "No" <<ENDL;
    }
    else
    {
      if(lli(d/s+1)<=lli(t))cout << "Yes" <<ENDL;
      else cout << "No" <<ENDL;
    }
    return 0;
}


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

typedef pair<int ,int> P;

int main(){
    int N, M;
    cin >> N >> M;
    vector<P> r(M);
    vector<bool> a(N - 1);

    for(int i = 0 ; i < M; ++i){
        cin >> r[i].second >> r[i].first;
    }

    a.assign(N - 1, false);

    sort(r.begin(), r.end()); // bについて昇順ソート

    int ans = 0;
    int b = -1;
    for(int i = 0; i < M; ++i){
        bool ok = false;
        // for(int j = r[i].second; j < r[i].first; ++j){
        //     if(a[j])ok = true;
        // }
        if(r[i].second <= b)ok = true;

        if(!ok){
            b = r[i].first - 1;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4020
#include "bits/stdc++.h"
using namespace std;

int n;
vector<int> a;

int isOK(int key) {
    //減らすとき1, 増やす時0, できたとき-1
    int f = 1;
    vector<int> now = a;
    now[0] -= key, now[n-1] -= key;
    if(now[0] < 0 || now[n-1] < 0) return f;
    for(int i = 1; i < n; i++){
        now[i] -= now[i-1];
        if(now[i] < 0){
            if(i % 2 == 0) return 1;
            else return 0;
        }
    }
    if(now[n-1] == 0) return -1;
    return 0;
}

int binary_search() {
    int ng = -2;
    int ok = 1000000002;

    while (ok - ng > 1) {
        int mid = (ok + ng) / 2;
        int res = isOK(mid);

        if (res == 1) ok = mid;
        else if(res == 0) ng = mid;
        else return mid;
    }
    return -1;
}

int main() {
    cin >> n;
    a.resize(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    vector<int> ans(n, 0);
    int last = binary_search();
    ans[0] = last*2;
    for(int i = 1; i < n; i++){
        last = a[i-1] - last;
        ans[i] = last * 2;
    }
    for(int i = 0; i < n; i++){
        if(i != n-1) cout << ans[i] << " ";
        else cout << ans[i] << endl;
    }
}

Measured memory_bytes: 2424
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf 10000000000000000 //10^16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
#define P pair<int,int>
using namespace std;
// 6,36,216,1296,7776,46656
// 9,81,729,6561,59049
int n;
int a[12]={1,6,9,36,81,216,729,1296,6561,7776,46656,59049};
int dp[100010];
signed main() {
	cin>>n;
	rep(i,100010) dp[i]=i;
	dp[1]=1;
	for(int i=2;i<=n;i++) {
		rep(j,12) {
			if(a[j]<=i) {
				dp[i]=min(dp[i-a[j]]+1,dp[i]);
			}
		}
	}
	cout<<dp[n]<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
    int k,a,b,f=0;
    cin>>k;
    cin>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0){
        f=1;
        break;}
    }
    if(f)
    cout<<"OK";
    else
    cout<<"NG";
    
}


Measured memory_bytes: 3620
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int N;
        cin >> N;
        vector<Int> A(N + 1), B(N);
        for (int i = 0; i <= N; ++i) cin >> A[i];
        for (int i = 0; i < N; ++i) cin >> B[i];

        Int ans = 0;
        for (int i = 0; i < N; ++i) {
            Int d = max(min({A[i], B[i]}), 0ll);
            ans += d;
            A[i] -= d;
            B[i] -= d;

            d = max(min({A[i + 1], B[i]}), 0ll);
            ans += d;
            A[i + 1] -= d;
            B[i] -= d;
        }

        cout << ans << endl;
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 1792
package main

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

var sc *bufio.Scanner

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

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt()

	vArray := make([]int, n)
	for i := 0; i < n; i++ {
		vArray[i] = nextInt()
	}
	sort.Sort(sort.IntSlice(vArray))

	ans := float64(vArray[0])
	vArray = vArray[1:]
	for len(vArray) > 0 {
		ans = (ans + float64(vArray[0])) / 2.0
		vArray = vArray[1:]
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
#define INF 2000000000
#define MAX 100001
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define pa pair<int, int>
#define pb push_back
#define mp make_pair
 
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
 
#define BR cout << "\n";
#define SP cout << " ";
#define ENDL cout<<endl;
#define OUT(d) cout<<(d);
#define OUTL(d) cout<<(d)<<endl;
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
 
#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(a)-1;i>=(b);--i)
#define AREP(a, n) for(auto (a):(n))
#define ALL(a) (a).begin(),(a).end()
#define IN(n, a, b) ((a)<=(n)&&(n)<(b))

signed main(){ INIT;
    VAR(int, h, w);
    MAT(string, s, h, w);
    REP(i, h) REP(j, w) if(s[i][j] == "snuke"){
        OUT((char)('A'+j)); OUTL(i+1);
        RET;
    }
RET;}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

VMAX = 10000

B = [0] * (N + 1)
C = [0] * (VMAX + 1)

for a in A:
    C[a] += 1

# print(C)

for i in range(1, VMAX+1):
    C[i] = C[i] + C[i-1]

# print(C)

for j in range(N):
    B[C[A[j]]] = A[j]
    C[A[j]] -= 1

print(' '.join(map(str, B[1:])))



Measured memory_bytes: 246716
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;

const int maxn = 1e5 + 5;
long long a[maxn];

int main(){
	long long n,k;
	scanf("%lld %lld",&n,&k);
	long long g = 0;
	for(int i = 1;i <= n;i++){
		scanf("%lld",&a[i]);
		g = __gcd(g,a[i]);
	}
	sort(a + 1,a + 1 + n);
	if(a[n] >= k && k % g == 0) printf("POSSIBLE");
	else printf("IMPOSSIBLE");
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,e)for(int i=0;i<e;i++)
using namespace std;

int main(){
    int H, W;
    while(1){
        cin >> H >> W;
        if(H==0 && W==0)break;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(i==0 || i==H-1)cout << "#";
                else{
                    if(j==0 || j==W-1)cout << "#";
                    else cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3080
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
L=[]
f=0
ct=0
for i in range(5):
  if l[i]%10!=0:
    f+=1
    L.append(l[i]%10)
    ct+=(l[i]//10)*10+10
  else:
    ct+=(l[i]//10)*10
if f==0:
  print(ct)
else:
  print(ct-10+min(L))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    string S;
    cin >> S;
    vector<int> A(S.size());
    int N = S.size(), num = 0;
    
    for (int i = 0; i < N - 1; i++) {
        if (S.at(i) == 'R') {
            num ++;
            if (S.at(i + 1) != 'R') {
                A.at(i) = num;
                num = 0;
            }
        }
    }
    for (int i = 0; i < N - 1; i++) {
        if (S.at(N - i - 1) == 'L') {
            num++;
            if (S.at(N - i - 2) != 'L') {
                A.at(N - i - 1) = num;
                num = 0;
            }
        }
    }
    for (int i = 0; i < N - 1; i++) {
        if (A.at(i) != 0) {
            int left = A.at(i), right = A.at(i + 1);
            A.at(i) = (left + 1) / 2 + right / 2;
            A.at(i + 1) = left / 2 + (right + 1) / 2;
            i++;
        }
    }
    for (int i = 0; i < N; i++) {
        cout << A.at(i) << " ";
    }
    cout << endl;
}


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

bool IsRightTriangle(const int a, const int b, const int c)
{
	if(a <= b){
		if(b <= c){
			if(c*c == a*a + b*b){
				return true;
			}else{
				return false;
			}
		}else{
			if(b*b == c*c + a*a){
				return true;
			}else{
				return false;
			}
		}
	}else{
		if(a <= c){
			if(c*c == a*a + b*b){
				return true;
			}else{
				return false;
			}
		}else{
			if(a*a == b*b + c*c){
				return true;
			}else{
				return false;
			}
		}
	}
}

int main()
{
	int N;
	cin >> N;
	for(int i = 0; i < N; i++){
		int a, b, c;
		cin >> a >> b >> c;
		if(IsRightTriangle(a, b, c)){
			cout << "YES" << endl;
		}else{
			cout << "NO"  << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


int main() {
   
    ll a,b;
    cin >> a >> b;
    if((a+b)%2 != 0){
        cout << "IMPOSSIBLE" << endl;
    }else{
        cout << (a+b)/2 << endl;
    }
    

}

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 a: i64 = read();
    let b: i64 = read();
    print!("{}", a * b)
}


Measured memory_bytes: 2144
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int []a = new int [n];
		
		for(int i = 0 ; i < n ;i++) {
			a[i] = Integer.parseInt(sc.next());
		}
		int cnt = 0;
		
		for(int i = 0 ; i < n ;i++) {
			for(int j = i ; j < n ;j++) {
				for(int k = j ; k < n ; k++) {
					if(a[i] != a[j] && a[j] != a[k] && a[k] != a[i]) {
						int c = Math.abs(a[j]-a[k]);
						int d = a[j] + a[k];
						if(c < a[i] && a[i] < d) {
							cnt++;
						}
					}
				}
			}
		}
		
		System.out.println(cnt);
	}

}


Measured memory_bytes: 35584
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
struct human
{
    vector<int> inout;
    vector<int> date;
};
struct god
{
    int in, out, date;
};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    while(cin >> N, N)
    {
        human info_h[N + 1];
        god info_g[N + 1];
        int last;
        string day, time, inout, num;
        int pos1 = 0, pos2 = 0;
        vector<int> programer(1000, 0);
        for(int i = 0; i < N; i++)
        {
            cin >> day >> time >> inout >> num;
            string tmp_s = day.substr(0, 2);
            tmp_s += day.substr(3);
            int tmp_time = stoi(time.substr(0, 2)) * 60 + stoi(time.substr(3));
            int tmp_num = stoi(num);
            int tmp_day = stoi(tmp_s);
            if(tmp_num == 0)
            {
                if(inout == "I")
                {
                    info_g[pos1].in = tmp_time;
                    info_g[pos1].date = tmp_day;
                }
                else
                {
                    info_g[pos1].out = tmp_time;
                    info_g[pos1].date = tmp_day;
                    pos1++;
                }
            }
            else
            {
                if(inout == "I")
                {
                    info_h[tmp_num].inout.push_back(tmp_time);
                    info_h[tmp_num].date.push_back(tmp_day);
                }
                else
                {
                    info_h[tmp_num].inout.push_back(tmp_time);
                    info_h[tmp_num].date.push_back(tmp_day);
                }
            }
        }
        for(int i = 0; i < pos1; i++)
        {
            for(int j = 0; j < N; j++)
            {
                for(int k = 0; k < info_h[j].inout.size(); k += 2)
                {
                    if(info_h[j].inout[k] > info_g[i].out || info_h[j].inout[k + 1] < info_g[i].in)
                        continue;
                    if(info_g[i].date != info_h[j].date[k])
                        continue;
                    programer[j] += min(info_h[j].inout[k + 1], info_g[i].out) - max(info_h[j].inout[k], info_g[i].in);
                }
            }
        }
        int ans = 0;
        for(int i = 0; i < N; i++)
        {
            if(programer[i] > ans)
                ans = programer[i];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3120
nums = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

N, M = map(int, input().split())
As = list(map(int, input().split()))

As.sort(reverse=True)

# dp[i+1][j]: As[i]まで使って、マッチ棒j本で作れる整数MAX
dp = [[-float('inf')]*(N+1) for _ in range(M+1)]
dp[0][0] = 0
for i, A in enumerate(As, 1):
    for j in range(N+1):
        dp[i][j] = dp[i-1][j]
        if j >= nums[A]:
            dp[i][j] = max(dp[i][j], dp[i-1][j-nums[A]]*10+A, dp[i][j-nums[A]]*10+A)

print(dp[-1][-1])


Measured memory_bytes: 31952
#include<bits/stdc++.h>
#define int long long int
#define ull unsigned long long
#define vii vector <int>
#define pii pair <int, int>
#define fi first
#define se second
#define rep(i,a,n)		for(int i=a;i<n;i++)
#define endl '\n'
#define mem(a,b) memset(a, b, sizeof a)
#define mkp make_pair
#define pb push_back
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
using namespace std;
double pi=3.1415926535;
double eps=0.000001;
int mod=1000000007; 
void print(vector <int> &arr){
	for(int i=0;i<arr.size();i++)
		cout<<arr[i]<<" ";
	
	cout<<endl;
}
 
 
int32_t main(){
/////////////////////////////////////////////////////////////////////
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr.tie(NULL);
//For fast IO
///////////////////////////////////////////////////////////////////// 
//	std::cout.unsetf ( std::ios::floatfield );  // floatfield not set
//    std::cout.precision(10);
	int h, w;
	cin>>h>>w;
	char ch[h][w];
	rep(i,0,h){
		string s;
		cin>>s;
		rep(ii,0,w) ch[i][ii]=s[ii];
	}
	
	vector < vii > dp(h, vector <int> (w, 0));
	int i=0;
	while(ch[0][i]=='.' && i<=h-1) {
		i++;
	}
	rep(ii, 1, i) dp[0][ii]=1;
	i=0;
	while(ch[i][0]=='.' && i<=w-1){
		i++;
	}

	rep(ii, 1, i) dp[ii][0]=1;
	
	rep(i,1,h){
		rep(ii, 1, w){
			if(ch[i][ii]=='#') dp[i][ii]=0;
			else{
				dp[i][ii]=(((dp[i-1][ii])%mod)+((dp[i][ii-1])%mod))%mod;
			}
		}
	}
	cout<<dp[h-1][w-1]<<endl;
	return 0;
	}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int a, b, c;
  int k;
  cin >> a >> b >> c >> k;

  int m = max(a, max(b, c));
  int ans = a + b + c - m;
  REP(i, k) { m *= 2; }
  ans += m;

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, K; cin >> N >> K;
    long long p[N];
    for(int i = 0; i < N; i++) {
        cin >> p[i];
    }
    vector<long long> sum(N+1, 0);
    for (int i = 1; i <= N; i++)
    {
        sum[i] = sum[i-1] + p[i-1];
    }
    long long ans = 0;
    for (int i = 0; i + K <= N; i++)
    {
        ans = max(ans, sum[i+K] - sum[i]);
    }

    cout << fixed << setprecision(10) << (double)(ans + K) / 2 << endl;
    return 0;
}

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

int main()
{
  int s;
  cin >> s;
  int i;
  bool a = false;
  bool b = false;
  if(s/100 > 0 && s/100 <= 12) a = true;
  if(s%100 > 0 && s%100 <= 12) b = true;
  if(a == true && b == true) cout << "AMBIGUOUS" << endl;
  else if(a == false && b == true) cout << "YYMM" << endl;
  else if(a == true && b == false) cout << "MMYY" << endl;
  else cout << "NA" << endl;
}

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

int n,k;
char s[100];

int main()
{
	scanf("%d%d%s",&n,&k,s+1);
	for(int i=1;i<=n;i++)
		if(i==k) putchar(s[i]-'A'+'a');
		else putchar(s[i]);
	return 0;
}

Measured memory_bytes: 128
N = int(input())
S = []
for i in range(N):
    S.append((input()))

ac = str(S.count('AC'))
wa = str(S.count('WA'))
tle = str(S.count('TLE'))
re = str(S.count('RE'))


ans = 'AC x'+' '+ ac + "\n"+'WA x'+' '+ wa + "\n"+'TLE x' +' '+ tle +"\n" + 'RE x'+' '+re

print(ans)

Measured memory_bytes: 16108
$<.each_line.lazy.map(&:split).each_slice(2) do |a, b|
	hit = 0
	blow = 0

	a.each_with_index do |c, i|
		case
		when c == b[i]; hit += 1
		when b.include?(c); blow += 1
		end
	end

	puts [hit, blow] * ' '
end

Measured memory_bytes: 6108
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;
using ll = long long int;

// to format a document: ctrl + K -> ctrl + D

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for (auto& i : a) cin >> i;

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

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<MOD>;

ll n, k; mint dp[110][110000];
mint sdp[110000];
ll num[110000];

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

    ll cnt = 0;
    for(ll i = 1; i <= n; cnt++) {
        ll j = n / i;
        if (i <= j) num[cnt] = 1, i++;
        else num[cnt] = n/j - i + 1, i = n/j + 1;
    }

    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    rep(i, 0, k) {
        memset(sdp, 0, sizeof(sdp));
        rep(j, 0, cnt) sdp[j+1] = sdp[j] + dp[i][j];
        rep(j, 0, cnt) dp[i+1][j] = sdp[cnt - j] * mint(num[j]);
    }

    mint ans = 0;
    rep(j, 0, cnt+1) ans += dp[k][j];
    cout << ans << endl;
}

Measured memory_bytes: 96128
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class c{
    public static void Main(){
        long n = long.Parse(Console.ReadLine());
        long ans = 1;
        long div = (long)Math.Pow(10,9)+7;
        for(long i=0; i<n; i++){
            ans *= 10;
            ans %= div;
        }
        long temp = 1;
        for(long i=0; i<n; i++){
            temp *= 8;
            temp %= div;
        }
        ans = (ans + temp) % div;
        temp = 1;
        for(long i=0; i<n; i++){
            temp *= 9;
            temp %= div;
        }
        temp = (temp * 2) % div;
        ans -= temp;
        if(ans < 0){
            ans += div;
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 17956
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
typedef long long ll;

int main() {
	string s; cin >> s;
	int a = 0, b = 0;
	for (int i = 0; i < (int)s.size(); i++) {
		a += s[i] == ('0' + i % 2);
		b += s[i] == ('0' + (i + 1) % 2);
	}
	cout << min(a, b) << endl;
	return 0;
}


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

int main() {
  int d, t, s;
  cin >> d >> t >> s;
  if (s * t >= d)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


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

#define ll long long
struct Networkflow {
	struct Edge {
		int v, fl, rev;
	};
	vector<vector<Edge> > adj;
	vector<int> lev, edge_tried;
	int st, ed;
	Networkflow(int V, int s, int t) :adj(V), lev(V), edge_tried(V), st(s), ed(t) {}
	void setEdge(int u, int v, int fl) {
		int sz1 = (int)adj[v].size();
		int sz2 = (int)adj[u].size();
		adj[u].push_back({ v, fl, sz1 });
		adj[v].push_back({ u, 0, sz2 });
	}
	bool assign_level() {
		fill(lev.begin(), lev.end(), -1);
		lev[st] = 0;
		queue<int> que; que.push(st);
		while (!que.empty()) {
			int now = que.front(); que.pop();
			for (int i = 0; i<adj[now].size(); i++) {
				int nxt = adj[now][i].v;
				if (lev[nxt] == -1 && adj[now][i].fl != 0) {
					lev[nxt] = lev[now] + 1; que.push(nxt);
				}
			}
		}
		return lev[ed] != -1;
	}
	int dfs(int now, int fl) {
		if (now == ed)return fl;
		for (int &i = edge_tried[now]; i<adj[now].size(); i++) {
			int nxt = adj[now][i].v;
			if (lev[nxt] == lev[now] + 1 && adj[now][i].fl != 0) {
				int nextflow = dfs(nxt, min(fl, adj[now][i].fl));
				if (nextflow) {
					adj[now][i].fl -= nextflow;
					adj[nxt][adj[now][i].rev].fl += nextflow;
					return nextflow;
				}
			}
		}
		return 0;
	}
	ll dinic() {
		ll ret = 0;
		while (assign_level()) {
			fill(edge_tried.begin(), edge_tried.end(), 0);
			while (1) {
				int amt = dfs(st, 1e9);
				if (amt == 0)break;
				ret += amt;
			}
		}
		return ret;
	}
};
int n, a[105];
int main()
{
	ll ans = 0;
	scanf("%d", &n);
	int st = 0, ed = n+3;
	Networkflow net(n + 5, st, ed);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		if (a[i] < 0) {
			net.setEdge(st, i, -a[i]);
		}
		else{
			ans += a[i];
			net.setEdge(i, ed, a[i]);
		}
	}
	for (int i = 1; i <= n; i++) {
		if (a[i] < 0) {
			for (int j = i+i; j <= n; j += i) {
				if (a[j] >= 0)net.setEdge(i, j, 2e9);
			}
		}
	}
	ans -= net.dinic();
	cout << ans;
}


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

namespace contest_Csharp
{
    class Program
    {
        static void Main(string[] args)
        {

            int N = int.Parse(Console.ReadLine());
            
            var A = Console.ReadLine().Split(' ')
              .Select(x => long.Parse(x)).ToList();
            List<long> sumeven=new List<long>(), sumodd=new List<long>();
            long se = 0, so = 0;
            sumodd.Add(so);
            sumeven.Add(se);
            for (int i = 0; i < N; i++)
            {
                if (i%2==0)
                {
                    se += A[i];
                    sumeven.Add(se);
                }
                else 
                {
                    so += A[i];
                    sumodd.Add(so);
                }
            }

            List<int> firstlimit = new List<int>(new int[N/2]), secondlimit = new List<int>(new int[N/2]);
            long f = 0;
            firstlimit[0] = (sumeven[1] > sumodd[1]) ? 0 : -1;//evenをA[i]まで数える
            for (int i = 1; i < N/2; i++)
            {
                if(sumeven[i+1]< sumeven[firstlimit[i-1] +1]+
                    (sumodd[i+1]- sumodd[firstlimit[i - 1] +1]))
                {
                    firstlimit[i] = firstlimit[i-1];
                }
                else
                {
                    firstlimit[i] = i;
                }
            }
            if (N%2==0)
            {
                long answer;
                answer = Math.Max(sumeven[N / 2],
                    sumeven[firstlimit[N / 2 - 1] + 1] +
                    (sumodd[N / 2] - sumodd[firstlimit[N / 2 - 1] + 1]));
                Console.WriteLine(answer);
                return ;

            }
            long ans = long.MinValue;
            var sumevenI = sumeven.Select(x => sumeven[sumeven.Count() - 1] - x).ToList();
            sumevenI.Reverse();
            for (int i = 0; i < N/2; i++)//後ろi個を確定させる
            {
                long a= Math.Max(sumeven[N / 2-i],
                    sumeven[firstlimit[N / 2-i - 1] + 1] +
                    (sumodd[N / 2-i] - sumodd[firstlimit[N / 2-i - 1] + 1]));
                ans = Math.Max(ans, a + sumevenI[i]);
            }
            ans = Math.Max(ans, sumevenI[N / 2]);
            Console.WriteLine(ans);


        }
    }
}


Measured memory_bytes: 46712
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var acnt = line[1] - line[0] - 1;
            var tall = 0;
            for (var i = 1; i <= acnt; i++) tall += i;
            Console.WriteLine(tall - line[0]);
        }
    }
}

Measured memory_bytes: 11348
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include <string>
#include <utility>
#include<array>
#include<set>
#define EPS (1e-7)
using namespace std;



void clawl(vector<vector<int>> map, vector<vector<int>> &ans,int N, int x=0, int y=0, int pre=0) {

	//if (!(x == 1 && y == N-1)) {
		int count = max(pre + map[x][y], ans[x][y]);
		ans[x][y] = count;
		if (x != 1) clawl(map, ans, N, x+1, y, count);
		if (y!=N-1) clawl(map, ans, N, x, y+1, count);

	//}


}




int main() {


	int N;
	cin >> N;
	int max = 0;
	vector<int> inner(N,0);
	vector<vector<int>> map(2,inner);

	for (auto i = 0; i < 2; i++)
	{
		for (auto j = 0; j < N; j++)
		{
			cin >> map[i][j];
		}
	}


	clawl(map, map, N);



	cout << map[1][N-1] << endl;

	return 0;
}

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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

int tj[2020];
char buf[200005];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    gstr(buf);
	int n = strlen(buf);
	ll ans = 0; int cur = 0, p10 = 1;
	tj[0] = 1;
	for(int i=n-1; i>=0; i--) {
		cur = (cur + (buf[i] - '0') * p10) % 2019;
		p10 = p10 * 10 % 2019;
		ans += tj[cur];
		tj[cur]++;
	}
	print(ans);
}


Measured memory_bytes: 3952
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
#define MP make_pair
#define PB push_back
#define ll long long
#define int long long
#define f(i,x,n) for(int i=x;i<n;i++)
#define ld long double
#define mod 1000000007
string s;
int n;
int ans=0;
int po[100005];
int dfs(int i,int val)
{
	val=(val)%mod;
	if(i==n)
	{
		ans=(ans+val)%mod;
		return 0;
	}
	if(s[i]=='1')
	{
		ans=(ans+val*po[n-i-1])%mod;
		dfs(i+1,2*val);
	}
	else
	{
		dfs(i+1,val);
	}
	return 0;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	po[0]=1;
	f(i,1,100005)
	{
		po[i]=(po[i-1]*3)%mod;
	}
	cin>>s;
	n=s.length();
	dfs(0,1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4432
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main()
{
	int h,w,d;cin >> h >> w >> d;
	vector<pair<int,int>> A(h*w);

	rep(i,h)
		rep(j,w)
		{
			int a;
			cin >> a;
			A[a-1]=make_pair(i,j);
		}
	vector<vector<int>> Asum(d);

		rep(i,d)Asum[i].push_back(0);


	rep(i,d)
		for(int j=i;j<h*w-d;j+=d)
		{
			Asum[i].push_back(abs(A[j].first-A[j+d].first)+abs(A[j].second-A[j+d].second));
		}


	
	rep(i,d)
		for(int j=0;j<Asum[i].size()-1;j++)
		{
			Asum[i][j+1]=Asum[i][j+1]+Asum[i][j];
		}

	//rep(i,Asum[1].size())cout<<Asum[1][i]<<endl;
	int q;cin >> q;
	rep(i,q)
	{
		int a,b;cin>> a>>b;
		a--;b--;
		//cout<<b/d<<':'<<a/d<<endl;
		cout<<Asum[b%d][b/d]-Asum[a%d][a/d]<<endl;
	}
	return 0;
}

Measured memory_bytes: 6016
from bisect import bisect_left

n = int(input())
lll = list(map(int, input().split()))
lll.sort()
ans = 0

for i in range(n - 2):
    li = lll[i]
    for j in range(i + 1, n - 1):
        k = bisect_left(lll, li + lll[j], lo=j)
        ans += k - j - 1
print(ans)

Measured memory_bytes: 3188
// Problem : A - 9x9
// Contest : AtCoder - AtCoder Beginner Contest 144
// URL : https://atcoder.jp/contests/abc144/tasks/abc144_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

#define int long long
#define db double
#define mod 1000000007
#define pb push_back
#define pp pair<int,int>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)
#define maxn 200005
#define ss second
#define ff first
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
int inv(int a, int b){
 return 1<a ? b - inv(b%a,a)*b/a : 1;
}
void solve()
{
	int a,b;
	cin >> a >> b;
	if(a >= 10 || a == 20 || b>=10 || b==20)
	cout << -1;
	else cout << a*b;
}
signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;

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

    int n = sc.nextInt();
    
    char[] chars = Integer.toString(n).toCharArray();
    for (char c : chars) {
      if (c == '7') {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	//ios_base::sync_with_stdio(false);
	int N, ans=0;
	int a[55];

	cin >> N;
	rep(i,N) cin >> a[i];

	int l=-1, r=N;
	while(r-l>1){
		pii mx = {};
		reps(i,l+1,r) chmax(mx, pii(abs(a[i]), i));
		//cout << mx.X << " " << mx.Y << endl;
		(a[mx.Y] < 0 ? l : r) = mx.Y;
	}
	//cout << l << " " << r <<  endl;

	cout << 2*(N-(l>=0)-(r<N)) << endl;
	for(int i=l; i>0; i--) rep(k,2) cout << i+1 << " " << i << endl;
	for(int i=r; i<N-1; i++) rep(k,2) cout << i+1 << " " << i+2 << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define pll pair<ll,ll>
#define pii pair<int,int>
#define F first
#define S second
const int maxn = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    if (s[0] == s[1] && s[1] == s[2]) {
        cout << "No\n";
    }
    else {
        cout << "Yes\n";
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int f = sc.nextInt();
		int wt = 1;
		int sg = 0;
		// 水の質量を全探索
		for(int i = 0 ; i <= f ; i++) {
			for(int j = 0 ; j <= f ; j++) {
				if(100 * a * i + 100 * b * j > f) continue;
				int water = 100 * a * i + 100 * b * j;
				// 砂糖の質量を全探索
				for(int k = 0 ; k <= f ; k++) {
					for(int l = 0 ; l <= f ; l++) {
						if(c * k + d * l > f) continue;
						int suger = c * k + d * l;
						if(water + suger > f) continue;
						if(e * water < suger * 100) continue;
						if(sg * water <= suger * wt) {
							wt = water;
							sg = suger;
						}
					}
				}
			}
		}
		int sgwt = sg + wt;
		System.out.println(sgwt + " " + sg);
	}
}

Measured memory_bytes: 22100
import math
import copy
from copy import deepcopy
import sys
import fractions
import numpy as np
from functools import reduce
# import statistics
import heapq
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = int(input())
data = getInputListInt()

cnt = 0
for i in range(n):
    if data[i] < 0:
        data[i] *= -1
        cnt += 1
sum_num = sum(data)

data.sort()
if cnt % 2 == 1:
    sum_num -= 2*data[0]

print(sum_num)


Measured memory_bytes: 24284
from fractions import gcd
A,B,C,D = map(int, input().split())

E = (C*D) // gcd(C,D)
x = (A-1) // C
y = (A-1) // D
z = (A-1) // E

xx = B // C
yy = B // D
zz = B // E

Cdiv = xx-x
Ddiv = yy-y
Ediv = zz-z
tmp = xx-x + yy-y - (zz-z)
total = B-A+1
print(int(total - Cdiv - Ddiv + Ediv))


Measured memory_bytes: 5076
/*****************************************************
 *     created by: nayakashutosh9
 * "Winners Never Quit and Quitters Never Win".
*****************************************************/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace std;
using namespace __gnu_pbds;
#define int long long int
#define endl '\n'
#define mod 1000000007
#define inf 1e18
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
const int N = 300005;
/**********************************************************************************************/



void solve() {
	int n; cin >> n;
	vector<int> a(n);
	int ans = 0, mx = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (mx > a[i]) ans += (mx - a[i]);
		mx = max(mx, a[i]);
	}
	cout << ans << endl;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int t = 1, z = 1;
	// cin >> t; cin.ignore();
	while (t--) {
		// cout << "Case #" << (z++) << ": ";
		// clock_t start = clock();
		solve();
		// clock_t end = clock();
		// cout << (end-start) << endl;
		//print execution time in ms
	}

	return 0;
}

Measured memory_bytes: 4784
#include <stdio.h>
int H, W, e; char buf[8];
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
int main() {
	while (scanf("%d%d", &W, &H), H) {
		int x = 1, y = 1, d = 0;
		while (scanf("%s", buf), buf[0] != 'S') {
			scanf("%d", &e);
			switch (buf[0]) {
			case 'F': x += dx[d] * e, y += dy[d] * e; break;
			case 'B': x -= dx[d] * e, y -= dy[d] * e; break;
			case 'R': d = (d + 1) % 4; break;
			case 'L': d = (d + 3) % 4; break;
			}
			if (x < 1) x = 1; if (x > W) x = W;
			if (y < 1) y = 1; if (y > H) y = H;
		}
		printf("%d %d\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 2644
k=int(input())
if k%2==0 or k%5==0:
    print(-1)
    exit()

pw=1
tmp=7
ans=1

for _ in range(k):
    if tmp%k==0: 
        break
    ans+=1
    pw*=10
    pw%=k
    tmp+=7*pw
print(ans)


Measured memory_bytes: 63440
import java.util.*;
public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                int k = sc.nextInt();
                int[] a = new int[n];
                int yono = 0;
                for(int i = 0 ; i < n ; i++){
                        a[i] = sc.nextInt();
                        yono += Math.min(a[i] , k - a[i]);
                }
                sc.close();
                System.out.println(2 * yono);
        }
}
//地味に部屋が暑いです
//LaTex難しくないですか？

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

int n;
bool is_prime(int x){
    bool ans=true;
    if(x<=1)ans=false;
    else if(x%2==0 && x!=2)ans=false;
    else{
        for(int i=3;i*i<=x;i+=2){
            if(x%i==0){
                ans=false;
                break;
            }
        }
    }
    return ans;
}
int main(){
    int x;
    int ans=0;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> x;
        if(is_prime(x)) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1160