akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define itr(a) begin(a), end(a)
#define pb push_back
#define x first
#define y second
#define endl '\n'

#define FAST cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

#ifndef __LOCAL
#define FILES(namein, nameout) freopen(namein, "r", stdin); freopen(nameout, "w", stdout); FAST;
#else
#define FILES(namein, nameout) FAST;
#endif //__LOCAL

using namespace std;
using namespace __gnu_pbds;
using python = void;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned short uss;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type> ordered_set;

const ll M = 1e9+7;
const ll N = 2e5+228;
constexpr ll inf = 0x3f3f3f3f3f3f3f3f;
ll dp[10][10];
ll p10[19];
python solve(){
	FAST;
	ll n;
	cin >> n;
	if(n < 10){
		cout << n << '\x0a';
	}else{
		p10[0] = 1;
		for(ll i = 1;i<19;i++) p10[i] = p10[i-1]*10;
		for(ll i =1;i<10;i++) dp[i][i] = 1;
		for(ll i =1;i<10;i++){
			for(ll j = 1;j<10;j++){
				if(i*10+j > n){
					break;
				}
				else{
					dp[i][j] = 1 + (i == j ? 1 : 0);
					for(ll len = 1;;len++){
						bool bk = 0;
						for(ll cv = 0;cv<p10[len];cv++){
							ll v = i*p10[len+1]+cv*10+j;
							if(v <= n) ++dp[i][j];
							else {bk = 1; break;}
						}
						if(bk) break;
					}
				}
			}
		}
		ll res = 0;
		for(ll i =1;i<10;i++){
			for(ll j = 1;j<10;j++){
				res += (i == j ? dp[i][j]*dp[i][j] : dp[i][j]*dp[j][i]);
			}
		}
		cout << res << '\x0a';
	}
}

signed main(){
	FAST;
	ll q = 1;
	//cin >> q;
	while(q--){
		solve();
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>
#include <bitset>
#include <cassert>

using namespace std;

struct UnionFind {

    // par[i] is parent of i
    // root of i is par[par[par[../par[i]...]]]
    vector<int> par;
    vector<int> sz;

    UnionFind(int N) : par(N), sz(N) {
        for (int i = 0; i < N; ++i) {
            par[i] = i;
            sz[i] = 1;
        }
    }

    int find(int x) {
        if (par[x] == x) {
            return x;
        } else {
            // path compression
            return par[x] = find(par[x]);
        }
    }

    bool same(int p, int q) {
        return find(p) == find(q);
    }

    void unite(int p, int q) {

        int pr = find(p);
        int qr = find(q);
        if (pr == qr) {
            return;
        }
        if (sz[pr] < sz[qr]) {
            par[pr] = qr;
            sz[qr] += sz[pr];
        } else {
            par[qr] = pr;
            sz[pr] += sz[qr];
        }
    }

    int size(int x) {
        return sz[par[x]];
    }

    string asString() {
        string sb;
        for (int i = 0; i < par.size() - 1; ++i) {
            sb += to_string(par[i]);
            sb += ",";
        }
        sb += to_string(par[par.size() - 1]);
        return sb;
    }
};

int main() {
    int N;
    cin >> N;

    int M;
    cin >> M;
    vector<int> ps(N);
    for (int i = 0; i < N; ++i) {
        int p;
        cin >> p;
        ps[i] = p;
    }

    UnionFind unionFind(N);

    for (int i = 0; i < M; ++i) {
        int x, y;
        cin >> x >> y;
        unionFind.unite(x-1, y-1);
    }
    int cnt = 0;
    for (int i = 0; i < N; ++i) {
        if (unionFind.same(ps[i]-1, i)) {
            cnt += 1;
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 4208
N = int(input())
d = {}
xy = []
for i in range(N):
    x, y = map(int, input().split())
    xy.append([x, y])

for x1, y1 in xy:
    for x2, y2 in xy:
        if x1 == x2 and y1 == y2:
            continue
        dis = (x2-x1, y2-y1)
        if dis not in d:
            d[dis] = 1
        else:
            d[dis] += 1

ans = 0
if N == 1:
    ans = 1
else:
    ans = N - max(d.values())
print(ans)


Measured memory_bytes: 3444
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cctype>

using namespace std;

int main(void) {

    double x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    printf("%f\n", sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)));

    return 0;
}

Measured memory_bytes: 1232
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;
int inf=1<<29;
long long llinf=1ll<<60;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct
#define N 250000
int p[N+1];

void eratosthenes(void){
    int i,j;
    for(i=2;i<N;i++)
        p[i]=1;
    for(i=2;i*i<N;i++){
        if(p[i]){
            for(j=2*i;j<=N;j=j+i){
                p[j]=0;
            }
        }
    }
}
int dp[250000];

int main(void){
    int n,i;
    eratosthenes();
    rep(i,250000)
        if(i)
            dp[i]=dp[i-1]+p[i];
    while(1){
        n=in();
        if(!n)break;
        print(dp[2*n]-dp[n]);
    }
    return 0;
}


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


int main()
{
    int n;
    std::cin >> n;
    std::vector<int> l(n);
    for (int i = 0; i < n; i++)
    {
        std::cin >> l[i];
    }
    
    std::sort(l.begin(), l.end());

    int count = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            for (int k = j + 1; k < n; k++)
            {
                if ((l[k] < l[i] + l[j]) && (l[i] != l[j]) && (l[j] != l[k]) && (l[k] != l[i]))
                {
                    count++;
                }
            }
        }
    }
    
    std::cout << count << std::endl;
    
    return 0;
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int m, f, r;
		int count = 0;
		int sum = 0;
		int[][] records = new int[50][3];
		for (int i = 0; true; i++) {
			m = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			if (m == -1 && f == -1 && r == -1) {
				break;
			}
			records[i][0] = m;
			records[i][1] = f;
			records[i][2] = r;
			count++;
		}
		for (int i = 0; i < count; i++) {
			if (records[i][0] == -1 || records[i][1] == -1) {
				System.out.println("F");
			} else {
				sum = records[i][0] + records[i][1];
				if (sum >= 80) {
					System.out.println("A");
				} else if (sum >= 65) {
					System.out.println("B");
				} else if (sum >= 50) {
					System.out.println("C");
				} else if (sum >= 30) {
					if (records[i][2] >= 50) {
						System.out.println("C");
					} else {
						System.out.println("D");
					}
				} else {
					System.out.println("F");
				}
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 26192
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<math.h>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
#include<unordered_map>
#include<list>
#include<fstream>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
const ll E=1e18+7;
#define F first
#define S second
#define MK make_pair
const ll MOD=1000000007;

bool judge(deque<vector<char>> v){
    for(int i=0;i<v.size();i++){
        if(v[i].size()!=v.size()){return false;}
        for(int t=i+1;t<v[i].size();t++){
            if(v[i][t]!=v[t][i]){return false;}
        }
    }
    return true;
}


int main(){
    ll n;
    cin>>n;
    deque<vector<char>> v(n,vector<char>(n));
    for(int i=0;i<n;i++){
        for(int t=0;t<n;t++){
            char b;
            cin>>b;
            v[i][t]=b;
        }
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        if(judge(v)){ans++;}
        vector<char> a=v[n-1];
        v.pop_back();
        v.push_front(a);
    }
    cout<<ans*n<<endl;
    
    return 0;
}

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> data(n);
    for (int i = 0; i < n; i++){
        cin >> data.at(i);
    }
    sort(data.begin(), data.end());
    int count = 0,sum = 0;
    for (int i = 0; i < k; i++){
        sum += data.at(i);
    }
    cout << sum << endl;
}

Measured memory_bytes: 3568
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>

struct Node
{
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int k)
{
    Node *y = NIL;
    Node *x = root;
    Node *z;
    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while (x != NIL)
    {
        y = x;
        if (z->key < x->key)
        {
            x = x->left;
        }
        else
        {
            x = x->right;
        }
    }
    z->parent = y;
    if (y == NIL)
    {
        root = z;
    }
    else
    {
        if (z->key < y->key)
        {
            y->left = z;
        }
        else
        {
            y->right = z;
        }
    }
}

void inorder(Node *u)
{
    if (u == NIL)
        return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u)
{
    if (u == NIL)
        return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main()
{
    int n, i, x;
    std::string com;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        std::cin >> com;
        if (com == "insert")
        {
            scanf("%d", &x);
            insert(x);
        }
        else if (com == "print")
        {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}



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

int main()
{
	string S;
	cin >> S;
	if (S[0] == '7' || S[1] == '7' || S[2] == '7') cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main(){
  int  N;
  cin >> N;
  vector <long long int> X(N);
  vector <long long int> tmp(N);
  for(int i = 0; i < N; i++){
    cin >> X[i];
    tmp[i] = X[i];
  }
  sort(tmp.begin(), tmp.end(), greater<long long int>());
  long long int l = N / 2 -1;
  long long int g = N / 2;
  map<long long int, long long int> M;
  for(int i = 0; i < N; i++){
    if(i <= l) M[tmp[i]] = tmp[g];
    else M[tmp[i]] = tmp[l];
  }
  for(int i = 0; i < N; i++){
    cout << M[X[i]] << " ";
  }
}


Measured memory_bytes: 18048
from copy import deepcopy
N=int(input())
A=[int(i) for i in input().split()]

def chmax(a,b):
    if a[0]<b[1]:
        return b
    elif a[0]<b[0]:
        return(b[0],a[0])
    elif a[1]<b[0]:
        return (a[0],b[0])
    else:
        return a
dp=[(A[i],0) for i in range(1<<N)]
#print(dp)
for i in range(N):
    for j in range(1<<N):
        if j & (1<<i):
            #print(j,i,j|(1<<i))
            dp[j]=chmax(dp[j],dp[j^(1<<i)])
#print(dp)
ans =sum(dp[0])
for i in range(1,1<<N):
    t = sum(dp[i])
    ans = max(ans,t)
    print(ans)

Measured memory_bytes: 128444
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	ll x, cr = 100, ans = 0;
	cin >> x;
	while(cr < x) ans++, cr += cr / 100;
	cout << ans << '\n';
}



Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  ll res = 0;
  res = min(a, k);
  k -= a;
  k -= b;
  if(k > 0) res -= k;
  cout << res << endl;
}


Measured memory_bytes: 3636
import queue
T = str(input())
NN = len(T)
T2 = [0] * NN
P = str(input())
N = len(P)
P2 = [0] * N

alpha2num = lambda c: ord(c) - ord('0') + 1
#print(alpha2num("1"))
#print(alpha2num("A"))
#print(alpha2num("a"))
for i in range(N):
  P2[i] = alpha2num(P[i])
#print(P2)
for i in range(NN):
  T2[i] = alpha2num(T[i])
#print(T2)

for i in range(NN - N + 1):
  if T[i:i + N] == P:
    print(i)





Measured memory_bytes: 16668
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("board.in");ofstream out("board.out");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid<int> u1(5, 10); u1(rnd);

int main() {
    fast;
    ll a,k; cin>>a>>k;
    cout<<(a+2*k)/(2*k+1);
}

Measured memory_bytes: 256
n,X=map(int,input().split())
x=list(map(int,input().split()))

x.append(X)
x.sort()
z=[]
for i in range(n):
    z.append(x[i+1]-x[i])
ans=z[0]
import fractions
for j in range(1,n):
    ans=fractions.gcd(ans,z[j])
print(ans)

Measured memory_bytes: 14224
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
long long n,a,b;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cin>>n>>a>>b;
	if(a<b)
		swap(a,b);
	if((a-b)%2==0)
		cout<<(a-b)/2;
	else {
		if(a!=n && b!=1)
		{
			long long ans1,ansn;
			ans1=b+(a-b-1)/2;
			ansn=n-a+1+(a-b)/2;
			cout<<min(ans1,ansn);
		}
		else
			cout<<(a-b)/2+1;
	}
	cin>>n;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
public class c
{
  public static void Main()
 {
   int[]NQ = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
   int i;
    string s=Console.ReadLine();
    char[] S=s.ToCharArray();
    int ans=0;
    int[] count=new int[NQ[0]];
    
    for(i=0;i<NQ[0]-1;i++)
    {
       if(S[i]=='A'&&S[i+1]=='C'){S[i]='a';ans++;}
       count[i]=ans;
       count[i+1]=count[i];
    }
    for(i=0;i<NQ[1];i++)
    {
      int[]lt= Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
      
      if(lt[0]-2>=0)Console.WriteLine(count[lt[1]-2]-count[lt[0]-2]);
      else Console.WriteLine(count[lt[1]-2]);
    }
  } 
}

Measured memory_bytes: 17992
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

int main(void) {
  int N;
  scanf("%d", &N);
  vector<int> a(N);
  REP(i, N) scanf("%d", &a[i]);

  int i = 0, ret = 0;
  while (i < N) {
    int j = i;
    while (j < N && a[j] == a[i]) j++;

    ret += (j - i) / 2;
    i = j;
  }

  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    
    int a[3],i,j,tmp,result;

    for(i=0;i<3;i++){
        scanf("%d",&a[i]);
    }

    for(i=0;i<3;i++){
        for(j=i+1;j<3;j++){
            if(a[i]>a[j]){
                tmp=a[i];
                a[i]=a[j];
                a[j]=tmp;
            }
        }
    }

    result=a[0]+a[1];

    printf("%d",result);
    return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max()/2;
const int MOD = 1e9+7;

// sieve of eratosthenes
// primes[i] != 0 if i is prime
vector<int> sieve_of_eratosthenes(int n) {
  vector<int> primes(n);
  for (int i = 2; i < n; ++i)
    primes[i] = i;
  for (int i = 2; i*i < n; ++i)
    if (primes[i])
      for (int j = i*i; j < n; j+=i)
        primes[j] = 0;
  return primes;
}

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

    int q;cin>>q;
    vector<int> primes=sieve_of_eratosthenes(111111);
    vector<int> res(111111,0);
    for(int i=3;i<111111;i+=2){
        if(primes[i] && primes[(i+1)/2]){
            res[i]=1;
            //cout<<i<<endl;
        }
    }
    for(int i=3;i<111111;i++){
        res[i]+=res[i-1];
    }
    for(int i=0;i<q;i++){
        int l,r;cin>>l>>r;
        cout<<res[r]-res[l-1]<<endl;
    }
}

Measured memory_bytes: 1536
while True:
	N, M = map(int, input().split())
	if N==0 and M==0: break
	n = [int(input()) for _ in range(N)]
	m = [int(input()) for _ in range(M)]
	j = 0  #現在のマス目
	for i in range(M):
		j += m[i]
		if j>=N: break
		j += n[j]
		if j>=N: break
	print(i+1)



Measured memory_bytes: 5644
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

ll func(ll a, ll b, double x){
    ll ans = (ll)(a * x / b) - a * (ll)(x / b);
    return ans;
}

int main(){
    ll A, B, N;
    cin >> A >> B >> N;
    ll x = min(N, B-1);
    ll ans = (A * (x % B) - A * (x % B) % B) / B;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int N;
	scanf("%d", &N);
	for (int i = 1; i <= 9; ++i) {
		if (N % i == 0 && N / i <= 9) {
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 128
"""
author : halo2halo
date : 18,Oct,2019
"""

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

S = readline().rstrip()
ans = 'Yes'
for i in range(len(S)):
    if i % 2 == 0 and S[i] == 'L':
        ans = 'No'
        break
    elif i % 2 == 1 and S[i] == 'R':
        ans = 'No'
        break
print(ans)


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

#define     bip(a)         __builtin_popcount(a)
#define     ull            unsigned long long
#define     ll             long long
#define     u              unsigned
#define     pb             push_back
#define     pf             push_front ///for list
#define     mpr            make_pair
#define     is             insert
#define     ff             first
#define     ss             second
#define     vi             vector<int>
#define     vl             vector<ll>
#define     si             set<int>
#define     sl             set<ll>
#define     li             list<int>
#define     pii            pair<int,int>
#define     pll            pair<ll,ll>
#define     mii            map<int,int>
#define     mll            map<ll,ll>
#define     ma             INT_MAX
#define     mi             INT_MIN
#define     mod            1000000007
#define     pi             3.14159265359
#define     e              2.71828182846
#define     inf            1000000000000000LL
#define     all(x)         x.begin(), x.end()
#define     lb(a,b,c)      lower_bound(a,a+b,c)-a
#define     ub(a,b,c)      upper_bound(a,a+b,c)-a
#define     lbv(a,c)       lower_bound(all(a),c)-a.begin()
#define     ubv(a,c)       upper_bound(all(a),c)-a.begin()
#define     srt1(a,b)      sort(a,a+b)
#define     srt2(a,b)      sort(a,a+b,greater<int>())
#define     gcd(a,b)       __gcd(a,b)
#define     lcm(a,b)       (a*(b/gcd(a,b)))
#define     harmonic(n)    0.57721566490153286l+log(n)
#define     mem(a, b)      memset(a, b, sizeof(a))

///s.lower_bound(a),s.upper_bound(a), for set
///nCr(x, y) = nCr(x-1, y-1) + nCr(x-1, y)
///factorial digit   ((n * log10(n / e) +log10(2 * pi * n) /2.0));


int main()
{
    char ch;
    cin>>ch;
    if(ch>='a' && ch<='z')cout<<"a\n";
    if(ch>='A' && ch<='Z')cout<<"A\n";
}



Measured memory_bytes: 3620
#include<stdio.h>

int main(){
  int n;
  int i=1,x=0,flag=0;

  scanf("%d", &n);
  while(1){
    if (flag==1){
        flag = -1;
        i++;
        if(i>n){
          break;
        }
    }
    else if(x>0 && flag >-1){
      if(x%10==3){
        printf(" %d", i);
        flag = 1;
      }
      x /= 10;
      if (x==0){
        flag = 1;
      }
    }
    else {
      flag = 0;
      x = i;
      if(x%3==0){
        printf(" %d", i);
        flag = 1;
      }
    }
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 2096
#include<stdio.h>
main(){
  int n,data[100],i,j,tmp,count;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&data[i]);
  for(i=0;i<n;i++)
    for(j=n-1;j>i;j--)
    if(data[j]<data[j-1]){
      tmp=data[j];
      data[j]=data[j-1];
      data[j-1]=tmp;
      count++;
    }
  for(i=0;i<n;i++){
    if(i)
      printf(" ");
    printf("%d",data[i]);
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	ll x;
	cin>>x;
	ll a = 100;
	ll ans = 0;
	while(a<x){
		++ans;
		a += (a/100);
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 3652
import java.util.*;

public class Main {
	public static void main(String[] args) {
	// TODO Auto-generated method stub
	Scanner sc = new Scanner(System.in);

	int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    int E = sc.nextInt();
    int F = 0;

    for(int i = 1; C > i ; i++) {
        int G = sc.nextInt();
        int H = sc.nextInt();

        if((D > G && E < H) || (D < G && E > H)) {
            F = F + Math.abs(D - G) + Math.abs(E - H);
	    }else{
	         F = F + Math.max(Math.abs(D - G), Math.abs(E - H));
	    }
	    D = G;
	    E = H;
	}
    System.out.println(F);
    sc.close();
}
}

Measured memory_bytes: 25464
#include <stdio.h>

int main(void)
{
	int i, j, k, l;
	int n, c;
	
	while (scanf("%d", &n) != EOF){
		c = 0;
		for (i = 0; i < 10; i++){
			for (j = 0; j < 10; j++){
				for (k = 0; k < 10; k++){
					for (l = 0; l < 10; l++){
						if (i + j + k + l == n){
							c++;
						}
					}
				}
			}
		}
		
		printf("%d\n", c);
	}
	return (0);
}

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

 int main(void){
  string a,b,c;
   cin >>a>>b>>c;
   char A,B,C;
   A = a[0]-32;
   B = b[0]-32;
   C = c[0]-32;
   
   cout <<A<<B<<C<<endl;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int m1,m2,d1,d2;
    cin>>m1>>d1>>m2>>d2;
    if(d1+1==d2){
        cout<<0<<endl;
    }else{
        cout<<1<<endl;
    }
}

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

using namespace std;

const int nmax = 5e5 + 3;
int n, q, usu[nmax], sol, v[nmax];
struct Query {
	int l, r, idx;

	inline pair<int, int> toPair() const {

	    int ceva;
	    if((int)(l / sqrt(n)) % 2) ceva = -r;
	    else ceva = r;
		return make_pair(l / sqrt(n), ceva);
	}
}t[nmax];

int ap[nmax];

inline bool operator<(const Query &a, const Query &b) {
	return a.toPair() < b.toPair();
}

int main()
{
    ios::sync_with_stdio(false);
    cin >> n >> q;
    for(int i = 1; i <= n; ++i) cin >> v[i];
    for(int i = 1; i <= q; ++i)
    {
        cin >> t[i].l >> t[i].r;
        t[i].idx = i;
    }
    sort(t + 1, t + q + 1);

    int st = 0;
    int dr = 0;

    for(int i = 1; i <= q; ++i)
    {
        //cout << t[i].l << ' ' << t[i].r << '\n';

        if(t[i].l > dr || t[i].r < st)
        {
            for(int j = st; j <= dr; ++j) ap[v[j]] = 0;
            st = t[i].l;
            dr = st;
            sol = 1;
            ++ap[v[st]];
        }

        while(dr < t[i].r)
        {
            ap[v[++dr]]++;
            if(ap[v[dr]] == 1) ++sol;
        }

        while(st > t[i].l)
        {
            ap[v[--st]]++;
            if(ap[v[st]] == 1) ++sol;
        }

        while(st < t[i].l)
        {
            ap[v[st++]]--;
            if(ap[v[st - 1]] == 0) --sol;
        }

        while(dr > t[i].r)
        {
            ap[v[dr--]]--;
            if(ap[v[dr + 1]] == 0) --sol;
        }

        usu[t[i].idx] = sol;
    }

    for(int i = 1; i <= q; ++i) cout << usu[i] << '\n';
    return 0;
}


Measured memory_bytes: 15472
n,a,b = map(int,input().split())
ans = 0

for i in range(n+1):
    keta_wa = 0
    x = i
    while x != 0:
        keta_wa += int(x % 10)
        x = int(x /10)
        #print(keta_wa,x)
    
    if a <= keta_wa <= b:
        ans += i 

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <string>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pii pair<int, int>
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
//#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define jai_shree_ram  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i, a, b, d) for (int i = a; i <= b; i += d)
#define brep(i, a, b, d) for (int i = a; i >= b; i -= d)
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl '\n'
int MAX = 1e5 + 5;
int MOD = 1e9 + 7;
////////////////////////////////

int a[405], dp[405][405], pre[405];

int sum(int l, int r){
    return pre[r] - pre[l-1];
}

int solve(int l, int r){
    if(dp[l][r]) return dp[l][r];
    if(r == l+1) return dp[l][r] = a[l] + a[r];
    if(l == r) return dp[l][l] = 0;

    int ans = 1e18;
    rep(i,l,r-1,1){
        ans = min(ans, solve(l, i) + solve(i+1, r) + sum(l,i) + sum(i+1,r));
    }
    
    return dp[l][r] = ans;
}


int32_t main(){
    jai_shree_ram
    int n;
    cin >> n;
    rep(i,1,n,1) cin >> a[i], pre[i] = a[i], pre[i] += pre[i-1];
    cout << solve(1, n) << endl;
    return 0; 
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

P h_cnt[300010],w_cnt[300010];

int main() {
    int h,w,m;cin>>h>>w>>m;
    rep(i,h){
        h_cnt[i].first = 0;
        h_cnt[i].second = i;
    }
    rep(i,w){
        w_cnt[i].first = 0;
        w_cnt[i].second = i;
    }
    map<P,int> ma;
    rep(i,m) {
        int y,x;cin>>y>>x;
        y--;x--;
        h_cnt[y].first++;
        // cout<<h_cnt[y].first<<h_cnt[y].second<<endl;
        w_cnt[x].first++;
        ma[P(y,x)]++;
    }
    sort(h_cnt,h_cnt+h);
    // reverse(h_cnt,h_cnt+h);
    sort(w_cnt,w_cnt+w);
    // reverse(w_cnt,w_cnt+w);
    // rep(i,h) cout<<h_cnt[i].first<<h_cnt[i].second<<endl;
    int hs = lower_bound(h_cnt,h_cnt+h,P(h_cnt[h-1].first,0)) - h_cnt;
    int ws = lower_bound(w_cnt,w_cnt+w,P(w_cnt[w-1].first,0)) - w_cnt;
    // cout<< hs << " " << ws <<endl;
    for(int i=hs;i<h;i++) {
        for(int j = ws;j<w;j++) {
            // cout<<h_cnt[i].second<<w_cnt[j].second<<endl;
            if(ma[P(h_cnt[i].second,w_cnt[j].second)]==0) {
                cout<<h_cnt[i].first+w_cnt[j].first<<endl;
                return 0;
            }
        }
    }
    cout<<h_cnt[h-1].first+w_cnt[w-1].first-1<<endl;
}

Measured memory_bytes: 27072
import fractions

N,X = map(int,input().split())
x = [int(i) for i in input().split()]

for i in range(N):
    x[i] = abs(X-x[i])

if N == 1:
    print(x[0])
    exit()

ans = fractions.gcd(x[0],x[1])

if N == 2:
    print(ans)
    exit()
    
for i in range(N-2):
    ans = fractions.gcd(ans,x[i+2])
    
print(ans)

Measured memory_bytes: 16240
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define fix(n) cout<<fixed<<setprecision(n);
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  string s; cin>>s;
  int c=0,ans=0;
  rep(i,0,s.size()){
    if(s[i]=='A' || s[i]=='C' || s[i]=='T' || s[i]=='G') c++;
    else{
      ans=max(ans,c);
      c=0;
    }
  }
  ans=max(ans,c);
  co(ans);
  
  return 0;
}

Measured memory_bytes: 3600
// https://atcoder.jp/contests/abc147/tasks/abc147_f
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;

// https://qiita.com/asksaito/items/76b71602dd956b79dbf7
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
    ll x;
    std::cin >> x;
    while(true){
        if(IsPrime(x)){
            std::cout << x << std::endl;
            return 0;
        }else{
            x++;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 4000
vector <int> bi[N];
int n;
int ai[N];
int dfs(int t, int f)
{
    int ok = 0;
    for (int i = 0; i < bi[t].size(); ++ i)
        if (bi[t][i] != f)
            if (ai[t] > ai[bi[t][i]])
                if (!dfs(bi[t][i], t))
                    ok = 1;
    return ok;
}
int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++ i) cin >> ai[i];
    for (int i = 1; i < n; ++ i)
    {
        int a, b;
        cin >> a >> b;
        bi[a].push_back(b);
        bi[b].push_back(a);
    }
    for (int i = 1; i <= n; ++ i)
        if (dfs(i, 0)) cout << i << " ";
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const ll sp = 132694967;
const ll sp2 = 61438739;

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

    int n = s.size();
    int m = t.size();

    int flag[n+10] = {};
    int now = m % n;
    int start = 0;

    ll hash_s = 0;
    ll hash_t = 0; 
    ll rem = 1;
    ll hash_s2[n+10] = {}; // optional

    // hash_t作成
    rep(i,m){ 
        rem = (rem*sp2) % sp;
        hash_t += (int)t[m-1-i] * rem;
        hash_t %= sp;
    }
    // hash_s作成
    rem = 1;
    rep(i,m){
        rem = (rem*sp2) % sp;
        hash_s += (int)s[(m-1-i)%n] * rem;
        hash_s %= sp;
    }

    rep(i,n){
        if(hash_s==hash_t)flag[i] = 1;
        hash_s2[i] = hash_s; // optional
        hash_s += sp*sp2 - (int)s[start] * rem + (int)s[now];
        hash_s %= sp;
        hash_s *= sp2;
        hash_s %= sp;
        
        now++;
        now %= n;
        start++;
        start %= n;
    }



    int ans[n+10] = {};
    rep(i,n){
        if(flag[i]==1){
            int tmp = 1;
            flag[i] = i+10;
            ll ii = i;
            while(true){
                ii += m;
                ii %= n;
                if(flag[ii]==(i+10)){
                    cout << "-1" << endl;
                    return 0;
                }else if(flag[ii]>1){
                    tmp += ans[ii];
                    flag[ii] = i+10;
                    break;
                }else if(flag[ii]==1){
                    tmp++;
                    flag[ii] = i+10;
                    //break;
                }else{
                    break;
                }
            }
            ans[i] = tmp;
        }
    }
    /*
    rep(i,n)cout << flag[i];
    cout << endl;
    */


    int ma = 0;
    rep(i,n){
        ma = max(ans[i],ma);
    }

    cout << ma<< endl;

    return 0;
}
 
 


Measured memory_bytes: 9224
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static int N;
    static int D;
    static void Main(string[] args)
    {
        var s = new Scanner();

        N = s.ReadInt();
        D = s.ReadInt();

        Solve();
    }

    static void Solve()
    {
        var ans = Math.Ceiling(N / (2.0 * D + 1));
        Console.WriteLine(ans);
    }
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }

    public string ReadStr()
    {
        return this.Next();
    }

    public char ReadChar()
    {
        return this.Next()[0];
    }

    public int ReadInt()
    {
        return int.Parse(this.Next());
    }

    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }

    public long ReadLong()
    {
        return long.Parse(this.Next());
    }

    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }

    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }

    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }

    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}



Measured memory_bytes: 13140
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

int main(){
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    
    int K; cin >> K;
    int K_div2 = K/2;
    cout << K_div2*(K-K_div2) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

int main() {
  int N;
  cin >> N;
  
  if (N == 1) {
    cout << "Hello World" << endl;
  } else {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, A, S;
set<pair<int,int>>st[1 << 18];
int main() {
	cin >> N;
	for (int i = 0; i < (1 << N); ++i) {
		cin >> A;
		st[i].insert(mkp(A, i));
		st[i].insert(mkp(-1, -1));
	}
	for (int i = 1; i < (1 << N); ++i) {
		for (int j = 0; j < N; ++j) {
			if (i&(1 << j)) {
				auto it = st[i - (1 << j)].begin();
				st[i].insert(*it);
				++it;
				st[i].insert(*it);
				while (st[i].size() > 2) {
					st[i].erase(st[i].begin());
				}
			}
		}
	}
	for (int i = 1; i < (1 << N); ++i) {
		int t = 0;
		for (auto j : st[i]) {
			t += j.first;
		}
		S = max(S, t);
		cout << S << endl;
	}
	return 0;
}

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

// ソルバー
class Abc140b {
    public:
    int solve(int n, int *a, int *b, int *c);
};

int Abc140b::solve(int n, int *a, int *b, int *c) {
    int s=0;
    for (int i=1;i<=n;i++){
        s+= b[a[i]];
        if (i<n && a[i+1] == a[i] + 1) {
            s += c[a[i]];
        }
    }
    return s;
}

// 実行
int main () {
    int n;
    std::cin >> n;
    int* a = new int[n+1];
    int* b = new int[n+1];
    int* c = new int[n];
    for(int i=1;i<=n;i++) {
        std::cin >> a[i];
    }
    for(int i=1;i<=n;i++) {
        std::cin >> b[i];
    }
    for(int i=1;i<=n-1;i++) {
        std::cin >> c[i];
    }

    Abc140b p;
    std::cout << p.solve(n, a, b, c) << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int k;
  cin >> k;

  int a = 7 % k;
  for (int i = 0; i < k; ++i) {
    if (a == 0) {
      cout << i + 1 << endl;
      return 0;
    }
    a = (a * 10 + 7) % k;
  }
  cout << -1 << endl;
}


Measured memory_bytes: 3608
#include<stdio.h>
#include<string.h>
#define MAX 25
#define LEN 14
#define NIL -1

typedef struct{
  int parent;
  int left; 
  int right; 
  char state[LEN]; 
  int depth; 
  int sib; 
  int deg; 
  int height; 
}Node;

void s_Dep(int, int);
int s_Hei(int, int);

Node t[MAX];

int main(){
  int n, a, parent, root;
  int i;

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    t[i].parent = NIL;
    t[i].deg = 0;
  }
  
  for(i = 0; i < n; i++){
    scanf("%d", &a);
    scanf("%d %d", &t[a].left, &t[a].right);
    if(t[a].left != NIL) t[t[a].left].parent = a; 
    if(t[a].right != NIL) t[t[a].right].parent = a;
  }

  for(i = 0; i < n; i++){
    if(t[i].parent == NIL) root = i;
  }

  s_Dep(root, 0);
  s_Hei(root, 0);

  for(i=0;i<n;i++){

    if(t[i].parent == NIL) strcpy(t[i].state, "root");
    else if(t[i].left == NIL && t[i].right == NIL) strcpy(t[i].state, "leaf");
    else strcpy(t[i].state, "internal node");

    if(t[i].parent != NIL){
      parent = t[i].parent;
      if(t[parent].left != NIL && t[parent].left != i) t[i].sib = t[parent].left;
      else if(t[parent].right != NIL && t[parent].right != i) t[i].sib = t[parent].right;
      else t[i].sib = NIL;
    }
    else t[i].sib = NIL;

    if(t[i].left != NIL) t[i].deg++;
    if(t[i].right != NIL) t[i].deg++;
    printf("node %d: ", i);
    printf("parent = %d, ", t[i].parent);
    printf("sibling = %d, ", t[i].sib);
    printf("degree = %d, ", t[i].deg);
    printf("depth = %d, ", t[i].depth);
    printf("height = %d, ", t[i].height);
    printf("%s\n", t[i].state);
  }
  
  return 0;
}

void s_Dep(int u, int d){
  t[u].depth = d;
  if(t[u].left != NIL) s_Dep(t[u].left, d+1);
  if(t[u].right != NIL) s_Dep(t[u].right, d+1);
}

int s_Hei(int u, int h){
  int h1 = 0, h2 = 0;
  if(t[u].left != NIL) h1 = s_Hei(t[u].left, h) + 1;
  if(t[u].right != NIL) h2 = s_Hei(t[u].right, h) +1;
  if(h1 > h2){ 
    t[u].height = h1;
    return h1;
  }else{
   t[u].height = h2;
   return h2;
  }
}



Measured memory_bytes: 2084
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define P pair<int,int>
#define prique priority_queue
int a,b,ans;
signed main(){
    cin>>a>>b;
    if(a<b)swap(a,b);
    if(a==b)ans=a+b;
    else ans=2*a-1;
    cout<<ans<<endl;
}


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

int main(){
    int n, t, c = 9999, ci, ti, i;
    cin >> n >> t;
    for(i=0; i<n; i++){
        cin >> ci >> ti;
        if(ti <= t){
            c = min(c, ci);
        }
    }
    if(c == 9999){
        cout << "TLE";
    }else{
        cout << c;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define ct(string) cout << string << endl

int n, c = 0;

void selectionSort(vector<int> &vec) {
    rep(i,n) {
        int minn = i;
        for (int j=i; j<n; j++) { //i以降で最小の
            if (vec.at(j) < vec.at(minn)) minn = j;
        }
        swap(vec.at(i), vec.at(minn));
        if (i != minn) c++;
    }
}

void cout_vector(vector<int> vec) {
    rep(i,n-1) {
        cout << vec.at(i) << " ";
    }
    ct(vec.at(n-1));
}

int main() {
    cin >> n;
    vector<int> vec(n);
    rep(i,n) cin >> vec.at(i);
    selectionSort(vec);
    cout_vector(vec);
    ct(c);
}


Measured memory_bytes: 3168
import sys
n,m = map(int,input().split())
fib = []
mod = 10**9 + 7

a = []
for i in range(m):
    a.append(int(input()))
    if a[i] == a[i-1] +1:
        print(0)
        sys.exit()
a.append(n+1)
dp = [1]
tmp = 0
for i in range(1,n+1):
    if i == a[tmp]:
        tmp += 1
        dp.append(0)
    elif i > 1:
        dp.append((dp[i-1] + dp[i-2])%mod)
    else:
        dp.append(1)

print(dp[-1])

Measured memory_bytes: 7372
Bingo_1 = list(map(int, input().split()))
Bingo_2 = list(map(int, input().split()))
Bingo_3 = list(map(int, input().split()))

number_table = []
number_count = int(input())
for i in range(number_count):
    number_table.append(int(input()))

for j in range(number_count):
    if number_table[j] == Bingo_1[0]:
        Bingo_1[0] = 0
    elif number_table[j] == Bingo_1[1]:
        Bingo_1[1] = 0
    elif number_table[j] == Bingo_1[2]:
        Bingo_1[2] = 0
    elif number_table[j] == Bingo_2[0]:
        Bingo_2[0] = 0
    elif number_table[j] == Bingo_2[1]:
        Bingo_2[1] = 0
    elif number_table[j] == Bingo_2[2]:
        Bingo_2[2] = 0
    elif number_table[j] == Bingo_3[0]:
        Bingo_3[0] = 0
    elif number_table[j] == Bingo_3[1]:
        Bingo_3[1] = 0
    elif number_table[j] == Bingo_3[2]:
        Bingo_3[2] = 0

if Bingo_1[0] == 0 and Bingo_1[1] == 0 and Bingo_1[2] == 0:
    print('Yes')
elif Bingo_2[0] == 0 and Bingo_2[1] == 0 and Bingo_2[2] == 0:
    print('Yes')
elif Bingo_3[0] == 0 and Bingo_3[1] == 0 and Bingo_3[2] == 0:
    print('Yes')
elif Bingo_1[0] == 0 and Bingo_2[0] == 0 and Bingo_3[0] == 0:
    print('Yes')
elif Bingo_1[1] == 0 and Bingo_2[1] == 0 and Bingo_3[1] == 0:
    print('Yes')
elif Bingo_1[2] == 0 and Bingo_2[2] == 0 and Bingo_3[2] == 0:
    print('Yes')
elif Bingo_1[0] == 0 and Bingo_2[1] == 0 and Bingo_3[2] == 0:
    print('Yes')
elif Bingo_1[2] == 0 and Bingo_2[1] == 0 and Bingo_3[0] == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9344
#include<iostream>

using namespace std;
int main(void) {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	cout << x2 - (y2 - y1) << endl;
	cout << y2 + (x2 - x1) << endl;
	cout << x1 - (y2 - y1) << endl;
	cout << y1 + (x2 - x1) << endl;
	return 0;
}

Measured memory_bytes: 256