akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := NewScanner()

	s := sc.NextLine()
	if string(s[0]) != "A" {
		fmt.Printf("%+v\n", "WA") // output for debug
		return
	}
	s = strings.TrimLeft(s, "A")

	cnt := 0
	for i := 1; i < len(s)-1; i++ {
		if string(s[i]) == "C" {
			cnt++
		}
	}
	if cnt != 1 {
		fmt.Printf("%+v\n", "WA") // output for debug
		return
	}
	s = strings.Replace(s, "C", "c", -1)

	if strings.ToLower(s) == s {
		fmt.Printf("%+v\n", "AC") // output for debug
		return
	}
	fmt.Printf("%+v\n", "WA") // output for debug

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define llp 1000000007
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }   
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;

bool year(int a, int b){
    if(b>=1 && b<=12){
        return true;
    }
    return false;
}
bool month(int a, int b){
    if(a>=1 && a<=12){
        return true;
    }
    return false;
}
int32_t main(){
	ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int A, B;
    for(int i=0;i<4;i++){
        if((s[i]-'0')>9 || (s[i]-'0')<0){
            cout<<"NA\n";
            return 0;
        }
    }
    A=(s[0]-'0')*10+(s[1]-'0');
    B=(s[2]-'0')*10+(s[3]-'0');
    if(month(A,B) && !year(A,B)){
        cout<<"MMYY\n";
    }
    else if(!month(A,B) && year(A,B)){
        cout<<"YYMM\n";
    }
    else if(month(A,B) && year(A,B)){
        cout<<"AMBIGUOUS\n";
    }
    else{
        cout<<"NA\n";
    }


	return 0;
}

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

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

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

struct abc{
    int id;
    int last = 0;
    int c;
    vi s;

public:
    abc(int n, int id){
        s = vi(n+1);
        this -> id = id;
    }
};

int e = 1;
double ep = 0.01;
int d = 365;

double score(abc p, int day){
    double ret = p.c * (day - p.last) + p.s[day];
    for(int i = 1;i <= e;i++){
        if (day + i > d) break;
        ret += ep * (p.c - p.s[day+i]);
    }

    return ret;
}

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

  cin >> d;
  vector<abc> abcs;
  rep(i,26) abcs.push_back(abc(d, i+1));

  rep(i,26){
      cin >> abcs[i].c;
  }

  rep(i,d){
      rep(j,26) cin >> abcs[j].s[i+1];
  }

  vi ret(d);

  for(int day = 1; day <= d; day++){
    sort(all(abcs),[=](auto const& lhs, auto const& rhs) {
        //return lhs.c * (day - lhs.last) + lhs.s[day] > rhs.c * (day - rhs.last) + rhs.s[day];
        return score(lhs, day) > score(rhs, day);
    });

    ret[day - 1] = abcs[0].id;
    abcs[0].last = day;
  }

  rep(i,d){
      cout << ret[i] << endl;
  }
}

Measured memory_bytes: 3696
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,m=mp()
tree=[[False]*(n+1) for i in range(n+1)]
for i in range(m):
    a,b=mp()
    tree[a][b]=True
    tree[b][a]=True
ans=0
for path in itertools.permutations(range(2,n+1), n-1):
    if tree[1][path[0]]:
        for i in range(n-1):
            if i==n-2:
                ans+=1
                break
            if not tree[path[i]][path[i+1]]:
                break

print(ans)

Measured memory_bytes: 66028
N = int(input())
T, A = [0]*N, [0]*N

for i in range(N):
    T[i], A[i] = map(int, input().split())
t = a = 1
for i in range(N):
    n = max(-(-t//T[i]), -(-a//A[i]))
    t = n*T[i]
    a = n*A[i]
print(t+a)


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

int main()
{
    double a, b, c, dif, d1, d2, d3, count=0;
    scanf("%lf%lf%lf%lf", &a, &b, &c, &dif);
    
    d1 = abs(a-c);
    d2 = abs(a-b);
    d3 = abs(b-c);
    
    if(d1<=dif)
        count=1;
    if(d2<=dif && d3<=dif)
        count=1;
    
    if(count==0)
        printf("No\n");
    else
        printf("Yes\n");
    
    return 0;
}

Measured memory_bytes: 1688
#include<stdio.h>
int main(void)
{
	int x;
	char s[3];
	scanf("%s",&s);
	x=700;
	if(s[0]=='o') {
		x=x+100;
	}
	if(s[1]=='o') {
		x=x+100;
	}
	if(s[2]=='o') {
		x=x+100;
	}
	printf("%d\n",x);
	return 0;
}
	

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

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  cout<<max({a+b,a-b,a*b})<<"\n";
  return 0;
}

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

int main(void)
{
  int ans=0;
  string S; cin>>S;
  for(int i=0;i<4;i++){
  	if(S[i]=='+')ans++;
    else ans--;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N, M;
  cin >> N >> M;
  vector<ll> A(N), B(N), C(N), D(M), E(M), F(M);
  map<ll, ll> mpX, mpY; // 座標圧縮のための座標
  mpX[0] = 0;
  mpY[0] = 0;
  rep(i, N) {
    cin >> A[i] >> B[i] >> C[i];
    mpX[A[i]] = 0;
    mpX[B[i]] = 0;
    mpY[C[i]] = 0;
  }
  rep(i, M) {
    cin >> D[i] >> E[i] >> F[i];
    mpX[D[i]] = 0;
    mpY[E[i]] = 0;
    mpY[F[i]] = 0;
  }
  /* 座標圧縮 mpX[] */
  vector<ll> xs, ys;
  for(auto& p: mpX) {
    p.second = xs.size();
    xs.push_back(p.first);
  }
  for(auto& p: mpY) {
    p.second = ys.size();
    ys.push_back(p.first);
  }
  int H = xs.size()*2;
  int W = ys.size()*2;
  vector<vector<ll>> dis(H, vector<ll>(W));
  rep(i, N) {
    ll a = mpX[A[i]]*2;
    ll b = mpX[B[i]]*2;
    ll c = mpY[C[i]]*2;
    for(ll x=a; x<=b; x++) dis[x][c] = -1;
  }
  rep(i, M) {
    ll d = mpX[D[i]]*2;
    ll e = mpY[E[i]]*2;
    ll f = mpY[F[i]]*2;
    for(ll y=e; y<=f; y++) dis[d][y] = -1;
  }
  int dx[] = {0, -1, 0, 1};
  int dy[] = {-1, 0, 1, 0};
  queue<pair<ll, ll>> Q;
  ll sx = mpX[0]*2;
  ll sy = mpY[0]*2;
  Q.emplace(sx, sy);
  while(!Q.empty()) {
    auto p = Q.front();
    Q.pop();
    if(dis[p.first][p.second] != 0) continue;
    dis[p.first][p.second] = 1;
    rep(k, 4) {
      ll nx = p.first  + dx[k];
      ll ny = p.second + dy[k];
      if(nx < 0 || nx >= H) continue;
      if(ny < 0 || ny >= W) continue;
      Q.emplace(nx, ny);
    }
  }

  ll ans = 0;
  rep(x, H) rep(y, W) {
    if(dis[x][y] != 1) continue;
    if(x == 0 || x == H-1 || y == 0 || y == W-1) {
      cout << "INF" << endl;
      return 0;
    }
    if(x%2==0 || y%2==0) continue;
    ans += (xs[x/2+1]-xs[x/2]) * (ys[y/2+1]-ys[y/2]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 285384
//2020年3月21日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include <cstdio>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

namespace {
    // printElems(&a[0], &a[n]);　みたいな感じで使う。
    void printElems(const int* begin, const int* end)
    {
        for (const int* p = begin; p != end; ++p) {
            std::cout << *p << ' ';
        }
        std::cout << std::endl;
    }
}

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define FOR(i,j,n) for(int i=j; i < n; i++)
#define souatari rep1(i,n-1)rep(j,i)
#define souatari1 for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
const ll BIG = 10000000000000000;


ll gcd(ll a,ll b){
	ll r = a%b;
	while (r != 0) {
		a = b;
		b = r;
		r = a%b;
	}
	return b;
}


int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	ll cnt = 0;
	ll rgbcnt[3] = {0,0,0};
	rep(i,n){
		if(s[i] == 'R')rgbcnt[0]++;
		if(s[i] == 'G')rgbcnt[1]++;
		if(s[i] == 'B')rgbcnt[2]++;
	}
	ll ans = rgbcnt[0]*rgbcnt[1]*rgbcnt[2];

	rep(haba,n){
		rep(i,n){
			if(i+haba+haba>=n) break;

			bool tmp[3] = {false,false,false};
			if(s[i] == 'R')tmp[0] = true;
			if(s[i] == 'G')tmp[1] = true;
			if(s[i] == 'B')tmp[2] = true;

			if(s[i+haba] == 'R')tmp[0] = true;
			if(s[i+haba] == 'G')tmp[1] = true;
			if(s[i+haba] == 'B')tmp[2] = true;

			if(s[i+haba+haba] == 'R')tmp[0] = true;
			if(s[i+haba+haba] == 'G')tmp[1] = true;
			if(s[i+haba+haba] == 'B')tmp[2] = true;

			if(tmp[0] && tmp[1] && tmp[2]) ans--;
		}
	}

	prints(ans);


	return 0;
}



Measured memory_bytes: 3640
n = int(input())
d = {}
summ = 0

for i in range(n):
    s = ''.join(sorted(input()))
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1

for k, v in d.items():
    summ += v*(v-1)/2

print(int(summ))


Measured memory_bytes: 17852
//#define LOCAL

/*
??????URL???https://pekempey.github.io/lazy_propagation_segment_tree/lazy_propagation_segment_tree.html
*/

#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
#include <climits>
#include <set>

//#define int long long
typedef long long ll;
//using ll = long long;
//using R = double;

//#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

#define MOD 1000000007

const int INF = int(1e9);

using namespace std;

typedef vector<int> V;
typedef vector<V> VV;

int N, Q;
int a[100010];
ll wa[100010];
ll x;

signed main()
{
    cin >> N >> Q;
    ll sum = 0;
    REP(i,N) {
        cin >> a[i];
        sum += a[i];
        wa[i] = sum;
    }

    REP(i,Q) {
        cin >> x;
        ll ans = 0;
        REP(j,N) {
            ll cnt = int(upper_bound(wa, wa + N, wa[j-1] + x) - (wa + j));
            //printf("cnt = %d\n", cnt);
            //printf("upper_bound = %d, minus = %d\n", upper_bound(wa, wa + N, wa[j] + x) - wa, j);
            if (cnt > 0) ans += cnt;
        }
        cout << ans << endl;
    }



    return 0;
}

Measured memory_bytes: 4264
#include <bits/stdc++.h>
#define fore(x,a,b) for(int x=a, qwerty=b; x<qwerty; x++)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define pb push_back
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fst first
#define snd second
#define mset(a,v) memset((a),(v),sizeof(a))
using namespace std;
typedef long long ll;
const int N=200500;

ll n,c;
ll dp[N],a[N];
typedef ll tc;
struct Line{tc m,h;};
struct CHT { // for minimum (for maximum just change the sign of lines)
	vector<Line> c;
	int pos=0;
	tc in(Line a, Line b){
		tc x=b.h-a.h,y=a.m-b.m;
		return x/y+(x%y?!((x>0)^(y>0)):0); // ==ceil(x/y)
	}
	void add(tc m, tc h){ // m's should be non increasing
		Line l=(Line){m,h};
		if(c.size()&&m==c.back().m){
			l.h=min(h,c.back().h);c.pop_back();if(pos)pos--;
		}
		while(c.size()>1&&in(c.back(),l)<=in(c[c.size()-2],c.back())){
			c.pop_back();if(pos)pos--;
		}
		c.pb(l);
	}
	inline bool fbin(tc x, int m){return in(c[m],c[m+1])>x;}
	tc eval(tc x){
		// O(log n) query:
		int s=0,e=c.size();
		while(e-s>1){int m=(s+e)/2;
			if(fbin(x,m-1))e=m;
			else s=m;
		}
		return c[s].m*x+c[s].h;
		// O(1) query (for ordered x's):
		while(pos>0&&fbin(x,pos-1))pos--;
		while(pos<SZ(c)-1&&!fbin(x,pos))pos++;
		return c[pos].m*x+c[pos].h;
	}
};

int main(){FIN;
	CHT ch;
	cin>>n>>c;
	fore(i,0,n)cin>>a[i];
	ll h=a[0],f;
	ch.add(-2*h,h*h);
	//for(int i=n-2;i>=0;i--){
	fore(i,1,n){
		h=a[i];
		f=ch.eval(h)+c+h*h;
		ch.add(-2*h,f+h*h);
	}
	cout<<f<<"\n";
}

Measured memory_bytes: 8048
length = int(input())
targ = [int(n) for n in input().split(' ')]
for l in range(length):
    insert = 0
    for m in range(l):
        if targ[l] >= targ[l - m - 1]:
            insert = l - m
            break
    aftdisp = targ[l]
    for i in range(0,l - insert):
        disp = targ[l - i]
        targ[l - i] = targ[l - i - 1]
        targ[l - i - 1] = disp
    print(" ".join([str(n) for n in targ]))

Measured memory_bytes: 7740
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <map>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#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()

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  string S;
  cin >> S;
  int AB = A + B;
  int num_AB = 0;
  int num_B = 0;
  rep(i, N){
    if (S[i] == 'a'){
      num_AB++;
      if (num_AB <= AB){
        cout << "Yes" << endl;
      }else{cout << "No" << endl;}
    }
    else if (S[i] == 'b'){
      num_B++;
      if (num_AB <= AB-1 && num_B <= B){
        num_AB++;
        cout << "Yes" << endl;
      }else{cout << "No" << endl;}
    }
    else{cout << "No" << endl;}
  }
}  

Measured memory_bytes: 896
#include<bits/stdc++.h> 
using namespace std;
int main()
{
  	string c;
    cin>>c;
    if (c[0]=='9'||c[1]=='9')
        cout << "Yes"<<endl;
    else
    {
    	cout << "No"<<endl;
	} 
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int x[5];
  int i;
  for(i=0;i<5;i++){
  scanf("%d",&x[i]);
  }
  for(i=0;i<5;i++){
    if(x[i]==0){
      printf("%d\n",i+1);
    }
  }
  
  return 0;
}

Measured memory_bytes: 1720
#include <stdio.h>

int main(){
	
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a>=b&&b>=c)printf("%d\n",a*10+b+c);
	else if(a>=c&&c>=b)printf("%d\n",a*10+b+c);
	else if(b>=c&&c>=a)printf("%d\n",b*10+c+a);
	else if(b>=a&&a>=c)printf("%d\n",b*10+a+c);
	else if(c>=a&&a>=b)printf("%d\n",c*10+a+b);
	else if(c>=b&&b>=a)printf("%d\n",c*10+b+a);
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

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

typedef long long ll;

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

int main() {
	/*int n;
	cin >> n;
	double ans = (n+1) / 2;
	ans /= (double)n;
	cout << setprecision(7) << ans;*/


	/*int n, k;
	cin >> n >> k;
	int h;
	int ans = 0;
	rep(i, n) {
		cin >> h;
		if (h >= k)ans++;
	}
	cout << ans;*/


	/*int n;
	cin >> n;
	int a;
	vector<int>ans(n);
	rep(i, n) {
		cin >> a;
		a--;
		ans[a] = i + 1;
	}
	rep(i, n)cout << ans[i] << " ";*/


	ll a, b;
	cin >> a >> b;
	ll g = gcd(a, b);
	set<int>s;
	s.insert(1);
	ll c = 2;
	while (g >= c * c) {
		if (g % c == 0) {
			g /= c;
			s.insert(c);
		}
		else {
			c++;
		}
	}
	s.insert(g);
	ll ss = s.size();
	cout << ss;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
#include<climits>
#include<iomanip>
using namespace std;
#define MOD 1000000007
#define ll long long
const long long INF = 1LL << 60;

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

class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;

	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}


}

//約数求める //約数
void divisor(ll n,vector<ll> &ret) {
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(ret.begin(), ret.end());
	
}
//階乗
long long factorial(long long n, long long mod) {
	long long ret = 1;
	for (long long i = 1; i <= n; i++) {
		ret = (ret * i) % mod;
	}
	return ret;
}
//モジュラ逆数
long long inv_mod(long long n, long long mod) {
	long long a = n % mod, b = mod - 2, ret = 1;
	while (b > 0) {
		if (b & 1) ret = (ret * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return ret;
}

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

long long nCr(long long n, long long r, long long mod) {
	return nPr(n, r, mod) * inv_mod(factorial(r, mod), mod) % mod;
}

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



int main() {
	ll H, W;
	cin >> H >> W;
	vector<vector<int>> a;
	a.resize(H);
	for (int i = 0; i < H; i++)a[i].resize(W);
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> a[i][j];

		}
	}
	vector < pair<pair<int, int>, pair<int, int>>> ans;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (a[i][j] % 2 == 1) {
				if (j != W - 1) {
					ans.push_back(make_pair(make_pair(i+1, j+1), make_pair(i+1, j + 2)));
					a[i][j + 1]++;
				}
				else if (i != H - 1) {
					ans.push_back(make_pair(make_pair(i+1, j+1), make_pair(i+2, j+1)));
					a[i + 1][j]++;
				}
			}

		}
	}
	cout << ans.size() << endl;
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i].first.first << ' ' << ans[i].first.second << ' ' << ans[i].second.first << ' ' << ans[i].second.second << endl;
	}
	return 0;
}


Measured memory_bytes: 5232
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MAX=1000000007;
vector< int > divisor(int n) {
  vector< int > ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
  
signed main() {
    int n,k;
    cin>>n>>k;
    int a[n],ala=0;
    for(int i=0;i<n;i++){
      cin>>a[i];
      ala+=a[i];
    }
    int ama[n],q=0,p,ans=MAX;
    vector<int> da=divisor(ala);
    for(int i0=da.size()-1;i0>=0;i0--){
      int i=da[i0];
        p=0;q=0;
        for(int j=0;j<n;j++){
          ama[j]=a[j]%i;
          q+=i-ama[j];
        }
        sort(ama,ama+n);
     
        for(int j=0;(j<(q/i))&&(j<n);j++)p+=ama[j];
        if(p<=k){
         
          cout<<i;
          break;
        }

        
      

    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100005;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int d;
    cin>>d;
    int c[26];
    for(int i=0;i<26;i++)cin>>c[i];
    int s[d][26];
    for(int i=0;i<d;i++){
        for(int j=0;j<26;j++)cin>>s[i][j];
    }
    vector<int> t(d);
    for(int i=0;i<d;i++)cin>>t[i];
    for(int i=0;i<d;i++)t[i]--;
    vector<int> last(26,0);
    int res=0;
    for(int i=0;i<d;i++){
        res+=s[i][t[i]];
        last[t[i]]=i+1;
        for(int j=0;j<26;j++){
            res-=c[j]*(i+1-last[j]);
        }
        cout<<res<<endl;
    }
}

Measured memory_bytes: 3736
x=int(input())

x_ni=x%100

if x<100:
    print(0)
else:
    x_go=x_ni//5
    if x_ni%5==0:
        hituyou=x_go
    else:
        hituyou=x_go+1
    if x//100>=hituyou:
        print(1)
    else:
        print(0)



Measured memory_bytes: 2940
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	int MOD = 1000000007;

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int a[] = new int[n+1];
		int ind[] = new int[n+1];
		int l=-1;
		int r=-1;
		Arrays.fill(ind, -1);
		for(int i=0; i<n+1; i++) {
			a[i]=sc.nextInt();
			if(ind[a[i]]>=0) {
				l=ind[a[i]];
				r=i;
			}
			ind[a[i]]=i;
		}

		init(n+1);

		for(int k=1; k<=n+1; k++) {
			long ans = ((combi(n+1, k) + MOD) - combi(l + n-r, k-1)) % MOD;
			System.out.println(ans);
		}

		sc.close();
	}

	long fact[];
	long ifact[];
	private long combi(int n, int k) {
		if(k<0 || k>n) return 0;
		return (((fact[n] * ifact[k]) % MOD) * ifact[n-k]) % MOD;
	}

	private void init(int n) {
		fact = new long[n+1];
		ifact = new long[n+1];

		fact[0]=1;
		for(int i=1; i<=n; i++) {
			fact[i] = (fact[i-1] * i) % MOD;
		}
		ifact[n] = pow(fact[n], MOD-2);
		for(int i=n; i>=1; i--) {
			ifact[i-1] = (ifact[i] * i) % MOD;
		}
	}

	private long pow(long x, int n) {
		if(n==0) return 1;
		long ret = pow(x, n/2);
		if(n%2==0) {
			ret = (ret * ret) % MOD;
		}else {
			ret = (((ret * ret) % MOD) * x) % MOD;
		}
		return ret;
	}

}


Measured memory_bytes: 59972
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n;
    long long a;
    vector<long long> A;

    cin >> n;

    long long y = 0;
    for (int i=0; i<n; i++) {
        cin >> a;
        A.push_back(a);
        y += a;
    }

    long long x = 0, ans = 9223372036854775807;
    for (int i=0; i<n-1; i++) {
        x += A[i];
        y -= A[i];
        
        ans = min(abs(x-y), ans);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3444
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String s = br.readLine();
		String t = br.readLine();
		
		int count = 0;
		
		for(int i = 0; i < s.length(); i++){
			if(s.charAt(i) == t.charAt(i)){
				count++;
			}
		}


		System.out.println(count);
	}

}


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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;

int n;
LL l, r;

int main()
{
	cin >> n;
	l = r = 1;
	
	while (n -- )
	{
		LL a, b;
		cin >> a >> b;
		
		LL t1 = (l + a - 1LL) / a;
		LL t2 = (r + b - 1LL) / b;
		LL t = max(t1, t2);
		
		l = t * a;
		r = t * b;
	}

	cout << l + r << endl;
	return 0;
}

Measured memory_bytes: 256
#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 all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;
ll const MOD = 1000000007;


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

int N = 3;
vi A(N);
map<int,int> cnt;
rep(i,N) {
    cin >> A[i];
    cnt[A[i]]++;
}
for(auto x:cnt) {
    if(x.second == 1) cout << x.first << endl;
}

return 0;
}

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

int main()
{
    int x = 0;
    int ans = 0;
    int n;
    string s;
    cin >> n >> s;
    for(auto a: s) {
        if(a == 'I') {
            ++x;
        }else {
            --x;
        }
        ans = max(ans, x);
    }
    cout << ans << endl;
}

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

const int maxN = 100005;
const int MOD = 10000;

char a[maxN];
char b[maxN];
int dp[maxN];
int main()
{
	scanf("%s",a+1);
	int n = strlen(a+1);
	int cnt1 = 0;
	for(int i=1;i<=n;i++)
	{
		if(i%2 == 1 && a[i]!='0')
		{
			cnt1++;
		}
		if(i%2 == 0 && a[i]!='1')
		{
			cnt1++;
		}
	}
	int cnt2 = 0;
	for(int i=1;i<=n;i++)
	{
		if(i%2 == 1 && a[i]!='1')
		{
			cnt2++;
		}
		if(i%2 == 0 && a[i]!='0')
		{
			cnt2++;
		}
	}
	int ans = min(cnt1,cnt2);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
from sys import exit, stderr, stdin, setrecursionlimit
input = stdin.readline
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    N, Q = list(map(int,input().split()))
    adjl = [[] for _ in range(N+1)]
    for _ in  range(N-1):
        a, b = list(map(lambda x: int(x),input().split()))
        adjl[a].append(b)
        adjl[b].append(a)
    res = [0]*(N+1)
    # print(adjl)
    for _ in  range(Q):
        p, x = list(map(lambda x: int(x),input().split()))
        res[p] += x
    # def dfs(n, parent = None):
    #     if parent != None:
    #         res[n] += res[parent]
    #     for neigh in adjl[n]:
    #         if neigh == parent:
    #             continue
    #         else:
    #             dfs(neigh,n)
    # dfs(0)
    q = [(1,0)]
    while q:
        x, parent = q.pop()
        res[x] += res[parent]
        for neigh in adjl[x]:
            if neigh != parent:
                q.append((neigh,x))

    print(' '.join(map(str,res[1:])))





if __name__ == "__main__":
    main()


Measured memory_bytes: 73444
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define ss second
#define MOD 998244353LL
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl

#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<int,int> &a,
             const pair<int,int> &b)
{
    if(a.ff == b.ff) {
        return (b.ss < a.ss);
    }
    return (a.ff<b.ff);
}
int findlcm(int arr[], int n) 
{ 
    // Initialize result 
    int ans = arr[0]; 
  
    // ans contains LCM of arr[0], ..arr[i] 
    // after i'th iteration, 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (__gcd(arr[i], ans))); 
  
    return ans; 
}
bool prime[1000001];
void SieveOfEratosthenes(int n) 
{
    // Create a boolean array "prime[0..n]" and initialize
    // aint entries it as true. A value in prime[i] wiint
    // finainty be false if i is Not a prime, else true.

    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
  }
}
int32_t main()
{
    IOS;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    /********************* From here ***********************/
    double n,k;
    cin >> n >> k;
    double ans = 0;
    // if(n > k){
    // 	ans = n-k +1;
    // }
    if(n >= k){
	    for(int i =1;i<k;i++){
	    	double t = i;
	    	double prob = 0;
	    	while(t<k){
	    		t = t*2;
	    		prob++;
	    	}
	    	ans += pow(0.5, prob);
	    	
	    }
	    cout <<setprecision(16) << (ans+n-k+1)/n << endl;
	}
    else{
    	for(int i =1;i<=n;i++){
	    	double t = i;
	    	double prob = 0;
	    	while(t<k){
	    		t = t*2;
	    		prob++;
	    	}
	    	ans += pow(0.5, prob);
	    	
	    }

	    cout << setprecision(16) << (ans)/n   <<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
typedef long long ll;
const int N=4010;
ll ans1=0,ans2=0;
char str[N];
int c[N][N];
int g[N][3];
int main()
{
    int n;
    cin>>n;
    cin>>str+1;
    for(int i=n;i>=1;i--)
    {
        for(int j=0;j<3;j++)
        {
            g[i][j]=g[i+1][j];
        }
        if(str[i]=='R')g[i][0]++;
        else if(str[i]=='G')g[i][1]++;
        else g[i][2]++;
    }
    for(int i=1;i<=n;i++)
    {
        if(str[i]=='R'){
            ans1+=(g[i+1][1]*(g[i+1][2]));
        }else if(str[i]=='G'){
            ans1+=(g[i+1][0]*(g[i+1][2]));
        }else{
            ans1+=(g[i+1][0]*(g[i+1][1]));
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            if(2*j-i<=n&&str[i]!=str[j]&&str[i]!=str[j+j-i]&&str[j]!=str[j+j-i])ans2++;
        }
    }
    cout<<(ans1-ans2)<<endl;
}

Measured memory_bytes: 3652
#include<algorithm>
#include<iostream>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;

int main(){
	ll n;
	cin >> n;
	vector<pair<ll, ll>>p(n);
	for (ll i = 0; i < n; i++){
		ll a, b;
		cin >> a >> b;
		p[i] = make_pair(b, a);
	}
	
	sort(p.begin(),p.end());

	ll sum = 0;
	for (ll i = 0; i < n; i++){
		sum += p[i].second;
		if (sum <= p[i].first){
			continue;
		}
		else{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3328
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    swap(A, B);
    if (A == 1 && B == 1){
        cout << "1 2" << endl;
        cout << "#." << endl;
        return 0;
    }
    int tmp = 5;
    if (A == 1) tmp -= 2;
    cout << (((B-2) / 50)*2 + ((A-2) / 50)*2) + tmp << " 100" << endl;
    char a = '.';
    char b = '#';
    // A > B とする (ex, A == 300, B == 10) 
    bool flag = true;
    if (A == 1) flag = false;
    if (flag) {
        while(true){
            int i = 50;
            rep(i, 100) cout << a;
            cout << endl;
            while(i > 0 && A-1 > 0) {
                cout << a << b;
                A--; i--;
            }
            if (A-1 > 0) cout << endl;
            if (A-1 == 0) {
                i *= 2;
                while(i > 0) {
                    cout << b;
                    i--;
                }
                break;
            }
        }
    }
    if (flag) cout << endl;
    rep(i, 100) cout << a;
    cout << endl;
    while(true){
        int i = 50;
        rep(i, 100) cout << b;
        cout << endl;
        while(i > 0 && B-1 > 0) {
            cout << b << a;
            B--; i--;
        }
        if (B-1 > 0) cout << endl;
        if (B-1 == 0) {
            i *= 2;
            while(i > 0) {
                cout << b;
                i--;
            }
            break;
        }
    }
    cout << endl;



    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	int cur = 0;
	while(cur < n) cur += 1000;
	cout << cur - n << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 3652
#include<stdio.h>

int main(){
        int d[50];
        int a[50],b[50];
        int i,j,k,l,m,o,q;
        int n,r,p,c;
        int A;

        for(i=0; ;i++){
                scanf("%d",&n);
                scanf("%d",&r);
                if(n == 0 && r == 0)
                        break;


                A = n;

                for(m=0; m<n; m++){
                        d[m] = A;
                        A--;
                }
                for(j=0; j<r; j++){
                        scanf("%d",&p);
                        scanf("%d",&c);



                        for(k=0; k<p-1; k++){
                                a[k] = d[k];
                        }
                        for(l=0; l<c; l++){
                                b[l] = d[p-1+l];
                        }
                        for(o=0; o<p-1; o++){
                                d[o+c] = a[o];
                        }
                        for(q=0; q<c; q++){
                                d[q] = b[q];
                        }

                }

        printf("%d\n",d[0]);

        }

        return 0;
}

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

int main(){
    double x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    double X = pow (x2 - x1,2);
    double Y = pow (y2 - y1,2);
    double ans =sqrt (X + Y);
    cout << fixed << setprecision(15) << ans << endl;
    return 0;
}


Measured memory_bytes: 3280
/*
power code taken from geeks for geeks
*/

#include <bits/stdc++.h>
#define MODD 1000000007LL
#define MAX 1000000000LL
#define MAX_N 200001
using namespace std;
typedef long long ll;
typedef long double ld;
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
double modd(double a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return a % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;
 
    ll P = power(k, p/2LL);
    P = (P * P) % MODD;
 
    if (p % 2 == 1)
        P = (P * k) % MODD;
 
    return P;
}

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


void solve(){
    ll x,y,z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y;
}
int main(){


    // #ifndef ONLINE_JUDGE 

    // // For getting input from input.txt file 
    // freopen("input.txt", "r", stdin); 

    // // Printing the Output to output.txt file 
    // freopen("output.txt", "w", stdout); 
    // #endif 



    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;


void solve(){
    int k;
    cin>>k;
    queue<int> q;
    for(int i = 1; i <= 9; i++)q.push(i);
    while(!q.empty()){
        int n = q.front();
        q.pop();
        if(!(--k)){cout<<n;return ;}
        int p = (n%10);
        if(p > 0)q.push((10*n) + p - 1);
        q.push((10*n) + p);
        if(p < 9)q.push((10*n) + p + 1);
    }
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}

Measured memory_bytes: 4780
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

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

int main() {
    int h, w; cin >> h >> w;
    vector<vector<int>> dist(h, vector<int>(w, -1));
    queue<pair<int, int>> q;
    for (int i = 0; i < h; i++) {
        string s; cin >> s;
        for (int j = 0; j < w; j++) {
            if (s[j] == '#') {
                dist[i][j] = 0;
                q.emplace(i, j);
            }
        }
    }
    int cnt = 0;
    while (!q.empty()) {
        auto p = q.front(); q.pop();
        for (int k = 0; k < 4; k++) {
            int ni = p.first + dx[k], nj = p.second + dy[k];
            if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
            if (dist[ni][nj] == -1) {
                dist[ni][nj] = dist[p.first][p.second] + 1;
                cnt = max(cnt, dist[ni][nj]);
                q.emplace(ni, nj);
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 12432
# ABC125 D - Flipping Signs
N = int(input())
A = list(map(int,input().split()))

cnt = 0
is_zero = False
for i in range(N):
    if A[i] < 0:
        cnt += 1
    if A[i] == 0:
        is_zero = True

A = [abs(a) for a in A]

if cnt%2 == 0 or is_zero == True:
    print(sum(A))
else:
    print(sum(A)-2*min(A))
    


Measured memory_bytes: 15020
#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b){
    long long r = a % b;
    while(a % b != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}
int main(void){
    long long N,X;
    cin >> N >> X;
    vector<long long> x(N);
    for(int i = 0; i < N; i++) cin >> x[i];
    if(N == 1) cout << abs(X - x[0]) << endl;
    else{
        long long D = GCD(abs(x[0] - X), abs(x[1] - X));
        for(int i = 0; i < N; i++){
            D = GCD(D,abs(x[i] - X));
        }
        cout << D << endl;
    }
}


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

int main( void ) {
    ios::sync_with_stdio( false );
    string s;
    cin >> s;
    int a = (s[0] - '0') * 10 + s[1] - '0';
    int b = (s[2] - '0') * 10 + s[3] - '0';
    int c, d;
    if( a >= 1 && a <= 12 ) c = 1;
    else c = 0;
    if( b >= 1 && b <= 12 ) d = 1;
    else d = 0;
    if( c + d == 2 ) cout << "AMBIGUOUS" << '\n';
    else if( c == 1 ) cout << "MMYY" << '\n';
    else if( d == 1 ) cout << "YYMM" << '\n';
    else cout << "NA" << '\n';
    return 0;
}


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


 const int MAX = 1001;
const int MOD = 1000000007;


signed main(){
    string s,t;
    cin>>s>>t;
    int d[t.size()+1];
    d[0]=-1;
    int p=-1;
    for(int i=0;i<t.size();i++){
        while(p>=0 && t[i]!=t[p])p=d[p];
        p++;
        if(t[i+1]==t[p])d[i+1]=d[p];
        else d[i+1]=p;
    }
    //for(int i=0;i<=t.size();i++)cerr<<d[i]<<' ';
    p=0;int ans[s.size()];
    for(int i=0;i<s.size()+t.size();i++){
        while(p>=0 && (s[i%s.size()]!=t[p]||p>t.size()))p=d[p];
        ans[i%s.size()]=p;
        p++;
    }
    int a=s.size(),b=t.size();
    while(a!=0){
        b=b%a;
        swap(a,b);
    }
    int maxa=0;
    for(int i=0;i<b;i++){
        a=0;
        for(int j=0;j<(s.size()/b)*2;j++){
            if(ans[(i+j*t.size())%s.size()]==t.size()-1){
                a++;
                maxa=max(a,maxa);
            }else a=0;
        }
        if(a==(s.size()/b)*2){
            cout<<-1;
            return 0;
        }
    }
    cout<<maxa;
    

   return 0;
}

Measured memory_bytes: 5256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  string s;
  cin >> s;
  if (s[0] == s[1] or s[1] == s[2] or s[2] == s[3])  {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>
#include<time.h>

#define DIV 998244353
using namespace std;
using ll = long long;
using ldb = long double;
//f***************k
int main() {
	ll N, Q; cin >> N >> Q;
	vector<ll> tate(N + 1), yoko(N + 1);
	ll ans = (N - 2) * (N - 2);
	ll T = N - 3, Y = N - 3;
	for (int i = 0; i < Q; i++) {
		ll ty, x; cin >> ty >> x;
		x -= 2;
		if (ty == 1) {

			for (int j = x; j <= Y; j++) {
				tate[j] = T;
			}
			ans -= tate[x] + 1;
			//printf("tate[%lld]+1=%lld\n", x, tate[x] + 1);
			Y = min(Y, x - 1);
		}

		if (ty == 2) {
			for (int j = x; j <= T; j++) {
				yoko[j] = Y;
			}
			ans -= yoko[x] + 1;
			//printf("yoko[%lld]+1=%lld\n", x, yoko[x] + 1);
			T = min(T, x - 1);

		}
	}
	cout << ans << endl;
}

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


using namespace std;


int main()
{
    string s, t;

    cin >> s >> t;

        t.pop_back();
    if(s == t)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
        
    }
    

    return 0;
}

Measured memory_bytes: 3624