akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define MOD 1000000007
#define inf 0x3f3f3f3f3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define Max(x, y) (((x) > (y)) ? (x) : (y))
#define Min(x, y) (((x) < (y)) ? (x) : (y))
#define Abs(x) ((x) < 0 ? (-(x)) : (x))
#define int long long
const int maxn = 1e3 + 10;
inline int read()
{
    int f = 1, r = 0;
    char c = getchar();
    while (!isdigit(c)) {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (isdigit(c)) {
        r = 10 * r + c - '0';
        c = getchar();
    }
    return f * r;
}
inline void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
inline void writesp(int x) { write(x), putchar(' '); }
inline void writeln(int x) { write(x), puts(""); }
int N, S;
inline int f(int n, int jinzhi)
{
    if (n < jinzhi) {
        return n;
    }
    int sum = n % jinzhi + f(n / jinzhi, jinzhi);
    return sum;
}
signed main()
{
    N = read(), S = read();
    if (S > N) {
        puts("-1");
        return 0;
    }
    if (S == N) {
        writeln(S+1);
        return 0;
    }
    int block = sqrt(N) + 1;
    for (ri i = 2; i <= block; ++i) {
        if (f(N, i) == S) {
            writeln(i);
            return 0;
        }
    }
    int sub = N - S, ans = inf;
    for (ri i = sqrt(sub); i >= 1; --i) {
        if ((N - S) % i == 0) {
            int b = (N - S) / i + 1;
            if (f(N, b) == S) {
                ans = Min(ans, b);
            }
        }
    }
    if (ans != inf) {
        writeln(ans);
    } else {
        puts("-1");
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<string>
#include<set>
#include<queue>
#include<cmath>
#include<tuple>
#include<utility>
#include<functional>
#include<algorithm>



using namespace std;

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

long long K,sum=0ll;

int main() {
	cin>>K;
	for(int i=1;i<=K;i++)
	for(int j=1;j<=K;j++)
	for(int k=1;k<=K;k++){
		sum+=gcd(gcd(i,j),k);
	}
	cout<<sum<<endl;

	return 0;
}



Measured memory_bytes: 3624
import std;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N = lread();
    auto A = aryread();
    A[] -= 1;
    // writeln(A);
    auto ans = new long[](N);
    foreach_reverse (i; 0 .. N - 1)
    {
        ans[A[i]]++;
    }
    foreach (i; 0 .. N)
    {
        ans[i].writeln();
    }
}


Measured memory_bytes: 12568
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FI          freopen("input.txt", "r", stdin)
#define FO          freopen("output.txt", "w", stdout)
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef unsigned long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 1e5 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-9;
//int dx[] = {0, -1}, dy[] = {-1, 0};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
string s, t;
void solve(){
    cin >> s >> t;
    int ans = 1e9;
    for(int i = 0; i < sz(s) - sz(t) + 1; i++){
        int cur = 0;
        for(int  j = 0; j < sz(t); j++){
            if(t[j] != s[j + i])
                cur++;
        }
        ans = min(ans, cur);
    }
    cout << ans << '\n';
}
int main(){
    FIN;
    int t = 1;
    for(int i = 1; i <= t; i++){
        solve();
    }
   // EjecuteTime;
    return 0;
}       

Measured memory_bytes: 3656
import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit


@njit
def loop(N,A):
    L = np.array([0 for i in range(N+1)])
    R = np.array([0 for i in range(N+1)])

    for i in range(N):
        temp = A[i]
        if i+1+temp <= N:
            L[i+1+temp] += 1
        if i+1-temp >= 0:
            R[i+1-temp] += 1

    return np.sum(L*R)

def main():
    N = int(input())
    A = list(map(int,input().split()))
    A = np.array(A)

    res = loop(N,A)

    print(res)




main()


Measured memory_bytes: 120844
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int h = int.Parse(Console.ReadLine());
        int w = int.Parse(Console.ReadLine());

        Console.WriteLine((n + 1 - h) * (n + 1 - w));
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

class UnionFind {
public:
  vector<ll> par;
  vector<ll> siz;
  
  UnionFind(ll sz_) : par(sz_), siz(sz_, 1) {
    for(int i = 0; i < sz_; i++) par[i] = i;
  }
  
  void init(ll sz_){
    par.resize(sz_);
    siz.assign(sz_, 1);
    for (ll i = 0; i < sz_; ++i) par[i] = i;
  }
  
  ll root(ll x){
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  
  bool unite(ll x, ll y){
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }
  
  bool same(ll x, ll y){
    return root(x) == root(y);
  }
    
  ll size(ll x){
    return siz[root(x)];
  }
};

int main(){
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int>> fri(n), blo(n);
  UnionFind tree(n);
  rep(i, m){
    int a, b;
    cin >> a >> b;
    a--, b--;
    fri[a].push_back(b);
    fri[b].push_back(a);
    tree.unite(a, b);
  }
  rep(i, k){
    int c, d;
    cin >> c >> d;
    c--, d--;
    blo[c].push_back(d);
    blo[d].push_back(c);
  }
  
  rep(i, n){
    int ans = tree.size(i) - 1;
    ans -= fri[i].size();
    for(int j : blo[i]){
      if (tree.same(i, j)) ans--;
    }
    cout << ans;
    if(i == n-1) cout << endl;
    else cout << ' ';
  }
  
  return 0;
}


Measured memory_bytes: 13432
with Ada.Text_IO;
with Ada.Integer_Text_IO;
with Ada.Float_Text_IO;
use Ada.Text_IO;
use Ada.Integer_Text_IO;
use Ada.Float_Text_IO;

procedure hoge is
 a: integer;
 b: integer;
 c: integer;
begin
 get(a);
 get(b);
 get(c);
 if a+b+c>=22 then
  put_line("bust");
 else
  put_line("win");
 end if;
end hoge;

Measured memory_bytes: 3684
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  int N,D;
  cin >> N >> D;
  int ans = 0;
  ans = (N+D * 2) /(2*D + 1);
  cout << ans << endl;
}


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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    rep(i,s.size()){
        int k = (s[i] - 65 + n) % 26;
        cout << char(char(k + 65));
    }
    cout <<  endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 50;
const int ININF = 1000000;
const int MAX = 510000;
const int MOD = 998244353;

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

int main() {
    long long N, M, K;
    cin >> N >> M >> K;
    // 前処理
    COMinit();
    long long res = 0;
    rep(i, 0, K+1) {
        long long tmp = COM(N - 1, i) * M % MOD;
        // cout << "i" << i << "," << tmp << endl;
        tmp *= modpow(M - 1, N - i - 1, MOD);
        tmp %= MOD;
        res = (res + tmp) % MOD;
    }

    // 計算例
    cout << res << endl;
}


Measured memory_bytes: 15596
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt() int {
	n, _ := strconv.Atoi(readString())
	return n
}

func readInts() (int, int) {
	input := strings.Split(readString(), " ")
	n, _ := strconv.Atoi(input[0])
	k, _ := strconv.Atoi(input[1])

	return n, k
}

func main() {
	n, k := readInts()
	h := make([]int, n)
	for i := 0; i < n; i++ {
		h[i] = readInt()
	}
	sort.Sort(sort.IntSlice(h))

	min := h[k-1] - h[0]
	for i := 1; i < n-k+1; i++ {
		diff := h[i+k-1] - h[i]
		if diff == 0 {
			min = 0
			break
		} else if diff < min {
			min = diff
		}
	}
	fmt.Println(min)
}

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

using namespace std;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<int> a(n + 1, 0);
  for (int i = 0; i < n; ++i) {
    if (s[i] == '<') {
      a[i + 1] = max(a[i + 1], a[i] + 1);
    }
  }

  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == '>') {
      a[i] = max(a[i], a[i + 1] + 1);
    }
  }
  long long ans = 0;
  for (int i = 0; i < n + 1; ++i) {
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2820
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str,strArray[];
		int seg[] = new int[10];
		int v1,v2,sum=0,ans;

		while((str=br.readLine()) != null){
			strArray = str.split(",");

			for(int i=sum=0; i<10; i++){
				seg[i] = Integer.parseInt(strArray[i]);
				sum += seg[i];
			}

			v1 = Integer.parseInt(strArray[10]);
			v2 = Integer.parseInt(strArray[11]);

			ans = sum*v2/(v1+v2);

			for(int i=9; i>=0; i--){
				ans -= seg[i];
				if(ans<0){
					System.out.println(i+1);
					break;
				}
			}

		}

	}
}

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

using namespace std;

struct T;
#define null ((T*)NULL)

typedef int ll;

struct T {
  ll v;
  ll m;
  int c;
  T *l,*r;
  bool lz;
  ll lazy;
  T(){}
  T(ll v):v(v),m(v),c(1),l(null),r(null),lz(false),lazy(0){}
};

int hogeS=0;
#define SSS 2222222
T hoge[SSS];
inline T* New(int v){
  if(hogeS >= SSS) exit(-1);
  hoge[hogeS]=T(v);
  return &hoge[hogeS++];
}
inline int count(T* t){ return t?t->c:0; }
inline void push(T* t)
{
  if( !t ) return;
  if( t->lz ) {
    t->v += t->lazy;
    t->m += t->lazy;
    t->lz = false;
    if( t->r ) {
      t->r->lz |= true;
      t->r->lazy += t->lazy;
    }
    if( t->l ) {
      t->l->lz |= true;
      t->l->lazy += t->lazy;
    }
    t->lazy = 0;
  }
}
inline ll mini(T* t){ push(t); return t?t->m:INT_MAX; }

inline T* update(T* t)
{
  if(!t)return t;
  push(t);
  t->c = count(t->l)+count(t->r)+1;
  t->m = min(t->v,min(mini(t->l),mini(t->r)));
  return t;
}

T* merge(T* a,T* b)
{
  push(a);
  push(b);
  if(!a || !b)return a?a:b;
  if(rand()%(count(a)+count(b))<count(a)){
    a->r = merge(a->r,b);
    return update(a);
  } else {
    b->l = merge(a,b->l);
    return update(b);
  }
}

pair<T*,T*> split(T* a,int k)
{
  push(a);
  if(!a)return make_pair(null,null);
  if(k<=count(a->l)){
    pair<T*,T*> s=split(a->l,k);
    a->l = s.second;
    return make_pair(s.first,update(a));
  } else {
    pair<T*,T*> s=split(a->r,k-count(a->l)-1);
    a->r = s.first;
    return make_pair(update(a),s.second);
  }
}

inline T* insert(T* t,int k,int v)
{
  push(t);
  pair<T*,T*> a=split(t,k);
  return merge(merge(a.first,New(v)),a.second);
}

inline T* add(T* t,int l,int r,int k)
{
  push(t);
  pair<T*,T*> u = split(t,r);
  pair<T*,T*> v = split(u.first,l);
  T* w = v.second;
  w->lz = true;
  w->lazy += k;
  return merge(merge(v.first,update(w)),u.second);
}

int n,m;
char s[333333];

void print(T* t)
{
  if(t==null)return;
  push(t);
  print(t->l);
  printf("%2lld,%2lld|",t->v,t->m);
  print(t->r);
}

int main(void)
{
  T *root = null;
  int n,q;
  set<int> toji;
  scanf("%d%d",&n,&q);
  scanf("%s",s);
  for( int i = 0; i < n; i++ ) {
    root = insert(root,i,0);
  }
  for( int i = 0; i < n; i++ ) {
    root = add(root,i,n,s[i]=='('?1:-1);
    if( s[i] == ')' ) toji.insert(i);
  }
  int k;
  for( int ii = 0; ii < q; ii++ ) {
    scanf("%d",&k);
    if( s[k-1] == '(' ) {
      s[k-1] = ')';
      toji.insert(k-1);
      root = add(root,k-1,n,-2);
      int me = *(toji.begin());
      printf("%d\n",me+1);
      s[me] = '(';
      toji.erase(me);
      root = add(root,me,n,2);
    } else {
      toji.erase(k-1);
      s[k-1] = '(';
      root = add(root,k-1,n,2);
      int l=0,r=n;
      while( l < r ) {
        int mb = (l+r)/2;
        auto t = split(root,mb);
        if( mini(t.second) >= 2 ) {
          r = mb;
        } else {
          l = mb+1;
        }
        root = merge(t.first,t.second);
      }
      printf("%d\n",l+1);
      s[l] = ')';
      toji.insert(l);
      root = add(root,l,n,-2);
    }
  }
  return 0;
}

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
ll gcd(ll x,ll y){
    if(x%y==0)return y;
    return gcd(y,x%y);
}
ll LCM(int a, int b){
    return a*b/gcd(a,b);
}

int main(void)
{
    string s;
    cin>>s;
    cout<<s[0]<<s[1]<<s[2]<<endl;
    return 0;
}

Measured memory_bytes: 3568
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    char str[1201];
    int i;
    
    gets(str);
    
    for (i = 0; str[i] != '\0'; i++) {
        
        if (str[i] >= 'A' && str[i] <= 'Z') {
            str[i] += 32;
            continue;
        }
        
        if (str[i] >= 'a' && str[i] <= 'z') {
            str[i] -= 32;
        }
    }
    
    printf("%s\n",str);
    
    return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef pair <int, int> pii;
typedef pair <long long, long long> pll;
#define pb push_back
#define ll long long
#define endl "\n"
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
int main() 
{
    fast_io();
    int r; cin >> r;
    cout << r*r << endl;
    return 0;
}

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

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout<<setprecision(10);
  ll  a,b;
  cin>>a>>b;
  ll c=1;
  ll res=0;
  while(b>=c)c*=2;
  c/=2;
  while(c>0)
  {
    ll cnt=0;
    if(c>=a)
    {
      cnt+=((b-c)/(2*c))*c;
      if((b-c)%(2*c)<c)cnt+=(b-c)%(2*c)+1;
      else cnt+=c;
    }
    else
    {
      cnt+=((b-c)/(2*c))*c;
      if((b-c)%(2*c)<c)cnt+=(b-c)%(2*c)+1;
      else cnt+=c;

      ll cnt1=0;
      cnt1+=((a-c-1)/(2*c))*c;
      if((a-c-1)%(2*c)<c)cnt1+=(a-c-1)%(2*c)+1;
      else cnt1+=c;
      cnt-=cnt1;
    }
    if(cnt&1)
    {
      res+=c;
    }
    //cout<<cnt<<" "<<c<<endl;
    c>>=1;
  }
  cout<<res<<endl;


  return 0;

}


Measured memory_bytes: 256
#n = int(input())
#a, b = map(int,input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
s = list(input())
ans = ''
for i, si in enumerate(s):
    if (i+1) % 2 != 0:
        ans += si
print(ans)


Measured memory_bytes: 9368
program path
  implicit none
  integer :: a, b, p(4,4), i
  p = 0
  do i = 1, 3
    read(*,*) a, b
    p(a,b) = 1
    p(b,a) = 1
  end do
  do i = 1, 4
    if (sum(p(i,:)).gt.2) then
      write(*,'(a)') "NO"
      stop
    end if
  end do
  write(*,'(a)') "YES"
  stop
end program path

Measured memory_bytes: 256
L=[]
for i in range(10):
    a=int(input())
    L.append(a)
    i+=1

for k in range(9,0,-1):
    for l in range(k):
        if L[l]>L[l+1]:
            L[l],L[l+1]=L[l+1],L[l]
        l+=1
    k+=1

for j in range(3):
    print(L[-1])
    L.remove(L[-1])
    j+=1


Measured memory_bytes: 5600
import java.io.*;

public class Main {
	public static void main(String[] args) throws Exception {
		double max=0, min=0;
		boolean button = true;
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input;
		while((input = br.readLine()) != null) {
			double input2 = Double.parseDouble(input);
			if(button) {
				max = min = input2;
				button = false;
			}
			if(input2 > max) max = input2;
			else if(input2 < min) min = input2;
		}
		System.out.println(max-min);
	}
}

Measured memory_bytes: 17032
import java.util.*;

public class Main {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      
      String[] input = sc.nextLine().split(" ");
      int a = Integer.parseInt(input[0]);
      int b = Integer.parseInt(input[1]);
      
      System.out.println(gcd(a,b));
   }
   
   
   public static int gcd(int a, int b) {
      if (a % b == 0) {
         return b;
      } else {
         return gcd(b, a % b);
      }
   }
}


Measured memory_bytes: 26292
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math;

void main()
{
    auto N = readln.chomp.to!int;
    auto AS = readln.split.to!(long[]);
    foreach (i; 0..N) {
        AS[i] = AS[i] - (i+1);
    }
    sort(AS);
    auto d = AS[N/2];
    long ret;
    foreach (a; AS) {
        ret += abs(a - d);
    }
    writeln(ret);
}

Measured memory_bytes: 10864
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.next();
		String T = stdIn.next();
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		String U = stdIn.next();
		int ans = 0;
		if(S.equals(U)){
			ans = A - 1;
			System.out.println(ans + " " + B);
		}
		else{
			ans = B - 1;
			System.out.println(A + " " + ans);
		}
		stdIn.close();
	}
}

Measured memory_bytes: 38756
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B;
  cin >> A >> B;
  if (A != 1 && B != 1) {
    if (A > B) {cout << "Alice" << endl;}
    else if (A == B) {cout << "Draw" << endl;}
    else {cout << "Bob" << endl;}
  }
  else {
    if (A == 1 && B != 1) {cout << "Alice" << endl;}
    else if (A == 1 && B == 1) {cout << "Draw" << endl;}
    else {cout << "Bob" << endl;}
  }
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    pair<int,int>p[n];
    for(int i=0;i<n;i++)cin>>p[i].first>>p[i].second;
    for(int i=0;i<n-2;i++){
        if(p[i].first==p[i].second&&p[i+1].first==p[i+1].second&&p[i+2].first==p[i+2].second){
            cout<<"Yes\n";
            return 0;
        }
    }cout<<"No\n";
}

Measured memory_bytes: 3104
#include<stdio.h>
#include<algorithm>
using namespace std;
char str[30][11];
int a,b,c,d;
int calc(int t){
	for(int i=0;i<d;i++){
		for(int j=0;j<a-2;j++){
			if(str[i][j]=='1'&&str[i][j+1]=='1')return -1;
		}
	}
	for(int i=0;i<d;i++){
		if(t<a-1&&str[i][t]=='1')t++;
		else if(t&&str[i][t-1]=='1')t--;
	}
	return t;
}
int main(){
	while(scanf("%d",&a),a){
		scanf("%d%d%d",&b,&c,&d);
		b--;
		c--;
		for(int i=0;i<d;i++)scanf("%s",str[i]);
		bool ok=false;
		if(calc(b)==c){
			printf("0\n");
			ok=true;
		}
		for(int i=0;!ok&&i<d;i++){
			for(int j=0;!ok&&j<a-1;j++){
				if(str[i][j]=='1')continue;
				str[i][j]='1';
				if(calc(b)==c){
					printf("%d %d\n",i+1,j+1);
					ok=true;
				}
				str[i][j]='0';
			}
		}
		if(!ok)printf("1\n");
	}
}

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

const int mod = 1e9 + 7;

int exp(int x, int n) {
    int ret = 1;
    while(n) {
        if(n & 1) ret = 1LL * ret * x % mod;
        x = 1LL * x * x % mod;
        n >>= 1;
    }
    return ret;
}
int inv(int x) {
    return exp(x, mod - 2);
}
int fact[20010], invf[20010];
int comb(int n, int k) {
    return 1LL * fact[n] * invf[k] % mod * invf[n - k] % mod;
}
int H(int n, int k) {
    if(n == 0 && k == 0) return 1;
    return comb(n + k - 1, k);
}

int N, A, B, C;

int main() {
    fact[0] = 1;
    for(int i = 1; i < 20010; i++) {
        fact[i] = 1LL * fact[i - 1] * i % mod;
    }
    for(int i = 0; i < 20010; i++) {
        invf[i] = inv(fact[i]);
    }

    cin >> N >> A >> B >> C;

    if(B % 2) {
        printf("0");
        return 0;
    }

    int ans = 0;
    for(int i = 0; i <= N; i++) {
        for(int j = 0; j <= N; j++) {
            if(i > A) continue;
            if(i + 3 * j > C) continue;

            ans += 1LL * comb(i + j, i) * comb(i + j + B / 2, B / 2) % mod * comb(i + j + B / 2 + A - i, A - i) % mod * H(B / 2, C - i - 3 * j) % mod;
            ans %= mod;
        }
    }

    cout << ans;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vii;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip> vip;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 :1e9;
int main(){
	int n;
	while(cin>>n,n){
		vs in(n);
		rep(i,n)cin>>in[i];
		int q[]={5,7,5,7,7};
		rep(i,n){
			int t=0,I=i,s=0;
			while(I<n){
				s+=in[I].size();
				if(s>q[t])break;
				if(s==q[t]){
					t++;
					s=0;
				}
				if(t==5){
					cout<<i+1<<endl;
					goto end;
				}
				I++;
			}
		}
		end:;
	}
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1e9+7;

int main() {
  string n;
  cin>>n;
  rep(i,n.size()){
    if(n[i]=='1') cout<<"9";
    else if(n[i]=='9') cout<<"1";
    else cout<<n[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;

typedef long long ll;
#define READ(a) int a; cin >> a;
#define READARR(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define READMAT(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
#define print(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int a, b;
	cin >> a >> b;
	if (b > a) swap(a, b);
	
	int x = 0;
	FOR (i, 1, a) x = x*10 + b;
	cout << x;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <map>
#include <bitset>
#define ri register
#define inf 0x7fffffff
#define E (1)
#define mk make_pair
#define int long long
//#define double long double
using namespace std; const int N=200010;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch-'0'), ch=getchar();
    return s*w;
}
void print(int x) { if(x<0) x=-x, putchar('-'); if(x>9) print(x/10); putchar(x%10+'0'); }
signed main()
{
    char c;
    cin>>c;
    if(c>='A'&&c<='Z') puts("A");
    else puts("a");
    return 0;
}

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

h, w = map(int, input().split())
s = []
for _ in range(h):
    s.append(input())

ans = s.copy()
for i in range(h):
    ans[i] = list(ans[i])

for x in range(h):
    for y in range(w):
        if s[x][y] == '.':
            num = 0
            for dx in [-1, 0, 1]:
                for dy in [-1, 0, 1]:
                    if 0 <= x + dx < h and 0 <= y + dy < w and s[x+dx][y+dy] == '#':
                        num += 1
            ans[x][y] = str(num)

for i in ans:
    print(''.join(i))

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

struct Pos{
    int x,y;
    Pos(){}
    Pos(int x,int y):x(x),y(y){}
};

int N;
vector<Pos> pos;
int p[20];
int K;
vector<int> lx,ly;

int calc(int n){
    if(n==N&&lx.size()+ly.size()!=K)return INF;
    if(lx.size()+ly.size()==K){
        int res=0;
        for(int i=0;i<N;++i){
            int dist_min=INF;
            for(auto u:lx){
                int dist=abs(pos[i].x-pos[u].x);
                chmin(dist_min,dist);
            }
            for(auto u:ly){
                int dist=abs(pos[i].y-pos[u].y);
                chmin(dist_min,dist);
            }
            chmin(dist_min,abs(pos[i].x));
            chmin(dist_min,abs(pos[i].y));
            res+=p[i]*dist_min;
        }
        return res;
    }
    else {
        int res=INF;
        res=min(res,calc(n+1));
        lx.push_back(n);
        res=min(res,calc(n+1));
        lx.pop_back();
        ly.push_back(n);
        res=min(res,calc(n+1));
        ly.pop_back();
        return res;
    }
}

signed main(){
    cin>>N;
    for(int i=0;i<N;++i){
        int x,y;
        cin>>x>>y;
        pos.push_back(Pos(x,y));
        cin>>p[i];
    }
    for(int k=0;k<=N;++k){
        K=k;
        cout<<calc(0)<<endl;
        lx.clear();
        ly.clear();
    }
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
int main() {
  	int N, cnt;
  	double D;
  	cnt = 0;
  	cin >> N >> D;
  	vector<vector<double>> x_y(N, vector<double> (2, 0));
  
 	for(int i=0; i < N ; i++){
		for(int j=0; j < 2; j++){
        	cin  >> x_y.at(i).at(j);
        }
  	}
	
	for(int i=0; i < N ; i++){
  
       	if(sqrt(x_y.at(i).at(0)*x_y.at(i).at(0)+x_y.at(i).at(1)*x_y.at(i).at(1)) <= D){
        	cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 14400
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int a,b,c,d,n;
string s;

bool wolne(int x){
  return s[x] == '.' && a != x && b != x;
}
bool rusza(){
  if(wolne(a + 1)){
    a++;
    return 1;
  }else if(wolne(a + 2)){
    a+=2;
    return 1;
  }
  return 0;
}
bool ruszb(){
  if(wolne(b + 1)){
    b++;
    return 1;
  }else if(wolne(b + 2)){
    b+=2;
    return 1;
  }
  return 0;
}


void nie(){
  cout << "No\n";
  exit(0);
}  
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n >> a >> b >> c >> d >> s;
  a--;b--;c--;d--;
  s += '.';
  s += '.';
  if(c < d){
    swap(a,b);
    swap(c,d);
  }
  while(1){
    debug(a,b,c,d);
    if(a > c || b > d){
      nie();
    }
    if(a == c || !rusza()){
      if(a == c && b == d){
        cout << "Yes\n";
        exit(0);
      }
      if(!ruszb()){
        nie();
      }
    }
  }
}


Measured memory_bytes: 592
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


double dp[200][400];
int main(){
    int n;
    cin>>n;
    int h[n+1];
    rep(i,n)cin>>h[i];
    rep(i,200)rep(j,400)dp[i][j]=inf;
    dp[0][1]=0;
    rep(i,n){
        REP(j,1,400)REP(k,1,400){
            if((j<h[i])^(k<h[i])){
                double x=abs(j-h[i]),y=abs(k-h[i]);
                dp[i+1][k]=min(dp[i+1][k],dp[i][j]+(double)(x*x+y*y)/2.0/(x+y));
            }
            else{
                double x=abs(j-h[i]),y=abs(k-h[i]);
                dp[i+1][k]=min(dp[i+1][k],dp[i][j]+(double)(x+y)/2.0);
            }
        }
    }
    double ans=longinf;
    rep(i,400)ans=min(ans,dp[n][i]);
    cout<<fixed<<setprecision(9)<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3868
#include <stdio.h>

int main(void){
  int i,j,n,q;
  int cnt	= 0;
  long long int S[10001],T[501];

  scanf("%d",&n);
  for( i = 0 ; i < n ; i++ ) scanf("%lld",&S[i]);
  scanf("%d",&q);
  for( i = 0 ; i < q ; i++ ) scanf("%lld",&T[i]);
  for( i = 0 ; i < q ; i++ ){
    for( j = 0 ; j < n ; j++ ){
      if( S[j] == T[i] ){
        cnt++;
        break;
      }
    }
  }
  printf("%d\n",cnt);
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1005;
int a[N][N],flag[N*10],P[N*10],tot,n; 
int check1(int x,int y){
	return (x+y)/2;
}
int check2(int x,int y){
	return (x-y+n+1)/2;
}
int Lcm(int x,int y){
	if (!x||!y)return x+y;
	return x/__gcd(x,y)*y;
} 
signed main(){
	scanf("%lld",&n);
	if (n==2){
		puts("2 3");
		puts("5 16");
		return 0;
	}
	for (int i=2;i<=10000;i++)
		if (!flag[i])for (int j=2*i;j<=10000;j+=i)flag[j]=1;
	for (int i=2;i<=10000;i++)
		if (!flag[i])P[++tot]=i;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			if ((i+j)%2==1)a[i][j]=P[check1(i,j)]*P[check2(i,j)+n+1];
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			if ((i+j)%2==0)a[i][j]=Lcm(Lcm(a[i+1][j],a[i-1][j]),Lcm(a[i][j-1],a[i][j+1]))+1;
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++)printf("%lld ",a[i][j]);
		puts("");
	}
}

Measured memory_bytes: 7168
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{
    string S;
    int Q;
    cin >> S >> Q;
    deque<char> dq;
    rep(i,S.size()) dq.push_back(S[i]);
    int rev = 0;
    rep(i,Q){
        int t;
        cin >> t;
        if(t == 1) rev++;
        else{
            int f;
            char a;
            cin >> f >> a;
            if(rev % 2 == 0){
                if(f == 1) dq.push_front(a);
                else dq.push_back(a);
            }else{
                if(f == 1) dq.push_back(a);
                else dq.push_front(a);
            }
        }
    }

    if(rev%2==0){
        for (char s : dq) {
            cout << s;
        }
    }else{
        for (int i = dq.size()-1; i >= 0; i--) {
            cout << dq[i];
        }
    }
    cout << endl;
    
    
    
    

    return 0;
}


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

divisors = set()

for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        divisors.add(i)
        divisors.add(n//i)

ans = 0

for d in divisors:
    m = d-1
    if m != 0 and n//m == n % m:
        ans += m

print(ans)


Measured memory_bytes: 3828
#include <iostream> 
using namespace std; 
int main() 
{ 
	long long n,d,x,y,cnt=0;
	cin>>n>>d;
	while(n--)
	{
		cin>>x>>y;
		if(x*x+y*y<=d*d)
		{
			cnt++;
		}
	}
	cout<<cnt<<endl;
    return 0; 
}

Measured memory_bytes: 3592
from collections import defaultdict
N = int(input())
A = [int(i) for i in input().split()]

def upper(x):
    if x < 3200:
        return (x//400 + 1) * 400 -1
    else:
        return 3200

Rate = defaultdict(int)
for a in A:
    Rate[upper(a)] += 1

ans = 0
for r in Rate:
    if r < 3200:
        ans += 1
if ans > 0:
    print(ans, ans + Rate[3200])
else:
    print(1, Rate[3200])

Measured memory_bytes: 3444
using System;
using System.Numerics;
using System.Collections.Generic;
using System.Linq;

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = BigInteger.Parse(Console.ReadLine());

            var l = new List<BigInteger>();
            l.Add(BigInteger.Parse(Console.ReadLine()));
            l.Add(BigInteger.Parse(Console.ReadLine()));
            l.Add(BigInteger.Parse(Console.ReadLine()));
            l.Add(BigInteger.Parse(Console.ReadLine()));
            l.Add(BigInteger.Parse(Console.ReadLine()));
            var min = l.Min();

            BigInteger t = n % min == 0 ? n / min : (n / min) + 1;
            t += 4;

            Console.WriteLine(t);
        }
    }
}


Measured memory_bytes: 13652
public class Main {
	public static void main(String[] args) {
		var sc = new java.util.Scanner(System.in);
		var s = sc.next();
		var t = sc.next();
		int sum = 0;
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)!=t.charAt(i)) {
				sum++;
			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 41128
class UnionFind
  def initialize(size)
    @rank = Array.new(size, 0)
    @parent = Array.new(size, &:itself)
  end

  def unite(id_x, id_y)
    x_parent = get_parent(id_x)
    y_parent = get_parent(id_y)
    return if x_parent == y_parent

    if @rank[x_parent] > @rank[y_parent]
      @parent[y_parent] = x_parent
    else
      @parent[x_parent] = y_parent
      @rank[y_parent] += 1 if @rank[x_parent] == @rank[y_parent]
    end
  end

  def get_parent(id_x)
    @parent[id_x] == id_x ? id_x : (@parent[id_x] = get_parent(@parent[id_x]))
  end

  def same_parent?(id_x, id_y)
    get_parent(id_x) == get_parent(id_y)
  end
  
  def size
    @parent.map { |id_x| get_parent(id_x) }.uniq.size
  end
end

n,m = gets.split.map(&:to_i)
a,b = m.times.map{gets.split.map(&:to_i)}.transpose

uf = UnionFind.new n
for i in 0..(m-1)
  uf.unite(a[i]-1,b[i]-1)
end
puts uf.size-1

Measured memory_bytes: 26104
import java.io.*;
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        FastReader scan = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        Task solver = new Task();
        int t = 1;
        while (t --> 0) solver.solve(1, scan, out);
        out.close();
    }
 
    static class Task {
        static int h, n;
        static Monster[] m;
        
        public void solve(int testNumber, FastReader scan, PrintWriter out) {
            h = scan.nextInt();
            n = scan.nextInt();
            m = new Monster[n];
            for(int i = 0; i < n; i++) m[i] = new Monster(scan.nextInt(), scan.nextInt());
            long[] dp = new long[h+1];
            Arrays.fill(dp, Integer.MAX_VALUE/10);
            dp[h] = 0;
            for(int i = h; i >= 0; i--) {
                for(int j = 0; j < n; j++) {
                    int next = Math.max(0, i - m[j].a);
                    dp[next] = Math.min(dp[next], dp[i] + m[j].b);
                }
            }
            out.println(dp[0]);
        }
        
        static class Monster {
            int a, b;
            public Monster(int cc, int dd) {
                a = cc;
                b = dd;
            }
        }
    }
 
    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
 
    static void shuffle(long[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            long temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
 
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        public FastReader(String s) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(new File(s)));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt() {
            return Integer.parseInt(next());
        }
 
        long nextLong() {
            return Long.parseLong(next());
        }
 
        double nextDouble() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
 
}

Measured memory_bytes: 23764
#include<stdio.h>
int main(){
    char strt[100];
    char *ptime=strt;
    int i=0;
    int flag=0;
    char strflag[4][10] = {0};
    fgets(strt, sizeof(strt), stdin);
    
    //数字をすべてchar型で読み込みstrflagに一文字ずつ格納していっている。
    while(*ptime){
        //改行文字削除して文字列の最後にNULLを入れる
        if(*ptime=='\n'){
            *ptime='\0';
        }else if(*ptime==' '){  //ひとまとまりの数字を読み込むとflagをインクリメントすることで、flagと数字のまとまりを対応させる
            flag++;
            i=0;
            ptime++;
        }else{
            strflag[flag][i]=*ptime;
            i++;
            ptime++;
        }
    }
    
    /*
    if(atoi(&strflag[0]) > atoi(&strflag[1]) ) printf("a > b\n");
    else if(atoi(&strflag[0])< atoi(&strflag[1]) ) printf("a < b\n");
    else printf("a == b\n");
    */
    
    if( atoi(&strflag[0]) < atoi(&strflag[1]) && atoi(&strflag[1]) < atoi(&strflag[2]) ){
       printf("Yes\n");
       exit(0);
    }
    
    printf("No\n");
}


Measured memory_bytes: 2060
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)       for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

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

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

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int r; cin >> r;
    cout << r*r << endl;

return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define ll long long int 
using namespace std;
typedef string str;

int main ()
{
	//test cases
	str s,t;
    cin>>s>>t;
    str c;
    ll flag=0;
    for (ll i=0;i<t.size();++i)
    {
        c+=t[i];

    }
    for (ll i=0;i<s.size();++i)
    {
        if (s[i]!=t[i])
        {
            flag=1;
            break;
        }
    }
    if (s.size()!=t.size()-1)
    flag=1;

    if (flag)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
    
}

Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

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(a>b){
		a=b;
		return true;
	}
	return false;
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

int main(){
	VS w = {"Sunny","Cloudy","Rainy"};
	string s;
	cin>>s;
	int index=0;
	for(index=0;index<3;index++){
		if(w.at(index)==s)break;
	}
	index++;
	index%=3;
	cout<<w.at(index)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using int64 = long long int;
const int64 MOD = 1e9+7;
const int64 SIZE = 2e5+7;

int64 n;
int a, b, c;
int64 fact[SIZE];

int64 modpow(int64 base, int64 exp) {
    int64 result = 1LL;
    while(exp) {
        if(exp & 1)
            result = result * base % MOD;
        base = base * base % MOD;
        exp >>= 1;
    }
    return result;
}

int64 inv(int64 n) {
    return modpow(n, MOD-2);
}

int64 powcomb(int64 n, int64 k) {
    if(n < k)
        return 0;
    return fact[n] * inv(fact[k]) % MOD * inv(fact[n-k]) % MOD;
}

int main() {
    cin >> n >> a >> b >> c;
    int64 pa = a * inv(a+b) % MOD;
    int64 pb = b * inv(a+b) % MOD;

    fact[1] = fact[0] = 1;
    for(int64 i = 2; i < SIZE; i++)
        fact[i] = i * fact[i-1] % MOD;
    
    int64 result = 0;
    for(int64 k = n; k < 2*n; k++) {
        result += powcomb(k-1, n-1) * modpow(pa, n) % MOD * modpow(pb, k-n) % MOD * k % MOD;
        result += powcomb(k-1, n-1) * modpow(pb, n) % MOD * modpow(pa, k-n) % MOD * k % MOD;
        result %= MOD;
    }
    result = result * 100LL % MOD * inv(100LL - c) % MOD;
    cout << result << endl;
}


Measured memory_bytes: 1792