akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    if (s == "SAT") cout << 1;
    else if (s == "FRI") cout << 2;
    else if (s == "THU") cout << 3;
    else if (s == "WED") cout << 4;
    else if (s == "TUE") cout << 5;
    else if (s == "MON") cout << 6;
    else cout << 7;
    return 0;
}

Measured memory_bytes: 256
import math
A,B = (int(x) for x in input().split())
minA = math.ceil(A/0.08)
minB = math.ceil(B/0.1)
if minA > minB:
  if math.floor(minA*0.08) == A and math.floor(minA*0.1) == B:
    print(minA)
  else:
    print(-1)
else:
  if math.floor(minB*0.08) == A and math.floor(minB*0.1) == B:
    print(minB)
  else:
    print(-1)

Measured memory_bytes: 3060
A, B, H, M = gets.split.map(&:to_i)
t = H * 60 + M
t = t.to_f * 360 / (60 * 12)
m = M.to_f * 360 / 60
ax = A * Math.cos(t * Math::PI / 180)
ay = A * Math.sin(t * Math::PI / 180)
bx = B * Math.cos(m * Math::PI / 180)
by = B * Math.sin(m * Math::PI / 180)
warn "%f,%f" % [ax, ay]
warn "%f,%f" % [bx, by]
puts ((ax - bx) ** 2 + (ay - by) ** 2) ** 0.5


Measured memory_bytes: 14840
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};


int main(){
    ll fq=5000000000000000; //five quadrillion
    string S; cin >> S;
    ll K; cin >> K;
    ll ans=1;
    for(int i=0;i<K;i++){
        if(S[i]>='2'){
            ans = S[i]-'0';
            break;
        }
    }
    cout << ans << endl;
    return 0;
}
/*
5000000000000000
123456789012345678
*/

Measured memory_bytes: 256
import java.math.*;
import java.util.*;
import java.util.function.*;
 
public class Main {
  private static long path(int[][] edge, int parent_node, int src_node, int target_node) {
    int[] dist_edges = edge[src_node];
    for (int dist_node = 1; dist_node < dist_edges.length; dist_node++) {
      if (dist_node == parent_node || dist_node == src_node) continue;
      int edge_no = dist_edges[dist_node];
      if (edge_no == 0) continue;
      long path = dist_node == target_node
          ? 0 : path(edge, src_node, dist_node, target_node);
      if (path == -1L) continue;
      return  (1L << edge_no - 1) | path;
    }
    return -1L;
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N];
    int[] b = new int[N];
    for (int i = 1; i < N; i++) {
      a[i] = sc.nextInt();
      b[i] = sc.nextInt();
    }
    int M = sc.nextInt();
    int[] u = new int[M];
    int[] v = new int[M];
    for (int i = 0; i < M; i++) {
      u[i] = sc.nextInt();
      v[i] = sc.nextInt();
    }
    sc.close();

    int[][] edge = new int[N + 1][N + 1];
    for (int i = 1; i < N; i++) {
      edge[a[i]][b[i]] = i;
      edge[b[i]][a[i]] = i;
    }

    long[] path = new long[M];
    for (int i = 0; i < M; i++)
      path[i] = path(edge, 0, u[i], v[i]);

    long ans = 0;
    for (long i = (1L << M) - 1; 0 <= i; i--) {
      long p = 0;
      long m = i;
      for (int j = 0; m != 0 && j < M; j++) {
        if ((m & 1) == 1) p |= path[j];
        m >>>= 1;
      }
      long ng_case = 1L << (N - 1 - Long.bitCount(p));
      if ((Long.bitCount(i) & 1) == 1) {
        ans -= ng_case;
      } else {
        ans += ng_case;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define INF 1e9
#define forn(n) for(long long int i=0; i<n; ++i)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;

int arr[1005][1005];
int h,w,a,b;
string s2,s1="";


int main() {
	ios_base::sync_with_stdio(false);
	cin>>h>>w>>a>>b;
	int cont=0;
	for(int i=0;i<w;++i){
		if(cont<a){
			s1+="1";
			s2+="0";
			cont++;
		}
		else{
			s1+="0";
			s2+="1";
		}
	}
	s1+="\n";
	s2+="\n";
	cont=0;
	
	for(int i=0;i<h;++i){
		if(cont<b){
			cout<<s1;
			cont++;
		}
		else
			cout<<s2;
		
	}
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 1280
#pragma region Include
#include <bits/stdc++.h>
#pragma endregion

using namespace std;

#pragma region Macros
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define all(c) (c).begin(), (c).end()
#define newl "\n"
#define out(x) cout << (x) << newl
#define dump(x) \
  cout << "Line " << __LINE__ << " : " << #x << " = " << (x) << newl
template <class T>
using VV = vector<vector<T>>;
#define Uni(v) (v).erase(unique((v).begin(), (v).end()), (v).end());

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  os << "[";
  rep(i, vec.size()) os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  os << "]";
  return os;
}

template <typename T>
ostream& operator<<(ostream& os, vector<vector<T>>& mat) {
  os << "[";
  rep(i, mat.size()) os << mat[i] << (i + 1 == mat.size() ? "" : ",\n ");
  os << "]";
  return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x;
  return is;
}

template <typename V, typename H>
void resize(vector<V>& vec, const H head) {
  vec.resize(head);
}

template <typename V, typename H, typename... T>
void resize(vector<V>& vec, const H& head, const T... tail) {
  vec.resize(head);
  for (auto& v : vec) resize(v, tail...);
}
constexpr double EPS = 1e-10;
const int INF = 0x3f3f3f3f;

string tostring(int i, int digit) {
  auto cur = cout.flags();
  stringstream ss;
  ss << setw(digit) << setfill('0') << i;
  string ret = ss.str();
  cout.flags(cur);
  return ret;
}

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

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

#pragma endregion

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A,B,C,K;
  cin>>A>>B>>C>>K;
  if(A>=K){
    out(K);
  }else{
    if(A+B>=K){
      out(A);
    }else{
      out(A-(K-A-B));
    }
  }
  return 0;
}

Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define repf(i, x, n) for (int i = (int)(x); i < (int)(n); i++)
#define repfr(i, x, n) for (int i = (int)(x)-1; i >= (int)(n); i--)
template <class T> bool chmax(T& a, const T& b) {
	if (a < b) {
		a = b;
		return 1;
	}
	return 0;
}
template <class T> bool chmin(T& a, const T& b) {
	if (b < a) {
		a = b;
		return 1;
	}
	return 0;
}
template <class T> inline void in(T& a) { cin >> a; }
template <class T, class U> inline void in(T& a, U& b) { cin >> a >> b; }
template <class T, class U, class V> inline void in(T& a, U& b, V& c) {
	cin >> a >> b >> c;
}
template <class T> inline void out(T a) { std::cout << a << endl; }
template <class T, class U> inline void out(T a, U b) {
	cout << a << ' ' << b << endl;
}
template <class T, class U, class V> inline void out(T a, U b, V c) {
	cout << a << ' ' << b << ' ' << c << endl;
}
#define inf 1e9
using ll = int64_t;
#define waru 1000000007

void Main() {
	int r, g;
	in(r, g);
	out(g + (g - r));

	return; 
}

int main() {
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define read(a) scanf("%d", &a)
#define readl(a) scanf("%lld", &a)
#define reads(a) scanf("%s", a)
#define readf(a) scanf("%lf", &a)
#define readc(a) scanf("%c", &a)
#define debug(a, b) printf("%s = %d\n", a, b)
#define debug1(a, i, b) printf("%s[%d] = %d", a, i, b)
#define show(a) putchar(a)
#define pb emplace_back
#define mk make_pair
#define _rand mt19937 RAND(time(0))
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define mem(a) memset(a, 0, sizeof(a))
#define Buff ios::sync_with_stdio(false)
typedef long long ll;
typedef long long LL;
typedef int Int;
typedef double db;
using namespace std;
const int INF = 1e9 + 7;
const int N = 2e5 + 7;
const int M = 5e6 + 7;
signed main()
{
    Buff;
    int A, B, x = -1;
    cin >> A >> B;

    for(int i = 1; i < 1010; i++)
    {
        if(i*2/25 == A && i/10 == B)
        {
            x = i;
            break;
        }
    }
    cout << x << "\n";
    return 0;
}
/**

**/



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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);


int main(void)
{
    ll n; cin>>n;
    ll ans=1;
  bool ng = false;
    rep(i,n){
        ll a; cin>>a;
        if(a==0){
            cout << 0 << endl;
          return 0;
        }
        if(ans>(ll)1e18/a){
            ans=-1;
          ng=1;
        }
        ans*=a;
    }
  if(ng)ans=-1;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3612
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>   
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef double Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	while(cin>>n,n){
		vvi in(n,vi(8));
		rep(i,n)rep(j,8)cin>>in[i][j];
		vip w;
		rep(i,n)loop(j,i+1,n){
			double d[8];
			rep(k,8)d[k]=in[i][k]+in[j][k]*(k<6?-1:1);
			double a=d[3]*d[3]+d[4]*d[4]+d[5]*d[5]-d[7]*d[7];
			double b=d[0]*d[3]+d[1]*d[4]+d[2]*d[5]+d[6]*d[7];
			double c=d[0]*d[0]+d[1]*d[1]+d[2]*d[2]-d[6]*d[6];
			b*=2;
			if(b*b-4*a*c+EPS<0)continue;
			double D=sqrt(EPS+b*b-4*a*c);
			double t1=(-b+D)/2/a;
			double t2=(-b-D)/2/a;
			if(t1>0)w.pb({t1,{i,j}});
			if(t2>0)w.pb({t2,{i,j}});
		}
		sort(all(w));
		vector<int> co(n,1);
		vi out(n);
		rep(i,n)out[i]=in[i][6]/in[i][7];
		rep(i,w.size()){
			int a=w[i].second.first;
			int b=w[i].second.second;
			double t=w[i].first;
			if(co[a]&&co[b]&&out[a]>t&&out[b]>t){
				co[a]=co[b]=0;
				out[a]=out[b]=w[i].first;
			}
		}
		rep(i,n)cout<<shosu(9)<<out[i]<<endl;
	}
}
/*
	(dx+vx*t)^2+(dy+vy*t)^2+(dz+vz*t)^2=(dr-vr*t)^2
	(vx^2+vy^2+vz^2-vr^2)t^2+2(dxvx+dyvy+dzvz+drvr)*t
		+dx^2+dy^2+dz^2-dr^2
		
	
*/




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

using namespace std;

int main(void){
    int A,B,C;
    cin >> A >> B >> C;

    if(A!=B && B !=C && A !=C){
        cout << "No";
        return 0;
    }

    if(A==B&&A==C){
        cout << "No";
        return 0;
    }

    cout << "Yes";
    return 0;
}

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

int main (void) {
    char s[21];
    int i;
    int l;
    gets(s);
    l=strlen(s);
    for (i=l-1;i>=0;i--){
        printf("%c",s[i]);       
   }    
    printf("\n");
    return 0;
}

Measured memory_bytes: 524
def main():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
#    S = [list(map(int, input(_).split())) for _ in range(M)]
    LIST = [1] * N
    #LIST = [ 1 for _ in range(N)]
    for _ in range(M):
        A, B = map(int, input().split())
        if H[A-1] >= H[B-1]: LIST[B-1] = 0
        if H[A-1] <= H[B-1]: LIST[A-1] = 0
    print(sum(LIST))
    
main()

Measured memory_bytes: 20012
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)

int main() {
    string s; cin >> s;
    int tmp = 0;
    rep(i, s.size()) {
        tmp += s[i] - '0';
    }
    int x = stoi(s);
    if (x % tmp == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
 
using namespace std;
const int MOD = 1000000007;

struct UnionFind{
    vector<int> par;  // par[x] := x の親
    vector<int> rank; // rank[x] := x の ランク
    vector<int> size; // x 木のサイズ (x が根の時のみ)
private:
    void init(int n = 1){
        par.resize(n);
        rank.resize(n);
        size.resize(n);
        for(int i = 0; i < n; i++){
            par[i] = i;
            rank[i] = 0;
            size[i] = 1;
        }
    }
 
public:
    UnionFind(int n = 1){
        init(n);
    }
    int Find(int x){
        if(par[x] == x) return x;
        int r = Find(par[x]);    //pathcompression
        return par[x] = r;
    }
    bool same(int x, int y){
        return Find(x) == Find(y);
    }
    bool Union(int x, int y){
        x = Find(x);
        y = Find(y);
        if(x == y) return false;
        if(rank[x] < rank[y]) swap(x, y);  // union by rank
        if(rank[x] == rank[y]) rank[x]++;
        par[y] = x;
        size[x] = size[x] + size[y];
    }
    int getSize(int x){
        return size[Find(x)];
    }
};

int main(){
    
    UnionFind uf(13);
    uf.Union(1, 3);
    uf.Union(1, 5);
    uf.Union(1, 7);
    uf.Union(1, 8);
    uf.Union(1, 10);
    uf.Union(1, 12);
    uf.Union(4, 6);
    uf.Union(4, 9);
    uf.Union(4, 11);

    int a, b; cin >> a >> b;
    if(uf.same(a, b)) cout << "Yes" << endl;
    else cout << "No" << endl;    
    return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/tenka1-2019-beginner/tasks/tenka1_2019_c

n = int(input())
s = input()
ans = s.count('.')
t = ans
for i in range(n):
    if s[i] == '#':
        t += 1
    else:
        t -= 1
    ans = min(ans, t)
print(ans)

Measured memory_bytes: 40176
S=input()
i=0
while i<=len(S):
    if i==len(S):
        print("YES")
        exit()
    if S[i:i+11] == "dreameraser":
        i+=11
        continue
    elif S[i:i+10] == "dreamerase":
        i+=10
        continue
    elif S[i:i+7] == "dreamer":
        i+=7
        continue
    elif S[i:i+6] == "eraser":
        i+=6
        continue
    elif S[i:i+5] in ["dream","erase"]:
        i+=5
        continue
    else:
        print("NO")
        exit()
print("NO")


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,l,taste,mini = 1000,min_num;
  cin >> n >> l;
  taste = (n * (n+1))/2 + n * (l - 1);
  for(int i = l;i < n + l;i++){
    if(mini > abs(i)){
      mini = abs(i);
      min_num =  i;
    }    
  }
  cout <<taste - min_num << endl;
}

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

using namespace std;
using ll = long long;

const int INF = 1001001001;

struct Edge {
    Edge(int _to, int _cost) : to(_to), cost(_cost) {}
    int to;
    int cost;
};

using Graph = vector<vector<Edge>>;

struct VInfo {
    VInfo(int _dist, int _num) : minimum_distance(_dist), v_num(_num) {}
    bool operator ==(const VInfo &info) const { return this->minimum_distance == info.minimum_distance; }
    bool operator !=(const VInfo &info) const { return this->minimum_distance != info.minimum_distance; }
    bool operator <(const VInfo &info) const { return this->minimum_distance < info.minimum_distance; }
    bool operator <=(const VInfo &info) const { return this->minimum_distance <= info.minimum_distance; }
    bool operator >(const VInfo &info) const { return this->minimum_distance > info.minimum_distance; }
    bool operator >=(const VInfo &info) const { return this->minimum_distance >= info.minimum_distance; }
    int minimum_distance;
    int v_num;
};

void dijkstra(int s, vector<vector<Edge>> &graph, vector<int> &cost) {
    priority_queue<VInfo> q;
    cost[s] = 0;
    q.emplace(0, s);

    while (!q.empty()) {
        auto p = q.top();
        q.pop();
        int v = p.v_num;
        if (cost[v] < p.minimum_distance) continue;
        for (auto e: graph[v]) {
            if (cost[e.to] > cost[v] + e.cost) {
                cost[e.to] = cost[v] + e.cost;
                q.emplace(cost[e.to], e.to);
            }
        }
    }
};


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

    Graph G(n, vector<Edge>());
    vector<int> d(n, INF);

    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].emplace_back(b, 1);
    }
    dijkstra(0, G, d);

    cout << ((d[n - 1] == 2) ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}

Measured memory_bytes: 11124
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <iterator>
#include <cmath>
#include <deque>
#include <stack>
#include <functional>
using namespace std;
#define int long long

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

signed main()
{
    {
        if (fopen("input.txt", "r")) {
            freopen("input.txt", "r", stdin);
            freopen("output.txt", "w", stdout);
        }
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
    }

    int n;
    cin >> n;
    int k = 1;
    for (int i = 0; i != n; ++i) {
        int a;
        cin >> a;
        if (a == k)
            ++k;
    }
    if (k > 1)
        cout << n - (k - 1);
    else
        cout << -1;
    return 0;
}

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

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

    int ans = N;
    for (int i = 0; i * 6 <= N; i++) {
        for (int j = 0; i * 6 + j * 9 <= N; j++) {
            int cnt6 = 0;
            int cnt9 = 0;
            int tmp6 = i;
            int tmp9 = j;
            while (tmp6 != 0) {
                cnt6 += tmp6 % 6;
                tmp6 /= 6;
            }
            while (tmp9 != 0) {
                cnt9 += tmp9 % 9;
                tmp9 /= 9;
            }
            int cnt1 = N - i * 6 - j * 9;
            if (cnt1 >= 0) ans = min(ans, cnt1 + cnt6 + cnt9);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M1 1000000007
#define M2 998244353
#define ll long long int
#define N (int)1e5+3
#define test(t) while(t--)
#define PI acos(-1.0)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mii map<int,int>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repp(i,b,a) for(ll i=b-1;i>=a;i--)
#define clr(ar, val) memset(ar, val, sizeof(ar))
#define F first
#define S second
#define PB push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define V(a) vector<a>
#define M(a,b) map<a,b>
#define endl '\n'
#define all(x) begin(x),end(x)
#define allr(x) rbegin(x),rend(x)
#define pr(a) cout<<a<<endl;
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int dx[4] = { 0, -1, 0, 1 };
const int dy[4] = { -1, 0, 1, 0 };
using namespace std;

ll CalculateMex(set<ll> Set){
    ll Mex = 0;
    while(Set.find(Mex)!=Set.end()){
        Mex++;
    }
    return Mex;
}

ll floor_div(ll a, ll b) {
	return a / b - (((a ^ b) < 0) and a % b);
}
ll ceil_div(ll a, ll b){
    return a / b + (((a ^ b) >= 0) and a % b);
}

inline void INP()
{
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);   
	    freopen("output.txt","w",stdout);
	#endif 
}

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

}

int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    test(t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
use std::cmp::min;
use proconio::input;

fn main() {
    input! {
        s: String,
        t: String,
    }
    let s: Vec<char> = s.chars().collect();


    let mut min_count = i64::max_value();

    for i in 0..(s.len() - t.len() + 1) {
        let mut tmp_count = 0;
        for (j, t) in t.chars().enumerate() {
            if s[i + j] != t {
                tmp_count += 1;
            }
        }

        min_count = min(min_count, tmp_count);
    } 

    println!("{:?}", min_count);
}


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

int ctoi(char c){
    return (int)(c-'0');
}

int main(){
    string s;
    cin >> s ;
    int N = (int)(s.length());
    //cout << N << endl;
    int R[N];
    int count[2019];
    for(int i=0;i<2019;i++){
        count[i]=0;
    }
    count[0]=1;
    long long int rest =0 ;
    long long int k=1;
    for(int i=0;i<N;i++){
        int t=ctoi(s[N-i-1]);
        int nr=((t*k)%2019 + rest)%2019;
        count[nr] += 1;
        k=(k*10)%2019;
        rest = nr;


    }
    long long int sum=0;
    for(int i=0;i<2019;i++){
        int m = count[i];
        sum += (m*(m-1))/2;
    }
  

    cout << sum << endl;
    return 0;


}

Measured memory_bytes: 3772
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll h,w;
  cin >> h >> w;
  ll res = 0;
  res = pow(10,18);
  for(int i = 1;i < h;i++){
    vector<ll> a(3);
    
    a[0] = w * i;
    if(w % 2 == 0){
      a[1] = (h - i) * w / 2;
      a[2] = (h - i) * w / 2;
    }
    else{
      a[1] = (h - i) * (w / 2);
      a[2] = (h - i) * (w / 2 + 1);
    }
    sort(a.begin(),a.end());
    res = min(res,a[2] - a[0]);
    
    a[0] = w * i;
    if((h - i) % 2 == 0){
      a[1] = w * (h - i) / 2;
      a[2] = w * (h - i) / 2;
    }
    else{
      a[1] = w * ((h - i) / 2);
      a[2] = w * ((h - i) / 2 + 1);
    }
    sort(a.begin(),a.end());
    res = min(res,a[2] - a[0]);
    
  }
  for(int i = 1;i < w;i++){
    vector<ll> a(3);
    
    a[0] = h * i;
    if(h % 2 == 0){
      a[1] = (w - i) * h / 2;
      a[2] = (w - i) * h / 2;
    }
    else{
      a[1] = (w - i) * (h / 2);
      a[2] = (w - i) * (h / 2 + 1);
    }
    sort(a.begin(),a.end());
    res = min(res,a[2] - a[0]);
    
    a[0] = h * i;
    if((w - i) % 2 == 0){
      a[1] = h * (w - i) / 2;
      a[2] = h * (w - i) / 2;
    }
    else{
      a[1] = h * ((w - i) / 2);
      a[2] = h * ((w - i) / 2 + 1);
    }
    sort(a.begin(),a.end());
    res = min(res,a[2] - a[0]);
    
  }
  cout << res << endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef set<int> si;
typedef map<int,ll> mil;
typedef string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N,M;
int S[2010],T[2010];
ll dp[2010][2010];
ll sum[2010][2010];
int main(){
  cin>>N>>M;
  rep(i,N) cin>>S[i];
  rep(i,M) cin>>T[i];
  fill(dp,(ll)0);
  fill(sum,(ll)0);
  rep1(i,N){
    rep1(j,M){
      dp[i][j]=(S[i-1]==T[j-1]?(sum[i-1][j-1]+1)%MOD:(ll)0);
      sum[i][j]=(dp[i][j]+sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+MOD)%MOD;
    }
  }
  ll res=0;
  rep1(i,N){
    rep1(j,M){
      res=(res+dp[i][j])%MOD;
    }
  }
  res=(res+1)%MOD;
  prin(res);
  return 0;
}


Measured memory_bytes: 63360
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repA(a,i,n) for(int i=a;i<n;i++)
#define trav(a,x)for(auto &a: x)
#define fll(a) memset(a,0,sizeof(a));
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define itr(it,x) for(auto it=x.begin();it!=x.end();it++)
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
typedef vector<int>vi;
typedef map<int,int>ma;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
void fopen()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);   
}

int main()
{
  // fopen();
    ll h,c=0,p=0;
    cin>>h;
    while(h>0)
    {
        c+=pow(2,p);
        h/=2;
        p++;
    }
    cout<<c;
    
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
 
typedef vector<vector<int> > Matrix; //隣接行列
 
const int INF = 1000000000;
 
Matrix dist;
 
//trueなら負の閉路を検出
bool warshall_floyd(int n) { //nは頂点数
    for (int k = 0; k < n; k++) { //経由点
        for (int i = 0; i < n; i++) { //始点
            for (int j = 0; j < n; j++) { //終点
                if (dist[i][k] != INF && dist[k][j] != INF) {
                    dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
                }
            }
        }
    }
    
    //負の閉路を検出
    for (int i = 0; i < n; i++) {
        if (dist[i][i] < 0) return true;
    }
    return false;
}
 
int dp[1 << 8][8];
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M, R;
	cin >> N >> M >> R;
	vector<int> r(R);
	for (int i = 0; i < R; i++) {
		cin >> r[i];
		r[i]--;
	}
 
	dist.resize(N, vector<int>(N, INF));
	for (int i = 0; i < M; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		dist[a][b] = c;
		dist[b][a] = c;
	}
 
	warshall_floyd(N);
	for (int i = 0; i < (1 << R); i++) {
		for (int j = 0; j < R; j++) {
			dp[i][j] = INF;
		}
	}
 
	for (int i = 0; i < R; i++) dp[1 << i][i] = 0;
	for (int i = 1; i < (1 << R) - 1; i++) {
		for (int j = 0; j < R; j++) {
			for (int k = 0; k < R; k++) {
				if (i & (1 << k)) continue;
				dp[i | (1 << k)][k] = min(dp[i | (1 << k)][k], dp[i][j] + dist[r[j]][r[k]]);
			}
		}
	}
 
	int ans = INF;
	for (int i = 0; i < R; i++) {
		ans = min(ans, dp[(1 << R) - 1][i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
a = list(input())
# print(a[1])
b = 0
c = 0
for i in range(len(a)):
    if i % 2 == 1:
        b = b + int(a[i] != "R")
    if i % 2 == 0:
        c = c + int(a[i] != "L")
if b +c == len(a):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
while True:
    n,x = map(int, input().split())
    if n == 0 and x == 0:
        break
    else:
        combinations = 0
        for i in range(1, n-1):
            for j in range(i+1, n):
                for k in range(j+1, n+1):
                    if i+j+k == x:
                        combinations += 1
        print(combinations)


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

int main(void)
{
  char b, ans;
  scanf("%c", &b);
  if (b=='A') ans='T';
  else if (b=='C') ans='G';
  else if (b=='G') ans='C';
  else ans='A';
  printf("%c\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n,i;
  char p;
  cin>>n;
  vector <char> s,t,ans;
  //string s,t,ans;
  cin.ignore(numeric_limits<streamsize>::max(),'\n'); 
 // getline(cin,s);
  //getline(cin,t);
  for(i=0;i<n;i++)
  {  cin>>p;
   	s.push_back(p);
  }
   for(i=0;i<n;i++)
  {  cin>>p;
   	t.push_back(p);
  }
   for(i=0;i<n;i++)
  {  cout<<s[i]<<t[i];
  }
  return 0;
}

Measured memory_bytes: 256
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v):
    print(["Yes", "No"][not v])


# エントリーポイント
def main():
    S = set(input(str))
    yesno(len(S) == 2)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    char x;
    cin>>x;
    char k=x+1;
    cout<<k<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys

def _calc(Ai, j):
    if j != 0:
        return j * Ai + 1
    if j == 0:
        return 1

def main(inp_list):
    # return inp_list
     N = inp_list[0]
     D = inp_list[1][0]
     X = inp_list[1][1]
     A = inp_list[2:]
     #return type(A[0][0])
     results =[ _calc(per[0], i) for per in A  for i in range(0,100) if _calc(per[0], i) < D + 1]
     return len(list(results)) + X

def init(MODE):
    if MODE == 0:
        while True:
            try:
                result = int(input())
                yield result
            except:
                break

    if MODE == 1:
        while True:
            try:
                li=list(map(int,input().split()))
                yield li
            except:
                break
if __name__ == '__main__':
    """ MODE: 0 縦, 1 縦横, 2 横 """
    MODE = 1
    inp_list = init(MODE)
    print(main(list(inp_list)))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		sc.close();
		int s=0;
		for(int i=1; i<=K; i++) {
			for(int j=1; j<=K; j++) {
				for(int k=1; k<=K; k++) {
					s+=gcd(gcd(i,j),k);
				}
			}
		}
		System.out.println(s);
	}

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

}


Measured memory_bytes: 35692
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string O,E;
  cin >> O >> E;
  
  if(O.size()==E.size())
  {
    for(int i=0;i<O.size();i++)
    {
      cout << O.at(i) << E.at(i);
    }
  }
  
  else
  {
    for(int i=0;i<E.size();i++)
    {
      cout << O.at(i) << E.at(i);
    }
    cout << O.at(O.size()-1);
  }
}
    


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; //10^9
using ll = long long;
using P = pair<int,int>;
//加算代入演算子は+=！！！！！

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    rep (i, n - 1){
        if(s.at(i) != s.at(i + 1)) ++ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main()
{
	int n;
	long long int mozi[5] = {0};
	long long int ans = 1;
	long long int zenbu = 0;
	int i, j, k;
	char s[11];

	scanf("%lld", &n);
	for (i= 0; i < n; i++) {
		scanf("%s", s);

		switch (s[0]) {
			case 'M' :
				mozi[0]++;
				break;
			case 'A' :
				mozi[1]++;
				break;
			case 'R' :
				mozi[2]++;
				break;
			case 'C' :
				mozi[3]++;
				break;
			case 'H' :
				mozi[4]++;
				break;
		}

	}

	for (i = 0; i < 3; i++) {
		for (j = i+1; j < 4; j++) {
			for (k = j+1; k < 5; k++) {
				ans = mozi[i] * mozi[j] * mozi[k];
				zenbu += ans;
			}
		}
	}

	printf("%lld", zenbu);
	return 0;
}



Measured memory_bytes: 128
#include <iostream>

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

    int count = 3;
    if(a == b) {
        count--;
    }
    if(b == c) {
        count--;
    }
    if(a == c) {
        count--;
    }

    if(count == 0) {
        std::cout << 1 << std::endl;
    } else {
        std::cout << count << std::endl;

    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,b[200005],tot,v[10000005],h[10000005],ans[200005],ww,s;
vector<int> vec;
struct P {
	int x,y,id;
} a[200005];
struct E{
	int to,next;
}e[28000005];
void A(int x,int y){
	e[++ww]={y,h[x]},h[x]=ww;
}
void dfs(int x) {
	if(!x||v[x])return ;
	v[x]=1;
	if(x<=n)vec.push_back(x),s++;
	for(int i=h[x];i;i=e[i].next)dfs(e[i].to);
}
struct SEGMENT {
	int c[10000005][2],rt;
	bool is;
	void Ins(int &p,int l,int r,int x,int y) {
		int q=++tot;
		c[q][0]=c[p][0],c[q][1]=c[p][1];
		if(!is)A(q,p);
		else A(p,q);
		p=q;
		if(l==r) {
			if(!is)A(p,y);
			else A(y,p);
			return ;
		}
		int mid=(l+r)/2;
		if(!is) {
			if(x<=mid)A(p,c[p][1]),Ins(c[p][0],l,mid,x,y),A(p,c[p][0]);
			else A(p,c[p][0]),Ins(c[p][1],mid+1,r,x,y),A(p,c[p][1]);
		}
		else {
			if(x<=mid)A(c[p][1],p),Ins(c[p][0],l,mid,x,y),A(c[p][0],p);
			else A(c[p][0],p),Ins(c[p][1],mid+1,r,x,y),A(c[p][1],p);
		}
	}
	void Link(int p,int l,int r,int x,int y) {
		if(!p)return ;
		if(r<=x) {
			if(!is)return A(y,p),void();
			else return A(p,y),void();
		}
		int mid=(l+r)/2;
		Link(c[p][0],l,mid,x,y);
		if(x>mid)Link(c[p][1],mid+1,r,x,y);
	}
} q1,q2;
int main() {
	cin>>n,tot=n;
	for(int i=1; i<=n; i++)cin>>a[i].x>>a[i].y,b[i]=a[i].y,a[i].id=i;
	sort(b+1,b+n+1);
	for(int i=1; i<=n; i++)a[i].y=lower_bound(b+1,b+n+1,a[i].y)-b;
	sort(a+1,a+n+1,[](P i,P j) {
		return i.x^j.x?i.x<j.x:i.y<j.y;
	});
	q2.is=1;
	for(int i=1; i<=n; i++) {
		q1.Link(q1.rt,1,n,a[i].y,i);
		q1.Ins(q1.rt,1,n,a[i].y,i);
		q2.Link(q2.rt,1,n,a[i].y,i);
		q2.Ins(q2.rt,1,n,a[i].y,i);
	}
	for(int i=1; i<=n; i++) {
		if(!v[i]){
			s=0,vec.clear(),dfs(i);
			for(int j:vec)ans[a[j].id]=s;
		}
	}
	for(int i=1; i<=n; i++)cout<<ans[i]<<'\n';
	return 0;
}

Measured memory_bytes: 447524
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;
const int mod = 1e9+7;
#define ll long long

signed main() {
  int d;
  cin >> d;
  vector<pair<int,int>> c(26);
  vector<int> cc(26);
  vector<int> dd(26);
  vector<int> t;
  rep(i,26) {
    int x;
    cin >> x;
    c[i] = {-x,i};
    cc[i]=x;
  }
  sort(c.begin(),c.end());
  
  vector<vector<int>> s(d);
  int ans = 0;
  rep(i,d) {
    int ma = 0;
    rep(j,26) {
      int num;
      cin >> num;
      ma = max(ma,num+cc[j]);
      if(ma==num+cc[j]) ans = j+1;
      s[i].push_back(num);
    }
    rep(j,26) {
      if(ans-1!=j) cc[j]+=dd[j];
      else cc[j]=dd[j];
    }
    //sort(s.begin(),s.end());
    //cout << ans << endl;
  }
  
  int cnt = 0;
  rep(i,d) {
    t.push_back(c[cnt].second+1);
    cnt++;
    cnt%=26;
  }

  rep(i,d/13) {
    FOR(j,i*13+1,i*13+12) {
      if(j+13>=360) break;

      if(s[j][t[j]-1]<s[j+13][t[j+13]-1]+5000) {
        swap(t[j],t[j+1]);
      }
    }
  }

  rep(i,d) {
    cout << t[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3756
X,Y,A,B,C = (int(x) for x in input().split())
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]

p = sorted(p, reverse=True)
q = sorted(q, reverse=True)
r = sorted(r, reverse=True)

p.append(0)
q.append(0)
r.append(0)
for i in range(X,A):
    p[i] = 0
for i in range(Y,B):
    q[i] = 0

a = 0
b = 0
c = 0
cnt = 0

for i in range(X+Y):
    if (not a == X) and p[a] >= q[b] and p[a] >= r[c]:
        cnt += p[a]
        a += 1
    elif (not b == Y) and q[b] >= r[c]:
        cnt += q[b]
        b += 1
    else:
        cnt += r[c]
        c += 1
print(cnt)


Measured memory_bytes: 105216
N = int(input())
P = list(map(int, input().split()))

ans = 0

for i in range(N):
    p = P[i]
    if p == i + 1:
        ans += 1
        if i < N - 1:
            P[i], P[i + 1] = P[i + 1], P[i]
        else:
            P[i], P[i - 1] = P[i - 1], P[i]

print(ans)

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

int n;
int kq;

int main(){
    cin>>n;kq=-1;
    for(int i=1;i<=50000;i++)
        if (i*108/100==n){
            kq=i;break;
        }
    if (kq==-1) cout<<":(";
    else cout<<kq;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
#define FOR(i,a) for (int i=0;i<(a);++i)
#define FORD(i,a) for (int i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (int i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (int i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define all(v) v.begin(),v.end()
#define make_unique(v) v.erase(unique(all(v)),v.end())
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define srng mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define y1 EsiHancagorcRepa
 
const int N=2e5+10;
const ll MOD2=998244353;
const ll MOD=1e9+7;

int myus[N][30],nax[30];

int main(){
    fastio;
    srng;
    #ifdef ALEXPC
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    //cout.precision(13);
    string s,t;
    cin>>s>>t;
    ll n=s.length();
    s+=s;
    FORD(i,s.length()){
        FOR(j,26){
            
            myus[i][j]=nax[j];
            if (nax[j]==0)myus[i][j]=-1;
        }
        nax[s[i]-'a']=i;
    }
    ll tv=n-1;
    ll ans=0;
    FOR(i,t.length()){
        tv=myus[tv][t[i]-'a'];
        //cout<<tv<<endl;
        if (tv==-1){
            cout<<-1<<endl;
            return 0;
        }
        //cout<<tv<<endl;
        if (tv>=n){
            tv-=n;
            ans+=(ll)n;
        }
    }
    cout<<ans+tv-n+1ll<<endl;
    return 0;
}

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

typedef long long ll;
typedef long double ld;
#define size(a) int((a).size())
#define present(c, x) (c.find(x) != c.end()) 

template <class T>
void printArray(vector<T> arr) {for (T a: arr) cout << a << " ";cout << '\n';}
void printVerdict(bool verdict) {cout << (verdict ? "Yes": "No") << '\n';}
void printDecimal(double d) {printf("%.9f\n", d);}

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int k,x; cin >> k >> x;
	bool verdict = k*500 >= x;
	printVerdict(verdict);
}



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

int main(){
  // 入力
  int N, Y;
  cin >> N; // 紙幣の合計枚数
  cin >> Y; // 合計金額

  int x, y, z;
  x = 0; //10000円札の枚数
  y = 0; //5000円札の枚数
  z = 0; //1000円札の枚数

  bool endflag = false; // 多重ループから抜けるためのフラグ

  // 全探索 計算量N^2
  for (x = 0; x < N + 1; ++x) {
    for (y = 0; y < N + 1; ++y) {
      z = (Y - x * 10000 - y * 5000) / 1000;
      // zが自然数かつx+y+z=Nなら条件を満たす
      if ((z >= 0) && (x + y + z == N)) {
        // 出力
        cout << x << " " << y << " " << z << " " << endl;
        endflag = true;
      }
      if (endflag) break;
    }
    if (endflag) break;
  }
  // 最後まで条件を満たさなかった場合の処理
  if(endflag == false) {
    cout << "-1 -1 -1" << endl;
  }
}


Measured memory_bytes: 256
/*
[arc102] C - Triangular Relationship
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

int N, K;

ll solve() {
    ll d = N / K;
    ll ans = d * d * d;
    if (K % 2 == 0) {
        d = (N + K / 2) / K;
        ans += d * d * d;
    }

    return ans;
}

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

    cout << solve() << endl;

    return 0;
}


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

int main(){
  int n,m;
  cin >> n >> m;
  int s=0;
  for(int i=0; i<m; i++){
    int a;
    cin >> a;
    s += a;
  }
  int ans;
  if(s>n) ans = -1;
  else ans = n-s;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=gets.to_i
D=get_i
d_ext={}
D.each do|d|
  d_ext[d]=0 if d_ext[d].nil?
  d_ext[d]+=1
end
M=gets.to_i
T=get_i
t_ext={}
T.each do|t|
    t_ext[t]=0 if t_ext[t].nil?
    t_ext[t]+=1
end
flag=true
t_ext.each do|t,n|
    if d_ext[t].nil? or d_ext[t]<n
      flag=false
      break
    end 
end
puts yn_judge(flag,"YES","NO")

Measured memory_bytes: 58888
# -*- coding: utf-8 -*-
import numpy as np
#%%
a = input()
b = a.split()
b = b[0]+b[1]
a = int(b)
#%%
rta = np.sqrt(a)
sa = rta - int(rta)
if sa > 0:
    print('No')
else:
    print('Yes')


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

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
#define INF 1000000000
typedef long long ll;

set<ll> nums;

int main() {
    int N;
    cin >> N;
    
    rep(i,N){
        ll x;
        cin >> x;
        if( nums.find(x) == nums.end()){
            nums.insert(x);
        } else {
            nums.erase(x);
        }
    }
    cout<<nums.size()<<endl;
}

Measured memory_bytes: 4992
use proconio::input;

fn satisfy(a: i32, b: i32, c: i32) -> bool {
    if a == b || b == c || c == a {
        return false;
    }

    return c < a+b && a < b+c && b < a+c;    
}

fn main() {
    input!{
        n: i32,
        l: [i32; n],
    }

    if n < 3 {
        println!("0");
        return ();
    }

    let mut num = 0;

    for i in 0..n-2 {
        for j in i..n-1 {
            for k in j..n {
                if satisfy(l[i as usize], l[j as usize], l[k as usize]) {
                    num += 1;
                }
            }
        }
    }
    println!("{}", num);
}


Measured memory_bytes: 2172
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));

  $mod = 1000000007;

  $array = array_fill(0, $n+1, 1);
  for ($i=1; $i<=$n; $i++) {
    $res = factorize($i);
//    var_dump($res);
    foreach($res as $k => $v){
      $array[$k]+=$v;
    }
  }

  $ans = 1;
  for ($i=1; $i<=$n; $i++) {
    $ans = $ans * $array[$i] % $mod;
  }

  echo $ans;

function factorize($n){
  $res = [];
  for($i=2; $i*$i<=$n; $i++){
    if($n % $i != 0) continue;
    $res[$i]=0;
    while($n % $i == 0){      
      $res[$i]++;
      $n /= $i;
    }
  }
  if($n != 1){
    $res[$n]=1;
  }
  return $res;
}

Measured memory_bytes: 16232
a, b = [parse(Int, x) for x in split(readline(), " ")]
x = 0
if a > b
    x += a
    a -= 1
else
    x += b
    b -= 1
end
if a > b
    x += a
    a -= 1
else
    x += b
    b -= 1
end
print(x)

Measured memory_bytes: 166188
import java.util.*;
import java.math.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long m = sc.nextLong();
    long n = sc.nextLong();
    long r1 = ((m & 1) == 0 ? 0 : 1) + m / 2;
    long r2 = ((n & 1) == 0 ? 0 : 1) + n / 2;
    if(m == 1 || n == 1) System.out.println(1); 
    else System.out.println(r1 * r2 + (m / 2) * (n / 2));
  }
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

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 ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int n;cin>>n;
	ll suma=0,sumb=0;
	vl a(n),b(n),c(n);
	rep(i,n){
		cin>>a[i]>>b[i];
		suma+=a[i];
		sumb+=b[i];
		c[i]=a[i]+b[i];
	}
	sort(all(c));
	reverse(all(c));
	rep(i,n){
		if(i%2==0)suma+=c[i];
		else sumb+=c[i];
	}
	cout<<(suma-sumb)/2<<endl;
}

Measured memory_bytes: 2560