akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
    int x[204], y[204];

int b[204];
int s = 0, t;

int cnt = -1, head[10004], nxt[200005], to[200005], w[200005], dep[10004];

void add(int u, int v, int ww) {
    nxt[++cnt] = head[u];
    head[u] = cnt;
    to[cnt] = v;
    w[cnt] = ww;
    return;
}



bool bfs() {
    queue<int> q;
    while (!q.empty()) {
        q.pop();
    }
    memset(dep, 0, sizeof(dep));
    //cout << dep[t];
    dep[s] = 1;
    //cout << dep[t];
    //cout << s << "<-> " << t << endl;
    
    q.push(s);
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for(int i = head[u]; i != -1; i = nxt[i]) {
            if ((w[i] > 0) && (dep[to[i]] == 0)) {
                dep[to[i]] = dep[u] + 1;
                q.push(to[i]);
                //cout << u << " " << to[i] << " " << w[i] << endl;
            }
        }
    }
    if (dep[t] == 0) {
        return 0;
    }
    //cout << dep[t];
    return 1;
}

int dfs(int u, int d) {
    if (u == t) {
        return d;
    }
    
    for (int i = head[u]; i != -1; i = nxt[i]) {
        if ((dep[to[i]] == dep[u] + 1) && (w[i] != 0)) {
            int di = dfs(to[i], min(d, w[i]));
            //cout << u << " " << to[i] << " " << w[i] << endl;
            //cout << di << endl;
            if (di > 0) {
                w[i] -= di;
                w[i ^ 1] += di;
                return di;
            }
        }
    }
    return 0;
}

int mw() {
    int maxx = 0;
    for (int i = head[s]; i != -1; i = nxt[i]) {
        maxx = max(w[i], maxx);
    }
    return maxx;
}

int dinic() {
    int ans = 0;
    while (bfs()) {
        while (int d = dfs(s, 10000)) {
            ans += d;
           // cout << d;
        }
    } 
    return ans;
}
int main() {
    int N;
    scanf("%d", &N);
    t = N * 2 + 1;
    for (int i = 0; i <= N * 2 + 1; ++i) {
        head[i] = -1;
    }
    for (int i = 1; i <= N * 2; ++i) {
		cin >> x[i] >> y[i];
    }
    for (int i = 1; i <= N; ++i) {
    	add(s, i, 1);
    	add(i, s, 0);
    	add(i + N, t, 1);
    	add(t, i + N, 0);
		for (int j = N + 1; j <= 2 * N; ++j) {
			if (x[i] < x[j] && y[i] < y[j])	 {
				add(i, j, 1);
				add(j, i, 0);
			}
		}
	}
	int res = dinic();
    printf("%d", res);
    return 0;
}

Measured memory_bytes: 384
//#pragma warning(disable : 4996)
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<fstream>
#include<stdio.h>
#include<map>
#include<set>
#include<limits.h>
#include<list>
#include <cassert>
#include<sstream>
#include <bitset>
#include<unordered_map>
using namespace std;
using ll = long long int;
using uint = unsigned int;

int main() {
	unordered_map<int, int> can[2];
	unordered_map<int, int>& lcan = can[0], &rcan = can[1];
	int N;
	int m[2] = { 0 };
	int mX[2] = { 0 };
	int c, ans, & lm = m[0], & rm = m[1], &lml=mX[0], &rmr=mX[1];
	cin >> N;

	for (int i = 0; i < N; ++i) {
		cin >> c;
		if (i & 1)
			++lcan[c];
		else
			++rcan[c];
	}
	for (auto l : lcan)
		if (l.second > lm)
			lm = l.second, lml = l.first;
	for (auto r : rcan)
		if (r.second > rm)
			rm = r.second, rmr = r.first;
	if (lml != rmr) ans = N - lm - rm;
	else 
	{// / \同处理
		int index_min = bool(m[0] > m[1]);
		int index_max = 1 - index_min;
		int actual_m[2] = { 0 };
		for (auto it : can[index_min])
			if (it.first != mX[index_min] && it.second > actual_m[index_min])
				actual_m[index_min] = it.second;
		for (auto it : can[index_max])
			if (it.first != mX[index_max] && it.second > actual_m[index_max])
				actual_m[index_max] = it.second;

		ans = N - max(m[index_max] + actual_m[index_min], m[index_min] + actual_m[index_max]);
	}
	
	cout << ans;
	return 0;
} 





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

int main(void)
{
    int n;
    int freq[6];
    double height;
    int i, j;
    int index;
    
    memset(freq, 0, sizeof(freq));
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++){
        scanf("%lf", &height);
        if (height < 165.0){
            freq[0]++;
        }
        else if (height >= 185.0){
            freq[5]++;
        }
        else {
            index = (height - 165.0) / 5.0;
            freq[index + 1]++;
        }
    }

    for (i = 0; i < 6; i++){
        printf("%d:", i + 1);
        for (j = 0; j < freq[i]; j++){
            printf("*");
        }
        printf("\n");
    }
    
    return (0);
}

Measured memory_bytes: 0
import math
A,B,H,M=map(int,input().split())

hun=6*M
ji=30*H+(1/2)*M

if math.radians(hun-ji)==0:
    a=abs(A-B)
elif hun-ji==180 or ji-hun==180:
    a=A+B
else:
    a = (A ** 2 + B ** 2 - 2* A * B * math.cos(math.radians(hun-ji))) ** (1 / 2)
print(a)

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

int main() {
  
  int num;
  cin >> num;
  
  if(num<=111){cout << "111";}
  if(112<=num && num<=222){cout << "222";}
  if(223<=num && num<=333){cout << "333";}
  if(334<=num && num<=444){cout << "444";}
  if(445<=num && num<=555){cout << "555";}
  if(556<=num && num<=666){cout << "666";}
  if(667<=num && num<=777){cout << "777";}
  if(778<=num && num<=888){cout << "888";}
  if(889<=num && num<=999){cout << "999";}
  
  
}


Measured memory_bytes: 256
from collections import deque


dh = [-1, 0, 1, 0]
dw = [0, 1, 0, -1]


H, W = map(int, input().split())
G = [input() for _ in range(H)]


def count_black():
    res = 0
    for i in range(H):
        for j in range(W):
            if G[i][j] == '#':
                res += 1
    return res


def minimum_step():
    dist = [[0] * W for _ in range(H)]
    dist[0][0] = 1
    que = deque([[0, 0]])

    while que:
        h, w = que.popleft()
        for i in range(4):
            nh = h + dh[i]
            nw = w + dw[i]
            if nh < 0 or nw < 0 or nh >= H or nw >= W:
                continue
            if G[nh][nw] == '#':
                continue
            if dist[nh][nw]:
                continue
            dist[nh][nw] = dist[h][w] + 1
            que.append([nh, nw])
    return dist[H - 1][W - 1]


def main():
    step = minimum_step()
    print(H * W - step - count_black() if step else -1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 73908
N = gets.to_i
ary = []
si = -1
N.times do |i|
    ary << gets.split(" ").map(&:to_i)
    si = i if ary[i][2] != 0
end
flag = false

101.times do |i|
    101.times do |j|
        h = ary[si][2] + (i - ary[si][0]).abs + (j - ary[si][1]).abs
        N.times do |k|
            break if ary[k][2] == 0 && h > (i - ary[k][0]).abs + (j - ary[k][1]).abs
            break if ary[k][2] != 0 && h - ary[k][2] != (i - ary[k][0]).abs + (j - ary[k][1]).abs
            if k == N - 1
                puts [i, j, h].join(" ")
                flag = true
            end
        end
        break if flag == true
    end
    break if flag == true
end





Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int n,m,f[100005],ans,a[100005],mid,b[100005],c[100005];
long long num;
void add(int x,int y){
	for(;x<=m;x+=x&-x)f[x]+=y;
}
int ask(int x){
	int sum=0;
	for(;x;x-=x&-x)sum+=f[x];
	return sum;
}
long long calc(){
    long long sum=0;
    b[0]=0;
	memset(f,0,sizeof(f));
    for(int i=1;i<=n;i++){
		b[i]=b[i-1]+(a[i]<=mid?1:-1);
		c[i]=b[i];
	}
	m=n+1;
    c[m]=0;
	sort(c+1,c+m+1);
	m=unique(c+1,c+m+1)-(c+1);
    for(int i=0;i<=n;i++)b[i]=lower_bound(c+1,c+m+1,b[i])-c;
    add(b[0],1);
    for(int i=1;i<=n;i++){
		sum+=(long long)ask(b[i]-1);
		add(b[i],1);
	}
	return sum;
}
int main(){
    scanf("%d",&n);
	num=n*(long long)(n+1)>>1;
	num=(num>>1)+1;
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    int L=1,R=1e9;
    while(L<=R){
        mid=L+R>>1;
        if(calc()>=num){
			ans=mid;
			R=mid-1;
        }
		else L=mid+1;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 5360
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  ll N;
  cin >> N;
  vector<ll> vec(N);
  vector<ll> vecR(N);
  ll sum = 0;
  rep(i, N) {
    cin >> vec.at(i);
    vecR.at(i) = vec.at(i);
    sum += vec.at(i);
  }
  sort(vec.begin(), vec.end());
  sort(vecR.begin(), vecR.end());
  reverse(vecR.begin(), vecR.end());
  ll A, B, C, D;
  A = B = C = D = 0;
  ll X, Y;
  X = Y = 0;
  if(N % 2 == 0) {
    rep(i, N/2) {
      A += vec.at(i);
      B += vecR.at(i);
    }
    cout << B * 2 - A * 2 - vec.at(N/2) + vecR.at(N/2) << endl;
  }
  else {
    rep(i, N/2) {
      A += vecR.at(i+N/2); 
      B += vecR.at(i);
    }
    rep2(i, N/2, N/2+2) {
      X += vec.at(i);
      Y += vecR.at(i);
    }
    rep(i, N/2) {
      C += vec.at(i+N/2);  
      D += vec.at(i);       
    }
    cout << max(B * 2 - (sum - B) * 2 + Y, (sum - D) * 2 - X - 2 * D) << endl;
  }
}


Measured memory_bytes: 4828
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int dp[10010];
int main()
{
    int n;
    int w[100];
    cin>>n;
    REP(i,n)cin>>w[i];
    int allsu=0;
    REP(i,n)allsu+=w[i];
    int ans=allsu;
    int su=0;
    REP(i,n){
        su+=w[i];
        ans=min(ans,abs(allsu-su*2));
    }
    cout<<ans<<endl;
    
}


Measured memory_bytes: 256
A, B, C, X, Y = map(int, input().split())

D = C * 2
p = []

if X > Y:
    p.append(D * Y + A * (X - Y))
else:
    p.append(D * X + B * (Y - X))

p.append(A * X + B * Y)
p.append(D * max(X, Y))

ans = min(p)

print(ans)


Measured memory_bytes: 3060
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define IGNORE cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');

const ll INF = (1LL << 58);

#ifdef BUGGY
	bool DEBUG = 1;
#endif
#ifndef BUGGY
	bool DEBUG = 0;
#endif

string S;

int main()
{
	cin >> S;

	int l = 0, r = S.size() - 1;

	bool hasAns = 1; int ans = 0;

	while(l < r) {
		if(S[l] == S[r]) {
			l++;
			r--;
		} else if(S[l] == 'x') {
			l++;
			ans++;
		} else if(S[r] == 'x') {
			r--;
			ans++;
		} else {
			hasAns = 0;
			break;
		}
	}

	if(hasAns) {
		cout << ans;
	} else {
		cout << -1;
	}

	return 0;
}
/*
	Powered by Buggy Plugin
*/

Measured memory_bytes: 512
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>

using namespace std;
int main(){
   int n;
   double a;
   cin>>n;

   if(n%2==0)
    a=n/2;
   else
    a=n/2+1;
    cout<<a/n<<endl;
}


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

int main(void) {
    int N;
    cin>>N;
    set<string> w;
    string before;
    for (int i = 0; i < N; i++) {
        string s;
        cin>>s;
        if (w.find(s) != w.end()) {
            cout << "No" << endl;
            return 0;
        }
        if (i > 0 && s[0] != before[before.size() - 1]) {
            cout << "No" << endl;
            return 0;
        }
        w.insert(s);
        before = s;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
C = []
for i in range(H):
    C.append(input())

ans = []

for i in range(2*H):
    row = ''
    for j in range(W):
        row += C[i//2][j]
    ans.append(row)

for i in range(2*H):
    print(ans[i])

Measured memory_bytes: 3060
#include <stdio.h>

int main() {
    int a, b, c;
    int s[101] = { 0 };
    int cnt = 0;

    scanf("%d %d %d", &a, &b, &c);

    s[a]++;
    s[b]++;
    s[c]++;

    for (int i = 0; i < 101; i++) {
        if (s[i] > 0) {
            cnt++;
        }
    }

    printf("%d\n", cnt);
    return 0;
}


Measured memory_bytes: 128
N=int(input())
rw=list(input())
s=len(rw)
i=0
j=s-1
count=0

while i<j:
  while (j>=0 and rw[j]=='W'):
        j-=1
  while (i<=s-1 and rw[i]=='R'):
        i+=1
  if i>=j:
    break
  if rw[i]=='W' and rw[j]=='R':
      rw[i]='R'
      rw[j]='W'
      count+=1
  i+=1
  j-=1

j=s-1
while (rw[j]=='W' and j>=0):
      j-=1
i=0 
while (i<j):
  if (rw[i]=='W'):
      count+=1
  i+=1

print(count)
  

Measured memory_bytes: 10748
class Unionfind():  # Unionfind
    def __init__(self, N):
        self.N = N
        self.parents = [-1] * N

    def find(self, x):  # グループの根
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):  # グループの併合
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):  # グループのサイズ
        return - self.parents[self.find(x)]


n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

uf = Unionfind(n)
ans, cnt = [], n * (n - 1) // 2
for a, b in ab[::-1]:
    a, b = a - 1, b - 1
    ans.append(max(cnt, 0))
    if uf.find(a) != uf.find(b):
        cnt -= uf.size(a) * uf.size(b)
        uf.union(a, b)
print(*ans[::-1], sep='\n')


Measured memory_bytes: 101684
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod

#include <bits/stdc++.h>
using namespace std;
signed main(){
    int N; cin>>N;
    vec Time(5);
    REP(i,5) cin>>Time[i];
    int bottle = 0;
    REP(i,5){
        bottle = max(bottle,(N-1)/Time[i]);
    }
    Out(bottle+5);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define ull unsigned long long int
#define boost ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0)
#define vi vector<int>
#define P push_back
#define F first
#define S second
#define debug(x) cout<<x<<" "
#define pi vector<pair<int,int> >
#define FOR(i,x,n) for(int i=x;i<n;i++)
#define all(a) a.begin(),a.end()
ll mod=1e9+7;
#define N 99999999
//#define int ll
using namespace std;
#define int ll
signed main(){
    boost;
    int n;
    cin>>n;
    vi v(n);
    double sum=0;
    int odd=0;
    for(int i=0;i<n;i++){cin>>v[i];}
    sort(all(v));
    sum=v[0];
    for(int i=1;i<n;i++){
        sum+=v[i];
        sum/=2;
    }
    //cout<<sum;
    printf("%.10F",sum);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
int n = 0;
int main(void){
    int a, b, c, d;
    int cnt;
    while(std::cin >> n){
        cnt = 0;
        for(a=0; a<=9; ++a) for(b=0; b<=9; ++b) for(c=0; c<=9; ++c) for(d=0; d<=9; ++d) if(a+b+c+d == n) cnt++;
        std::cout << cnt << std::endl;
    }
}

Measured memory_bytes: 2996
#include<stdio.h>

int main()

{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a==b){
		printf("%d",c);
	}
	else if(a==c){
		printf("%d",b);
	}
	else {
		printf("%d",a);
	}



	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String s = sc.next();

		if(solve(s)) {
			System.out.println("AC");
		} else {
			System.out.println("WA");
		}
    }

	public static boolean solve(String s) {
		if(s.charAt(0) != 'A') return false;
		int a = 0;
		int index = 0;
		for(int i = 2; i < s.length() - 1; i++) {
			if(s.charAt(i) == 'C') {
				if(a != 0) return false;
				a++;
				index = i;
			}
		}
		if(a != 1) return false;
		for(int i = 1; i < s.length(); i++) {
			if(i == index) continue;
			if(Character.isUpperCase(s.charAt(i))) return false;
		}
		return true;
	}
}


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

// #define int ll
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n) for (int i = 0; i < n; i++)
#define dotc()    int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)     (int)x.size()
#define eb        emplace_back
#define pb        push_back
#define mp        make_pair
#define all(x)    x.begin(), x.end()
#define rall(x)   x.rbegin(), x.rend()
#define fi        first
#define se        second

ll mod(1000000007);
double pi(acos(-1.0));

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#endif

  ll a, b, n;
  cin >> a >> b >> n;

  ll x = min(n, b - 1);
  cout << a * x / b - a * (x / b);

  return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Count ABC
            int N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            int n = N - S.Replace("ABC", "").Length;
            Console.WriteLine(n / 3);
        }
    }
}

Measured memory_bytes: 11092
#line 1 "../../library/template.cpp"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define per(i, n) for(ll i = n-1; i >= 0; i--)
#define all(v) begin(v), end(v)
template<class T, class U>
inline void cmax(T& a, U b) { if (a < b) a = b; }
template<class T, class U>
inline void cmin(T& a, U b) { if (a > b) a = b; }

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
  }
} io_setup;
#line 2 "a2.cpp"

int main() {
  string s;
  cin >> s;
  if (s == "AAA" or s == "BBB") {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}


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

#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof(a))

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

int main() {
	int x;
	scanf("%d", &x);
	int divs = x / 500;
	int mods = x % 500;
	int divs1 = mods / 5;
	printf("%d\n", divs*1000 + divs1*5);
	return 0;
}

Measured memory_bytes: 256
public class Main {
    public static void main(String[] arg){
        int a = 1;
        int b = 1;
        
        for(int i = 0; a < 10 && b < 10; i++){
            System.out.println(a + "x" + b + "=" + (a*b));
            b++;
            if(b == 9 && a < 10) {
                System.out.println(a + "x" + b + "=" + (a*b));
                b = 1;
                a += 1;
            }
        }

    }
}

Measured memory_bytes: 24084
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <functional>
using namespace std;

typedef long long ll;

int main() {
	int cnt = 0;
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		cnt += a & 1;
	}
	if (cnt & 1) cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <string>
#include <algorithm>
#include <cassert>

using namespace std;

int main()
{
	string s;

	cin >> s;
	int c0 = count(s.cbegin(), s.cend(), '0');
	int c1 = count(s.cbegin(), s.cend(), '1');

	cout << 2 * min(c0, c1) << endl;

}



Measured memory_bytes: 512
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
//Using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> Ordered_set;

#define ll              long long
#define int             long long
#define ld             long double
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vi>
#define vip            vector<pii>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define lb(x)           (x&(-x))
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define itr(it,v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fir(i,k,n)       for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ff               first 
#define ss               second
#define deb(x) cout << #x << "=" << x << endl
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define check(x) (x && cout<<"Yes\n")||(cout<<"No\n");
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);

const ld pi = 3.141592653589793238462643383279502884;
const int xd[]={-1,0,1,0};
const int yd[]={0,-1,0,1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0,  1, -1, 1, -1, 0, 1 };

int expo(int a,int b,int m);
int mmi(int a,int m);
void ipgraph(int m);

const int N=5*(1e5)+10;
vii adj(N);
int a[N];

void  solve(){

}
int32_t main()
{
    FIO
    string s,t; cin>>s>>t;
    int maxz=t.length();
    for(int i=0;i<=s.length()-t.length();i++){
        int cnt=0;

        for(int j=0;j<t.length();j++){
            if(s[i+j]!=t[j]) cnt++;    
        }
        maxz=min(maxz,cnt);
    }
    cout<<maxz<<"\n";
    return 0;

}

void ipgraph(int m){
    int i, u, v;
    while(m--){
          cin>>u>>v;
         u--, v--;
    adj[u].pb(v);
    adj[v].pb(u);
    }
}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}


Measured memory_bytes: 15020
/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)(s))
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)(s))
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
/* }}} */

int main(){
  string s;
  int k;
  cin >> s >> k;
  rep(i, s.size()){
    if (s[i] != 'a' && 'z' - s[i] + 1 <= k){
      k -= 'z' - s[i] + 1;
      s[i] = 'a';
    }
  }
  s.back() = 'a' + (s.back() - 'a' + k) % 26;
  cout << s << endl;
}


Measured memory_bytes: 592
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int



using namespace std;

int main(){
    int N,K;cin>>N>>K;
    string s; cin>>s;
    if(s[K-1] == 'A') s[K-1] = 'a';
       if(s[K-1] == 'B') s[K-1] = 'b';
          if(s[K-1] == 'C') s[K-1] = 'c';
          cout<<s<<endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
#include <algorithm>
using namespace std;
int main(){

  int n;
  vector <tuple <int,int,string,long long,string>> a;
  cin>>n;
  for(int i=0;i<n;i++){
    int v,w;
    string t,s;
    long long d;
    cin>>v>>w>>t>>d>>s;
    a.push_back(make_tuple(v,w,t,d,s));
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++) cout<<get<0>(a[i])<<" "<<get<1>(a[i])<<" "<<get<2>(a[i])<<" "<<get<3>(a[i])<<" "<<get<4>(a[i])<<endl;
}



Measured memory_bytes: 16888
# (x + y + z) ** 2 == n + xy + yz + zx\

ans = [0] * 10010
n = int(input())

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            value = x*x + y*y + z*z + x*y + y*z + z*x
            if value <= n:
                ans[value] += 1

for i in range(1, n+1):
    print(ans[i])

Measured memory_bytes: 9168
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

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

int main() {
	int n, m;
	cin >> n >> m;

	vector<int> t(m);
	rep(i, m) cin >> t[i];

	int cnt[105];
	memset(cnt, 0, sizeof(cnt));

	rep(i, m) {
		int res = 0, x;
		rep(j, n) {
			cin >> x;
			if(x == t[i]) cnt[j]++;
			else res++;
		}

		cnt[t[i]-1] += res;
	}

	rep(i, n) {
		cout << cnt[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1200
#include<cstdio>
int main(void){
	int a[1000010];
	long long k;
	int n;
	long long s;
	int t;
	long long x;
	long long y;
	long long z;
	s = 0;
	k = 0;
x=0;
y=0;
	z = 0;
	scanf("%d %lld %lld", &n, &x,&y);
	for (int i = 0; i < n; i++)a[i] = 0;
	for (int i = 0; i < n; i++)scanf("%d", &a[i]);
	s = 0;
	for (int i = 0; i < n-1; i++){
		z = a[i + 1] - a[i];
		k = x*z;
		if (k > y)s = s + y;
		else s = s + k;
	}
	printf("%lld\n", s);
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a,b;
  cin >> a >> b;
  int key = 0;
  string c = b;
  for(int i = 0;i<a.size();i++){
    if(a == b){
      cout << "Yes" << endl;
      key = 1;
      break;
    }
    char tmp = a.at(a.size()-1);
    c.at(0) = tmp;
    for(int i = 1;i<a.size();i++){
      c.at(i) = a.at(i-1);
    }
    a = c;
  }
  if(key == 0){
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void) {
	int R = 0, B = 0, W = 0, G = 0,Z;
	scanf("%d %d %d %d", &R, &B , &W , &G);
	Z = R + B + W + G;
	printf("%d\n", Z);
	return 0;
}


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

using namespace std;
using ll = long long;

struct Combination {
    vector<int64_t> fact, rfact;
	const int64_t MOD = 1000000007;

    Combination(int sz) : fact(sz + 1), rfact(sz + 1) {
        fact[0] = 1;
        for(int i = 1; i < fact.size(); i++){
            fact[i] = fact[i - 1] * i % MOD;
        }
        rfact[sz] = inv(fact[sz]);
        for(int i = sz - 1; i >= 0; i--){
            rfact[i] = rfact[i + 1] * (i + 1) % MOD;
        }
    }
    int64_t inv(int x) const {
        return pow(x, MOD - 2);
    }
    int64_t pow(int64_t x, int64_t n) const {
        int64_t ret = 1;
        while (n > 0) {
            if (n & 1) { (ret *= x) %= MOD; }
            (x *= x) %= MOD;
            n >>= 1;
        }
        return (ret);
    }

    int64_t P(int n, int r) const {
        if (r < 0 || n < r) { return 0; }
        return (fact[n] * rfact[n - r] % MOD);
    }

    int64_t C(int p, int q) const {
        if (q < 0 || p < q) { return 0; }
        return (fact[p] * rfact[q] % MOD * rfact[p - q] % MOD);
    }

    int64_t H(int n, int r) const {
        if (n < 0 || r < 0) { return 0; }
        return (r == 0 ? 1 : C(n + r - 1, r));
    }
};

ll calc(ll n) { return (n * (n + 1) / 2) % 1000000007; }

int main() {
	const ll MOD = 1e9 + 7;
	ll N, M, K;
	cin >> N >> M >> K;

	Combination comb(N * M);
	ll res = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < M; ++j) {
			ll cost = (calc(N - i - 1) * M + calc(j) * (N - i - 1) + calc(M - j - 1) * (N - i)) % MOD;
			(res += (cost * comb.C(N * M - 2, K - 2)) % MOD) %= MOD;
		}
	}
	cout << res % MOD << endl;

	return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define test ll t=1;  while(t--)
typedef long long int ll;
typedef long double lx;
int main() {
    FIO;
    test{
        ll n;
        cin>>n;
        lx p[n];
        for(ll i=0;i<n;i++){
            cin>>p[i];
        }
        lx dp[n+1][n+1];
        for(ll i=0;i<=n;i++){
            for(ll j=0;j<=n;j++){
                dp[i][j]=0.0;
            }
        }
        dp[0][0]=1.0;
        for(ll i=1;i<=n;i++){
            for(ll j=0;j<n;j++){
                dp[i][j+1]+=(dp[i-1][j]*p[i-1]);
                dp[i][j]+=(dp[i-1][j]*(1-p[i-1]));
            }
        }
        lx ans=0;
        for(ll i=(n+1)/2;i<=n;i++){
            ans+=dp[n][i];
        }
        cout<<fixed<<setprecision(12)<<ans<<endl;
    }
	return 0;
}


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

int main(){
    int n,l;cin>>n>>l;
    int x[n],q=0,ans=0;
    for(int i=0;i<n;i++){
        x[i]=l+i;
        
    }
    
        if(l>0)    q=l;
        else if(l<0&&x[n-1]<0)    q=x[n-1];

    for(int i=0;i<n;i++){
        ans+=x[i];
        if(x[i]==0)q=x[i];
    }
    ans-=q;
    
cout << ans << endl;

}



Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1e-8

int y[111];

int main(){
	while(1){
		int n,q;
		cin>>n>>q;
		if(n==0)return 0;
		memset(y,0,sizeof(y));
		REP(i,n){int m;
			cin>>m;
			REP(j,m){
				int d;
				cin>>d;
				y[d]++;
			}
		}
		int idx=0;
		q--;
		REP(i, 111){
			if(y[i]>q){
				idx = i;
				q=y[i];
			}
		}
		cout << idx << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int ans;
    int c[499];//次の駅まで何秒か
    int s[499];//初電
    int f[499];//間隔
    cin>>n;
    for(int i=0;i<n-1;i++)cin>>c[i]>>s[i]>>f[i];
    for(int i=0;i<n;i++){
        ans=0;
        for(int j=i;j<n-1;j++){
            if(s[j]>ans)ans=s[j];
            else if(ans%f[j])ans+=f[j]-(ans%f[j]);
            ans+=c[j];
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

def main():
    H,W = map(int,input().split())
    graph = [[""]*W for _ in range(H)]

    for h in range(H):
        graph[h] = list(input())

    left = [[1]*W for _ in range(H)]
    for h in range(H):
        for w in range(W):
            if graph[h][w] == "#":
                left[h][w] = 0
            else:
                if w-1 >= 0:
                    left[h][w] = left[h][w-1] + 1

    right = [[1]*W for _ in range(H)]
    for h in range(H):
        for w in reversed(range(W)):
            if graph[h][w] == "#":
                right[h][w] = 0
            else:
                if w+1<W:
                    right[h][w] = right[h][w+1] + 1

    down = [[1]*W for _ in range(H)]
    for h in range(H):
        for w in range(W):
            if graph[h][w] == "#":
                down[h][w] = 0
            else:
                if h-1>=0:
                    down[h][w] = down[h-1][w] + 1

    up = [[1]*W for _ in range(H)]
    for h in reversed(range(H)):
        for w in range(W):
            if graph[h][w] == "#":
                up[h][w] = 0
            else:
                if h+1<H:
                    up[h][w] = up[h+1][w] + 1

    ans = 0
    for h in range(H):
        for w in range(W):
            ans = max(ans,up[h][w] + down[h][w] + left[h][w] + right[h][w] - 3)


    print(ans)
    # print(up,"\n",down,"\n",left,"\n",right)
    # print(down)

if __name__ == "__main__":
  main()


Measured memory_bytes: 306952
#include <bits/stdc++.h>
using namespace std;
int a[10001];
int main(){
	int i,flag=0,l;
	char c[1000010];
	scanf("%s",c); l=strlen(c);
	for (i=0;i<l;i++){
		if(c[i]=='C')flag=1;
		if(flag && c[i]=='F'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl; 
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
  #define int long long int
    #define endl "\n"
    #define MOD 1000000007
    #define mod 1000000007
    #define M 1000000007
    
    #define pb push_back
    #define take(a,b,c) for(int b=0;b<c;b++) cin>>a[b]
  //  #define mp make_pair
  #define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);  
  #define mx 400005
  #define fiint(a,b) memset(a,b,sizeof(a))  
  #define bitcount __builtin_popcount
  #define fori(i,a,b) for(int i=a;i<b;i++)
  #define ford(i,a,b) for(int i=a;i>=b;i--)
  #define debug(x) cout<<x<<endl;
  #define cases(t) int t; cin>>t; while(t--)
  #define inf1 INT_MAX
  #define all(a) a.begin(),a.end()
  #define vec vector<int>
  #define pii pair<int,int>
  #define plii pair<int,int>
  #define pint pair<int,int>
  #define ff first
  #define ss second
  #define lb lower_bound
  #define ub upper_bound
  #define bs binary_search
  #define sz(x) (int)x.size()
#define PI                    3.14159265359

bool prime[10000001];

void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}

void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}

void sub_self(int& a, int b) {
    a -= b;
    if(a < 0) {
        a += mod;
    }
}

signed  main() 
{ 
	int n;cin>>n;
	int mat[n][n];
	fori(i,0,n)
		fori(j,0,n)
			cin>>mat[i][j];
	vec dp(1<<n);
	dp[0]=1;
	
		for(int mask = 0  ;mask <(1<<n) ;mask++)
		{
			int a = __builtin_popcount(mask);
			fori(b,0,n)
			{
				if(mat[a][b] && !((1<<b) & mask)  )
				{
					int n_mask = (1<<b) ^ mask;
					 add_self( dp[n_mask],dp[mask] );

				}
			}
		}	
	cout<<dp[(1<<n)-1]<<endl;		
}

 


Measured memory_bytes: 16768
N, X = map(int, input().split())
l_list = list(map(int,input().split()))

d = 0
cnt = 1
for i,l in enumerate(l_list):
    d += l

    if d > X:
        break
    cnt += 1
#     if i == N-1:
#         if d <= X:
#             cnt += 1
    
print(cnt)

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

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

    ll ans = 0;
    if (n % 2 == 1)
    {
        ans = 0;
    }
    else
    {
        vll cnt(100, 0);
        vll cycle(100, 0);

        ll i = 1;
        ll tmpCycle = 10;
        while (tmpCycle <= n)
        {
            cnt[i] = cnt[i - 1] * 5 + 1;
            cycle[i] = tmpCycle;
            //cout << "debug(1):" << i << "," << cnt[i] << "," << cycle[i] << endl;
            i++;
            tmpCycle *= 5;
        }

        i--;
        while (i > 0)
        {
            while (cycle[i] <= n)
            {
                //cout << "debug(2):" << i << "," << n << "," << cycle[i] << endl;
                ans += cnt[i];
                n -= cycle[i];
            }
            i--;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int cnt=0;
  char a[4][4];
  for(int i=0;i<2;i++){
    for(int j=0;j<3;j++){
      cin>>a[i][j];
    }
  }
  for(int i=0;i<2;i++){
    for(int j=0;j<3;j++){
      if(a[i][j]==a[2-i-1][3-j-1])cnt++;
    }
  }
  if(cnt==6)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <string>

using namespace std;

long long dp[(int) (1e5+1)];
long long nums[(int) (1e4+1)];

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

    int k;
    cin >> k;

    vector<int> steps;
    for (int i = 1; i <= k; i++)
        steps.push_back(i);

    int nums[stones];
    for (int i = 0; i < stones; i++) {
        cin >> nums[i];

        dp[i + 1] = INT_MAX;
    }

    dp[0] = 0;
    for (int i = 0; i < stones; i++) {
        for (int j : steps) {
            if (j < stones) {
                dp[j + i] = min(dp[j + i], abs(nums[i] - nums[j + i]) + dp[i]);
            }
        }
    }

    cout << dp[stones - 1];

    return 0;
}


Measured memory_bytes: 4804
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;

int main(){
    int n;
    int b[110];
    int a[110];
    cin >> n;
    for(int i = 0; i < n-1; i++) cin >> b[i];
    for(int i = 0; i < n-1; i++){
        if(i == 0){
            a[0] = b[0];
            a[1] = b[0];
        }
        else{
            if(a[i] > b[i]){
                a[i] = b[i];
                a[i+1] = b[i];
            }
            else a[i+1] = b[i];
        }
    }
    int total = 0;
    for(int i = 0; i < n; i++) total += a[i];
    cout << total << endl;
}

Measured memory_bytes: 256
//  main.cpp
//  abc79
//
//  Created by 洞井僚太 on 2017/11/18.
//  Copyright © 2017年 洞井僚太. All rights reserved.
//

#include <stdio.h>
#include<iostream>
#include <string.h>
#include<algorithm>
#include<stdlib.h>
using namespace std;
long long int DP[10000];
bool chack[10000];
long long int lucas(int a){
    if(chack[a]){
        return DP[a];
    }
    if(a==0){
        return 2;
    }
    if(a==1){
        return 1;
    }
    long long int ent;
    ent=lucas(a-1)+lucas(a-2);
    DP[a]=ent;
   // printf("%llu %llu\n",ent,DP[a]);
    chack[a]=true;
    return ent;
}
int main(void) {
  /*  int count=0,len;
    char n[100000];
    cin >>n;
    len=(int)strlen(n);
    for(int i=0;i<len+1;i++){
        if(count==2){
            printf("Yes\n");break;
        }
        if(n[i]==n[i-1]){
            count+=1;
        }
        else{
            count=0;
        }
        if(i+1==len+1){
            printf("No\n");
        }
    }
    long long int ans;
    int n;
    cin >>n;
    ans=lucas(n);
    cout<<ans<<endl;*/
    int a[2]={1,-1},b[2]={1,-1},c[3]={1,-1},inte[4],q,w,e,r,ans,che=0;
    char moj[4];
    for(int i=0;i<4;i++){
        cin>>moj[i];
        inte[i]=(int)moj[i]-'0';
    }
   // sort(inte,inte+4);
    q=inte[0];
    w=inte[1];
    e=inte[2];
    r=inte[3];
    for(int i=0;i<2;i++){
        for(int j=0;j<2;j++){
            for(int k=0;k<2;k++){
                ans=q+w*a[i]+e*b[j]+r*c[k];
                if(ans==7){
                    che=1;
                    for(int v=0;v<4;v++){
                        cout <<inte[v];
                        if(v==3){
                            cout<<"=7"<<endl;break;
                        }
                        if(a[i]==1&&v==0){
                            cout<<"+";
                        }
                        if(a[i]==-1&&v==0){
                            cout<<"-";
                        }
                        if(b[j]==1&&v==1){
                            cout<<"+";
                        }
                        if(b[j]==-1&&v==1){
                            cout<<"-";
                        }
                        if(c[k]==1&&v==2){
                            cout<<"+";
                        }
                        if(c[k]==-1&&v==2){
                            cout<<"-";
                        }
                        }
                    
                    }
                if(che==1){
                    break;
                }
            }
                if(che==1){
                    break;
            }
        }
        if(che==1){
            break;
    }
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int minn(int a,int b)
{
    if(a<b)
        return a;
    return b;
}
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    printf("%d\n",minn(minn(a+b,b+c),a+c));
    return 0;
}


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using namespace std;

int main()
{
    int h , w, kk;
    cin >> h >> w >> kk;

    vector<string> data(h);

    rep(i, h) {
        cin >> data.at(i);
    }

    ll res = 0;
    for (int i = 0; i < (1<<h); ++i) {
        vector<int> s1;
        for (int j = 0; j < h; ++j) {
            if (i & (1<<j)) {
                s1.push_back(j);
            }
        }
        for (int k = 0; k < (1<<w); ++k) {
            vector<int> s2;
            for (int l = 0; l < w; ++l) {
                if (k & (1<<l)) {
                    s2.push_back(l);
                }
            }
            int sum = 0;
            for (int gyou = 0; gyou < h; ++gyou) {
                if (find(s1.begin(), s1.end(), gyou) != s1.end() ) {
                    continue;
                }
                for (int retsu = 0; retsu < w; ++retsu) {
                    if (find(s2.begin(), s2.end(), retsu) != s2.end() ) {
                        continue;
                    }
                    if (data.at(gyou).at(retsu) == '#') {
                        ++sum;
                    }
                }
            }
            if (sum == kk) {
                ++res;
            }
        }

    }
    cout << res << endl;
    return 0;
}


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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

const int N = 1e6 + 10;

int n;

char s[N], t[N];

int q[N];

int main()
{
	int l = 1, r = 0;
	gi(n);
	scanf("%s", s + 1);
	scanf("%s", t + 1);
	if (!strcmp(s + 1, t + 1))
	{
		puts("0");
		return 0;
	}
	int ans = 0, cnt = 0;
	for (int i = n, j = n; i; --i)
	{
		if (t[i] == t[i - 1]);
		else
		{
			j = min(j, i);
			while (j && t[i] != s[j]) --j;
			if (!j) return puts("-1"), 0;
			while (l <= r)
			{
				if (q[l] - (r - l) > i) ++l;
				else break;
			}
			q[++r] = j;
			if (i != j) ans = max(ans, r - l + 1);
		}
	}
	printf("%d\n", ++ans);
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  if (S == "Sunny") {
    cout << "Cloudy" <<endl;
  }
  else if (S == "Cloudy") {
    cout << "Rainy" <<endl;
  }
  else {
    cout << "Sunny" <<endl;
  }
  
}


Measured memory_bytes: 256
"use strict";

const main = arg => {
    // 標準入力の不要な空白と改行を削除し、配列に格納する
    const input = arg.trim().split("\n");
    const strngs = input[0].split(" ");
    const A = Math.floor(input[1].split(" ")[0], 10);
    const B = Math.floor(input[1].split(" ")[1], 10);
    const U = input[2];

    if ( U === strngs[0]) {
        console.log((A - 1), B);
    } else {
        console.log(A, (B - 1));
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 21064
import functools
n = input()

x = [int(x) for x in input().split()]
ans = functools.reduce(lambda a,b: a +(b-0)**2, x, 0)
for i in range(min(x),max(x)+1):
    t = functools.reduce(lambda a,b: a +(b-i)**2, x, 0)
    ans  = min(ans, t)
print(ans)

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define ll long long
string s,s1;
int k;
int main()
{
   cin>>k>>s;
   if(s.size()<=k) cout<<s;
   else
      {
      	  s1=s.substr(0,k)+"...";
      	  cout<<s1;
	  }


return 0;
}


Measured memory_bytes: 3628