akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

bool match(char c1, char c2) {
    return c1 == '?' || c2 == '?' || c1 == c2;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a, b, c; cin >> a >> b >> c;
    int na = a.size(), nb = b.size(), nc = c.size();
    const int offset = 50000;
    V<bool> ab(100000, true), ac(100000, true), bc(100000, true);
    // 相対位置を i - j 文字分ずらした時に合うかどうか
    for (int i = 0; i < na; i++) {
        for (int j = 0; j < nb; j++) ab[i - j + offset] = ab[i - j + offset] && match(a[i], b[j]);
    }
    for (int i = 0; i < na; i++) {
        for (int j = 0; j < nc; j++) ac[i - j + offset] = ac[i - j + offset] && match(a[i], c[j]);
    }
    for (int i = 0; i < nb; i++) {
        for (int j = 0; j < nc; j++) bc[i - j + offset] = bc[i - j + offset] && match(b[i], c[j]);
    }

    int ans = INF;
    for (int bi = -4000; bi <= 4000; bi++) {
        for (int ci = -4000; ci <= 4000; ci++) {
            if (ab[bi + offset] && ac[ci + offset] && bc[ci - bi + offset]) {
                int lll = min({0, bi, ci}), rrr = max({na, bi + nb, ci + nc});
                chmin(ans, rrr - lll);
            }
        }
    }
    cout << ans << '\n';
    return 0;
}


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

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

	return 0;
}


Measured memory_bytes: 256
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　|   _　 _l
　 　　　／` ミ＿x ノ   Zzz..
　　 　 /　 　 　 |   コード見ちゃだめ！！
　　　 /　 ヽ　　  ﾉ
　 　 │　　|　|  |
　／￣|　　 |　|  |
　| (￣ヽ＿_ヽ_)_ _)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define REP(i, n) for (int i = 0; i < n; i++)
const int MOD = 1e9 + 7;
typedef long long ll;
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  if (k >= a && b <= k - a)
    cout << 0 << " " << 0 << endl;
  else if (k >= a && b >= k - a)
    cout << 0 << " " << b - (k - a) << endl;
  else
    cout << a - k << " " << b << endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
//#define double long double

using namespace std;

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

const int MOD = 1e9+7;
const ll INF = 1e17;
const int INT_INF = 1e9;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;


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

	int A, B; cin >> A >> B;
	int cnt = 0;
	int res = 1;

	while (res < B) {
		cnt++;
		res += A-1;
	}
	print(cnt);
}



Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split(' ')))
B=list(map(int,input().split(' ')))
plus=[]
minus = 0
ans = 0
if sum(A)<sum(B):
    print(-1)
    exit()
for a,b in zip(A,B):
    if a-b >=0:
        plus.append(a-b)
    elif a-b<0:
        minus += a-b
        ans += 1
if minus==0:
    print(0)
    exit()
for i in sorted(plus,reverse=True):
    minus += i
    ans += 1
    if minus >=0:
        print(ans)
        break

Measured memory_bytes: 18356
/*
ID: Aman Raj
LANG: C++
TASK: milk3
*/
#include<iostream>
#include <stdio.h>
//#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#include<math.h>
typedef long long ll;
 #include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
//#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define flush fflush(stdout)
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <fstream>
// find_by_order()  // order_of_key
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;


int main()
{    ifstream fin ("milk3.in");
     ofstream fout ("milk3.out");
     ll n,k;cin>>n>>k;
       string s;cin>>s;
         for(ll i=0;i<n;i++)
         {


                 if(s[i]<97&&i==k-1)cout<<char(s[i]+32);
                 else cout<<s[i];

         }

    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);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 (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

int main() {
    int n, d; cin >> n >> d;
    cout << (n+2*d)/(2*d+1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int i, N, T, c[100], count = 0, t, min = 9999;

	scanf("%d %d", &N, &T);

	for (i = 0; i < N; i++) {
		scanf("%d %d", &c[count], &t);
		if (t <= T) {
			if (c[count] <= min) min = c[count];
			count++;
		}
	}

	if (count != 0)printf("%d\n", min);
	else printf("TLE\n");

	return 0;
}

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

using namespace std;
using ll = long long;
constexpr ll mod = 1e9+7;
constexpr ll md = mod;
constexpr ll inf = 1e15;
int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ac = (a-1)/c;
    ll ad = (a-1)/d;
    ll cd = c*d/__gcd(c,d);
    ll bc = b/c;
    ll bd = b/d;
    ll abc = max(0ll,bc - ac);
    ll abd = max(0ll,bd - ad);
    ll bdc = b/cd;
    ll adc = (a-1)/cd;
    ll abcd = max(0ll,bdc - adc);
    ll ret = b-a+1;
    ret = ret - (abd + abc) + abcd;
    cout << ret << endl;
    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(){
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,N)cin>>a[i];
    int alice=0,bob=0;
    sort(a.begin(),a.end(),greater<int>());
    for(int i = 0; i < N; i++){
         if(i%2==0)alice += a[i];
         else bob += a[i];
    }
    cout<<alice-bob<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<list>
#include<algorithm>
using namespace std;

int main(){
    char c[10];
    int n, num;
    list<int> L;
    
    scanf("%d", &n);
    
    for(int i = 0; i < n; i++){
        scanf("%s%d", c, &num);
        
        if(c[0] == 'i'){
            L.push_front(num);
        }
        else{
            if(c[6] == 'F') L.pop_front();
            else if(c[6] == 'L') L.pop_back();
            else{
                for(list<int>::iterator i = L.begin(); i != L.end(); i++){
                    if(num == *i){
                        L.erase(i);
                        break;
                    }
                }
            }
        }
    }
    
    for(list<int>::iterator i = L.begin(); i != L.end(); i++){
        if(i != L.begin()) printf(" ");
        printf("%d", *i);
    }
    printf("\n");
    
    return 0;
}


Measured memory_bytes: 33932
# -*- coding: utf-8 -*-
N, H = list(map(int, input().split()))
a = []
b = []
for i in range(N):
    ai, bi = list(map(int, input().split()))
    a.append(ai)
    b.append(bi)

a_max = max(a) # 通常攻撃の最大値
b_dmg = [ elem for elem in b if elem > a_max]

cnt = 0
isFinished = False
for elem in (reversed(sorted(b_dmg))):
    H -= elem
    cnt += 1
    if H <= 0:
        print(cnt)
        isFinished = True
        break

if isFinished == False:
    if H % a_max == 0:
        print(int(H/a_max)+len(b_dmg))
    else:
        print(int(H/a_max)+1+len(b_dmg))



Measured memory_bytes: 12844
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=LONG_LONG_MAX;
const ll ms=(1e6)+5;



int main()
{
    idfc;
    int n;
    cin>>n;
    int a=0;
    int b=0;
    int c=0;
    int x,y,t;
    int pp;
    int tt;
    int dd;
    while(n--)
    {
        cin>>t>>x>>y;
        pp=abs(x-a)+abs(y-b);
        tt=t-c;
        dd=tt-pp;
        if(0>dd||(dd&1))
        {
            cout<<"No";
            return 0;
        }
        c=t;
        a=x;
        b=y;
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3648
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

string S;
ul N,i,cnt;

inline void solve(){
  IN(S);
  N=S.size();
  REP(i,N){
    if(i==0)continue;
    if(S[i-1]!=S[i])cnt++;
  }
  OUT(cnt);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 512
/*
これを入れて実行
g++ code.cpp
./a.out
*/

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = { -1, 0, +1, 0 };
int dx4[4] = { 0, +1, 0, -1 };
int dy8[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };
int dx8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
	if (r == 0 || r == n){
		return 1;
	}
	else if (r == 1){
		return n;
	}
	return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
	r = n - r;
	ll ret = 1;
	for (ll i = n; i >= r + 1; i--) ret *= i;
	return ret;
}

//-----------------------ここから-----------

int main(void){

	string s;
	cin >> s;

	int ans = 0;

	for (int i = 0; i < s.size(); i++){
		if (s[i] == '1'){
			ans++;
		}
	}

	cout << ans << endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
#include<unordered_set>
long long const infty = 0x3fffffffffffff;
struct edge{
    long long weight;
    int to,rev;
};
//隣接リスト表現
class Graph{
protected:
    int numVertex,numEdge;
    std::vector<edge> *adj;
public:
    //---基本---

    //v頂点のグラフを作成する（頂点の番号は0-indexed）
    Graph(int v){
        numVertex=v;
        numEdge=0;
        adj=new std::vector<edge>[v];
    }
    ~Graph(){ delete[] adj; }
    //フロー計算用の有向辺+逆辺の追加
    void addNetwork(int u,int v,long long w=1LL){
        adj[u].push_back({w,v,(int)adj[v].size()});
        adj[v].push_back({0,u,(int)adj[u].size()-1});
        numEdge++;
    }
    
private:
    //vからtへの増加パスをdfsで探す
    //fは流量の上界のうち現時点で判明している最小のもの
    long long dfs_Ford_fulkerson(int v,int t,long long f,bool* used){
        //始点と終点が一致していれば無限に流せる
        if(v==t)return f;
        used[v]=true;
        //vから出る各辺eに対して、
        for(auto itr=adj[v].begin();itr!=adj[v].end();itr++){
            edge e=*itr;
            //e.toにまだ訪問したことがなく、さらに流せるとき
            if(!used[e.to]&&e.weight>0){
                //e.toから終点tまで流せる量を取得する
                //流量の上界は、eで流せる量でも上から抑えられる
                long long d = dfs_Ford_fulkerson(e.to, t, std::min(f,e.weight), used);
                //もし流せるなら
                if(d>0){
                    //dだけ逆流させればvからtにもd流せる
                    itr->weight-=d;
                    adj[e.to][e.rev].weight+=d;
                    return d;
                }
            }
        }
        //どこも訪問済みか流せる量がないときは0
        return 0;
    }
public:
    //最大流 O(E*(最大流の流量))
    long long maxFlow_Ford_Fulkerson(int s,int t){
        bool *used=new bool[numVertex];
        long long flow=0;
        while(true){
            for(int i=0;i<numVertex;i++)used[i]=false;
            long long f=dfs_Ford_fulkerson(s,t,infty,used);
            if(f==0)return flow;
            flow+=f;
        }
    }
    void debugPrint(){
        printf("numEdge: %d\n",numEdge);
        printf("numVertex: %d\n",numVertex);
        printf("EdgeList:\n");
        for(int i=0;i<numVertex;i++){
            printf("%6d: ",i);
            for(auto itr=adj[i].begin();itr!=adj[i].end();itr++){
                printf("(%d->%d:%lld)",i,(*itr).to,(*itr).weight);
            }
            printf("\n");
        }
    }
};

int main(){
    int v,e;
    scanf("%d%d",&v,&e);
    Graph g(v);
    for(int i=0;i<e;i++){
        int u,v,c;
        scanf("%d%d%d",&u,&v,&c);
        g.addNetwork(u,v,c);
    }
    printf("%lld\n",g.maxFlow_Ford_Fulkerson(0,v-1));
}


Measured memory_bytes: 2828
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

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

    int n, k;

    cin >> n >> k;

    if ((n + 1) / 2 >= k) {
        cout << "YES";
    } else {
        cout << "NO";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    h,w,n = LI()
    xy = sorted([LI() for _ in range(n)])
    mx = h + 1
    p = 0
    for x,y in xy:
        if x-p == y:
            p += 1
            continue
        if x-p <= y:
            continue
        mx = x
        break
    return mx - 1


print(main())


Measured memory_bytes: 44308
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <numeric>
using namespace std;
typedef long long int ll;

struct UnionFind{
    vector<int> par,num;
    vector<bool> done;
    UnionFind(int n):par(n),num(n,1),done(n,false){
        iota(par.begin(),par.end(),0);  //include<numeric>
    }
    int find(int v){
        return (par[v]==v)?v:(par[v]=find(par[v]));
    }
    void unite(int u,int v){
        u=find(u),v=find(v);
        if(u==v)return;
        if(num[u]<num[v])swap(u,v);
        num[u]+=num[v];
        par[v]=u;
        done[u]=done[u]|done[v];
    }
    bool same(int u,int v){
        return find(u) == find(v);
    }
    bool ispar(int v){
        return v=find(v);
    }
    int size(int v){
        return num[find(v)];
    }
};

vector<int> g[100100];
int d[100100];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m,k; cin >> n >> m >> k;
	UnionFind uf(n),uf2(n);
	for(int i=0;i<m;i++){
		int x,y; cin  >> x >> y;
		x--; y--;
		g[x].push_back(y);
		g[y].push_back(x);
		uf.unite(x,y);
	}
	for(int i=0;i<k;i++){
		int x,y; cin >> x >> y;
		x--; y--;
		if(uf.same(x,y)){
			d[x]++;
			d[y]++;
		} 
	}
	for(int i=0;i<n;i++){
		cout << uf.size(i)-g[i].size()-d[i]-1 << " ";
	}
	cout << endl;
}

Measured memory_bytes: 8696
#include<iostream>
#include<string.h>
using namespace std;
static int table[1500 * 1000];
int main()
{
	int n, m;
	while (cin >> n >> m && n != 0 || m != 0)
	{
		int x[1502];
		int y[1502];
		memset(table, 0, sizeof table);
		y[0] = 0;
		for (int i = 0; i < n; i++)
		{
			int h;
			cin >> h;
			y[i + 1] = y[i] + h;
		}
		x[0] = 0;
		for (int i = 0; i < m; i++)
		{
			int w;
			cin >> w;
			x[i + 1] = x[i] + w;
		}
		for (int i = 0; i < m; i++)
		{
			for (int j = i + 1; j <= m; j++)
			{
				table[x[j] - x[i]]++;
			}
		}
		int count = 0;
		for (int i = 0; i < n; i++)
		{
			for (int j = i + 1; j <= n; j++)
			{
				if (table[y[j] - y[i]] > 0)
				{
					count += table[y[j] - y[i]];
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 7040
N = int(input())
S,T = map(str,input().split())



LS = list(S)
LT = list(T)
ANS = ""

for i in range(N):#0スタートである事に注意。
  ANS = ANS + LS[i]
  ANS = ANS + LT[i]
  
print(ANS)#文字の連結



Measured memory_bytes: 2940
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		if(s.charAt(0) >= 'a'){
			System.out.print("a");
		}else{
			System.out.print("A");
		}
		
	}
}


Measured memory_bytes: 35624
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 1010;
const int mo = 1e+9+7;

LL f[N];
LL g[N][N],c[N][N];
int n,A,B,C,D;

LL quickmi(LL x,LL tim){
	LL ans=1;
	while(tim){
		if (tim%2)ans=ans*x%mo;
		x=x*x%mo;
		tim/=2;
	}
	return ans;
}

int main(){
	n=get();A=get();B=get();C=get();D=get();
	g[0][0]=1;
	c[0][0]=1;
	fo(i,1,n){
		c[i][0]=1;
		fo(j,1,i)c[i][j]=(c[i-1][j]+c[i-1][j-1])%mo;
	}
	fo(i,1,n){
		g[i][0]=1;
		fo(j,1,n/i)
		g[i][j]=g[i][j-1]*c[i*j][i]%mo*quickmi(j,mo-2)%mo;
	}
	f[0]=1;
	fo(s,A,B)
		fd(i,n,1){
			fo(t,C,min(i/s,D))
			f[i]=(f[i]+f[i-s*t]*g[s][t]%mo*c[n-i+s*t][s*t])%mo;
		}
	printf("%lld\n",f[n]);
	return 0;
}

Measured memory_bytes: 11392
program abc129d
  implicit none
  character(2000),dimension(:),allocatable :: s
  integer :: h, w, i, j, ans = 0
  integer,dimension(:,:,:),allocatable :: grid

  read *, h, w
  allocate(s(h),grid(w,h,3))
  read *, s

  do i = 1,h
     do j = 1,w
        grid(j,i,:) = merge(0,1,s(i)(j:j)=='#')
     end do
  end do

  do j = 2,w
     grid(j,:,2) = merge(grid(j,:,2)+grid(j-1,:,2),grid(j,:,2),grid(j,:,1)/=0)
  end do

  do j = w-1,1,-1
     grid(j,:,2) = merge(grid(j+1,:,2),grid(j,:,2),grid(j,:,1)/=0.and.grid(j+1,:,1)/=0)
  end do

  do i = 2,h
     grid(:,i,3) = merge(grid(:,i,3)+grid(:,i-1,3),grid(:,i,3),grid(:,i,1)/=0)
  end do

  do i = h-1,1,-1
     grid(:,i,3) = merge(grid(:,i+1,3),grid(:,i,3),grid(:,i,1)/=0.and.grid(:,i+1,1)/=0)
  end do

  do i = 1,h
     do j = 1,w
        if (ans < grid(j,i,2)+grid(j,i,3)) ans = grid(j,i,2)+grid(j,i,3)
     end do
  end do

  print *, ans-1
end program abc129d


Measured memory_bytes: 51584
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <queue>
using namespace std;

const int MAXS = 1000010;
char str[MAXS];

int main() {
    int N;
    unordered_map <int, deque<int>> posCho;
    unordered_map <int, deque<int>> negCho;

    cin >> N;
    int maxRight = 0;
    int maxLeft = 0;

    const int INF = 100000000;
    int minLcnt = INF;
    int minRcnt = INF;

    for (int i = 0; i < N; ++i) {
        scanf("%s", str);
        int len = strlen(str);
        vector <char> stk;

        for (int j = 0; j < len; ++j) {
            if (str[j] == '(') {
                stk.push_back('(');
            } else {
                if (!stk.empty() && stk.back() == '(') {
                    stk.pop_back();
                } else {
                    stk.push_back(')');
                }
            }
        }

        int j = 0;
        int lcnt = 0;
        int rcnt = 0;
        while (j < stk.size()) {
            if (stk[j] == ')') {
                ++rcnt;
                ++j;
            } else {
                break;
            }
        }

        lcnt = stk.size() - j;
        maxRight = max(maxRight, rcnt);
        maxLeft = max(maxLeft, lcnt);

        if (lcnt >= rcnt) {
            posCho[rcnt].push_back(lcnt);
        } else {
            negCho[lcnt].push_back(rcnt);
        }

        minLcnt = min(minLcnt, lcnt);
        minRcnt = min(minRcnt, rcnt);
        // cout << "DEBUG " << lcnt << " " << rcnt << endl;
    }

    bool failed = false;
    int totLcnt = 0;
    int totRcnt = 0;

    for (int v = 0; v <= maxRight && !failed; ++v) {
        for (int j = 0; j < posCho[v].size(); ++j) {
            if (totLcnt < v) {
                failed = true;
                break;
            } else {
                totLcnt += (posCho[v][j] - v);
            }
        }
    }

    for (int v = 0; v <= maxLeft && !failed; ++v) {
        for (int j = 0; j < negCho[v].size(); ++j) {
            if (totRcnt < v) {
                failed = true;
                break;
            } else {
                totRcnt += (negCho[v][j] - v);
            }
        }
    }

    cout << (failed || totLcnt != totRcnt || minLcnt > 0 || minRcnt > 0 ? "No" : "Yes") << endl;

    return 0;
}

Measured memory_bytes: 7700
#include <stdio.h>

int main(){
  
  int i,j,v,N,c;
  
  scanf("%d",&N);

  int A[N];
  
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

  for(c=0;c<N;c++){
    printf("%d",A[c]);
    if(c<N-1){
      printf(" ");
    }
    else{
      printf("\n");
    }
  }
  
  
  for(i=1;i<=N-1;i++){
    
    v = A[i];
    j = i -1;
  

    while(j>=0 && A[j]>v){
      A[j+1] = A[j];
      j--;
    }
    
    A[j+1] = v;
    
    for(c=0;c<N;c++){
      printf("%d",A[c]);
      if(c<N-1){
	printf(" ");
      }
      else{
	printf("\n");
      }
    }
  }
    return 0;
}



Measured memory_bytes: 2124
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define Gput(a,b) G[a].push_back(b)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll fact(ll x){
  ll y=1;
  for(ll i=1;i<=x;i++){
   y*=i;
   y%=1000000007;
  }
  return y;
}
int main() {
  ll n,k;
  cin>>n>>k;
  if(n==k)putout(1);
  else{
ll t=n-k;
    if(t%(k-1)==0)putout(1+t/(k-1));
    else putout(2+t/(k-1));
  }
  
  
  
  
  
  
}


Measured memory_bytes: 256
#include <stdio.h>

using namespace std;
typedef long long llong;

#define MAX
const llong mod = 1000000000 + 7;

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

int main()
{
  int K;
  llong ans = 0;
  scanf("%d", &K);
  for (int i = 1; i <= K; i++)
  {
    for (int j = 1; j <= K; j++)
    {
      for (int k = 1; k <= K; k++)
      {
        ans += gcd(gcd(i, j), k);
      }
    }
  }

  printf("%lld\n", ans);

  return 0;
}

Measured memory_bytes: 1736
let main () =
  let n = read_int () in
  let count = ref 0 in
  (
    for a = 1 to n do
      for b = 1 to n / a do
        let c = n - a * b in
        if c > 0
        then count := !count + 1
      done
    done;
    Printf.printf "%d" !count;
    print_newline ()
  )

let _ = main ()


Measured memory_bytes: 3656
import sys
import bisect
input = sys.stdin.readline

def main():
    # N = int(input())
    # N, K = map(int, input().split())
    # a = list(map(int, input().split()))
    s = input().strip()
    t = input().strip()
    len_s = len(s)

    dic = {}
    for i in range(len_s):
        if s[i] in dic:
            dic[s[i]].append(i)
        else:
            dic[s[i]] = [i]
    # print(dic)
    ok = True
    now = 0
    ans = 0
    for i in range(len(t)):
        if t[i] not in dic:
            ok = False
            break
        else:
            index = bisect.bisect_left(dic[t[i]], now)
            # print(index)
            if index >= len(dic[t[i]]):# １週回ってからしかない
                # print("plus")
                ans += len_s
                now = dic[t[i]][0]+1
            else:# １週回るまでに見つかった
                now = dic[t[i]][index]+1
            # print(now)
            # if i == len(t)-1:
            #     if ans != 0:
            #         now -= 1
    if ok:
        print(ans+now)
    else:
        print(-1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 7668
n = int(input())
jobs = [list(map(int, input().split())) for i in range(n)]

jobs.sort(key=lambda x:x[1])

flg = True
sum = 0
for a, b in jobs:
    sum += a
    if sum > b:
        flg = False
        break

if flg:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 53600
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	X := make([]int, n)
	for i := 0; i < n; i++ {
		var x int
		fmt.Scan(&x)
		X[i] = x
	}

	accept := true
	for _, v := range X {
		if v%2 == 0 {
			if v%3 != 0 && v%5 != 0 {
				accept = false
			}
		}
	}
	if accept == true {
		fmt.Println("APPROVED")
	} else {
		fmt.Println("DENIED")
	}
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#define mod 1000000007
using namespace std;
int main(){
	int n;
	vector<int> a;
	cin>>n;
	for(int i=0;i<n;i++){
		int t;
		cin>>t;
		a.push_back(t);
	}
	sort(a.begin(),a.end());
	int big = a[n-1];
	int curdif=2*mod;
	int good;
	for(int i=0;i<n;i++){
		if(abs(big-a[i]*2)<curdif){
			good=i;
			curdif=abs(big-a[i]*2);
		}
	}
	cout<<big<<" "<<a[good]<<endl;
	return 0;
}

Measured memory_bytes: 892
import java.util.*;
	
	public class Main {
	
		public static void main(String[] args) {
		
			Scanner sc = new Scanner(System.in);
			int h = sc.nextInt();
			int n = sc.nextInt();
			int a[] = new int[n];
			
			for(int i=0;i<n;i++) {
				a[i] = sc.nextInt();
			}
			
			int sum =0;
			
			for(int i=0;i<n;i++) {
				sum += a[i];
			}
			
			if(h>sum) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			
		}
				
	}

Measured memory_bytes: 51016
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    Map<String, Integer> map = new HashMap<>();
    int max = 0;
    for(int i = 0; i < N; i++){
      String s = sc.nextLine();
      if(map.containsKey(s)){
        int n = map.get(s)+1;
        max = Math.max(n, max);
        map.put(s, n);
      }else{
        map.put(s, 1);
        max = Math.max(max, 1);
      }
    }
    List<String> list = new ArrayList<>();
    for (Map.Entry<String, Integer> entry : map.entrySet()) {
      if(entry.getValue() == max){
        list.add(entry.getKey());
      }
    }
    Collections.sort(list);
    for(String st : list){
      System.out.println(st);
    }
  }
}

Measured memory_bytes: 177700
toInt :: (String -> Int)
toInt x = read x ::Int

getInts :: IO [Int]
getInts = do
    x <- getLine
    let y = (map$toInt)$words x
    return y

main :: IO ()
main = do
    ns <- getInts
    let [d, t, s] = ns
    let r = if t * s >= d then "Yes" else "No"
    putStrLn r


Measured memory_bytes: 3852
n = int(input())
a = list(map(int, input().split()))
ans = [0]*n
count = 0
for i in range(n-1, -1, -1):
    c = sum([ans[j] for j in range(i, n, i+1)])%2
    if c != a[i]:
        count+=1
        ans[i] = 1
print(count)
ans = [i+1 for i in range(n) if ans[i]==1]
if count > 0:
    print(' '.join(map(str, ans)))

Measured memory_bytes: 18868
/*
THE BEST IS YET TO COME
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define r(i,s,l) for(int i=s;i<l;i++)
#define mod 1000000007
#define INT_BITS 32
#define ld long double
#define pp pair<long long,long long>
#define ss second
#define ff first
#define N 2000005
#define all(a) a.begin(),a.end()
#define pb push_back
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int main(){
    fast();
    ll n,m;
    cin>>n>>m;
    vector<pp> a(n);
    ll ans=0;
    ll nt=0;
    r(i,0,n)
    {
        cin>>a[i].ff>>a[i].ss;
    }
    sort(all(a));
    priority_queue<ll> pq;
    r(i,1,m+1)
    {
        while(a[nt].ff==i && nt<n)
              {
                  pq.push(a[nt].ss);
                  nt++;
              }
        if(!pq.empty())
        {
              ans+=pq.top();
              pq.pop();
        }
    }
    cout<<ans;
	return 0;
}


Measured memory_bytes: 2936
#include<iostream>
#include<sstream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>

using namespace std;

int main(){
  long long N,M;
  cin>>N>>M;
  long long buf;
  priority_queue<long long> que;
  for(int i=0; i<N; i++){
    cin>>buf;
    que.push(buf);
  }
  for(int i=0; i<M; i++){
    buf=que.top();
    que.pop();
    buf=buf/2;
    que.push(buf);
  }
  long long sum=0;
  for(int i=0; i<N; i++){
    sum+=que.top();
    que.pop();
  }
  cout<<sum<<endl;

  return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;
ll INF = 1e9+10;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
vector<pair<ll, ll> > pairs;

ll n, mod = 998244353;
const ll MAX = 1e7 + 1;
vector<ll> v(MAX);

ll inv[MAX];

void init() {
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
    }
}

int main()
{
    ll N;
    cin >> N;
    init();
    
    ll sub = 0;
    ll beki = 1, nCk = 1;
    for (int i = N; i >= N/2+1; i--){
        (sub += beki * nCk)%=mod; 
        (nCk *= i) %= mod;
        (nCk *= inv[N + 1 - i]) %= mod;
        (beki *= 2) %= mod;
    }
    (sub *= 2) %= mod;
    
    
    ll ans = 1;
    rep(i, N){
        (ans *= 3) %= mod;
    }
    (ans += mod - sub) %= mod;
    cout << ans << endl;
    return 0;    
}


Measured memory_bytes: 156544
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ld long double
#define zeros(x) x^(x-1)&x
#define pii pair<ll,ll>
#define cd complex<double>
#define dbg(x) cerr<<x<<endl;
#define Nmax 1000005
#define MOD 1000000007
using namespace std;

ll n,v[Nmax],mx;

int main()
{
    cin >> n;
    for (int i=1;i<=n;i++) cin >> v[i];

    ll ans = 0;
    for (int i=n;i>=1;i--){
        if (v[i] > i-1){
            cout << "-1\n";
            return 0;
        }
        if (v[i] > mx){
            ans += v[i];
            mx = v[i];
        }
        else if (v[i] < mx){
            cout << "-1\n";
            return 0;
        }
        mx--;
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
string S;
int main(){
	cin>>S;
	cout<<S.substr(0,S.size()-8);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;


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

	int n, a, b, c;
	cin >> n >> a >> b >> c;
	vector<string> S(n);
	vector<char> ans;
	map<char, int> cnt;
	cnt['A'] = a;
	cnt['B'] = b;
	cnt['C'] = c;

	for(int i = 0; i < n; i++) cin >> S[i];

	int mx = max({a, b, c});

	if(mx <= 5){
		char dp[n + 1][6][6][6];
		for(int i = 0; i <= n; i++){
			for(int j = 0; j < 6; j++){
				for(int k = 0; k < 6; k++){
					for(int l = 0; l < 6; l++){
						dp[i][j][k][l] = '$';
					}
				}
			}
		}
		dp[0][a][b][c] = '!';


		for(int i = 1; i <= n; i++){
			for(int j = 0; j < 6; j++){
				for(int k = 0; k < 6; k++){
					for(int l = 0; l < 6; l++){
						string curr = S[i - 1];
						if(curr == "AB"){
							if(j > 0 && k < 5 && dp[i - 1][j - 1][k + 1][l] != '$'){
								dp[i][j][k][l] = 'A';
							}
							else if(k > 0 && j < 5 && dp[i - 1][j + 1][k - 1][l] != '$'){
								dp[i][j][k][l] = 'B';
							}
						}
						if(curr == "BC"){
							if(k > 0 && l < 5 && dp[i - 1][j][k - 1][l + 1] != '$'){
								dp[i][j][k][l] = 'B';
							}
							else if(l > 0 && k < 5 && dp[i - 1][j][k + 1][l - 1] != '$'){
								dp[i][j][k][l] = 'C';
							}
						}
						if(curr == "AC"){
							if(j > 0 && l < 5 && dp[i - 1][j - 1][k][l + 1] != '$'){
								dp[i][j][k][l] = 'A';
							}
							else if(l > 0 && j < 5 && dp[i - 1][j + 1][k][l - 1] != '$'){
								dp[i][j][k][l] = 'C';
							}
						}
					}
				}
			}
		}
		a = -1, b = -1, c = -1;
		for(int j = 0; j < 6; j++){
			for(int k = 0; k < 6; k++){
				for(int l = 0; l < 6; l++){
					if(dp[n][j][k][l] != '$'){
						a = j;
						b = k;
						c = l;
					}
				}
			}
		}
		if(a == -1){
			cout << "No";
			return 0;
		}

		for(int i = n; i >= 1; i--){
			string curr = S[i - 1];
			ans.pb(dp[i][a][b][c]);
			if(curr == "AB" && dp[i][a][b][c] == 'A'){
				a--;
				b++;
			}
			else if(curr == "AB" && dp[i][a][b][c] == 'B'){
				a++;
				b--;
			}
			else if(curr == "BC" && dp[i][a][b][c] == 'B'){
				b--;
				c++;
			}
			else if(curr == "BC" && dp[i][a][b][c] == 'C'){
				b++;
				c--;
			}
			else if(curr == "AC" && dp[i][a][b][c] == 'A'){
				a--;
				c++;
			}
			else if(curr == "AC" && dp[i][a][b][c] == 'C'){
				a++;
				c--;
			}
			else assert(0);
		}
		reverse(all(ans));
	}
	else{
		for(int i = 0; i < n; i++){
			if(cnt[S[i][0]] == 0 && cnt[S[i][1]] == 0){
				cout << "No";
				return 0;
			}
			if(cnt[S[i][0]] < cnt[S[i][1]]){
				ans.pb(S[i][0]);
				cnt[S[i][0]]++;
				cnt[S[i][1]]--;
			}
			else{
				ans.pb(S[i][1]);
				cnt[S[i][0]]--;
				cnt[S[i][1]]++;
			}
		}
	}

	cout << "Yes\n";
	for(auto c : ans) cout << c << "\n";
}

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

using namespace std;
static const int MAX = 200000;

int main(){
  int A[MAX],n;
  int count = 0;
  bool flag = 1;

  cin >> n;

  for (int i = 0;  i <n; i++){
  cin >> A[i];
}

  for(int i=0;flag ;i++){
    flag = 0;
    for(int j=n-1;j>=i+1 ;j--){
      if(A[j]<A[j-1]){
        swap(A[j],A[j-1]);
        flag = 1;
        count++;
      }
    }
  }
  for (int i=0;i<n;i++){
    if(i) cout <<" ";
    cout << A[i];
  }
  cout << endl;

  cout << count;

  cout << endl;
  return 0;
}

Measured memory_bytes: 3104
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main{

    public static final int FIRST_NUMBER = 0;
    public static final int SECOND_NUMBER = 1;

    public static void main(String[] args) throws NumberFormatException, IOException {

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	// ???????????°
	int vertical = Integer.parseInt(br.readLine());
	// ?¨?????????°
	int horizontal = Integer.parseInt(br.readLine());

	// ?????????????????°??????????????????
	List<int[]> changeRequests = new ArrayList<>();
	for (int i = 0; i < horizontal; i++) {
	    String[] changeRequestStr = br.readLine().split(",");
	    int[] changeRequest = new int[2];
	    changeRequest[FIRST_NUMBER] = Integer.parseInt(changeRequestStr[FIRST_NUMBER]);
	    changeRequest[SECOND_NUMBER] = Integer.parseInt(changeRequestStr[SECOND_NUMBER]);
	    changeRequests.add(changeRequest);
	}

	// ?????\???????????????????´???????????????????????????????
	int[] outputArray = getDrawedArray(changeRequests, vertical, horizontal);

	// ???????????????????????????????????¨?????\???????????????????????????????????????1??????????????????
	for (int i = 1; i < outputArray.length; i++) {
	    System.out.println(outputArray[i]);
	}

    }

    /**
     * ?????? ?????????????´???????????????\??????????????????
     * 
     * @param changeRequests
     * @param vertical
     * @param horizontal
     * @return ?????\?????????
     */
    private static int[] getDrawedArray(List<int[]> changeRequests, int vertical, int horizontal) {
	// ?????\?????????????????????????????????????????????
	// outputArray[0]????????¨?????????
	int[] outputArray = new int[vertical + 1];
	for (int i = 1; i < outputArray.length; i++) {
	    outputArray[i] = i;
	}

	// ?????????????????????????£????????????\????????????
	for (int[] changeRequest : changeRequests) {
	    int mediator = 0;
	    mediator = outputArray[changeRequest[FIRST_NUMBER]];
	    outputArray[changeRequest[FIRST_NUMBER]] = outputArray[changeRequest[SECOND_NUMBER]];
	    outputArray[changeRequest[SECOND_NUMBER]] = mediator;

	}

	return outputArray;

    }

}

Measured memory_bytes: 24176
use strict;
use warnings;
use utf8;
use feature qw/say/;

my $str = <STDIN>;
my $num = length $str;
chop $str;

while (length $str) {
    chop $str;
    my $len = length $str;
    last if(substr($str, 0, $len/2) eq substr($str, $len/2, $len));
}

say length $str;


Measured memory_bytes: 768
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;
using namespace chrono;
 
typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

//#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define loop(x,n) for(int x = 0; x < n; ++x)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 100001;

string get_str() {
    string temp;
    cin >> temp;
    return temp;
}
int get_int() {
    int temp;
    cin >> temp;
    return temp;
}

const int N = 7;
char ar[N][N];
 
void solve() {
  int r, c, k;
  cin >> r >> c >> k;
  for(int i = 0; i < r; i++) cin >> ar[i];
  int ans = 0;
  for(int i = 0; i < (1<<r); i++) {
      for(int j = 0; j < (1<<c); j++) {
          int black = 0;
          for(int m = 0; m < r; m++) {
              for(int n = 0; n < c; n++) {
                  if(((i>>m) & 1) == 0 && ((j>>n) & 1) == 0 && ar[m][n] == '#') {
                      black++;
                  }
              }
          }
          if(black == k) ans++;
      }
  }
  cout << ans;
}

int main() {
    
    solve();

}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
using namespace std;
int dp[100010];

int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  dp[1]=abs(a[1]-a[0]);
  for(int i=2;i<n;i++){
    dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 入力値を数値で返却する
def gets_i()
  gets.chomp.to_i
end

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end
# N, M = gets_i_list
# list = gets_i_list

N = gets_i
D, X = gets_i_list

total = X
N.times do
  a = gets_i
  count = (D - 1) / a + 1
  total += count
end

puts total


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

int main()
{
  int a, b;
  cin >> a >> b;
  if (a < b)
  {
    for (int i = 0; i < b; i++)
    {
      cout << a;
    }
    cout << endl;
    return 0;
  }
  for (int i = 0; i < a; i++)
  {
    cout << b;
  }
  cout << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int[] m = new int[n + 1];
    for (int i = 1; i <= n; i++) {
      for (int j = i; j <= n; j += i) {
        m[j]++;
      }
    }
    long count = 0L;
    for (int c = 1; c < n; c++) {
      int ab = n - c;
      count += (long) m[ab];
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 36640