akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
using namespace std;
struct Dice{
  int s[6];
  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0];
      s[0]=s[3];
      s[3]=s[5];
      s[5]=s[2];
      s[2]=b;
    }
    if(c=='W'){
      b=s[0];
      s[0]=s[2];
      s[2]=s[5];
      s[5]=s[3];
      s[3]=b;
    }
    if(c=='N'){
      b=s[0];
      s[0]=s[1];
      s[1]=s[5];
      s[5]=s[4];
      s[4]=b;
    }
    if(c=='S'){
      b=s[0];
      s[0]=s[4];
      s[4]=s[5];
      s[5]=s[1];
      s[1]=b;
    }
    if(c=='R'){//水平向右旋转
      b=s[1];
      s[1]=s[2];
      s[2]=s[4];
      s[4]=s[3];
      s[3]=b;
    }    
  }
    //设定方向
  int top() {
    return s[0];
  }
  int right(){
    return s[2];
  }
  int left(){
    return s[3];
  }
  int front(){
    return s[1];
  }
};
//判断是否相同
bool same(Dice a,Dice b){
  for(int i=0;i<6;i++) if(a.s[i]!=b.s[i]) return false;
  return true;
}
//初始化两个骰子
int main(){
  Dice d[2];
  for(int j=0;j<2;j++) 
    for(int i=0;i<6;i++)
      cin >> d[j].s[i];
  bool f=false;
  
  //开始各种旋转来判断是否每个面都相同
  for(int i=0;i<4;i++){
    d[1].roll('R');
    for(int j=0;j<4;j++){
      d[1].roll('N');
      if(same(d[0],d[1])) f=true;
    }
  }
  d[1].roll('E');
  for(int j=0;j<4;j++){
    d[1].roll('N');
    if(same(d[0],d[1])) f=true;
  }
//因为前面向E转了一次，所以这里要向W转两次
  d[1].roll('W');
  d[1].roll('W');
  for(int j=0;j<4;j++){
    d[1].roll('N');
    if(same(d[0],d[1])) f=true;
  }
  
  cout << (f?"Yes":"No") << endl;
  return 0;
}


Measured memory_bytes: 3116
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):  # リストに重複した要素があるか判定（要素にリストがある場合）
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


a, b, c = map(int, input().split())

if (a % 2 == 0)and(a == b)and(a == c):
    print(-1)
else:
    cnt = 0
    while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        aa = (b+c)//2
        bb = (a+c)//2
        cc = (a+b)//2
        a = aa
        b = bb
        c = cc
        cnt += 1
    print(cnt)


Measured memory_bytes: 3892
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    string S;
    cin >> S;
    int len = S.length();
    int bStart = 0;
    int wStart = 0;
    rep(i, len) {
        if (i % 2 == 0) {
            if (S[i] == '0') {
                wStart++;
            } else {
                bStart++;
            }
        } else {
            if (S[i] == '0') {
                bStart++;
            } else {
                wStart++;
            }
        }
    }
    cout << min(bStart, wStart) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main(){
    int d, g; cin >> d >> g;
    vector<int> p(d), c(d); rep(i,d) cin >> p[i] >> c[i];
    int ans=INF;
    rep(bit, (1<<d)){
      int pnt=0, cnt=0;
      rep(i,d){
        if((1<<i) & bit){
          pnt += c[i] + (i+1)*100*p[i];
          cnt += p[i];
        }
      }
      if(pnt>=g) chmin(ans, cnt);
      else{
        rep(i,d){
          if(!((1<<(d-i-1)) & bit)){
            rep(j,p[d-i-1]){
              pnt += (d-i)*100;
              cnt++;
              if(pnt>=g) break;
            }
          }
          if(pnt>=g) break;
        }
        chmin(ans, cnt);
      }
    }
    cout << ans;
          
    
    return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy
 
## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))
 
N = int(input())
H = list(map(int, input().split()))

ans = 0
while sum(H) > 0:
    tmp = 0
    for i in range(N):
        if H[i] > 0:
            H[i] -= 1
            tmp += 1
        elif H[i] == 0 and tmp > 0:
            ans += 1
            tmp = 0
        if i == N-1 and tmp > 0:
            ans += 1

print(ans)

Measured memory_bytes: 77448
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int H, A;
    cin >> H >> A;

    if (H % A == 0) cout << H / A << endl;
    else cout << H / A + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    set<int>S;
    for(int i=0;i<3;i++){
        int tmp=0;cin>>tmp;
        S.insert(tmp);
    }
    if(S.size()==2){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
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 (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }

signed main() {
  SS(char,a);
  if(a>=97){
      p("a");
  }
  else{
      p("A");
    }
  
}

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

int main() {
  int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k; cin >> k;
  cout << a[k-1] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int gcd(int m, int n)
{
	int t;
	if (m < n) swap(m, n);
	while (n != 0)
		t = n, n = m % n, m = t;
	return m;
}
int main()
{
	int a, b;
	while (cin >> a)
	{
		if (cin.eof()) break;
		cin >> b;
		cout << gcd(a, b) << endl;
	}
}

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

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

    static class ACalc {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            long a = in.nextLong();
            out.println((long) (Math.pow(a, 2) + Math.pow(a, 3) + a));
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

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

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

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

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 32472
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    set<int> B;

    rep(i, N){
        cin >> A.at(i);
    }

    rep(i, N){
        B.insert(A.at(i));
    }

    if(A.size() == B.size()){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

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

int main() {
    int k;
    int a[5];
    for (int i = 0; i < 5; i++) {
        cin >> a[i];
    }
    cin >> k;
    bool ok = true;
    for (int i = 0; i < 4; i++) {
        for (int j = i+1; j < 5; j++) {
            if (a[j]-a[i] > k) {
                cout << ":(" << endl;
                ok = false;
                j = 5;
                i = 4; 
            }
        }
    }
    if (ok) cout << "Yay!" << endl;
}

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

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000001
using namespace std;
typedef long long ll;

int main(){
  int n;  cin >> n;
  string s;  cin >> s;
  vector<int> w(n, 0), e(n, 0);
  w[0] =(s.front()=='W')?1:0;
  e[n-1] =(s.back()=='E')?1:0;
  rep(i, 1, n){
    w[i]+=w[i-1];
    if(s[i]=='W') w[i]++;
    e[n-i-1]+=e[n-i];
    if(s[n-i-1]=='E') e[n-i-1]++;
  }
  int ans = 1e9;
  rep(i, 0, n){
    if(i==0)  ans = min(ans, e[i+1]);
    else if(i==n-1) ans = min(ans, w[i-1]);
    else  ans = min(ans, e[i+1]+w[i-1]);
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
    int n, b, f, r, v;
    int a[4][3][10];
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++) {
                a[i][j][k] = 0;
            }
        }
    }
    
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> b >> f >> r >> v;
        a[b-1][f-1][r-1] += v;
    }
    
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 10; k++) {
                cout << ' ' << a[i][j][k];
            }
            cout << endl;
        }
        if (i<3) {
            cout <<"####################" << endl;
        }
    }
    
    return 0;
}



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

int main(int argc, const char * argv[]) {



    cin.tie(0);
    ios::sync_with_stdio(false);

    /////////////////////
    // Write code below /
    /////////////////////
    
    char C;

    cin>>C;

    cout<<++C<<endl;


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
 
double distance(double x1, double y1, double x2, double y2);
 
int main(void){
  double x1, x2, y1, y2, dis;
 
  scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
  dis = distance(x1, y1, x2, y2);
  printf("%f\n", dis);
  return 0;
}
 
 
double distance(double x1, double y1, double x2, double y2){
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1- y2));
}


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

int main(){
  int c1,c5,c10,c50,c100,c500;
  cin >> c1 >> c5 >> c10 >> c50 >> c100 >> c500;
  int total=c1*1+c5*5+c10*10+c50*50+c100*100+c500*500;

  if(total>=1000){
    cout << 1<< endl;
  }else{
    cout << 0 << endl;
  }

  return 0;
}

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

template<typename T>
void show_vec(const T& v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << i << ": " << v[i] << endl;
	}
}

int main() {
	int N;
	cin >> N;
	vector<ll> a(N);
	for (int i = 0; i < N; ++i) { cin >> a[i]; }

	ll res = 0;
	for (int i = 0; i < N; ++i) {
		if (a[i] == 0) { continue; }

		if (i != 0) {
			ll x = min(a[i - 1], a[i]);
			res += x;
			a[i - 1] -= x;
			a[i] -= x;
		}

		res += (a[i] / 2);
		a[i] %= 2;
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 1024
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	ll n, m;
	scanf("%lld%lld", &n, &m);
	vector<int> a(m);
	rep(i, m)scanf("%d", &a[i]);
	ll sum = accumulate(all(a), 0LL);
	printf("%lld\n", max(-1LL, n - sum));

	Please AC;
}

Measured memory_bytes: 3852
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;
int s[100000];
int main()
{
    int n;
    int flag=0;
    int i;
    scanf("%d",&n);
    for(i=0; i<n; i++)
    {
        scanf("%d",&s[i]);

    }
    int x=s[0];
    for(i=0; i<n; i++)
    {
        if(s[i]>s[i-1])
            s[i]--;
        if(s[i]<s[i-1])
        {
            flag=1;
            printf("No\n");
            break;
        }
    }
    if(flag==0)
        printf("Yes\n");

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;

signed main(){
  fastio
  ll x;cin>>x;
  for(ll a=-130;;a++){
    for(ll b=-130;b<=130;b++){
      // cout<<a<<" "<<b<<"\n";
      if((ll)pow(a,5)-(ll)pow(b,5)==x){
        cout<<a<<" "<<b<<"\n";
        return 0;
      }
    }
  }
  return 0;
}

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

int main() {
    int N, X;
    std::cin >> N >> X;

    std::vector<int> L;
    L.reserve(N);
    int l;
    for(int i = 0; i < N; ++i) {
        std::cin >> l;
        L.push_back(l);
    }

    std::vector<int> D(N + 1);
    for (int i = 1; i <= N; ++i) {
        D[i] = D[i - 1] + L[i - 1];
    }

    const int ret = std::count_if(
        D.cbegin(), D.cend(),
        [X](auto d) { return d <= X; }
    );

    std::cout << ret << std::endl;
}


Measured memory_bytes: 256
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();
		long[] V = new long[N];
		
		for(int i = 0; i < N; i++) {
			V[i] = sc.nextLong();
		}
		
		int r = Math.min(N, K);
		long max = 0;
		
		for(int i = 0; i <= r; i++) {
			int count1 = 0;
			PriorityQueue<Long> hand1 = new PriorityQueue<>();
			for(int j = 0; j < i; j++) {
				hand1.add(V[j]);
				count1++;
			}
			
			for(int j = 0; j <= r - i; j++) {
				PriorityQueue<Long> hand = new PriorityQueue<>();
				for(long x : hand1) {
					hand.add(x);
				}
				
				int count = count1;
				
				for(int k = 0; k < j; k++) {
					hand.add(V[N - 1 - k]);
					count++;
				}
				
				while(K - count > 0 && hand.size() > 0) {
					if(hand.peek() >= 0) {
						break;
					}
					hand.poll();
					count++;
				}
				
				long juel = 0;
				
				while(!hand.isEmpty()) {
					juel += hand.poll();
				}
				max = Math.max(juel, max);
			}
		}
		System.out.println(max);	
	}
}


Measured memory_bytes: 24788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
const int MAX = 200000;

int main() {
    int n, k;
    cin >> n >> k;
    ll ans = 0;
    for (int i = k; i <= n + 1; i++) {
        ans += ((ll)i * (n + n - i + 1) / 2) - ((ll)i * (0 + i - 1) / 2) + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stack>
#include <cstring>
#include <queue>
#include <set>
#include <map>

using namespace std;

const int maxN = 1e6 + 10, oo = 23041997, modP = 1e7, maxC = 50;

#define FORU(i, l, r) for (int i = l; i <= r; ++i)
#define FORD(i, r, l) for (int i = r; i >= l; --i)
#define REPU(i, r) for (int i = 0; i < r; ++i)
#define F first
#define S second
#define PB push_back
#define LL long long
#define BIT(x, i) ((x >> i) & 1)
#define PINT pair < int, int >

int n, a[maxN], res;

int main() {
    cin >> n;
    FORU(i, 1, n) cin >> a[i];
    a[0] = a[n + 1] = 0;
    FORU(i, 0, n)
        res += (int) abs(a[i] - a[i + 1]);
    FORU(i, 1, n) {
        int tmp1 = (int) abs(a[i] - a[i + 1]);
        int tmp2 = (int) abs(a[i] - a[i - 1]);
        int tmp3 = (int) abs(a[i - 1] - a[i + 1]);
        cout << res - tmp1 - tmp2 + tmp3 << endl;
    }
}


Measured memory_bytes: 1664
using System;
using System.Linq;

namespace V2018_1{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            while(true){
                var N = sr.Next<int>();
                var M = sr.Next<int>();
                var P = sr.Next<int>();
                var X = sr.Next<int>(N);

                if(N == 0 && M == 0 && P == 0) break;

                var pool = X.Sum() * (100 - P);
                Console.WriteLine(X[M - 1] == 0 ? 0 : pool / X[M - 1]);
            }
            //---------------------------------
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];
        private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = _sr.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }
    }
}

Measured memory_bytes: 10328
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

N = int(input())
S = input()

def convert(s):
    if N + ord(s) <= ord('Z'):
        return chr(N + ord(s))
    else:
        return chr(ord('A') + ((N + ord(s)) - ord('Z') - 1))

print(''.join(list(map(convert, list(S)))))

Measured memory_bytes: 39792
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define int long long
using namespace std;

typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    string s, t;
    cin >> s >> t;
    vector<char> S(s.size()), T(t.size());

    REP(i, s.size()){
        S[i] = s[i];
    }
    REP(i, t.size()){
        T[i] = t[i];
    }
    SORT(S);
    SORT(T);
    REP(i, s.size()){
        s[i] = S[i];
    }
    REP(i, t.size()){
        t[i] = T[t.size() - i - 1];
    }
    
    if(s < t){
        cout << "Yes";
    }else{
        cout << "No";
    }
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 256
//============================================================================
// Name        : d
// Date        : Mon Apr  8 21:34:55 CST 2019
// Author      : landcold7
// Description : Actions speak louder more than words
//============================================================================
#include "bits/stdc++.h"
using namespace std;

#define x first
#define y second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mst(x, y) memset(x, y, sizeof(x))
#define pvar(x) cout << #x << ": "
#define output(v) cout << (v) << '\n'
#define fori(i, a, b) for (int i = a; i < b; ++i)
#define jam(x, n) cout << "Case #" << x << ": " << n << "\n"
#define prt(x, a, n) { cout << x[a]; if (a < n - 1) cout << " "; }
#define par(x, s, n, v) if(v) pvar(x); fori(y, s, n) prt(x, y, n) cout << "\n"
template<class T> inline void amin(T &x, const T &y) { if (y < x) x = y; }
template<class T> inline void amax(T &x, const T &y) { if (x < y) x = y; }

#ifndef _has_trace
#define trace(...)
#define dbstream ostream
#endif
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

void solve() {
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  vl a(x), b(y), c(z);
  for (int i = 0; i < x; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < y; ++i) {
    cin >> b[i];
  }
  for (int i = 0; i < z; ++i) {
    cin >> c[i];
  }
  sort(rall(a));
  sort(rall(b));
  sort(rall(c));
  // trace(a, b, c);
  vl ret;
  for (int i = 0; i < sz(a); ++i) {
    for (int j = 0; j < sz(b); ++j) {
      for (int h = 0; h < sz(c); ++h) {
        if ((i + 1) * (j + 1) * (h + 1) <= k) {
          ret.pb(a[i] + b[j] + c[h]);
        } else {
          break;
        }
      }
    }
  }
  sort(rall(ret));
  // par(ret, 0, k, 0);
  for (int i = 0; i < k; ++i) {
    cout << ret[i] << "\n";
  }
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}



Measured memory_bytes: 1404
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		boolean is = true;
		for (int i = 0; i < s.length(); i++) {
		    if (s.charAt(i) != t.charAt(i)) {
		        is = false;
		        break;
            }
        }
		if (is) System.out.println("Yes");
		else System.out.println("No");
		
	}
}

Measured memory_bytes: 35640
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>
#include<set>

#include <memory>


using namespace std;
using ll = long long;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<int>;

ll MOD = 1000000007;


int  main()
{
	int A, B;
	cin >> A >> B;
	if (A >= 10 || B >= 10) { cout << -1 << endl; return 0; }
	cout << A * B << endl;

	return 0;
}

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

const double g = 9.8;
const double EPS = 1.0e-6;

void kouhoth(int x, int y, int v, vector<double> &allTH)
{
	double K = 1.0*v*v/g;
	double d = K*K*x*x - x*x*(x*x+2*K*y);
	if(d<0) return;
	double kai1 = (K*x + sqrt(d)) / x / x;
	double kai2 = (K*x - sqrt(d)) / x / x;
	if(kai1+EPS>0) allTH.push_back(atan(kai1+EPS));
	if(kai1-EPS>0) allTH.push_back(atan(kai1-EPS));
	if(kai2+EPS>0) allTH.push_back(atan(kai2+EPS));
	if(kai2-EPS>0) allTH.push_back(atan(kai2-EPS));
}

double f(double th, int v, int x)
{
	double K = 1.0*v*v/g;
	double si = sin(th);
	double co = cos(th);
	double ta = tan(th);
	double alpha = -0.5*(1.0+ta*ta)/K;
	double beta = 0.5*K*si*si;
	double naka = 1.0*x - K*si*co;
	return alpha * naka*naka + beta;
}

int main(){
	int n;
	int v, x, y;
	pair<double, double> buf;
	while(cin>>n>>v>>x>>y){
		vector<int> allL, allB, allR, allT;
		vector<double> allTH;
		for(int i=0; i<n; i++){
			int l, b, r, t;
			cin>>l>>b>>r>>t;
			// ³Ê
			if(x<l) continue;
			// ³ÊÈª»
			if(x<r) r = x;
			allL.push_back(l);
			allB.push_back(b);
			allR.push_back(r);
			allT.push_back(t);
			kouhoth(l, b, v, allTH);
			kouhoth(r, b, v, allTH);
			kouhoth(l, t, v, allTH);
			kouhoth(r, t, v, allTH);
		}
		kouhoth(x, y, v, allTH);

		bool okflg = false;
		for(int i=0; i<allTH.size(); i++){
			double th = allTH[i];
			double mauey = f(th,v,x);
			if(mauey < y) continue;
			bool dameflg = false;
			for(int j=0; j<allL.size(); j++){
				if(
					(f(th,v,allL[j])<allB[j]&&f(th,v,allR[j])<allB[j]) ||
					(f(th,v,allL[j])>allT[j]&&f(th,v,allR[j])>allT[j]) ){
						continue;
				} else {
					dameflg = true;
					break;
				}
			}

			if(!dameflg){
				bool butukaruflg = false;
				for(int j=0; j<allL.size(); j++){
					if(allR[j]==x){
						if(y<allT[j] && allT[j]<mauey){
							butukaruflg = true;
							break;
						}
					}
				}
				if(!butukaruflg){
					okflg = true;
					break;
				}
			}
		}
		if(okflg) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

constexpr int dx[] = {0, -1, 1, 0, -1, 1, -1, 1};
constexpr int dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    char a, b;
    cin >> a >> b;

    if (a == b) {
        cout << "H" << endl;
    } else {
        cout << "D" << endl;
    }
}

signed main(int argc, char *argv[]) {
    solver();
}


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

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

int main() {
    int n, k, r_point, s_point, p_point;
    cin >> n >> k >> r_point >> s_point >> p_point;
    int point[] = {r_point, s_point, p_point};
    string t;
    cin >> t;
    int ans = 0;
    for (int i = 0; i < k; i++) {
        string s;
        for (int j = i; j < n; j += k) {
            s.push_back(t[j]);
        }
        //cout << s << endl;
        vector<int> u(s.size());
        rep(j,s.size()) {
            if (s[j] == 'r') u[j] = 2;
            if (s[j] == 's') u[j] = 0;
            if (s[j] == 'p') u[j] = 1;
        }
        //cout << u << endl;
        vector<vector<int>> dp(u.size()+1, vector<int>(3));
        for (int ni = 0; ni < u.size(); ni++) {
            for (int nj = 0; nj < 3; nj++) {
                for (int nk = 0; nk < 3; nk++) {
                    if (nj == nk) continue;
                    if (nk == u[ni]) chmax(dp[ni+1][nk], dp[ni][nj] + point[nk]);
                    else chmax(dp[ni+1][nk], dp[ni][nj]);
                }
            }
        }
        int res = 0;
        rep(j,3) chmax(res, dp[u.size()][j]);
        //cout << res << endl;
        ans += res;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9224
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            var M = cin.ReadInt();
            WriteLine(48 - M);
        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}

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

using namespace std;

int main(){
  long long l,r,i,j;
  cin>>l>>r;
  long long ans=1e5;
  if(r-l>=2019){
    ans=0;
  }
  else{
    for(i=l;i<r;i++){
      for(j=i+1;j<=r;j++){
        long long ii=i%2019,jj=j%2019;
        ans=min(ans,(ii*jj)%2019);
        //cout<<ans<<"\n";
      }
    }
  }
  cout<<ans;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int T = sc.nextInt();
    int[] costs = new int[N];
    int[] time = new int[N];
    int min = Integer.MAX_VALUE;

    for (int i = 0; i < N; i++) {
      costs[i] = sc.nextInt();
      time[i] = sc.nextInt();
    }

    for (int i = 0; i < N; i++) {
      if (time[i] <= T) {
        min = Math.min(min, costs[i]);
      }
    }

    if (min == Integer.MAX_VALUE) {
      System.out.println("TLE");
    } else {
      System.out.println(min);
    }
  }
}


Measured memory_bytes: 21972
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
#include <numeric>
#include <sstream>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
const int maxn = 1e6 + 10;
int a[maxn],n;
char s[maxn];
int main(int argc, char const *argv[])
{
	scanf("%d%s",&n,s);
	--n;
	int ans = 0;
	for(int i = 0;i <= n; ++i)
	{
		a[i] = s[i] - '1';
		if((n & i) == i)
		{
			ans = (ans + a[i]) & 1;
		}
	}
	if(!ans)
	{
		bool fg = 1;
		for(int i = 0;i <= n; ++i)
		{
			if(a[i] == 1)
			{
				fg = 0;
			}
		}
		if(fg)
		{
			int x = 0;
			for(int i = 0;i <= n; ++i)
			{
				a[i] >>= 1;
			}
			for(int i = 0;i <= n; ++i)
			{
				if((n & i) == i)
				{
					x = (x + a[i]) & 1;
				}
			}
			if(x)
			{
				ans = 2;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
int n;
struct Node{
	int A,B;
}p[maxn];
inline bool cmp(const Node &x,const Node &y){
	return x.B<y.B;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d%d",&p[i].A,&p[i].B);
	sort(p+1,p+1+n,cmp);
	LL Sum=0;
	for(int i=1;i<=n;i++){
		Sum+=p[i].A;
		if(Sum>p[i].B)return puts("No"),0;
	}
	puts("Yes");
	return 0;
}



Measured memory_bytes: 1792
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define F first
# define S second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define end(x) prev(x.end());
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define mset multiset
# define umap unordered_map
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)
# define lr(i,l,r) for(int i=l;(l>r?i>=r:i<=r);(l>r?--i:++i))

using namespace std;

template<class T> void umin(T &a, T b) { a = min(a, b); }
template<class T> void umax(T &a, T b) { a = max(a, b); }

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

const int mod = 1e9+7;
const int N = 2e5+5;

void solve(){
	int n;
	cin>>n;
	int a[n+1];
	forn(i,n){
		cin>>a[i];
	}
	int cnt=1,cur=1;
	while(cnt<=1e5){
		if(a[cur]==2){
			cout<<cnt;
			return;
		}
		cur=a[cur];
		cnt++;
	}
	cout<<-1;

}

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

Measured memory_bytes: 3964
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())

def eratosthenes(lim):
  is_p=[2]*lim

  is_p[0]=0
  is_p[1]=1

  for i in range(2,lim):
    for j in range(i*2,lim,i):
      is_p[j] += 1

  return is_p

lim=n+1
is_p=eratosthenes(lim)

ans=0
for i in range(1,n+1):
  ans+=i*is_p[i]
print(ans)

Measured memory_bytes: 151764
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#define EPS 1e-10
using namespace std;
typedef long long llong;
void print_v(vector<int>v) {
	for (int i = 0; i < v.size(); i++) {
		cout << v[i];
	}
	cout << endl;
}
int main() {
	int n;
	cin >> n;
	while (n--) {
		string s;
		cin >> s;
		vector<int>v(8), w(8);
		for (int i = 0; i < s.length(); i++) {
			v[i] = s[i] - '0';
			w[i] = v[i];
		}
		//print_v(v);
		sort(v.begin(), v.end());
		//print_v(v);
		sort(w.begin(), w.end(), greater<int>());
		//print_v(w);
		for (int i = s.length() - 1; i >= 0; i--) {
			w[i] -= v[i];
			if (w[i] < 0) {
				w[i - 1]--;
				w[i] += 10;
			}
		}
		cout << w[7] +w[6] * 10 + w[5] * 100 + w[4] * 1000 + w[3] * 10000 + w[2] * 100000 + w[1] * 1000000 + w[0] * 10000000 << endl;
	}
	return 0;
}

Measured memory_bytes: 3088
while 1:
    x,y = map(list,input().split())
    if x == ['0'] and y== ['0']: break

    h = b = 0
    for i in range(len(x)):
        if x[i] == y[i]:
            h += 1
        elif y[i] in x:
            b += 1

    print ('%d %d' % (h,b))

Measured memory_bytes: 6720
import java.util.*;
import java.util.Map.Entry;
 
class Main {
//	 static int mod =  (int) (Math.pow(10,9)+7);
//	 static int mod = 998244353;
   public static void main(String[] args) {
	   
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
       int K = sc.nextInt();
//       int B = sc.nextInt();
//       String S = sc.next();
//       String T = sc.next();
//       char[] s = S.toCharArray();
//       char[] t = T.toCharArray();
       
       int ans=0;
       while(N!=0) {
    	   N=N/K;
    	   ans++;
       }
       
       System.out.println(ans);
   }
      
}

Measured memory_bytes: 23252
#include <stdio.h>
#include <string.h>
int main(void)
{
    char a[11],b[11],c[11],d,e,f;

    scanf("%s%s%s",a,b,c);
    d=strlen(a);
    e=strlen(b);
    if(((a[d-1])==(b[0]))&&((b[e-1])==(c[0])))
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(a * 10 + b + c, max(a + b * 10 + c, a + b + c * 10));
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int i,j,num,pre,sum;
  int n[10000]={0},count[10000]={0};

  for(i=0;(scanf("%d",&n[i])==1);i++){}
  num=i;
  for(i=0;i<num;i++){
    for(j=0;j<=9999;j++){
      if(n[i]>36) break;
      pre=j;
      sum=0;
      sum+=pre/1000;
      pre-=(pre/1000)*1000;
      sum+=pre/100;
      pre-=(pre/100)*100;
      sum+=pre/10;
      pre-=(pre/10)*10;
      sum+=pre;
      if(sum==n[i]){
        count[i]++;
      }
    }
  }
  for(i=0;i<num;i++){
    printf("%d\n",count[i]);
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;
#define ll long long
 
inline int read()
{
	int x=0,f=1;
	char c=getchar();
	while(c>'9'||c<'0'){if(c=='-') f=-1;c=getchar();}
	while(c<='9'&&c>='0'){x=x*10+c-48;c=getchar();}
	return x*f;
}
 
inline ll llread()
{
	ll x=0,f=1;
	char c=getchar();
	while(c>'9'||c<'0'){if(c=='-') f=-1;c=getchar();}
	while(c<='9'&&c>='0'){x=x*10+c-48;c=getchar();}
	return x*f;
}

ll a,b,c;

int main()
{	
	a=llread(),b=llread(),c=llread();
	if(a+b+1>=c)
		printf("%lld\n",b+c);
	else
		printf("%lld\n",2*b+a+1);
	return 0;
} 

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s;
	ll ans=0;
	cin >>s;
	vector<int>dic(200010,1);
	rep(i,200001){
		dic[i+1]=dic[i]*10%2019;
	}
	map<int,int>tri;
	int bef=0;
	for(int i=s.size()-1;i>=0;i--){
		bef=bef+dic[s.size()-1-i]*(s[i]-'0');
		bef%=2019;
		tri[bef]+=0;
		tri[bef]++;
	}
	repi(itr,tri){
		if(itr->F==0){
			ans+=(itr->S)*(itr->S + 1)/2;
		}else{
			ans+=(itr->S)*(itr->S -1)/2;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4428
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int X, Y; cin >> X >> Y;
    cout << X + Y / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pi acos(-1)
#define mod 1000000007
using namespace std;

int dp[3001][3001];
string a, b;

void funk(int i, int j, string &s, string curr){
    if(i == 0 || j == 0){
        if(curr.length() > s.length()){
            s = curr;
        }
        return ;
    }
    if(a[i-1] == b[j-1]){
        curr += a[i-1];
        funk(i-1,j-1,s,curr);
        return;
    }
    if(dp[i-1][j] > dp[i][j-1]){
        funk(i-1,j,s,curr);
    }else /*if(dp[i][j-1] > dp[i-1][j])*/{
        funk(i,j-1,s,curr);
    }/*else{
        funk(i-1,j,s,curr);
        funk(i,j-1,s,curr);
    }*/
    return;
}

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

    cin >> a >> b;
    int n = a.length(), m = b.length();
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(a[i] == b[j]){
                dp[i + 1][j + 1] = dp[i][j] + 1;
            }
            dp[i+1][j+1] = max(dp[i + 1][j + 1], max(dp[i + 1][j], dp[i][j + 1]));
        }
    }
    string ans = "";
    string s;
    funk(n, m, ans, s);
    reverse(ans.begin(), ans.end());
    cout << ans;
    return 0;
}


Measured memory_bytes: 43264