akhauriyash/Code-Regression huggingface dataset:
s = input()
mid = len(s)//2
q = s[:mid]
if len(s)%2 == 0:
    t = list(s[mid:])
else:
    t = list(s[mid+1:])

t.reverse()
cnt = 0

for i in range(mid):
    cnt += s[i] != t[i]

print(cnt)

Measured memory_bytes: 8736
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define eb emplace_back
#define precision(n) cout << fixed << setprecision(n);
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
int main()
{
    fast;
    int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c<<endl;
        return 0;
    }


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

la = list()

if s == 1:
    l = [1] * k + [2] * (n-k)

elif s == 10**9:
    l = [s] * k + [1] * (n-k)

else:
    l = [s] * k + [s+1] * (n-k)

l = [str(i) for i in l]
print(" ".join(l))

Measured memory_bytes: 14036
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
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; }
const int INF = 1e9;
const ll MOD = 1000000007;

int main() {
    int w,h,x,y,r;cin>>w>>h>>x>>y>>r;
    if (x-r>=0 && x+r <= w && y+r<=h && y-r>=0) {
        ct("Yes");
    } else {
        ct("No");
    }
}



Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,m,i,j,k,x=0,y,z;
    string s,ss;
    cin>>n;
    cin>>s>>ss;
    for(i=0;i<n;i++){
        cout<<s[i]<<ss[i];
    }
    cout<<endl;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
        out << '(' << p.first << ',' << p.second << ')';
            return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
        in >> p.first >> p.second;
            return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
        for (T &x : v)
                    in >> x;
            return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
        for (const vector<T> &x : v)
                    out << x << '\n';
            return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
        for (const T &x : v)
                    out << x << ' ';
            return out;
}

template <class T>
ostream& operator << (ostream& out,const set<T> &s)
{
        for (const T &x : s)
                out << x << ' ';
            return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.00000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main()
{
    fast();
    ll n;
    string s1,s2;
    cin>>n>>s1>>s2;
    
    vi a;
    for(ll i=0;i<n;i++)
    {
        if(i==n-1)
            a.pb(1);
        else if(s1[i+1]==s1[i])
        {
            a.pb(2);
            i++;
        }
        else
        {
            a.pb(1);
        }
    }
    ll ans=3*a[0];
    for(ll i=1;i<sz(a);i++)
    {
        if(a[i-1]==1)
        {
            ans=(ans*2)%mod;
        }
        else
        {
            if(a[i]==2)
            {
                ans=(ans*3)%mod;
            }
        }
    }
    cout<<ans<<nl;
}


Measured memory_bytes: 3608
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

map<long long, int> factorization(long long N) {
	map<long long, int> re;
	while (true) {
		if (N % 2 == 0) {
			N /= 2;
			re[2]++;
			if (N == 1) break;
		}
		else {
			break;
		}
	}
	for (int loop = 3; (long long)loop * (long long)loop <= N; loop += 2) {
		if (N % loop == 0) {
			N /= loop;
			re[loop]++;
			loop -= 2;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	return re;
}

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination1 {
private:
	int m_module = 1000000007;
	vector<struct Memo> memo;
public:
	int calculate(int, int);
	Combination1(int, int);
};
int Combination1::calculate(int n, int k) {
	return ((memo[n].fact * memo[k].fact_inv) % m_module * memo[n - k].fact_inv) % m_module;
}
Combination1::Combination1(int memo_max, int module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

class Combination2 {
private:
	int size = 0;
	bool add(int);
public:
	vector<int> sequence;
	bool next_combination(void);
	Combination2(int, int);
};
bool Combination2::add(int index) {
	if (index == (int)sequence.size() - 1 && sequence[index] == size - 1
		|| index < (int)sequence.size() - 1 && sequence[index] == sequence[index + 1] - 1) {
		if (index == 0) {
			return false;
		}
		else {
			bool re = add(index - 1);
			sequence[index] = sequence[index - 1] + 1;
			return re;
		}
	}
	else {
		sequence[index]++;
		return true;
	}
}
bool Combination2::next_combination(void) {
	return (sequence.size() == 0) ? false : add(sequence.size() - 1);
}
Combination2::Combination2(int n, int r) {
	size = n;
	for (int loop = 0; loop < r; loop++) sequence.push_back(loop);
	return;
}

void A_Weather_Prediction(void) {

	string S; cin >> S;

	string weather[3] = { "Sunny","Cloudy","Rainy" };
	for (int loop = 0; loop < 3; loop++) {
		if (S == weather[loop]) {
			cout << weather[(loop + 1) % 3] << flush;
			break;
		}
	}
	return;
}

void B_Tap_Dance(void) {

	string S; cin >> S;

	for (int index = 0; index < S.size(); index++) {
		if (index % 2 == 0 && S[index] == 'L' || index % 2 == 1 && S[index] == 'R') {
			cout << "No" << flush;
			return;
		}
	}
	cout << "Yes" << flush;
	return;
}

void C_Attack_Survival(void) {

	int N, K, Q; cin >> N >> K >> Q;
	vector<int> player(N);
	fill(player.begin(), player.end(), 0);
	for (int loop = 0; loop < Q; loop++) {
		int A; cin >> A;
		player[A - 1]++;
	}

	for (int it : player) cout << (it + K - Q > 0 ? "Yes" : "No") << endl;
	return;
}

int main(void) {

	//A_Weather_Prediction();
	//B_Tap_Dance();
	C_Attack_Survival();
	return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N,K = inputMap()
	sushi_mii = []
	sushi_kii = []
	syu = [[] for i in range(N)]
	for i in range(N):
		t,d = inputMap()
		t -= 1
		syu[t].append(d)

	for i in syu:
		if len(i) > 0:
			i.sort()
			i = i[::-1]
			for j,val in enumerate(i):
				if j == 0:
					sushi_mii.append(val)
				else:
					sushi_kii.append(val)

	sushi_mii.sort()
	sushi_mii = sushi_mii[::-1]
	sushi_kii.sort()
	sushi_kii = sushi_kii[::-1]

	sushi_mi = []
	sushi_ki = []
	for i,val in enumerate(sushi_mii):
		if i == 0:
			sushi_mi.append(val)
		else:
			tmp = sushi_mi[i-1]
			sushi_mi.append(tmp + val)

	for i,val in enumerate(sushi_kii):
		if i == 0:
			sushi_ki.append(val)
		else:
			tmp = sushi_ki[i-1]
			sushi_ki.append(tmp + val)

	ans = 0
	for i in range(1, min(len(sushi_mi), K)+1):
		x = 0
		tmp = 0
		if K - i > len(sushi_ki):
			continue

		tmp += sushi_mi[i-1]
		x = i

		if K - i > 0:
			tmp += sushi_ki[K - i-1]

		oishi = tmp + x * x
		if ans < oishi:
			ans = oishi
	print(ans)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


Measured memory_bytes: 103120
// AOJ 1026 Hedro's Hexahedron
// 2018.2.2 bal4u@uu

#include <stdio.h>

#define getchar_unlocked()  getchar()
long long in()
{
	long long n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int main()
{
	long long n, i, k, s, ans;

	while(n = in()){
        ans = s = n >> 1;
        for(i = 1, k = 2; i*i < s; i++, k+=2) ans += (n+k-1)/k;
        ans <<= 1, ans -= i*i;
        if (n & 1) ans++;
        printf("%lld\n", (ans + n) << 3);
	}
	return 0;
}


Measured memory_bytes: 2080
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
vector<int> dx = {0,0,1,-1};
vector<int> dy = {1,-1,0,0};
int h,w;
char maze[23][23];
bool seen[23][23];

int id(int i,int j){
    return i + j * h;
}

void dfs(int now){
    int i = now % h;
    int j = now / h;
    if(seen[i][j]) return;
    seen[i][j] = true;

    rep(k,4){
        int next_i = i + dx[k];
        int next_j = j + dy[k];
        if(0 <= next_i && next_i < h && 0 <= next_j && next_j < w){
            if(seen[next_i][next_j]) continue;
            if(maze[next_i][next_j] == '#') continue;
            dfs(id(next_i,next_j));
        }
    }

    return;
}

int main(){
    while(1){
        cin >> w >> h;
        if(w==0 && h==0) break;
        rep(i,h)rep(j,w) seen[i][j] = false;
        rep(i,h)rep(j,w) cin >> maze[i][j];
        int si, sj;
        rep(i,h)rep(j,w){
            if(maze[i][j]=='@') si = i,sj = j;
        }
        dfs(id(si,sj));
        int ans = 0;
        rep(i,h)rep(j,w){
            ans += seen[i][j];
        }
        cout << ans << endl;
    }
    return 0;
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

const int MAXLN = 100;

ll res = 0;
ll cnt = 0;
vector<int> temp(MAXLN,-1);

ll comp(ll d, ll c){
    if(c == 1) return d;
    if(c % 2 == 1){
        temp[cnt] = d;
        --c, cnt++;
    }
    ll nd = d + d;
    res += c/2;
    if(nd>=10){
        nd = 1+(nd%10);
        res += c/2; 
    }
    return comp(nd, c/2);
}

int main()
{
    ll m; cin >> m;
    ll d[m], c[m];
    rep(i,m) cin >> d[i] >> c[i];

    vector<ll> fin;
    rep(i,m){
        cnt = 0;
        ll com = comp(d[i], c[i]);
        rep(j,cnt){
            com += temp[j];
            res++;
            if(com>=10){
                com = 1 + (com%10);
                res++; 
            }
        }
        fin.push_back(com);
        rep(j,cnt) temp[j] = -1;
    }
    ll num = -1;
    for(ll f: fin){
        if(num == -1){
            num = f;
            continue;
        }
        num += f;
        res++;
        if(num>=10){
            num = 1 + (num%10);
            res++; 
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 8456
n,c,k=map(int,input().split())
data=[]
for i in range(n):
    data.append(int(input()))
data.sort()
i=0
count=0
while i <= n-1:
    j=i
    bus_join=0
    while bus_join < c and j <= n-1 and data[j]-data[i] <= k:
        j += 1
        bus_join += 1
    i=j
    count += 1
print(count)

Measured memory_bytes: 81080
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main(){
  ll n;
  cin >>n;
  ll a[n];
  for(ll i=0;i<n;i++) {
    cin >>a[i];
    a[i]-=(i+1);
  }
  sort(a,a+n);
  ll ans=0;
  if(n%2==0){
    ll k=(a[n/2]+a[(n/2)-1])/2;
    for(ll i=0;i<n;i++) ans+=abs(a[i]-k);
    cout <<ans<<endl;
  }
  else{
    ll k=a[n/2];
    for(ll i=0;i<n;i++) ans+=abs(a[i]-k);
    cout <<ans<<endl;
  }
}


Measured memory_bytes: 1792
# Simple Knapsack
N, W = map(int, input().split())
d = {i: [] for i in range(0, 4)}
for i in range(N):
    w, v = map(int, input().split())
    if i == 0:
        w0 = w
    d[w-w0].append(v)

for i in range(4):
    cum = [0]
    d[i].sort(reverse=True)
    for j in d[i]:
        cum.append(cum[-1] + j)
    d[i] = cum[::]


ans = 0
for i in range(len(d[3])):
    v3_sum = d[3][i]
    w3_sum = (w0+3)*i
    for j in range(len(d[2])):
        v2_sum = d[2][j]
        w2_sum = (w0+2)*j
        for k in range(len(d[1])):
            v1_sum = d[1][k]
            w1_sum = (w0+1)*k

            rest = W - (w1_sum + w2_sum + w3_sum)
            if rest < 0:
                continue
            l = min(rest // w0, len(d[0])-1)
            v0_sum = d[0][l]
 
            ans = max(ans, v0_sum + v1_sum + v2_sum + v3_sum)

print(ans) 

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------


int main(){
    CIN(A,B,C);
    LCIN(K);
    if(K%2==0) printf("%d\n",A-B);
    else printf("%d\n",B-A);    
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int tmp1=0, tmp2=0;
    
    for(int i=0; i<s.size()/2; i++){
        if(s[2*i]!='0'){
            tmp1++;
        }
        if(s[2*i+1]!='1'){
            tmp1++;
        }
    }
    if(s.size()%2==1 && s[s.size()-1]!='0'){
        tmp1++;
    }
    for(int i=0; i<s.size()/2; i++){
        if(s[2*i]!='1'){
            tmp2++;
        }
        if(s[2*i+1]!='0'){
            tmp2++;
        }
    }
    if(s.size()%2==1 && s[s.size()-1]!='1'){
        tmp2++;
    }
    cout << min(tmp1, tmp2);
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 17;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

int main() {
	int N, D;
	scanf("%d %d", &D, &N);
	if (N == 100) N = 101;
	while (D--) N *= 100;
	return !printf("%d\n", N);
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    student_count, checkpoint_count = map(int, input().split())
    student_points = [list(map(int, input().split())) for i in range(1, student_count + 1)]
    check_points = [list(map(int, input().split())) for i in range(1, checkpoint_count + 1)]

    for student_point_x, student_point_y in student_points:
        point_number = 0
        shortest_distance = float('inf')
        manhattan_distance = 0

        for i in range(len(check_points)):
            diff_x = abs(student_point_x - check_points[i][0])
            diff_y = abs(student_point_y - check_points[i][1])
            manhattan_distance = diff_x + diff_y

            if manhattan_distance < shortest_distance:
                shortest_distance = manhattan_distance
                point_number = i + 1

        print(point_number)


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;

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

ll mod = 1000000007;

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

ll inv(ll x){
  ll res = 1;
  ll k = mod - 2;
  ll y = x;
  while(k){
    if(k&1)res = (res*y)%mod;
    y = (y*y) % mod;
    k /= 2;
  }
  return res;
}


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

  int n;
  cin >> n;
  string res[4] = {"AC","WA","TLE","RE"};
  map<string, int> cnt;

  rep(i,n){
    string s;
    cin >> s;
    cnt[s]++;
  }

  rep(i,4){
    cout << res[i] << " x " << cnt[res[i]] << endl;
  }
}

Measured memory_bytes: 3668
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int array[] = new int[w];
for (int i = 0; i < w; i++) array[i] = i+1;
for (int i = 0; i < n; i++){
String str = sc.next();
String ab[] = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
int tmp = array[a];
array[a] = array[b];
array[b] = tmp;
}
for (int i = 0; i < w; i++){
System.out.println(array[i]);
}
}
}

Measured memory_bytes: 26256
sx,sy,tx,ty = map(int,input().split())

dx = tx-sx
dy = ty-sy
res =''
#1回目
for _ in range(dx): res += 'R'
for _ in range(dy): res += 'U'
for _ in range(dx): res += 'L'
for _ in range(dy): res += 'D'
#2回目
res += 'D'
for _ in range(dx+1): res += 'R'
for _ in range(dy+1): res += 'U'
res += "L"
res += "U"
for _ in range(dx+1): res += 'L'
for _ in range(dy+1): res += 'D'
res += 'R'
print(res)

Measured memory_bytes: 9160
h, w = map(int, input().split())

area = []
for i in range(h):
    tmp = str(input())
    if tmp.find('#') == -1:
        #print('Not find')
        continue
    else:
        area.append(tmp)

#print(area)

area = list(zip(*area))

#print(area)

ans_list = []
for tmp in area:
    tmp = list(tmp)
    #print(tmp)
    if ('#' in tmp) == False:
        #print('Not find')
        continue
    else:
        ans_list.append(tmp)

ans_list = list(zip(*ans_list))

#print(ans_list)

for tmp in ans_list:
    ans = ''    
    for j in tmp:
        ans += j
    print(ans)




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

using namespace std;

typedef long long ll;

int main()
{
	int N, K;
	cin >> N >> K;
	int a, b;
	for(int i = 0; i < N; i++) {
		int A;
		cin >> A;
		if(A == 1) a = i;
	}
	b = N - a - 1;
	int ans = 100000000;
	for(int i = 0; i < K; i++) {
		int ta = a - i;
		int tb = b - (K - i - 1);
		if(ta < 0 || tb < 0) continue;
		int tmp = (ta+K-2)/(K-1) + (tb+K-2)/(K-1);
		ans = min(tmp + 1, ans);
	}
	cout << ans << endl;

	return 0;
}


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

#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define LL long long
#define ppt(x) __builtin_popcount(x)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=1e9+7;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;

template<typename T>
inline int getplc(T x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}

LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
	LL res=1;
	for(;b;b>>=1,a=a*a%_MOD){
		if(b&1)res=res*a%_MOD;
	}
	return res;
}

template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) {
	return max(a, Smax(args...));
}
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) {
	return min(a, Smin(args...));
}

template <typename T>
#define errorl(args...) {  \
	string _s = #args;   \
	replace(_s.begin(), _s.end(), ',', ' ');  \
    stringstream _ss(_s);  \
    istream_iterator<string> _it(_ss);  \
    errl(_it, args);  \
}
void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	errl(++it, args...);
}
#define error(args...) {  \
    string _s = #args;  \
    replace(_s.begin(), _s.end(), ',', ' ');  \
    stringstream _ss(_s);  \
    istream_iterator<string> _it(_ss);  \
    err(_it, args);  \
    cerr<<endl; \
}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << "=" << a << " # ";
	err(++it, args...);
}

LL a[5];

void Solve() {
	rep (i, 1, 3) cin >> a[i];
	sort(a + 1, a + 1 + 3);

	int ok = 0;
	rep (i, 1, 3) if (a[i] % 2 == 0) ok = 1;
	if (ok) cout << 0 << endl;
	else {
		LL ans = a[1] * a[2];
		cout << ans << endl;
	}
}


int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
//  freopen("o1.txt","w",stdout);
#endif
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	Solve();
	return 0;
}


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

typedef long long ll;
typedef long double ld;
// use unique(x) - removec consecutive items, returns vec.begin() + number of items
// for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end());
// use iota(all(vec), 0) for filling a vector with 0,1,2...
// use fill(all(vec), 1) for filling a vector with 1,1,1...
// use rotate(vec.begin(), vec.begin() + 1, vec.end()) to rotate a vector | middle arg becomes first
// use merge(all(vec1), all(vec2), vec3.begin()) to merge 2 vectors, use vec3.resize(vec1.size() + vec2.size()) first
// ll pos = partition_point(all(vec), pred) - vec.begin(); bool pred(ll a){return a<3};
// print number in binary -> cout << bitset<20>(n);

int main(){
	ll a,b;cin>>a>>b;
	cout<<a*b<<endl;
}


Measured memory_bytes: 3636
#include<stdio.h>

int main(){
	int i=0;
	char a[20];
	while(1){
	scanf("%c",&a[i]);
	if(a[i]=='\n')break;
	i++;
	}
	i--;
	while(i>=0){
	printf("%c",a[i]);
	i--;
	}
	printf("\n");
	return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  string s ;
  cin >> s ;
  string ans = "No" ;
  
  if(s.at(2) == s.at(3) && s.at(4) == s.at(5)) 
    ans = "Yes" ;
  
  cout << ans ;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
bool visited[100005];
const int max_N=1e5+10;
const int MOD=1e9+7;
int N;
ll ans=0;
ll sub=0;
ll dp[105][4][4][4]={};


int main(void)
{
  cin >> N;
  dp[0][3][3][3]=1;
  for(int len=0;len<N;len++)
    {
      for(int i=0;i<4;i++)
	{
	  for(int j=0;j<4;j++)
	    {
	      for(int k=0;k<4;k++)
		{
		  if(dp[len][i][j][k]==0) continue;
		  for(int l=0;l<4;l++)
		    {
		      if(j==0 && k==1 && l==2) continue;
		      if(j==0 && k==2 && l==1) continue;
		      if(j==1 && k==0 && l==2) continue;
		      if(i==0 && k==1 && l==2) continue;
		      if(i==0 && j==1 && l==2) continue;
		      else
			{
			  dp[len+1][j][k][l]=(dp[len+1][j][k][l]+dp[len][i][j][k])%MOD;
			}
		    }
		}
	    }
	}
    }
  for (int i = 0; i < 4; ++i)
    {
      for (int j = 0; j < 4; ++j)
	{
	  for (int k = 0; k < 4; ++k)
	    {
	      ans=(ans+dp[N][i][j][k])%MOD;
	    }
	}
    }
  cout << ans << endl;
  return 0;
}


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

#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define yes printf("Yes\n")
#define no printf("No\n")
#define print(ans) printf("%lld\n", ans)
#define nl cout << endl;
#define gap << " " <<
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()

typedef long long int ll;

int main()
{
    fastio;

    ll t, n, m, i, j, k, z, c, d, l, r, temp, temp1, temp2;
    double D, x, y;

    cin >> n >> D;

    ll ans = 0;
    for(i = 1; i <= n; i++)
    {
        cin >> x >> y;
        if(sqrt(x*x + y*y) <= D)
            ans++;
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3860
program MSOLUTIOND
    implicit none
    integer(8)::N,i,ans=1000
    integer(8),allocatable,dimension(:)::A
    read*,N
    allocate(A(N))
    read*,A

    do i=1,N-1
        if(A(i+1)>A(i))then
            ans=ans/A(i)*A(i+1)+mod(ans,A(i))
        end if
    end do
    print'(i0)',ans
end program MSOLUTIOND

Measured memory_bytes: 2844
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int x;
  cin>>x;
  long long int now=100;
  long long int ans = 0;
  while(now<x){
    now*=1.01;
    ans++;
  }
  cout<<ans<<endl;
}

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

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

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

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  const int MAX = 10010;
  vector<int> is_prime(MAX, 1);
  for (int i = 2; i * i < MAX; i++) {
    if (is_prime[i]) {
      for (int j = i * i; j < MAX; j += i) {
        is_prime[j] = 0;
      }
    }
  }
  vector<int> primes;
  for (int i = 2; i < MAX; i++) {
    if (is_prime[i]) {
      primes.push_back(i);
    }
  }
  auto lcm = [&](long long a, long long b) {
    return a / __gcd(a, b) * b; 
  };

  int n;
  cin >> n;
  if (n == 2) {
    cout << 4 << ' ' << 7 << '\n';
    cout << 23 << ' ' << 10 << '\n';
    return 0;
  }
  vector<vector<long long>> a(n, vector<long long>(n));
  int shift = (n - 1) - (n % 2 == 0);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if ((i + j) % 2 == 0) {
        int x = ((i - j) + shift) / 2;
        int y = ((i + j) + 2 * shift + 2) / 2;
        a[i][j]=  primes[x] * primes[y];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if ((i + j) % 2 == 1) {
        a[i][j] = 1;
        if (i > 0) a[i][j] = lcm(a[i][j], a[i - 1][j]);
        if (i < n - 1) a[i][j] = lcm(a[i][j], a[i + 1][j]);
        if (j > 0) a[i][j] = lcm(a[i][j], a[i][j - 1]);
        if (j < n - 1) a[i][j] = lcm(a[i][j], a[i][j + 1]);
        a[i][j]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      printf("%lld%c", a[i][j], " \n"[j == n - 1]);
    }
  }
  return 0;  
}


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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int t1,t2;
  t1 = c/b+(c%b!=0);
  t2 = a/d+(a%d!=0);
  cout << (t1<=t2?"Yes":"No") << endl;
}

Measured memory_bytes: 3624
import java.io.*;
import java.util.PriorityQueue;

public class Main {
    static class Log implements Comparable<Log>{
        double len;
        int num;
        Log(double l){
            len = l;
            num = 1;
        }
        void update(){
            len /= 2.0;
            num *= 2;
        }
        @Override
        public int compareTo(Log l){
            return l.len < this.len ? -1 : l.len==this.len ? 0 : 1;
        }
    }
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line[] = br.readLine().split(" ");
        int n = Integer.parseInt(line[0]);
        int k = Integer.parseInt(line[1]);
        line = br.readLine().split(" ");
        int a[] = new int[n];
        for(int i = 0; i < n; i++)  a[i] = Integer.parseInt(line[i]);
        int r = 1000000000, l = 0;
        while(r-l > 1){
            int mid = (l+r)/2;
            long x = 0;
            for(int i = 0; i < n; i++){
                x += (a[i]+mid-1)/mid-1;
            }
            if(x <= k)  r = mid;
            else        l = mid;
        }
        System.out.println(r);
    }
}


Measured memory_bytes: 61308
import java.util.*;
import java.lang.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		int b = sc.nextInt();
		int[] c=new int[6];
		int cou=0;
		for(long i=a;i<=b;i++) {
			long d=i;
		    int e=10000;
			int sum=0;
			for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			}
			if(i==sum)cou++;
		}
		System.out.println(cou);
	}
}

Measured memory_bytes: 23764
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include <conio.h>
using namespace std;

typedef long long int ll;
typedef pair<ll,ll> pll;

#define rep(i,n)	for(ll i=0;i<(n);i++)
#define SZ(x) ((ll)x.size())
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define F first
#define S second
#define int ll
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// const ll MOD = INT_MAX;
const double PI = acos(-1);

void openfile(){
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
}
const int N = 405;
int dp[N][N];
int sum[N];

int func(int i,int j){
	if(dp[i][j])	return dp[i][j];
	if(i == j)		return dp[i][j] = 0;
	if(i == j-1)	return dp[i][j] = sum[j] - sum[i-1];
	int ans = 1e18+7;
	for(int k = i;k < j;k++){
		ans = min(ans,func(i,k) + func(k+1,j));
	}
	return dp[i][j] = ans + sum[j] - sum[i-1];
}


signed main(){
	IOS
	int n;	cin >> n;
	rep(i,n)	cin >> sum[i+1],sum[i+1] += sum[i];
	cout << func(1,n) << endl;

}


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

int N;
vector<vector<int>> edge(1e5, vector<int>());

void dfs(int start, int d, vector<int>& dist) {
    if (dist[start] > 0) return;
    
    dist[start] = d;
    for (int next:edge[start]) {
        dfs(next, d + 1, dist);
    }
}

int main() {
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
      	--a; --b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    vector<int> distF(N), distS(N);
    dfs(0, 1, distF); dfs(N - 1, 1, distS);
    long long cnt = 0;
    for (int i = 0; i < N; i++) {
  // 	cout << distF[i] << " " << distS[i] << endl;
        cnt += distF[i] > distS[i]? -1: 1;
    }
    cout << (cnt > 0? "Fennec": "Snuke") << endl;
}


Measured memory_bytes: 11136
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    bool flag = 1;
    int c = 0;
    if (s[0] != 'A') flag = 0;
    if (isupper(s[1]) || isupper(s[s.size()-1]))flag = 0;
    for (int i = 2; i < s.size()-1; i++) {
        if (s[i] == 'C') c++;
        else if (isupper(s[i])) flag = 0;
    }
    if (c != 1) flag = 0;
    if (flag) cout << "AC" << endl;
    else cout << "WA" << endl;
}

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

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

    int M, D;
    cin >> M >> D;
    int res = 0;
    for (int m = 4; m <= M; m++) {
        for (int d = 22; d <= D; d++) {
            int d1 = d % 10, d10 = d / 10;
            if (d1 >= 2 && d10 >= 2 && d1 * d10 == m)
                res++;
        }
    }
    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX/2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

int DFS(int V,vector<vector<int> > & GRAPH,vector<bool> visited)
{
  visited[V] = true;
  int res = 0;
  bool check_to = false;
  for (int i = 0; i < GRAPH[V].size(); i++)
  {
    int to = GRAPH[V][i];
    if(visited[to] == false)
    {
      res += DFS(to,GRAPH,visited);
      check_to = true;
    }
  }

  if(check_to == false)
  {
    int check_bin = true;
    for (int i = 0; i < visited.size(); i++)
    {
      if(visited[i] == false) check_bin  = false;
    }
    res += (int)(check_bin);
  }

  return res;
  
}

void solve(void)
{
  int N,M;
  cin>>N>>M;
  vector<vector<int> > GRAPH(N);
  for (int i = 0; i < M; i++)
  {
    int A,B;
    cin>>A>>B;
    A--;
    B--;
    GRAPH[A].push_back(B);
    GRAPH[B].push_back(A);
  }
  vector<bool> visited(N,false);

  cout<<DFS(0,GRAPH,visited)<<endl;
  
  return; 
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

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

const int N = 2e5 + 5;

int n;
string s;
int f[N], lst[26], nxt[N][26];

int main() {
	ios_base::sync_with_stdio(false);
	cin >> s; n = s.size();
	for (int i = 0; i < 26; ++i) lst[i] = nxt[n][i] = n;
	for (int i = n - 1; i >= 0; --i) {
		lst[s[i] - 'a'] = i;
		for (int j = 0; j < 26; ++j) nxt[i][j] = lst[j];
	}
	for (int i = n; i >= 0; --i) {
		f[i] = N;
		for (int j = 0; j < 26; ++j) f[i] = min(f[i], f[nxt[i][j] + 1] + 1);
	} 
	int ptr = 0;
	for (int i = 1; i <= f[0]; ++i) {
		for (int j = 0; j < 26; ++j) {
			int nptr = nxt[ptr][j] + 1;
			if (f[nptr] + 1 == f[ptr]) {
				cout << (char)(j + 'a');
				ptr = nptr;
				break;
			} 
		}
	}
}

Measured memory_bytes: 21652
#include <stdio.h>
int main(void){
    int A, B;
    char op;
    scanf("%d %c %d", &A, &op, &B);

    if (op == '+'){
        printf("%d\n", A + B);
    }
    else {
        printf("%d\n", A - B);
    }
    
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
vector<bool> Pr(110000, false);
void eratos(int x) {
	V is_P(x + 100, true);
	is_P[0] = is_P[1] = false;
	for (int i = 2; i <= x; i++) {
		if (is_P[i]) {
			for (int j = i + i; j <= x; j += i) is_P[j] = false;
			Pr[i] = true;
		}
	}
	return;
}
int main() {
	eratos(110000);
	V ruiseki(110000, 0);
	rep(i, 105000) {
		if (Pr[i] && Pr[(i + 1) / 2]) ruiseki[i]++;
	}
	int i;
	for (i = 1; i <= 103000; i++) {
		ruiseki[i] += ruiseki[i - 1];
	}
	int q;
	cin >> q;
	rep(wanikunn, q) {
		int a, b;
		cin >> a >> b;
		cout << ruiseki[b] - ruiseki[a - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1104
fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(java.util.Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: java.util.Scanner, pw: java.io.PrintWriter) {
        val L = sc.next().toLong()
        val R = sc.next().toLong()
        var ans = 2020L
        for (l in (L until R)) {
            for (r in (l + 1)..R) {
                val a = ((l % 2019) * r) % 2019
                if (a == 0L) {
                    pw.println("0")
                    return
                }
                if (ans > a) {
                    ans = a
                }
            }
        }
        pw.println(ans)
    }
}


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

signed main() {
#ifdef LOCAL
  assert(freopen("b.in", "r", stdin));
#endif
  int n;
  cin >> n;
  ll total = 1;
  ll bad = 1;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    total *= 3;
    if (a % 2 == 0)
      bad *= 2;
  }
  cout << total - bad << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll k;

int main(){
	cin>>k;
	if(k==0){
		cout<<2<<endl<<0<<' '<<0<<endl;
		return 0;
	}
	for(int i=2;i<=50;i++){
		ll n=i;
		vl a(n,n-k-1);
		for(int j=0;j<n;j++){
			a[j]+=k/n*(n+1);
			if(j<k%n) a[j]+=n+1;
		}
		bool B=1;
		for(int j=0;j<n;j++) if(0>a[j]||a[j]>10000000000001000) B=0;
		if(!B) continue;
		cout<<n<<endl;
		for(int j=0;j<n;j++){
			if(j) cout<<' ';
			cout<<a[j];
		}
		cout<<endl;
		break;
	}
}

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

using namespace std;

int main(){
	int n;
	scanf("%d", &n);
	string a, b;
	cin >> a >> b;
	string ans = "";
	for (int i = 0; i < n; i++){
		ans += a[i];
		ans += b[i];
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int INF = numeric_limits<int>::max() / 2;
using ll = long long;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int k;
    cin >> s >> k;
    set<string> subs;
    for(int i = 0; i < s.size(); i++){
        int num = k;
        if(s.size() < k) num = s.size();
        for(int j = 1; j <= num; j++){
            subs.insert(s.substr(i,j));
        }
    }
    auto itr = subs.begin();
    for(int i = 0; i < k-1; i++) itr++;
    cout << *itr << endl;
    return 0;
}

Measured memory_bytes: 1664
from copy import deepcopy

S = input()
T = input()

answer = ''
for i in range(len(S)-len(T)+1):
    found = True
    for j in range(len(T)):
        if S[i+j] != '?' and S[i+j] != T[j]:
            found = False
            break
    if found:
        tmp = deepcopy(S).replace('?', 'a')
        tmp = tmp[:i] + T + tmp[i+len(T):]
        if answer == '' or tmp < answer:
            answer = tmp

if answer == '':
    print('UNRESTORABLE')
else:
    print(answer)

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

void sort(int arr[], int n)
{

	map<int, int> count;


	for (int i = 0; i < n; i++)
		count[arr[i]]++;

	map<int, int>::iterator it;
	int index = 0;

	for (it = count.begin(); it != count.end(); ++it)
	{
		while (it->second--)
			arr[index++] = it->first;
	}
}

int main() {

// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output3.txt", "w", stdout);
// #endif

	ios::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	int n1;
	int sum = 0;
	cin >> n1;
	int arr[n];
	for (int i = 0 ; i < n ; i++) {
		cin >> arr[i];
	}
	sort(arr, n);
	// for (int i = 0 ; i < n ; i++) {
	// 	cout << arr[i] << "  ";
	// }

	for (int i = 0 ; i < n1 ; i++) {
		sum = sum + arr[i];
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vll vector <ll>
#define fi first
#define se second
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 5e5+100;
const ll INF = 1e9;
const ll kek=998244353;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    vector <vector <pair <int,int> > > a(n);
    rep(i,n)
    {
        int b;
        cin>>b;
        while (b--) {
            int x, y;
            cin >> x >> y;
            x--;
            a[i].pb({x, y});
        }
    }
    int ans=0;
    for (int mask=0;mask<(1<<n);mask++)
    {
        vector <int> good(n,0);
        int f=0;
        for (int i=0;i<n;i++)
        {
            if ((mask>>i)&1) {
                good[i] = 1;
                f++;
            }
        }
        bool ok=true;
        for (int i=0;i<n;i++)
        {   if (good[i]==1) {
                for (int j = 0; j < a[i].size();j++)
                {
                    int x=a[i][j].first,y=a[i][j].second;
                    if (y==1)
                    {
                    if (good[x]==0)
                    {
                        ok=false;
                        break;
                    }
                    }
                    else
                    {
                        if (good[x]==1) {
                            ok = false;
                            break;
                        }
                    }
                }
            }
        }
        if (ok)
            ans=max(ans,f);

    }
    cout<<ans;
}








Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
using namespace std;

int main(){
    string S;
    char c;
    int flag = 0, Q;
    deque<char> dq;
    cin >> S >> Q;
    for(int i = 0; i < S.length(); i ++){
        dq.push_back(S[i]);
    }
    int T, F;
    for(int i = 0; i < Q; i ++){
        cin >> T;
        if (T == 1){
            flag ^= 1;
        }else{
            cin >> F >> c;
            if(flag ^ (F - 1)){
                dq.push_back(c);
            } else{
                dq.push_front(c);
            }
        }
    }
    int N = dq.size();
    if (flag){
        for(int i = 0; i < N; i ++){
            cout << dq[N - i - 1];
        }
    }else{
        for(int i = 0; i < N; i ++){
            cout << dq[i];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 896
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
//        DecimalFormat df = new DecimalFormat("0.00000000");

        String[] ss = sc.next().split("[^ACGT]");
        if (ss.length == 0) {
            out.println("0");
        } else {
            Integer[] a = new Integer[ss.length];
            for (int i = 0; i < ss.length; i++) {
                a[i] = ss[i].length();
            }
            Arrays.sort(a, Collections.reverseOrder());
            out.println(a[0]);
        }
        
        out.flush();
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;

  int C = 0;
  
  for (int i = A; i < B + 1; i++) {
    if (i % 10001 % 1010 != 1000 && i % 10001 % 1010 % 100 == 0) {
      C++;
    } 
  }   
  
  cout << C << endl;   

}

Measured memory_bytes: 3620