akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
    char s[3][3];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> s[i][j];
        }
    }
    for(int i = 0; i < 3; i++){
        cout << s[i][i];
    }
    cout << endl;
    return 0;
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007
#define MAXN 200
#define MAXDSIT 20000000

typedef long long ll;

using namespace std;

void makeFuctorial(vector<int> p, vector<int> f, vector<vector<int>> *fAll)
{
    if (p.size() != 0)
    {
        for (int i = 0; i < p.size(); ++i)
        {
            int num = p[i];
            f.push_back(num);
            vector<int> q;
            q = p;
            auto itr = q.begin();
            q.erase(itr + i);
            makeFuctorial(q, f, fAll);
            f.pop_back();
        }
    }
    else
    {
        (*fAll).push_back(f);
        return;
    }
    
}

void WarshallFloyd(int n, int dist[MAXN][MAXN])
{
    for (int k = 0; k < n; ++k)
    {
        for (int i = 0; i < n; ++i)
        {
            for (int j = 0; j < n; ++j)
            {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
}

int main()
{
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R, 0);
    REP(i, R)
    {
        cin >> r[i];
        r[i]--;
    }

    // 無向グラフの距離行列
    int dist[MAXN][MAXN];
    REP(i, N)
    {
        REP(j, N)
        {
            dist[i][j] = MAXDSIT; 
        }
    }
    REP(i, N)
    {
        dist[i][i] = 0;
    }
    REP(i, M)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        dist[a][b] = c;
        dist[b][a] = c;
    }

    // 頂点間の最短距離を計算
    WarshallFloyd(N, dist);
    
    vector<int> f;
    vector<vector<int>> fAll;
    // r の順列を作成
    makeFuctorial(r, f, &fAll);

    int ans = INT_MAX;
    // すべての経路を探索
    REP(i, fAll.size())
    {
        int distance = 0;
        int prev = fAll[i][0];
        for (int j = 1; j < R; ++j)
        {
            int now = fAll[i][j];
            distance += dist[prev][now];
            prev = now; 
        }
        ans = min(ans, distance);
    }

    cout << ans << endl;
}


Measured memory_bytes: 3512
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

//#define DEBUG

int N, M;
vector <int> safe;
vector <int> solution;
bool impossible;

int main()
{
    scanf("%d%d", &N, &M);
    for (int i = 0; i <= N; i++)
    {
        char temp; scanf(" %c", &temp);
        if (temp == '0') safe.push_back(i);
    }

    #ifdef DEBUG
    printf("Safe places:\n");
    for (int safePlaces : safe)
    {
        printf("%d ", safePlaces);
    }
    printf("\n");
    #endif // DEBUG

    int cur = N; impossible = false;
    while (cur != 0 && !impossible)
    {
        int furthestSafe = *lower_bound(safe.begin(), safe.end(), cur - M);
        if (furthestSafe == cur) impossible = true;
        #ifdef DEBUG
        printf("Current: %d; Furthest safe: %d\n", cur, furthestSafe);
        #endif // DEBUG

        solution.push_back(cur - furthestSafe);
        cur = furthestSafe;
    }
    if (impossible)
    {
        printf("-1");
    }
    else
    {
        for (int i = solution.size() - 1; i >= 0; i--)
        {
            printf("%d ", solution[i]);
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 1400
#include <stdio.h>
#include <limits.h>

#define LB(X,L) \
  ( (X) > (L) ? (X) : (L) )

static
const int stage[ ] = { 4, 1, 4, 1, 2, 1, 2, 1 };
#define STAGE(X) \
  ( stage[ ( (X) + 0 ) % 8 ] * 390625 \
  + stage[ ( (X) + 1 ) % 8 ] * 78125 \
  + stage[ ( (X) + 2 ) % 8 ] * 15625 \
  + stage[ ( (X) + 3 ) % 8 ] * 3125 \
  + stage[ ( (X) + 4 ) % 8 ] * 625 \
  + stage[ ( (X) + 5 ) % 8 ] * 25 \
  + stage[ ( (X) + 6 ) % 8 ] * 5 \
  + stage[ ( (X) + 7 ) % 8 ] * 1 )

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int b[ 8 ];
  int i, j;

  while ( scanf ( "%d%d%d%d%d%d%d%d"
                , b, b + 1, b + 2, b + 3, b + 4
                , b + 5, b + 6, b + 7 ) == 8 )
  {
    int res = 0;
    int min = INT_MAX;
    int mii = INT_MAX;

    for ( j = 0; j < 8; ++j )
    {
      int t = 0;

      for ( i = 0; i < 8; ++i )
      {
        t += LB( b[ i ] - stage[ ( j + i ) % 8 ], 0 );
      }

      if ( ( t < min )
        || ( t == min && STAGE( j ) < mii ) )
      {
        res = j;
        min = t;
        mii = STAGE( res );
      }
    }

    for ( i = 0; i < 8; ++i )
    {
      if ( i )  putchar ( ' ' );
      printf ( "%d", stage[ ( res + i ) % 8 ] );
    }
    puts ( "" );
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include <cstdio>
#include <utility>
#include <vector>
static const int MAXN = 2e6 + 3;
static const int MAXM = 2e6 + 3;    // ◡ ヽ(`Д´)ﾉ ┻━┻ 
static const int MAXC = 1e6 + 2;
static const int INF = 0x3fffffff;

int n, m;
std::vector<std::pair<int, int>> c[MAXC];

int ey_sz;
std::vector<int> ex[MAXN], ey[MAXN + MAXM];

int bfs_ct = 0;
int vis[MAXN] = { 0 };
inline void bfs_renew() { bfs_ct++; }
inline void bfs_x(int u)
{
    if (vis[u] == bfs_ct) return;

    static int q[MAXN], qhead, qtail;
    qhead = 0, qtail = 1;
    vis[u] = bfs_ct; q[0] = u;

    while (qhead < qtail) {
        u = q[qhead++];
        for (int v : ex[u]) if (vis[v] != bfs_ct) {
            vis[v] = bfs_ct; q[qtail++] = v;
        }
    }

    //for (int i = 0; i < qtail; ++i) printf(" %d", q[i]); putchar('\n');
    int idx = ey_sz++;
    for (int i = 0; i < qtail; ++i) {
        ey[q[i]].push_back(idx);
        ey[idx].push_back(q[i]);
    }
}

int dist[MAXN + MAXM];
inline void bfs_y(int u)
{
    for (int i = 0; i < ey_sz; ++i) dist[i] = INF;
    static int q[MAXN + MAXM], qhead, qtail;
    qhead = 0, qtail = 1;
    vis[u] = bfs_ct; q[0] = u; dist[u] = 0;

    while (qhead < qtail) {
        u = q[qhead++];
        for (int v : ey[u]) if (vis[v] != bfs_ct) {
            vis[v] = bfs_ct; q[qtail++] = v; dist[v] = dist[u] + 1;
        }
    }
}

int main()
{
    scanf("%d%d", &n, &m);
    int u, v, w;
    for (int i = 0; i < m; ++i) {
        scanf("%d%d%d", &u, &v, &w); --u, --v, --w;
        c[w].push_back(std::make_pair(u, v));
    }

    std::vector<int> verts;
    ey_sz = n;
    for (int i = 0; i < MAXC; ++i) if (!c[i].empty()) {
        for (auto e : c[i]) {
            ex[e.first].push_back(e.second);
            ex[e.second].push_back(e.first);
            verts.push_back(e.first);
            verts.push_back(e.second);
        }
        bfs_renew();
        for (int u : verts) bfs_x(u);
        for (int u : verts) ex[u].clear();
        verts.clear();
    }

    bfs_renew();
    bfs_y(0);
    printf("%d\n", dist[n - 1] == INF ? -1 : dist[n - 1] / 2);

    return 0;
}


Measured memory_bytes: 194176
s = gets.upcase.strip.to_s

a_index = nil
z_index = nil

s.length.times do |i|
    if a_index.nil? && s[i] == "A"
        a_index = i
    elsif s[i] == "Z" && !a_index.nil?
        z_index = i 
    end   
end

puts z_index - a_index + 1

Measured memory_bytes: 14852
#include<stdio.h>

int main(){
  int x,y,z;
  scanf("%d%d",&x,&y);
  while(1){
    z = x % y;
    x = y;
    y = z;
   
    if (z == 0)break;
  }
  printf("%d\n",x);
  return 0;
}

Measured memory_bytes: 592
#include <cstdlib>
#include <iostream>

using namespace std;

static const int MAX = 100;

class StackS
{
public:
    int current;
    int *vec;

    class PushErr
    {
    };
    class PopErr
    {
    };
    StackS() : current(0), vec(new int[MAX]) {
    }

    ~StackS() { delete[] vec; }

    void push(int value)
    {
        if (current == MAX)
            throw PushErr();
        vec[current++] = value;
    }

    int pop()
    {
        if (current == 0)
            throw PopErr();
        return vec[--current];
    }
};

int main()
{
    StackS s;
    char c[10];
    int a, b;

    while (scanf("%s", c) != EOF)
    {
        //if(c[0] == 'e') break;
        if(c[0] == '+'){
            a = s.pop();
            b = s.pop();
            s.push(a + b);
        }
        else if(c[0] == '-'){
            a = s.pop();
            b = s.pop();
            s.push(b - a);
        }
        else if(c[0] == '*'){
            a = s.pop();
            b = s.pop();
            s.push(a * b);
        }
        else{
            s.push(atoi(c));
        }
    }

    printf("%d\n", s.pop());
}


Measured memory_bytes: 3228
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

ll n,a,b;
vector<ll> h;

bool ch(ll x){
  ll cnt = 0;
  rep(i,n){
    ll at = h[i] - b * x; //h[i]からbをx回引く
    
    //もしそれでもまだライフが残っていたら、aで残りライフを0以下に出来る回数を数える
    if(at > 0) cnt += (at + a - 1) / a;
    if(cnt > x) return false; //cntがxを超えたら実行不可
  }
  return true; //cntがxを超えなければ実行可能
}

int main(){
  cin >> n >> a >> b;
  a -= b;
  
  rep(i,n){
    ll tmp; cin >> tmp;
    h.push_back(tmp);
  }
  
  sort(h.begin(),h.end(),greater<ll>());
  
  ll l = 0, r = 1000000005, now = 0;
  while(r > l){
    now = (r + l) / 2;
    if(r - l <= 1){ //rとlの差が1以内なら
      if(ch(l)) now = l; //lで実行可能ならlを入れる
      else if(ch(r)) now = r; //rが実行可能ならrを入れる
      else now = r + 1; //両方だめならrに1を足す
      break;
    }else if(ch(now)) r = now;
    else l = now;
  }
  
  cout << now << endl;
    
  return 0;
}

Measured memory_bytes: 1400
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
	long long H,W;
	scanf("%lld%lld",&H,&W);
	if(H!=1&&W!=1)
		printf("%lld\n",(1ll*H*W+1)/2);
	else
		printf("1\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

const int INF = 100000000;

int w, h, dy[] = {-1, 0, 1, 0}, dx[] = {0, 1, 0, -1};
char data[20][20];

bool check(int y, int x){
  if(y<0 || y>=h) return false;
  if(x<0 || x>=w) return false;
  return true;
}

int dfs(int y, int x, int t){
  int res = INF;
  for(int i=0;i<4;i++){
    int ny = y + dy[i];
    int nx = x + dx[i];
    bool f = false;
    while(check(ny, nx)){
      if(data[ny][nx] == '3'){
        return t + 1;
      }
      if(data[ny][nx] == '1'){
        if(f){
          data[ny][nx] = '0';
          if(t < 9) res = min(res, dfs(ny - dy[i], nx - dx[i], t + 1));
          data[ny][nx] = '1';
        }
        break;
      }
      f = true;
      ny += dy[i];
      nx += dx[i];
    }
  }
  return res;
}

main(){
  while(cin >> w >> h && (w|h)){
    int sy, sx;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cin >> data[i][j];
        if(data[i][j] == '2'){
          data[i][j] = '0';
          sy = i;
          sx = j;
        }
      }
    }
    int ans = dfs(sy, sx, 0);
    cout << (ans == INF ? -1 : ans) << endl;
  }
}

Measured memory_bytes: 0
def solve():
    N = input()
    K = int(input())
    dp = [[[0]*(K+2) for i in range(2)] for j in range(len(N)+1)]
    dp[0][False][0] = 1

    for i in range(len(N)):
        for k in range(K+1):
            dp[i+1][True][k+1] += dp[i][True][k] * 9
            dp[i+1][True][k] += dp[i][True][k]

            if int(N[i]) > 0:
                dp[i+1][True][k+1] += dp[i][False][k] * (int(N[i]) - 1)
                dp[i+1][True][k] += dp[i][False][k]
            
            if int(N[i]) > 0:
                dp[i+1][False][k+1] = dp[i][0][k]
            else:
                dp[i+1][False][k] = dp[i][0][k]
    
    print(dp[-1][False][K] + dp[-1][True][K])

if __name__ == '__main__':
    solve()

Measured memory_bytes: 38256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;

const long long maxn = 1000000007;
char s[100][100];

int main(){
	int n;
	long long sum = 1;
	scanf("%d",&n);
	for(int i = 1;i <= n;i++){
		scanf(" %c",&s[1][i]);
	}
	for(int i = 1;i <= n;i++){
		scanf(" %c",&s[2][i]);
	}
	int flag = 0,pos;
	if(s[1][1] == s[1][2]) flag = 1,pos = 3,sum = (sum * 6) % maxn;
	else if(s[1][1] = s[2][1]) flag = 0,pos = 2,sum = (sum * 3) % maxn;
	for(int i = pos;i <= n;i++){
		if(s[1][i] == s[1][i + 1]){
			if(flag == 0) sum = (sum * 2) % maxn;
			else sum = (sum * 3) % maxn;
			flag = 1;
			i++;
		}
		else{
			if(flag == 0) sum = (sum * 2) % maxn;
			flag = 0;
		}
	}
	printf("%lld",sum);
}

Measured memory_bytes: 256
#include <iostream>

typedef unsigned short ushort;

int main( void )
{
    ushort K;
    ushort A,B;
  
    std::cin >> K;
    std::cin >> A >> B;
  
    std::cout << ( A <= (B/K)*K ? "OK" : "NG" ) << std::endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<string>
#define INF 2434243
using namespace std;

int h=0;
void maxheap(int a[],int i){
int l,r,largest,ke;
	l=i*2;r=l+1;
	if(l<=h && a[l]>a[i])
	largest=l;
	else
	largest=i;
	if(r<=h&&a[r]>a[largest])
	largest=r;
	if(largest!=i){
	ke=a[i];
		a[i]=a[largest];
		a[largest]=ke;
		maxheap(a,largest);
	}
}

void aaa(int a[],int i,int k){
		
	int s;
	a[i]=k;
	while(i>1 && a[i/2]<a[i]){
	s=a[i/2];
		a[i/2]=a[i];
		a[i]=s;
		i/=2;
	}
}
void insert(int a[],int k){
	h++;
	a[h]=-INF;
	aaa(a,h,k);
}
int extractmax(int a[]){
int ke=a[1];
	a[1]=a[h];
	h--;
	maxheap(a,1);
	
	return ke;
}
main(){
	int key,a[INF];
	string s;
	while(1){
	cin>>s;
		if(s=="end")
		break;
		else if(s=="insert"){
			scanf("%d",&key);
			insert(a,key);
		}
		else 
			printf("%d\n",extractmax(a));
		
	}
	return 0;
}



Measured memory_bytes: 7100
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print() { cout << endl; }
template<typename Head,typename... Tail> void print(Head head,Tail... tail){cout<<head;if(sizeof...(Tail)>0)cout<<" ";print(tail...);}
void print0() {}
template<typename Head,typename... Tail> void print0(Head head,Tail... tail){cout<<head;print0(tail...);}
// clang-format on

int main() {
    ll N, X, M;
    cin >> N >> X >> M;
    vector<ll> exist(100003, -1);
    vector<ll> totals(100003, 0);
    ll iterate = 1;
    ll total = 0;
    ll a = X;
    bool loop_done = false;
    while (iterate <= N) {
        total = total + a;
        if (!loop_done) {
            if (exist[a] > 0) {
                ll loop_iter = iterate - exist[a];
                ll loop_sum = totals[iterate - 1] - totals[exist[a] - 1];
                ll loop_num = max(N / loop_iter - 3, 0L);
                total = total + loop_num * loop_sum;
                iterate = iterate + (loop_num * loop_iter);
                loop_done = true;
            } else {
                totals[iterate] = total;
                exist[a] = iterate;
            }
        }
        a = (a * a) % M;
        iterate++;
    }
    print(total);
}


Measured memory_bytes: 4812
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

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

	int count = 0;

	for (int i = a; i <= b; i++){
		if (i < 0) count++;
		if (i == 0){
			cout << "Zero" << endl;
			return 0;
		}
	}

	if (count % 2) cout << "Negative" << endl;
	else cout << "Positive" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin >> s;
    for(int i=0;i<s.size();i++){
        for(int j=0;j<s.size();j++){
            if(s[i]==s[j] && i!=j){
                cout << "no" << endl;
                return 0;
            }
        }
    }
    cout << "yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n, i, x, y;
	long int z;

	scanf("%d", &n);
	int a;

	z = 0;
	y = -1000000;
	x = 1000000;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &a);
		if (x > a)
		{
			x = a;
		}

		if (y < a)
		{
			y = a;
		}

		z = z + a;
	}
	printf("%d %d %ld\n", x, y, z);

	return 0;
}


Measured memory_bytes: 2748
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b' ');
    let t: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let mut ctv = vec![(0, 0); n];
    for i in 0..n {
        ctv[i].0 = read(&mut stdin_lock, &mut buf, b' ');
        ctv[i].1 = read(&mut stdin_lock, &mut buf, b'\n');
    }

    ctv.iter()
        .filter(|&&(_, t1)| t1 <= t)
        .map(|&(c, _)| c)
        .min()
        .map_or_else(|| println!("TLE"), |c| println!("{}", c));
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/

int main() {
	ll N; cin >> N;
	ll ans = 2, ans2 = 1,tmp;
	if (N == 1) cout << 1 << endl;
	else {
		for(int i = 2;i<=N;i++) {
			tmp = ans2;
			ans2 += ans;
			ans = tmp;
		}
		cout << ans2 << endl;
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        if(B % A == 0){
            System.out.println(A + B);
        } else {
            System.out.println(B - A);
        }
    }
}


Measured memory_bytes: 23764
#include <stdio.h>

int main()
{
    int n;
    scanf("%d",&n);
    int h[100000];
    for(int i=0;i<n;i++)
    scanf("%d",&h[i]);

    int min=1000000000;
    for(int i=n-1;i>=0;i--)
    {
        if(i+1==n) continue;
        else if(min>h[i+1]) min=h[i+1];
        // if(i+1==n) min=0;
        // printf("%d\n",min);
        if(min<h[i]-1)
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << endl
#define RETURN(x)    \
  cout << x << endl; \
  return 0
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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;
}

signed main() {
  init();
  string A, B, C;
  cin >> A >> B >> C;

  ll index_a = 1;
  ll index_b = 0;
  ll index_c = 0;
  char c = A[0];
  while (1) {
    if (c == 'a') {
      if (index_a == (ll)A.size()) {
        RETURN("A");
      }
      c = A[index_a];
      index_a++;
      continue;
    }
    if (c == 'b') {
      if (index_b == (ll)B.size()) {
        RETURN("B");
      }
      c = B[index_b];
      index_b++;
      continue;
    }
    if (c == 'c') {
      if (index_c == (ll)C.size()) {
        RETURN("C");
      }
      c = C[index_c];
      index_c++;
      continue;
    }
  }

  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#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++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;
	vector<int> v(n);
	rep(i, n) cin >> v[i];
	sort(all(v));
	int L = v.front(), R = v.back();
	ll min_v = INF;
	for (int i = L; i <= R; i++) {
		ll ans = 0;
		for (int x : v) {
			ans += (x - i) * (x - i);
		}
		chmin(min_v, ans);
	}
	cout << min_v << endl;
}


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

#define INF (2e9)
#define FOR(i, a, b) for (ll (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using namespace std;

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

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

using ll = long long;
using ld = long double;

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<ll>;
using vvi = vc<vi>;

template<class T>
using va = valarray<T>;
using vad = va<ld>;
using vai = va<ll>;

using pii = pair<ll, ll>;

vi Read(ll n) {
    auto      v = vi(n);
    for (auto i = std::size_t(0); i < n; ++i) {
        cin >> v[i];
    }
    return v;
}

template<class T>
void DumpRow(const T& A) {
    for (const auto& value : A)
        cout << value << "\n";
}

template<class T>
void DumpColumn(const T& A) {
    auto isFirst = true;
    for (const auto& value : A) {
        if (isFirst) {
            cout << value;
            isFirst = false;
        } else {
            cout << " " << value;
        }

    }
    cout << endl;
}

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

    ll n;
    cin >> n;
    auto v = Read(n);
    if (prev_permutation(ALL(v))) DumpColumn(v); // pre
    next_permutation(ALL(v));
    DumpColumn(v); // now
    if (next_permutation(ALL(v))) DumpColumn(v); // next
    return 0;
}



Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(void){
	int p,q;
	while(cin>>p>>q){
		vector<int> s;
		map<int,int> e;
		int a = p % q;
		int i = 0;
		int begin=0;
		e.insert(make_pair(a%q,i));
		a *= 10;
		while(++i){
			if(a%q!=0){//0で割り切れない時
				s.push_back(a/q);
				if(e.find(a%q)==e.end()){//過去に同じ余りがない時
					e.insert(make_pair(a%q,i));
					a %= q;
				}else{//過去に同じ余りがある時
					begin=(*(e.find(a%q))).second;
					for(int j=0;j<s.size();++j) cout<<s[j];
					cout<<"\n";
					for(int j=0;j<begin;++j) cout<<" ";
					for(int j=begin;j<i;++j) cout<<"^";
					cout<<"\n";
					break;
				}
			}else{//0で割り切れる時
					for(int j=0;j<s.size();++j) cout<<s[j];
					cout<<a/q<<"\n";
					break;
			}
			a *= 10;
		}
	}
	return 0;
}

Measured memory_bytes: 1224
fun main() = SimpleFastIO().exec {
    fun Int.pow(p: Int): Int {
        var x = 1
        for (i in 0 until p) x = Math.multiplyExact(x, this)
        return x
    }

    val a = readLine().toInt()

    val answer = a + a.pow(2) + a.pow(3)

    println(answer)
}

@Suppress("unused", "HasPlatformType")
class SimpleFastIO {
    private val br: java.io.BufferedReader = System.`in`.bufferedReader()
    private val sb: StringBuilder = StringBuilder()
    fun readLine() = br.readLine()!!
    fun println() = sb.appendln()
    fun print(any: Any) = sb.append(any)
    fun println(any: Any) = sb.appendln(any)
    fun <T> print(any: Iterable<T>, separator: String) = sb.append(any.joinToString(separator))
    fun <T> println(any: Iterable<T>, separator: String) = sb.appendln(any.joinToString(separator))
    fun exec(action: SimpleFastIO.() -> Unit) = run { action() }.run { kotlin.io.println(sb) }
}


Measured memory_bytes: 35680
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
//using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int dh[8] = {0, 0, 1, 1, 1, -1, -1, -1};
const int dw[8] = {1, -1, 0, 1, -1, 0, 1, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
using Edge = pair<int,int>;
using Graph = vector<vector<Edge>>;
Graph G;
  
/*------------------------------------------------------------------*/

int main(){
    string s; cin >> s;
    int k; cin >> k;
    int n = s.size();
    set<string> se;

    _rep(i, 1, 6){
        rep(j, n){
            if(j + i > n) continue;
            se.insert(s.substr(j, i));
        }
    }
    //for(auto it : se) cout << it << endl;
    auto it = se.begin();
    rep(i, k - 1) it++; 
    cout << *it << endl;
}

Measured memory_bytes: 1664
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney,chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun


#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")

int main() {
	int a;
	cin >> a;
	PRI(a * a * a);
	return 0;
}

Measured memory_bytes: 3632
import sys 

def A():
  n = int(sys.stdin.readline().rstrip())
  charge = (n+999)//1000 * 1000 - n
  print(charge)
  pass

from collections import Counter
def B():
  n, *s = sys.stdin.read().split() 
  c = Counter(s)
  for v in 'AC, WA, TLE, RE'.split(', '):
    print(f'{v} x {c[v]}')
  pass


def C():
  pass


def D():
  pass


def E():
  pass


def F():
  pass

if __name__ == "__main__":
  # A() 
  B()
  C()
  D()
  E()
  F()

Measured memory_bytes: 17476
#include <iostream>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
// long long -> lint
using lint = long long;
// fast cin and cout from hitonanode-san's code
// w/o 71 ms -> w/ 18 ms (tested on ABC148-D with C++14(GCC 5.4.1))
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

int main(){
    // input
    lint N, M;
    cin >> N >> M;
    vector<int> A(M);
    lint ans = N;
    for( int i=0; i<M; i++ ){
        cin >> A[i];
        ans -= A[i];
    }
    if( ans < 0 ) ans=-1;

    // out
    cout << ans << endl;
} 

Measured memory_bytes: 3660
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<string>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
const double eps=1e-9;
struct node1
{
    ll a,b;
}node[100010];
bool cmp(node1 p1,node1 p2)
{
    return p1.a<p2.a;
}
int main()
{
    ll n,m;
    scanf("%lld%lld",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld%lld",&node[i].a,&node[i].b);
    }
    sort(node+1,node+1+n,cmp);
    for(int i=1;i<=n;i++)
    {
        if(m-node[i].b<=0)
        {
            printf("%lld\n",node[i].a);
            break;
        }
        else
        {
            m-=node[i].b;
        }
    }
    return 0;
}


Measured memory_bytes: 1792
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')
#import numpy as np


def main():
	a,b=MI()
	for i in range(100):
		if (a-1)*i+1>=b:
			print(i)
			exit(0)
			
if __name__ == "__main__":
	main()

Measured memory_bytes: 3060
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vll a(n);
    REP(i,n) cin >> a[i];
    sort(rALL(a));
    if(n==2){
        cout << a[0] << endl;
        return 0;
    }
    ll ans = a[0];
    ll rem = n-2;
    ll now = 1;
    while(rem>0){
        ll t = min(2LL,rem);
        ans += a[now]*t;
        now++;
        rem -= t;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
ll solve(int a[], int s, int e, ll dp[]){
    if(s == e){
        return 1;
    }
    if(a[s] == 1)
        return 0;
    if(dp[s] != -1)
        return dp[s];
    
    ll so = solve(a, s + 1, e, dp);
    if(s + 2 <= e)
    so = (so + solve(a, s + 2, e, dp)) % mod;
    return dp[s] = so;
}
int main() {
    int n, m, u;
    cin >> n >> m;
    int a[n+1] = {0};
    for(int i = 0; i < m; i++){
        cin >> u;
        a[u] = 1;
    }
    ll dp[n+1];
    memset(dp, -1, sizeof(dp));
    cout << solve(a, 0, n, dp);
    return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  bool flag = false;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'C') {
      for (int j = i; j < s.size(); j++) {
        if (s[j] == 'F') flag = true;
      }
    }
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
// Jai Mata Di
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
void solveTest(){
  int n; cin>>n;
  lli prev=0, temp =0, result = 0;
  while(n--){
    cin>>temp;
    if(temp<prev){
      result+= (prev-temp);
    }
    else{
      prev= temp;
    }
  }
  cout<<result<<"\n";
}
int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t=1, i=1;
  //cin>>t;//Comment if only one test case
  while(i<=t){
    //cout<<"Case #"<<i<<": ";
    solveTest();
    i++;
  }
  return 0;
}


Measured memory_bytes: 3652
// A - Sharing Cookies

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	int A, B;
	cin >> A >> B;

	string ans;

	if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) {
		ans = "Possible";
	} else {
		ans = "Impossible";
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
def main():
    N, M, C = map(int, input().split())
    B = list(map(int, input().split()))

    ans = 0
    for _ in range(N):
        A = list(map(int, input().split())) 
        s = C
        for i in range(M):
            s += A[i] * B[i]
        if s > 0:
            ans += 1
    print(ans)

main()

Measured memory_bytes: 3060
#include <stdio.h>
int main(void)
{
        int a, b, c;
        //scanfでデータを取得
        scanf("%d %d %d",&a, &b, &c);
	//a < b かつb < cを満たす
        if((a < b) && (b < c)){
                printf("Yes\n");
        }
        else{
                printf("No\n");
        }
        return 0;
}


Measured memory_bytes: 2044
/*
05:55 - 06:20 first leg
06:20 - 
 */
#include<iostream>
#include<algorithm>
#include<vector>
#include<cassert>
#include<climits>
#include<unordered_map>
#include<unordered_set>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define MAX 501
using namespace std;

typedef pair<int,int> ii;

int n,u,v,m,card;
int G[MAX][MAX][2];
bool used[MAX][MAX][2];
bool row[MAX][2],column[MAX][2],diag[2][2];
int dx[] = {+1,0,+1,-1};
int dy[] = {0,+1,+1,+1};

bool check(int type,int player,int p){
  int x,y;
  if(type == 0)x = 0, y = p; // 右
  else if(type == 1)x = p, y = 0; // 下
  else if(type == 2)x = y = 0; //予想のはるか斜めを。。。
  else if(type == 3)x = n-1, y = 0;

  rep(i,n){
    assert( 0 <= x && x < n && 0 <= y && y < n );
    if(!used[y][x][player])return false;
    x = x + dx[type];
    y = y + dy[type];
  }
  return true;
}

inline void increment(int& a,int& b,int player){
  if(player == 0)a++;
  else b++;
}

int main(){

  unordered_map<int,ii> place[2];
  cin >> n >> u >> v >> m;
  rep(i,2)rep(y,n)rep(x,n){
    cin >> G[y][x][i];
    place[i][G[y][x][i]] = ii(x,y);
  }

  int limit_USAGI = u, limit_NEKO = v;
  int score_USAGI = 0,score_NEKO = 0;
  string win = "$";
  rep(i,m){
    cin >> card;
    if(win[0] != '$')continue;

    rep(player,2){
      if(place[player].find(card) != place[player].end()){
	ii p = place[player][card];
	used[p.second][p.first][player] = true;

	if(!row[p.second][player]){
	  if(check(0,player,p.second)){
	    row[p.second][player] = true;
	    increment(score_USAGI,score_NEKO,player);
	  }
	}

	if(!column[p.first][player]){
	  if(check(1,player,p.first)){
	    column[p.first][player] = true;
	    increment(score_USAGI,score_NEKO,player);
	  }
	}


	if(p.first == p.second && !diag[0][player]){
	  if(check(2,player,0)){
	    diag[0][player] = true;
	    increment(score_USAGI,score_NEKO,player);
	  }
	}

	if(p.second == n-p.first-1 && !diag[1][player]){
	  if(check(3,player,0)){
	    diag[1][player] = true;
	    increment(score_USAGI,score_NEKO,player);
	  }
	}
      }
    }

    if(n == 1)score_USAGI = min(score_USAGI,1),
		score_NEKO = min(score_NEKO,1);

    if(score_USAGI >= limit_USAGI && score_NEKO >= limit_NEKO){
      win = "DRAW";
      //limit_USAGI++, limit_NEKO++;
    } else if( score_USAGI >= limit_USAGI ){
      win = "USAGI";
    } else if( score_NEKO >= limit_NEKO ){
      win = "NEKO";
    }
  }

  if(win[0] == '$')cout << "DRAW" << endl;
  else             cout << win    << endl;

  return 0;
}

Measured memory_bytes: 16300
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    int p;
    int c=0;
    for(int i=1;i<=N;i++){
        cin >> p;
        if(i!=p) c++;
    }
    if(c==0 || c==2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 3616
/*
 ID: bradyawn
 PROG: contest
 LANG: C++11
 */

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <utility>
#include <algorithm>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <bitset>
#include <random>
#include <cstring>

using namespace std;

typedef long long ll;
typedef pair<int,int> i2;
typedef pair<ll,ll> ll2;

int main()
{
    //ifstream inf("");
    //ofstream outf("");
    //cout << setprecision(10);
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);
    
    int a, b;
    cin >> a >> b;
    
    string s;
    cin >> s;
    
    if (s.size() != a+b+1) {cout << "No\n"; return 0;}
    
    for (int i = 0; i < a; i++) if (s[i] > '9' || s[i] < '0') {cout << "No\n"; return 0;}
    
    if (s[a] != '-') {cout << "No\n"; return 0;}
    
    for (int i = a+1; i < s.size(); i++) if (s[i] > '9' || s[i] < '0') {cout << "No\n"; return 0;}
    
    cout << "Yes\n";
    return 0;
    
}



Measured memory_bytes: 256
use std::env;
use std::io::*;
use std::str::*;
use std::mem;
use std::collections::HashMap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn read_char() -> char {
    let c = read::<String>();
    let c = c.chars().collect::<Vec<char>>();
    c[0]
}
fn read_String_Vec() -> Vec<char> {
    let S = read::<String>();
    S.chars().collect::<Vec<char>>()
}

fn vecchar_to_String(Vs: &Vec<char>) -> String {
    let mut S = String::new();
    for i in 0..Vs.len() {
        S.push(Vs[i]);
    }
    S
}

/*
A : 65
Z : 90
a : 97
z : 122
*/

/*
let N = read::<i32>();
let S = read::<String>();
let S = read_String_Vec();
let C = read_char();
*/

/*
 .to_string() : * -> String
 &*S          : String -> &str
*/

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let N = read::<i32>();
    let D = read::<i32>();
    let X = read::<i32>();
    let mut sum = X;
    for n in 0..N {
        let A = read::<i32>();
        sum += (D-1)/A + 1;
    }

    println!("{}", sum);
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main() {
  string S;
  cin >> S;
  int c=0;
  int l = S.length();
  int m = l/2;
  l=l-1;
    for (int i = 0; i < m; i++) {
      if(S[i]!=S[l-i]){
        c++;
      }
    }
    cout << c;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int n, m, q, ans;
int a[50], b[50], c[50], d[50];


void makenum(int x, vector<int> vec){
	if (x == n){
		int temp = 0;
		for (int i = 0; i < q; i++){
			if (vec[b[i]-1] - vec[a[i]-1] == c[i]) temp += d[i];
		}
		ans = max(ans, temp);
		return;
	}
	if (x == 0){
		vec.push_back(1);
		makenum(x+1, vec);
	}else{
		for (int i = vec[x-1]; i <= m; i++){
			vec.push_back(i);
			makenum(x+1, vec);
			vec.pop_back();
		}
	}
	return;
}


int main(){
	cin >> n >> m >> q;
	for (int i = 0; i < q; i++){
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	vector<int> vec;
	makenum(0, vec);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3564
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int main()
{
	i64 N;
	scanf("%lld", &N);
	N += 1; // empty string

	vector<int> seq;
	int last = 1;

	bool flg = false;
	for (int i = 40; i >= 0; --i) {
		if ((N >> i) & 1) {
			if (flg) {
				seq.push_back(last++);
				seq.insert(seq.begin(), last++);
			} else {
				flg = true;
				//seq.push_back(last++);
			}
			//flg = true;
		} else if (flg) {
			seq.push_back(last++);
		}
	}
	for (int i = 1; i < last; ++i) seq.push_back(i);
	printf("%d\n", seq.size());
	for (int i = 0; i < seq.size(); ++i) printf("%d%c", seq[i], i == seq.size() - 1 ? '\n' : ' ');
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

 int main(void){

int i,n;

int number;

long long int sum=0;

int min=0; int max=0;

scanf("%d",&n);

for(i=0;i<n;i++){

scanf("%d",&number);

if(i==0){

min = number;

max = number;

}

if(number<min) min = number;

if(number>max) max = number;

sum += number;

}

printf("%d %d %lld\n",min,max,sum);

return 0; }
 

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;

int main() {
  int n,ans = 0;
  cin >> n;
  rep(i,n) {
    int p; 
    cin >> p;
    if(p != i+1) ans++;
  }
  if(ans == 0 || ans == 2) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
import math
import time
n, m = map(int, input().split())
flag=0
if m%n==0:
    print(m//n)

else:
    start = time.time()
    index=m//n
    while index >0:
        elapsedTime = time.time()-start
        if elapsedTime > 1:
            flag=1
            break
        elif m%index==0:
            print(index)
            break
        index-=1

    if flag==1:
        index = 1
        while index < m+1:
            if m % index == 0:
                if index > n-1:
                    print(m//index)
                    break
            index += 1

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< int > A(N);
	A[0] = -1;
	rep(i, N - 1) cin >> A[i + 1];
	vector< int > ans(N, 0);
	rep(i, N - 1) ans[A[i + 1] - 1]++;
	rep(i, N) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 6428
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#define rep(index,num) for(int index=0;index<num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
using namespace std;
typedef pair<int,int> pint;
typedef long long ll;
int main(){
	int N,M;
	pint a[100000];
	scan(N);scan(M);
	rep(i,M){
		scanf("%d %d",&a[i].first,&a[i].second);
	}
	sort(a,a+M);
	int honsu=0;
	int bmin=N;
	rep(i,M){
		if(a[i].first>=bmin){
			honsu++;
			bmin=N;
		}
		if(a[i].second<bmin){
			bmin=a[i].second;
		}
	}
	honsu++;
	prin(honsu);
	return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
	int a,t;
	cin>>a;
	t = a;
	int sum = 0;
	while(a)
	{
		sum += a%10;
		a/=10;
	}
	if(t%sum)
		printf("No\n");
	else
		printf("Yes\n");
 } 

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
ll const inf = LLONG_MAX / 2;

ll dp[100010][2]; // dp[i 番目][A_{i-1}, A_i を -1 倍] := i - 1 番目までの和

int main() {
  int N; cin >> N;
  vector<int> A(N); cin >> A;
  REP(i, 1, N + 1) {
    dp[i][0] = max(dp[i - 1][0] + A[i - 1], i > 1 ? dp[i - 1][1] - A[i - 1] : -inf);
    dp[i][1] = max(dp[i - 1][0] - A[i - 1], i > 1 ? dp[i - 1][1] + A[i - 1] : -inf);
  }
  ll ans = dp[N][0];//max(dp[N][0], dp[N][1]);
  cout << ans << endl;
}


Measured memory_bytes: 2176