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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

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

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}



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

    map<char,int> mp;
    REP(i,s.size()) mp[s[i]]++;

    int ans = inf;
    for(auto m:mp){
        int pre_i=0;
        int t_ans = 0;
        REP(i,s.size()){
            if(s[i] == m.first){
                chmax(t_ans,i-pre_i);
                pre_i = i + 1;
            }
        }
        chmax(t_ans,(int)s.size()-pre_i);

        //cout << m.first << ":" << t_ans << endl;

        chmin(ans,t_ans);
    }

    pl(ans)

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main()
{
    string a,b;
    cin>>a>>b;
    int c=0;
    for(int i=0;i<a.length();++i)
    {
        if(a[i]!=b[i])
        ++c;
    }
    cout<<c;
}

Measured memory_bytes: 3852
#include <iostream>
using namespace std;
int main(void)
{
	int a,b,c,d,tol,x,y;
	cin >> a >> b >> c >> d;
	tol=a+b+c+d;
	x=tol/60;
	y=tol%60;
	cout << x << "\n" << y << endl;
	
	return 0;
}

Measured memory_bytes: 3076
mod = 1000000007

N, M = [int(i) for i in input().split()]
A = [-1] + [int(input()) for _ in range(M)] + [N + 1]

for i in range(len(A) - 1):
    if A[i] + 1 == A[i + 1]:
        print(0)
        quit()

fib = [-1] * (N + 1)
fib[0] = 1
fib[1] = 1
for i in range(2, len(fib)):
    fib[i] = fib[i - 1] + fib[i - 2]

ans = 1
for i in range(1, len(A)):
    f = fib[A[i] - A[i - 1] - 2]
    ans = (ans * f) % mod
print(ans)

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 n, a[101];
void solve(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a,a+n);
	
	i64 cnt = 0;
	for(int i = 0; i < n; i++){
		for(int j = i+1; j < n; j++){
			for(int k = j+1; k < n; k++){
				if(a[i] == a[j] || a[j] == a[k]) continue;
				if(a[k] < a[i]+a[j]){
					cnt++;
				}
			}
		}
	}
	cout << cnt << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3656
#include <stdio.h>

#define f(n) (1 <= (n) && (n) <= 12)

int main(void)
{
  int y, m;
  scanf("%2d%2d", &y, &m);
  char *s[] = {"NA", "YYMM", "MMYY", "AMBIGUOUS"};
  puts(s[f(y) * 2 + f(m)]);
}


Measured memory_bytes: 128
import java.util.Scanner;

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

		int n = sc.nextInt();
		int[] p = new int[n];

		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}

		int cnt = 0;
		for (int i = 1; i < n - 1; i++) {
			if (isBSecond(p[i - 1], p[i], p[i + 1]))
				cnt++;
		}

		System.out.println(cnt);

		sc.close();
	}

	static boolean isBSecond(int a, int b, int c) {
		if (a >= b) {
			if (b >= c) {
				return true;
			}
		} else {
			if (c >= b) {
				return true;
			}
		}

		return false;
	}

}


Measured memory_bytes: 21844
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = int;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1<<30;
const double pi=acos(-1.0);

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

ll H,W;
vector<string> grid;

bool movable(ll gx,ll gy){
  if(gx<0||gx>=W||gy<0||gy>=H) return false;
  if(grid[gy][gx]=='#') return false;
  
  return true;
}
  
int main()
{
  cin>>H>>W;
  ll sy,sx; cin>>sy>>sx; sx--; sy--;
  ll gy,gx; cin>>gy>>gx; gx--; gy--;
  grid=vector<string>(H); rep(i,H) cin>>grid[i];
  
  //bfs
  deque<pair<ll,ll>> que;
  vector<vector<ll>> dp(H,vector<ll>(W,INF));
  
  que.push_front({sx,sy}); dp[sy][sx]=0;
  
  vector<ll> dx={-1,0,1,0};
  vector<ll> dy={0,-1,0,1};
  while(!que.empty()){
    auto v=que.front(); que.pop_front();
    ll vx,vy; tie(vx,vy)=v;
    rep(i,4){
      if(movable(vx+dx[i],vy+dy[i])&&chmin(dp[vy+dy[i]][vx+dx[i]],dp[vy][vx])){
        que.push_front({vx+dx[i],vy+dy[i]});
      }
    }
    if(movable(vx+dx[0],vy+dy[0])&&movable(vx+dx[1],vy+dy[1])&&movable(vx+dx[2],vy+dy[2])&&movable(vx+dx[3],vy+dy[3])) continue;
    rep(i,3){
      rep(j,3){
        if(abs(i)+abs(j)<=1) continue;
        if(movable(vx+i,vy+j)&&chmin(dp[vy+j][vx+i],dp[vy][vx]+1)) que.push_back({vx+i,vy+j});
        if(movable(vx-i,vy+j)&&chmin(dp[vy+j][vx-i],dp[vy][vx]+1)) que.push_back({vx-i,vy+j});
        if(movable(vx+i,vy-j)&&chmin(dp[vy-j][vx+i],dp[vy][vx]+1)) que.push_back({vx+i,vy-j});
        if(movable(vx-i,vy-j)&&chmin(dp[vy-j][vx-i],dp[vy][vx]+1)) que.push_back({vx-i,vy-j});
      }
    }
  }
  
  if(dp[gy][gx]==INF) cout<<-1<<endl;
  else cout<<dp[gy][gx]<<endl;
  return 0;
}


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

int main()
{
    int H, W;
    cin >> H >> W;
    char grid[H][W];
    int black_num = 0;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            cin >> grid[i][j];
            if (grid[i][j] == '#')
            {
                ++black_num;
            }
        }
    }
    vector<vector<int>> dist(H, vector<int>(W, -1));
    queue<pair<int, int>> q;
    q.push(make_pair(0, 0));
    dist[0][0] = 1;
    while (!q.empty())
    {
        pair<int, int> p = q.front();
        q.pop();
        int dh[4] = {0, 0, -1, 1};
        int dw[4] = {1, -1, 0, 0};
        for (int i = 0; i < 4; i++)
        {
            int hh = p.first + dh[i];
            int ww = p.second + dw[i];
            if (hh < 0 || hh >= H || ww < 0 || ww >= W)
            {
                continue;
            }
            if (grid[hh][ww] == '#')
            {
                continue;
            }
            if (dist[hh][ww] != -1)
            {
                continue;
            }
            dist[hh][ww] = dist[p.first][p.second] + 1;
            q.push(make_pair(hh, ww));
        }
    }
    int ans = dist[H - 1][W - 1];
    if (ans == -1)
    {
        cout << "-1" << endl;
    }
    else
    {
        cout << H * W - ans - black_num << endl;
    }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
 
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    ans = 0
    N = max(a)+1
    tab = [1 for _ in range(N)]
    for i in range(n):
        x = a[i]
        if i < n-1 and a[i] == a[i+1]:
            tab[a[i]] = 0
        if tab[x]:
            ans += 1
        for i in range(N):
            if x*i >= N:
                break
            tab[x*i] = 0        
    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 157424
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define p_yes() p("YES")
#define p_no() p("NO")
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;
const double PI = acos(-1);

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

    // input
    ll N; 
    cin >> N;

    ll ans;
    if(N%2==0){
      ans = N/2 - 1; 
    }else{
      ans = N/2;
    }
    p(ans);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;
const double PI = acos(-1);

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int a,b;cin>>a>>b;
    cout << a*b<<endl;
	return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <unordered_map>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int n, m;
int a[300][300];
int c[300];
int d[300];

P hoge() {
    REP(i,m) {
        d[i] = 0;
    }
    REP(i,n) {
        REP(j,m) {
            if (c[a[i][j]]) {
                d[a[i][j]]++;
                break;
            }
        }
    }
    long mv = 0, mi;
    REP(i,m) {
        if (d[i] > mv) {
            mv = d[i];
            mi = i;
        }
    }
    return P(mv,mi);
}

int main() {
    cin >> n >> m;
    REP(i,n) {
        REP(j,m) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    
    REP(i,m) {
        c[i] = 1;
    }
    
    if (m == 1) {
        cout << n << endl;
        return 0;
    }
    
    long ans = 1e9;
    REP(i,m-1) {
        P p = hoge();
        if (p.first < ans) {
            ans = p.first;
        }
        c[p.second] = 0;
    }
    
    cout << ans << endl;
}


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

#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define INF  (1<<30)
#define INFL (1LL<<60)
#define MOD 998244353
#define EPS ((ld)(1e-9))

#define sz(x) ((int)(x).size())
#define setz(x) memset(x, 0, sizeof(x))
#define rep(i, x)  for (int i = 0, _##i = (x); i < _##i; i++)
#define repp(i, x) for (int i = 1, _##i = (x); i <= _##i; i++)
#define repr(i, s, e) for (int i = (s), _##i = (e); i < _##i; i++)
#define repi(i, x) for (auto &i : (x))

#ifndef __SOULTCH
#define endl '\n'
#define debug(...) 
#else
#define __debug_a(v) cout << " [+] " << #v << " = " << (v) << endl
#define __debug_b(v) cout << "     " << #v << " = " << (v) << endl
#define debug1(v1) __debug_a(v1);
#define debug2(v1, v2) __debug_a(v1), __debug_b(v2);
#define debug3(v1, v2, v3) __debug_a(v1), __debug_b(v2), __debug_b(v3);
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define debug(...) GET_MACRO(__VA_ARGS__, debug3, debug2, debug1)(__VA_ARGS__)
#endif

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;
typedef pair<ll, ll> pll;

template<typename T, typename V>
ostream &operator<<(ostream &os, const pair<T, V> pai) { 
    return os << pai.first << ' ' << pai.second;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> v) {
    rep(i, sz(v)) cout << v[i] << ' ';
    return os;
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> s) {
    for (T p : s) cout << p << ' ';
    return os;
}

template<typename T, typename V>
ostream &operator<<(ostream &os, const map<T, V> s) {
    for (auto p : s) cout << '(' << p << ") ";
    return os;
}

template<typename T, typename V>
istream &operator>>(istream &is, pair<T, V> &pai) {
	is >> pai.first >> pai.second;
	return is;
}

template<typename T> void umax(T &a, T b) {a = max(a, b);}
template<typename T> void umin(T &a, T b) {a = min(a, b);}

int H, W;
int dist[1000][1000];

int x[] = {0, 0, -1, 1};
int y[] = {1, -1, 0, 0};

int bound(int a, int b) {
    return 0 <= a and a < H and 0 <= b and b < W;
}

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    cin >> H >> W;
    queue<pii> q;

    rep(i, H) {
        string s; cin >> s;
        rep(j, sz(s)) {
            if (s[j] == '#') {
                dist[i][j] = 0;
                q.push(mp(i, j));
            } else {
                dist[i][j] = INF;
            }
        }
    }

    int mv = 0;

    while (!q.empty()) {
        pii t = q.front(); q.pop();
        rep(i, 4) {
            int cx = t.fi+x[i], cy = t.se+y[i];
            if (bound(cx, cy) and dist[cx][cy] == INF) {
                dist[cx][cy] = dist[t.fi][t.se]+1;
                q.push(mp(cx, cy));
                umax(mv, dist[cx][cy]);
            }
        }
    }

    cout << mv << endl;
}

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

ll dp[101][4][2]; // dp[上からi桁][何個0以外があるか][ smaller ]
string n;
ll k;

void init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n;
    cin >> k;
    dp[0][0][0] = 1LL;
    rep(i,n.size()) dp[i+1][0][1] = 1LL;
}

void solve(){
    
    // 最大桁数の計算
    for(int i = 0; i < n.size(); ++i){
        rep(j,k){
            if(n[i] == '0'){ 
                dp[i+1][j+1][1] = dp[i][j][1]*9 + dp[i][j+1][1];
                dp[i+1][j+1][0] = dp[i][j+1][0];
            }else{
                dp[i+1][j+1][1] = dp[i][j][1]*9 + dp[i][j][0]*(n[i]-'0'-1) + dp[i][j+1][1] + dp[i][j+1][0];
                dp[i+1][j+1][0] = dp[i][j][0];
            }
        }
    }

    // 出力
    cout << dp[n.size()][k][0] + dp[n.size()][k][1] << endl;
}

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

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

#define int long long int

const int mod = 1000000007;

int32_t main()
{
    int n;
    cin>>n;
    vector<int> arr(n+1, 0);
    for(int i=1;i<n+1;i++)
    {
        cin>>arr[i];
    }

    int minm_so_far = arr[1];
    int cnt = 0;
    for(int i=1;i<n+1;i++)
    {
        if(minm_so_far >= arr[i])
        {
            cnt++;
            minm_so_far = arr[i];
        }
    }
    cout<<cnt;
    return 0;
}


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

int main(){

	int N;
	scanf("%d", &N);

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

	int ans=0;

	for( int j=0; j<N-1; j++ ){
		for( int k=j+1; k<N; k++ ){
			ans += d[j]*d[k];
		}
	}

	printf("%d", ans);

	return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    int count = 0;
    if (N >= 2) {
        count += N*(N-1)/2;
    }
    if (M >= 2) {
        count += M*(M-1)/2;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 100000

int binarySearch(int [], int, int [], int);

int main(){

  int n,m,i,j,a[N],b[N],c;

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

  scanf("%d",&m);

  for(j=0;j<m;j++){
    scanf("%d",&b[j]);
  }
  c=binarySearch(a,n,b,m);

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

int binarySearch(int *S,int n,int *key,int m){
  int c=0,left,right,mid,i;
  for(i=0;i<m;i++){
    left=0;
    right = n;
    while(left < right){
      mid = (left + right) / 2;  
      if(S[mid]==key[i]){	
	c++;
	break;
      }
 
      else if(S[mid]>key[i]){
	right=mid;
      }
      else if(S[mid]<key[i]){
	left=mid+1;
      }   
    }
  }   
  return c;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
void print(int mask,int to){
	for(int i=0;i<10;i++){
		if((mask>>i)&1)cout << 1;
		else cout << 0;
	}
	cout << ' ' << to << endl;
}
struct Data{
	int mask;
	int want;
	Data(){}
	Data(int mask,int want):mask(mask),want(want){}
};
int N;
string S;
vector<Data> vec;
bool used[12];
bool f[1<<10][10];
bool solve() {	
	cin >> N;
	if(N==0)return false;
	cin >> S;
	memset(f,false,sizeof(f));
	vec.clear();
	memset(used,false,sizeof(used));
	int mask = 0;
	for(int i=0;i<N;i++){
		if(S[i]=='u'){
			mask = 0;
			memset(used,false,sizeof(used));
		}else{
			int idx = S[i]-'0';
			if((mask>>idx)&1){
				cout << "UNSAFE" << endl;
				return true;
			}
			if(mask!=0&&!f[mask][idx]){
				vec.pb(Data(mask,idx));
				f[mask][idx]=true;
				//print(mask,idx);
			}
			mask |= (1<<idx);
		}
	}
	int pre = 0;
	while(1){
		int cnt=0;
		int cur_size = vec.size();
		for(int i=0;i<cur_size;i++){
			for(int j=((i<pre)?pre:0);j<cur_size;j++){
				if((vec[i].mask&vec[j].mask)!=0)continue;
				if((vec[j].mask>>vec[i].want)&1){
					int nmask = vec[j].mask|vec[i].mask;
					int nwant = vec[j].want;
					if(!f[nmask][nwant]){
						vec.pb(Data(nmask,nwant));
						f[nmask][nwant]=true;
						cnt++;
						//print(nmask,nwant);
					}
				}
			}
		}
		pre = cur_size;
		if(cnt==0)break;
	}
	for(int i=0;i<vec.size();i++){
		if((vec[i].mask>>vec[i].want)&1){
			cout << "UNSAFE" << endl;
			return true;
		}
	}
	cout << "SAFE" << endl;
	return true;
}

int main() {
	while (solve());
	return 0;
}


Measured memory_bytes: 3280
using namespace std;

#include <cstdio>
#include <cstdint>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

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

    string      S;
    string      ans;
    cin >> S;
    if(S == "ABC"){
        ans = "ARC";
    }else{
        ans = "ABC";
    }
    cout << ans << "\n";
    return 0;
    
}

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

template<int mod>
struct ModInt{
	int x;

	ModInt() : x(0){}
	ModInt(long long y) : x(y>=0 ? y%mod : (mod-(-y)%mod)){}

	ModInt &operator+=(const ModInt &p){
		if((x+=p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator-=(const ModInt &p){
		if((x+=mod-p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator*=(const ModInt &p){
		x=(int)(1LL*x*p.x%mod);
		return *this;
	}
	ModInt &operator/=(const ModInt &p){
		*this*=p.inverse();
		return *this;
	}

	ModInt operator-() const{return ModInt(-x);}
	ModInt operator+(const ModInt &p) const{return ModInt (*this)+=p;}
	ModInt operator-(const ModInt &p) const{return ModInt (*this)-=p;}
	ModInt operator*(const ModInt &p) const{return ModInt (*this)*=p;}
	ModInt operator/(const ModInt &p) const{return ModInt (*this)/=p;}
	bool operator==(const ModInt &p) const{return x==p.x;}
	bool operator!=(const ModInt &p) const{return x!=p.x;}
	friend ostream &operator<<(ostream &os, const ModInt &p){return os<<p.x;}
	friend istream &operator>>(istream &is,ModInt &a){
		int t;
		is>>t;
		a=ModInt<mod>(t);
		return (is);
	}

	ModInt inverse() const{
		int a=x, b=mod, u=1, v=0, t;
		while(b>0){
			t=a/b;
			a-=t*b;
			swap(a,b);
			u-=t*v;
			swap(u,v);
		}
		return ModInt(u);
	}
	
	ModInt pow(int e) const{
		long long a=1,p=x;
		while(e>0){
			if(e%2==0){p=(p*p)%mod; e/=2;}
			else {a=(a*p)%mod; e--;}
		}
		return ModInt(a);
	}
};

using modint = ModInt<1000000007>;

vector<int> era(int N){
	vector<int> is_prime(N+1,1);
	is_prime[0]=0;
	is_prime[1]=0;
	for(int p=2;p*p<=N;p++){
		if(!is_prime[p])continue;
		for(int i=p*2;i<=N;i+=p)is_prime[i]=0;
	}
	return is_prime;
}

signed main(){
	int N; cin>>N;
	map<int,modint> fact;
	vector<int> pri=era(N);
	vector<int>prime;
	for(int i=0;i<pri.size();i++){
		if(pri[i]==1)prime.push_back(i);
	}

	for(int i=2;i<=N;i++){
		for(auto p : prime){
			if(p>i || p==0)continue;
		
			int tmp=i;
			while(tmp%p==0){
				fact[p]+=1;
				tmp/=p;
			}
			
		}
	}

	modint ans=1;
	for(auto p : fact){
		//cout<<p.first<<"^"<<p.second<<endl;
		ans*=(p.second+1);
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(void) {
    int a, b, ans;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b;
    if (a >= 13) {
        ans = b;
    } else if (a >= 6) {
        ans = b / 2;
    } else {
        ans = 0;
    }

    cout << ans << "\n";
    return 0;
}

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

int main(){
	int a, b, c;
	int sum = 0;
	cin >> a >> b >> c;
	
	for ( int i = a; i <= b; i++ ){
		if ( c % i == 0 ){
			sum += 1;
		}
	}
	cout << sum << endl;

return 0;
}



Measured memory_bytes: 3136
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define vi vector<int>
#define vvi vector<vi>

#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

const ll mod = 1e9 + 7;
const ll IMF = 1LL<<29;
const double PI = 3.14159265358979323846;

struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};

mint dp0[2005][2005];
mint dp1[2005][2005];

int main(){
        int n,m;
        cin >> n >> m;
        vi s(n+1), t(m+1);
        rep(i,n) scanf("%d", &s[i]);
        rep(i,m) scanf("%d", &t[i]);
        dp0[0][0] = 1;
        rep(i,n+1)rep(j,m+1){
                dp0[i+1][j] += dp0[i][j];
                dp1[i][j] += dp0[i][j];
                dp1[i][j+1] += dp1[i][j];

                if(s[i] == t[j]){
                        dp0[i+1][j+1] += dp1[i][j];
                }
        }

        mint ans = dp1[n][m];

        cout << ans.x << endl;


}












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

struct C{ double x,y,z,r; };

double abs(C a,C b){
    double d = sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2)+pow(a.z-b.z,2));
    return max(d-(a.r+b.r),0.0);
}

struct UnionFind{
    vector<int> par;
    vector<int> sizes;
    UnionFind(int n):par(n),sizes(n,1){ rep(i,n)par[i]=i; }

    //find root of x
    int find(int x){
        if(x!=par[x]) par[x] = find(par[x]);
        return par[x];
    }

    void unite(int x,int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
    }

    bool same(int x,int y){ return find(x) == find(y); }
    int size(int x){ return sizes[find(x)]; }
};

int main(void){
    int n;
    while(cin>>n, n){
        vector<C> cs(n);
        rep(i,n){
            double x,y,z,r;
            cin>>x>>y>>z>>r;
            cs[i] = {x,y,z,r};
        }

        using P = pair<double,pair<int,int>>;
        priority_queue<P,vector<P>,greater<P>> pq;
        rep(i,n)rep(j,i) {
            pq.push({abs(cs[i],cs[j]), {i,j}});
        }
        UnionFind uf(n);
        double cost = 0;
        while(pq.size()){
            P p = pq.top(); pq.pop();
            double d = p.first;
            int a = p.second.first;
            int b = p.second.second;
            if(!uf.same(a,b)){
                uf.unite(a,b);
                cost += d;
            }
        }
        printf("%.3f\n",cost);
    }
    return 0;
}



Measured memory_bytes: 3200
#include <cstdint>
#include <iostream>

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

} // namespace null_null

#include <vector>

namespace null_null {

void main_() {
  i32 N;
  std::cin>>N;

  std::vector<i32>A(N),B(N),C(N-1);
  for(usize i=0;i<N;i++){
    std::cin>>A[i];
  }
  for(usize i=0;i<N;i++){
    std::cin>>B[i];
  }
  for(usize i=0;i<N-1;i++){
    std::cin>>C[i];
  }

  i32 ans=0;
  for(usize i=0;i<N;i++){
    ans+=B[i];
  }
  for(usize i=0;i<N-1;i++){
    if(A[i+1]-A[i]==1){
      ans+=C[A[i]-1];
    }
  }

  std::cout<<ans<<std::endl;
}

} // namespace null_null

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  null_null::main_();
  return 0;
}

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

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var A = n[0];
            var B = n[1];
            var K = n[2];
            var number = new List<int>();

            for(var i=1; i<=A; ++i)
            {
                if (A % i == 0 && B % i == 0)
                    number.Add(i);
                
            }
            number.Sort();
            number.Reverse();
            Console.WriteLine(number[K - 1]);
        }
        
    }
}


Measured memory_bytes: 13268
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
d=[1]*(n+1)
for i in range(m):
  d[a[i]]=0
for i in range(2,n+1):
  if d[i]!=0:
    d[i]=d[i-1]+d[i-2]
print(d[n]%(10**9+7))

Measured memory_bytes: 465924
#include<iostream>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  int n,m; cin >>n >>m;
  int h=n%2?n:n/4;
  h=min(h,m);
  rep(i,h){
    print(i+1,n-i);
  }
  h=m-h;
  h=max(0,h);
  rep(i,h){
    print(n/2-i-1,n/2+i+1);
  }
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int n,k,u,hsh[15],num,cnt;
string s;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++)
	{
		scanf("%d",&num);
		++hsh[num];
	}
	for(int i=n;;i++)
	{
		u=i;
		s=to_string(u);
		cnt=0;
		for(int j=0;j<s.size();j++)
		{
			if(hsh[s[j]-48]==0)
			{
				++cnt;
			}
		}
		if(cnt==s.size())
		{
			printf("%d",u);
			break;
		}
	}
}

Measured memory_bytes: 3756
#include<iostream>
using namespace std;
int N;
double gailv;
int main() {
	double jishu;
	scanf("%d",&N);
	if(N%2==0)
	jishu=N/2*1.0;
	else
	jishu=(N+1)/2*1.0;
	gailv=jishu/N*1.0;
	printf("%.10f\n",gailv);
	return 0;
}

Measured memory_bytes: 256
A = [int(i) for i in input().split()]
maxA = max(A)
minA = min(A)
midA = sum(A) - maxA - minA

count = maxA - midA
minA += count

while maxA - minA > 1:
    count += 1
    minA += 2
if maxA - minA == 1:
    count += 2
    
print(count)

Measured memory_bytes: 3060
def main():
    import sys
    from collections import deque

    def input(): return sys.stdin.readline().rstrip()

    def bfs(si, sj):
        di = [-1, 0, 1, 0]
        dj = [0, 1, 0, -1]
        que = deque([(si, sj)])
        dist[0][0] = 0
        while que:
            i, j = que.popleft()
            for k in range(4):
                ni = i+di[k]
                nj = j+dj[k]
                if (ni < 0 or ni >= h or nj < 0 or nj >= w):
                    continue
                if g[ni][nj] == '#':
                    continue
                if dist[ni][nj] > dist[i][j]+1:
                    dist[ni][nj] = dist[i][j]+1
                    que.append((ni, nj))
        

    h, w = map(int, input().split())
    g = []
    cnt = 0
    for i in range(h):
        g.append(input())
        cnt += g[-1].count('#')
    inf = 10**6
    dist = [[inf]*w for _ in range(h)]

    bfs(0, 0)
    if dist[-1][-1] == inf:
        print(-1)
    else:
        ans = h*w-cnt-dist[-1][-1]-1
        print(ans)

if __name__ == '__main__':
    main()

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

int main(void) {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; ++ i) {
        cin >> p[i];
    }

    long long ans = p[0] - 1, cc = 2;
    for (int i = 1; i < n; ++ i) {
        ans += p[i] / cc;
        if (p[i] % cc == 0) {
            -- ans;
        }
        if (p[i] == cc) ++ cc;
    }
    cout << ans << endl;

    return 0;
}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        ll N, C; cin >> N >> C;

        vector<ll> X(N), V(N);
        rep(i, N) cin >> X[i] >> V[i];

        vector<ll> left(N + 1);
        vector<ll> right(N + 1);
        vector<ll> max_l(N + 1), max_r(N + 1);
        rep(i, N) {
            right[i + 1] = right[i] + V[i] - X[i] + (i > 0 ? X[i - 1] : 0);
            left[i + 1] = left[i] + V[N - i - 1] - (C - X[N - i - 1]) + (i > 0 ? C - X[N - i] : 0);
            max_l[i + 1] = max(max_l[i], left[i + 1]);
            max_r[i + 1] = max(max_r[i], right[i + 1]);
        }

        ll ans = max(max_l[N], max_r[N]);
        rep(i, N) {
            set_max(ans, max_l[N - i - 1] + right[i + 1] - X[i]);
            set_max(ans, max_r[N - i - 1] + left[i + 1] - (C - X[N - i - 1]));
        }
        cout << ans << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 6272
#include <stdio.h>
#include <queue>

int N,M;
std::priority_queue<int> pq;

int main()
{
	int i;
	scanf("%d %d", &N, &M);

	for (i = 0; i < N; i++) {
		int x;
		scanf("%d", &x);
		pq.push(x);
	}

	for (i = 0; i < M; i++) {
		int price = pq.top();
		pq.pop();
		price /= 2;
		pq.push(price);
	}
	long long sum = 0;

	for (i = 0; i < N; i++) {
		sum += pq.top();
		pq.pop();
	}

	printf("%lld\n", sum);

	return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	string a,b="abc";
	cin>>a;
	Sort(a);
	if(a==b)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main()
{
	cin>>a>>b;
	int money = a/0.08;
	if((int)(money*0.08) != a) money++;
	while((int)(money*0.1)<=b&&(int)(money*0.08)==a)
	{
		if((int)(money*0.1) == b)
		{
			cout<<money;
			return 0; 
		}
		money ++;
	}
	cout<<-1;
	return 0;	
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
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...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int x,k,d;cin >> x >> k >> d;
	// x = abs(x);
	
	if(x >= 0){
		int pos = min(x/d,k);
		x -= pos*d;
		k -= pos;
		if(k%2 == 0)cout << abs(x) << endl;
		else cout << abs(x-d) << endl;
	}
	else{
		int pos = min(-x/d,k);
		x += pos*d;
		k -= pos;
		if(k%2 == 0)cout << abs(x) << endl;
		else cout << abs(x+d) << endl;
		
	}

	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main(void){
    double r;
    cin >> r;
    
    cout << fixed << setprecision(6) << r * r * M_PI << " " << 2 * r * M_PI << endl;
    
    return 0;
}

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

using namespace std;

vector<int> num;

int main() {
	
	int n;
	
	while( cin >> n) {
		
		int A[3];
		num.clear();
		
		if( n == 2) {
			
			cin >> A[0] >> A[1];
			sort(A, A+2);
			
			for(int i=1;i<=A[0];i++)
			if( A[0] % i == 0 && A[1] % i == 0)
			num.push_back(i);
			
		}
		else {
			
			cin >> A[0] >> A[1] >> A[2] ;
			sort(A, A+3);
			
			for(int i=1;i<=A[0];i++)
			if( A[0] % i == 0 && A[1] % i == 0 && A[2] % i == 0)
			num.push_back(i);
			
		}
		
	for(int i=0;i<num.size();i++)
	cout << num[i] << "\n";	
	}
	
	return 0;
}



Measured memory_bytes: 3136
import Foundation

var O = readLine()!.characters
var E = readLine()!.characters

var r: String = ""

while true {
    guard let o = O.popFirst() else {
        break
    }
    r.append(o)
    guard let e = E.popFirst() else {
        break
    }
    r.append(e)
}

print(r)

Measured memory_bytes: 1920
I=float('inf')
for e in iter(input,'0 0'):
 n,k=map(int,e.split())
 F=[[I]*-~n for _ in[0]*-~n]
 for i in range(1,n+1):F[i][i]=0
 for _ in[0]*k:
  f=input();g=map(int,f[2:].split())
  if'0'==f[0]:a,b=g;A=F[a][b];print([A,-1][A==I])
  else:
   c,d,e=g
   if e<F[c][d]:
    for i in range(2,n+1):
     for j in range(1,i):
      F[i][j]=min(F[i][j],F[i][c]+e+F[d][j],F[i][d]+e+F[c][j])
    for j in range(2,n+1):
     for i in range(1,j):
      F[i][j]=F[j][i]


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

using namespace std;

#pragma GCC optimize("O3")
static const auto __ = [] {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  return nullptr;
}();

constexpr int MOD {1000000007};
int DP[1000][1000];

int solve(int R, int C) {
  for (int r {0}; r < R; ++r) {
    for (int c {0}; c < C; ++c) {
      char cell;
      cin >> cell;
      DP[r][c] = (cell == '#' ? -1 : 0);
    }
  }
  DP[0][0] = 1;
  for (int r {0}; r < R; ++r) {
    for (int c {0}; c < C; ++c) {
      if (DP[r][c] == -1) {
        continue;
      }
      if (r && DP[r - 1][c] != -1) {
        DP[r][c] += DP[r - 1][c];
      }
      if (c && DP[r][c - 1] != -1) {
        DP[r][c] += DP[r][c - 1];
      }
      DP[r][c] %= MOD;
    }
  }
  return DP[R - 1][C - 1];  
}

int main(int argc, char* argv[]) {
  int R, C;
  cin >> R >> C;
  cout << solve(R, C) << '\n';
  return 0;
}

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

using namespace std;

int main(){
    string s;
    bool flag=true;
    cin>>s;
    for(int i=0; i<s.size(); i++){
        if(i%2==0){
            if(s[i]!='R' && s[i]!='U' && s[i]!='D'){
                //cout<<i<<endl;
                flag=false;
            }
        }else{
            if(s[i]!='L' && s[i]!='U' && s[i]!='D'){
                //cout<<i<<endl;
                flag=false;
            }
        }
    }
    if(flag){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
n,k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
g = a[0]
for i in 1..n-1
  g = g.gcd(a[i])
end
for i in 0..n-1
  if a[i] >= k && (a[i]-k)%g == 0
    puts "POSSIBLE"
    exit
  end
end
puts "IMPOSSIBLE"

Measured memory_bytes: 9476
#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 h,r;
    cin >> h >> r;
    if(h+r<0)cout << -1 << endl;
    else if(h+r==0)cout << 0 << endl;
    else cout << 1 << endl;
}



Measured memory_bytes: 3084
#include "iostream"

using namespace std;
typedef long long ll;

int main()
{
  int n;
  cin >> n;
  string a, b, c;
  cin >> a >> b >> c;
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    char x = a.at(i);
    char y = b.at(i);
    char z = c.at(i);
    if (x != y && y != z && z != x)
    {
      ans += 2;
    }
    else
    if ((x == y && x != z) || (y == z && y != x) || (z == x && z != y))
    {
      ans++;
    }
  }
  cout << ans << "\n";
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


MOD = 1000000007  # type: int


def solve(N: int, S: "List[str]"):
    ans = 1
    pdtype = 0
    i = 0
    while i < N:
        dtype = 2 if S[0][i] != S[1][i] else 1
        ans = {
            (0, 1): lambda: 3,
            (0, 2): lambda: 6,
            (1, 1): lambda: ans * 2,
            (1, 2): lambda: ans * 2,
            (2, 1): lambda: ans,
            (2, 2): lambda: ans * 3,
        }[pdtype, dtype]() % MOD
        i += dtype
        pdtype = dtype
    print(ans)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(2)]  # type: "List[str]"
    solve(N, S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188