akhauriyash/Code-Regression huggingface dataset:
q = gets.to_i
array = []
q.times do
  array << gets.split(" ").map(&:to_i)
end

## エラトステネスのふるいを使い、MAXである10**5までの素数を求める
MAX = 100000
is_prime = Array.new(MAX, 1)
is_prime[0] = 0
is_prime[1] = 0
(2...MAX).each do |i|
  if is_prime[i] == 1
    (2...MAX).each do |j|
      break if i * j > MAX
      is_prime[i * j] = 0
    end
  end
end

a = Array.new(MAX, 0)
MAX.times do |i|
  if i % 2 == 1
    a[i] = 1 if is_prime[i] == 1 && is_prime[(i + 1) / 2] == 1
  end
end


## 累積和
s = Array.new(MAX + 1, 0)
MAX.times do |i|
  s[i + 1] = s[i] + a[i]
end

result = []
array.each do |e|
  result << s[e[1] + 1] - s[e[0]]
end

puts result

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

#define FOR(s, i, n) for(int i = s; i n; i++)
typedef long long ll;
const int INF = 1e9;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int a,b;
	cin>>a>>b;
	cout<<a*b<<'\n';
	return 0;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define f first 
#define s second
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mp make_pair
#define pb push_back
#define MAX 1000001
int main()
{
  int n,q,a,b,c;
  cin >> n >> q;
  vector<pair<int,pair<int,int>>>v;
  for (int i = 0; i < n; ++i)
  {
    cin >> a >> b >> c;
    v.push_back(mp(c,mp(a,b)));
  }
  map<int,int>m;
  m.clear();
  set<int>s;
  for (int i = 0; i < q; ++i)
  {
    cin >> a;
    s.insert(a);
    m[a] = i;
  }
  // for(auto it = s.begin();it!=s.end();it++)
  //   cout << *it << " ";
  int ans[q+1];
  sort(v.begin(), v.end());
  for (int i = 0; i < q; ++i)
  {
    ans[i] = -1;
  }
  for (int i = 0; i < n; ++i)
  {
    int start = v[i].s.f-v[i].f;
    int end = v[i].s.s-v[i].f;
    auto it = s.lower_bound(start);
    auto it2 = s.lower_bound(end);
    // cout << *it << " \n" ;
    while(it!=it2)
    {
      ans[m[*it]] = v[i].f;
      // cout << m[*it] << " " << ans[m[*it]] << " " << *it << " " << "||\n";
      auto tmp = it;
      it++;
      s.erase(tmp);
    }
  }
  for (int i = 0; i < q; ++i)
  {
    cout << ans[i] << "\n";
  }
  return 0;
}
  

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

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var N = Console.ReadLine();

            long sum = 0;
            for (int i = 0; i < N.Length; i++)
                sum += long.Parse(N[i].ToString());

            if (sum % 9 == 0)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 32976
#include <stdio.h>
int main (){
  int a,b;
  char op;
  
  //op=+||-||*||/;
    
  for(;;){

    scanf("%d %c %d",&a,&op,&b);
    if(op == '+'){
      printf("%d\n",a + b);
    } else if (op == '-'){
      printf("%d\n",a - b);
    } else if (op == '*'){
      printf("%d\n",a * b );
    }
      else if (op =='/'){
      printf("%d\n",a / b);
    }
      else if (op == '?') break; 
    }
  return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<map>
#define MN 100000
#define ll long long
using namespace std;
inline ll read()
{
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
vector<pair<ll,ll> >v[MN+5],s[MN+5];
int n,top=0,Q,num=1;
ll q[MN+5],len,last,S[MN+5];
int main()
{
    n=read();Q=read();
    q[top=1]=n;
    for(int i=1;i<=Q;++i)
    {
        ll x=read();
        while(top&&x<=q[top]) --top;
        q[++top]=x;
    }
    len=q[1];v[1].push_back(make_pair(len,1));
    for(int i=2;i<=top;++i)
    {
        if(q[i]-q[i-1]>len)
        {
            len=q[i-1];++num;
            v[num].push_back(make_pair(len,q[i]/q[i-1]));
            if(q[i]%q[i-1]) v[num].push_back(make_pair(q[i]%q[i-1],1));
        }
        else v[num].push_back(make_pair(q[i]-q[i-1],1));
    }
    s[num].push_back(make_pair(q[top],1));
    for(int i=num;i;--i)
    {
        ll totc=0,nowlen=0;
     /*   cout<<i<<"----\n";
        for(int j=0;j<v[i].size();++j) printf("%lld %lld\n",v[i][j].first,v[i][j].second);
        puts("----\n");
        for(int j=0;j<s[i].size();++j) printf("%lld %lld\n",s[i][j].first,s[i][j].second);*/
        for(int j=0;j<s[i].size();++j) totc+=s[i][j].second;
        sort(s[i].begin(),s[i].end());
        for(int j=0,k=0;j<v[i].size();++j)
        {
            ll newlen=nowlen+v[i][j].first*v[i][j].second,extrac=0;
            for(;k<s[i].size()&&s[i][k].first<=newlen;++k)
            {
                totc-=s[i][k].second;
                ll uselen=s[i][k].first-nowlen;
                extrac+=s[i][k].second*(uselen/v[i][j].first);
                if(uselen%v[i][j].first)
                    s[i-1].push_back(make_pair(uselen%v[i][j].first,s[i][k].second));
            }
            s[i-1].push_back(make_pair(v[i][j].first,v[i][j].second*totc+extrac));
            nowlen=newlen;
        }
    }
    for(int i=0;i<s[0].size();++i) S[s[0][i].first]+=s[0][i].second;
    for(int i=n;--i;) S[i]+=S[i+1];
    for(int i=1;i<=n;++i) printf("%lld\n",S[i]);
    return 0;
}


Measured memory_bytes: 41840
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    ll N,M;
    cin>>N>>M;
    vector<ll> A(N),sum(N+1,0);
    REP(i,N) cin>>A[i];
    sort(A.begin(),A.end());
    REP(i,N){
        sum[i+1]=sum[i]+A[i];
    }
    ll l=-1;
    ll r=INF;
    ll x;
    while(r-l>1){
        x=(l+r)/2;
        ll cnt=0;
        REP(i,N){
            cnt+=A.end()-lower_bound(A.begin(),A.end(),x-A[i]);
        }
        if(cnt>=M){
            l=x;
        }else{
            r=x;
        }
    }
    x=l;
    x++;

    ll ans=0;
    ll cnt2=0;
    REP(i,N){
        l=lower_bound(A.begin(),A.end(),x-A[i])-A.begin();
        cnt2+=(N-l);
        ans+=(sum[N]-sum[l]);
        ans+=(N-l)*A[i];
    }
    ans+=(x-1)*(M-cnt2);
    cout<<ans<<endl;
}

Measured memory_bytes: 4824
import std.stdio;
import std.string;
import std.conv;
import std.bigint;
import std.typecons;
import std.algorithm;
import std.array;
 
void main() {
    auto a = readln.chomp.dup;
    auto b = readln.chomp.dup;
    reverse(b);
    writeln(a == b ? "YES" : "NO");
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, '%d', $count);
$numbers = explode(" ", trim(fgets(STDIN)));

$isContinue = true;
$changeCount = 0;
$y = 0;

while ($isContinue) {
  $isContinue = false;
  for ($i = $count - 1; $i > $y; $i--) {
    if ($numbers[$i] < $numbers[$i - 1]) {
      $tmp = $numbers[$i];
      $numbers[$i] = $numbers[$i - 1];
      $numbers[$i - 1] = $tmp;
      $isContinue = true;
      $changeCount++;
    }
  }
  $y++;
}

echo implode(" ", $numbers) . PHP_EOL;
echo $changeCount . PHP_EOL;



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

typedef long long ll;
const int N = 1e5 +5;

int n, m, first[N], cnt, fa[N], du[N], d[N<<1][2], tot[N<<1];
struct Edge {
	int to, next;
} e[N<<1];

void add(int u, int v) {
	e[cnt] = (Edge) { v, first[u] };
	first[u] = cnt++;
}

void Dfs1(int u) {
	for(int i = first[u]; i != -1; i = e[i].next) {
		int v = e[i].to;
		if(fa[v] != u) continue;
		Dfs1(v);
	}
	for(int i = first[u]; i != -1; i = e[i].next) {
		int v = e[i].to;
		if(v == fa[u]) {
			if(du[u]&1) {
				du[u]++;
				d[i][0] = d[i^1][0] = u;
				d[i][1] = d[i^1][1] = fa[u];
			}
			else if(fa[u] != -1) {
				du[fa[u]]++;
				d[i][0] = d[i^1][0] = fa[u];
				d[i][1] = d[i^1][1] = u;
			}
			return;
		}
	}
}

void Dfs(int u, int f, int root) {
	fa[u] = f;
	for(int i = first[u]; i != -1; i = e[i].next) {
		tot[root]++;
		int v = e[i].to;
		if(v == fa[u]) continue;
		if(fa[v]) {
			if(d[i][0]) continue;
 			du[u]++;
			d[i][0] = d[i^1][0] = u;
			d[i][1] = d[i^1][1] = v;
			continue;
		}
	    Dfs(v, u, root);
	}
}

int main() {
	cin>>n>>m;
	memset(first, -1, sizeof(first));
	for(int u, v, i = 1; i <= m; i++) {
		cin>>u>>v;
		add(u, v); add(v, u);
	}
	for(int i = 1; i <= n; i++) {
		if(fa[i] != 0) continue; 
		Dfs(i, -1, i);
		if((tot[i]/2)&1) {
			cout<<-1<<endl;
		    return 0;
		}
		Dfs1(i);
	}
	for(int i = 0; i < 2*m; i += 2) 
		cout<<d[i][0]<<" "<<d[i][1]<<endl;
}



Measured memory_bytes: 10624
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int n, m;
    cin >> n;
    string s[n];
    for(int i=0; i<n; i++) cin >> s[i];
    cin >> m;
    string t[m];
    for(int i=0; i<m; i++) cin >> t[i];

    int ans=0;
    auto calc = [&](string x) {
        int cnt=0;
        for(string y: s) if(x==y) cnt++;
        for(string y: t) if(x==y) cnt--;
        return cnt;
    };

    for(string y: s) ans = max(ans, calc(y));
    cout << ans << endl;

    return 0;
}


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

int main() {
    ll N,K,s=0;
    cin >> N >> K;
    vector<ll> H(N);
    rep(i,N)
        cin >> H.at(i);
    sort(H.begin(), H.end(), greater<int>());

    rep(i,min(N,K))
        H.at(i) = 0;
    
    rep(i,N)
        s += H.at(i);
    
    cout << s << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
unordered_map<int,int> cnt;
int main(void)
{
  int N;
  scanf("%d", &N);
  while(N--)
  {
    int A;
    scanf("%d", &A);
    cnt[A]++;
  }
  N = 0;
  for(auto a:cnt)
    if(a.second & 1)
      N++;
  printf("%d\n", N);
  return 0;
}

Measured memory_bytes: 4388
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      // cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

struct union_find {
  vector<int> data;
  int comp;
  union_find(int size) : data(size, -1), comp(size) {}
  void unite(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;
      comp--;
    }
  }
  bool same(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 components() { return comp; }
};
signed main() {
  int N;
  cin >> N;
  vi X(N), Y(N);
  rep(i, 0, N) { cin >> X[i] >> Y[i]; }

  union_find uf(N);
  map<int, int> xp, yp;
  rep(i, 0, N) {
    if (contains(xp, X[i])) {
      int j = xp[X[i]];
      uf.unite(i, j);
    } else {
      xp[X[i]] = i;
    }
    if (contains(yp, Y[i])) {
      int j = yp[Y[i]];
      uf.unite(i, j);
    } else {
      yp[Y[i]] = i;
    }
  }

  vector<int> checked(N, 0);
  vector<set<int>> sx(N), sy(N);
  int ans = 0;
  rep(i, 0, N) {
    int r = uf.root(i);
    checked[r]++;
    sx[r].insert(X[i]);
    sy[r].insert(Y[i]);

    if (checked[r] == uf.size(r)) {
      int w = sz(sx[r]);
      int h = sz(sy[r]);
      if (w == 0 || h == 0) continue;
      int count = w * h;
      ans += count - uf.size(r);
    }
  }
  cout << ans << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 23680
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		int a=in.nextInt(),b=in.nextInt();
		out.printf("%d %d %f", a/b,a%b,(double)a/b);
		out.flush();
	}

}



Measured memory_bytes: 26548
#include <stdio.h>
int main ()
{
  char a;
  while(1){
    scanf("%c",&a);
    if(a=='\n'){
      printf("\n");
      break;
    }
    if('A'<=a&&a<='Z'){
      printf("%c",a+'a'-'A');
    }else{
      if('a'<=a&&a<='z'){
	printf("%c",a-32);
      }else{
	printf("%c",a);
      }
    }
  }
}

Measured memory_bytes: 932
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,ll>;
using Graph= vector<vector<ll>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}

int main(){
ll x,y ;
cin>>x>>y ;
if(y%2==0&&2*x<=y&&4*x>=y) cout<<"Yes"<<endl ;
else
cout<< "No" <<endl ;
  return 0;
  }

Measured memory_bytes: 3592
n = int(input())
l = [] 
for i in range(n): 
  l.append(str(input()))

print('AC x '+str(l.count('AC')))
print('WA x '+str(l.count('WA')))
print('TLE x '+str(l.count('TLE')))
print('RE x '+str(l.count('RE')))

Measured memory_bytes: 16012
/*
author: madhav_1999 aka orthodoxparadox
12 April 2020 at 5:23 PM
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define dbl long double
#define int ll
#define ll long long
#define pii pair<int, int>
#define len(x) (int) x.size()
#define rev(a) reverse(all(a))
#define oiint ostream_iterator<int>(cout, " ") 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define onlyunique(v) v.erase(unique(all(v)), v.end()); //only for sorted vector
#define inf 2e18
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#ifdef MADHAV
#define dbg(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define dbg(...) 42
#endif
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(int i=0;i<(int)v.size();++i) x<<v[i]<<" ";return x;} 
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;} 
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;} 
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
struct pair_hash {inline std::size_t operator()(const std::pair<int, int> & v) const {return v.first*31+v.second;}};
const int MOD = 1e9 + 7;

int takemod(int a, int mod = MOD){a%=mod;if(a<0)a+=mod;return a;}

int fast_exp(int base, int expo, int mod = MOD) {
	int res=1;
	while(expo>0) {
		if(expo&1) res=(res*base)%mod;
		base=(base*base)%mod;
		expo>>=1;}
	return res;}

int modinv(int a, int mod = MOD){return takemod(fast_exp(takemod(a, mod), mod-2, mod), mod);}


void solve()
{
	string s;
	cin >> s;
	if(s[0] == '7' or s[1] == '7' or s[2] == '7') {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	#ifdef MADHAV
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
	#endif
	clock_t t1, t2;
	t1 = clock();

	int tt = 1;
	// cin >> tt;
	while(tt--)
	{
		solve();
	}
	#ifdef MADHAV
	t2 = clock(); cout << "\n\ntime taken: " << (t2-t1)/(dbl)CLOCKS_PER_SEC;
	#endif
	return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int e,y;
    cin >> e >> y;
    if(e==0){
        if(y<1912)cout << "M" << y-1911+44 << endl;
        else if(y<1926)cout << "T" << y-1925+14 << endl;
        else if(y<1989)cout << "S" << y-1988+63 << endl;
        else cout << "H" << y-2016+28 << endl;
    }else if(e==1){
        cout << y-44+1911 << endl;
    }else if(e==2){
        cout << y-14+1925 << endl;
    }else if(e==3){
        cout << y-63+1988 << endl;
    }else{
        cout << y-28+2016 << endl;
    }
}



Measured memory_bytes: 3100
#include <iostream>
#include <cstdio>
using namespace std;
long long n, x, s, mn=1e18, a[2005], m[2005];
int main() {
	int i, j;
	cin >> n >> x;
	for (j=0; j<n; j++) cin >> a[j], m[j] = 1e9;
	for (i=0; i<n; i++) {
		s = 0;
		for (j=0; j<n; j++) {
			m[j] = min(m[j], a[(j-i+n)%n]);
			s += m[j];
		}
		mn = min(mn, s + i*x);
	}
	cout << mn;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<unordered_map>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<unordered_set>
#include<map>




using namespace std;


int main() 
{
    string str;
    cin >> str;
    int i;
    for (i = 0; i < str.length(); ++i) {
        if (str[i] != str[str.length() - 1 - i]) {
            cout << "No";
            exit(0);
        }
    }

    int len1, len2;
    len1 = (str.length() - 1) / 2;
    for (i = 0; i < len1; ++i) {
        if (str[i] != str[len1 - 1 - i]) {
            cout << "No";
            exit(0);
        }
    }
    int j = str.length() - 1;
    for (i = (str.length() + 3) / 2 - 1; i<j ; ++i,--j) {
        if (str[i] != str[j]) {
            cout << "No";
            exit(0);
        }
    }

    cout << "Yes";



}
    


Measured memory_bytes: 256
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
    int s, w;
    cin >> s >> w;
    if( w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

Measured memory_bytes: 3624
#include<cstdio>
#include<vector>
#include<cstring>
#define rep(i, a, b) for (register int i=(a); i<=(b); ++i)
#define per(i, a, b) for (register int i=(a); i>=(b); --i)
using namespace std;
const int N=200005;
int cir[N], vis[N], mex[N], fa[N];
vector<int> G[N];

inline int read()
{
 	int x=0,f=1;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
	for (;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
	return x*f;
}

void dfs(int u)
{
	for (int v: G[u]) if (!cir[v]) dfs(v);
	for (int v: G[u]) if (!cir[v]) vis[mex[v]]=1;
	while (vis[mex[u]]) mex[u]++;
	for (int v: G[u]) if (!cir[v]) vis[mex[v]]=0;
}

int main()
{
	int n=read(), now=1;
	rep(i, 1, n) G[fa[i]=read()].push_back(i);
	while (!cir[now]) cir[now]=1, now=fa[now];
	memset(cir, 0, sizeof(cir));
	while (!cir[now]) cir[now]=1, now=fa[now];
	int Max=-1, Min=n+1, cnt=0;
	rep(i, 1, n) if (cir[i])
	{
		dfs(i); cnt++;
		Max=max(Max, mex[i]);
		Min=min(Min, mex[i]);
	}
	puts(Max==Min&&(cnt&1)?"IMPOSSIBLE":"POSSIBLE");
	return 0;
}


Measured memory_bytes: 12544
#include<iostream>
#include<unordered_map>
using namespace std;
main()
{
 long long int a, b, c, k, sum = 0;
 cin >> a >> b >> c >> k;
 sum+=min(a, k);
 k-=min(a,k);
 k-=min(b, k);
 sum-=min(c, k);
 cout << sum << endl;
 	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<string,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;


class UnionFind {
public:
    vector < ll > par; // 各元の親を表す配列
    vector < ll > siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};



int main(){
    ll N;
    cin >> N;
    ll M;
    cin >> M;
    ll K;
    cin >> K;
    UnionFind Tree(N+1);
    vector<ll> A(M+1,0);
    vector<ll> B(M+1,0);
    vector<ll> C(K+1,0);
    vector<ll> D(K+1,0);
    for(ll i=0;i<M;i++){
        cin>>A[i+1]>>B[i+1];
        Tree.unite(A[i+1],B[i+1]);
    ;}
    for(ll i=0;i<K;i++){
        cin>>C[i+1]>>D[i+1];
    ;}
    vector<ll> ans(N+1,0);
    for(ll i=1;i<=N;i++){
        ans[i]=Tree.size(i)-1
    ;}
    for(ll i=0;i<M;i++){
        ans[A[i+1]]--;
        ans[B[i+1]]--;
    ;}
    for(ll i=0;i<K;i++){
        if(Tree.same(C[i+1],D[i+1])){
            ans[C[i+1]]--;
            ans[D[i+1]]--;
        }
    ;}
    for(ll i=0;i<N;i++){
        cout<<ans[i+1]<<" ";
    ;}cout<<endl;


return 0;
}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
#define MOD 998244353

using namespace std;

typedef long long ll;

ll pow_mod(ll x,int k) {
  ll ans=1;
  while (k) {
  	if (k&1) ans=ans*x%MOD;
  	x=x*x%MOD;
  	k>>=1;
  }
  return ans;
}

ll facd[3000005],facv[3000005];

void pre(int n) {
  facd[0]=1;
  for(int i=1;i<=n;i++) facd[i]=facd[i-1]*i%MOD;
  facv[n]=pow_mod(facd[n],MOD-2);
  for(int i=n-1;i>=0;i--) facv[i]=facv[i+1]*(i+1)%MOD;
}

inline ll C(int n,int m) {
  return (n<m)?0:facd[n]*facv[m]%MOD*facv[n-m]%MOD;
}

int main() {
  int n,m;
  scanf("%d%d",&n,&m);
  pre(n+3*m);
  int ans=C(n+3*m-1,n-1);
  ans=(ans-n*C(n+m-2,n-1)%MOD+MOD)%MOD;
  for(int i=m+2;i<=n;i+=2)
    ans=(ans-C(n,i)*C(n+((3*m-i)>>1)-1,n-1)%MOD+MOD)%MOD;
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 41216
#include<bits/stdc++.h>
using namespace std;
struct Card{
    int pro;
    string whi;
};

int main(){
    int N, M, p, w = 0, ans = 0;
    string S;
    cin >> N >> M;
    vector<int> A(N), W(N);
    for(int i = 0; i < M; i++){
        cin >> p >> S;
        p--;
        if(A.at(p) == 1){
            continue;
        }
        if(S == "AC"){
            A.at(p) = 1;
        }
        else{
            W.at(p)++;
        }
    }
    for(int i = 0; i < N; i++){
        ans += A.at(i);
        if(A.at(i) == 1){
            w += W.at(i);
        }
    }
    cout << ans << " " << w << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

//#define DEBUG


int main(void)
{
  ll X;
  cin >> X;
  
  if(X>=2000)
  {
    cout << 1;
  }
  else
  {
    ll x_100_s,x_100_r,x_100_5_s,x_100_5_r;
    x_100_s = X/100;
    x_100_r = X%100;
    x_100_5_s = x_100_r/5;	//商 5の倍数
    x_100_5_r = x_100_r%5;	// あまり 0の場合と場合分けする
    
    if( x_100_5_r == 0)	// 5の倍数
    {
      // 
      if( x_100_s >= x_100_5_s)
      {
        cout << "1";
      }
      else
      {
        cout << "0";
      }
    }
    else	// 5の倍数以外
    {
     if( x_100_s > x_100_5_s)
      {
        cout << "1";
      }
      else
      {
        cout << "0";
      }
       
    }
    

  }
  
  
  return 0;
} 

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

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

	double final = 0.0;

	for(int i = 1; i <= N; ++i) {
		if(i >= K) {
			final += 1.0 / (double)N;
			continue;
		}

		double res = 1;
		res *= 1.0 / N;
		int k = i;
		while(k < K) {
			k = k * 2;
			res *= 0.5;
		}

		final += res;
	}

	cout << setprecision(12) << final << endl;
}

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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int main(){
ll N;cin>>N;
  ll tot=0;
  for(ll i=1;i<=N;i++){
    if(i%3!=0&&i%5!=0){
     tot+=i;
    }
  }
  cout<<tot<<endl;
}
   





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

int main(){
  int64_t X;
  cin>>X;

  int64_t n=100;
  int cnt=0;
  while(true){
    ++cnt;
    n = (int64_t)n*(double)1.01;
    
    if(n>=X){
      cout<<cnt<<endl;
      break;
    }
  }
}

Measured memory_bytes: 3596
k,n = [int(e) for e in input().split()]
a=[int(e) for e in input().split()]
a.sort()
d = [0]*n
for i in range(0,n-1):
    d[i] = a[i+1]-a[i]
d[n-1]=k-a[n-1]+a[0]
d.sort()
print(k-d[n-1])

Measured memory_bytes: 26000
object Main extends App {
  val ans = scala.io.Source.stdin.getLines.toList.tail
    .map(_.split(" ").map(_.toInt - 1))
    .foldLeft(Array.fill(4, 3, 10)(0)){ case (state, Array(b, f, r, v)) =>
      state(b)(f)(r) += v + 1
      state
    }
    .map(_.map(_.map(" " + _).mkString("")).mkString("\n"))
    .mkString("\n" + ("#" * 20) + "\n")
  println(ans)
}

Measured memory_bytes: 44372
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vs = vector<string>;
using vvs = vector<vs>;
using pli = pair<long long, int>;
using vpli = vector<pli>;

int main() {
  ll X, Y, reward = 0;
  cin >> X >> Y;

  if (X == 1) reward += 300000;
  else if (X == 2) reward += 200000;
  else if (X == 3) reward += 100000;

  if (Y == 1) reward += 300000;
  else if (Y == 2) reward += 200000;
  else if (Y == 3) reward += 100000;

  if (X == 1 && Y == 1) reward += 400000;
  
  cout << reward << endl;
 
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
#include <utility>
using namespace std;

using vector2D = vector< vector<int> >;

vector2D rotate_right(vector2D board) {
    int H = board.size(), W = board[0].size();

    vector2D ret(W, vector<int>(H));
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            int ni = j, nj = H - i - 1;
            ret[ni][nj] = board[i][j];
        }
    }

    return ret;
}

vector2D rotate_left(vector2D board) {
    vector2D ret = rotate_right(board);

    reverse(ret.begin(), ret.end());
    for(int i=0; i<(int)ret.size(); i++) {
        reverse(ret[i].begin(), ret[i].end());
    }
    return ret;
}

pair< vector2D, vector2D > split_board(vector2D board, int col) {
    int H = board.size(), W = board[0].size();

    vector2D A(H, vector<int>(col)), B(H, vector<int>(W - col));
    for(int i=0; i<H; i++) {
        for(int j=0; j<col; j++) {
            int idx = j;
            A[i][idx] = board[i][j];
        }
        for(int j=col; j<W; j++) {
            int idx = j - col;
            B[i][idx] = board[i][j];
        }
    }

    for(int i=0; i<H; i++) {
        reverse(A[i].begin(), A[i].end());
    }

    return make_pair(A, B);
}

vector2D fold(vector2D board, int col) {
    vector2D A, B;
    tie(A, B) = split_board(board, col);

    int H = max(A.size(), B.size());
    int W = max(A[0].size(), B[0].size());

    vector2D ret(H, vector<int>(W));
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            if(i < A.size() && j < A[0].size()) {
                ret[i][j] += A[i][j];
            }
            if(i < B.size() && j < B[0].size()) {
                ret[i][j] += B[i][j];
            }
        }
    }
    return ret;
}

void print_board(vector2D board) {
    cout << "status:" << endl;

    int H = board.size(), W = board[0].size();
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            cout << board[i][j] << " ";
        }
        cout << endl;
    }
}

int main() {
    int W, H, T, P;
    while(cin >> W >> H >> T >> P, W + H + T + P) {
        vector2D board(H, vector<int>(W, 1));

        for(int i=0; i<T; i++) {
            // print_board(board);

            int d, col; cin >> d >> col;
            if(d == 2) {
                board = rotate_right(board);
            }

            board = fold(board, col);

            if(d == 2) {
                board = rotate_left(board);
            }
        }

        H = board.size(), W = board[0].size();
        for(int i=0; i<P; i++) {
            int x, y; cin >> x >> y;
            // printf("x = %d, y = %d, H = %d, W = %d\n", x, y, H, W);
            cout << board[H - y - 1][x] << endl;
        }
    }
}


Measured memory_bytes: 3204
/*
	長さ4の英大文字からなる文字列Sが与えられます。
	Sがちょうど２種類の文字からなり、かつ現れる各文字は
	ちょうど２回ずつ現れているかどうか判定してください。
	<制約>
	・Sの長さは4である。
	・Sは英大文字からなる。
	
	例：ASSA -> YES   STOP -> No  EEEE -> No
	
	URL:https://atcoder.jp/contests/abc132/tasks/abc132_a
 */

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>

#define S_LEN (4)

static bool is_upper(char* array, int n);
static int appear_char_count(char* array, int n);
static void swap(char* a, char* b);
static void bubble_sort(char* array, int n);

int main(void)
{
	bool result = true;
	char buf[S_LEN];
	
	scanf("%s", buf);
	
	if(strlen(buf) != 4)
	{
		printf("No");
		return 0;
	}
	
	bubble_sort(buf, strlen(buf));
	
	if(!is_upper(buf, strlen(buf)))
	{
		printf("No");
		return 0;
	}

	if(appear_char_count(buf, strlen(buf)) != 2)
	{
		printf("No");
		return 0;
	}

	printf("Yes");

	return 0;
}

static bool is_upper(char* array, int n)
{
	for(int i = 0; i < n/2; i += 2)
	{
		if(!isupper(array[i+0]) || !isupper(array[i+1]))
		{
			return false;
		}
	}	
	return true;
}

static int appear_char_count(char* array, int n)
{
	int cnt = 1;
	char ch = array[0];

	for(int i = 1; i < n; i++)
	{
		if(ch != array[i])
		{
			cnt++;
		}
		ch = array[i];
	}
	return cnt;
}

static void swap(char* a, char* b)
{
	char tmp = *a;
	*a = *b;
	*b = tmp;
}

static void bubble_sort(char* array, int n)
{
        for(int sorted_i = 0; sorted_i < n-1; sorted_i++)
        {
                for(int j = n-1; j > sorted_i; j--)
                {
                        if(array[j-1] > array[j])
                        {
                                swap(&array[j-1], &array[j]);
                        }       
                }
        }
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

int main(){
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i = 0; i < h; i++) cin >> s[i];
    int dy[4] = {0,0,1,-1};
    int dx[4] = {-1,1,0,0};
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(s[i][j] == '#'){
                bool ok = false;
                for(int k = 0; k < 4; k++){    
                    if(0 <= dy[k]+i && dy[k]+i < h && 0 <= dx[k]+j && dx[k]+j < w){
                        int y = dy[k]+i;
                        int x = dx[k]+j;
                        if(s[y][x] == '#') ok = true;
                    }
                }
                if(!ok){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
using namespace std;

void dfs(vector<long long> &vec, long long v) {
    if (v > 10000000010) return;
    for (int i = -1; i <= 1; i++) {
        int next = v % 10 + i;
        if (next >= 0 && next < 10) {
            vec.push_back(v * 10 + next);
            dfs(vec, v * 10 + next);
        }
    }
}

int main() {
    int K; cin >> K;
    vector<long long> vec;
    for (int i = 1; i < 10; i++) {
        vec.push_back(i);
        dfs(vec, i);
    }
    sort(vec.begin(), vec.end());
    cout << vec[K - 1] << endl;
}


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

typedef long long ll;

int max(int a, int b){
  if(a > b) return a;
  else return b;
}
int min(int a, int b){
  if(a < b) return a;
  else return b;
}

int sort(const void *a ,const void *b){
  return *(int*)a - *(int*)b;
}
int main(){

  int n,ans;
  scanf("%d",&n);

  printf("%d",n + n*n +n*n*n);

  return 0;
}


Measured memory_bytes: 1732
N, M = map(int,input().split())
H = list(map(int,input().split()))
ans = [0]*N
for _ in range(M):
    A, B = map(int,input().split())
    if H[A-1] >= H[B-1]:
        ans[B-1] = 1
    if H[A-1] <= H[B-1]:
        ans[A-1] = 1
print(ans.count(0))

Measured memory_bytes: 20032
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	N = II()
	ans = 0
	A = LI()
	B = LI()
	C = LI()
	pre = -1
	for a in A:
		if(pre+1 ==a):
			ans += B[a-1]+C[a-2]
		else:
			ans += B[a-1]
		pre = a

	print(ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		int dif = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) != t.charAt(i)) dif++;
		}
		System.out.println(dif);
	}
}


Measured memory_bytes: 41168
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define size(x) int(x.size())
typedef long long ll;
using namespace std;

int main(){
    int N,K; cin >> N >> K;
    double ans = 0;

    cout<<defaultfloat<<setprecision(10);

    for(int i = 1; i<= N;i++){
        
        double tmp = 1.0/N;
        int cnt = i;
        while(cnt<K){
            cnt *= 2;
            tmp /= 2;
        }
        ans += tmp;
    }
   
    cout << fixed << ans <<endl; 
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll a,b,c;
  cin>>a>>b>>c;
  swap(a,b);
  swap(a,c);
  cout<<a<<" "<<b<<" "<<c<<endl;
}



Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

//const int mod = 1000000007;
const int mod = 998244353;

struct mint {
    int64_t x;
    mint(int64_t x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int64_t t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    //for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) {return mint(*this) /= a;}
};

istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    vector<vector<vector<mint> > > dp(c, vector<vector<mint> >(d, vector<mint>(2)));
    dp[a-1][b-1][0] = 1;
    for(int i = a-1; i < c; ++i) {
        for(int j = b-1; j < d; ++j) {
            if(i) {
                dp[i][j][1] += mint(j+1)*(dp[i-1][j][0] + dp[i-1][j][1]);
            }
            if(j) {
                dp[i][j][0] += mint(i+1)*dp[i][j-1][0] + dp[i][j-1][1];
            }
        }
    }

    

    cout << dp[c-1][d-1][0] + dp[c-1][d-1][1] << endl;
}

Measured memory_bytes: 495748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define input(n) scanf("%d",&n)
#define llinput(n) scnaf("%lld",&n)
set<int> snu;
int main()
{
  int n,k;
  cin>>n;
  cin>>k;
  while(k--)
  {
    int temp;
    int a;
    cin>>temp;
    for(int i = 0;i<temp;i++)
   
    {cin>>a;snu.insert(a);}
  }
  cout<<n-(int)snu.size()<<endl;
}


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

int main(void){
    int x = 0, y = 0, z = 0; 
    int ans = 0;

    scanf("%d%d%d", &x, &y, &z);    

    printf("%d\n", (x - z) / (y + z));
    return 0;

} 


Measured memory_bytes: 256
#include <iostream>
using namespace  std;
 
int main () {
  int x[4], y[4];
  cin >> x[0];
  cin >> y[0];
  cin >> x[1];
  cin >> y[1];
 
  int a = x[0] - x[1];
  int b = y[0] - y[1];
 
  x[2] = x[1] + b;
  y[2] = y[1] - a;
 
  x[3] = x[0] + b;
  y[3] = y[0] - a;
 
  cout << x[2] << " ";
  cout << y[2] << " ";
  cout << x[3] << " ";
  cout << y[3] << " ";
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int PAIR[6050];
string dp[6050];

int main() {
    //cout.precision(10);
    int N;
    string S;
    cin >> N >> S;
    S = "#" + S;
    queue<int> a, b;
    for(int i = 1; i <= 2*N; i++) {
        if(S[i] == 'a') a.push(i);
        else b.push(i);
    }
    for(int i = 1; i <= N; i++) {
        int A = a.front();
        int B = b.front();
        a.pop();
        b.pop();
        PAIR[A] = B;
        PAIR[B] = A;
    }
    for(int i = 1; i <= 2*N; i++) {
        //cerr << PAIR[i] << endl;
    }
    for(int index = 2*N; index >= 1; index--) {
        dp[index] = dp[index + 1];
        if(PAIR[index] < index) continue;
        if(S[index] == 'a') {
            string sub = "ab" + dp[PAIR[index] + 1];
            dp[index] = max(dp[index], sub);
            continue;
        }
        if(S[index] == 'b') {
            string sub = "b";
            int plus = 1;
            int sub_index = index + 1;
            for(; plus > 0; sub_index++) {
                if(S[sub_index] == 'b') {
                    sub = sub + "b";
                    plus++;
                    continue;
                }
                if(sub_index < PAIR[index]) continue;
                sub = sub + "a";
                plus--;
            }
            sub = sub + dp[sub_index];
            dp[index] = max(dp[index], sub);
        }
    }
    cout << dp[1] << endl;
    return 0;
}


Measured memory_bytes: 10624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



int main() {
    string s, t;
    cin >> s >> t;
    // cout << s << " " << t << endl;
    vector<string> v;
    rep(i, sz(s)) {
        if (i + sz(t) > sz(s)) break; // 等号入れない
        rep(j, sz(t)) {
            if (s[i + j] != t[j] && s[i + j] != '?') break; // continueにしてた
            // cout << i << " " << j << " " << s[i + j] << " " << t[j] << endl;
            if (j == sz(t) - 1) {
                // cout << i << endl;
                string u = s;
                rep(k, sz(t)) {
                    u[i + k] = t[k];
                }
                rep(k, sz(u)) if (u[k] == '?') u[k] = 'a';
                // cout << u << endl;
                v.eb(u);
            }
        }
    }
    if (sz(v) == 0) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    
    sort(all(v));
    // cout << sz(v) << endl;
    cout << v[0] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>

#define _ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define i64 long long

using namespace std;

string n;
int d;
i64 b = 1, s, ans;
map<i64, i64> f;

int main() {_
  cin >> n;
  reverse(n.begin(), n.end());
  f[0] = 1;
  for(char c : n) {
  	d = c - '0';
    s = (s + d*b)%2019;
    b = 10*b % 2019;
    ans += f[s];
    ++f[s];
  }
  cout << ans << endl;                        
}

Measured memory_bytes: 3296
abcd = list(input())

o = [1, 1, 1]
o2 = []
# print(abcd)
for i in range(2):
    o[0] *= -1
    for j in range(2):
        o[1] *= -1
        for k in range(3):
            o[2] *= -1
            ans = int(abcd[0]) + int(abcd[1])*o[0] + int(abcd[2])*o[1] + int(abcd[3])*o[2]
            # print(ans, i, j, k)
            if ans == 7:
                for l in o:
                    if l > 0:
                        o2.append('+')
                    else:
                        o2.append('-')
                print(abcd[0] + o2[0] + abcd[1] + o2[1] + abcd[2] + o2[2] + abcd[3] + '=7')
                quit()


Measured memory_bytes: 3064
N, P = map(int, input().split())
S = input()

if P == 2 or P == 5:
    cnt = 0

    cnt_a = 0
    for s in S[::-1]:
        if int(s) % P == 0:
            cnt_a += 1

        cnt += cnt_a
else:
    r_lst = [0] * P
    r_lst[0] = 1

    cnt = 0
    num = 0

    for i, s in enumerate(S[::-1]):
        num  = (num + int(s) * pow(10, i, P)) % P
        cnt += r_lst[num]

        r_lst[num] += 1


print(cnt)



Measured memory_bytes: 3500
#include<stdio.h>
int main(){
  
  int x,y,z,kari;
  
  scanf("%d %d %d",&x,&y,&z);
  
  kari = x;
  x = y;
  y = kari;
  
  kari = x;
  x = z;
  z = kari;
  
  printf("%d %d %d",x,y,z);
  
  return 0;

}

Measured memory_bytes: 128
n = int(input())
s = input()
wdp = [0]*n
edp = [0]*n
if s[0] == "E":
    edp[0] = s.count("E")-1
else:
    edp[0] = s.count("E")

for i in range(1, n):
    if "W" == s[i-1]:
        wdp[i] = wdp[i-1]+1
    else:
        wdp[i] = wdp[i-1]
for i in range(1, n):
    if "E" == s[i]:
        edp[i] = edp[i-1]-1
    else:
        edp[i] = edp[i-1]
ans = [wdp[i]+edp[i] for i in range(n)]
print(min(ans))

Measured memory_bytes: 69948