akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long int lli;
const lli mod = 1e9 +7;
typedef pair<lli, lli> pll;
const lli inf = 1e18;
const char dir[5] = "RULD";
const double dd[4] = {1, 1, -1, -1};
const double EPS = 1e-8;

int main(){
    int n;
    cin >> n;
    vector<vector<lli> > osmm(4, vector<lli>{inf, -inf});
    vector<vector<lli> > osmx(2, vector<lli>{inf, -inf});
    for(int i=0; i<n; i++){
        lli x,y;
        char d;
        cin >> x >> y >> d;
        for(int j=0; j<4; j++){
            if(d == dir[j]){
                if(j%2 == 0){
                    //lr
                    osmm[j][0] = min(osmm[j][0], x);
                    osmm[j][1] = max(osmm[j][1], x);
                    osmx[(j+1)%2][0] = min(osmx[(j+1)%2][0], y);
                    osmx[(j+1)%2][1] = max(osmx[(j+1)%2][1], y);
                }else{
                    //ud
                    osmm[j][0] = min(osmm[j][0], y);
                    osmm[j][1] = max(osmm[j][1], y);
                    osmx[(j+1)%2][0] = min(osmx[(j+1)%2][0], x);
                    osmx[(j+1)%2][1] = max(osmx[(j+1)%2][1], x);
                }
            }
        }
    }
    vector<double> tcand(1, 0);
    //進行方向
    for(int i=0; i<4; i++){
        if(osmm[i][0] == inf) continue;
        //逆
        if(osmm[(i+2)%4][0] != inf){
            for(int j=0; j<2; j++){
                for(int k=0; k<2; k++){
                    double d = abs(osmm[i][j] -osmm[(i+2)%4][k]);
                    tcand.push_back(d/2);
                }
            }
        }
        //固定
        if(osmx[i%2][0] != inf){
            for(int j=0; j<2; j++){
                for(int k=0; k<2; k++){
                    double d = abs(osmm[i][j] -osmx[i%2][k]);
                    tcand.push_back(d);
                }
            }
        }
    }
    //cout << osmx[1][0] << " " << osmx[1][1] << endl << endl;
    double ans = inf;
    for(double t: tcand){
        vector<double> x;
        vector<double> y;
        for(int i=0; i<4; i++){
            if(osmm[i][0] == inf) continue;
            if(i%2 == 0){
                x.push_back(osmm[i][0] +dd[i]*t);
                x.push_back(osmm[i][1] +dd[i]*t);
            }else{
                y.push_back(osmm[i][0] +dd[i]*t);
                y.push_back(osmm[i][1] +dd[i]*t);
            }
        }
        //cout << t << endl;
        if(osmx[0][0] != inf){
            x.push_back(osmx[0][0]);
            x.push_back(osmx[0][1]);
        }
        if(osmx[1][0] != inf){
            y.push_back(osmx[1][0]);
            y.push_back(osmx[1][1]);
        }
        sort(x.begin(), x.end());
        sort(y.begin(), y.end());
        /*
        for(double xx: x){
            cout << xx << endl;
        }
        cout << endl;
        for(double yy: y){
            cout << yy << endl;

        }
        */
        ans = min(ans, (x.back()-x[0])*(y.back()-y[0]));
    }
    if(abs(ans) < EPS) ans = 0;
    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long N;cin>>N;
    long long A[N+1];
    for(long long i=1;i<=N;i++){
        cin>>A[i];
    }
    long long ans=0;
    vector<long long>P(N+1);
    for(long long i=1;i<=N;i++){
        if(A[A[i]]==i){
            ans++;
        }
    }
    ans/=2;
    cout<<ans<<endl;
    return 0;
}


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

int main(){
    string s;
    cin>>s;
    string w[3]={"Sunny","Cloudy","Rainy"};
    if(s==w[0]){
        cout<<w[1]<<endl;
    }else if(s==w[1]){
        cout<<w[2]<<endl;
    }else if(s==w[2]){
        cout<<w[0]<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

int main(){
  char b;
  cin >> b;

  if(b=='A')  cout << 'T' << endl;
  if(b=='T')  cout << 'A' << endl;
  if(b=='G')  cout << 'C' << endl;
  if(b=='C')  cout << 'G' << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    char a;
    cin >> a;
    int n = a - 'a';
    if(n >= 0 && n < 26){
    	cout <<"a" << endl; 
    }else{
    	cout << "A" << endl;
    }
    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define int long long int
#define F first
#define S second
#define MP make_pair
using namespace std;
typedef pair<int, int> PII;
typedef pair<int, PII> PIP;

int n;
PII ab[300010];
priority_queue<PIP> q;
int ans = 0;

struct segtree
{
  int tree[1048576];
  int size;

  void reset(){
    size = 1;
    while(size < n + 1){
      size <<= 1;
    }
  }

  void add(int where, int value){
    int now = size - 1 + where;
    while(true){
      tree[now] += value;
      if(now == 0){
	break;
      }
      now = (now - 1) / 2;
    }
  }

  int sum(int end, int left, int right, int now){
    if(end < left){
      return 0;
    }
    else if(right <= end){
      return tree[now];
    }
    else{
      return sum(end, left, (left + right) / 2, now * 2 + 1) + sum(end, (left + right) / 2 + 1, right, now * 2 + 2);
    }
  }
} tr_sum, tr_many;

bool judge(int mid, int nowb)
{
  if(tr_sum.sum(mid, 0, tr_sum.size - 1, 0) <= nowb * tr_many.sum(mid, 0, tr_many.size - 1, 0)){
    return true;
  }
  return false;
}

int bs(int nowb)
{
  int bss = 0, bse = tr_many.size;
  while(bse - bss > 1){
    int mid = (bss + bse) / 2;
    if(judge(mid, nowb)){
      bss = mid;
    }
    else{
      bse = mid;
    }
  }
  return tr_many.sum(bss, 0, tr_many.size - 1, 0);
}

signed main()
{
  scanf("%lld", &n);
  for(int i = 1; i <= n; i++){
    scanf("%lld%lld", &ab[i].first, &ab[i].second);
  }
  
  sort(ab + 1, ab + n + 1);
  
  for(int i = 1; i <= n; i++){
    q.push(MP(ab[i].S, MP(ab[i].F, i)));
  }

  tr_sum.reset(); tr_many.reset();

  for(int i = 1; i <= n; i++){
    PIP now = q.top();
    q.pop();
    
    tr_sum.add(now.S.S, now.S.F);
    tr_many.add(now.S.S, 1);

    ans = max(ans, bs(now.F));
  }

  printf("%lld\n", ans);
  return 0;
}

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

int main() {
    int N, C;
    cin >> N >> C;
    vector<vector<int>> D(C, vector<int>(C));
    for (int i = 0; i < C; i++) {
        for (int j = 0; j < C; j++) {
            cin >> D[i][j];
        }
    }
    vector<vector<int>> c(N, vector<int>(N));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> c[i][j];
            c[i][j]--;
        }
    }

    map<int, int> cnt[3];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cnt[(i + j + 2) % 3][c[i][j]]++;
        }
    }

    int ans = 1e9;
    for (int l = 0; l < C; l++) {
        for (int m = 0; m < C; m++) {
            for (int n = 0; n < C; n++) {
                if (l == m || m == n || n == l)
                    continue;

                int tmp = 0;
                for (int i = 0; i < 3; i++) {
                    for (auto p : cnt[i]) {
                        if (i == 0) {
                            tmp += D[p.first][l] * p.second;
                        } else if (i == 1) {
                            tmp += D[p.first][m] * p.second;
                        } else {
                            tmp += D[p.first][n] * p.second;
                        }
                    }
                }
                ans = min(ans, tmp);
            }
        }
    }
    cout << ans << endl;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N+1);

  for (int j = 0; j < M; j++) {
      int a, b;
      cin >> a >> b;
    for (int i = 1; i <= N; i++){
        if (a==i||b==i)
        vec.at(i)++;
    }     
  }
  for (int i = 1; i <= N; i++)
    cout << vec.at(i) << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#define maxn 400010
#define ll long long
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define pii pair<int, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define IL inline
#define ss system
using namespace std;

int n, root, ans = 0;
bool vis[maxn];
vector<int> nxt[maxn];
template <class T> void read (T &x) {
  char ch = x = 0;
  bool fl = false;
  while (!isdigit(ch))
    fl |= ch == '-', ch = getchar();
  while (isdigit(ch))
    x = x * 10 + ch - '0', ch = getchar();
  x = fl ? -x : x;
}
void dfs(int x, int fa) {
  int cnt = 0;
  for (auto &v : nxt[x]) {
    if (v != fa)
      dfs(v, x), cnt += !vis[v], vis[x] |= vis[v];
  }
  if (cnt > 1)
    ans += cnt - 1, vis[x] = true;
}
int main() {
  read(n);
  for (int i = 1, u, v; i <= n - 1; i++) {
    read(u), read(v), nxt[++u].pb(++v), nxt[v].pb(u);
  }
  for (int i = 1; i <= n; i++) {
    if (nxt[i].size() >= 3)
      root = i;
  }
  if (!root)
    return puts("1"), 0;
  dfs(root, 0);
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 14720
(defun f (a b c n)
  (if (or (oddp a)
	  (oddp b)
	  (oddp c))
      n
      (f (/ (+ b c) 2)
	 (/ (+ a c) 2)
	 (/ (+ a b) 2)
	 (+ n 1))))

(defun ff (a b c)
  (if (and (= a b) (= b c))
      (if (evenp a)
	  -1
	  0)
      (f a b c 0)))

(let ((a (read))
      (b (read))
      (c (read)))
  (format t "~a~%" (ff a b c)))

Measured memory_bytes: 14052
#include <stdio.h>
#include <math.h> /*  コンパイル時にオプション -lm  */
int isPrime(int);

int main(){

  int i,n,x[10000],count=0;
  scanf("%d",&n);

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

  }
  for(i=0;i<n;i++){
    if(isPrime(x[i])==1){
      count++;
    }
  }
  

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

  
}


int isPrime(int x){
  int i;

  if(x==2){
    return 1;
}
  if(x<2 || x%2==0){
    return 0;
    }
  i=3;
  while( i<=sqrt(x)){
    if(x%i==0){
      return 0;
	}
    i=i+2;


  }
  return 1;
}



Measured memory_bytes: 2084
#[allow(dead_code)]
fn read_line(n: usize) -> String {
    let mut ss = String::new();
    for _i in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        ss.push_str(&s);
    }
    ss
}

macro_rules! parse {
    ($s:expr => $($r:tt)*) => {
        let s = $s;
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        parse!{s => $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn sub() -> bool
{
    parse!{
        n: usize,
        s: chars,
    }
    if n % 2 != 0 {
        return false;
    }
    let mut a = String::new();
    for i in 0..n / 2 {
        a.push(s[i]);
    }
    let mut b = String::new();
    for i in n / 2..n {
        b.push(s[i]);
    }
    return a == b;
}

fn main()
{
    if sub() {
        println!("Yes");
    }
    else {
        println!("No");
    }
}

Measured memory_bytes: 4352
#include<stdio.h>
int aaa(int s){
  return s%10;
}
int main(){
int a[5];
  int k,idx,min=10;
  for(int i=0;i<5;i++){
	scanf("%d",&a[i]);
    int x=aaa(a[i]);		//x:1のくらいの数
    if(x!=0&&x<=min){min=x;
               idx=i;
              }
  }
  //printf("%d\n",min);
  int sum=0;
  for(int i=0;i<5;i++){
	if(i==idx)sum+=a[i];
    else {if(aaa(a[i])!=0)
      	sum+=a[i]+10-aaa(a[i]);
          else sum+=a[i];
         }
  }
  printf("%d",sum);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000

string trans(string S){
	string ret  ="";
	
	for(int i=0;i<S.size()-1;i++){
		int a = S[i]-'0';
		int b = S[i+1]-'0';
		ret += '0'+abs(a-b);
	}
	
	return ret;
}

long long func(long long x){
	long long ret = 0;
	while(x!=0){
		ret += (long long)x/2;
		x /= 2;
	}
	
	return ret;
}

int main(){
    
	int N;
	cin>>N;
	
	string S;
	cin>>S;
	
	S = trans(S);
	
	if(S.size()==1){
		cout<<S[0]<<endl;
		return 0;
	}
	
	N--;
	//cout<<S<<endl;
	bool f = false;
	
	for(int i=0;i<N;i++){
		if(S[i]=='1'){
			f = true;
			break;
		}
	}
	
	for(int i=0;i<N;i++){
		if(S[i]=='2'){
			if(!f)S[i] = '1';
			else S[i] = '0';
		}
	}
	
	vector<long long> X(N);
	
	for(long long i=0;i<N;i++){
		long long a = func(N-1);
		long long b = func(N-1-i);
		long long c = func(i);
		b += c;
		if(a<=b)X[i] = 1;
		else X[i]=0;
		//X[i] = 
	}

	
	long long sum = 0;
	
	for(int i=0;i<N;i++){
		//cout<<X[i]<<endl;
		sum += X[i] * (long long)(S[i]-'0');
		sum %= 2;
	}
	
	long long ans = sum%2;
	
	if(ans==0){
		cout<<0<<endl;
		return 0;
	}
	
	if(!f)ans*=2;
	
	cout<<ans<<endl;
	
	
    return 0;
}


Measured memory_bytes: 9184
#include<stdio.h>
#include<string.h>
#define IN"Y"
int main(void){
int n,i,d=0,j;
char str[100],Y;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",str);
if(!strcmp(str,IN)){
d=1;break;
}
}
if(d==1){
puts("Four");
}else if(d==0){
puts("Three");
}
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1505,mod=998244353;
int n,tot,a[N][N],head[N],nex[N*N<<1],to[N*N<<1];
void add(int u,int v){to[++tot]=v;nex[tot]=head[u];head[u]=tot;}
char s[N][N];
vector<int>v[N][N];
bool vis[N];
int num,c[N][N],vt[N],e[N];
void solve(int x,int y,int dx,int dy,int tot)
{
    while(x>=0&&x<=n&&y>=0&&y<=n)
    {
        v[x][y].push_back(tot);
        x+=dx;y+=dy;
    }
}
void dfs(int u)
{
    if(vis[u]) return;
    vis[u]=true;num^=vt[u];
    for(int i=head[u];i;i=nex[i])
        dfs(to[i]);
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<n;i++)
        scanf("%s",s[i]+1);
    for(int i=0;i<=n;i++)
    {
        int x=0,y=i,dx=1,dy=1;
        for(int j=1;j<=(i>0&&i<n?2*n:n);j++)
        {
            v[x][y].push_back(i);
            if(x+dx<0||x+dx>n) dx*=-1;
            if(y+dy<0||y+dy>n) dy*=-1;
            x+=dx;y+=dy;
        }
    }
    for(int i=1;i<n;i++)
        for(int j=1;j<n;j++)
        if(s[i][j]=='o') a[i][j]=1;
    else if(s[i][j]=='x') a[i][j]=2;
    for(int i=1;i<n;i++)
        for(int j=1;j<n;j++)
    {
        int x=v[i][j][0],y=v[i][j][1];
        c[x][y]|=a[i][j];
        if(c[x][y]==3){cout<<0<<endl;return 0;}
    }
    for(int i=0;i<=n;i++)
        for(int j=i+2;j<=n;j+=2)
        if(c[i][j]==0) add(i,j),add(j,i),e[i&1]++;
    else vt[i]^=c[i][j]-1,vt[j]^=c[i][j]-1;
    int ans=1;
    for(int d=0;d<2;d++)
    {
        int nt=(n-d)/2+1;
        if(nt&1)
        {
            int cnt=0;
            for(int i=d;i<=n;i+=2)
                if(!vis[i])
            {
                cnt++;num=0;
                dfs(i);
                if(num&1){cout<<0<<endl;return 0;}
            }
            for(int i=1;i<=e[d]-nt+cnt;i++)
                ans=ans*2%mod;
        }
        else for(int i=1;i<=e[d];i++) ans=ans*2%mod;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 157696
#include <bits/stdc++.h>
#define prob "monster"
#define N 100001
#define io freopen(prob".inp","r",stdin); freopen(prob".out","w",stdout);
using namespace std;
int n, x;
int main ()
{
//    io
    cin >> n;
    int dem = 0;
    cin >> x;
    int mod = x;
    for (int i = 1; i < n; i++)
    {
        cin >> x;
        mod = __gcd(x, mod);
    }
    cout << mod;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        solve();
    }
    static Scanner cin;

    static int N;
    static int[] X;
    static int[] Y;
    static int[] h;
    static void input()
    {
        cin = new Scanner();
        N = cin.nextInt();
        X = new int[N];
        Y = new int[N];
        h = new int[N];
        for(int i = 0; i < N; i++)
        {
            X[i] = cin.nextInt();
            Y[i] = cin.nextInt();
            h[i] = cin.nextInt();
        }
    }
    static void solve()
    {
        input();
        int v = 0;
        for(int i = 0; i < N; i++)
        {
            if(h[i] != 0)
            {
                v = i;
                break;
            }
        }
        for(int y = 0; y <= 100; y++)
            for(int x = 0; x <= 100; x++)
            {
                int H = Abs(X[v] - x) + Abs(Y[v] - y) + h[v];
                if (H <= 0) continue;

                bool isOK = true;
                for(int i = 0; i < N; i++)
                {
                    int height = Max(H - Abs(x - X[i]) - Abs(y - Y[i]), 0);

                    if (h[i] != height)
                    {
                        isOK = false;
                        break;
                    }
                }
                if (isOK)
                {
                    WriteLine($"{x} {y} {H}");
                }
            }
    }
    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }
        
        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }

        public double[] ArrayDounble(int N, int add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

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

int main() {
  int d;
  scanf("%d",&d);
  if(d==25) {
    printf("Christmas\n");
  }
  if(d==24) {
    printf("Christmas Eve\n");
  }
  if(d==23) {
    printf("Christmas Eve Eve\n");
  }
  if(d==22) {
    printf("Christmas Eve Eve Eve\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
void print(const vector<string>&xs){
  for(const auto&x:xs)cout<<x<<endl;
}
main(){
  string s;
  int K;
  cin>>s>>K;
  set<string> set_;
  for(int i=0;i<s.size();++i){
    for(int len=1;len<=K;++len){
      int right=i+len;
      if(right>s.size())break;
      string tmp=s.substr(i,len);
      set_.insert(tmp);
    }
  }
  vector<string>strings(set_.begin(),set_.end());
  sort(strings.begin(),strings.end());
  // print(strings);
  cout<<strings[K-1]<<endl;
}


Measured memory_bytes: 1792
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    int n;
    cin >> n;
    for(int i = 1; i < 10; i++){
        for(int j = 1; j < 10; j++){
            if(i * j == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
}

Measured memory_bytes: 256
package main

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

var scan = bufio.NewScanner(os.Stdin)

func main() {
	scanWords()

	itemNum := readNextInt()
	list := make([]int, 0, itemNum)
	for i := 0; i < cap(list); i++ {
		list = append(list, readNextInt())
	}

	list = reverseOrder(list)
	for index, value := range list {
		fmt.Printf("%d", value)
		if index != len(list)-1 {
			fmt.Print(" ")
		}
	}
	fmt.Println()
}

func scanWords() {
	scan.Split(bufio.ScanWords)
}

func readNextInt() int {
	scan.Scan()

	input, err := strconv.Atoi(scan.Text())
	if err != nil {
		panic(err)
	}
	return input
}

func reverseOrder(slice []int) []int {
	for index := 0; index < len(slice)/2; index++ {
		slice[index], slice[len(slice)-1-index] = slice[len(slice)-1-index], slice[index]
	}
	return slice
}



Measured memory_bytes: 1096
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.stream.IntStream;

class Main {
	
    public static void main(String[] args) {
		OriginScanner os = new OriginScanner();
		PrintWriter pw = new PrintWriter(System.out);
		
		int n = os.nextInt();
		
		long count = IntStream.rangeClosed(1, n).filter(i -> String.valueOf(i).length() % 2 == 1).count();
		
		pw.println(count);
		pw.close();
	}
    
	static class OriginScanner {
		StringTokenizer token;
		BufferedReader br;
		
		public OriginScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String nextLine() {
			String str = null;
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				System.out.println(e);
			}
			return str;
		}
		
		String next() {
			while (token == null || !token.hasMoreElements()) { 
				token = new StringTokenizer(nextLine());
			}
			return token.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}

Measured memory_bytes: 28752
#include<stdio.h>

int main()
{
 int W,H,x,y,r;

 scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
 if(x+r>W||x-r<0||y+r>H||y-r<0)printf("No\n");
 else printf("Yes\n"); 

 
 return 0;
}

Measured memory_bytes: 584
import java.util.*;

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

		while(sc.hasNext()){
			String s = sc.next();
			int sum = 0;
			int n = 0;
			int m = 0;
			int t = 0;
			int u = 0;
			for(int i=0;i<s.length();i++){
				n = s.codePointAt(i);
				m = 0;
				u = 0;
				if(i!=s.length()-1)m = s.codePointAt(i+1);
				if(n==73)t = 1;
				else if(n==86)t = 5;
				else if(n==88)t = 10;
				else if(n==76)t = 50;
				else if(n==67)t = 100;
				else if(n==68)t = 500;
				else if(n==77)t = 1000;

				if(m==73)u = 1;
				else if(m==86)u = 5;
				else if(m==88)u = 10;
				else if(m==76)u = 50;
				else if(m==67)u = 100;
				else if(m==68)u = 500;
				else if(m==77)u = 1000;				
							
				if(i==s.length()-1){
					sum += t;
				}else if(u>t){
					sum -= t;
				}else{
					sum += t;
				}
	
			}
			System.out.println(sum);
		}
	
	}	
}

Measured memory_bytes: 17156
#include <bits/stdc++.h>
using namespace std;
#define ll long long
bool comapre(pair<ll int,ll int> a,pair<ll int,ll int> b)
{return a.second<b.second;
}
int main()
{



  
ll int n,w,sum=0;
cin>>n>>w;
pair<ll int,ll int> a[n];
for(ll int i=0;i<n;i++)
{ll int e,f;
  cin>>e>>f;
  sum+=f;
  a[i]=make_pair(e,f);
}

sort(a,a+n);
ll int v=100002;
ll int dp[n][100002];
for(ll int i=0;i<n;i++)
{for(ll int j=0;j<=sum;j++)
{dp[i][j]=INT_MAX;
if(j==0)
  dp[i][j]=0;
}
}
for(ll int i=0,j=0;j<=sum;j++)
{if(j==a[i].second)
dp[i][j]=a[i].first;
}
for(ll int i=1;i<n;i++)
{ll int val=a[i].second;
  for(ll int j=0;j<=sum;j++)
  {if(j<val)
    dp[i][j]=dp[i-1][j];
    else
    {ll int op1=dp[i-1][j];
      ll int op2=dp[i-1][j-val];
     if(op1==INT_MAX)
      dp[i][j]=INT_MAX;
    else
      dp[i][j]=dp[i-1][j];
    if(op2!=INT_MAX)
      dp[i][j]=min(dp[i][j],op2+a[i].first);



    }




  }




}

ll int ans=0;
for(ll int i=0;i<n;i++)
{for(ll int j=0;j<=sum;j++)
  {if(dp[i][j]<=w)
    ans=max(ans,j);


  }

}

cout<<ans<<endl;












}

Measured memory_bytes: 78336
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;

class _Class
{
  void _Do()
  {
    var tmp = Split.ints();
    var H = tmp[0];
    var W = tmp[1];

    var hw = new int[H, W];
    var mp = new int[H+1,W+1];
    var mod = 1000000000 + 7;

    for (int h=0;h<H;h++)
    {
      var s = Split.strings()[0];
      for(int w=0;w<W ;w++ )
      {
        hw[h, w] = s[w];
      }  
    }

    //
    mp[0, 0] = 1;
    for(int h=0;h<H ;h++ )
    {
      for (int w = 0; w < W; w++)
      {
        if (hw[h,w]=='.') {
          mp[h, w + 1] += mp[h, w];
          mp[h,w+1] = (mp[h,w+1]%mod);

          mp[h + 1, w] += mp[h, w];
          mp[h+1, w] = (mp[h+1, w] % mod);
        }
      }
    }
    Console.WriteLine(mp[H-1,W-1]);
  }

  static void Main(string[] args)
  {
    _(args);
    new _Class()._Do();
  }

  [Conditional("DEBUG")]
  static void _(string[] args)
  {
    if (args.Length != 0 && File.Exists(args[0]))
      Console.SetIn(new StreamReader(args[0]));
    else
      Console.Error.WriteLine("in");
  }
}

static class Split
{ 

  // 1
  public static string[] strings()
  {
    return Console.ReadLine().Split();
  }


  // [2.1] -2,147,483,648 ~ +2,147,483,647
  public static int[] ints()
  {
    var _s = Console.ReadLine().Split();

    var x = new int[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = int.Parse(_s[i]);

    return x;
  }

  // [2.2] 
  // -9,223,372,036,854,775,808 ~ 
  // +9,223,372,036,854,775,807
  public static long[] longs()
  {
    var _s = Console.ReadLine().Split();

    var x = new long[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = long.Parse(_s[i]);

    return x;
  }

  public static double[] doubles()
  {
    var _s = Console.ReadLine().Split();

    var x = new double[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = double.Parse(_s[i]);

    return x;
  }

  public static BigInteger[] bigs()
  {
    var _s = Console.ReadLine().Split();

    var x = new BigInteger[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = BigInteger.Parse(_s[i]);

    return x;
  }
}





Measured memory_bytes: 24792
//Author:  Pranta
//Date:    2020-Sep-11
//Problem: A_Don_t_be_late
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
using namespace std;
void solve()
{
    int d,t,s;
    cin>>d>>t>>s;
    cout<<(t*s>=d?"Yes":"No");
}
int main()
{
    fast;
    int t;
    //cin>>t;
    //while(t--)
    solve();
}

Measured memory_bytes: 3644
use std::cmp;

const MOD: usize = 1e9 as usize + 7;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let m = sc.read();

    let mut left_x = vec![vec![]; n + 1];
    for _ in 0..m {
        let left = sc.read::<usize>();
        let right = sc.read::<usize>();
        let x: usize = sc.read();
        left_x[right].push((left, x));
    }

    let mut dp = vec![vec![vec![0; n + 1]; n + 1]; n + 1];
    dp[0][0][0] = 1;
    for r in 0..n {
        for g in 0..n {
            for b in 0..n {
                let max = cmp::max(cmp::max(r, g), b);
                let check = |a: usize, b: usize| left_x[max + 1].iter().all(|&(left, x)| {
                    let mut count = 1;
                    if a >= left { count += 1; }
                    if b >= left { count += 1; }
                    count == x
                });

                if check(g, b) {
                    dp[max + 1][g][b] += dp[r][g][b];
                    dp[max + 1][g][b] %= MOD;
                }
                if check(r, g) {
                    dp[r][g][max + 1] += dp[r][g][b];
                    dp[r][g][max + 1] %= MOD;
                }
                if check(r, b) {
                    dp[r][max + 1][b] += dp[r][g][b];
                    dp[r][max + 1][b] %= MOD;
                }
            }
        }
    }

    let mut ans = 0;
    for i in 0..n {
        for j in 0..n {
            ans += dp[i][j][n];
            ans += dp[i][n][j];
            ans += dp[n][j][i];
            ans %= MOD;
        }
    }
    println!("{}", ans);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 237820
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
  string s, t;
  cin >> s >> t;
  s = s+s;
  if(s.find(t) != string::npos)cout << "Yes";
  else cout << "No";
} 

Measured memory_bytes: 256
def p_prime(n): 
    prime = [2]
    for i in range(3,n+1):
        flag = 0
        for j in prime:
            if i%j == 0:
                flag = 1
                break
            if i**0.5 < j:
                break
        if flag == 0:
            prime.append(i)
    return prime

prime = p_prime(10**5+1000)

X = int(input())

for p in prime:
    if p>=X:
        break
print(p)

Measured memory_bytes: 40048
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]

for i in range(n):
    if li[i][2] != 0:
        h1 = li[i][2]
        break

flag = True
flag2 = False

for i in range(10**9):
    if flag2 == True: break
    for X in range(101):
        for Y in range(101):
            h = h1 + i
            flag = True
            for j in range(n):
                if max(h - abs(li[j][0]-X) - abs(li[j][1]-Y),0) != li[j][2]:
                    flag = False
                    break
            if flag == True:
                print(X,Y,h)
                flag2 = True
            if flag2 == True: break
            h = h1 - i
            flag = True
            for j in range(n):
                if max(h - abs(li[j][0]-X) - abs(li[j][1]-Y),0) != li[j][2]:
                    flag = False
                    break
            if flag == True:
                print(X,Y,h)
                flag2 = True


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,x,sum;
  cin >> N >> K;
  sum = 0;
  for (int i = 0; i < N; i++) {
   
    cin >> x;
    if (abs(x) > abs(K-x)) {
      sum += 2*abs(K-x);
    }
    else {
      sum += 2*abs(x);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
//Ankit Verma
//Chandigarh University
//verma_ankit484( handle on cp sites)
//verma.ankit484@gmail.com

#include<bits/stdc++.h>
typedef long long ll;

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef AV
	freopen("int.txt", "r", stdin);
	#endif
	ll n;
	cin>>n;
	vector<ll> vc(n);
	for(ll i=0; i<n; i++){
		cin>>vc[i];
	}
	vector<ll> dp(n, 0);
	dp[0]=0;
	dp[1]=abs(vc[0]-vc[1]);
	for(ll i=2; i<n; i++){
		dp[i]=min(abs(vc[i]-vc[i-1])+dp[i-1], abs(vc[i]- vc[i-2])+dp[i-2]);
	}
	cout<<dp[n-1]<<"\n";
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 100005;
ll X[MAXN],Y[MAXN];
int g[MAXN],fn[MAXN];
bool vis[MAXN];
int main()
{
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
		cin >> X[i];
	for(int i=n;i;i--) {
		X[i] = X[i] - X[i-1];
		g[i] = i;
	}
	int m;
	ll K;
	cin >> m >> K;
	for(int i=1;i<=m;i++) {
		int pos;
		cin >> pos;
		swap(g[pos] , g[pos+1]);
	}
	
	for(int i=1;i<=n;i++)
		if(vis[i] == false) {
			static int st[MAXN];
			int cnt = 0;
			for(int j=i;vis[j] == false;j=g[j]) {
				st[cnt++] = j;
				vis[j] = true;
			}
			for(int j=0;j<cnt;j++)
				fn[st[j]] = st[(j+K)%cnt];
		}
	
	for(int i=1;i<=n;i++)
		Y[i] = X[fn[i]];
	for(int i=1;i<=n;i++) {
		Y[i] += Y[i-1];
		cout << Y[i] << ".0\n";
	}
}


Measured memory_bytes: 4352
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>

using namespace std;

#define forn(I,N) for (int I = 0; I < (N); ++I)
#define fornd(I,N) for (int I = (N) - 1; I >= 0; --I)
#define forab(I,A,B) for (int I = (A); I <= (B); ++I)
#define forabd(I,A,B) for (int I= (B); I >= (A); --I)
#define FOREACH(I,A) for (__typeof__(A)::iterator I=A.begin(); I<A.end(); I++)
#define all(V) (V).begin(), (V).end()
#define pb push_back
#define mp make_pair

typedef long long int ll;

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

const ll mod = 1000000007;

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

  vector<ll> V(N);
  forn(i, N) {
    cin >> V[i];
  }

  ll ans = 0;
  forn(i, N + 1) {
    forn(j, N - i + 1) {
      if (i + j <= K) {
        vector<ll> neg;
        ll buf = 0;
        forn(k, i) {
          buf += V[k];
          if (V[k] < 0) {
            neg.pb(V[k]);
          }
        }
        forn(k, j) {
          buf += V[N - k - 1];
          if (V[N - k - 1] < 0) {
            neg.pb(V[N - k - 1]);
          }
        }

        ans = max(ans, buf);

        sort(neg.begin(), neg.end());
        // cout << min(K - i - j, (int)neg.size()) << endl;
        forn(k, min(K - i - j, (int)neg.size())) {
          buf -= neg[k];
          ans = max(ans, buf);
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}



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

int main() {
  int n;
  cin >> n;
  unordered_map<string, int> hash;
  int mx = 0;
  rep(i,n) {
	string str;
    cin >> str;
    if (hash.find(str) == hash.end()) {
      hash.emplace(str, 1);
      mx = max(1, mx);      
    } else {
      hash.at(str)++;
      mx = max(hash.at(str), mx);
    }
    //cout << "str = " << str << " mx = " << mx << endl;
  }

  vector<string> strings;
  for (auto itr = hash.begin(); itr != hash.end(); itr++) {
	if (itr->second == mx) {
      strings.push_back(itr->first);
    }
  }
  
  sort(strings.begin(), strings.end());
  
  for (auto itr = strings.begin(); itr != strings.end(); itr++) {
	cout << *itr << endl;
  }
  
  return 0;
}

Measured memory_bytes: 26692
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int Combination(int sum, int n);

int main(void)
{
	int N, M;
	scanf("%d %d", &N, &M);
	
	int ans = 0;
	int n = 0;
	n = Combination(N, 2);
	// if (n == 1) n = 0;

	ans = n;

	n = Combination(M, 2);
	// if (n == 1) n = 0;

	ans += n;

	printf("%d\n", ans);

	return 0;
}

int Combination(int sum, int n)
{
	return (sum * (sum - 1)) / n;
}


Measured memory_bytes: 128
function main()
  (a, b, c) = map(x -> parse(Int, x), split(readline()))
  x = a + b - c
  
  if x > 0
    print("No")
    return;
  end
  
  if x^2 <= 4*a*b
    print("No")
    return;
  end
  
  println("Yes")
end; main()

Measured memory_bytes: 166228
#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 bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    
    ll n;
    cin >> n;
    ll ans = 1e18;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i != 0) continue;
        ll j = n / i;
        chmin(ans, i + j - 2);
    }
    cout << ans << endl;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()


int main() {
    int N;
    cin >> N;
    vl A(N);
    FOR(i,0,N){
        cin >> A[i];
    }
    
    ll cnt = 0;
    ll m = abs(A[0]);
    ll sum = 0;
    FOR(i,0,N){

        if(A[i]<0){
            cnt++;
        }

        sum += abs(A[i]);
        m = min(m,abs(A[i]));

    }

    if(cnt%2==1){
        sum -= 2*m;
    }

    cout << sum << endl;

}



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

#define ll long long
#define F(i,a,b) for(int i=a;i<=b;++i)
#define R(i,a,b) for(int i=a;i<b;++i)
#define mem(a,b) memset(a,b,sizeof(a))

int n,m;

int main()
{
    cin>>n>>m;
    cout<<(n-1)*(m-1)<<endl;
    return 0;
}

Measured memory_bytes: 256
// abc141_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    string S;
    cin >> S;

    if (S == "Sunny") {
        print("Cloudy");
    } else if (S == "Cloudy"){
        print("Rainy");
    } else {
        print("Sunny");
    }

    return 0;
}


Measured memory_bytes: 256
# C - Exception Handling
import heapq

n = int(input())
a = []
hq = []
for i in range(n):
    i = int(input())
    a.append(i)
    heapq.heappush(hq, -i)

ma1 = heapq.heappop(hq) * -1
ma2 = heapq.heappop(hq) * -1

for j in range(n):
    if a[j]==ma1:
        print(ma2)
    else:
        print(ma1)
        

Measured memory_bytes: 20528
def main():
    s = str(input())
    t = str(input())
    s_num = len(s)
    t_num = len(t)
    ans = []
    for i in range(s_num - t_num + 1):
        count = 0
        U = s[i:i + t_num]
        for j in range(t_num):
            if U[j] != t[j]:
                count += 1
        ans.append(count)
    print(min(ans))

main()

Measured memory_bytes: 8972
s = input()
t = input()
m, n = len(s), len(t)
dp = [[0 for _ in range(n+1)] for _ in range(m+1)]

for i in range(1, m+1):
  for j in range(1, n+1):
    if s[i-1] == t[j-1]:
      dp[i][j] = dp[i-1][j-1] + 1
    else:
      dp[i][j] = max(dp[i-1][j], dp[i][j-1])

res = ''
i, j = m, n
while i > 0 and j > 0:
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    i -= 1
    j -= 1
    res = s[i] + res
print(res)

Measured memory_bytes: 119772
#include<bits/stdc++.h>
using namespace std;
#define N 1111116

int n,m,ans;
char s[N],t[N];
queue<int> q;

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-')  f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	scanf("%d %s %s",&n,s+1,t+1);
	if (!strcmp(s+1,t+1)) {printf("0\n");return 0;}
	for (int i=n,j=n;i;i--){
		while (t[i-1]==t[i]) i--;
		while (j>i||(j&&s[j]!=t[i])) j--;
		if (s[j]!=t[i]) {printf("-1\n");return 0;};
		if (i==j) continue;
		while (!q.empty()&&q.front()-m>i) q.pop();
		m++;q.push(j+m);
		ans=max(ans,(int)q.size());
		
	}
	printf("%d\n",ans+1);
	return 0;
}

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

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

using ll = long long;

using namespace std;

bool OK(ll N, ll K) {
  while (N != 1) {
    if (N % K == 0) {
      N /= K;
      continue;
    } else if (N > K) {
      N %= K;
      continue;
    } else {
      return false;
    }
  }
  return true;
}

map<ll, int> factorize(ll x) {
  map<ll, int> m;
  for (ll i = 2; i * i <= x;) {
    if (x % i == 0) {
      m[i]++;
      x /= i;
    } else {
      ++i;
    }
  }
  if (x > 1) m[x]++;
  return m;
}

using iter = map<ll, int>::const_iterator;

void dfs(set<ll>& s, ll K, iter it, iter end) {
  if (it == end) {
    if (K > 1) {
      s.insert(K);
    }
    return;
  }
  auto[k, v] = *it;
  ++it;
  dfs(s, K, it, end);
  for (int i = 0; i < v; ++i) {
    K *= k;
    dfs(s, K, it, end);
  }
}

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

  map<ll, int> f1 = factorize(N - 1);
  set<ll> s1;
  dfs(s1, 1, f1.begin(), f1.end());

  map<ll, int> f2 = factorize(N);
  set<ll> s2;
  dfs(s2, 1, f2.begin(), f2.end());

  ll ans = s1.size();
  for (ll x : s2) {
    if (OK(N, x)) {
      ++ans;
    }
  }
  cout << ans << endl;
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  int n;
  cin>>n;
  string ans="";
  while(n!=0){
    if(n%2!=0){
      n--;
      ans="1"+ans;
    }
    else ans="0"+ans;
    n/=-2;
  }
  if(ans=="") ans="0";
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int a,A,B,C,D,P,SumX,SumY;
  

  scanf("%d",&A);

  scanf("%d",&B);

  scanf("%d",&C);

  scanf("%d",&D);

  scanf("%d",&P);
  SumX=A*P;

  if (P<C) {SumY=B;}
  else if (P>C){SumY=B+(P-C)*D;}

  if (SumX<SumY){printf("%d\n",SumX);}
  else if (SumX>SumY){printf("%d\n",SumY);}
  else if (SumX==SumY){printf("%d\n",SumX);}
  
 
  return 0;
}

Measured memory_bytes: 596
//                          VIVEK UPADHYAY
//                         MANIT, BHOPAL(M.P)
/**********************************************************************************************/
/**********************************************************************************************/
//                        $$ JAB-TAK TODEGA NHI,
//                           TAB -TAK CHODEGA NHI :D
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<"\n" ;
#define ok cout<<"ok\n" ;
#define dbg(x) cout<<#x<<" = "<<(x)<<"\n";
typedef long long ll;
const int MAXN = 500510;
const int MAX = 1e7 + 1 ;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e18 ;
ll mod = 500500507;
ll powr(ll a , ll b){ if(b==0) return 1LL ; ll x = powr(a,b/2) ; x = (x*x)%mod ; if(b%2) return ((a%mod)*x)%mod ; return x ;}
ll gcd(ll a , ll b){if(a==0) return b ; return gcd(b%a,a);}
int main () {
    
    int N ;
    cin >> N ;
    ll a[N] ;
    multiset<ll> ms ;
    for(int i = 0; i < N ;i++){
        cin >> a[i] ;
        ms.insert(a[i]) ;
    }
    int cnt=0;
   
    while(ms.empty()==false){
        ll x = *ms.rbegin() ,pw = 1LL ;
        ms.erase(ms.find(x)) ;
        while(pw <= x)
            pw*=2 ;
        auto it = ms.find(pw - x) ;
        if(it==ms.end()) continue ;
        ms.erase(it) ;
        ++cnt ;
    }
    cout<<cnt<<endl;
    return 0 ;
}


Measured memory_bytes: 11136