akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        ArrayList<DJSet> ds = new ArrayList<DJSet>();
        for(int i = 0; i < m; i++) ds.add(new DJSet(n));
        for(int i = 0; i < m; i++){
            int a = sc.nextInt()-1;
            int b = sc.nextInt()-1;
            for (int j = 0; j < m; j++) {
                if(i != j) ds.get(j).union(a, b);
            }
        }
        int ans = 0;
        for (int i = 0; i < m; i++) {
            if(ds.get(i).countSet() != 1) ans++;
        }

        System.out.println(ans);
        sc.close();
    }

}

class DJSet {
    /**
     * 各要素の親を保持する配列。
     * 自信が根である要素は負の数を持つ。
     * （負の数の場合、絶対値がその集合の要素数）
     */
    public int[] upper;

    /**
     * コンストラクタ。
     * @param n 対象となる要素数
     */
    public DJSet(int n) {
        upper = new int[n];
        Arrays.fill(upper, -1);
    }

    /**
     * 要素xが含まれる集合のrootを求める。
     * rootを求める過程で経路圧縮しrootが親になるようにする。
     * @param x 要素x
     * @return 要素xが含まれる集合のroot
     */
    public int root(int x) {
        return upper[x] < 0 ? x : (upper[x] = root(upper[x]));
    }

    /**
     * 要素xと要素yが同じ集合か判定する。
     * @param x 要素x
     * @param y 要素y
     * @return 要素xと要素yが同じ集合であればtrue、そうでなければfalseを返す。
     */
    public boolean same(int x, int y) {
        return root(x) == root(y);
    }

    /**
     * 要素xと要素yを含むそれぞれの集合を合併する。
     * 要素数の多い集合のrootを残し、少ないほうのrootをその下に合併する。
     * @param x 要素x
     * @param y 要素y
     * @return 要素xと要素yを含むそれぞれの集合を合併できたらtrue、もともと同じ集合で合併しなかったらfalseを返す。
     */
    public boolean union(int x, int y) {
        x = root(x);
        y = root(y);
        if (x != y) {
            if (upper[y] < upper[x]) {
                int t = x;
                x = y;
                y = t;
            }
            upper[x] += upper[y];
            upper[y] = x;
        }
        return x != y;
    }

    /**
     * 集合の数を数える。
     * @return 集合の数
     */
    public int countSet() {
        int c = 0;
        for (int u : upper) {
            if (u < 0)
                c++;
        }
        return c;
    }

    /**
     * 要素ｘが含まれる集合の要素数を数える。
     * @param x 要素ｘ
     * @return 要素ｘが含まれる集合の要素数
     */
    public int countElement(int x) {
        return upper[root(x)] * -1;
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int N;
    int A[114514];
    int B[114514]={};
    int X=0;
    cin >> N;
    REP(i,N){cin >> A[i];B[A[i]]++;}
    if(N==1){cout << 1 <<endl;}
    else if(N==2){
        if(abs(A[0]-A[1])<=2){cout << 2 << endl;}else{cout << 1 <<endl;}
    }else{
        REP(i,N-2){
            X=max(X,B[i]+B[i+1]+B[i+2]);
        }
        cout << X << endl;
    }
	return 0;
}

Measured memory_bytes: 1024
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {
        var HW = Console.ReadLine().SplittedStringToInt32List();
        var H = HW[0];
        var W = HW[1];

        var grid = new char[H + 2, W + 2];
        for (int i = 0; i < H + 2; i++)
        {
            for (int j = 0; j < W + 2; j++)
            {
                grid[i, j] = '#';
            }
        }
        for (int i = 1; i < H + 1; i++)
        {

            var str = Console.ReadLine().ToList();
            for (int j = 1; j < W + 1; j++)
            {
                grid[i, j] = str[j - 1];
            }
        }
        for (int i = 0; i < H + 2; i++)
        {
            var sb = new StringBuilder();
            for (int j = 0; j < W+ 2; j++)
            {
                sb.Append(grid[i, j]);
            }
            Console.WriteLine(sb.ToString());
        }

        Console.ReadLine();
    }

    public static void PrintArray<T>(T[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            for (int j = 0; j < array.GetLength(1); j++)
            {
                Console.Write(array[i, j] + " ");
            }
            Console.WriteLine();
        }
    }

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;

    public static int Max(params int[] values)
    {
        var maxes = -1;
        for (int i = 0; i < values.Length; i++)
        {
            maxes = Math.Max(values[i], maxes);
        }
        return maxes;
    }

    #endregion
}



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

using namespace std;

int main() {
     string s;
     int q;
     bool reversed =  false;
     vector<vector<char> > chars(2,vector<char>());

    cin >> s;
     cin >> q;

     for(int i=0; i<q ; i++){
        int t;
        cin >> t;
        if(t == 1){
            //文字列Sの反転操作
            /*
            for(int i = 0; i < s.length()/2; i++){
                //左右対称に入れ替え。
                char buf = s[i];
                s[i] = s[s.length()-1-i];
                s[s.length()-1-i] = buf;
            }
            */

           reversed = !reversed;

        }else if(t == 2){
            int f;
            char c;

            cin >> f >> c;

            if(f == 1){
                //先頭に追加
                chars[reversed].insert(chars[reversed].begin(),c);

            }else if(f == 2){
                //末尾に追加
                chars[!reversed].insert(chars[!reversed].begin(),c);
            }

        }
     }

     //最終処理
     string top(chars[0].begin(),chars[0].end());
     string bottom(chars[1].begin(),chars[1].end());

     reverse(bottom.begin(),bottom.end());

     s = top + s + bottom;

     if(reversed) reverse(s.begin(),s.end());

     //結果の出力
     cout << s << "\n";
}


Measured memory_bytes: 1404
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef string str;
typedef std::pair<ll,ll> pl;
typedef std::map<string, ll> msl;
typedef std::map<ll, ll> mll;
typedef std::vector<ll> vl;
typedef std::vector<pl> vpl;
const long double EPS = 1e-9;

#define rep(i, n) for(ll (i) = 0; (i) < (n) ; (i)++ )
#define For(i, a, b) for(ll (i) = (a); (i) < (b) ; (i)++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define tol(c) char((c)+0x20)
#define tou(c) char((c)-0x20)
#define pb push_back
#define mp make_pair
#define pr(a) cout << (a)
#define prl(a) cout << (a) << endl
#define prl2(a,b) cout << (a) << " " << (b) << endl
#define prs(a) cout << (a) << " "
#define yn(condition) if ((condition)) prl("Yes"); else prl("No");
#define YN(condition) if ((condition)) prl("YES"); else prl("NO");
#define rpr(i,n,ans) rep((i),(n)) prs((ans[(i)]))
#define cpr(i,n,ans) rep((i),(n)) prl((ans[(i)]))
#define in1(a) cin >> (a)
#define in2(a,b) cin >> (a) >> (b)
#define in3(a,b,c) cin >> (a) >> (b) >> (c)
#define in4(a,b,c,d) cin >> (a) >> (b) >> (c) >> (d)
#define rin1(i,n,a) rep((i),(n)) cin >> (a[(i)])
#define rin2(i,n,a,b) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)])
#define rin3(i,n,a,b,c) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)]) >> (c[(i)])
#define e1 first
#define e2 second
#define ctol(c) ll((c)) - ll('0')
#define ltos(n) to_string((n))
#define items(kv, v) for(auto &(kv): (v))
#define ndig(N, n) ctol(ll(ltos((N))[ll(ltos((N)).length()) - (n)]))
#define beto(a,b,c) (a) < (b) && (b) < (c)
#define betc(a,b,c) (a) <= (b) && (b) <= (c) 
#define rsort(a,n) sort(a,a+n,greater<>())

const ll mod = 1e9 + 7;
const ll INF = mod * mod;
const ll MAX_N = 200;

int main(void){
    ll n;
    ll r[1000],l[1000];
    ll ans = 0;

    in1(n);
    rin2(i,n,l,r);

    rep(i,n) ans += r[i] - l[i] + 1;
    prl(ans);

    return 0;
}

Measured memory_bytes: 256
def main():
    num, walk_num = map(int, input().split())
    data_kari = list(map(int, input().split()))
    data = [0 for i in range(num)]

    for i in range(num):
        if data_kari[i] >= 0:
            break
    if data_kari[i] < 0:
        i += 1

    for j in range(i):
        if j == i - 1:
            data[j] = data_kari[j]
        else:
            data[j] = data_kari[j] - data_kari[j + 1]

    if i == num:
        i -= 1
    data[i] = data_kari[i]
    for j in range(i + 1, num):
        data[j] = data_kari[j] - data_kari[j -1]

    start_ind = max(0,i - walk_num + 1)

    data_sum_fu = 0
    data_sum_sei = 0

    for i in range(start_ind, start_ind + walk_num):
        if data[i] > 0:
            data_sum_sei += data[i]
        else:
            data_sum_fu += abs(data[i])

    ans = 2 * min(data_sum_sei, data_sum_fu) + max(data_sum_sei, data_sum_fu)


    for i in range(start_ind + 1, num - walk_num + 1):
        left_data = data[i - 1]
        right_data = data[i + walk_num - 1]

        if left_data > 0:
            break
        data_sum_fu -= abs(left_data)
        if right_data > 0:
            data_sum_sei += right_data
        else:
            data_sum_fu += abs(right_data)

        ans_kari = 2 * min(data_sum_sei, data_sum_fu) + max(data_sum_sei, data_sum_fu)


        if ans_kari < ans:
            ans = ans_kari

    print(ans)





if __name__ == '__main__':
    main()

Measured memory_bytes: 14252
use strict;
use warnings;

my ($a, $b, $c, $d) = split //, <STDIN>;
my @op = ('+', '-');
my $ans;

OUTER: for (my $op1 = 0; $op1 <= 1; $op1++) {
    for (my $op2 = 0; $op2 <= 1; $op2++) {
        for (my $op3 = 0; $op3 <= 1; $op3++) {
            $ans = $a . $op[$op1] . $b . $op[$op2] . $c . $op[$op3] . $d;
            if (eval($ans) == 7) {
                last OUTER;
            }
        }
    }
}
print $ans, "=7\n";

Measured memory_bytes: 640
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
typedef long long ll;
int a,b,c;
int main(){
	cin>>a>>b>>c;

	if((b-a)==(c-b))cout<<"YES"<<endl;
	else cout<<"NO"<<endl;






    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
    int key;//値を格納する場所
    struct node *prev,*next;//１つ前の値と後ろの値のメモリ位置を格納する場所
};

struct node *nil;//番兵を定義（データは無いが連結リストの基準となるもの）
void init(){//番兵のノードを作成する
    nil = (struct node *)malloc(sizeof(struct node));//構造体のサイズに従ってメモリ容量を確保し、そのメモリの種類を指定する。
    nil -> next = nil;//それぞれのメモリにnilを格納する
    nil -> prev = nil;
}

void insert(int key){//値xが格納されたリストを連結リストの先頭に追加
    struct node *x=(struct node *)malloc(sizeof(struct node));//ポインタ型構造体変数xを持つ構造体のメモリ領域を新たに確保する
    x->key=key;//keyノードにkey（入力された値）を代入
    x->next=nil->next;//リストの先頭に追加するために番兵のnextにある値をxのnextに格納する。
    nil->next->prev=x;//元々番兵のnextに指定されていた構造体のprevにxのアドレスを格納したいので番兵から辿って格納する
    x->prev=nil;//xをリストの先頭に追加する時、番兵の次に位置することになるためxのprevには番兵を入れる
    nil->next=x;//番兵のnextは使用したので最後にxのアドレスに書き換える
    return;
}

void deleteFirst(){//リストの先頭の構造体を削除
    struct node *target=nil->next;//番兵の次の構造体を削除するので、target変数を定義して番兵の次の構造体を設定する。
    nil->next=target->next;//削除する構造体のnextに入っているアドレスを番兵のnextに格納する
    target->next->prev=nil;//削除する構造体のprevに番兵のアドレスを格納する
    free(target);//構造体を削除する
    return;
}

void deleteLast(){//リストの末尾にある構造体を削除
    struct node *target=nil->prev;//番兵のprev（リストの一番最後にある構造体）をtargetにする
    nil->prev=target->prev;//削除する構造体のprevに入っているアドレスを番兵のprevに格納し、１つ前の構造体と番兵をつなげる
    target->prev->next=nil;//削除する構造体の１つ前の構造体に番兵のアドレスを格納する
    free(target);//削除
    return;
}

void delete(int key){//値xを探索しそれを格納している構造体を削除する、削除するのは最初に見つけたもののみ
    struct node *searcher=nil->next;//searcherというポインタ型構造体変数を定義し、番兵の次の構造体から探索を始める。
    while(searcher!=nil &&searcher->key!=key){//searcherが番兵に戻ってくる、もしくは目的のノードを見つけるまで繰り返す。
        searcher=searcher->next;//次の構造体に行く
    }
    if(searcher==nil){//番兵に辿り着いた場合、一周しているので値が見つからなかったと判断し何もせずに終了する。
        return;
    }
    //値を見つけループから抜けた後の削除処理、今いるアドレスの前後の構造体同士をつなげる
    searcher->prev->next=searcher->next;//searcherの前の構造体のnextをsearcherの次の構造体のprevに設定する
    searcher->next->prev=searcher->prev;//searcherの次の構造体のprevをsearcherの前の構造体のnextに設定する
    free(searcher);//searcherにある構造体のメモリを削除する。
    return;
}

int main(void){
    int com_num;//何回コマンドを入力するのかを設定する変数
    int delete_co = 0;//削除回数
    init();//番兵
    scanf("%d",&com_num);
    if(com_num > 2000000){exit(0);}
    for(int i=0;i<com_num;i++){//設定した回数分ループ
        char com[20];//コマンドの文字を格納する配列
        int num;//操作を行う数値
        scanf("%s",com);//コマンドのみで判定できるものから判定する
        if(strcmp(com,"deleteFirst")==0){
            deleteFirst();
        }else if(strcmp(com,"deleteLast")==0){
            deleteLast();
        }else{
            scanf("%d",&num);//数値をコマンドに従って操作する
            if(strcmp(com,"insert")==0){
                insert(num);
            }else if(strcmp(com,"delete")==0){
                delete(num);
                delete_co = delete_co + 1;
            }
        }
        if(delete_co > 20){exit(0);}
    }
    struct node *output=nil->next;//番兵の次、データがある最初の構造体を指定
    while(1){//構造体のkyeノードに格納されている数値を出力していく
        printf("%d",output->key );
        if(output->next!=nil){
            output=output->next;
            printf(" ");//空白
        }else{
            break;
        }
        
    }
    printf("\n");//改行
    return 0;
}


Measured memory_bytes: 33028
char=['A','B','C','D','E','F','G',
    'H','I','J','K','L','M','N',
    'O','P','Q','R','S','T','U',
    'V','W','X','Y','Z']
n=int(input())
s=list(input())
ans=''
for i in range(len(s)):
    ans+=char[(char.index(s[i])+n)%26]
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++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int a, b;
    cin >> a >> b;
    if(a <= 8 && b <= 8)cout << "Yay!" << endl;
    else cout << ":(" << endl;
}

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


int main() {
  ll N;
  cin >> N;
  ll result = pow(10, 12);
  for (ll i = 1; i <= sqrt(N); ++i) {
    ll div = N / i;
    if (div * i == N) {
      result = min(result, div + i - 2);
    }
  }
  cout << result << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define _size(X) (int)((X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 100000;
int N, K;
int S[MAX_N];
string tmp_str;
vector<Pii> vp;

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

  cin >> N >> K;
  cin >> tmp_str;
  rep(i, N) S[i] = tmp_str[i]-'0';

  for (int i = 0; i < N;) {
      int color = S[i];
      int _count = 0;
      while (i < N && S[i] == color) {
          ++_count;
          ++i;
      }
      vp.push_back(Pii(color, _count));
  }

  vector<ll> sum(_size(vp));
  if (vp[0].fi == 0) {
      sum[0] = vp[0].sc;
      int idx = 1;
      for (int i = 1; i+1 < vp.size(); i += 2) {
          sum[idx++] = vp[i].sc + vp[i+1].sc;
      }
  } else {
      if (vp.size() >= 2) {
          sum[0] = vp[0].sc + vp[1].sc;
          int idx = 1;
          for (int i = 2; i+1 < vp.size(); i += 2) {
              sum[idx++] = vp[i].sc + vp[i+1].sc;
          }
      }
  }


  int ans = 0;
  int t = 0;
  int idx = 0;
  for (int i = 0; i < vp.size(); ++i) {
      Pii pii = vp[i];
      if (pii.fi == 1) {
          t += pii.sc;
      } else {
          if (K > 0) {
              t += pii.sc;
              --K;
          } else {
              t -= sum[idx++];
              t += pii.sc;
          }
      }
      ans = max(ans, t);
  }

  cout << ans << endl;

  return 0;
}


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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int T = 1e6+3;
const int N = 42;
bitset<T> bit[N];
bitset<T> my;
vector<ll> v;
int n,k;

int main() {
    ios_base::sync_with_stdio(false);
    cin >> n >> k;
    vector<ll> ve(n);
    for(int i = 0; i < n; i++) cin >> ve[i];

    for(int i = 0; i < n; i++) {
        ll sum = 0;
        for(int j = i; j < n; j++) {
            sum += ve[j];
            v.pb(sum);
        }
    }

    for(int i = 0; i < v.size(); i++) {
        ll x = v[i];
        for(ll j = 1, casa = 0; j <= x; j <<= 1, casa++)
            if(x&j) bit[casa][i] = 1;
    }

    ll ans = 0;
    my.set();

    for(int ok = N-1; ok >= 0; ok--) {
        if(bit[ok].count() >= k) {
            bitset<T> tmp = my&bit[ok];
            if(tmp.count() >= k) {
                ans += (1ll << ok);
                my &= bit[ok];
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8172
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
const ll INF = 1LL<<60;
 
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
 
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; }
 
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
 
const ll MOD = 1e9+7;
 
ll dp[2100][2100] = {0};
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    int N, M;
    cin >> N >> M;
    vector<int> S(N);
    vector<int> T(M);
 
    for(int i = 0; i < N; i++){
        cin >> S[i];
    }
 
    for(int i = 0; i < M; i++){
        cin >> T[i];
    }
 
    for(int i = 0; i <= N; i++){
        for(int j = 0; j <= M; j++){
            dp[i][j] = 0;
        }
    }
 
    for(int i = 0; i <= N; i++){
        dp[i][0] = 1;
    }
    for(int j = 0; j <= M; j++){
        dp[0][j] = 1;
    }
 
    for(int k = 0; k < min(N, M); k++){
        for(int i = 0; i < N; i++){
            if(S[i] == T[k]){
                dp[i+1][k+1] = (dp[i+1][k] + dp[i][k+1])%MOD;
            }else{
                dp[i+1][k+1] = (dp[i+1][k] + dp[i][k+1] + MOD - dp[i][k])%MOD;
            }
        }
 
        for(int j = 0; j < M; j++){
            if(T[j] == S[k]){
                dp[k+1][j+1] = (dp[k+1][j] + dp[k][j+1])%MOD;
            }else{
                dp[k+1][j+1] = (dp[k+1][j] + dp[k][j+1] + MOD - dp[k][j])%MOD;
            }
        }
    }
 
    cout << dp[N][M] << endl;
 
 
  
    return 0;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int k=a;
  string s="NO";
  for(int i=0;i<b;i++){
    if(k%b==c){
      s="YES";
      break;
    }
    k+=a;
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <utility>
#include <cstring>
#define rep(i,n) for(int i=0;i<n;i++)
using ll =long long;
using namespace std;

int main(){
	ll n, a, b,ans=0;
	cin >> n >> a >> b;
	ll q = n / (a + b);
	ll r = n % (a + b);
	ans = a * q;
	if (r > a)ans += a;
	else ans += r;

	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n, m;
	cin >> n >> m;
	vector<vector<int>> graph(n, vector<int>());
	rep(_, m) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		graph[u].pb(v);
		graph[v].pb(u);
	}
	vector<int> dis(n, inf);
	queue<int> que;
	dis[0] = 0; que.push(0);
	while (!que.empty()) {
		int p = que.front(); que.pop();
		for (int i : graph[p]) {
			if (dis[i] == inf) {
				dis[i] = dis[p] + 1;
				que.push(i);
			}
		}
	}
	cout << "Yes\n";
	rep(i, n) {
		if (i == 0) continue;
		for (int j : graph[i]) {
			if (dis[j] < dis[i]) {
				cout << j + 1 << '\n';
				break;
			}
		}
	}
}

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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  auto cmp = [&](int i, int j) {
    return a[i].first < a[j].first;
  };
  auto cmp2 = [&](int i, int j) {
    return a[i].second > a[j].second;
  };
  auto proc = [&](bool l) -> long long {
    priority_queue<int, vector<int>, decltype(cmp)> maxl(cmp);
    priority_queue<int, vector<int>, decltype(cmp2)> minr(cmp2);
    for (int i = 0; i < n; ++i) {
      maxl.push(i);
      minr.push(i);
    }
    vector<bool> used(n);
    long long d = 0;
    int next, pos;
    if (l) {
      next = minr.top();
      pos = min(0, a[next].second);
      if (a[next].first > 0) {
        return -1;
      }
    } else {
      next = maxl.top();
      pos = max(0, a[next].first);
      if (a[next].second < 0) {
        return -1;
      }
    }
    used[next] = true;
    d += abs(pos);
    for (int i = 1; i < n; ++i) {
      while (!maxl.empty() && used[maxl.top()]) {
        maxl.pop();
      }
      while (!minr.empty() && used[minr.top()]) {
        minr.pop();
      }
      int next, npos;
      if (i % 2 == l) {
        next = maxl.top();
        npos = max(pos, a[next].first);
      } else {
        next = minr.top();
        npos = min(pos, a[next].second);
      }
      used[next] = true;
      d += abs(pos - npos);
      pos = npos;
    }
    d += abs(pos);
    return d;
  };
  cout << max(proc(0), proc(1)) << endl;
  return 0;
}


Measured memory_bytes: 2300
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
/*  TLEだった orz
int main(void) {
  int n; cin >> n;
  std::vector<int> v(n);
  rep(i, n) {
    cin >> v[i];
  }
  bool flag = false;
  rep(i,n){
    if(v[i]%2==0){
      flag = true;
    }
  }
  if(!flag) {
    cout << 0 << endl;
    return 0;
  } */
  /* flag = false;
  int ans = 0;
  while(!flag) {
    rep(i,n){
      if(v[i]%2==0 && !flag) {
        v[i] /= 2;
        flag = true;
      } else {
        v[i] *= 3;
      }
    }
    flag = true;
    rep(i,n){
      if(v[i]%2==0){
        flag = false;
      }
    }
    if(ans==0&&flag){
      std::cout << 0 << '\n';
      return 0;
    }
    ans++;
    //printf("ans=%d\n", ans);
  }
  std::cout << ans << '\n';
} 
*/
int main() {
    ll N; cin >> N;
    vector<ll> a(N);
    rep(i,N) cin >> a[i];
    int ans = 0, cnt=0;
    while (1)
    {
        cnt = 0;
        rep(i,N) {
            if(a[i]%2==0 && a[i]!=0) {
                a[i] /= 2;
                break;
            } else {
                cnt++;
            }
        }
        if(cnt == N) break;
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
def main():
    N, K = map(int, input().split())
    *D, = map(int, input().split())

    price = N
    while True:
        a = False
        for x in D:
            if str(x) in str(price):
                a = True
                break
        if not a:
            break

        price += 1

    print(price)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
A500 = int(input())
B100 = int(input())
C50 = int(input())
X = int(input())

c = 0
for i in range(A500+1):
  for j in range(B100+1):
    for k in range(C50+1):
      if X == i*500 + j* 100 + k*50:
        c+=1
print(c)


Measured memory_bytes: 9112
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
    int N;
    cin >> N;
    double x[N],y[N];
    for(int i = 0 ; i < N ; i++) cin >> x[i];
    for(int i = 0 ; i < N ; i++) cin >> y[i];
    double p1 = 0, p2 = 0, p3 = 0, pINF = 0;
    for(int i = 0 ; i < N ; i++){
        double diff = fabs(x[i]-y[i]);
        p1 += diff;
        p2 += pow(diff, 2.0);
        p3 += pow(diff, 3.0);
        pINF = max(pINF, diff);
    }
    p2 = sqrt(p2);
    p3 = pow(p3, 0.33333333333333333333);
    printf("%.6f\n%.6f\n%.6f\n%.6f\n" ,p1 ,p2 ,p3, pINF);
    return 0;
}


Measured memory_bytes: 3412
n = int(input())
s = [int(input()) for _ in range(n)]
t = []

for i in range(n)[::-1]:
    if s[i]%10==0:
        t.append(s.pop(i))

s.sort()
t.sort()

if sum(s)%10==0:
    if len(s)!=0:
        s.pop(0)

num = sum(s)+sum(t)

if len(s)==0:
    num = 0


print(num)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#include<cmath>

using namespace std;

//int mod_num_counter[2030];


int main()
{
  long long  a, b, c, k;
  cin >> a >> b >> c >> k;
  
  long long ans;
  if (k <= a)
  {
    ans = k;
  }
  else if (k <= a+b)
  {
    ans = a;
  }
  else if (k <= a+b+c)
  {
    ans = a - (k -(a+b));
  }
  else
  {
    ans = -1234;
  }
  cout << ans << endl;
    
  return 0;
}

Measured memory_bytes: 3612
#include<cstdio>

int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    for(int i = 0;;i++){
        for(int j = 0;;j++){
            if(a >= b){
                int k = a;
                a = b;
                b = k;
            }
            else if(b >= c){
                int l = b;
                b = c;
                c = l;
            }
            else{
                a = a;
                b = b;
                c = c;
            }
            break;
        }
        if(a <= b && b <=c){
            break;
        }
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}


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

int main(void) {
	string s;
	string res = "yes";
	cin >> s;

	for (int i = 0; i < s.length(); i++){
		for(int j = i+1; j < s.length(); j++){
			if(s[i] == s[j]) res = "no";
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int q[N];
int main()
{
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
	string s;
	cin>>s;
	int ans=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!=s[s.size()-i-1])ans++;
	}
	cout<<ans/2;

}


Measured memory_bytes: 3624
#include <string>
#include <iostream>
#include <stack>
#include <queue>
#include <set> // 要素数は size() で取得
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

template <class InputIterator, class T>
bool contains(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// =========ここまでテンプレ============

int main()
{
    ll r;
    cin >> r;
    ll total;
    total = sum(vector{1, 2, 3, 4, 5});
    string str = "aiueo";
    string result;
    for (char c : str)
    {
        result.push_back(c);
        result.push_back('x');
    }
    if (gcd(64, 96) == 32 && total == 15 && result == "axixuxexox")
    {
        cout << setprecision(15) << r * 6.283185307179586232;
    }
    else
    {
        cout << "bad!!";
    }
}

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

int main(){
  
  int N,R;
  cin >> N >> R;
  if(N <10){
    
    int a = 100 * (10 - N);
    
    R += a;
    cout << R <<endl;
  }else{
    
    cout << R <<endl;
  }
}


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

int main(){
  int Wh,Wm,Sh,Sm;
  int K;
  cin >> Wh >> Wm >> Sh >> Sm >> K;
  
  int W,S;
  W = Wh*60+Wm;
  S = Sh*60+Sm;
  
  cout << S-W-K << endl;
}

Measured memory_bytes: 3596
#define _CRT_SECURE_NO_WARNINGS

#include<bits/stdc++.h>

using namespace std;

#define PI			3.14159265
#define OO			1e9
#define SS       	second
#define FF       	first
#define Trace(n)  	cout<< #n <<" = "<< n << endl; 
#define ll			long long
//#define endl		"\n"
#define all(v) ((v).begin()), ((v).end())
#define boom main
#define cn(n)  scanf("%d", &n)
#define cnl(n)  scanf("%lld", &n)
#define F(i, a, b) for(int i=a; i<=b; i++)
#define rep(i, n) for(int i=0; i<n; i++)
#define Fill(ar, val) memset(ar, val, sizeof(ar))
#define bit(n) (1<<(n))

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

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}

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

	int N1 = v[0];
	int N2 = v[1];

	set<int> divs;
	map<int, int> mp;

	for (int i = 1; i*i <= N1; i++)
	{
		if (N1%i == 0)
		{
			divs.insert(i);
			divs.insert(N1 / i);
		}
	}

	for (int i = 1; i*i <= N2; i++)
	{
		if (N2%i == 0)
		{
			divs.insert(i);
			divs.insert(N2 / i);
		}
	}


	for (int i = 0; i < n; i++)
	{
		for (auto Num : divs)
		{
			if (v[i] % Num == 0)
			{
				mp[Num]++;
			}
		}
	}

	int ans = 1;
	for (auto it : mp)
	{
		if (it.SS >= (n - 1))
			ans = max(ans, it.FF);
	}

	cout << ans;
}

Measured memory_bytes: 640
/* ex 3-2
    kas056 */
#include <stdio.h>
int main(void){
    int N , R;

    // Nの読み込み
    scanf("%d", &N);
    //余り(remain)で考える
    R = N % 10;
	//以下条件によって場合分け（「または」を使うとき）
    //remainが2,4,5,7,9の場合
    if (R==2 || R==4 || R==5 || R==7 || R==9){
        printf("hon\n");
    }
    //remainが0,1,6,8の場合
    else if (R==0 || R==1 || R==6 || R==8){
        printf("pon\n");
    }
    //remainが3の場合
    else{
        printf("bon\n");
    }
    return 0;
}


Measured memory_bytes: 1612
// Aizu Vol0 0000: QQ
// 2017.7.28

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main()
{
	int a, b;


	for (a = 1; a < 10; a++) {
		for (b = 1; b < 10; b++) {
			printf("%dx%d=%d\n", a, b, a*b);
		}
	}
	return 0;
}

Measured memory_bytes: 524
import sys

h,w = map(int,input().split())

li = [[0] * (w+2)]  + [[0] + list(input()) + [0] for _ in range(h)] + [[0] * (w+2)]

for i in range(h+2):
    for j in range(w+2):
        if li[i][j] == "#":
            if li[i][j-1] == "#" or li[i][j+1] == "#" or li[i-1][j] == "#" or li[i+1][j] == "#":
                pass
            else:
                print("No")
                sys.exit()
else:
    print("Yes")

Measured memory_bytes: 3064
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

#include <bits/stdc++.h>
using namespace std;

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
    if (ib == ie) {
        ib = ibuf;
        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
    }
    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

const size_t N = 5e5 + 5;
const int MOD = 998244353;

int qpow(int base, int e) {
    int ret = 1;
    for (; e; e >>= 1) {
        if (e & 1) {
            ret = (LL) ret * base % MOD;
        }
        base = (LL) base * base % MOD;
    }
    return ret;
}

int fac[N], inv[N];

void prep() {
    fac[0] = 1;
    for (int i = 1; i <= N - 1; ++i) {
        fac[i] = (LL) fac[i - 1] * i % MOD;
    }
    inv[N - 1] = qpow(fac[N - 1], MOD - 2);
    for (int i = N - 1; i >= 1; --i) {
        inv[i - 1] = (LL) inv[i] * i % MOD;
    }
}

int comb(int n, int m) {
    return (LL) fac[n] * inv[m] % MOD * inv[n - m] % MOD;
}

int main() {
    prep();
    int n = read(), m = read(), ans = 0;
    if (n > m) swap(n, m);
    int mul1 = qpow(n + 1, m - n), mul2 = 1;
    for (int i = n; i >= 0; --i) {
        ans = (ans + (i & 1 ? -1LL : 1LL) * comb(n, i) * comb(m, i) % MOD
                * fac[i] % MOD * mul1 % MOD * mul2) % MOD;
        mul1 = (LL) mul1 * (n + 1) % MOD;
        mul2 = (LL) mul2 * (m + 1) % MOD;
    }
    if (ans < 0) ans += MOD;
    cout << ans;
    return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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 ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  ll n, k;

  cin >> n >> k;

  ll rec = 1;

  REP(i, n) rec = (k < rec) ? (rec + k) : (rec + rec);

  cout << rec << endl;
  return 0;
}


Measured memory_bytes: 256
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
import math

def solve():
    N = int(sysread())
    KLR_left, KLR_right = [], []
    counts_l, counts_r = [0] * (N+1), [0] * (N+1)

    for _ in range(N):
        k,l,r = map(int, sysread().split())
        if l>r:
            KLR_left.append((k, l, r))
            counts_l[k] += 1
        else:
            KLR_right.append((k, l, r))
            counts_r[k] += 1

    KLR_left = sorted(KLR_left, key = lambda x:x[0], reverse=True)
    KLR_right = sorted(KLR_right, key=lambda x:x[0])
    queue_left = []
    queue_right = []
    dump = []
    SUM = 0
    for i in range(1, N+1):
        for j in range(counts_l[i]):
            k, l, r = KLR_left.pop()
            heappush(queue_left, (l-r, l, r))
            SUM += l

        while True:
            if len(queue_left)>i:
                l_r, l, r = heappop(queue_left)
                dump.append((l_r, l, r))
                SUM -= l_r
            else:break


    #print(filled_left)
    for i in list(range(1, N+1))[::-1]:
        for j in range(counts_r[i]):
            k, l, r = KLR_right.pop()
            heappush(queue_right, (r-l, l, r))
            SUM += r
        while True:
            if len(queue_right) > N-i:
                try:
                    r_l, l, r = heappop(queue_right)
                except:break
                dump.append((r_l, l, r))
                SUM -= r_l
            else:break
    return SUM

def run():
    T = int(sysread())
    for i in range(T):
        print(solve())



if __name__ == "__main__":
    run()


Measured memory_bytes: 50928
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cstring>

using namespace std;

string T, P;
vector<int> v1, v2;
int main(void) {
	cin >> T >> P;
	bool ans = false;
	int ind = 0;
	for (int i = 0; i < T.size() && ind < P.size(); i++) {
		if (T[i] == P[ind]) {
			v1.push_back(i);
			ind++;
		}
	}
	if (v1.size() == P.size()) {
		ind--;
		for (int i = T.size()-1; i >= 0 && ind >= 0; i--) {
			if (T[i] == P[ind]) {
				v2.push_back(i);
				ind--;
			}
		}
		reverse(v2.begin(), v2.end());
		ans = v1 == v2;
	}
	cout << (ans ? "yes" : "no") << endl;
}

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

int gcd(int a, int b) {
    if (a < b) {
        std::swap(a, b);
    }
    while (b > 0) {
        int tmp_b = a - b * (a / b);
        a = b;
        b = tmp_b;
    }
    return a;
}


int main() {
    // ~5:06
    int N, K;
    std::cin >> N >> K;
    std::vector<int> vals(N);
    std::cin >> vals[0];
    int g = vals[0];
    int max_val = vals[0];
    for (int i = 1; i < N; i++) {
        std::cin >> vals[i];
        if (vals[i] > max_val)  {
            max_val = vals[i];
        }
        g = gcd(vals[i], g);
    }

    if (K % g == 0 && K <= max_val) {
        std::cout << "POSSIBLE" << std::endl;
    } else {
        std::cout << "IMPOSSIBLE" << std::endl;
    }
}


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

using i64 = std::int64_t;

namespace io {
  using i64 = std::int64_t;
  constexpr int is = 1 << 17;
  char ib[is], *ip = ib + is, it;
  inline char getc() {
    if (ip == ib + is) { read(STDIN_FILENO, ib, is); ip = ib; }
    return *ip++;
  }
  inline i64 scan() {
    i64 r = 0;
    if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';
    else while ((it = *ip++) & 16) r = r * 10 + it - '0';
    return r;
  }
  constexpr int os = 1 << 17;
  char ob[os], *op = ob, ot;
  inline void putc(const char c) {
    *op++ = c;
    if (op == ob + os) { write(STDOUT_FILENO, ob, os); op = ob; }
  }
  /* x shoud be greater than or equal to zero */
  inline void print(i64 x) {
    char d[20];
    int i = 0;
    while (true) {
      d[i] = x % 10 + 48;
      x /= 10;
      ++i;
      if (x <= 0) break;
    }
    while (i--) {
      putc(d[i]);
    }
  }
  inline void flush() {
    write(STDOUT_FILENO, ob, op - ob);
  }
}

signed main() {
  using namespace io;
  i64 h = scan();
  i64 n = scan();
  for (int i = 0; i < n; i++) {
    i64 a = scan();
    h -= a;
  }
  if (h <= 0) {
    write(STDOUT_FILENO, "Yes", 3);
  } else {
    write(STDOUT_FILENO, "No", 2);
  }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define int long long
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
# define mo 1000000007

signed main(){
    gok
   int c=0;
   string s;
   cin>>s;
   for(int i=0;i<s.size();i++)
   {
       if(s[i]=='A')
        c++;
   }
     if(c==3 || c==0)
            cout<<"No";
     else
        cout<<"Yes";
    return 0;
}


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

int main(){
    long long a, b;
    int k;
    cin >> a >> b >> k;
    vector<long long> v;
    for(long long i = a; i < min(a+k,b); i++){
        v.push_back(i);
    }
    for(long long i = b; i > max(b-k,a); i--){
        v.push_back(i);        
    }
    if(a == b){
        v.push_back(a);
    }
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    for(int i = 0; i < v.size(); i++){
        cout << v[i] << endl;
    }
    return 0;
}


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

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

    if(abs(c-a) <= d || (abs(a-b) <= d && abs(b-c) <= d)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import Data.List
import Data.Tuple
main = do
  [n,m] <- map read . words <$> getLine :: IO [Int]
  xs <- map (\[a,b] -> (a,b)) . map (map read . words) . lines <$> getContents :: IO [(Int,Int)]
  print $ step n (xs ++ map swap xs) 1 []

step :: Int -> [(Int,Int)] -> Int -> [Int] -> Int
step n path dest arrived =
  let 
    ns = map snd $ filter (\(a,_) -> a==dest) path
  in
    if sort (dest:arrived) == [1..n] 
       then 1
    else if dest `elem` arrived 
       then 0
    else
       sum $ [r | next<-ns, let r = step n path next (dest:arrived)]

Measured memory_bytes: 892
#include<stdio.h>
#define MAX 2000000
#define INFTY 1
int H,A[MAX+1];
void maxHeapify(int i){
  int r , l , largest;
  int temp;
  l =2 * i;
  r = 2 * i + 1;
  if(l <= H && A[l] > A[i]){
    largest = l;
  }
  else {
    largest = i;
  }
  if(r <= H && A[r]>A[largest]){
    largest = r;
  }
  if(largest != i){
    temp=A[i];
    A[i]=A[largest];
    A[largest]=temp;
    return maxHeapify(largest);

  }
}


int extract(){
  int maxv;
  if(H < 1)return -INFTY;
  maxv = A[1];
  A[1] =A[H--];
  maxHeapify(1);
  return maxv;
}
void increaseKey(int i,int key){
  int temp;
  if(key < A[i])return;
  A[i]=key;
  while(i>1 &&A[i/2] <A[i]){
    temp=A[i];
    A[i]=A[i/2];
    A[i/2]=temp;
    i =i/2;
  }
}
void insert(int key){
  H++;
  A[H]=-INFTY;
  increaseKey(H,key);
}
int main(){
  int key;
  char B[10];
  while(1){
    scanf("%s",B);
    if(B[0] == 'e' && B[1]=='n')break;
    if(B[0] == 'i'){
      scanf("%d",&key);
      insert(key);
    }
    else{
      printf("%d\n",extract());
    }

  }
  return 0;
}

Measured memory_bytes: 4692
while True:
    H,W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        s = ""
        flg = True
        for j in range(W):
            if i == 0:
                s = s + "#"
            elif i == H-1:
                s = s + "#"
            elif flg:
                s = s + "#"
                flg = False
            elif j == W-1:
                s = s + "#"
            else:
                s = s + "."
        print(s)
    print("")


Measured memory_bytes: 5608
import java.io.BufferedReader
import java.util.*

fun main() = abc138e()

@OptIn(ExperimentalStdlibApi::class)
fun abc138e() = SimpleFastIOWithToken_abc138e().exec {
    val s = readString()
    val t = readString()
    fun Char.toIndex() = this - 'a'

    val nextAppearDist = Array(26) { IntArray(s.length) }
    val repeatedS = s.repeat(2)

    for (tChar in t.toSet()) {
        var distToNext = 1
        for (i in repeatedS.indices.reversed()) {
            if (i in s.indices) nextAppearDist[tChar.toIndex()][i] = distToNext
            if (repeatedS[i] == tChar) distToNext = 1 else distToNext++
        }
        if (distToNext - 1 == repeatedS.length) return@exec println(-1)
    }

    var before = s.lastIndex
    var answer = 0L

    for (tChar in t) {
        val nextDist = nextAppearDist[tChar.toIndex()][before]
        answer += nextDist
        before = (before + nextDist) % s.length
    }

    println(answer)
}

// region kokokara template dayo (^o^)
@Suppress("unused", "HasPlatformType", "MemberVisibilityCanBePrivate", "ClassName")
private class SimpleFastIOWithToken_abc138e(private val separator: String = System.lineSeparator()) {
    private val br: BufferedReader = System.`in`.bufferedReader()
    private var st: StringTokenizer = StringTokenizer("")
    private val sb: StringBuilder = StringBuilder()
    private fun prepareNext() = run { if (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) }

    fun readString(): String = run { prepareNext() }.run { st.nextToken() }
    fun readStringList(size: Int): List<String> = List(size) { readString() }
    fun readInt(): Int = Integer.valueOf(readString())
    fun readIntList(size: Int): List<Int> = List(size) { readInt() }
    fun readLong(): Long = java.lang.Long.valueOf(readString())
    fun readLongList(size: Int): List<Long> = List(size) { readLong() }
    inline fun <reified T> readArray(size: Int, init: () -> T) = Array(size) { init() }
    inline fun <T> readList(size: Int, init: () -> T) = List(size) { init() }

    fun println(): Unit = run { sb.append(separator) }
    fun print(any: Any): Unit = run { sb.append(any) }
    fun println(any: Any): Unit = print(any.toString() + separator)

    fun exec(action: SimpleFastIOWithToken_abc138e.() -> Unit) = run {
        Thread(null, { action() }, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()
    }.run { kotlin.io.print(sb) }

    fun readLine(): Nothing = error("readLine is disabled.")
}
// endregion kokomade template dayo (^o^)


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

int main() {
  int N;
  cin >> N;
  long long Li_1,sum=0,sums;
  for(int i=0;i<N;i++) {
    sums=sum;
    //if(i==0) sum+=2,Li;
    if(i==0) sum+=1,Li_1=2;
    
    else {
      sum+=Li_1;
      Li_1=sums;
    }
  }
  cout << sum << endl;
}



Measured memory_bytes: 256
/*
ID:greenty2
LANG:C++
TASK:
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int x=a*100+b*10+c;
	if(x%4==0)
	{
		cout<<"YES"<<endl;
	}
	else
	{
		cout<<"NO"<<endl;
	}
}


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

#define fi first
#define se second
using namespace std;
using ll = long long;
using Pll = pair<ll, ll>;
constexpr ll MOD = 1000000007;

ll modpow(ll a, ll n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret = ret * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return ret;
}

int main() {
  int N;
  cin >> N;
  vector<Pll> AB(N);
  map<Pll, Pll> mp;
  ll zero = 0;
  for (auto &p : AB) {
    cin >> p.fi >> p.se;
    if (p.fi == 0 && p.se == 0) {
      zero++;
    } else if (p.fi == 0) {
      mp[Pll(0, 1)].fi++;
    } else if (p.se == 0) {
      mp[Pll(0, 1)].se++;
    } else {
      ll gc = gcd(abs(p.fi), abs(p.se));
      p.fi /= gc;
      p.se /= gc;
      if (p.fi < 0) {
        p.fi = -p.fi;
        p.se = -p.se;
      }
      if (p.second > 0)
        mp[p].fi++;
      else
        mp[Pll(-p.se, p.fi)].se++;
    }
  }
  ll ans = 1;
  for (auto p : mp)
    ans = ans * (modpow(2, p.se.fi) + modpow(2, p.se.se) - 1) % MOD;
  cout << ((ans + zero - 1 + MOD) % MOD) << endl;
  return 0;
}

Measured memory_bytes: 21904