akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(long long i=0;i<n;++i)
#define REPP(i,m,n) for(long long i=m;i<n;++i)
#define rep(i,n) for(long long i = n-1;i>=0;--i)
#define repp(i,n,m) for(long long i = n-1; i >= m; --i)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
#define pq priority_queue
#define Dcout(N) cout << setprecision(20) << N << endl
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
constexpr long long INFF = 3223372036854775807;

signed main() {
    cin.tie(0);
	ios::sync_with_stdio(false);
    int H,W;cin >> H >> W;
    char S[H][W];
    REP(i,H) REP(j,W) cin >> S[i][j];
    int F[H][W];int L[H][W] = {};
    REP(i,H) REP(j,W){
        if(S[i][j] == '.') F[i][j] = 0;
        else F[i][j] = 1;
    }
    int A = 0;
    REP(i,H){
        if(i > 0 && F[i][0] == 1 && F[i-1][0] == 1) ;
        else A += F[i][0];
        L[i][0] = A;
    }
    A = 0;
    REP(i,W){
        if(i > 0 && F[0][i] == 1 && F[0][i-1] == 1) ;
        else A += F[0][i];
        L[0][i] = A;
    }
    REPP(i,1,H) REPP(j,1,W){
        int B,C;
        if(F[i][j] == 1 && F[i-1][j] == 1) B = L[i-1][j];
        else B = L[i-1][j] + F[i][j];
        if(F[i][j] == 1 && F[i][j-1] == 1) C = L[i][j-1];
        else C = L[i][j-1] + F[i][j];
        L[i][j] = min(B,C);
    }
    
    cout << L[H-1][W-1]<< endl;
    // REP(i,H){
    //     REP(j,W){
    //         cout << L[i][j] << ' ';
    //     }
    //     cout << endl;
    // }
}

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

#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>

using namespace std;


//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int power(int a,int n)
{
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return a*power(a*a,n/2);
    return power(a*a,n/2);
}
const int md = 998244353;
const int inf = (int) 1e18;

/*int inverse(int x){

    return power(x,mod-2)%mod;//little fermat....
}*/


signed main()
{
    showoff;
    /*int n,ans[maxn];
    cin >> n;
    vector<pair<pair<string,int>,int> >v;
    FOR(i,1,n+1){
        int sc;
        string s;
        cin >> s >> sc;
        v.pb({{s,-sc},i});
    }
    sort(v.begin(),v.end());
    FOR(i,0,n)ans[v[i].se] = i+1;
    FOR(i,1,n+1)cout << ans[i] << "\n";*/
    int n,m,p[100];
    cin >> n >> m;
    vector<int>adj[m+5];
    FOR(i,1,m+1){
        int k;
        cin >> k;
        FOR(j,1,k+1){
            int x;
            cin >> x;
            adj[i].pb(x-1);
        }
    }
    int ans = 0;
    FOR(i,1,m+1)cin >> p[i];
    FOR(i,0,(1<<n)){
        bool fo = 1;
        FOR(j,1,m+1){
            int c = 0;
            for(auto &x:adj[j]){
                if(i&(1<<x))++c;
            }
            if(c%2 != p[j]%2)fo = 0;
        }
        if(fo)++ans;
    }
    cout << ans;
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...    

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int A,B,C;
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&C);
	if(A==5&&B==5&&C==7){
		printf("YES");}
	else if(A==5&&B==7&&C==5){
			printf("YES");}
	else if(A==7&&B==5&&C==5){
		printf("YES");}
		else{
			printf("NO");}
			return 0;
}

Measured memory_bytes: 128
i=input
from scipy.optimize import*
t=[list(map(int,i().split()))for _ in[0]*int(i())]
c=lambda k:max([(x-k[0])**2+(y-k[1])**2for x,y in t])
print(c(fmin(c,[500]*2,disp=0))**0.5)

Measured memory_bytes: 27308
n = int(input())
ans_list = [['AC',0],['WA',0],['TLE',0],['RE',0]]
for i in range(0,n):
    s = str(input())
    for j in range(0,4):
        if ans_list[j][0] == s:
            ans_list[j][1] += 1

for j in range(0,4):
    print(ans_list[j][0],'x',ans_list[j][1])


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

int N;
vector<ll> height(1e5+3);

int main(){

    cin >> N;
    for (int i=0; i<N; i++){
        cin >> height.at(i);
    }

    int move_mem = 0, move_tmp = 0;
    for (int i=1; i<N; i++){
        if (height.at(i-1) >= height.at(i)){
            move_tmp++;
        }
        else{
            move_mem = max(move_tmp, move_mem);
            move_tmp = 0;
        }
    }
    move_mem = max(move_tmp, move_mem);

    cout << move_mem << endl;
    return 0;
}

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

#define ll long long int
#define endl "\n"
#define mod 1000000007


int main()
{

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	{
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
#endif
	string s;
	cin >> s;
	if (s == "ABC") {
		cout << "ARC" << endl;
	} else {
		cout << "ABC" << endl;
	}

	return 0;
}

Measured memory_bytes: 3656
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main()
{
  long h, w;
  scanf("%ld", &h);
  scanf("%ld", &w);
  long sum = h * w;
  long o;
  if (h == 1 || w == 1)
  {
    cout << 1 << "\n";
    return 0;
  }
  if (sum % 2 == 1)
  {
    o = sum / 2 + 1;
  }
  else
  {
    o = sum / 2;
  }
  cout << o << "\n";
  return 0;
}

Measured memory_bytes: 256
N = int(input())
l = []
ans = 'Yes'
for i in range(N):
    w = input()
    if w in l:
        ans = 'No'
        break
    l.append(w)
    if i == 0:
        continue
    if l[i-1][-1] != l[i][0]:
        ans = 'No'
        break
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
long long int dist[200005];
    long long int visited[200005];
int main()
{
    ll n,m;
    cin >> n >> m;
    vector< vector <ll > >adj(n);
    for(ll i=0;i<n-1;i++)
    {
        ll x,y;
        cin >> x >> y;
        x--;
        y--;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    queue <ll > q;
    for(ll i=0;i<m;i++)
    {
        ll temp,val;
        cin >> temp>>val;
        temp--;
        dist[temp]+= val;

    }
    q.push(0);
    while(!q.empty())
    {
        long long int f=q.front();
        q.pop();
        visited[f]=1;
        for(long long int i=0;i<adj[f].size();i++)
        {
            if(visited[adj[f][i]]==0)
            {
                dist[adj[f][i]]+=dist[f];
                q.push(adj[f][i]);
            }
        }
    }
    for(long long int i=0;i<n;i++)
    {
        cout << dist[i]<<" ";
    }
    
}


Measured memory_bytes: 20576
module Main where

import           Control.Monad
import           Debug.Trace
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe
import           Data.Ord
import           Data.Vector.Algorithms.Search
import qualified Data.Array                    as A
import qualified Data.Array.Unboxed            as AU
import qualified Data.Array.IO                 as AIO



getvuil :: IO (VU.Vector Int)
getvuil = VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
readi :: BSC8.ByteString -> Int
readi = fst . fromJust . BSC8.readInt
readil :: BSC8.ByteString -> [Int]
readil = map readi . BSC8.words
geti :: IO Int
geti = readi <$> BSC8.getLine
getil :: IO [Int]
getil = readil <$> BSC8.getLine

getNis :: Int -> IO [(Int, BSC8.ByteString)]
getNis 0 = return []
getisl n = do
    [aFst, aSnd] <- BSC8.words <$> BSC8.getLine
    next         <- (getisl (n - 1))
    return ((readi aFst, aSnd) : next)

il2ss :: [Int] -> String
il2ss = unwords . map show

il2sn :: [Int] -> String
il2sn = unlines . map show

main :: IO ()
main = do
    aN <- geti
    let ret = if (mod aN 10) == 7
            then "Yes"
            else if div (mod aN 100) 10 == 7
                then "Yes"
                else if div aN 100 == 7 then "Yes" else "No"
    putStrLn ret


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

 
int main()
{
    int n;
    cin>>n;
    int x=n%10;
    if(x==2|| x==4||x==7||x==9||x==5)
    cout<<"hon"<<endl;
    else if(x==0 || x==1|| x==6|| x==8)
    cout<<"pon"<<endl;
    else
    cout<<"bon"<<endl;
  
   return 0;
}



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

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return float(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	s=RD()
	t=RD()


	ans=10**6
	#print(ans)

	ns=len(s)
	nt=len(t)
	k=ns-nt

	for i in range(k+1):
		cnt=0
		for j in range(nt):
			if s[i+j]!=t[j]:
				cnt+=1
		ans=min(ans,cnt)

	print(ans)














if __name__ == "__main__":
	main()


Measured memory_bytes: 9212
# coding:utf-8


DNA = ["A","C","G","T"]
ng3 = ["AGC","ACG","GAC"]
ng4 = ["ACGC","AGGC","ATGC", "AGAC","AGTC"]
MOD = 10**9 +7

def main():
    N = int(input())
    memo = [{} for i in range(N+1)]
    # ACGTからなる
    # 部分文字列AGCを持たない
        # AGC
    # 隣接する2文字の入れかえを1回することでうえの条件に違反しない
        # ACG
        # GAC
        # A-GC
        # AG-C

    # 4^N個の通り

    # 動的計画法
        # 違反があったやつの打ち切り
        # すでに組み合わせの通りが分かっているやつの省略
    # 再帰
    # count = pow(4,N)
    ans = string_check("",0,N,memo)
    # print(memo)
    print(ans%MOD)

    # print(memo2)
    #print(len(memo))


def string_check(nowstr,i,N,memo):
    # print(nowstr)
    slen = len(nowstr)
    if slen == 3:
        if nowstr in ng3:
            return 0
    if slen == 4:
        if nowstr[-3:] in ng3:
            return 0
        elif nowstr in ng4:
            return 0
    elif slen > 4:
        if nowstr[-3:] in ng3:
            return 0
        elif nowstr[-4:] in ng4:
            return 0
    if nowstr[-3:] in memo[i]:
        return memo[i][nowstr[-3:]]
    elif slen == N:
        return 1
    else:
        count = 0
        for s in DNA:
            count += string_check(nowstr+s,i+1,N,memo)
        if slen >= 4:
            memo[i][nowstr[-3:]] = count
        return count
    


if __name__ == "__main__":
    main()

Measured memory_bytes: 3884
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
 
int main() {
  
  int N;
  cin >> N;

  if(N%10 == 7 || N/100 == 7 || (N/10)%10 == 7) cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 3644
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;$n:expr) => {
        (0..$n).map(|_| scan!()).collect::<Vec<_>>()
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let n = scan!(usize);
    let vs = scan!(i64;n);
    let mut dp = (0..n + 1)
        .map(|_| vec![false; n * 100 + 1])
        .collect::<Vec<Vec<_>>>();

    dp[0][0] = true;
    for (i, &v) in vs.iter().enumerate() {
        for j in 0..dp[i].len() {
            if dp[i][j] {
                if (j + v as usize) < dp[i].len() {
                    dp[i + 1][j + v as usize] = true
                }
                dp[i + 1][j] = true
            }
        }
    }

    for (i, v) in dp[n].iter_mut().enumerate() {
        if i > 1 && i % 10 == 0 {
            *v = false;
        }
    }

    println!(
        "{}",
        dp[n]
            .iter()
            .enumerate()
            .filter(|&(_, v)| *v)
            .last()
            .unwrap()
            .0
    )
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  ll k,q;
  cin >> k >> q;

  vector<ll> d(k);
  rep(i,k) cin >> d[i];

  rep(i,q){
    ll n,x,m;
    cin >> n >> x >> m;
    x%=m;
    vector<ll> td(k);
    ll zcnt=0;
    ll sum=0;
    rep(j,k){
      td[j] = d[j]%m;
      if(td[j]==0)zcnt++;
      sum += td[j];
    }
    ll loop = (n-1)/k;
    ll fin = x + loop*sum;
    //    cout << "loop sum/loop " << loop << " " << sum << endl;

    ll ans = n-1;
    ans -= (fin/m);
    ans -= zcnt*loop;
    //    cout << zcnt << endl;
    //    cout << "after loop " << (fin/m - x/m) << endl;
    //    cout << "after loop " << ans << endl;
    ll pre = fin%m;
    ll c = fin%m;
    //    cout << "fin " << fin << endl;
    //    cout << "pre ans " << ans << endl;
    for(int i= loop*k+1; i<n;i++){
      //      cout << ans << endl;
      c+=d[(i-1)%k];
      c%=m;
      if(pre>=c) ans--;
      pre = c;
    }
    //    cout << "an " <<  c << endl;
    cout << ans << endl;
  }
  


  
  //  cout << endl << endl;
  //  cout << static_cast<double>(clock()) / CLOCKS_PER_SEC << "s"<<endl;
  return 0;
    

}


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

using namespace std;

int main() {
  int ms[10];
  for (int i = 0; i < 10; i++)
    cin >> ms[i];
  sort(ms, ms+10);
  for (int i = 9; i >= 7; i--)
    cout << ms[i] << endl;
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.rbegin(), a.rend());
	long long res = a[0];
	int p = 1, used = 0;
	for (int i = 2; i < n; i++) {
		res += a[p];
		used++;
		if (used == 2) {
			p++; used = 0;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 4048
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#define lol(i,n) for(ll i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
int NOEL(){
  cout<<"No"<<endl;
  return 0;
}
#define N 100010
class RAQxRSQ{
  private:
  ll dat[2*N],laz[2*N];
  ll eval(ll k){
    if(k<N){
      laz[k*2+1]+=laz[k];
      laz[k*2+2]+=laz[k];
    }
    dat[k]+=laz[k],laz[k]=0;
    return dat[k];
  }
  public:
  void init(){
    lol(i,2*N)dat[i]=0,laz[i]=0;
  }
  void add(ll l,ll r,ll x){
    l+=N,r+=N+1;
    for(ll a=l,b=r;a<b;a>>=1,b>>=1){
      if(a&1)laz[a++]+=x;
      if(b&1)laz[--b]+=x;
    }
    for(ll a=l,b=r;a+b;a>>=1,b>>=1){
      dat[a/2]=eval(a)+eval(a^1);
      dat[b/2]=eval(b)+eval(b^1);
    }
  }
  ll qry(ll l,ll r){
    l+=N,r+=N+1;
    for(ll d=20;~d;d--){
      eval(l>>d); eval(r>>d);
    }
    ll res=0;
    for(ll a=l,b=r;a<b;a>>=1,b>>=1){
      if(a&1)res+=eval(a++);
      if(b&1)res+=eval(--b);
    }
    return res;
  }
};RAQxRSQ seg;
ll n,b[N];
ll ten[N];
class setTentou{
  public:
  vector<ll> a;
  ll ten[N],m;
  void sub(bool flip){
    seg.init();
    for(int i=0;i<m;i++){
      ll sum=seg.qry(a[i],N-3);
      if(flip)ten[m-i-1]+=sum;
      else ten[i]+=sum;
      seg.add(a[i],a[i],1);
    }
  }
  void main(){
    m=a.size();
    lol(i,m)ten[i]=0;
    sub(0);
    lol(i,m)a[i]=N-5-a[i];
    lol(i,m/2)swap(a[i],a[m-i-1]);
    sub(1);
  }
  void push(ll x){
    a.push_back(x);
  }
};setTentou ST[2];

ll d[N][3];
int main(){
    cin>>n;
    lol(j,3)lol(i,n)cin>>d[i][j];
    lol(i,n){
      if(d[i][1]%3!=2)return NOEL();
      if(d[i][0]<d[i][2]){
	if(d[i][0]!=d[i][1]-1)return NOEL();
	if(d[i][2]!=d[i][1]+1)return NOEL();
	b[i]=0;
      }
      if(d[i][0]>d[i][2]){
	if(d[i][2]!=d[i][1]-1)return NOEL();
	if(d[i][0]!=d[i][1]+1)return NOEL();
	b[i]=1;
      }
      ll val=d[i][1]/3;
      if(val%2!=i%2)return NOEL();
      ST[i%2].push(val);
    }
    ST[0].main(); ST[1].main();
    lol(i,n)ten[i]=ST[i%2].ten[i/2];
    int cnt[2]={0,0};
    ll sum[2]={0,0};
    lol(i,n){
      sum[i%2]+=ten[i];
      bool need=(b[i]+ten[i])%2;
      if(need)cnt[i%2]++;
    }
    sum[0]/=2,sum[1]/=2;
    bool vl=(cnt[0]+sum[1])%2; if(vl)return NOEL();
    bool vr=(cnt[1]+sum[0])%2; if(vr)return NOEL();
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 9844
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
for i in range(n):
    if a[i] >= b[i]:
        ans += b[i]
    else:
        ans += a[i] + min(b[i] - a[i], a[i+1])
        a[i+1] = max(0, a[i+1] - (b[i] - a[i]))

print(ans)


Measured memory_bytes: 82020
/**
*    author:  souzai32
*    created: 12.08.2020 12:16:11
**/

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

int main() {

    long long n,p;
    cin >> n >> p;
    long long gcd=1,num,i=2;
    int count=0;

    if(n==1) gcd=p;
    else if(n>=40) gcd=1;
    else{
        while(1){
            num=pow(i,n);
            if(p%num) i++;
            else{
                gcd*=i;
                p/=num;
            }
            if(num>p) break;
            //cout << num << endl;
        }
    }

     cout << gcd << endl;

    return 0;
}

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

int main(){
  long long n;	cin >> n;
  if(n%2==1){
    cout << 0;
    return 0;
  }
  
  long long ans=0;
  long long w=10;
  while(w<=n){
    ans+=n/w;
    w*=5;
  }
  cout << ans;
}

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

#define Debug(x) x
typedef int regular_int;
// #define int ll
typedef long long ll;

int B[500];

regular_int main() {
	ios_base::sync_with_stdio(false);
	cout << setprecision(12) << fixed;
int n;
cin >> n;
for (int i = 0; i + 1 < n; ++i) {
    cin >> B[i + 1];

}
B[0] = 1e9;
B[n] = 1e9;

ll res = 0 ;
for (int i = 0; i < n; ++i) {
    res += min(B[i], B[i + 1]);

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


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    if (a == b)
    {
        for (int i = 1; i <= a; i++)
            cout << a;
    }
    else
    {
        for (int i = 1; i <= max(a, b); i++)
            cout << min(a, b);
    }

    return 0;
}

Measured memory_bytes: 888
// 
#include<bits/stdc++.h>
#define pb push_back 
#define mp make_pair
using namespace std;

const int maxn=2e5+7;
typedef long long ll;

int n,m,ans;
int a[maxn];

int main()
{
	int i,j,k,T;
	cin>>n;
	for(i=1;i<=n;++i)
	{
		cin>>a[i];
		ans=max(ans,a[i]);
	}
	
	double b=ans/2.0;
	
	int ans2;
	
	ans2=(a[1]==ans)?a[2]:a[1];
	
	for(i=1;i<=n;++i)
	{
		if(a[i]!=ans && abs(a[i]-b) <abs(ans2-b))
		{
			ans2=a[i];
		}
	}
	
	cout<<ans<<" "<<ans2;
	
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, K;
  cin>>N>>K;
  int tmp;
  for(int i=0;i<N;++i) {
    cin>>tmp;
  }
  if(N<=K) cout<<1<<endl;
  else if((N-K)%(K-1)==0) cout<<1+(N-K)/(K-1)<<endl;
  else cout<<1+(N-K)/(K-1)+1<<endl;
}



Measured memory_bytes: 3644
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <stack>
#define pb push_back
#include <functional>
#include <vector>
#include <queue>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) a.size()
using namespace std;
int n,m;
vector<pii> G[52];
int fr=1;
int road[52][52];
int e[52][52];
int v[52];
int main()
{
	int a;
	scanf("%d",&a);
	int x1=a%10;
	a/=10;
	int x2=a%10;
	a/=10;
	int x3=a%10;
	a/=10;
	int x4=a%10;
	//cout<<x1<<" "<<x2<<" "<<x3<<" "<<x4;
	bool fg = false;
	if(x4==x3&&x2==x3) fg=true;
	if(x3==x2&&x2==x1) fg=true;
	puts(fg?"Yes":"No");
    return 0;
}


Measured memory_bytes: 256
N = int(input())
input_array = list(map(int, input().split()))

upper = False
lower = False
res = 1
for i in range(len(input_array) - 1):
    if input_array[i] == input_array[i + 1]:
        continue
    elif input_array[i] < input_array[i + 1]:
        upper = True
    else:
        lower = True

    if upper is True and lower is True:
        res += 1
        upper = False
        lower = False

print(res)

Measured memory_bytes: 14224
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int dp[100010];

int main()
{
	ll n;cin >> n;
	
	REP(i,n)dp[i] = n;
	
	dp[1] = 1;
	
	bool flag = true;
	while(flag)
	{
		flag = false;
		for(int i = 1;i < n;i++)
		{		
			int tmp = i;
			while(dp[(tmp*10)%n] > dp[tmp])
			{
				dp[(tmp*10)%n] = dp[tmp];
				flag = true;
				tmp = (tmp*10)%n;
			}
			if(dp[(i+1)%n]>dp[i]+1)
			{
				flag = true;
				dp[(i+1)%n] = dp[i]+1;
			}
		}
	}	
	
	cout << dp[0] << endl;
	
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int a = Integer.parseInt(scanner.next());
    int b = Integer.parseInt(scanner.next());
    int count = a <= b ? a : a - 1;
    System.out.println(count);
    scanner.close();
  }
}

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

ll n;

void func(ll cur,int use,int &counter){
  if (cur>n) return;
  if (use==0b111) ++counter;
  func(cur*10+3,use|0b100,counter);
  func(cur*10+5,use|0b010,counter);
  func(cur*10+7,use|0b001,counter);
}

int main() {
  cin >> n;
  int ans=0;
  func(0,0,ans);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

dp = [[-10**18 for i in range(N//2+1)] for j in range(2)]

dp[0][0] = 0
dp[1][1] = A[0]
dp[1][0] = 0

for i in range(2,N+1):
    high = min(N//2, i//2+10)
    low = max(0,i//2-10)
    for j in range(high,low,-1):
        dp[i%2][j] = max(dp[(i-1)%2][j], dp[i%2][j-1] + A[i-1])
print(dp[N%2][N//2])



Measured memory_bytes: 100972
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U> bool chmax(T &a, U b) { if (a <= b) {a = b; return 1;} return 0; }
template <class T, class U>  bool chmin(T &a, U b) { if (a > b) { a = b; return 1; } return 0; }
template <typename T>  ostream &operator<<(ostream &os, vector<T> &v) { os << "{"; rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); } os << "}"; return os; }

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)

int main() {
    ll x=0,y=0,z=0,n,m,ans=0,sum=0,k,w,Max=-1,Min=1e9+1;
    bool ok = true;
    string s,t,u;
    cin >> s >> t >> u;
    char c='a';
    while(1){
      if(c=='a'){
        if(s.size()==0){
           cout << 'A' << endl;
           return 0;
        }
        c = s[0];
        s = s.substr(1,s.size()-1);
      }
      if(c=='b'){
        if(t.size()==0){
          cout << 'B' << endl;
          return 0;
        }
        c = t[0];
        t = t.substr(1,t.size()-1);
      }
      if(c=='c'){
        if(u.size()==0){
          cout << 'C' << endl;
          return 0;
        }
        c = u[0];
        u = u.substr(1,u.size()-1);
      }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
int main() {
	string S;
	cin>>S;
	int ans=700;
	if(S[0]=='o')ans+=100;
	if(S[1]=='o')ans+=100;
	if(S[2]=='o')ans+=100;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
r, g, b, n = map(int, input().split())
c = 0

for i in range(n // r + 1):
  for j in range(n // g + 1):
    # print((i, j))
    t = n - i*r - j*g
    # print(t)
    if t >= 0 and t % b == 0:
      c += 1
print(c)


Measured memory_bytes: 40812
m,d = list(map(int, input().split())) 
cnt = 0
for  j in range(1,m+1):
    for i in range(1, d+1, 1):
        d1 = i % 10
        d2 = int(i / 10)
        if((d1 >= 2) & (d2 >= 2) & (d1 * d2 == j) ):
            cnt+=1
print(cnt)
            

Measured memory_bytes: 3064
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;




int main(){

	int table[5];

	for(int i = 0; i < 5; i++){

		scanf("%d",&table[i]);
	}

	for(int i = 0; i < 5; i++){

		if(table[i] == 0){

			printf("%d\n",i+1);
			return 0;
		}
	}

	return 0;
}


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

void prt(int A[],int n){
    for(int i=0;i<n;++i){
        if(i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}

void insertSort(int A[],int n){
    for(int i=1;i<n;++i){
        int v=A[i];
        int j=i-1;
        while(A[j]>v&&j>=0){
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=v;
        prt(A,n);
    }
}
int main()
{
    int n;
    int A[100];
    scanf("%d",&n);
    for(int i=0;i<n;++i) scanf("%d",&A[i]);
    prt(A,n);
    insertSort(A,n);
    return 0;
}

Measured memory_bytes: 3212
s=0
S=list(input())
c=len(S)
if S[-1]=="A" or S[-1]=="G" or S[-1]=="C" or S[-1]=="T":
  k=1
else:
  k=0
for i in range(c-1):
  for j in range(i+1,c+1):
    if j-i<=k:
      continue
    t=set(S[i:j])
    if "A" in t:
      s+=1
    if "C" in t:
      s+=1
    if "T" in t:
      s+=1
    if "G" in t:
      s+=1
    if s==len(t):
      k=j-i
    s=0
print(k)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

int n, m, ans;
vector<vector<int>> adj;
vector<bool> used;

void solve(int step, int x) {
	if (used[x]) return;
	if (step == n - 1) {
		ans++;
	}
	else {
		used[x] = true;
		for (auto p : adj[x]) {
			solve(step + 1, p);
		}

		used[x] = false;
	}
}

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

	cin >> n >> m;
	int i, j, k, a, b;
	adj.resize(n + 1);
	for (i = 0; i < m; i++) {
		cin >> a >> b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}

	used.assign(n + 1, false);
	ans = 0;
	solve(0, 1);
	cout << ans << "\n";


	return 0;
}



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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;

int main()
{
    int n , k , s ;

    scanf("%d %d %d",&n,&k,&s) ;

    vector <int> ans ;

    for(int i=1 ; i<=k ; i++) ans.pb(s) ;

    if(s==INF)
    {
        for(int i=1 ; i<=n-k ; i++) ans.pb(1) ;
    }
    else{
        for(int i=1 ; i<=n-k ; i++) ans.pb(s+1) ;
    }

    for(int i=0 ; i<ans.size() ; i++) printf("%d ",ans[i]) ;
    printf("\n") ;

    return 0 ;
}


Measured memory_bytes: 1784
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <string>

using namespace std;

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

    vector<int> a(n, 0);
    int prev = -1;
    for(int i = 0; i < n; i++){
        int tmp;
        cin >>tmp;
        if(prev+1 == tmp){
            a[prev-1] = 1;
        }
        prev = tmp;
    }
    int bsum = 0;
    for(int i = 0; i < n; i++){
        int tmp;
        cin >>tmp;
        bsum += tmp;
    }
    for(int i = 0; i < n-1; i++){
        int tmp;
        cin >>tmp;
        if(a[i] == 1){
            bsum += tmp;
        }
    }

    printf("%d\n", bsum);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int infn = -1e18;

struct edge {
  int to, c;
  edge(){};
  edge(int _to, int _c) {
    to = _to;
    c = _c;
  };
};

signed main() {
  int n, m;
  cin >> n >> m;
  vector<vector<edge>> g(n);
  vector<int> d(n, infn);
  d[0] = 0;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    g[a].push_back(edge(b, c));
  }
  for (int i = 0; i < n; i++) {
    for (int i = 0; i < n; i++) {
      if (d[i] == infn) continue;
      for (auto &&w : g[i]) {
        d[w.to] = max(d[w.to], d[i] + w.c);
      }
    }
  }
  int ans = d[n - 1];

  for (int i = 0; i < n; i++) {
    for (int i = 0; i < n; i++) {
      if (d[i] == infn) continue;
      for (auto &&w : g[i]) {
        d[w.to] = max(d[w.to], d[i] + w.c);
      }
    }
  }
  if (ans < d[n - 1])
    cout << "inf" << endl;
  else
    cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define INF 1e9
using namespace std;
typedef pair<int,int> P;

struct Graph{
    Graph(int n):E(n),d(n),N(n){};
    vector<vector<P>>E;
    vector<int>d;
    int N;
    void add_edge(int a,int b,int c){
        E[a].emplace_back(b,c);
    }
    bool bellmanFord(int s, int t=0){
        fill(d.begin(),d.end(),INF);
        d[s]=0;
        for(int i=0;i<N;++i)
            for(int j=0;j<N;++j)
                for(P& p:E[j])
                    if(d[j]!=INF&&d[j]+p.second<d[p.first]){
                        d[p.first]=d[j]+p.second;
                        //if(i==N-1&&p.first==t)return false;
                        //if check after destination route
                        if(i==N-1)return false;
                    }
        return true;
    }
    int get_cost(int n){
        return d[n];
    }
};

main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int V,E,r;
    cin>>V>>E>>r;
    Graph G(V);
    for(int i=0;i<E;++i){
        int s,t,d;
        cin>>s>>t>>d;
        G.add_edge(s,t,d);
    }
    if(G.bellmanFord(r))
        for(int i=0;i<V;++i){
            int x = G.get_cost(i);
            if(x==INF) cout<<"INF"<<endl;
            else cout<<x<<endl;
        }
        else cout<<"NEGATIVE CYCLE"<<endl;
}

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

int main() {
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);

    sort(a.begin(), a.end());
    int count = 0;
    rep(i, n-1) {
        if(x >= a.at(i)) {
            x -= a.at(i);
            count++;
        } else break;
    }
    if(x == a.at(n-1)) count++;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int DIV=1000000000+7;
long myPow(long x, long n, long m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

long myFact(long i,long j){//i*i+1*....*i+j-1
    if(j==0)
        return 1;
    else
        return myFact(i,j-1)*(i+j-1)%DIV;
}


int main(){
    long N;
    cin >> N;
    
    long m;
    if(N%2==0)
        m=N/2;
        
    else
        m=(N-1)/2;
    long A[m];
    long fact[N];
    long invfact[N];
//    long kaijo = fact(1,N-m-1);
//    A[0] = fact(1,N-1);
//    A[1] = A[0];
//    cout << A[1]<<endl;
//    A[1] /=  (N-1)*(N-2);
//    cout << A[1]<<endl;
//    A[1] *= (N-2)*(N-3);
//    cout << A[1]<<endl;
//    B[1] = fact(1,N-2) *fact(N-3,1);
//    cout << A[1]<<endl;
//    cout <<B[1]<<endl;
//    A[m-1] = kaijo*kaijo*(N-m);
    fact[0]=1;
    for(int i=0;i<N-1;i++){
        fact[i+1]=fact[i]*(i+1)%DIV;
    }
    invfact[N-1] = myPow(fact[N-1],DIV-2,DIV);
    for(int i=N-1;i>0;i--){
        invfact[i-1]=invfact[i] * i % DIV;
    //    cout << invfact[i-1]*fact[i-1]%DIV <<endl;
    }
    for(long i=0;i<m;i++){
        A[i] = (fact[N-i-1]*fact[N-i-2]%DIV) * invfact[N-i-i-2] % DIV;
//        cout<<"myFact:"<<myFact(1,N-i-1)*myFact(N-i-i-1,i)%DIV <<"Ai:"<<A[i]<<endl;
    }
    long ret;
//    for(int i=0;i<m;i++){
//        A[i] %= DIV;
//        if (0<i&&i<10) cout<<(B[i]-A[i])%DIV<<endl;
//    }
    ret = A[0] * (N-1) % DIV;
    for(int i=1;i<m;i++){
        ret += DIV;
        ret -= A[i];
//        cout<<"i:"<<i<<endl;
    }
    ret %= DIV;
    cout << ret << endl;
    

}

Measured memory_bytes: 19712
#include <bits/stdc++.h>
using namespace std;
bool vis[101];
int main(void) {
    int n, x;
    while(~scanf("%d", &n)) {
        memset(vis, 0, sizeof(vis));
        int cnt = 0;
        while(n--) {
            scanf("%d", &x);
            if(!vis[x]) {
                ++cnt;
                vis[x] = 1;
            }
        }
        printf("%d\n", cnt);
    }
}


Measured memory_bytes: 256
//                          **********  YATIN KWATRA  ********** 

#include <bits/stdc++.h>
#define ll                      long long 
#define ld                      long double
#define ull                     unsigned long long 
#define FIO                     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl                    "\n"
#define fo(i,a,b)               for(int i = a; i<=b ; i++)
#define rfo(i,a,b)              for(int i = a; i>=b ; i--)
#define vii                      vector<int>
#define vll                     vector<ll>
#define pq                      priority_queue
#define uom                      unordered_map                
#define all(v)                  v.begin(),v.end()
#define mp                      make_pair
#define pb                      push_back
#define pob                     pop_back
#define ff                      first
#define ss                      second
#define pii                     pair<int,int> 
#define pll                     pair<long,long>
#define mll                     map<ll,ll>
#define mii                     map<int,int>
#define vvii                    vector<vii>
#define vvll                    vector<vll>
#define mod                     1000000007
#define pi                      3.1415926535897932384626433832795
// #define node                    Node


using namespace std;

void INPUT() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

}


void solve()
{ 
       string s1,s2;
       cin >> s1 >> s2;

       int i = 0 ,j = 0;

       int n1 = s1.length();
       int n2 = s2.length();

       int cnt = 0;

       while(i<min(n1,n2))
       {
         if(s1[i] != s2[j]) cnt++;

         i++;
         j++;
       }

       cnt += n1-i;
       cnt += n2-j;

       cout << cnt << endl;
       
}
int main() {
    
    FIO
    INPUT();
    
    int t;
    t = 1;
    //cin >> t;
    
    while(t--)
    {
       solve();
    }
    return 0;
}


Measured memory_bytes: 3800
n, a, b = map(int, input().split())
mod = 1000000007

def cmb(N, x):
    numerator = 1
    for i in range(N-x+1, N+1):
        numerator = numerator * i % mod
    denominator = 1
    for j in range(1, x+1):
        denominator = denominator * j % mod
    d = pow(denominator, mod-2, mod)
    return numerator * d
 
a = cmb(n, a)
b = cmb(n, b)

total=(pow(2,n)-(1+a+b))%mod

print(total)


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

int D[1001][1001] = {{0}};
string S,T;

int equal(char c,char d){
	if(c==d) return 0;
	else return 1;
}

int main(){
	cin >> S >> T;
	int n = S.size(),m = T.size();
	for(int i=0;i<=n;i++){
		for(int j=0;j<=m;j++){
			if(i==0) D[i][j] = j;
			else if(j==0) D[i][j] = i;
			else D[i][j] = min(D[i-1][j-1]+equal(S[i-1],T[j-1]),min(D[i-1][j]+1,D[i][j-1]+1));
		}
	}
	cout << D[n][m] << endl;
}


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

int main(){
    int N, M, X, Y;
    int x[101], y[101];
    cin >> N >> M >> X >> Y;
    for(int i = 0; i < N; i++){
        cin >> x[i];
    }
    for(int i = 0; i < M; i++){
        cin >> y[i];
    }
    int max = x[0];
    int min = y[0];
    for(int i = 1; i < N; i++){
        if(max < x[i]) max = x[i];
    }
    for(int i = i; i < M; i++){
        if(min > y[i]) min = y[i];
    }
    bool wars = false;
    for(int i = X + 1; i <= Y; i++){
        if(max < i && i <= min){
            wars = true;
            break;
        }
    }
    if(wars) cout << "No War" << endl;
    else cout << "War" << endl;
    return 0;
}

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

using namespace std;


int main() {
	char x;
	cin >> x;
	if (x >= 'A' && x <= 'Z') cout << "A" << endl;
	else cout << "a" << endl;
	// cout << select(N) << endl;
	return 0;
}


Measured memory_bytes: 3596
import Data.List

main = do
  [n, m, a, b] <- map read . words <$> getLine :: IO [Int]
  x <- sort . map read . words <$> getLine :: IO [Int]
  y <- sort . map read . words <$> getLine :: IO [Int]
  if maximum (a:x) < minimum (b:y)
    then putStrLn "No War"
    else putStrLn "War"


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

const int N = 1e5 + 10;
int n;
set<string> s;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++) {
		string str;
		cin >> str;
		s.insert(str);
	}	
	cout << s.size() << "\n";
	
	return 0;
}

Measured memory_bytes: 19280
//IncubatorMan
#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 __gnu_pbds;
using namespace std;
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve(){
    char arr[5];
    cin>>arr;
    bool ans= false;
    for(int i=0;i<3;i++){
        if(arr[i]=='7') ans = true;
    }
    if(ans)cout<<"Yes\n";
    else cout<<"No\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
        int test=1;
        //read(test);
        while(test--){
            solve();
        }
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cmath>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
using namespace std;
#define INF 1000000007
#define ll long long
#define rep(i, start, end) for(ll i=(ll)start; i<(ll)end; i++)
#define print(a) cout << a << endl;
#define printarray(a, len) rep(i,0,len) cout << a[i] << " ";

string bit(ll n, ll k){
  string b = "";
  rep(i, 0, k){
    b += to_string(n % 2);
    n /= 2;
  }
  return b;
}

bool check(string b, ll s[], ll p){
  //printarray(s, sizeof(*s)/sizeof(ll));
  ll count = 0;
  bool ans;
  rep(i, 1, s[0] + 1){
    if (b[s[i] - 1] == '1') count++;
  }
  if (count % 2 == p){
    return true;
  }else return false;
}

int main(){
  ll n, m, count=0;
  ll s[11][11] = {};
  ll p[11] = {};
  cin >> n >> m;
  rep(i, 0, m){
    cin >> s[i][0];
    rep(j, 0, s[i][0]){
      cin >> s[i][j+1];
    }
  }
  rep(i, 0, m) cin >> p[i];
  
  rep(i, 0, pow(2, n)){
    string b = bit(i, n);
    bool flag = true;
    //print(b);
    rep(j, 0, m){
      if (check(b, s[j], p[j]) == false){
        flag = false;
        break;
      }
    }
    //print(flag);
    if (flag == true) count++;
  }
  
  print(count); 
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        for(int i=1; i<=1250; i++) {
            if((int)Math.floor(i*0.08)==a && (int)Math.floor(i*0.10)==b) {
                System.out.println(i);
                return;
            }
        }
        System.out.println(-1);
    }
}


Measured memory_bytes: 22100
#include <iostream>
#include <cstdio>
#include <cstring>
#define N 102
using namespace std;
string s;
int main() {
  cin>>s;
  int n = s.size();
  int cnt=0;
  for (int i = 0; i < n; ++i) {
    if (i == 0) {
      cnt++;
    } else {
      if (s[i] != s[i-1]) cnt++;
    }
  }
  cout<<cnt-1<<endl;
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)

const int mx=100010;
const ll mod=1e9+7;

ll x,y,ans=0;

int main(){
  cin >> x >> y;
  while(x<=y){
    x *= 2;
    ans++;
  }
  
  
  cout<< ans <<endl;
  return 0;  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		while (sc.hasNext()) {
			int cnt = 0;
			int n = sc.nextInt();
			for (int a = 0; a <= 9; a++)
			for (int b = 0; b <= 9; b++)
			for (int c = 0; c <= 9; c++)
			for (int d = 0; d <= 9; d++)
				if (a + b + c + d == n) cnt++;
			System.out.println(cnt);
		}

	}

}

Measured memory_bytes: 18852
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
3 2
1 2
5 5
-2 8
---+/
/+---test
3 4
-3 7 8 2
-12 1 10 2
-2 8 9 3
---+/
/+---test
5 1
1
2
3
4
5
---+/

void main(string[] args) {
  long N, D;
  readf(" %d %d ", &N, &D);

  long[][] pts;
  pts.length = N;
  foreach (ref pt; pts) {
    pt = readln.split.map!(to!long).array;
  }

  long ans;
  foreach (i; 0..N) {
    foreach (j; i+1..N) {
      long distpow;
      foreach (k; 0..D) {
        distpow += pow(pts[i][k] - pts[j][k], 2);
      }
      ans += !!(distpow.to!double.sqrt.to!long.pow(2) == distpow);
    }
  }
  ans.writeln;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp14
{
    class Class5
    {
        static void Main()
        {
            var I = Console.ReadLine().Split().Select(int.Parse).ToArray();
            double W = I[0];
            double H = I[1];
            double x = I[2];
            double y = I[3];
            //対角線上あるかどうか 0 のとき？
            //y = y/x + y0
            bool frag = y == H / 2 && x == W / 2;
            int i = frag ? 1 : 0;

            Console.WriteLine($"{W*H/2} {i}");
        }
    }
}


Measured memory_bytes: 13268