akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

//sからtへの最大流を求める(Dinic法)
//計算量 O(E*V^2)

template<typename T>
struct Max_Flow{
    struct edge{
        int to; T cap; int rev;
        edge(int to, T cap, int rev) : to(to), cap(cap), rev(rev) {}
    };

    vector<vector<edge>> es;
    vector<int> d, pos;
    const T INF_T;

    Max_Flow(int n) : INF_T(numeric_limits<T>::max()){
        es.resize(n), d.resize(n), pos.resize(n);
    }

    void add_edge(int from, int to, T cap){
        es[from].eb(to, cap, sz(es[to]));
        es[to].eb(from, 0, sz(es[from])-1);
    }

    bool bfs(int s, int t){
        fill(all(d), -1);
        queue<int> que;
        d[s] = 0, que.push(s);
        while(!que.empty()){
            int i = que.front(); que.pop();
            for(auto &e: es[i]){
                if(e.cap > 0 && d[e.to] == -1){
                    d[e.to] = d[i]+1;
                    que.push(e.to);
                }
            }
        }
        return d[t] != -1;
    }

    T dfs(int now, int t, T flow){
        if(now == t) return flow;
        for(int &i = pos[now]; i < sz(es[now]); i++){
            edge &e = es[now][i];
            if(e.cap > 0 && d[e.to] > d[now]){
                T f = dfs(e.to, t, min(flow, e.cap));
                if(f > 0){
                    e.cap -= f;
                    es[e.to][e.rev].cap += f;
                    return f;
                }
            }
        }
        return 0;
    }

    T max_flow(int s, int t){
        T flow = 0;
        while(bfs(s, t)){
            fill(all(pos), 0);
            T f = 0;
            while((f = dfs(s, t, INF_T)) > 0) flow += f;
        }
        return flow;
    }
};

int main(){
    int V, E;
    cin >> V >> E;
    Max_Flow<int> G(V);
    rep(i, E){
        int u, v, c; cin >> u >> v >> c;
        G.add_edge(u, v, c);
    }
    cout << G.max_flow(0, V-1) << endl;
}


Measured memory_bytes: 3180
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let h=read::<i32>();
    let w=read::<i32>();
    let s=(0..h).map(|_|read::<String>().chars().collect::<Vec<char>>()).collect::<Vec<Vec<char>>>();
    let dx=vec![0,1,0,-1,1,1,-1,-1];
    let dy=vec![1,0,-1,0,1,-1,1,-1];
    for i in 0..h{
    	for j in 0..w{
    		if s[i as usize][j as usize]=='#'{print!("#")}
    		else {
    			let mut c=0;
    			for r in 0..8{
    				let x=i+dx[r];
    				let y=j+dy[r];
    				if x>=0&&y>=0&&x<h&&y<w&&s[x as usize][y as usize]=='#'{c+=1}
    			}
    			print!("{}",c)
    		}
    	}
    	println!("")
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
int main(){
  string S, T;
  cin >> S >> T;
  vector<int> s(26, -1), t(26, -1);
  int count_s = 0, count_t = 0;
  
  rep(i, S.size()){
    char c_s = S[i] - 'a';
    if (s[c_s] == -1){
      s[c_s] = count_s;
      count_s++;
    }
    char c_t = T[i] - 'a';
    if (t[c_t] == -1){
      t[c_t] = count_t;
      count_t++;
    }
    if (s[c_s] != t[c_t])
    {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

int main() {
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    int ans = 0;
    for (int x = 0; x <= N; x++) {
        for (int y = 0; y <= N; y++) {
            int tmp = N - R * x - G * y;
            if (tmp >= 0 && tmp % B == 0) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
import math
import string
import fractions
import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop

# from itertools import accumulate
# from collections import deque
import random

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)


def main():
    n = int(input())
    l = list(map(int, input().split()))

    eprint("=======================")
    while True:
        xx = min([x for x in l if x > 0])
        # eprint("min_index: "+str(min_index))
        eprint("xx: "+str(xx))
        flag = 0
        for i in range(len(l)):
            if l[i] == xx and flag == 0:
                flag=1
            else:
                l[i] = l[i]%xx

        # eprint(l)
        if all(x==l[0] for x in l):
            # eprint(l)
            print(l[0])
            return 0
        if 1 in l:
            print(1)
            return 0
        if sum(l)==xx:
            print(xx)
            return 0
        eprint("=======================")

    print(xx)
    return 0


if __name__ == '__main__':
    main()


Measured memory_bytes: 89108
#include <bits/stdc++.h>
//#include <eigen3/Eigen/Dense>
using namespace std;
//using namespace Eigen;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v) cout << i << ' ' << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vin2(v, w) for (ll i = 0; i < v.size(); ++i) cin >> v[i] >> w[i];
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 (a > b) { a = b; return 1; } return 0; }
int dx[] = { 0, 0, -1, 1 };
int dy[] = { 1, -1, 0, 0 };
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(18);
	int x;
	cin >> x;
	if(x == 0) cout << 1;
	else cout << 0;
	return 0;
}

Measured memory_bytes: 3644
def main():
    n, k = [int(x) for x in input().split()]
    teleporter = [int(x) - 1 for x in input().split()]
    route = []
    route_append = route.append
    seen = [False] * n
    traveled, now_i = 0, 0

    while traveled < n + 100:
        if seen[now_i]:
            # テレポートがループしたら，ルート調査は終了する。
            break
        route_append(now_i)
        seen[now_i] = True
        now_i = teleporter[now_i]
        traveled += 1

    # 調査終了後，now_1 はループ部分の頭。ループ前にイントロがある。
    # ループ頭は何番目に尋ねるか？
    # intro_length = [i for i, x in enumerate(route) if x == now_i][-1]
    intro_length = route.index(now_i)
    loop_length = len(route) - intro_length
    if k >= intro_length:
        arriving_i = intro_length + (k - intro_length) % loop_length
    else:
        # k が イントロ内に収まっている場合。
        arriving_i = k
    return route[arriving_i] + 1


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 32224
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

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

using namespace std;

int main()
{
  int n, q;
  cin >> n >> q;
  
  string S;
  cin >> S;
  
  vector<int> l(q), r(q);
  rep(i,q) cin >> l[i] >> r[i];
  
  vector<int> ac(n,0);
  for(int i=0; i<n; i++)
  {
    if(S.substr(i,2) == "AC") ac[i] = 1;
    else ac[i] = 0;
  }
  
  //  0 1 0 1 0 0 1 0
  //  A C A C T A C G
  //  0 1 1 2 2 2 3 3
  
//for(int val: ac) cout << val;
//cout << endl;
  
  vector<int> sum(n, 0);
  for(int i=1; i<n; i++)
  {
    sum[i] = sum[i-1] + ac[i-1];
  }
//  sum[n-1] = sum[n-2];
  
//  for(int val: sum) cout << val;
//	cout << endl;  
  
  for(int i=0; i<q; i++)
  {
    int left = sum[l[i]-1];
    int right = sum[r[i]-1];
    
//    cout << left << ", " << right << endl;
    
    cout << right - left << endl;
  }
  
//  rep(i,q) cout << sum[r[i]-1] - sum[l[i]-1] << endl;
  
  return 0;
}

Measured memory_bytes: 2688
#include <iostream>
using namespace std;
int main() {
	int n, m, sum, a[100][100], b[100];
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			cin >> a[i][j];
	for (int i = 0; i < m; i++) 
        cin >> b[i];
	for (int i = 0; i < n; i++) {
		sum = 0;
		for (int j = 0; j < m; j++)
			sum += a[i][j] * b[j];
		cout << sum << '\n';
	}	
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1000000000 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    int ss[N];
    REP(i, N){
        ss[i] = (S[i]==')');
    }
    /*
    REP(i, N){
        cout << ss[i] << " ";
    }
    cout << endl;
    */
    int a=0, b=0;
    REP(i, N){
        if(ss[i]==1){
            a--;
            a = max(a, 0);
        }else{
            a++;
        }
        if(ss[N-i-1]==0){
            b--;
            b = max(b, 0);
        }else{
            b++;
        }
    }
    //cout << a << b << endl;
    REP(i, b) cout << '(';
    cout << S;
    REP(i, a) cout << ')';
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))

dp = [float('inf')] * n
dp[0] = 0

for i in range(1, n):
  for ki in range(1, k+1):
    if ki > i:
      continue
    dp[i] = min(dp[i], dp[i-ki] + abs(a[i] - a[i-ki]))
    #print(i, ki, dp[i-ki] + abs(a[i] - a[ki]), dp)

print(dp[-1])

Measured memory_bytes: 55392
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <complex>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,n) for(int i = 0; i < (n); i++)
#define ten(x) ((int)1e##x)

using namespace std;

int main(){
	int n; cin >> n;
	int q; cin >> q;
	vector<int> A(n,2147483647);
	int interval = sqrt(n);
	vector<int> B(n / interval + 1,2147483647);

	FOR(i,q){
		int com, x, y; cin >> com >> x >> y;
		if(com == 0){
			A[x] = y;
			int s = x/interval;
			int tmp = A[s*interval];
			// cout << "upd:" << x << " " << y << " " ;
			for(int j = s * interval; j < min((s+1)*interval,n); j++)
				tmp = min(A[j],tmp);
			B[s] = tmp;
			// cout << s << " " << B[s] << endl;

		}
		if(com == 1){
			int tmp = A[x];
			int j = x;
			// cout << "fin:"<< x << " " << y << endl;
			// FOR(ii,B.size()) cout << B[ii] << " ";
			// cout << endl;
			// FOR(ii,A.size()) cout << A[ii] << " ";
			// cout << endl;
			while(j <= y){
				// cout << j << " ";
				if(j % interval == 0 && y - j >= interval - 1){
					tmp = min(B[j/interval], tmp);
					j += interval;
				}
				else{
					tmp = min(A[j],tmp);
					j++;
				}
			}
			// cout << "ans:" << tmp << endl << endl;
			cout << tmp << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1532
// D - Wizard in Maze
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(int)(s);i<(int)(e);++i)

// ダイクストラ　O(ElogV)
using PR = pair<int, int>;
#define INF 1'000'000'000
vector<vector<PR>> G; // [from]<to, cost> 隣接リスト
int V; // 頂点数(max:10^3*10^3=10^6)

vi dijkstra(int s){
	vi dist(V, INF);
	dist[s] = 0;
	priority_queue<PR, vector<PR>, greater<PR>> pq; // <dist, u>
	pq.push({0, s});
	while(pq.size()){
		int d, u; tie(d, u) = pq.top(); pq.pop();
		if(dist[u] < d) continue;
		for(auto e:G[u]){
			int v = e.first, next_d = e.second + dist[u];
			if(dist[v] <= next_d) continue;
			dist[v] = next_d;
			pq.push({dist[v], v});
		}
	}
	return dist;
}

PR dhw[] = { // <h, w>
        { 1, 0},
{ 0,-1},        { 0, 1},
        {-1, 0},
{ 2,-2},{ 2,-1},{ 2, 0},{ 2, 1},{ 2, 2},
{ 1,-2},{ 1,-1},        { 1, 1},{ 1, 2},
{ 0,-2},                        { 0, 2},
{-1,-2},{-1,-1},        {-1, 1},{-1, 2},
{-2,-2},{-2,-1},{-2, 0},{-2, 1},{-2, 2}
};

int main(){
	int H, W; cin>>H>>W;
	int sh, sw, eh, ew; cin>>sh>>sw>>eh>>ew; sh--, sw--, eh--; ew--;
	string S[H]; rp(i, 0, H) cin>>S[i];

	V = H * W;
	G.resize(V); // 隣接リスト初期化
	rp(u, 0, V){
		int h = u / W, w = u % W;
		rp(i, 0, 4){
			int nx_h = h + dhw[i].first, nx_w = w + dhw[i].second;
			if(nx_h < 0 || H <= nx_h || nx_w < 0 || W <= nx_w) continue;
			if(S[nx_h][nx_w] == '#') continue;
			int v = nx_h*W + nx_w;
			G[u].emplace_back(v, 0);
		}
		rp(i, 4, 24){
			int nx_h = h + dhw[i].first, nx_w = w + dhw[i].second;
			if(nx_h < 0 || H <= nx_h || nx_w < 0 || W <= nx_w) continue;
			if(S[nx_h][nx_w] == '#') continue;
			int v = nx_h*W + nx_w;
			G[u].emplace_back(v, 1);
		}
	}

	int st = sh*W + sw, ed = eh*W + ew;
	vi dist = dijkstra(st);
	cout<< (dist[ed]==INF? -1:dist[ed]) <<endl;
}


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

int main(){
    ull a,b;
    cin >> a >> b;
    if(a==1||b==1)
        cout << 1;
            else
    cout << (a*b+1)/2;



    return 0;
}








Measured memory_bytes: 3640
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 28;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
int dp[200][200];
int ct[200];
int cb[200];

int main(){
	int n;
	cin >> n;
	fill(&dp[0][0], &dp[199][199] + 1, INF);
	rep(i, n){
		cin >> ct[i] >> cb[i];
		dp[i][i] = 0;
	}
	rep2(w, 2, n + 1){
		rep(i, n){
			rep2(j, 1, w){
				dp[i][i+w-1] = min(dp[i][i+w-1],
					dp[i][i+j-1] + dp[i+j][i+w-1] + ct[i] * cb[i+j-1] * ct[i+j] * cb[i+w-1]);

			}
		}
	}
	cout << dp[0][n-1] << endl;
	return 0;
}

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


using ll = long long int;

using namespace std;


const int MAX_M = 20;
const int MAX_N = 50;

ll path[MAX_M];

int depth[MAX_N];
int parent[MAX_N];

vector<vector<int>> g(MAX_N);

void dfs(int v)
{
    for(auto u: g[v])
    {
        if (u == parent[v]) continue;
        depth[u] = depth[v] + 1;
        parent[u] = v;
        dfs(u);
    }
    return;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int i, j, n, m, a ,b;
    
    cin >> n;
    
    for(i = 0; i < n - 1; ++i)
    {
        cin >> a >> b;
        --a, --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    
    parent[0] = -1;
    dfs(0);
    
    cin >> m;
    
    for(i = 0; i < m; ++i)
    {
        cin >> a >> b;
        --a, --b;
        if (depth[a] < depth[b]) swap(a, b);
        // a >= b
        while (depth[b] < depth[a])
        {
            path[i] |= (1LL << a);
            a = parent[a];
        }
        while (a != b)
        {
            path[i] |= (1LL << a);
            a = parent[a];
            path[i] |= (1LL << b);
            b = parent[b];
        }
        //cout << path[i] << endl;
    }
    
    int k;
    
    ll cnt;
    
    ll ans = 0;
    
    for(i = 0; i < (1 << m); ++i)
    {
        cnt = 0;
        int k = __builtin_popcount(i);
        j = i;
        for(j = 0; j < m; ++j)
        {
            if (i & (1 << j))
            {
                cnt |= path[j];
            }
        }
        cnt = __builtin_popcountll(cnt);
        
        if ((k & 1) == 0)
        {
            ans += (1LL << (n - 1 - cnt));
        }
        else
        {
            ans -= (1LL << (n - 1 - cnt));
        }
    }
    
    //ans = (1LL << (n - 1)) - ans;
    
    cout << ans;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define loop(i,a,b)for(ll i=a;i<=b;i++)
#define loopr(i,a,b)for(ll i=b;i>=a;i--)
#define vll vector<ll> 
#define vvl vector<vll>
#define pii pair<ll,ll>
#define F first
#define S second
#define endl "\n"
#define M 1000000007
ll max(ll a,ll b){if (a>b) return a; else return b;}
 
/*ll po(ll x, ll y){
    if(y==0)
    return 1;
    if(y%2){
        return ((x)(po(x,y/2)%M)(po(x,y/2)%M) + M)%M;
    }
   return ((po(x,y/2)%M)*(po(x,y/2)%M) + M)%M;
}*/
 
void seive(bool prime[]){
    //bool prime[100002]; 
     
  
    for (ll p=2; p*p<=1000001; p++) 
    { 
        if (prime[p]) 
        { 
            for (ll i=p*p; i<=1000001; i+=p) 
                prime[i] = false; 
        } 
    }
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
    //cin>>t;
	while(t--){
	  ll n,x,t;
	  cin>>n>>x>>t;
	  if(n%x==0)
	  cout<<(t*n)/x<<endl;
	  else
	  cout<<(t*(n/x+1))<<endl;
	}
return 0;
}

Measured memory_bytes: 3644
import itertools

n,m,q = map(int,input().split())
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int, input().split())

mm = [0]*m

for k in range(1,m+1,1):
    mm[k-1]=k

A = list(itertools.combinations_with_replacement(mm, n))
su = 0
ans = 0

for x in range(len(A)):
    l=A[x]
    su = 0
    for h in range(q):
        if l[b[h]-1]-l[a[h]-1] == c[h]:
            su += d[h]

    if su > ans:
        ans = su

print(str(ans))

Measured memory_bytes: 84744
import sys
def main(argv):
    args = sys.argv
    # file_name = args[1]
    # f = open(file_name, 'r')
    # s1 =  f.readline().strip()
    # s2 =  f.readline().strip()

    s1  = input()
    s2 = input()



    n1 = len(s1)
    n2 = len(s2)
    dp = [[0 for _ in range(n2 + 1)] for _ in range(n1 + 1) ]

    for i in range(0, n1+1):
        dp[i][0] = i
    for j in range(0, n2+1):
        dp[0][j] = j

    for i in range(1, n1+1):
        for j in range(1, n2+1):
            if s1[i-1] == s2[j-1]:
                a = dp[i-1][j-1]
            else:
                a = dp[i-1][j-1]+1
            b = dp[i][j-1] + 1
            c = dp[i-1][j] + 1
            dp[i][j] = min([a,b,c])
            pass
    # for l in dp:
    #     print(l)
    print(dp[n1][n2])
if __name__ == '__main__':
    main(sys.argv[1:])




Measured memory_bytes: 42908
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using ll = long long;
using namespace std;

int main() {
    ll n = 0;
    cin >> n;
    vector<ll> a(n);
    for (int i=0; i<n; i++) {
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    int ans = 0;
    int buf = 1;
    for (int i=1; i<n; i++) {
        if (a.at(i) == a.at(i-1)) {
            buf++;
        }
        else {
            if (buf%2 == 1) {
                ans++;
            }
            buf = 1;
        }
    }
    if (buf%2 == 1) {
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
 int n, m, c, a = 1;
 cin >>n>>m;

 for(int i = 0; i < m; i++){
     a *= 2;
}

c = (1900*m) + 100*(n-m);

cout<<c*a<<endl;

return 0;
}

Measured memory_bytes: 256
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
(N, u, v ) = list(map(int,input().split()))
A=[]
B=[]
D=[] 
INF = 10 ** 10

for i in range(0,N-1):
    (a, b) =  list(map(int,input().split()))
    A.append(a)
    B.append(b)
    
C=[[] for _ in range(N)]
# print(N,u,v, A, B, C) 

for i in range(0,N-1):
    # print(i,A[i],B[i])
    C[A[i]-1].append(B[i])
    C[B[i]-1].append(A[i])

def initD():
    global D
    D=[INF for _ in range(N)]
    
def dist(n):
    global D
    initD()
    D[n-1] = 0 
    for x in C[n-1]:
        # print("x1:",x)
        if D[x-1] == INF:
            distR(x,1)
    
def distR(n,d):
    global D
    D[n-1] = d
    for x in C[n-1]:
        if D[x-1] == INF:
            # print("x1,x2:",n,x)
            distR(x,d+1)


# print(N,u,v, A, B, C) 
dist(u)
U = D 
dist(v)
V = D
# print(U,V)

max = 0

for i in range(0,N):
    if U[i] < V[i]:
        if (V[i] - U[i]) % 2 ==0:
            x = V[i] - 1
        else:
            x = V[i] - 1
    
        if x > max:
            max = x
 
print(max) 

Measured memory_bytes: 103336
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b>> c;
  if(a == b){
  cout << c;
  }else{
  if (a == c){
  cout << b;
  }else{
  cout << a;
  }
  }
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main() {
    int n, a;
    scanf("%d", &n);
    double sum = 0;
    for (int i = 0; i < n; ++i) scanf("%d", &a), sum += 1.0 / a;
    printf("%.15lf\n", 1 / sum);
    return 0;
}


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

int main() {
  ll d, t, s;
  cin >> d >> t >> s;
  if ((d + s - 1) / s <= t)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    int n;
    cin>>n;
    vector<int> v(n);
    rep(i, n-1){
        int a;
        cin>>a;
        --a;
        v[a]++;
    }
    rep(i, n) cout<<v[i]<<endl;
    return 0;
}

Measured memory_bytes: 4052
N, Q = map(int, input().split())
S = input()
lr = [list(map(int, input().split())) for _ in range(Q)]

box = [0]
for i in range(1, N):
    if S[i-1] + S[i] == "AC":
        box.append(box[i-1] + 1)
    else:
        box.append(box[i-1])

for i, j in lr:
    print(box[j-1] - box[i-1])

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

// 1つの証言を表す構造体
using pint = pair<int, int>;

// 入力
int N;
vector<vector<pint>> v;


bool judge(int bit) {

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

        if(!(bit&(1<<i))) continue;

        for(pint xy : v[i]) {
            int x = xy.first;
            int y = xy.second;

            if(y==0 && (bit&(1<<x))) return false;
            if(y==1 && !(bit&(1<<x))) return false;
        }
    }
    return true;
}

int main() {
    cin >> N;
    v.resize(N);
    for (int i = 0; i < N; ++i) {
        int A; cin >> A;
        v[i].resize(A);
        for (int j = 0; j < A; ++j) {
            cin >> v[i][j].first >> v[i][j].second;
            --v[i][j].first; // 0-indexed に
        }
    }

    int res = 0;
    for (int bit = 0; bit < (1 << N); ++bit) {
        
        // 矛盾 check
        if (judge(bit)) {
            
            // bit に含まれる人数を数える
            int count = 0;
            for (int i = 0; i < N; ++i) {
                if (bit & (1 << i)) ++count;
            }
            res = max(res, count);
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 256
class Exp
	def initialize(*args)
		@children = args
	end
	def to_s
		@children.map(&:to_s).join
	end
	def size
		@children.map(&:size).inject(:+)
	end

	def [](k)
		s = @children[0].size
		if k < s
			@children[0][k]
		else
			@children[1][k-s]
		end
	end
end

class Term
	def initialize(*args)
		@children = args
	end
	def to_s
		if @children[0].class == Num
			@children[1].to_s * @children[0].value.to_i
		else
			@children[0].to_s
		end
	end
	def size
		if @children[0].class == Num
			@children[1].size * @children[0].value.to_i
		else
			@children[0].size
		end
	end

	def [](k)
		if @children[0].class == Num
			@children[1][k % @children[1].size]
		else
			@children[0].to_s
		end
	end
end

class Alph
	def initialize(value)
		@value = value
	end
	def to_s
		@value
	end
	def size
		1
	end
	def [](k)
		@value
	end
end

class Num
	def initialize(value)
		@value = value
	end

	def size
		@value.size
	end
	attr_reader :value
end

def get_exp(tokens, i)
	return [nil, i] if i >= tokens.size
	t, i = get_term(tokens, i)
	return [nil, i] unless t

	e, i = get_exp(tokens, i)
	if e
		return [Exp.new(t, e), i]
	else
		return [Exp.new(t), i]
	end
end

def get_term(tokens, i)
	return [nil, i] if i >= tokens.size

	a, j = get_alph(tokens, i)
	if a
		return [Term.new(a), j]
	end

	n, j = get_num(tokens, i)
	return [nil, i] unless n

	a, k = get_alph(tokens, j)
	if a
		return [Term.new(n, a), k]
	end

	e, k = get_exp(tokens, j+1)
	if tokens[j] == ?( && e && tokens[k] == ?)
		return [Term.new(n, e), k+1]
	else
		return [nil, i]
	end
end

def get_alph(tokens, i)
	return [nil, i] if i >= tokens.size
	if ('A'..'Z') === tokens[i] 
		return [Alph.new(tokens[i]), i+1]
	end
	[nil, i]
end

def get_num(tokens, i)
	return [nil, i] if i >= tokens.size
	if tokens[i] =~ /^\d+$/
		return [Num.new(tokens[i]), i+1]
	end
	[nil, i]
end

loop {
	s, n = gets.chomp.split
	break if s == ?0
	n = n.to_i

	tokens = s.scan(/\d+|[()\w]/)
	e, _ = get_exp(tokens, 0)
	if n < e.size
		puts e[n]
	else
		puts 0
	end
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<string,int> P;
typedef pair<int,P> PP;

//-----------------------------------------------------------------------------

int a,b,c,d,e;

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

	cin>>a>>b>>c>>d>>e;
	int ans=0;
	if(a<0) ans+=abs(a)*c,a=0;
	if(a==0) ans+=d;
	ans+=(b-a)*e;
	cout<<ans<<endl;

	return 0;
}



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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int n;
  cin>>n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int digit = log10(i) + 1;
    if (digit % 2 == 1) {
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

int main() {
	char a, b;
	cin >> a >> b;
	if (a == b) cout << "H" << endl;
	else cout << "D" << endl;
	return 0;
}

Measured memory_bytes: 3568
H,W = map(int,input().split())

L = [input() for i in range(H)]

ans = "Yes"

dxy = [(-1,0),(1,0),(0,-1),(0,1)]

flg1 = 0
flg2 = 0

for y in range(H) :
    if flg1 : break
    for x in range(W) :
        if flg2 : break
        if L[y][x] == "#" :
            flg3 = 0
        
            for dy,dx in dxy :


                ny = y+dy
                nx = x+dx

                if (ny < 0) or (ny >= H) or (nx < 0) or (nx >= W) :
                    continue

                if L[ny][nx] == "#" :
                    flg3 = 1
                    break
            
            if not flg3 :
                ans = "No"
                flg1 = 1
                flg2 = 1
                flg3 = 1
                break
print(ans)


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

int main(){
  int n;
  cin >> n;
  int a[n+1];
  bool use[n+1];
  rep(i, n) {
    cin >> a[i+1];
    use[i+1] = false;
  }
  for(int i = n; i >= 1; i--){
    int s = n/i;
    int c = 0;
    for(int j = s; j > 1; j--){
      if(use[i*j]) c++;
    }
    if((c-a[i]) %2) use[i] = true;
  }
  vector<int> ans;
  for(int i = 1; i <= n; i++){
    if(use[i]) ans.push_back(i);
  }
  cout << ans.size() << endl;
  rep(i, ans.size()) cout << ans[i] << " ";
  cout << endl;
  return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll l;
  cin>>l;

  ll n=0;
  while(pow(2,n)<=l)n++;

  vector<tuple<ll,ll,ll>> ans;
  REP(i,n-1)ans.push_back(make_tuple(i+1,i+2,pow(2,i)));
  REP(i,n-1)ans.push_back(make_tuple(i+1,i+2,0));

  ll sum=pow(2,n-1);
  for(ll i=n-1-1; i>=0; i--){
    if(l&ll(pow(2,i))){
      ans.push_back(make_tuple(i+1,n,sum));
      sum += pow(2,i);
    }
  }

  cout<<n<<" "<<ans.size()<<endl;
  for(auto a:ans){
    cout<<get<0>(a)<<" "<<get<1>(a)<<" "<<get<2>(a)<<endl;
  }
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


int main()
{
	string s;
	cin >> s;

	string t[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

	int res;
	for (int i = 0; i < 7; i++)
	{
		if (s == t[i])
		{
			res = 7 - i;
		}
	}

	println(res);
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
#define ll long long
using namespace std;
int main(){
    int n,h,w;
    cin>>n>>h>>w;
    cout<<(n-h+1)*(n-w+1);
    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  int h, w; cin >> h >> w;
  char c[h][w];
  char ans[2*h][2*(w)];
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++){
      cin >> c[i][j];
      ans[2*i][j] = c[i][j];
      ans[2*i+1][j] = c[i][j];
    }
  }
  for(int i = 0; i < 2*h; ++i) {
    for(int j = 0; j < w; ++j) {
      cout << ans[i][j];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
def swap(a, b ,item):
    c = item[a]
    item[a] = item[b]
    item[b] = c
    
AB = input().split()
a = int(AB[0])
b = int(AB[1])
while a!=0 or b!=0:
    if a>b:
        swap(0, 1, AB)
    print(int(AB[0]), int(AB[1]))
    AB = input().split()
    a = int(AB[0])
    b = int(AB[1])

Measured memory_bytes: 7660
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll N=109;
ll n,W;
ll dp[100008];
//the minimum weight that we can reach with the given value
int main(){
    cin>>n>>W;
    /**Either the current weight is included or not in the dp[i]
    dp[i] is the minimum weight that we can get for a fixed value of i
    so let is say from all possible set of values 0..1e5
    dp[i] is correct for elements 1...n-1.
    so for the nth element the update of dp would be like
    either the optimal solution of value i would contain the nth item or not
    If it contains the nth item then for a value i the min weight possible if it is present
    is dp[i-val]-->recursive dp + its own weight w.
    **/
    for(ll i=1;i<100008;i++)dp[i]=INT32_MAX;
  
    for(ll i=0;i<n;i++){
        ll val,w;
        cin>>w>>val;
        for(ll i=100001;i>=val;i--)
            dp[i]=min(dp[i],dp[i-val]+w);
    }
    ll ans=0;
    for(ll i=0;i<=100001;i++)
        if(dp[i]<=W)
            ans=i;

    cout<<ans<<"\n";   
    return 0; 
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    int n = 0, num = 0;
    char d = NULL;
    int data[4][13];
    for (int a=0; a<4; a++) {
        for (int b=0; b<13; b++) {
            data[a][b] = 0;
        }
    }
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> d >> num;
        switch (d) {
            case 'S':
                data[0][num-1] = 1;
                break;
            case 'H':
                data[1][num-1] = 1;
                break;
            case 'C':
                data[2][num-1] = 1;
                break;
            case 'D':
                data[3][num-1] = 1;
                break;
            default:
                break;
        }
    }
       for (int a=0; a<4; a++) {
        for (int b=0; b<13; b++) {
            if (data[a][b] == 0) {
                switch (a) {
                    case 0:
                        cout << "S " << b+1 << endl;
                        break;
                    case 1:
                        cout << "H " << b+1 << endl;
                        break;
                    case 2:
                        cout << "C " << b+1 << endl;
                        break;
                    case 3:
                        cout << "D " << b+1 << endl;
                        break;
                    default:
                        break;
                }
            }
        }
    }
}

Measured memory_bytes: 3068
# DP(配るDP)
INF = float('inf')

N = int(input())

c = [1]
t = 6
while t <= N:
    c.append(t)
    t *= 6
t = 9
while t <= N:
    c.append(t)
    t *= 9

dp = [INF] * (N + 1)
dp[0] = 0
for i in range(N):
    t0 = dp[i] + 1
    for j in c:
        t1 = i + j
        if t1 <= N and dp[t1] > t0:
            dp[t1] = t0
print(dp[N])


Measured memory_bytes: 3828
#include<bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define mod 1000000007
using namespace std;

string s;
int n;
int d;
int dp[10012][2][101];
int solve(int pos,int tight,int sum)
{
   if(pos == n)
   {
    //cout<<kk<<" "<<sum<<endl;

       if(sum == 0){
        return 1;
         }
       else
        return 0;
   }

   if(dp[pos][tight][sum]!= -1)
    return dp[pos][tight][sum];

   int res = 0;

   int ub = (tight)?(s[pos]-'0'):9;
   int newtight;int newsum;

   for(int i = 0;i<=ub;i++)
   {
      if(tight == 1 && i == ub)
        newtight = 1;
      else
        newtight = 0;
      
      newsum = (sum+i)%d;
      res =  (res%mod + solve(pos+1,newtight,newsum))%mod;
   }

   return dp[pos][tight][sum] = res;
}
int main(void)
{
   cin>>s>>d;
   n = s.length();
   //reverse(all(s));
   memset(dp, -1 , sizeof(dp));
   int res = solve(0,1,0);
   res = res-1;
   if(res==-1)
    res+=mod;
  cout<<res<<endl;
}

Measured memory_bytes: 8960
#include<iostream>
#include<cmath>
#define int long long
using namespace std;
signed main(){
	int n;
	int d;
	cin>>n;
	cin>>d;
	int tot=0;
	for(int i=1;i<=n;++i){
		double x;
		double y;
		cin>>x>>y;
		if(sqrt(x*x+y*y)<=d+0.00000001)
			++tot;
	}
	cout<<tot<<endl;
	return 0;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int n;
  cin >> n;
  bool ok = true;
  int px = 0, py = 0;
  int now = 0;
  REP(i, n){
    int t, x, y;
    cin >> t >> x >> y;
    int d = abs(x - px) + abs(y - py);
    int dt = t - now;
    if(d > dt || d%2 != dt%2) ok &= false;
    px = x;
    py = y;
    now = t;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.*;

class Main{
	public static void main(String[] argv) throws IOException, NumberFormatException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int lineNum = Integer.parseInt(br.readLine());
		int[] lines = new int[lineNum];
		for(int i=0; i<lineNum; i++){
			lines[i] = i+1;
		}
		
		int excNum = Integer.parseInt(br.readLine());
		for(int i=0; i<excNum; i++){
			String[] e = br.readLine().split(",");
			int tmp = lines[Integer.parseInt(e[0])-1];
			lines[Integer.parseInt(e[0])-1] = lines[Integer.parseInt(e[1])-1];
			lines[Integer.parseInt(e[1])-1] = tmp;
		}
		
		for(int i : lines){
			System.out.println(i);
		}
	}
}

Measured memory_bytes: 15080
a,b = map(int,input().split())
s = list(input())
for i in range(len(s)):
    if i == a:
        if s[i] != '-':
            print('No')
            exit()
    else:
        if not s[i].isdigit():
            print('No')
            exit()
else:
    print('Yes')


Measured memory_bytes: 2940
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        p: [(i32, i32, i32); n],
    }
    let mut p = p;
    for i in 1..n {
        if p[i].2 > 0 {
            p.swap(0, i);
            break;
        }
    }
    let m = 101;
    for a in 0..m {
        for b in 0..m {
            let (x, y, h) = p[0];
            let c = h + (a - x).abs() + (b - y).abs();
            if p.iter().all(|&(x, y, h)| h == std::cmp::max(0, c - (x - a).abs() - (y - b).abs())) {
                println!("{} {} {}", a, b, c);
                return;
            }
        }
    }
}

fn main() {
    run();
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

int main() {
    int d,n;
    cin>>d>>n;
    int c;
    if(n<10){
        c=pow(100,d)*n;
    }else if(n<100){
        c=pow(100,d)*(n);
    }else{c=pow(100,d)*(n+1);}
    cout<<c<<endl;
    return 0;
}


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

int main(){
  int n,num;
  int mins=INT_MAX; //最小の値
  int dif=INT_MIN;  //差分
  cin>>n;
  while(n--){
    cin>>num;
    if(dif<num-mins)dif=num-mins;
    if(mins>num)mins=num;
  }
  cout<<dif<<endl;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x) 
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define fo(i, a, b) for (int i = a; i <= b; ++i)

vector<int> al[100005];
int res[100005];

int dp(int u) {
    if (~res[u]) return res[u];
    res[u] = 0;
    for (auto v : al[u]) res[u] = max(res[u], dp(v)+1);
    return res[u];
}

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m; cin >> n >> m;
    rep(i, m) {
        int u, v; cin >> u >> v;
        al[u].pb(v);
    }

    memset(res, -1, sizeof res);
    int ans = 0;
    fo(i, 1, n) ans = max(ans, dp(i));
    cout << ans << '\n';
}



Measured memory_bytes: 7552
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


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 Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
	ll a, b;
	cin >> a >> b;
	
	REP(i, 100000) {
		if ((ll)(i*0.08) == a && (ll)(i*0.1)==b) {
			cout << i << en;
			return;
		}
	}
	cout << -1 << en;
}

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

	solve();
	//int t; cin >> t; REP(i, t) solve();

	return 0;
}

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

int main() {

	string N,M;
	cin>>N>>M;
   if(N.length()>M.length()){
	for(int i=0; i<N.length()-1;i++)
    {cout<<N.at(i)<<M.at(i);}
  cout<<N.at(N.length()-1);}
  
  else{for(int i=0; i<N.length();i++)
    {cout<<N.at(i)<<M.at(i);}}
  
  cout<<endl;
}



Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int r=sc.nextInt();
		if(n>=10)System.out.println(r);
		else System.out.println(r+(100*(10-n)));
	}
}

Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
int a[4];
int main()
{
    for(int i=0;i<4;i++)
    {
        cin>>a[i];
    }
    sort(a,a+4);
    if(a[0]==1&&a[1]==4&&a[2]==7&&a[3]==9)
    {
        cout<<"YES";
    }
    else
    {
        cout<<"NO";
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int N;
    int K;
	
    scanf("%d",&N);   
    scanf("%d",&K);    
    
    int total = 1;   
	     
    for(int i = 0;i<N;i++){ 
        if(total < K){     
            total = total * 2; 
        }
        else{
            total = total + K;  
        }
    }
    printf("%d\n",total);
    return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;

int main(void) {
	int num, needNum;
	while (cin >> num >> needNum, num) {
		vector<int> possDay(1001, 0);

		for (int mi = 0; mi < num; mi++) {
			int dateNum;
			cin >> dateNum;
			for (int di = 0; di < dateNum; di++) {
				int date;
				cin >> date;
				possDay[date]++;
			}
		}

		int maxi = 0;
		for (int i = 1; i <= 1000; i++) {
			if (possDay[maxi] < possDay[i]) {
				maxi = i;
			}
		}

		cout << (possDay[maxi] < needNum ? 0 : maxi) << endl;
	}

	return 0;
}

Measured memory_bytes: 1196