akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define out(x) cout << x << '\n'
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
//---------------------------------------------------------------------------------------------------
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
//---------------------------------------------------------------------------------------------------
lli a = 0, b = 0, c = 0, h = 0, n = 0, w = 0, ans = 0, count = 0;
string s = "", t = "";
vector<pair<lli, lli>> pr;
map<lli, lli> mp;
set<lli> st;

//---------------------------------------------------------------------------------------------------
lli solve()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  vlli d(n);
  lli count = 0;
  rep(i, 0, n)
  {
    cin >> d[i];
    if ((i + 1) % 2 == 1 && d[i] % 2 == 1)
    {
      count++;
    }
  }
  return count;
}

//---------------------------------------------------------------------------------------------------
signed main()
{
  out(solve());
  // if (ans > 0)
  // {
  //   cout << "Yes"
  //        << "\n";
  // }
  // else
  // {
  //   cout << "No"
  //        << "\n";
  // }
}

Measured memory_bytes: 3656
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===
def main():
    n = ni()
    s = list(input())
    q = ni()

    alphabet_idx = {}
    for i in range(26):
        alphabet_idx[i] = []

    for i, si in enumerate(s):
        alphabet_idx[ord(si) - ord("a")].append(i)

    for _ in range(q):
        qi, a, b = input().split()
        qi, a = int(qi), int(a)

        if qi == 1:
            a -= 1
            if s[a] == b:
                continue
            del_char = ord(s[a]) - ord("a")
            del_idx = bisect.bisect_left(alphabet_idx[del_char], a)
            del alphabet_idx[del_char][del_idx]

            insert_char = ord(b) - ord("a")
            insert_idx = bisect.bisect_left(alphabet_idx[insert_char], a)
            alphabet_idx[insert_char].insert(insert_idx, a)

            s[a] = b

        if qi == 2:
            b = int(b)
            a -= 1
            b -= 1
            ans = 0

            for i in range(26):
                a_idx = bisect.bisect_left(alphabet_idx[i], a)
                if a_idx < len(alphabet_idx[i]):
                    if alphabet_idx[i][a_idx] <= b:
                        ans += 1

            print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;
using ll = long long;


int main() {
    string s;
    cin >> s;
    ll n = s.length();
    ll r = 0;
    ll l = 0;
    rep(i, n) {
        if (s[i] == 'R') r++;
        else l++;

        if (i == n-1) {
            rep(j,r-1) {
                cout << 0 << " ";
            }
            if ((r+l) % 2 == 0) {
                cout << (r + l) / 2 << " " << (r + l) / 2 << " ";
            }
            else if (r % 2 == 0) {
                cout << (r + l) / 2 << " " << (r + l + 1 ) / 2 << " ";
            }else{
                cout << (r + l + 1) / 2 << " " << (r + l) / 2 << " ";
            }
            rep(j, l - 1) {
                cout << 0 << " ";
            }
            r = 0;
            l = 0;
        } else if (s[i] == 'L' && s[i+1] == 'R') {
            rep(j, r-1) {
                cout << 0 << " ";
            }
            if ((r + l) % 2 == 0) {
                cout << (r + l) / 2 << " " << (r + l) / 2 << " ";
            }
            else if (r % 2 == 0) {
                cout << (r + l) / 2 << " " << (r + l + 1) / 2 << " ";
            } else {
                cout << (r + l + 1) / 2 << " " << (r + l) / 2 << " ";
            }
            rep(j, l-1) {
                cout <<0 << " ";
            }
            r = 0;
            l = 0;
        }
    }
    cout << endl;
}


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

using ll=long long;
void chmin(ll &a,ll b){
  if(a>b)a=b;
}

int main(){
  int t;cin>>t;
  while(t--){
    int n,ans=0;cin>>n;
    vector<ll>v(n),now;
    for(ll &p:v)cin>>p;
    string s;cin>>s;
    for(int i=n-1;i>=0;i--){
      for(ll p:now)chmin(v[i],v[i]^p);
      now.push_back(v[i]);
      ans|=s[i]=='1'&&v[i];
    }
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 3604
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>

using namespace std;


int main()
{
	constexpr int INF = 1000000000;
	int h, n;
	cin >> h >> n;

	vector<vector<int>> dp(n + 1, vector<int>(h + 1, INF));

	dp[0][0] = 0;

	for (int i = 0; i < n; ++i)
	{
		int a, b;
		cin >> a >> b;

		for (int j = 0; j <= h; ++j)
		{

			dp[i + 1][j] = min(dp[i + 1][j],dp[i][j]);
			dp[i + 1][min(j + a, h)] = min(dp[i + 1][min(j + a, h)], dp[i + 1][j] + b);
		}
	}

	cout << dp[n][h] << endl;
}

Measured memory_bytes: 39424
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <numeric>
#include <cmath>
#include <map>
#include <set>
#define ull unsigned long long
#define ll long long
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a = {111,222,333,444,555,666,777,888,999};
    for(int i=0;i<9;i++){
        if(n<=a[i]){
            cout << a[i] << endl;
            return 0;
        }
        else continue;
    }


    return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
#define MAX 500000
Node root;
int S[MAX-1];
int cnt=0;
/*
Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}
*/
/*
Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



  }
*/

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  S[cnt] = k;
  
  while(x != NIL){
  y=x;
  if(z->key < x->key) x = x->left;
  else x = x->right;
  }
  // z->p = y;
  
  if(y == NIL) root = z;
  else if( z->key < y->key) y->left = z;              // z を y の左の子にする
  else     y->right = z;               // z を y の右の子にする
  cnt++;
}

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;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    /* if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");*/
   if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
   else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }/* else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
      }*/
  }
  return 0;
}



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

const int mod = 1e9 + 7;

inline int add(int a, int b)
{
	return (0LL + a + b) % mod;
}

inline int mult(int a, int b)
{
	return (1LL*a*b)%mod;
}

void solve()
{
	int n;
	cin >> n;

	vector<int> a(n);
	for(auto &ele : a)
		cin >> ele;

	auto suff = a;
	for(int i = n - 2; i >= 0; i--)
		suff[i] = add(suff[i], suff[i + 1]);

	int res = 0;
	for(int i = 0; i < (n - 1); i++)
	{
		res = add(res, mult(a[i], suff[i + 1]));
	}

	cout << res << endl;
}



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

	solve();
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    int x[n], y[n], h[n];
    for(int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i] >> h[i];
    }

    int MAX = 100;
    //全探索
    for(int i = 0; i <= MAX; i++)
    {
        for(int j = 0; j <= MAX; j++)
        {
            int H = -1;

            for(int k = 0; k < n; k++)
            {
                if(h[k]>0){
                    int tmp = h[k] + abs(x[k]-i) + abs(y[k]-j);
                    if(H == -1){
                        H = tmp;
                    }
                    else{
                        if(H != tmp){
                            H = -2;
                            break;
                        }
                    }
                }
            }
            if(H == -2) continue;

            for(int k = 0; k < n; k++)
            {
                if(h[k]==0){
                    if(H > abs(i-x[k])+abs(j-y[k])){
                        H = -2;
                        break;
                    }
                }
            }
            
            if(H == -2) continue;

            cout << i << ' ' << j << ' ' << H << endl;
            return 0;
            
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=1<<18;

int main(){
    int n,x,t;
    cin>>n>>x>>t;
    int m=n/x;
    if(n%x!=0) m++;
    cout<<m*t<<endl;
}

Measured memory_bytes: 3620
printNum::(Int,Bool)->IO()
printNum (n,True) = putStrLn $ take n $ repeat '#'
printNum (1,False) = putStrLn "#"
printNum (n,False) = putStrLn $ "#"++(take (n-2) $ repeat '.')++"#"


printRec::(Int,Int)->IO ()
printRec (a,b) = sequence_ $ (\x->x++[putStrLn ""]) $ map printNum $ map (\x->(b,(x==a||x==1))) $ take a [1,2..]



function::String->IO ()
function x=mapM_ printRec $ takeWhile(/=(0,0))$map (\[x,y]->(read x::Int,read y::Int)) $ map words $ lines x

main = getContents >>= function

Measured memory_bytes: 4748
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  int N;
  cin >>N;
  double a=1;
  double b=2;
  double c=(double)a/(double)b;
  if(N%2==0) {
cout << c<< endl;
  }
else if((N%2 !=0) &&(N !=1) ){
int d=N/2;
  int e=N-d;
  double f=(double)e/(double)N;
  cout << f<< endl;

}
  else if (N ==1) {
    cout << 1 << endl;
  }
}

Measured memory_bytes: 256
n,t = map(int,input().split())
dishes = [[int(i) for i in input().split()] for _ in range(n)]
dishes.sort(key=lambda x: x[0])
dp = [[0]*(t+1) for _ in range(n+1)]

for i in range(n):
    a,b = dishes[i]
    for j in range(t+1):
        if j < t: dp[i+1][min(j+a,t)] = max(dp[i+1][min(j+a,t)],dp[i][j]+b)
        dp[i+1][j] = max(dp[i+1][j],dp[i][j])
print(dp[n][t])

Measured memory_bytes: 146492
// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;
 
#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll N; cin >> N;
	int mbit = -1; rep(i, 63) if(N & (1ull<<i)) mbit = i;
	rep(i, 63) if(i <= mbit) N |= (1ull<<i);
	cout << N << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int m, nmin, nmax;
    while (cin >> m >> nmin >> nmax, m) {
        vector<int> P(m);
        REP (i, m) cin >> P[i];
        int tmp = 0, ans = -1;
        FOR (i, nmin, nmax + 1) {
            if (P[i - 1] - P[i] >= tmp) {
                tmp = P[i - 1] - P[i];
                ans = i;
            }
        }
        cout << ans << endl;
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
#define loop(i, a, b) for(int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
using vi = vector <int>;
using vvi = vector <vi>;
using vc = vector <char>;
using vvc = vector <vc>;
using vs = vector <string>;
using vvs = vector <vs>;
//g++ -std==c++14
//setprecision(10)
bool check(string s){
    char va = s[0];
    rep(i, s.size())if(va != s[i])return 0;
    return 1;
}

int main(){
    string s;
    cin >> s;
    map <char, bool> memo;
    int min_cnt = INF;
    rep(i, s.size()){
        if(memo[s[i]]++)continue;
        int cnt = 0;
        string alt = s;
        string erase_alt = s;
        while(!check(erase_alt)){
            alt = erase_alt;
            erase_alt.erase(erase_alt.begin());
            rep(j, erase_alt.size())
                if(alt[j] == s[i] || alt[j + 1] == s[i])
                    erase_alt[j] = s[i];
            cnt++;
        }
        min_cnt = min(cnt, min_cnt);
    }
    cout << min_cnt << endl;

}
/*
whbrjpjyhsrywlqjxdbrbaomnw

char vari = s[i];
auto koko = s.begin();

*/

Measured memory_bytes: 384
#!/opt/local/bin/python3

from sys import stdin

def solve(N):
  l = [2, 1]
  if N <= 0: return l[N]
  for i in range(2, N + 1):
    lx = l[0] + l[1]
    l[0] = l[1]
    l[1] = lx
  return l[1]

N = int(stdin.readline())
print(solve(N))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;	// 998244353
using ll = long long;
using namespace std;

ll power( ll a, int b ){
	ll res = 1;
	while( b > 0 ){
		if( b & 1 ) res = res*a % mod;
		a = a*a % mod;
		b >>= 1;
	}
	return res;
}

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

	vector<int> a(n);
	for( auto &k : a ) cin >> k;

	const int a_bound = 1000010;
	vector<int> l(a_bound, 0);
	
	int p_bound = 1;
	for( auto k : a ){
		if( k == 1 ) continue;
		int t = k;
		for( int p = 2; p*p <= k; ++p ){
			int cnt = 0;
			while( t % p == 0 ){
				t /= p;
				++cnt;
			}
			if( cnt > 0 ){
				p_bound = max(p_bound, p);
				l[p] = max(l[p], cnt);
			}
		}
		if( t != 1 ){
			p_bound = max(p_bound, t);
			l[t] = max(l[t], 1);
		}
	}
	
	vector<int> pset;
	for( int p = 2; p <= p_bound; ++p ){
		if( l[p] > 0 ) pset.emplace_back(p);
	}

	ll ans = 0;
	
	for( auto &t : a ){
		ll pro = 1;
		for( auto p : pset ){
			int cnt = 0;
			while( t % p == 0 ){
				t /= p;
				++cnt;
			}
			pro *= pow((ll)p, l[p]-cnt);
			pro %= mod;
		}
		ans += pro;
		ans %= mod;
	}

	cout << ans << endl;
}

Measured memory_bytes: 4352
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#define SF scanf
#define PF printf
#define MAXN 310
using namespace std;
int n,ans;
char s[MAXN][MAXN];
bool used[MAXN];
int main(){
	SF("%d",&n);
	for(int i=0;i<n;i++)
		SF("%s",s[i]);
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++){
			for(int k=0;k<n;k++)
				if(s[i][j]!=s[(j-(k+i-j)+2*n)%n][(i+(k+i-j)+n)%n])
					used[(k+i-j+n)%n]=1;
		}
	for(int i=0;i<n;i++)
		if(used[i]==0)
			ans+=n;
	PF("%d",ans);
} 

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

string a,b="CF"; 
int al,bl;

int main(){
    getline(cin,a);
    al=a.length();
    for(int i=0;i<al;i++)
        if(a[i]==b[bl]){ 
            bl++;
            if(bl==2)
                break;
        }
    if(bl==2) cout<<"Yes"; 
    else cout<<"No";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
    int A, B;
    cin >> A >> B;
    int sum = 0;
    if (A > B) {
        sum = A;
        A--;
    } else {
        sum = B;
        B--;
    }

    sum += max(A, B);
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3588
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		private const int mod = 1000000007;  // 10^9+7

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			int k = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int a = vs[0];
			int b = vs[1];

			int c = b / k;
			if (a <= k * c) {
				Console.WriteLine("OK");
			} else {
				Console.WriteLine("NG");
			}
		}

	}
}


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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007

signed main()
{
	init();
	solve();
}


string s;

void init()
{
	cin >> s;
	cin >> s;
}

void solve()
{
	cout << "A" << s[0] << "C" << endl;
}



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

int as[4];
int bs[4];

int main() {
  while (1) {
    int hit = 0;
    int blow = 0;
  
    for (int i=0; i<4; i++) {
      if (scanf("%d", &as[i]) != 1) return 0;
    }
  
    for (int i=0; i<4; i++) {
      scanf("%d", &bs[i]);
      if (as[i] == bs[i]) hit++;
      else {
        for (int j=0; j<4; j++) {
          if (as[j] == bs[i]) blow++;
        }
      }
    }
  
    printf("%d %d\n", hit, blow);
  }
}

Measured memory_bytes: 2580
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(), (x).end()
#define Sort(x) sort((x).begin(), (x).end())
#define Reverse(x) reverse((x).begin(), (x).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for (int i = m; i < n; i++)
#define INF INT_MAX
#define fcout cout << fixed << setprecision(15) // 15桁まで表示
#define en '\n'
using str = string;
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using puu = pair<ui, ui>;
using P = pair<int, int>;
using vi = vector<int>;
int gcd(int a, int b) {
  return b ? gcd(b, a % b) : a;
};
int lcm(int a, int b) {
  return a / gcd(a, b) * b;
};
int floor(int a, int b) {
  return (a + b - 1) / b;
};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
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;
};
const ll mod = 1000000007;
const double PI = acos(-1.0);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << setiosflags(ios::fixed);

  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  ll p = x / d;
  if (k<p)
    cout << x - k * d << en;
  else {
    k -= p;
    x -= p * d;
    k &= 1;
    cout << abs(x - d * k) << en;
  }
}

Measured memory_bytes: 3640
#ABC061 D Score Attack
#ベルマンフォード法を使う時は、グラフが連結でない場合に注意する。
from collections import deque

def bfs(s, graph):
    visited = [False]*N
    visited[s] = True
    q = deque([s])
    
    while q:
        v = q.popleft()
        
        for nv in graph[v]:
            if not visited[nv]:
                visited[nv] = True
                q.append(nv)
    
    return visited

def bellmanford():
    dist = [10**18]*N
    dist[0] = 0
    
    for i in range(N):
        for s, t, c in edges:
            if not visited1[s] or not visited2[t]:
                continue
            
            if dist[t]>dist[s]+c:
                dist[t] = dist[s]+c
                
                if i==N-1:
                    print('inf')
                    exit()

    return dist[-1]

N, M = map(int, input().split())
edges = []
G = [[] for _ in range(N)]
rG = [[] for _ in range(N)]

for _ in range(M):
    a, b, c = map(int, input().split())
    edges.append((a-1, b-1, -c))
    G[a-1].append(b-1)
    rG[b-1].append(a-1)

visited1 = bfs(0, G)
visited2 = bfs(N-1, rG)

print(-bellmanford())

Measured memory_bytes: 46828
#include<bits/stdc++.h>
using namespace std;
int a,b,c,type=0;
int main(){
	scanf("%d%d%d",&a,&b,&c);
	for(int i=1;i<=b;i++){
		if(a*i%b==c){
			type=-1;
			break;
		}
	}
	if(type==-1){
		printf("YES");
	}else printf("NO");
}

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

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

 int main() {
   int N;
   ll ans = 0;
   cin >> N;
   map<string, ll> s;
   rep(i, N) {
     string tmp;
     cin >> tmp;
     sort(tmp.begin(), tmp.end());
     s[tmp]++;
   }

   for(auto p:s) {
     ans += p.second * (p.second - 1) / 2;
   }

   cout << ans << endl;
 }


Measured memory_bytes: 11136
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    int n, sum1, sum2, ans = 1000000000;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    FOR(i, 1, n){
        sum1 = 0;
        sum2 = 0;
        REP(j, n){
            if(j < i) sum1 += a[j];
            else sum2 += a[j];
        }
        ans = min(ans, abs(sum1-sum2));
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int n = sc.nextInt();
		System.out.println(f(n));
	}
	
	static long f(int n) {
		if(n == 0) {
			return 1;
		} else {
			return n * f(n-1);
		}
	}
}

Measured memory_bytes: 12000
MOD = 10 ** 9 + 7
INF = 10 ** 11
import sys
sys.setrecursionlimit(100000000)

def main():
    k = int(input())
    a,b = map(int,input().split())
    for i in range(a,b + 1):
        if i%k == 0:
            print('OK')
            return
    print('NG')
if __name__ == '__main__':
    main()


Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
#define int long long


signed main(){
	int n,mi=1000000000;
	bool bou=true;
	cin>>n;
	vector<int>vec(n);
	for(int i=0;i<n;i++){
	    cin>>vec[i];
	}
	sort(vec.begin(),vec.end());
	int a=1;
	while(1){
	    a*=2;
	    for(int i=0;i<vec.size();i+=a){
	    	//cout<<vec[i]<<" "<<vec[i+a/2]<<endl;
	    	if(i+a/2<=vec.size()){
	            vec[i]=__gcd(vec[i+a/2],vec[i]);
	    	}
	        //cout<<vec[i]<<endl;
	    }
	    if(a*2>vec.size())break;
	}
	cout<<vec[0]<<endl;
}

Measured memory_bytes: 1024
//四則演算 #pragma GCC target("avx")
//並列計算 #pragma GCC optimize("O3")
//条件分岐を減らす #pragma GCC optimize("unroll-loops")
//浮動小数点演算 #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define each(i, a) for(auto &i : a)
#define SORT(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

int main() {
    init();

    string s; cin >> s;
    string t; cin >> t;
    int ans = 0;
    FOR(i, 0, s.length())if (s[i] != t[i])++ans;
    print(ans);

    return 0;
}

Measured memory_bytes: 3796
#include <iostream>
#include <string>

#define swap(x,y) int temp=(x); (x)=(y); (y)=temp;
using namespace std;

class Dice{
    int s[6];   //?????????????????¢
public:
    Dice(int *);
    void throw_dice(char);
    int get_up() const {return s[0];}
};

Dice::Dice(int *dice_s){
    for (int i=0;i<6;i++) s[i]=dice_s[i];
}

void Dice::throw_dice(char d){
    int temp,temp2;
    switch(d){
        case 'S':
            temp=temp2=s[2-1];
            s[2-1]=s[1-1];
            temp2=s[6-1];
            s[6-1]=temp;
            temp=temp2;
            temp2=s[5-1];
            s[5-1]=temp;
            temp=temp2;
            s[1-1]=temp;
            break;
        case 'E':
            temp=temp2=s[3-1];
            s[3-1]=s[1-1];
            temp2=s[6-1];
            s[6-1]=temp;
            temp=temp2;
            temp2=s[4-1];
            s[4-1]=temp;
            temp=temp2;
            s[1-1]=temp;
            break;
        case 'N':
            temp=temp2=s[5-1];
            s[5-1]=s[1-1];
            temp2=s[6-1];
            s[6-1]=temp;
            temp=temp2;
            temp2=s[2-1];
            s[2-1]=temp;
            temp=temp2;
            s[1-1]=temp;
            break;
        case 'W':
            temp=temp2=s[4-1];
            s[4-1]=s[1-1];
            temp2=s[6-1];
            s[6-1]=temp;
            temp=temp2;
            temp2=s[3-1];
            s[3-1]=temp;
            temp=temp2;
            s[1-1]=temp;
            break;
        default:
            cout<<"Error!";
            break;
    }
}

int main(){
    int n[6];
    for (int i=0;i<6;i++) cin>>n[i];
    
    Dice dice(n);
    
    string s;
    cin>>s;
    for (int i=0,l=s.length();i<l;i++){
        dice.throw_dice(s[i]);
    }
    cout<<dice.get_up()<<endl;
}

Measured memory_bytes: 1204
import java.io.*;
import java.util.*;
import java.util.Stack;
import java.util.regex.Pattern;


public class Main {

	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
		//it reads the data about the specified point and divide the data about it ,it is quite fast
		//than using direct 

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static long mod = (long)(1e9+7);
	public static void main(String[] args) {
		 FastReader sc = new FastReader();
		 int n = sc.nextInt();
		 int k = sc.nextInt();
		 int ans = 0;
		 if(k!=1) ans = n-k;
		 System.out.println(ans);
	}
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
#define ll long long
const int mo = 1e9+7;
using namespace std;
int gi(){
  char ch=getchar(); int x=0,q=0;
  while(ch<'0' || ch>'9') (ch=='-'?q=1:0),ch=getchar();
  while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return q?(-x):x;
}
ll ans,x,y,sx,sy;
int main(){
  int n=gi(),m=gi(),v;
  for (int i=1; i<=n; ++i){
    v=gi(); sx+=1ll*(i-1)*v-x;
    x+=v;
  }
  for (int i=1; i<=m; ++i){
    v=gi(); sy+=1ll*(i-1)*v-y;
    y+=v;
  }
  sx%=mo,sy%=mo;
  cout<<sx*sy%mo;
  return 0;
}


Measured memory_bytes: 384
import sys

n, t = [int(x) for x in sys.stdin.readline().split()]
a = [int(x) for x in sys.stdin.readline().split()]
total = t
for i in range(n-1):
	d = a[i+1] - a[i]
	if d <= t:
		total += d
	else:
		total += t
print(total)

Measured memory_bytes: 25104
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun Apr  5 14:53:06 JST 2020
 **/

signed main() {
    Int K;
    std::cin >> K;
    std::vector<Int> all;
    auto dfs = [&](auto f, Int cur) -> void {
        if (cur > 3234566667) return;
        all.push_back(cur);
        REP(i, 10) {
            if (std::abs(i - cur % 10) > 1) continue;
            f(f, cur * 10 + i);
        }
    };
    REP(i, 1, 10) dfs(dfs, i);
    std::sort(all.begin(), all.end());
    std::cout << all[K - 1] << std::endl;
}


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

int main() {
	int N;
	cin >> N;
	int Y = 0;

	for (int i = 0; i < N; i++) {
		string op;
		cin >> op;
		if (op == "Y")
			Y++;
		else
			Y = Y;
	}
	if (Y == 0)
		cout << "Three" << endl;
	else
		cout << "Four" << endl;
	return 0;
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll mod = 1e9+7;


ll n,i,j,k,t,l,r;

int main(){
	scanf("%lld %lld", &n, &k);
	if(n%k==0){
		puts("-1");
	}
	else{
		t = n;
		while(t%k==0)
			t += n;
		if(t > 1e18)
			puts("-1");
		else
			printf("%lld\n", t);
	}
	return 0;
}

Measured memory_bytes: 256
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

# r = int(sys.stdin.readline())
# print(r**2 *3)

N, D = list(map(int, sys.stdin.readline().split()))

print(math.ceil(N / (D * 2 + 1)))


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

ll gcd(ll m, ll n) {
  if (n == 0) return m;
  else return gcd(n, m % n);
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll A, B, C, D;
  cin >> A >> B >> C >> D;
  ll ans = B - A + 1;
  ll kc = (B + C) / C - (A + C - 1) / C;
  ll kd = (B + D) / D - (A + D - 1) / D;
  ll g = lcm(C, D);
  ll kg = (B + g) / g - (A + g - 1) / g;
  ans = ans - kc - kd + kg;
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int x,y,z;
	cin >> x >> y >> z;
	if (x <= y && x <= z && y <= z) {
		cout << x <<" "<< y <<" "<< z << endl;
	}
	else if (x <= z && x <= y && z <= y) {
		cout << x <<" "<< z <<" "<< y << endl;
	}
	else if (y<=x && y<=z && x<=z) {
		cout << y<<" "<<x<<" "<<z << endl;
	}
	else if (y<=z && y<=x && z<=x) {
		cout << y<<" "<<z<<" "<<x << endl;
	}
	else if (z<=x && z<=y && x<=y) {
		cout << z<<" "<<x<<" "<<y << endl;
	}
	else if (z<=y && z<=x &&y<=x) {
		cout << z<<" "<<y<<" "<<x << endl;
	}
}


Measured memory_bytes: 3100
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		while (true) {
			int n = scan.nextInt();
			int m = scan.nextInt();
			if (n + m == 0)
				break;
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = scan.nextInt();
			}
			int ans = 0;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (i == j) continue;
					int sum = a[i] + a[j];
					if (sum <= m)
						ans = Math.max(ans, sum);
				}
			}
			if (ans != 0) {
				System.out.println(ans);
			} else {
				System.out.println("NONE");
			}
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 51768
#define _CRT_SECURE_NO_WARNINGS
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
#define indexOf(v,x) (find(all(v),x)-v.begin())



inline int popcount64(unsigned long long x) {
	x = (x >> 1 & 0x5555555555555555ULL) + (x & 0x5555555555555555ULL);
	x = (x >> 2 & 0x3333333333333333ULL) + (x & 0x3333333333333333ULL);
	x = (x >> 4 & 0x0f0f0f0f0f0f0f0fULL) + (x & 0x0f0f0f0f0f0f0f0fULL);
	x = (x >> 8 & 0x00ff00ff00ff00ffULL) + (x & 0x00ff00ff00ff00ffULL);
	x = (x >> 16 & 0x0000ffff0000ffffULL) + (x & 0x0000ffff0000ffffULL);
	return ((x >> 32) + (x & 0xffffffff));
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long n;
	cin >> n;
	n |= n >> 1;
	n |= n >> 2;
	n |= n >> 4;
	n |= n >> 8;
	n |= n >> 16;
	n |= n >> 32;
	cout << popcount64(n) << endl;


	return 0;
}

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

int findSumOfDigits(int n){
    int sum = 0;
    while(n > 0){
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
int main(){
    int N,A,B;
    cin >> N >> A >> B;
    int sum = 0;
    int total = 0;
    for(int i = 1; i <= N; ++i){
        int sum = findSumOfDigits(i);
        if(sum >= A && sum <= B){
            total += i;
        }
    }

    cout << total << endl;

    

 return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int n , k ,ans = 1;
  
  scanf("%d %d",&n,&k);
  
  for(int i = 0; i < n;i ++){
    if(ans*2<k+ans){
      int c = ans;
      ans = 2*c;
    }
    else{
      ans += k;
    }
  }

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

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 0x3fffffff;

int N, M;
vector<int> v[100005], ans;
bool f[100005] = {};

void dfs(int n){
	ans.push_back(n);
	f[n] = true;
	for(auto t: v[n]) if( !f[t] ){
		dfs(t);
		break;
	}
}

int main(){
	//ios_base::sync_with_stdio(0);

	cin >> N >> M;
	rep(i,M){
		int A, B;
		cin >> A >> B;
		//A--; B--;
		v[A].push_back(B);
		v[B].push_back(A);
	}

	dfs(1);
	reverse( all(ans) );
	ans.pop_back();
	dfs(1);

	cout << ans.size() << endl;
	for(auto a: ans){
		cout << a;
		if(ans.back() != a) cout << " ";
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 9720
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        m: i64,
        d: i64,
    }
    let mut ans = 0;
    for i in 1..m+1 {
        for j in 1..d+1 {
            if j/10 ==0 || j/10 ==1 || j%10 ==0 || j%10==1 {
                continue;
            }
            if i==(j/10) * (j%10) {
                // println!("{}", i);
                ans+=1;
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			while(sc.hasNext()) {
				int m = sc.nextInt();
				int n = sc.nextInt();
				if(m + n == 0) break;
				
				boolean[] jud = new boolean[7500000];
				int pos = m;
				
				for(int i=0; i<n; i++) {
					while(jud[pos]) pos++;
					for(int j=pos; j<jud.length; j+=pos) jud[j] = true;
				}
				while(jud[pos]) pos++;
				
				System.out.println(pos);
			}
		}
	}
}



Measured memory_bytes: 148564
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fr first
#define se second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng (chrono::steady_clock::now().time_since_epoch().count() );
 
const int MOD = 1e9 + 7;
const ll INF = 1e18;
const int MX = 2e5 + 12; //check the limits, dummy

int main() {
 
    ios_base::sync_with_stdio (0);
    cin.tie (0);
 
    string hi = "hi";
    string s;
    cin >> s;
    int idx  = 0;
    for(auto c : s) {
        if(hi[idx] == c) {
            idx++;
            idx %= 2;
        } else {
            cout <<"No\n";
            return 0;
            
        }
    }
    cout << (idx == 0 ? "Yes" : "No");
    return  0;
}

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

int main(){
    int n;
    cin>>n;
    int ar[3]={0};
    for(int i=0; i<n; i++){
        int a;
        cin>>a;
        if(a%2!=0) ar[0]++;
        else if(a%4!=0) ar[1]++;
        else ar[2]++;
    }

    if(ar[0]<=ar[2] || (ar[0]-ar[2]==1 && ar[1]==0)){
        cout<<"Yes"<<endl;
    }
    else {
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#include<vector>
#include<cmath>
#define maxn 5007 
#define ll long long  
using namespace std;
const double eps = 1e-17;
long double a,b,c;
long double a1,b1,c1;
inline int read()
{
	int x = 0;
	int flag = 1;
	char ch;
	ch = getchar();
	while(!isdigit(ch)) 
	{
		if(ch == '-') flag = -1;
	ch = getchar();
	} 
	while(isdigit(ch))
	{
		x = (x<<1) + (x<<3) + ch - 48;
		ch = getchar();
	}
	return x * flag;
}


int main()
{
	cin>>a>>b>>c;
	a1 = sqrt(a);
	b1 = sqrt(b);
	c1 = sqrt(c);
	if(a + b + 2.0 * a1 * b1 - c < 0) 
	{
		printf("Yes\n");
	}
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long res = 0, b = 0;
		for (char c : sc.next().toCharArray()) {
			if (c == 'B') b++;
			else res += b;
		}
		System.out.println(res);
	}
}

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

using namespace std;

#define ll long long




void solve() {

	int n, x, t;
	cin >> n >> x >> t;
	cout << fixed;
	cout << (int)ceil(n / double(x)) * t;

	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	int t = 1;
	// cin >> t;
	while(t--)
		solve();

	return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
int main(){
  int x,y;
  while(1){
    scanf("%d%d",&x,&y);
    if(x == 0 && y == 0)break;
    else if(x > y)printf("%d %d\n",y,x);
    else if(x < y)printf("%d %d\n",x,y);
    else if(x == y)printf("%d %d\n",x,y);
  }
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main ()
{
	int i,n,c=0;
	string s;
	cin>>n;
	cin>>s;
	int k=n/2;
	if(n%2==1)
	{
		cout<<"No";
	}
	if(n%2==0)
	{
		for(i=0;i<k;i++)
		{
			if(s[i]==s[k+i])
			{
				c++;
			}
		}
	
	c==k ? cout<<"Yes" : cout<<"No" ;}
	return 0;
 } 

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

using namespace std;
typedef long long ll;
const int maxn = 1e6 + 5;

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


Measured memory_bytes: 256