akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main (void){
    int a,b,ans,i,j,keta;
    while(scanf("%d %d",&a,&b)!=EOF){
        ans=a+b;
        keta=0,j=1;
        for(;;){
            keta++;
            j=j*10;
            if(ans%j==ans)break;
        }
        printf("%d\n",keta);
    }
return 0;
}

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

int dp[3001][3001];
int f(int x, int y, string& s1, string& s2){
    if(x<0 or y<0) return 0;
    int &ans = dp[x][y];
    if(ans!=-1) return ans;
    
    ans = 0;
    if(s1[x]==s2[y]) ans = 1 + f(x-1,y-1,s1,s2);
    else{
        ans = max(f(x-1,y,s1,s2), f(x,y-1,s1,s2));
    }
    return ans;
}




int main(){
    memset(dp,-1,sizeof(dp));
    string s1, s2;
    cin>>s1>>s2;
    int temp = f(s1.size()-1, s2.size()-1,s1,s2);
    
    int i=s1.size()-1, j=s2.size()-1;
    
    string ans = "";
    while(temp){
        //cout<<ans<<" "<<temp<<endl;
        if(s1[i]==s2[j]){
            ans = s1[i]+ans;
            i--;
            j--;
            temp--;
        }
        else if(i-1>=0 and j-1>= 0 and dp[i-1][j]>=dp[i][j-1]){
            i--;
        }else{j--;}
    }
    
    cout<<ans;

}

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

int main()
{
  int n;
  int d, x;
  int a[105];
  int ans = 0;
  
  cin >> n;
  cin >> d >> x;

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

  for ( int i = 0; i < n; i++) {
    int j = 1;
    while ( j <= d) {
      ans++;
      j += a[i];
    }
  }
  ans += x;

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

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

vector<ll> s;
void solve(){
    int a,b;
    cin>>a>>b;
    if(a+b==15)cout<<"+"<<endl;
    else if(a*b==15)cout<<"*"<<endl;
    else cout<<"x"<<endl;

}
int main(){
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
#include<string>
#include<string.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
	int a, b, c;
	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.text.*;
import java.util.*;

public class Main {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

    static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000");
        long max = 1000000000000l, min = -10000000000000l;
        long mod = (long) 1e9 + 7;

        long pro(long a, long b) {
            return (a % mod * b % mod) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        long ncr3(long n) {
            return (n * (n - 1) * (n - 2)) / 6l;
        }

        long ncr2(long n) {
            return n * (n - 1) / 2l;
        }

        long modPow(long x, long y) {
            long res = 1l;
            x = x % mod;
            while (y > 0) {
                if (y % 2 != 0)
                    res = pro(res, x);
                x = pro(x, x);
                y = y >> 1;
            }
            return res;
        }

        int MAXN = 200005;

        void solve() {
            long n = sc.nlo();
            long k = sc.nlo();
            if (n < k)
                out.println(Math.min(n, k - n));
            else {
                if (n % k == 0)
                    out.println(0);
                else
                    out.println(Math.min(n % k, k - n % k));
            }
        }
    }
}


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

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i=0;i<(n);i++)
#define rep2(i, m, n) for(int i=m;i<(n);i++)
#define rrep(i, n, m) for(int i=n;i>=(m);i--)
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int K, X;
    cin >> K >> X;

    for (int i = X - K + 1; i <= K + X - 1; ++i) {
        cout << i << " ";
    }
    cout << "" << endl;

}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

class pcompare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return !(get<1>(a) < get<1>(b));
	}
};

int main() {
	int n, h, w;
	cin >> h >> w >> n;
	vi v(n);
	rep(i, n) {
		cin >> v[i];
	}
	vi ans;
	rep(i, n) {
		rep(j, v[i]) {
			ans.push_back(i + 1);
		}
	}
	rep(i, h){
		rep(j, w) {
			cout<< ans[w*i+((i%2==1)?w-j-1:j)];
			cout << (j == w - 1 ? "\n" : " ");
		}
	}
}

Measured memory_bytes: 384
import java.util.*;
import java.io.*;

public class Main{

     public static void main(String []args){
       Scanner scanner = new Scanner(System.in);
       int n1= scanner.nextInt();
        int n2= scanner.nextInt();
        List<Integer> list = new ArrayList<>();
        boolean b = false;
        
        for(int i=0;i<n2;i++){
       
        list.add( scanner.nextInt());
        }
       
      while(!b)
      {
          String s = String.valueOf(n1);
       
          int counter=0;
          char [] c1 = s.toCharArray();
          for(int i=0;i<s.length();i++)
          {
             int a = (int) s.charAt(i)-'0';
              if(list.contains(a))
              {
               
                  n1++;
                  break;
              }
              else
              {
                counter++;  
              }
          }
          
          if(counter==s.length())
          {
              b=true;
              break;
              
          }
          
          
      }
      
      System.out.println(n1);
       
     }
}

Measured memory_bytes: 43060
import sys
input = sys.stdin.buffer.readline
INF = 1001001001

N, K = map(int, input().split())
x = list(map(int, input().split()))

ans = INF

for i in range(N-K+1):
    if x[i] < 0:
        neg = -x[i]
    else:
        neg = 0
    if x[i+K-1] > 0:
        pos = x[i+K-1]
    else:
        pos = 0
    tmp = neg + pos + min(neg, pos)
    ans = min(ans, tmp)

print(ans)


Measured memory_bytes: 12496
#include <bits/stdc++.h>
#define M ((ll)1e12)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pi acos(-1)
typedef long long ll;
using namespace std;


void solve()
{
   int n;string s;
   cin>>n>>s;
   pair<int,int> h[10][10];int h1[10]={0};
   for(int i=0;i<10;i++)
   for(int j=0;j<10;j++)
   h[i][j]=mp(300001,0);
   for(int i=0;i<n;i++)
   {
       int v=s[i]-48;
       for(int j=0;j<10;j++)
       {
           if(h1[j]==1)
           {
               h[j][v].F=min(h[j][v].F,i);
               h[j][v].S=max(h[j][v].S,i);
           }
       }
       h1[v]=1;
   }
   ll c=0;
   for(int i=0;i<10;i++)
   {
       for(int j=0;j<10;j++)
       {
           int mi=h[i][j].F;
           for(int k=0;k<10;k++)
           {
               if(h[i][k].S>mi)
               c++;
           }
       }
   }
   cout<<c<<endl;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 384
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 10010010010010;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

int main() {
    long long S;cin >> S;
    long long C,D;
    if(S % 1000000000 == 0){
        D = S/1000000000;
        C = 0;
    }
    else{
        D = S/1000000000+1;
        C = (D*1000000000-S)%1000000000;
    }
    cout << "0 0 1000000000 1 " << C << " " << D << endl;
}


Measured memory_bytes: 256
import math
import copy
import sys
import fractions
# import numpy as np
# import statistics
import decimal
import heapq
import collections
import itertools
import bisect

# from operator import mul

sys.setrecursionlimit(100001)


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

# ===FUNCTION===

def getInputIntList():
    outputDataList = []
    inputData = input().split()
    outputDataList = [int(n) for n in inputData]

    return outputDataList


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())
adj = [list(map(int, input().split()))[2:] for _ in range(n)]

d = [-1] * n

for a in adj:
    for i in range(len(a)):
        a[i] -= 1

s = 0
q = collections.deque([])
d[s] = 0
q.append(s)
while len(q):
    u = q.popleft()
    v = adj[u]
    for vi in v:
        if d[vi] == -1:
            d[vi] = d[u] + 1
            q.append(vi)
        elif d[vi] > d[u] + 1:
            d[vi] = d[u] + 1
            q.append(vi)

for i, di in enumerate(d):
    print(i + 1, di)



Measured memory_bytes: 7020
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

class Combination {
public:
    vector <ll> fac, inv, fiv;

    Combination(int N) : fac(N + 1), inv(N + 1), fiv(N + 1) {
        fac[0] = inv[0] = fiv[0] = fac[1] = inv[1] = fiv[1] = 1;
        for (ll i = 2; i <= N; i++) {
            fac[i] = fac[i - 1] * i % MOD; // n!
            inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD; // n^-1
            fiv[i] = fiv[i - 1] * inv[i] % MOD; // (n!)^-1
        }
    }

    ll C(ll n, ll k) {
        if (k < 0 || n < k) return 0;
        return fac[n] * fiv[k] % MOD * fiv[n - k] % MOD;
    }

    ll P(ll n, ll k) {
        if (k < 0 || n < k) return 0;
        return fac[n] * fiv[n - k] % MOD;
    }

    ll H(ll n, ll k) {
        if (n == 0 && k == 0) return 1;
        return C(n + k - 1, k - 1);
    }
};

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

    ll n, k;
    cin >> n >> k;

    Combination com(400005);

    ll ans = 0;
    for (int i = 0; i < n && i <= k; i++) {
        // 最終的に0人の部屋がi個あるような場合の数
        ans = (ans + com.C(n, i) * com.H(i, n - i) % MOD) % MOD;
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 9600
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long w = sc.nextLong();
		long h = sc.nextLong();
		int x = sc.nextInt();
		int y = sc.nextInt();
		sc.close();
		System.out.println((double) (w * h) / 2.0
				+ ((x == (double) w / 2.0 && y == (double) h / 2.0) || (w * h == 0) ? " 1" : " 0"));
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,sum=0;
  cin >> n;
  
  for(int i=0;i<=n;i++){
    int a=i;
    int digit=0;
  while(a!=0){
    a = a / 10;
    digit = digit+1;
  }
  if(digit%2==1)
    sum = sum + 1;
  else  
    sum = sum + 0;
  }
  cout << sum << endl;
}

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

#define MOD 1000000007


int res(int N, set<int> a, vector<int> &fib){
  if(fib.at(N) != -1) return fib.at(N);

  if(N == 1) return fib.at(N) = 1;
  if(N == 0) return fib.at(N) = 1;

  return fib.at(N) = (res(N-1, a, fib) % MOD + res(N-2, a, fib) %MOD) % MOD;
}

int main(){
  int N, M;
  cin >> N >> M;
  set<int> a;
  vector<int> fib(N+1, -1);
  for(int i = 0; i < M; i++){
    int aa;
    cin >> aa;
    fib.at(aa) = 0;
  }
  cout << res(N, a, fib) << endl;
}


Measured memory_bytes: 17792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// --------------------------------------------------------
#define FOR(i,l,r) for (int i = (l); i < (r); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c), 0)
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((int)(c).size())
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<int,int>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const int INF = 1 << 30;
// const ll INF = 1LL << 62;
// --------------------------------------------------------


ll f(ll A, ll B, ll x) {
    return (B / x) - ((A - 1) / x);
}


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

    ll A, B, C, D; cin >> A >> B >> C >> D;

    ll ans = f(A, B, 1) - f(A, B, C) - f(A, B, D) + f(A, B, lcm(C, D));
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{   
    int a,b;
    cin >> a >> b;
    cout << ((a*b)%2==0 ? "Even" : "Odd") << endl;
    return 0;
}

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


int partition(int A[],int p,int r){
  
  int x = A[r];
  int i = p-1;
  for(int j = p; j < r; ++j){
    if(A[j] <= x){
      ++i;
      swap(A[i],A[j]);
    }
  }
  swap(A[i+1],A[r]);
  return i+1;
}

int main(){
  int n,A[len];
  cin >> n;
  for(int i=0; i<n; ++i) cin >> A[i];

  int p=partition(A,0,n-1);

  for(int i=0; i<n; ++i){
    if(i == p) cout << "[" << A[i] << "]";
    else  cout << A[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  


  return 0;
}



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

int main() {
  int H, W;
  cin >> H >> W;
  
  char array[H][W];
  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      cin >> array[i][j];
    }
  }
  
  for (int i=0; i<W+2 ; i++){
    cout << '#';
  } 
  cout << endl;
  
  for (int i=0; i<H; i++){
    cout <<'#';
    for (int j=0; j<W; j++){
      cout << array[i][j];
    }
    cout << '#' << endl;
  }
  
  for (int i=0; i<W+2 ; i++){
    cout << '#';
  } 
  cout << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
const int MAX = 100000 + 10;

char arr[MAX];

int main(){
  int n;
  scanf("%s", arr);
  scanf("%d", &n);
  int len = strlen(arr);
  for(int i = 0 ; n > 0 && i < len ; i++){
    int need = (int) ('z' - arr[i] + 1) % 26;
    if(n >= need) {
      arr[i] = 'a';
      n -= need;
    }
  }
  int now = arr[len-1] - 'a';
  now += n;
  now %= 26;
  arr[len-1] = now + 'a';
  puts(arr);
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <complex>
#include <functional>
#include <bitset>
#include <map>
#include <random>
#include <memory>
#include <map>
#include <valarray>
#include <iomanip>
#include <queue>

#include <cassert>
#include <ctime>
#include <cmath>
#include <cstdlib>

using namespace std;

const int inf = (int)1e9 + 7;

bool dfs (const vector<vector<int>> &gr, vector<bool> &used, vector<bool> &col, int v = 0, bool c = false)
{
    if (used[v])
        return col[v] == c;

    used[v] = true;
    col[v] = c;

    for (auto it : gr[v])
        if (!dfs (gr, used, col, it, !c))
            return false;

    return true;
}

int main ()
{
    //freopen ("input.txt", "r", stdin);

    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);

    int n, m;

    cin >> n >> m;

    vector<vector<int>> gr (n);

    for (int i = 0; i < m; i++)
    {
        int a, b;

        cin >> a >> b;
        a--;
        b--;

        gr[a].push_back (b);
        gr[b].push_back (a);
    }

    vector<bool> used (n), col (n);

    if (dfs (gr, used, col))
        cout << count (col.begin (), col.end (), true) * 
        (long long)count (col.begin (), col.end (), false) - m << endl;
    else
        cout << n * (long long)(n - 1) / 2 - m << endl;

    return 0;
}


Measured memory_bytes: 6272
#include <iostream>
#include <array>
#include <vector>
#include <functional>
#include <algorithm>
using namespace std;

int main()
{
    int X, Y, Z, num;
    cin >> X >> Y >> Z >> num;

    array<long,1001> cake1;
    array<long,1001> cake2;
    array<long,1001> cake3;
    for(int i=0;i<X;i++){
        cin >> cake1[i];
    }
    for(int i=0;i<Y;i++){
        cin >> cake2[i];
    }
    for(int i=0;i<Z;i++){
        cin >> cake3[i];
    }

    sort(cake1.begin(),cake1.begin()+X,greater<long>());
    sort(cake2.begin(),cake2.begin()+Y,greater<long>());
    sort(cake3.begin(),cake3.begin()+Z,greater<long>());

    vector<long> v;
    
    for(int i=0;i<X;i++){
        for(int j=0;j<Y;j++){
            for(int k=0;k<Z;k++){
                if(i*j*k<num){
                    v.push_back(cake1[i]+cake2[j]+cake3[k]);
                }else{
                    break;
                }
            }
        }
    }

    sort(v.begin(),v.end(),greater<long>());

    for(int i=0;i<num;i++){
        cout << v[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 35172
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	int N, A, B;
	int sum;
	int total = 0;
	int tmp;

	cin >> N >> A >> B;

	for (int i = 1; i <= N; i++)
	{
		tmp = i;
		sum = 0;
		while (tmp > 0)
		{
			sum += tmp % 10;
			tmp = (int)(tmp / 10);
		}

		if (A <= sum && sum <= B)
			total += i;
	}

	cout << total << endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)


int main(){
    int n,m;
    while(scanf("%d%d",&n,&m)){
        int i,j;
        if(n==0&&m==0)break;
        
        int a[101],b[101];
        for(i=0;i<n;i++) scanf("%d",&a[i]);
        for(i=0;i<m;i++) scanf("%d",&b[i]);
        
        int sumA=0,sumB=0;
        
        for(i=0;i<n;i++) sumA += a[i];
        for(i=0;i<m;i++) sumB += b[i];
        
        int diff = sumA-sumB;
        
        
        if(abs(diff)%2==1)printf("-1\n");
        else{
            int min_diff = INF;
            int x,y;
            
            for(i=0;i<n;i++){
                for(j=0;j<m;j++){
                    if(a[i]-b[j]==diff/2){
                        
                        if( min_diff>a[i]+b[j] ){
                            min_diff = a[i]+b[j];
                            x = a[i];
                            y = b[j];
                        }
                        
                    }
                }
            }
            if(min_diff==INF)printf("-1\n");
            else printf("%d %d\n",x,y);
        }
    }
}

Measured memory_bytes: 1196
#include<stdio.h>
#include<string.h>

#define MAX 2000000
#define INFTY (1<<30)

int H;
int A[MAX+1];

void maxHeapify(int x);
void insert(int key);
int extract(void);




int main(void){
  int key;
  char com[10];
    
  while(1){
    scanf("%s",com);
	
    if(com[0] == 'e' && com[1] == 'n'){
      break;
    }
	
    if(com[0]=='i'){
      scanf("%d",&key);
      insert(key);
	  
    } else {
      printf("%d\n",extract());
    }
  }
  
  return 0;
}


void maxHeapify(int x){
  int l,r;
  int max,temp = 0;
  
  l = 2*x;
  r = 2*x + 1;

  if(l <= H && A[x] < A[l]){
    max = l;
  } else {
    max = x;
  }
  
  if(r <= H && A[max] < A[r] ){
    max = r;
  }

  if(max != x){
    temp = A[x];        
    A[x] = A[max] ;
    A[max] = temp ;
    
    maxHeapify(max);
  }
  
}



void insert(int key){
  H++;
  A[H] = -INFTY;
  
  increaseKey(H,key);
}



int extract(void){
  int max;
    
  if(H < 1){
    return -INFTY;
  }
    
  max = A[1];
  A[1] = A[H--];
    
  maxHeapify(1);
    
  return max;
}


void increaseKey(int i,int key){
  int temp = 0;
  
  if(key < A[i]){
    return;
  }
    
  A[i] = key;
    
  while(1 < i && A[i/2] < A[i]){
      temp = A[i];
      A[i] = A[i/2];
      A[i/2] = temp;
	
      i = i/2;
    }
  
}



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

using namespace std;

typedef long long ll;
typedef long long unsigned int llui;
typedef long long int lli;
typedef long double float64;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

#define INF 1000000000
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define all(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define UNIQUE(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define tr(container, it) \
    for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) 

// #define sz(a) int((a).size())
// #define pb push_back
// #define fill(a,v) memset(a,v,sizeof a)


#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;

#define trace3(x,y,z) cout<< '>' << #x << ':' << x \
        << " | " << #y << ':' << y <<" | " << #z << ':' << z << endl;

#define trace4(x,y,z,w) cout<< '>' << #x << ':' << x \
    << " | " << #y << ':' << y <<" | " << #z << ':' << z << " | " << #w << ':' << w << endl;


inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

#define LSOne(S) (S&(-S))

const double pi = acos(-1);

/////////////////////////////////////////////////////////////////////

/*bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
{
    return (a.second < b.second);
}*/

template<class T> inline T gcd(T a,T b) //NOTES:__gcd(0,0) gives exception
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}



const int MAX_N = 123;

//ll arr[MAX_N];

int main() {
    ll N,t;
    scanf("%lld",&N);
    int sum=0;
    t=N;
    while(t){
        sum+=t%10;
        t/=10;
    }
    if(N%sum==0){
        printf("Yes\n");
    }
    else
        printf("No\n");
	return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main()
    {
        while(true)
        {
            string[] s = Console.ReadLine().Split(' ');
            int h,w;
            h = int.Parse(s[0]);
            w = int.Parse(s[1]);
            if(h==0 && w==0)break;
            for(int i=0;i<h;i++)
            {
                for(int j=0;j<w;j++)
                {
                    if(i==0 || j==0 || i==h-1 || j==w-1)
                    {
                        Console.Write('#');
                    }
                    else
                    {
                        Console.Write('.');
                    }
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
}



Measured memory_bytes: 15932
N, M = map(int, input().split())
heights = list(map(int, input().split()))

paths = [1] * N

for i in range(M):
    a, b = map(int, input().split())
    if heights[a-1] <= heights[b-1]:
        paths[a-1] = 0
    if heights[a-1] >= heights[b-1]:
        paths[b-1] = 0

print(sum(paths))

Measured memory_bytes: 19956
#include<bits/stdc++.h>
using namespace std;
#define lli long long int 
int main()
{
    lli n,x,t,a;
    cin>>n>>x>>t;
    if(n%x==0)
    a=n/x;
    else
    a=n/x+1;
    cout<<a*t;
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a, b, c;
    cin >> a >> b >> c;
    ll ans = 0;
    
    if ((a % 2 == 0) || (b % 2 == 0) || (c % 2 == 0)) {
        ans = 0;
    }
    else {
        ans = min(a * b, min(b * c, a * c));
    }
    
    cout << ans << endl;
    return 0;
}


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

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

typedef unsigned long long UInt64;
typedef long long Int64;

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

using namespace std;

typedef pair<int ,int > P;

string sei(int n)
{
	string res="";
	rep(i,8)
	{
		if(n%2==0)
		{
			res+="0";
		}
		else
		{
			res+="1";
		}
		n/=2;
	}

	reverse(all(res));
	return res;
}

string syo(double d)
{
	string res="";
	rep(i,4)
	{
		d*=2;
		if((int)d==1)
		{
			res+="1";
			d-=1.0;
		}
		else
		{
			res+="0";
		}

	}
	if(d!=0.0) return "-1";

	return res;
}

int main()
{
	double d;
	while(cin>>d)
	{
		if(d==-1.0) return 0;
		
		string ans = sei((int)d)+"."+syo(d - (int)d );
		if(ans.size()==13) cout<<ans<<endl;
		else cout<<"NA"<<endl;
		//cout<<ans<<endl;

	}
		return 0;
}

Measured memory_bytes: 1228
#include<stdio.h>
int main()
{
    int a,b,s,m,p;
    scanf("%d%d",&a,&b);
    s=a+b,p=a*b,m=a-b;
    a=(s>p?(s>m?s:m):(p>m?p:m));
    printf("%d\n",a);

}

Measured memory_bytes: 1732
# https://onlinejudge.u-aizu.ac.jp/problems/ALDS1_3_A

a = list(map(str, input().split()))


def is_op(s):
    if s == '+' or s == '-' or s == '*':
        return True
    return False


a2 = []
for s in a:
    if is_op(s):
        n2 = a2.pop()
        n1 = a2.pop()
        a2.append(eval(str(n1) + s + str(n2)))
    else:
        a2.append(int(s))

print(a2.pop())



Measured memory_bytes: 5604
#include <stdio.h>

int N;
int a[114514], b[114514], c[114514];

int yakusimaruhiroko[114514][4];

int yosinagasayuri(int pos, int prev) {
	int minaseinori = 0, mizukinana;
	if (pos >= N) return 0;
	if (yakusimaruhiroko[pos][prev]) return ~yakusimaruhiroko[pos][prev];

	if (prev != 0) {
		mizukinana = yosinagasayuri(pos + 1, 0) + a[pos];
		if (mizukinana > minaseinori) minaseinori = mizukinana;
	}
	if (prev != 1) {
		mizukinana = yosinagasayuri(pos + 1, 1) + b[pos];
		if (mizukinana > minaseinori) minaseinori = mizukinana;
	}
	if (prev != 2) {
		mizukinana = yosinagasayuri(pos + 1, 2) + c[pos];
		if (mizukinana > minaseinori) minaseinori = mizukinana;
	}
	return ~(yakusimaruhiroko[pos][prev] = ~minaseinori);
}

int main(void) {
	int i;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d%d%d", &a[i], &b[i], &c[i]) != 3) return 1;
	}
	printf("%d\n", yosinagasayuri(0, 3));
	return 0;
}


Measured memory_bytes: 9068
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   ff   first
#define   ss   second
#define   pii  pair<int,int>
using namespace std;

int  fun(int n){
    for (int i=sqrt(n);i>1;i--)
        if (n%i==0) return (i+n/i-2);
    return n-1;
}

inline void solve(){
    int n; cin>>n; 
    cout << fun(n) << endl;
}

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


Measured memory_bytes: 3652
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8

LL func(LL h, LL w){
	LL ret = h % 3 ? w : 0LL;
	for(LL i = 1; i < h; ++i){
		LL s1 = i * w;
		LL s2 = (h - i) * (w / 2);
		LL s3 = (h - i) * ((w + 1) / 2);
		
		LL a = max({s1, s2, s3});
		LL b = min({s1, s2, s3});
		chmin(ret, a - b);
	}
	return ret;
}

void mainmain(){
	LL h, w;
	cin >> h >> w;
	LL s1 = func(h, w);
	LL s2 = func(w, h);
	cout << min(s1, s2) << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#define ll long long int
using namespace std;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

int main() {
	int N;
	cin >> N;
	vector<string> arr;

	for(int i = 0; i < N; i++) {
		string input;
		cin >> input;
		arr.push_back(input);
	}
	int freq[26][N];
	for(int i = 0; i < 26; i++) {
		for(int j = 0; j < N; j++) {
			freq[i][j] = 0;
		}
	}
	for(int i = 0; i < N; i++) {
		for(int j = 0; j < arr[i].length(); j++) {
			freq[int(arr[i][j]) - int('a')][i]++;
		}
	}

	int overfreq[26];
	for(int i = 0; i < 26; i++) {
		overfreq[i] = 100;
	}

	for(int i = 0; i < N; i++) {
		for(int j = 0; j < 26; j++) {
			if(overfreq[j] > freq[j][i]) {
				overfreq[j] = freq[j][i];
			}
		}
	}

	for(int i = 0; i < 26; i++) {
		for(int j = 0; j < overfreq[i]; j++) {
			int of_A = int('a');
			int to_output = of_A + i;
			char output = char(to_output);
			cout << output;
		}
	}
	cout << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
		private static Scanner sc;
	    public static void main(String[] args){
	    	int A[] = new int[31];
	        A[0]=1;
	        for (int i=1; i<=30; i++){
	        	A[i]=A[i-1];
	        	if (i>1) A[i]+=A[i-2];
	        	if (i>2) A[i]+=A[i-3];
	        }
	        sc = new Scanner(System.in);
			int a;
			while ((a=sc.nextInt())>0){
				System.out.println((int)(A[a]/3650)+1);
	        }
	}
}

Measured memory_bytes: 25804
n,m,c=map(int, input().split())
B=[int(x) for x in input().split()]

sum=0
count=0

for i in range(0,n):
    A=[int(n) for n in input().split()]
    for j in range(0,m):
        sum+=A[j]*B[j]
    if sum+c>0:
        count+=1
    sum=0

print(count)

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

#define ll long long int
#define ull unsigned long long int
#define lld long double
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
#define vull vector<ull>
#define all(v) v.begin(),v.end()
#define mp make_pair
#define bitcount(x) __builtin_popcountll(x)
#define charcount(s,c) count(s.begin(), s.end(), c)
#define each(a,b) memset(a,b,sizeof a) //for b=0/-1, all pos,s for multidim arr too;
#define tofsi(s,c,t) memset(s,c,t) // for char s[n],first t;
#define tofs(s,pos,c,t) fill_n(s.begin()+pos, t, c);
#define fi first
#define se second
#define cfl cout.flush()

ll e_bit=0xAAAAAAAA;
ll o_bit=0x55555555;
lld pi = acos(-1.0);
ll gprime=402653189;
ll pprime=1610612741;
ll dulo=1000000007;

bool is_power2(ll n){
	return (n&&!(n&(n-1)));
}
ll power(ll x, ll y){
    ll temp;
    if( y == 0)
       return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return (temp*temp);
    else
    {
        if(y > 0)
            return (((x*temp))*temp);
        else
            return (temp*temp)/x;
    }
}

long long int mul_inv(long long int n,long long int p,long long int m){
	if(p==1){
		return n%m;
	}
	else if(p%2==0){
		long long int t= mul_inv(n,p/2,m);
		return ((t)*(t))%m;
	}
	else{
		long long int t= mul_inv(n,p/2,m);
		return ((((n%m)*t)%m)*t)%m;
	}
}

bool isprime(ll n){
	if(n==1){
		return false;
	}
	if(n==2){
		return true;
	}
	if(n%2==0){
		return false;
	}
	for(ll i=3;i<=sqrt(n);i+=2){
		if(n%i==0){
			return false;
		}
	}
	return true;
}


// getline(cin,s), cin.ignore() if cin>>p b4;


/*
struct compare {
    bool operator() (string a,string b) const{
    	string s1=a+b;
    	string s2=b+a;
        return s1<s2;
    }
};
*/


/*
---------------------Priority Queue Compare Operator------------------------

priority_queue<int, std::vector<int>, compare> pq;

*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	/*freopen("fbh.in","r",stdin);
    freopen("B-large.out","w",stdout);*/
	/*float ans;
	std::cout << std::fixed;
    std::cout << std::setprecision(9);
    std::cout << ans;
	*/
	int n;
	cin>>n;
	int a[2][n];
	for(int i=0;i<2;i++){
		for(int k=0;k<n;k++){
			cin>>a[i][k];
		}
	}
	int a1[n];
	a1[0]=a[0][0];
	for(int i=1;i<n;i++){
		a1[i]=a[0][i]+a1[i-1];
	}
	int a2[n];
	a2[n-1]=a[1][n-1];
	for(int i=n-2;i>=0;i--){
		a2[i]=a2[i+1]+a[1][i];
	}
	int m=0;
	for(int i=0;i<n;i++){
		m=max(m,a1[i]+a2[i]);
	}
	cout<<m<<endl;
	return 0;
}

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

int main(){
  int d;
  int c[27];
  int s[400][27];
  int t[400];
  static int last[27];//最後の開催日

  cin >> d;
  rep(i, 26)cin >> c[i+1];
  rep(i, d){
    rep(j, 26){
      cin >> s[i+1][j+1];
    }
  }

  for(int i=1;i<=d;i++){
    int mx = -INF;
    int mxi;
    for(int j=1;j<=26;j++){
      int tmp=0;
      tmp += s[i][j];
      for(int k=1;k<=26;k++){
        if(j!=k)tmp-=(i-last[k])*c[k];
      }
      if(tmp>mx){
        mx = tmp;
        mxi = j; 
      }
    }
    t[i]=mxi;
    last[t[i]]=i;
  }

  rep(i, d)cout << t[i+1] << endl;
  return 0;
}


Measured memory_bytes: 3688
//
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;

/*CODE START HERE*/

string a, ans;

int main(){
    ios::sync_with_stdio(0);
    cin >> a;
    ans.clear();

    forn(i,a.size()){
        if(a[i] != 'B'){
            ans.push_back(a[i]);
            continue;
        }

        if(!ans.empty()){
            ans.pop_back();
        }
    }

    cout << ans << "\n";
    return 0;
}

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

int main() {
  int i, j;
  char str[100];
  int N;
  int K;

  scanf("%d %d ", &N, &K);
  scanf("%[^\n]%*c", str);
  
  if(str[K-1] == 'A'){
    str[K-1] = 'a';
  }
  else if(str[K-1] == 'B'){
    str[K-1] = 'b';
  }
  else if(str[K-1] == 'C'){
    str[K-1] = 'c';
  }

  printf("%s", str);

  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string str,str2;
  	cin >> str;
  	cin >> str2;
  	int len1 = str.length();
  	int len2 = str2.length();
  	for(int i=0;i<len1;i++){
    	if(str[i]!=str2[i]){
        	cout<<"No\n";exit(0);
        }
    }
  
  	(len1 == len2-1)? cout<<"Yes\n":cout<<"No\n";
  	return 0;
  
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

int slide(int num, int p){
	return num % 1000 * 10 + p;
}

const int M = 1000000007;
set<int> s;

bool ncheck(int num){
	string s = to_string(num);

	rep(i,s.size()){
		if(s[i] >= '5' and s[i] <= '9') return true;
		if(s[i] == '0') return true;
	}

	return false;
}

void makeSet(){
	rep(i,5){
		s.emplace(312 * 10 + i);
		s.emplace(312 + i * 1000);

		s.emplace(123 * 10 + i);
		s.emplace(123 + i * 1000);

		s.emplace(132 * 10 + i);
		s.emplace(132 + i * 1000);

		s.emplace(1032 + 100 * i);
		s.emplace(1302 + 10 * i);
	}
}

signed main(){
	makeSet();

	assert(slide(1234, 4) == 2344);
	assert(slide(4234, 2) == 2342);
	assert(slide(201, 0) == 2010);

	assert(s.count(1232));
	assert(s.count(1132));

	assert(s.count(3123));
	assert(s.count(2312));


	int n;
	cin >> n;

	vector<int> cur(4500, 0);
	rep(i,4) cur[i + 1]++;
	rep(i,n - 1){
		vector<int> nxt(4500, 0);
		range(j,1,4444 + 1){
			if(log10(j) >= i + 1) break;
			if(ncheck(j) || cur[j] == 0){
				continue;
			}

			rep(k,4){
				int tmp = slide(j,k + 1);
				if(s.count(tmp)) continue;
				(nxt.at(tmp) += cur.at(j)) %= M;
			}
		}
		cur = nxt;
	}

	int ans = 0;
	rep(i,4500){
		(ans += cur[i]) %= M;
	}

	cout << ans << endl;
}


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

int main(){
	int n;
    cin>>n;
    vector<int> ans(n,0);
	for(int i=1;i<n;i++){
    	int a;
        cin>>a;
        ans[a-1]++;
    }
    for(int i=0;i<n;i++){
    	cout<<ans[i]<<endl;
    }
}


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

int main(){
  int n, m=0;
  cin >> n;
  int a[n], b[n], c[n-1];
  
  rep(i,0,n) cin >> a[i];
  rep(i,0,n) cin >> b[i];
  rep(i,0,n-1) cin >> c[i];
  
  rep(i,0,n) m+=b[i];
  rep(i,0,n-1){
    if(a[i+1]==a[i]+1){
      m+=c[a[i]-1];
    }
  }
  cout << m << endl;
  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            int iN = int.Parse(Console.ReadLine().Trim());
            List<int> lstInp = new List<int>();
            for (int i = 0; i < iN; i++)
            {
                lstInp.Add(int.Parse(Console.ReadLine().Trim()));
            }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            lstInp.Sort(delegate (int mca1, int mca2) { return (int)(mca1 - mca2); });      // 昇順
            int iOut = lstInp.Sum();                                                        // とりあえず合計
            int iOuk = iOut;                                                                // とりあえず合計のBak
            Boolean bOk = false;
            if (iOut % 10 != 0) { bOk = true; }                                             // 10の倍数でない=OK
            if (!bOk)                                                                       // 全部10の倍数かチェック
            {   Boolean bAll10 = true;
                for (int i = 0; i < lstInp.Count; i++) { if (lstInp[i] % 10 != 0) { bAll10 = false; break; } }                   // 10の倍数でないと抜ける
                if (bAll10) { iOut = 0; bOk = true; } }                                     // 全部10の倍数なら0固定
            if (!bOk)                                                                       // 小さい方から抜いていく
            {
                for (int i = 0; i < lstInp.Count; i++)
                {
                    iOut = iOuk - lstInp[i];                                                // nの中に必ず10の倍数でない値ありその値の最小値を引けば最大値
                    if (iOut % 10 != 0) { break; }                                          // 10の倍数でないと抜ける
                }
            }

            //出力
            Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 11476