akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;


const long long int mod = 998244353;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 
const long long int pl=1000000;

long long int X,Y,sum=15;

int main(){

    cout << fixed << setprecision(18);
    cin>>X>>Y;
    IFYes(Y%2==0&&Y>=2*X&&Y<=4*X);
}




Measured memory_bytes: 3628
def main():
    n=int(input())
    s=list(input())
    if n %2 ==1:
        print('No')
        return
    m=int(n/2)
    for i in range(0,m):
        if s[i]==s[m+i]:
            continue
        else:
            print('No')
            return
    print('Yes')
if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

const ll INF = 1LL << 60;
const int INT_INF = 1e8;
const int MOD = 1000000007;

int main() {
    int N; cin >> N;
    string S,T; cin >> S >> T;
    ll ans;
    int i = 0;
    bool pre;
    while(i < N) {
        if(S[i] == T[i]) {
            if(i == 0) {
                ans = 3;
            } else if(pre) {
                ans *= 1;
            } else {
                ans *= 2;
                ans %= MOD;
            }
            pre = 0;
            i++;
        } else {
            if(i == 0) ans = 6;
            else if(pre) {
                ans *= 3;
                ans %= MOD;
            } else {
                ans *= 2; 
                ans%= MOD;
            }
            pre = 1;
            i += 2;
        }
        //cout << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main(){
	int a,b,c;
	int ans=0;
	cin>>a>>b>>c;
	for (int i=a;i<=b;i++){
		if (c%i==0){
			//c????´???°
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1164
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions 

#endif


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

    int N, M; cin >> N >> M;
    vi X(M); REP(i, M) cin >> X[i];

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

    vi d;
    REP(i,M-1){
        d.push_back(abs(X[i + 1] - X[i]));
    }

    sort(d.begin(), d.end(), greater<int>());

    ll ans = 0;
    for(int i=N-1; i<d.size(); i++) {
        ans += (ll)d[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1276
#include <cstdio>
#include <cmath>

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    int count_b_digit = 0;
    int c = b;
    for(int i = 1;; i++){
        if(c / 10 >= 0){
            count_b_digit++;
            c = (c - c % 10) / 10;
        }
        if(c == 0){
            break;
        }
    }
    int d = a * pow(10,count_b_digit) + b;
    int e = sqrt(d);
    if(e * e == d){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	string s;
	zep(i, 0, 3){
		cin >> s;
		cout << s[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigInteger n = new BigInteger(sc.next());
        BigInteger a_blue = new BigInteger(sc.next());
        BigInteger b_red = new BigInteger(sc.next());
        BigInteger absum = a_blue.add(b_red);
        BigInteger div = n.divide(absum);
        BigInteger rem = n.remainder(absum);
        BigInteger answer = div.multiply(a_blue).add(rem.min(a_blue));
        System.out.println(answer);
        sc.close();
    }
}


Measured memory_bytes: 35920
#include <iostream>
#include <vector>
#define MAX_V 100001

using namespace std;

struct edge { int to; long long cost; };

vector<edge> tree[MAX_V];
long long depth[MAX_V];

// v: 今いる頂点, p: v の親
void dfs(int v, int p, long long d) {
    depth[v] = d;
    for (int i = 0; i < tree[v].size(); i++) {
        edge e = tree[v][i];
        // 戻らないようにする処理
        if (e.to == p) { continue; }
        dfs(e.to, v, d + e.cost);
    }
}

int main() {
    int N, a, b, c;
    int Q, K, x, y;

    cin >> N;

    for (int i = 0; i < N-1; i++) {
        cin >> a >> b >> c;
        a--, b--;
        tree[a].push_back(edge{b, c});
        tree[b].push_back(edge{a, c});
    }

    cin >> Q >> K;
    dfs(K-1, -1, 0);

    for (int i = 0; i < Q; i++) {
        cin >> x >> y;
        x--; y--;
        cout << depth[x] + depth[y] << endl;
    }
    return 0;
}

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

int main()
{
    int N,M;
    cin >> N >> M;
    
    
    int a[M];
    int b[M];
    
    for(int i=0;i<M;i++){
        cin >> a[i] >>b[i];}
    
    int sum[N];
    
    for(int i=0;i<N;i++){
        sum[i]=0;
        for (int j=0;j<M;j++){
            if (a[j]==i+1 ||  b[j]==i+1)
                sum[i] += 1;}
        cout << sum[i]<<"\n";}
}


Measured memory_bytes: 256
from sys import stdin
def input():
    return stdin.readline().strip()

import heapq

def main():
    h, w, k = map(int, input().split())
    x1, y1, x2, y2 = map(int, input().split())

    # surround the square with '@'
    c = [['@'] * (w+2)]
    for _ in range(h):
        i = input()
        l = ['@']
        for j in i:
            l.append(j)
        l.append('@')
        c.append(l)
    c.append(['@'] * (w+2))

    # Dijkstra
    # seen[x][y] = the minimum cost of (x, y)
    # if seen[x][y] == -1, (x, y) is unresearched
    seen = [[-1] * (w+2) for _ in range(h+2)]

    # todo[i] == (cost, x, y, direction)
    todo = [(0, x1, y1, 0)]
    heapq.heapify(todo)

    # direction
    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]

    while len(todo) > 0:
        cost, xi, yi, direction = heapq.heappop(todo)

        # only straight
        if seen[xi][yi] != -1:
            if (seen[xi][yi]+k-1)//k * k > cost:
                xj, yj = xi + dx[direction], yi + dy[direction]
                if c[xj][yj] == '.':
                    heapq.heappush(todo, (cost+1, xj, yj, direction))
            continue
        seen[xi][yi] = cost

        # goal
        if xi == x2 and yi == y2:
            print((cost+k-1)//k)
            exit()
        
        # 4 directions
        for j in range(4):
            xj, yj = xi + dx[j], yi + dy[j]
            if c[xj][yj] == '.':
                if j == direction:
                    if seen[xj][yj] == -1 or (seen[xj][yj]+k-1)//k * k > cost:
                        heapq.heappush(todo, (cost+1, xj, yj, j))
                elif seen[xj][yj] == -1:
                    heapq.heappush(todo, ((cost+k-1)//k * k + 1, xj, yj, j))

    print(-1)

main()

Measured memory_bytes: 77220
K, N = map(int, input().split(' '))
A_ls = list(map(int, input().split(' ')))
rst = 0
for i in range(N):
    l = A_ls[(i + 1) % len(A_ls)] - A_ls[i]
    if l < 0:
        l = A_ls[(i + 1) % len(A_ls)] + K - A_ls[i]
    rst = max(rst, l)
print(K - rst)

Measured memory_bytes: 32268
//#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include<bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <queue>
#include <set>
#include <string>
#include <stdbool.h>
#include<ctime>

#include <cstring>

#define pb push_back


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define ll long long
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) < (b) ? (a) : (b))

#define getI(a) scanf("%d",&a)
#define getII(a, b) scanf("%d%d",&a,&b)
#define getIII(a, b, c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a, b) scanf("%lld%lld",&a,&b)
#define getLLL(a, b, c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfb(a) printf("%.10lf\n",a);
#define pfi(a) printf("%d",a);
#define pfii(a, b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a, b) printf("%lld%lld",a,b);
#define pfd(a) printf("%.12lf ",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
#define endl "\n"

#define MOD  ( int)(1e9 + 7)
#define MAXN (ll) ((1e5+5))
#define K 25
#define  ALPHABET_SIZE  26
//#define N (int)(1e5+10)
#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define INF (ll )1e18
#define int ll
using namespace std;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<pair<int, int>>> vvpi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph;


ll res = 0; 

signed main(){
	ll n ,d;
	cin >> n >> d;
	for (int a , b, i = 1; i <= n; i++){
		cin >> a>> b;

		if (a  *a + b * b <= d * d )res++;
	}

	cout << res;






	return 0;



}




/*


10 567
300 150 460 518 426 181 393 70 129 742
*/


Measured memory_bytes: 3588
#include <iostream>
using namespace std;
typedef long long ll;
ll n, k, bit[40], a[100100], b[100100], maxbit, ans;

ll pow(ll x, ll y){
    if (y == 0) return 1;
    if (y % 2){
        return x * pow(x, y - 1);
    } else {
        ll yyy = pow(x, y / 2);
        return yyy * yyy;
    }
}

int main(void){
    // Your code here!
    cin >> n >> k;
    for (ll i = 0; i < n; i++) cin >> a[i] >> b[i];
    for (ll i = 0; i < 39; i++){
        bit[i] = k % 2;
        k /= 2;
        if (bit[i] == 1) maxbit = i;
    }
    for (ll i = 0; i <= maxbit + 1; i++){
        if (i != 0 && bit[i - 1] == 0) continue;
        ll whole = 0, sum = 0;
        if (i != 0) whole += pow(2, i - 1) - 1;
        for (ll j = i; j <= maxbit; j++){
            whole += bit[j] * pow(2, j);
        }
        for (ll j = 0; j < n; j++){
            if (whole == (whole | a[j])) sum += b[j];
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
n = int(input())

st_t = 0
st_x = 0
st_y = 0
li_in = list()
for i in range(n):
    li_in.append(list(map(int, input().split())))


for t, x, y in li_in:
    time = t - st_t
    diff_x = abs(x - st_x)
    diff_y = abs(y - st_y)

    if diff_x + diff_y > time:
        print('No')
        exit(0)
    elif diff_x + diff_y == time:
        st_t = t
        st_x = x
        st_y = y
        continue
    # elif diff_x + diff_y < t:
    else:
        if (time - (diff_x + diff_y)) % 2 == 0:
            st_t = t
            st_x = x
            st_y = y
            continue
        else:
            print('No')
            exit(0)
else:
    print('Yes')


Measured memory_bytes: 27124
#include<stdio.h>

int main(void){
  int a,b,x,y,z;
  scanf("%d %d %d %d %d",&a,&b,&x,&y,&z);
  if ( a < x+z ){
    printf("No\n");
  } else if ( 0 > x-z ){
    printf("No\n");
   
  } else if ( b < y+z ){
    
    printf("No\n");
    
  } else if ( 0 > y-z ){
    
    printf("No\n");
   
  } else printf("Yes\n");

  return 0;

}



Measured memory_bytes: 2112
class InsertionSort
  def self.execute(a, n)
    puts a.join(' ')

    1.upto(n - 1) do |i|
      v, j = a[i], i - 1

      while j >= 0 && a[j] > v
        a[j + 1] = a[j]
        j -= 1
      end

      a[j + 1] = v
      puts a.join(' ')
    end
  end
end

if $PROGRAM_NAME == __FILE__
  n = gets.to_i
  InsertionSort.execute(gets.split.map(&:to_i), n)
end

Measured memory_bytes: 8812
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

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

  string S;
  cin >> S;

  int Q;
  cin >> Q;

  vector<int> K;
  ll k;
  for (int i = 0; i < Q; ++i) {
    cin >> k;
    K.push_back(k);
  }

  for (int k : K) {
    fprintf(stderr, "k: %d\n", k);
    ll ans = 0;
    ll rui[N][3];
    map<string, ll> counter;

    for (int i = 0; i < N; ++i) {
      char ch = S[i];

      switch(ch) {
        case 'D':
          counter["D"]++;
          break;
        case 'M':
          counter["M"]++;
          counter["DM"] += counter["D"];
          break;
        case 'C':
          ans += counter["DM"];
          break;
        default:
          // NOOP
          break;
      }

      if (i >= k - 1) {
        char c = S[i - k + 1];

        switch(c) {
          case 'D':
            counter["D"]--;
            counter["DM"] -= counter["M"];
            break;
          case 'M':
            counter["M"]--;
            break;
          default:
            // NOOP
            break;
        }
      }
    }

    cout << ans << endl;
  }

  return 0;
}


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

int main() {
  int a[4] = {};
  for (int i = 0; i < 6; i++) {
    int val;
    cin >> val;
    a[val - 1]++;
  }

  bool ans = true;

  for (int i = 0; i < 4; i++) {
    if (a[i] ==  3) ans = false;
  }

  if (ans) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
#include <random>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;
 

int main() {

    ll K; cin >> K;

    ll left_cnt = K % 50;
    ll height = K - left_cnt;

    vector<ll> ans(50,49 + height / 50);
    int idx = 0;
    while(left_cnt > 0) {
        if(ans[idx] < 1e16 + 900) {
            ans[idx] += 50;
            REP(i,50) if(idx!=i) ans[i]--;
            left_cnt--;
        } else {
            idx++;
        }
    }

    cout << ans.size() << endl;
    REP(i,ans.size()) cout << ans[i] << " ";
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
#define vint vector<int>

template <class T> class SegmentTree {
    int n;
    vector<T> seg_tree;
    T unit;
    function<T(T, T)> operation;
    function<T(T, T)> update;
    T _query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l)
            return unit;
        if (a <= l && r <= b) {
            return seg_tree[k];
        } else {
            T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2);
            T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r);
            return operation(c1, c2);
        }
    }

  public:
    SegmentTree(size_t _n, T _unit, function<T(T, T)> _operation,
                function<T(T, T)> _update)
        : unit(_unit), operation(_operation), update(_update) {
        n = 1;
        while (n < _n) {
            n *= 2;
        }
        seg_tree = vector<T>(2 * n - 1, unit);
    }

    void change(int index, T changed) {
        index += n - 1;
        seg_tree[index] = update(seg_tree[index], changed);
        while (index > 0) {
            index = (index - 1) / 2;
            seg_tree[index] =
                operation(seg_tree[index * 2 + 1], seg_tree[index * 2 + 2]);
        }
    }
    T query(int a, int b) { return _query(a, b, 0, 0, n); }
    T operator[](int index) { return seg_tree[index + n - 1]; }
};

int main() {
    int n, q;
    cin >> n >> q;
    SegmentTree<ll> st(n, (1LL << 31) - 1, [](ll a, ll b) { return min(a, b); },
                       [](ll a, ll b) { return b; });
    rep(query, q) {
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0)
            st.change(x, y);
        else
            cout << st.query(x, y + 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 4880
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <limits>
#include <unordered_map>

using namespace std;

bool ATGC(char c)
{
	return (c == 'A') || (c == 'T') || (c == 'G') || (c == 'C');
}

bool allATGC(const string &S, size_t left, size_t right)
{
	for (size_t i = left; i < right; i++)
	{
		if (!ATGC(S[i])) return false;
	}
	return true;
}

int syakutori(const string &S)
{
	int max_length = 0;
	size_t left = 0, right;
	while (left < S.size())
	{
		if (!ATGC(S[left]))
		{
			left++;
			continue;
		}
		for (right = left + 1; right <= S.size(); right++)
		{
			if (!ATGC(S[right])) break;
		}
		max_length = std::max<int>(max_length, right - left);
		left = right;
	}
	return max_length;
}

int zentansaku(const string& S)
{
	int max_length = 0;
	for (size_t left = 0; left < S.size(); left++)
	{
		for (size_t right = left + 1; right <= S.size(); right++)
		{
			if (allATGC(S, left, right))
			{
				max_length = std::max<int>(max_length, right - left);
			}
		}
	}
	return max_length;
}

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

	std::cout << syakutori(S);
//	std::cout << std::endl;
//	std::cout << zentansaku(S);
}

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

int main(){
	int t,n;
	for(int i=0;i<4;i++){
		cin>>t>>n;
		switch(t){
			case 1:
				cout<<6000*n<<endl;
				break;
			case 2:
				cout<<4000*n<<endl;
				break;
			case 3:
				cout<<3000*n<<endl;
				break;
			case 4:
				cout<<2000*n<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3088
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int[] a=new int[3];
        for(int i=0;i<3;i++){
            a[i]=scan.nextInt();
        }
        for(int i=0;i<3;i++){
            for(int j=i+1;j<3;j++){
                if(a[i]>a[j]){
                    int tmp=a[j];
                    a[j]=a[i];
                    a[i]=tmp;
                }
            }
        }
        System.out.println(a[0]+" "+a[1]+" "+a[2]);
    }
}


Measured memory_bytes: 26176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	map<int,int> cnt;
	rep(i,n){
		int d;
		cin>>d;
		cnt[d]++;
	}
	bool flag=true;
	int m;
	cin>>m;
	rep(i,m){
		int t;
		cin>>t;
		if(cnt[t]){
			cnt[t]--;
		}else{
			flag=false;
		}
	}
	if(flag) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 9600
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);++i)
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
using namespace std;
typedef long long int LL;
typedef map<int, int> MII;
typedef vector<int> VI;
 
int main(){
  int N, K;
  cin >> N >> K;
  MII m;
  REP(i, N) {
    int A;
    cin >> A;
    m[A]++;
  }
  VI c;
  for(auto i=m.begin(); i!=m.end(); ++i) {
    c.push_back(i->second);
  }
  sort(c.begin(), c.end());
  int ret = 0;
  int csize = c.size();
  for(int i=0; i<csize-K; ++i) {
    ret += c[i];
  }
  cout << ret << endl;
}

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

int main(){
    int N,X,Y;
    cin >> N >> X >> Y;
    vector<int> d(N);
    int dis, dis1, dis2;
    
    X = X - 1;
    Y = Y - 1;
    for ( int i = 0; i < N-1; ++i){
        for ( int j = i+1; j < N; ++j){
            dis1 = j - i;
            dis2 = abs( X - i ) + abs ( Y - j ) + 1;
            dis = min(dis1,dis2);
            d.at(dis - 1) = d.at(dis - 1) + 1;
            //cout << i << j << dis << endl;
        }
    }
    for ( int i = 0; i < N-1; ++i){
        cout << d.at(i) << endl;
    }
    
    
    
    return 0;
}


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

long lcd(long a, long b) {
  if (a < b) {
    swap(a, b);
  }
  long x = a * b;
  long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}

int main() {
  long N, M;
  cin >> N >> M;
  string S, T;
  cin >> S >> T;
  long L =lcd(N, M);
  map<long, char> X;
  for (long i = 0; i < N; i++) {
    X[i*L/N] = S[i];
  }
  for (long i = 0; i < M; i++) {
    if (X.count(i*L/M) != 0 && X[i*L/M] != T[i]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << L << endl;
}

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

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

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

int read(){
	int a = 0; char c = getchar();
	while(!isdigit(c)) c = getchar();
	while(isdigit(c)){a = a * 10 + c - 48; c = getchar();}
	return a;
}

#define PII pair < int , int >
const int _ = 1e5 + 7 , MOD = 1e9 + 7;
int arr[_] , x[_] , y[_] , N , M;
vector < PII > dist; vector < int > lsh;

void inc(int &a , int b){a = a + b >= MOD ? a + b - MOD : a + b;}

namespace BIT{
	int arr[_];
#define lowbit(x) ((x) & -(x))
	void add(int x , int val){while(x <= N + 1){inc(arr[x] , val); x += lowbit(x);}}
	int qry(int x){int sum = 0; while(x){inc(sum , arr[x]); x -= lowbit(x);} return sum;}
}

int main(){
	N = read(); M = read();
	for(int i = 1 ; i <= N ; ++i) x[i] = read();
	for(int i = 1 ; i <= M ; ++i) y[i] = read();
	int pos = 0;
	for(int i = 1 ; i <= N ; ++i){
		while(pos < M && y[pos + 1] < x[i]) ++pos;
		if(pos && pos < M){
			dist.push_back(PII(y[pos + 1] - x[i] , x[i] - y[pos]));
			lsh.push_back(x[i] - y[pos]);
		}
	}
	sort(lsh.begin() , lsh.end()); lsh.resize(unique(lsh.begin() , lsh.end()) - lsh.begin());
	for(auto &t : dist) t.second = lower_bound(lsh.begin() , lsh.end() , t.second) - lsh.begin() + 1;
	sort(dist.begin() , dist.end() , [&](PII x , PII y){return x.first < y.first || x.first == y.first && x.second > y.second;});
	dist.resize(unique(dist.begin() , dist.end()) - dist.begin());

	BIT::add(1 , 1); for(auto t : dist) BIT::add(t.second + 1 , BIT::qry(t.second));
	cout << BIT::qry(N + 1) << endl; return 0;
}

Measured memory_bytes: 2804
#include<iostream>
#include<vector>
#include<set>
using namespace std;
 
int main(){
  int n, m, maxi = 0;
  std::cin >> n >> m;
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    std::cin >> x[i];
    maxi = max(maxi, x[i]);
  }
  vector<int> mod(m, 0);
  for (int i = 0; i < n; i++) {
    mod[x[i]%m]++;
  }
  int ans = 0, tmp;
 
  for (int i = 1; 2*i <= m; i++) {
    if(2*i == m){
      tmp = mod[m/2]/2;
      ans += tmp;
      mod[m/2] -= tmp*2;
    }else{
      tmp = min(mod[i], mod[m - i]);
      ans += tmp;
      mod[i] -= tmp;
      mod[m - i] -= tmp;
    }
  }
  tmp = mod[0]/2;
  ans += tmp;
  mod[0] -= tmp*2;
  vector<int> s(maxi, 0);
  for (int i = 0; i < n; i++) {
    s[x[i]]++;
    if(s[x[i]] >= 2 and mod[x[i]%m] >= 2){
      s[x[i]] -= 2;
      mod[x[i]%m] -= 2;
      ans++;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 1408
import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;


public class Main {
	 static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !st.hasMoreTokens()) 
	            { 
	                try
	                { 
	                    st = new StringTokenizer(br.readLine()); 
	                } 
	                catch (IOException  e) 
	                { 
	                    e.printStackTrace(); 
	                } 
	            } 
	            return st.nextToken();
	            
	        } 
	  
	        int nextInt() 
	        { 
	            return Integer.parseInt(next()); 
	        } 
	  
	        long nextLong() 
	        { 
	            return Long.parseLong(next()); 
	        } 
	  
	        double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
	  
	        String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    }

	 static int gcd(int a , int b) {
		 if(b==0)return a;
		 return gcd(b,a%b);
	 }

	/**
	 * @param args
	 * @throws IOException
	 */
	 static int m =(int) (1e9+7);
	 static long mod(long x) {
		 
		 return ((x%m+m)%m);
	 }
	 static long add(long x,long y) {
		 return mod((mod(x)+mod(y)));
	 }
	 static long mul(long x,long y) {
		 return mod((mod(x)*mod(y)));
	 }
	 
	public static void main(String[] args)throws IOException  {
		FastReader s=new FastReader();		
		int n = s.nextInt();
		int[] ar = new int[n];
		int[] t = new int[n];
		for(int i=0;i<n;i++) {
			ar[i]=s.nextInt();
			t[i]=ar[i];
		}
		
		Arrays.sort(t);
		int max1 = t[n-1];
		int max2 =t[n-2];
		
		int k=n-1;
		for(int i=0;i<n;i++) {
			if(ar[i]==max1)System.out.println(max2);
			else System.out.println(max1);
		}
		
	}
}
	



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

int main(){
  int n,m,ans=0;
  cin>>n;
  cin>>m;
  if(n>1){
    ans = ans + ((n*(n-1))/2);
  }
  if(m>1){
    ans = ans + ((m*(m-1))/2);
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define lli long long int
#define pii pair<int,int>
#define ppi pair<pii,pii>
#define forn(i, n) for(int i=0;i<n;i++)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define fi first
#define se second
#define endl '\n'

using namespace std;

const int MAXN = 1000001;

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	lli k,a,b;
	cin>>k>>a>>b;

	if(b <= a + 2 || k <= a) {
		cout<<k + 1<<endl;
		return 0;
	}

	lli ans = a + abs(b - a);
	k -= a + 1;

	ans += (k / 2) * abs(b - a);
	if(k & 1) ans++;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	sl := make([]int, n)
	for i, _ := range sl {
		fmt.Scan(&sl[i])
	}

	var a, b int
	sort.Sort(sort.Reverse(sort.IntSlice(sl)))
	for i, s := range sl {
		if i%2 == 0 {
			a += s
		} else {
			b += s
		}
	}

	fmt.Println(a - b)
}


Measured memory_bytes: 512
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int N;
    cin >> N;
    int e[101] = {};
    FOR(i, 2, N + 1, 1) {
        int n = i;
        FOR(j, 2, i + 1, 1) {
            while (n % j == 0) {
                e[j]++;
                n /= j;
            }
        }
    }
    int res = 0;
    FOR(i, 2, 101, 1) {
        if (e[i] >= 74) {
            res++;
        }
        FOR(j, 2, 101, 1) {
            if (i == j) {
                continue;
            }
            if (e[i] >= 2 && e[j] >= 24) {
                res++;
            }
            if (e[i] >= 4 && e[j] >= 14) {
                res++;
            }
            FOR(k, j + 1, 101, 1) {
                if (k == i || k == j) {
                    continue;
                } else if (e[i] >= 2 && e[j] >= 4 && e[k] >= 4) {
                    res++;
                }
            }
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//スペルミスに注意
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//関係性は隣接行列で記録
//過半数：N/2.0で判定
//ある量からある量を引く系の問題：端から定義してやる
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}


//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1)) % M;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}


int main() {
	double N; ll P; cin >> N >> P;

	double num = pow(P, 1 / N);
	ll C = ceil(num);
	for (ll n = C; n >= 1; n--) {
		ll x = pow(n, N);
		if (P%x == 0) {
			cout << n << endl;
			return 0;
		}
	}
}

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

#define ll long long
#define FOR(k,a,b) for(ll k=(a); k < (b); k++)
#define FORE(k,a,b) for(ll k=(a); k <= (b); k++)
#define REP(k,a) for(ll k=0; k < (a); k++)

ll mod = 1e9+7;
int main()
{
   ll n,m;
   cin >> n >> m;
   ll arr[n+1];
   FORE(i,0,n+1)
   	arr[i] = 0;
   REP(i,m)
   	{
   		int x;
   		cin >> x;
   		arr[x] = -1;
   	}

   arr[0] = 1;
   if(arr[1]==0)
      arr[1] = 1;

   FORE(i,2,n)
   {
      if(arr[i]==-1)
         continue;

      if(arr[i-1]!=-1)
         (arr[i]+=arr[i-1])%=mod;

      if(arr[i-2]!=-1)
         (arr[i]+=arr[i-2])%=mod;
   }

   cout<<arr[n]%mod;
   cout << endl;
   return 0;
}
 

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

int main(){
	
	string str;
	cin >> str ;
	map <char , int> m;
	for(int i=0;i<4;i++) m[str[i]]++;
	for( auto it = m.begin();it!= m.end();it++){
		if(it->second !=2){
			cout << "No" ;
			return 0;
		}

	}
	cout << "Yes";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb(a) push_back(a);
#define all(a) begin(a),end(a)
#define sz(a) a.size()
#define len(a) a.length()
using namespace std;
vector<vector<int>>dp;
int solve(int i,int j,vector<int>arr1,vector<int>arr2)
{
    if(i<0 || j<0) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    if( abs(arr1[i]-arr2[j]) <= 1 )
    dp[i][j]= 1+solve(i-1,j-1,arr1,arr2);
    else dp[i][j]= max(solve(i,j-1,arr1,arr2),solve(i-1,j,arr1,arr2));
    return dp[i][j];
}
void solveA()
{
    ll a,b,k;
    cin>>k>>a>>b;
    for(ll i=a;i<=b;i++)
    if(i%k==0)
    {
        cout<<"OK";
        return;
    }
    cout<<"NG";
}
void solveB()
{
    ll a;
    cin>>a;
    ll ans=1;
    ll x=100;
    ll i;
    for(i=1;i<=3760;i++)
    {
        x=x*1.01;
        if(x>=a)
            break;
    }
    cout<<i;
    
}
int main() {
    solveB();
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <random>
using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  vector <string> a(H);
  for (int i = 0; i < H; i++) {
	  cin >> a[i];
	}
  vector <int> r;
  vector <int> c;
  for (int i = 0; i < H; i++) {
	  bool flag = false;
	  for (int j = 0; j < W; j++) {
		  if (a[i][j] == '#') {
			  flag = true;
			  break;
			}
		}
	  if (flag) {
		  r.push_back(i);
		}
	}
  for (int j = 0; j < W; j++) {
	  bool flag = false;
	  for (int i = 0; i < H; i++) {
		  if (a[i][j] == '#') {
			  flag = true;
			  break;
			}
		}
	  if (flag) {
		  c.push_back(j);
		}
	}
  for (auto itr1 = r.begin(); itr1 != r.end(); itr1++) {
	  for (auto itr2 = c.begin(); itr2 != c.end(); itr2++) {
		  cout << a[*itr1][*itr2];
		}
	  cout << endl;
	}
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iostream>

using namespace std;

int main( void ){

    
    int64_t a, b;
    uint64_t v, w, t;

    cin >> a >> v;

    cin >> b >> w;
    cin >> t;

    string strYes("YES");
    string strNo( "NO" );

    uint64_t dis = abs( b - a );
    int64_t vdis = v - w;


    bool yes = false;

    if ( vdis > 0 )
    {
        if ( vdis*t >= dis )
        {
            yes = true;
        }
    }

    if( t == 0 && dis == 0 )
    {
        yes = true;
    }

    if ( yes )
        cout << strYes;
    else
        cout << strNo;

    return 0;
}

Measured memory_bytes: 3128
N, M = map(int, input().split())
penalty = 0
answers = 0
mydict  = {}
for i in range(M):
    tmp1,tmp2 = input().split()
    if tmp1 in mydict.keys():
        if mydict[tmp1][0] == "WA" and tmp2 == "WA":
            mydict[tmp1][1] = mydict[tmp1][1] + 1
        elif mydict[tmp1][0] == "WA" and tmp2 == "AC":
            penalty = penalty + mydict[tmp1][1] 
            mydict[tmp1][0] = tmp2
            answers = answers + 1
        else:
            continue 
    else:
        mydict[tmp1] = [tmp2,0] #keyの登録["判定",不正回数]
        if tmp2 == "WA":
            mydict[tmp1][1] = mydict[tmp1][1] + 1
        else:
            answers = answers + 1
    #print(mydict)
print(answers,end=" ")
print(penalty)

Measured memory_bytes: 30156
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int INF = 1e9 + 5;

int main() {
    int n,k;
    cin>>n>>k;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
    {
        cin>>h[i];
    }
    vector<int> dp(n,INF);
    dp[0] = 0;
    for(int i=0;i<n;i++){
        for(int j=i+1; j <= i+k;j++){
            if(j<n){
                dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]));
            }
        }
    }
    cout<< dp[n-1]<<endl;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll rep_pow(ll a, ll b){//繰り返し2乗法
    if(b==0) return 1;
    else if(b%2==0){
        ll memo = rep_pow(a, b/2);
        return memo*memo%mod;
    }else{
        return rep_pow(a, b-1)*a%mod;
    }
}

ll nCr(ll n, ll r){//mod逆元使ったnCr
    ll ret=1;
    rep(i,r){
        ret *= n-i;//分子
        ret %= mod;
        ret *=rep_pow(r-i, mod-2);//mod逆元によりr!で割ると同値
        ret %= mod;
    }
    return ret;
}
ll gcd(ll a, ll b){ if(b==0) return a; return gcd(b, a%b);}

int main(){
    fast_io

    int n;
    cin>>n;
    int A[20];
    int x[20][20];
    int y[20][20];
    
    for(int i=1;i<=n;i++){
        cin>>A[i];
        for(int j=1;j<=A[i];j++){
            cin>>x[i][j]>>y[i][j];
        }
    }
    int ans=0;
    for(int bits=1;bits<(1<<n);bits++){
        bool ok=true;
        bitset<18> bs(bits);
        for(int i=1;i<=n;i++){
            if(!bs[i-1])continue;
            for(int j=1;j<=A[i];j++){
                if((bs[x[i][j]-1])^y[i][j]) ok=false;
            }
        }
        if(ok) ans=max(ans, (int)bs.count());
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
const int inf = 2e9;
const int maxn = 2e5 + 7;
int n, k;
int edge, fir[maxn], go[maxn], nex[maxn];
int l[maxn], r[maxn], bo[maxn];
int v[maxn];
int ans[maxn];
inline void Ins(int x, int y)
{
	nex[++edge] = fir[x];
	fir[x] = edge;
	go[edge] = y;
}
inline int Get()
{
	char c;
	bool o = false;
	while(!isdigit(c = getchar()))
		if(c == '-')
			o = true;
	int x = c - '0';
	while(isdigit(c = getchar()))
		x = x * 10 + c - '0';
	return (o) ? -x : x;
}
void Dfsone(int u, int f)
{
	bool bu = false, bv = false;
	for(int i = fir[u]; i; i = nex[i])
	{
		int v = go[i];
		if(v != f)
		{
			Dfsone(v, u);
			if(bo[v] == 1) bu = true;
			if(bo[v] == 2) bv = true;
			if(bu && bv)
			{
				puts("No");
				exit(0);
			}
			l[u] = max(l[u], l[v] - 1);
			r[u] = min(r[u], r[v] + 1);
			if(l[u] > r[u])
			{
				puts("No");
				exit(0);
			}
		}
	}
	if(bu) bo[u] = 2;
	if(bv) bo[u] = 1;
	if(v[u] != -inf - 1)
	{
		if(v[u] & 1)
		{
			if(!bo[u]) bo[u] = 1;
			if(bo[u] != 1)
			{
				puts("No");
				exit(0);
			}
		}
		else
		{
			if(!bo[u]) bo[u] = 2;
			if(bo[u] != 2)
			{
				puts("No");
				exit(0);
			}
		}
		if(v[u] < l[u] || r[u] < v[u])
		{
			puts("No");
			exit(0);
		}
		l[u] = r[u] = v[u];
	}
}
void Dfstwo(int u, int f)
{
	if(ans[f] % 2 == 0 && bo[u] == 2)
	{
		puts("No");
		exit(0);
	}
	if(ans[f] % 2 && bo[u] == 1)
	{
		puts("No");
		exit(0);
	}
	if(l[u] <= ans[f] + 1 && ans[f] + 1 <= r[u]) ans[u] = ans[f] + 1;
	if(l[u] <= ans[f] - 1 && ans[f] - 1 <= r[u]) ans[u] = ans[f] - 1;
	for(int i = fir[u]; i; i = nex[i])
	{
		int v = go[i];
		if(v != f)
			Dfstwo(v, u);
	}
}
int main()
{
	n = Get();
	for(int i = 1; i < n; ++i)
	{
		int x = Get(), y = Get();
		Ins(x, y), Ins(y, x);
	}
	k = Get();
	for(int i = 1; i <= n; ++i) v[i] = -inf - 1;
	for(int i = 1; i <= k; ++i)
	{
		int x = Get();
		v[x] = Get();
	}
	for(int i = 0; i <= n; ++i) l[i] = -inf, r[i] = inf;
	Dfsone(1, 0);
	ans[0] = l[1] + 1;
	Dfstwo(1, 0);
	printf("Yes\n");
	for(int i = 1; i <= n; ++i) printf("%d\n", ans[i]);
}

Measured memory_bytes: 13952
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)

int main() {
  int N;
  long long X, Y;
  cin>>N>>X>>Y;
  vector<long long> a(N,0);
  REP(i,N) cin>>a[i];

  long long ans1 = abs(a[N-1] - Y);
  if(N == 1) cout << ans1 << endl;
  else {
    long long ans2 = abs(a[N-2] - a[N-1]);
    cout << max(ans1, ans2) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    cout << min(a+b, min(b+c, a+c)) << "\n";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long ll;
const int INF=1e9+7;

ll dp[110000];

int main()
{
    ll N,W;
    cin >> N >> W;
    for(int i=0; i<=100007; i++)
        dp[i]=INF;
    for(int i=0; i<N; i++)
    {
        ll x,y;
        cin >> x >> y;
        for(int j=100005; j>=0; j--)
        {
            if(dp[j] != 0)
                dp[j+y]=min(dp[j+y], dp[j]+x);
        }
        dp[y]=min(dp[y], x);
    }
    ll wynik=0;
    for(int i=0; i<=100000; i++)
        if(dp[i] <= W && dp[i] != 0)
            wynik=i;
    cout << wynik;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>
int main(void){
  char s[111],t[111],u[111];
  int n,m,k,i,j,d[110],jd[110]={0};
  scanf("%d%d",&n,&k);
  for(i=0;i<k;i++){
    scanf("%d",&d[i]);
    jd[d[i]]=1;
  }
  for(i=n;i<=10*n;i++){
    int j=i;
    while(j>0){
      if(jd[j%10]) break;
      j/=10;
    }
    if(j<=0){
      printf("%d\n",i);
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 128