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

int main() {
    ll n;
    cin >> n;
    ll a;
    vector<ll> b(100010);
    for (int i=0;i<n;i++) {
        cin >> a;
        b[a]++;
    }
    ll k=0;
    int r=0;
    for (int i=0;i<100010;i++) {
        if (b[i]>1) {
            if (r==1) b[i]--;
            k+=b[i]/2;
            r=(b[i]+1)%2;
        } 
    }
    cout << n-2*k << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

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

int main() {
  int N; cin >> N;
  double pi = 3.141;

  cout << N*2*pi << endl;
  return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

#define MAX_N 1000

int q;

int main(){
	cin.sync_with_stdio(false);
	cin>>q;
	ll sumr=0,suml=0;
	while(q--){
		int p,n;
		char c;
		cin>>p>>c>>n;
		if(c=='(')suml+=n;
		else sumr+=n;
		if(suml==sumr)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}

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

int main(void)
{
  int x, y;
  cin>>x>>y;

  int xx=abs(x), yy=abs(y);

  int a = abs(xx-yy);
  int b=0;
  if((x<0 && y>0) || (x>=0 && y<=0))
    b=1;
  else if(x>0 && y>0)
    if(xx>yy) b=2;
    else b=0;
  else if(x<0 && y<0)
    if(xx<yy) b=2;
    else b=0;

    cout<<a+b<<endl;
  
  return 0;
}


Measured memory_bytes: 256
def neg(a,b):
    n = max(a,b)-min(a,b)+1
    print('Negative' if n%2 else 'Positive')
    
def sign(a, b):
    if a==0 or b==0:
        print('Zero');        return
    sa =-1 if a*(-1) == abs(a) else 1
    sb =-1 if b*(-1) == abs(b) else 1
    if sa * sb == -1:
        print('Zero');        return
    elif sa==sb==1:
        print('Positive');        return
    else:
        neg(a,b)
        
a, b = map(int,input().split())
sign(a,b)

Measured memory_bytes: 9184
import numpy as np
S = list(input())
T = list(input())
r = "Yes"
end_list = np.array([0] * len(S))
for i in range(len(S)):
    if end_list[i] == 0:
        s1 = S[i]
        t1 = T[i]
        s_bit = list(map(lambda x:1 if x==s1 else 0, S))
        t_bit = list(map(lambda x:1 if x==t1 else 0, T))
        if s_bit != t_bit:
            r = "No"
            break
        end_list += np.array(s_bit)
print(r)

Measured memory_bytes: 23472
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

int main () {
  int X, A, B;
  cin >> X >> A >> B;
  cout << (X - A) % B << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;

#define rep(i,m,n) for(ll i=m;i<n;i++)

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

 ll n;
  cin >> n;
  ll sum=0,sq=0;
  rep(i,0,n) {
   ll d;   
cin >> d;
 sum+=d;
 sq+=d*d;
}

 cout << (sum*sum-sq)/2 << endl; 
  
  
  
}

Measured memory_bytes: 256
import copy
n  = int(input())
a = [int(input()) for i in range(n)]

ans = []
cp = copy.copy(a) 
v_max = max(a)
cp.remove(v_max)
v_next = max(cp)

for i in a:
    #cp = a
    #print(i)
    if i == v_max:
        print(v_next)
    else:
        print(v_max)

#for i in a:
#    print(i)


#print(n)
#print(a)

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);

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

  if(A+B>C+D){
    cout << "Left" << endl;    
  }else if(A+B==C+D){
    cout << "Balanced" << endl;
  }else{
    cout << "Right" << endl;
  }
}



Measured memory_bytes: 256
using System;

class Program{
    public static void Main(){
        var H=int.Parse(Console.ReadLine());
        var nodes=new int[H];
        var s=Console.ReadLine().Split(' ');
        for (var i=0; i<H; i++) {
            nodes[i]=int.Parse(s[i]);
        }

        for(var i=0; i<H; i++){
            Console.Write("node "+(i+1)+": key = "+nodes[i]+", ");
            if(i!=0){
                Console.Write("parent key = "+nodes[(i-1)/2]+", ");
            }
            if(i*2+1<H){
                Console.Write("left key = "+nodes[i*2+1]+", ");
            }
            if((i+1)*2<H){
                Console.Write("right key = "+nodes[(i+1)*2]+", ");
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9160
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
#include <fstream>
#include <climits>
 
  using namespace std;
   
 
//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ

  typedef long long ll;
  typedef long double lld;
  typedef unsigned long long ull;
  int INF = INT_MAX;
  // ll mod = 1000000007;
  // lld PI = 3.141592653;
 


void solve(){
  
  string s,t;
  cin>>s>>t;
  int n = s.length();
  int m = t.length();
  int ans = m;
  for (int i = 0;i<n-m+1;i++){
    int cnt = 0;
    for (int j = 0;j<m;j++){
      if (s[i+j]!=t[j]) cnt++;
    }
    ans = min(ans, cnt);
  }
cout<<ans<<"\n";
}

  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int q = 1;
    while(q--) solve();

}

Measured memory_bytes: 3196
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int n, x;
	cin >> n >> x;
	int m, mn = 100000;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> m;
		sum += m;
		mn = min(mn, m);
	}
	x -= sum;
	cout << n + x / mn << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define LL long long
#define endl '\n'
using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int cnt[26] = {};
    char ch;
    while (cin >> ch) {
        if (isupper(ch)) {
            ch = tolower(ch);
        }
        int num = ch - 'a';
        cnt[num]++;
    }

    REP(i, 26)
    {
        cout << char('a' + i) << " : " << cnt[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main(){
	int y,m,d;scanf("%d/%d/%d",&y,&m,&d);
	if(m<5){
		puts("Heisei");
	}
	else puts("TBD");
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define int long long

typedef long long ll;
typedef pair<int, int> Pair;

const int kMaxR = 10;
const int kMaxC = 10000;

int R, C;
bool grid[kMaxR][kMaxC];
int ans;

vector<int> selected;

int Count(int col) {
  int cnt = 0;
  REP(i, R) { if (!grid[i][col]) { ++cnt; } }
  return cnt;
}

void Ans() {
  // REP(i, R) {
  //   REP(j, C) {
  //     cout << grid[i][j] << " ";
  //   }
  //   cout << endl;
  // }

  int cnt = 0;
  REP(j, C) {
    int cntcol = Count(j);
    cnt += MAX(cntcol, R-cntcol);
  }
  ans = MAX(ans, cnt);
}

void Turn(int row) {
  REP(j, C) { grid[row][j] = !grid[row][j]; }
  return;
}

void Dfs(int row) {
  if (row == R) {
    Ans();
    return;
  }

  Dfs(row+1);

  Turn(row);
  Dfs(row+1);
  Turn(row);

  return;
}

signed main() {
  while (true) {
    cin >> R >> C;
    if (R == 0) { break; }
    REP(i, R) { REP(j, C) { cin >> grid[i][j]; } }
    ans = 0;

    Dfs(0);

    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 3176
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>
#include<stdlib.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    string S;
    cin >> S;
    ll n = S.size()-1;

    //本文
    ll ans = 0;
    for(int bit = 0; bit <(1<<n);bit++){
      ll res = 0;
      for(int i = 0; i <= n;i++){
        res*=10;
        res+= S[i]-'0';
        if(bit&(1<<i)){
          ans += res;
          res =0;
        }

      }
      ans += res;
    }
    //出力
    cout << ans << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Measured memory_bytes: 3616
#include<stdio.h>
int main(void){
    int cnt,all=0;
    int N,M;
    scanf("%d %d",&N,&M);
    int A[M];
    for(cnt=0;cnt<M;cnt++){
        scanf("%d",&A[cnt]);
        all+=A[cnt];
    }

    if(N<all){
        printf("-1\n");
        return 0;
    }

    printf("%d\n",N-all);
    return 0;
}

Measured memory_bytes: 1732
//
// Created by Peter on 2018/11/19.
//
// from ALDS 1_1_D: Maximum Profit
//

#include <iostream>

using namespace std;

void drive_online()
{
    int n;
    cin >> n;
    int curr_val;
    int max_val = -1000000000;
    int min_val = -max_val;
    for (int i=0; i<n; ++i) {
        cin >> curr_val;
        if (i == 0) {
            min_val = curr_val;
        } else {
            max_val = max(max_val, curr_val-min_val);
            min_val = min(min_val, curr_val);
        }
    }
    cout << max_val << endl;
}

int main()
{
    drive_online();
    return 0;
}


Measured memory_bytes: 3092
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
void needenter() {
	for (int i = 0; i < 2; ++i) {
		while (getchar() != '\n');
	}
}
inline bool check(char x) {
	const char *str = "ACGT";
	for (int i = 0; i < 4; ++i) {
		if (x == str[i]) {
			return true;
		}
	}
	return false;
}
int main() {
	string str;
	cin >> str;
	int ans = 0;
	for (int i = 0; i < str.size(); ++i) {
		int count = 0;
		for (; i + count < str.size() && check(str[i + count]); ++count);
		ans = max(ans, count);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = a*b;
		if(c%2==1) {
			System.out.printf("Odd\n");
		}
		else {
			System.out.printf("Even\n");
		}
	}
}


Measured memory_bytes: 22740
#include <stdio.h>
#include <stdlib.h>
int main()
{
  int n, k;
  int x[120];

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

  int count = 0;

  for (int i = 0; i < n; i++) {
  int ans = 1000;

   if(ans > (x[i] * 2)) {
     ans = x[i] * 2;
   }

   if (ans > (abs(k-x[i]) * 2)) {
     ans = abs(k-x[i]) * 2;
   }

   count += ans;

  }

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

  return 0;
}


Measured memory_bytes: 128
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        Task task = new Task();
        task.solve(sc, out);
        out.flush();
        sc.close();
    }

    static class Task {
        public void solve(Scanner sc, PrintWriter out) {
            int A = nint(sc);
            int B = nint(sc);
            int C = nint(sc);
            
            out.println(C >= A && C <= B ? "Yes": "No");
        }
    }


    static int nint(Scanner sc) {
        return Integer.parseInt(sc.next());
    }

    static long nlong(Scanner sc) {
        return Long.parseLong(sc.next());
    }

    static double ndouble(Scanner sc) {
        return Double.parseDouble(sc.next());
    }

    static float nfloat(Scanner sc) {
        return Float.parseFloat(sc.next());
    }

    static String nstr(Scanner sc) {
        return sc.next();
    }

    static long[] longLine(Scanner sc, int size) {
        long[] lLine = new long[size];
        for (int i = 0; i < size; i++) {
            lLine[i] = nlong(sc);
        }
        return lLine;
    }

    static int[] intLine(Scanner sc, int size) {
        int[] iLine = new int[size];
        for (int i = 0; i < size; i++) {
            iLine[i] = nint(sc);
        }
        return iLine;
    }

    static String[] strLine(Scanner sc, int size) {
        String[] strLine = new String[size];
        for (int i = 0; i < size; i++) {
            strLine[i] = nstr(sc);
        }
        return strLine;
    }

    static long maxFromList(List<Long> longList) {
        return longList.stream().max(Comparator.naturalOrder()).get();
    }

    static long minFromList(List<Long> longList) {
        return longList.stream().min(Comparator.naturalOrder()).get();
    }

    public static int sumDigits(int n) {
        int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;
    }

    public static long sumDigits(long n) {
        long sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;
    }

    static List<Integer> getIntegerList(Scanner sc, int size) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            list.add(nint(sc));
        }
        return list;
    }

    static List<Long> getLongList(Scanner sc, int size) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            list.add(nlong(sc));
        }
        return list;
    }
}


Measured memory_bytes: 23764
N = int(input())

dp = [0] * (N + 1)

for i in range(1, N + 1):
    dp[i] = float('inf')
    p = 1
    while i - p >= 0:
        dp[i] = min(dp[i], dp[i - p] + 1)
        p *= 6
    q = 9
    while i - q >= 0:
        dp[i] = min(dp[i], dp[i - q] + 1)
        q *= 9
print(dp[N])

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts> auto make_v(size_t a,Ts... ts){   return vector<decltype(make_v<T>(ts...))>(a,make_v<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); }
template<typename T,typename U,typename... V> typename enable_if<is_same<T, U>::value!=0>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V> typename enable_if<is_same<T, U>::value==0>::type fill_v(U &u,const V... v){ for(auto &e:u) fill_v<T>(e,v...);}
//FUNCTION


void solve(void)
{
  int A,B;
  cin>>A>>B;
  if(B == 1)
  {
    cout<<0<<endl;
    return;
  }
  int ANS = 1;
  int TAP = A;
  while(true)
  {
    if(TAP >= B) break;
    ANS++;
    TAP += A -1;
  }

  cout<<ANS<<endl;
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


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

int main() {
    int max_value = 100003;
    vector<int> list(max_value);
    rep(i, max_value-1) list[i] = i + 2;

    int lim = (int)floor(sqrt(list[list.size() - 1]));
    for (int i = 0; list[i+1] > lim; i++) {
        int d = list[i];
        vector<int> multIdx;
        for (int k = i + 1; k < list.size(); k++) {
            if (list[k] % d == 0) {
                multIdx.push_back(k);
            }
        }
        reverse(multIdx.begin(), multIdx.end());
        rep(k, multIdx.size()) {
            list.erase(list.begin() + multIdx[k]);
        }
    }

    int x;
    cin >> x;

    int ok = list.size();
    int ng = -1;
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        if (list[mid] >= x)
            ok = mid;
        else
            ng = mid;
    }
    cout << list[ok] << endl;
}


Measured memory_bytes: 1024
N = gets.to_i
s = []
N.times do |i|
  s << gets.chomp.to_s
end

ans = {}
ret = 0
s.each do |t|
  key = t.split("").sort.join("")
  if ans.has_key?(key)
    ret += ans[key]
    ans[key] += 1
  else
    ans[key] = 1
  end
end

puts ret

Measured memory_bytes: 26620
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll k,n ;
	cin >> k >> n ;
	for(int i=n-k+1;i<=n+k-1;i++) cout << i << (i==n+k-1?"\n":" ") ;
}


Measured memory_bytes: 3608
n=int(input())
a=list(map(int,input().split()))
x4=0
x2=0
y=0
for i in range(len(a)):
    if a[i]%4==0:
        x4+=1
    elif a[i]%2==0:
        x2+=1
    else:
        y+=1
if x4>=y:
    print("Yes")
elif x4==1 and y==2 and x2==0:
    print("Yes")
elif x4>=(y-1) and x2==0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 62576
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>


using namespace std;



int main() {

	int A, B, C, D,E,F;
	cin >> A >> B >> C >> D >> E >> F;
	int ans = -1, h = -1; double n = -1;
	vector<int>t,s;
	bool z[1000] = {}, zz[10000] = {};
	for (int a = 0; a * 100 * A <= F; a++) {
		for (int b = 0; b * 100 * B + a * 100 * A <= F; b++) {
			if (!a)b++;
			if (!z[a*A + b*B]) {
				t.push_back(100 * (a*A + b*B));
				z[a*A + b*B] = 1;
			}

		}
	}
	

		for (int a = 0; a  * C <= F; a++) {
			for (int b = 0; b * D + a * C <= F; b++) {
				
				if (!zz[a*C + b*D]) {
					s.push_back((a*C + b*D));
					zz[a*C + b*D] = 1;
				}

			}
		}


			for (int i = 0; i < t.size(); i++) {
				for (int j = 0; j < s.size(); j++) {
					double w = 100*(double)s[j]/((double)t[i]+(double)s[j]);
				//	cout << t[i] + s[j] << endl;;
					if (w > n&&s[j]*100 <= E*t[i]&&t[i] + s[j] <= F) {
						n = w;
					//	cout << s[j] << " " << t[i] << endl;;
						ans = t[i] + s[j]; h = s[j];
					}
				}
			}
		//	cout << n;
	cout << ans << " " << h << endl;

		return 0;

}




Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int N=1,M=1;
int main(){
    while(N&&M){
        cin>>N>>M;
        int ln[N+1],lm[M+1];
        for(int i=1;i<N+1;i++){cin>>ln[i];}
        for(int i=1;i<M+1;i++){scanf("%d",&lm[i]);}
        int n=1;
        for(int i=1;i<M+1;i++){
            n=n+lm[i];
            n=n+ln[n];
            if(n>=N){cout<<i<<endl;break;}
        }
    }
}

Measured memory_bytes: 3132
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = 100000;
const int BLOCK = 320;
struct edge{
	int to, dis, clr;
	edge *nxt;
}edges[2*MAXN + 5], *adj[MAXN + 5], *ecnt = &edges[0];
void addedge(int u, int v, int c, int d) {
	edge *p = (++ecnt);
	p->to = v, p->clr = c, p->dis = d;
	p->nxt = adj[u], adj[u] = p;
	p = (++ecnt);
	p->to = u, p->clr = c, p->dis = d;
	p->nxt = adj[v], adj[v] = p;
}
int clr[MAXN + 5], dis[MAXN + 5];
int fa[MAXN + 5][20], dep[MAXN + 5];
int dfn[2*MAXN + 5], fir[MAXN + 5], bac[MAXN + 5], dcnt = 0;
void dfs(int x, int pre) {
	dfn[++dcnt] = x, fir[x] = dcnt;
	fa[x][0] = pre, dep[x] = dep[pre] + 1;
	for(int i=1;i<20;i++)
		fa[x][i] = fa[fa[x][i-1]][i-1];
	for(edge *p=adj[x];p;p=p->nxt)
		if( p->to != pre ) {
			dfs(p->to, x);
			clr[p->to] = p->clr, dis[p->to] = p->dis;
		}
	dfn[++dcnt] = x, bac[x] = dcnt;
}
int lca(int u, int v) {
	if( dep[u] < dep[v] ) swap(u, v);
	for(int i=19;i>=0;i--)
		if( dep[fa[u][i]] >= dep[v] )
			u = fa[u][i];
	if( u == v ) return u;
	for(int i=19;i>=0;i--)
		if( fa[u][i] != fa[v][i] )
			u = fa[u][i], v = fa[v][i];
	return fa[u][0];
}
struct query{
	int le, ri, num;
	int x, y;
}qry[MAXN + 5];
bool operator < (query a, query b) {
	return (a.le/BLOCK == b.le/BLOCK) ? a.ri < b.ri : a.le < b.le;
}
int nwres, cnt[MAXN + 5], tag[MAXN + 5];
int sum[MAXN + 5], ans[MAXN + 5];
void update(int x) {
	int y = dfn[x];
	if( tag[y] )
		cnt[clr[y]]--, sum[clr[y]] -= dis[y], nwres -= dis[y];
	else cnt[clr[y]]++, sum[clr[y]] += dis[y], nwres += dis[y];
	tag[y] ^= 1;
}
int main() {
	int N, Q; scanf("%d%d", &N, &Q);
	for(int i=1;i<N;i++) {
		int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
		addedge(a, b, c, d);
	}
	dfs(1, 0);
	for(int i=1;i<=Q;i++) {
		int x, y, u, v; scanf("%d%d%d%d", &x, &y, &u, &v);
		int l = lca(u, v);
		if( l == u || l == v ) {
			if( l == v ) swap(u, v);
			qry[i].le = fir[u] + 1, qry[i].ri = fir[v];
		}
		else {
			if( fir[u] > fir[v] ) swap(u, v);
			qry[i].le = bac[u], qry[i].ri = fir[v];
		}
		qry[i].num = i, qry[i].x = x, qry[i].y = y;
	}
	sort(qry + 1, qry + Q + 1);
	int l = 1, r = 0;
	for(int i=1;i<=Q;i++) {
		while( l > qry[i].le ) update(--l);
		while( r < qry[i].ri ) update(++r);
		while( l < qry[i].le ) update(l++);
		while( r > qry[i].ri ) update(r--);
		ans[qry[i].num] = nwres - sum[qry[i].x] + cnt[qry[i].x]*qry[i].y;
	}
	for(int i=1;i<=Q;i++)
		printf("%d\n", ans[i]);
}

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

int main()
{
	long long n, m;
	scanf("%lld%lld", &n, &m);
	if (m / 2 <= n)
		printf("%lld\n", m / 2);
	else
		printf("%lld\n", (2 * n + m) / 4);

	return 0;
}

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

min_dp = [-1] * N

min_dp[0] = P[0]

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

print(ans)

Measured memory_bytes: 26012
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int N,A;
int main() {
	cin>>N>>A;

	cout<<N*N-A<<endl;
 	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
   int n;
   scanf("%d", &n);
   int p[n];
   for(int i = 0; i < n; i++){
       scanf("%d", &p[i]);
   }
   
   int count = 0;
   for(int i = 0; i < n; i++){
       if(i+1!=p[i]){
           count++;
       }
   }

   if(count==2 || count==0){
       printf("YES");
   } else {
       printf("NO");
   }
   return 0;
}

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

using namespace std;

#define int long long
#define PB push_back
#define PPB pop_back
typedef pair<int, int> pii;
static const int INF = 1LL<<61;

int p[1005], n, m, nn;
vector<int> gedo;

inline void cut(int *k) {
  if (m < *k) *k = 0;
}

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

  while (cin >> n >> m, n) {
    gedo.clear();
    for (int i = 0; i < n; ++i) {
      cin >> p[i];
    }

    for (int i = 0; i < n; ++i) {
      for (int j = i; j < n; ++j) {
        gedo.PB(p[i] + p[j]);
      }

      gedo.PB(p[i]);
    }
    gedo.PB(0);
    sort(gedo.begin(), gedo.end());
    gedo.PB(INF);

    int ans = 0;
    for (int i = 0; i < gedo.size() - 1; ++i) {
      int l = 0, r = gedo.size() - 1, cur = gedo[i];

      while (1 <= r - l) {
        int j = (r + l) / 2, temp1 = cur + gedo[j], temp2 = cur + gedo[j + 1];
        cut(&temp1);
        cut(&temp2);
        ans = max(ans, temp1);

        if (temp1 != 0 && temp2 == 0) break;

        if (temp1 == 0) {
          r = j;
        } else {
          l = j + 1;
        }
      }
    }

    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
typedef long long ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()

const ll Mod = 1e9 + 7;
const int N = 2e5 + 7;
ll A[N] , table[N] ;

void upt(int x , ll val){
	while(x < N){
		table[x] += val;
		x += x&-x;
	}
}

ll query(int x){
	ll sum = 0;
	while(x){
		sum += table[x];
		x -= x&-x;
	}
	return sum;
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);


	ll n , k , x; cin >> n >> k;
	map<ll , ll> cord;
	cord[0];
	for(int i = 1;i <= n ;i++){
		cin >> x;
		x -= k;
		A[i] = A[i-1] + x;
		cord[A[i]];
	}
	int id = 1;
	for(auto it : cord)
		cord[it.F] = id++;

	for(int i = 0;i <= n ; i++)
		A[i] = cord[A[i]];

	ll ans = 0;
	for(int i = 0;i <= n ;i++){
		ans += query(A[i]);
		upt(A[i] , 1);
	}
	cout << ans << endl;

	return 0;
}









Measured memory_bytes: 15872
#include <iostream>
#include <vector>
#include <string.h>
#include <queue>
using namespace std;

struct edge{int to, cap, rev;};
int level[300];
int iter[300];
int INF = 100000000;

void bfs(vector< vector<edge> > &G, int s){
  memset(level, -1, sizeof(level));
  queue<int> que;
  level[s] = 0;
  que.push(s);
  while(!que.empty()){
    int v = que.front();
    que.pop();
    for(int i = 0; i < G[v].size(); ++i){
      edge &e = G[v][i];
      if(e.cap > 0 && level[e.to] < 0){
        level[e.to] = level[v] + 1;
        que.push(e.to);
      }
    }
  }
}


int dfs(vector< vector<edge> > &G, int v, int t, int f){
  if(v == t) return f;
  for(int &i = iter[v]; i < G[v].size(); ++i){
    edge &e = G[v][i];
    if(e.cap > 0 && level[v] < level[e.to]){
      int d = dfs(G,e.to,t,min(f,e.cap));
      if(d > 0){
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}


int max_flow(vector< vector<edge> > G, int s, int t){
  int flow = 0;
  for(;;){
    bfs(G,s);
    if(level[t] < 0) return flow;
    memset(iter,0,sizeof(iter));
    int f;
    while((f = dfs(G,s,t,INF)) > 0){
      flow += f;
    }
  }
}

int main(){
  int X, Y, E;
  cin >> X >> Y >> E;
  int x, y, V = X + Y + 2;
  vector< vector<edge> > G(V);
  for(int i = 0; i < E; ++i){
    cin >> x >> y;
    y += X;
    G[x].push_back((edge){y,1,G[y].size()});
    G[y].push_back((edge){x,0,G[x].size()-1});
  }
  int s = X + Y, t = X + Y + 1;
  for(int i = 0; i < X; ++i){
    G[s].push_back((edge){i,1,G[i].size()});
    G[i].push_back((edge){s,0,G[s].size()-1});
  }
  for(int i = 0; i < Y; ++i){
    G[X+i].push_back((edge){t,1,G[t].size()});
    G[t].push_back((edge){X+i,0,G[X+i].size()-1});
  }
  cout << max_flow(G,s,t) << endl;
  return 0;
}

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


class Main {
    static void solve(int n,int m,int k,long[]a){
        long[][]dp=new long[2][n];
        for(int i=0;i<n;++i){
            dp[0][i]=a[i];
        }
        int[]deq=new int[n];
        for(int i=1;i<k;++i){
            int s=0,t=0;
            int u=(i-1)%2;
            int nxt=1-u;
            for(int j=i-1;j<n;++j){
                if(j>=i){
                    assert s < t;
                    long val=dp[u][deq[s]]+(i+1)*a[j];
                    dp[nxt][j]=val;
                    if(deq[s]==j-m)s++;
                }
                while(s<t&&dp[u][deq[t-1]]<=dp[u][j])t--;
                deq[t++]=j;
            }
        }
        long ans=0;
        for(int i=k-1;i<n;++i)ans=Math.max(ans,dp[(k-1)%2][i]);
        out.println(ans);
    }
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n=sc.nextInt();
        int m=sc.nextInt();
        int k=sc.nextInt();
        long[]a=new long[n];
        for(int i=0;i<n;++i){
            a[i]=sc.nextLong();
        }
        solve(n,m,k,a);
        out.close();
    }
    // http://codeforces.com/blog/entry/7018
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 44532
#ABC130 C-Rectangle Cutting 14:59

W,H,x,y = map(int, input().split())

def func(W,H,x,y):
    if x == W/2 and y == H/2:
        return W*H/2, 1
    else:
        return W*H/2, 0
print(*func(W,H,x,y))

Measured memory_bytes: 9096
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

main(){
	int a,b,c;
	cin>>a>>b>>c;
	int s=a*b*c;
	if(s%2==0){
		dump(0);
	}else{
		dump(min({a*b,b*c,c*a}));
		//dump(s/max({a,b,c}));
	}
}

Measured memory_bytes: 384
import java.util.*;

class Main {
  private static final long MOD_CONST = 1000000007;
  
  private static long mul(long a, long b) {
    return a * b % 1000000007;
  }
  
  private static long solve(String text) {
    int[] count = new int[26];
    for (char c: text.toCharArray()) {
      count[c - 'a']++;
    }
    long result = 1;
    for (long c : count) {
      result = mul(result, (c + 1));
    }
    
    result--;
    result += MOD_CONST;
    result %= MOD_CONST;
    return result;
  }
  
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    
    int n = s.nextInt();
    String text = s.next();
    
    System.out.println(solve(text));
  }
}


Measured memory_bytes: 25716
h, n = map(int, input().split())
magic = []
a_max = 0
for i in range(n):
    a, b = map(int, input().split())
    a_max = max(a, a_max)
    magic.append((a, b))

dp = [float('inf')] * (h + a_max)
dp[0] = 0
for i in range(h):
    for a, b in magic:
        if i + a > h + a_max:
            continue
        dp[i + a] = min(dp[i] + b, dp[i + a])

print(min(dp[h:]))

Measured memory_bytes: 42076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll xs[100005]={0},ys[100005]={0};
vector<P> node[100005];
ll prim(){
  vector<bool> used(100005,false);
  used[0]=true;
  ll res=0;
  priority_queue<P,vector<P>,greater<P>> pque;
  for(int i=0;i<node[0].size();i++) pque.push(node[0][i]);
  while(!pque.empty()){
    P p=pque.top();
    pque.pop();
    ll cos=p.first,pos=p.second;
    if(used[pos]) continue;
    used[pos]=true;
    res+=cos;
    for(int i=0;i<node[pos].size();i++){
      ll to=node[pos][i].second;
      if(!used[to]) pque.push(node[pos][i]);
    }
  }
  return res;
}
int main(){
  ll n;
  cin>>n;
  vector<P> xv,yv;
  for(int i=0;i<n;i++){
    cin>>xs[i]>>ys[i];
    xv.push_back(P(xs[i],i));
    yv.push_back(P(ys[i],i));
  }
  sort(xv.begin(),xv.end());
  sort(yv.begin(),yv.end());
  for(int i=0;i<n;i++){
    if(i!=0){
      ll sx=xv[i-1].second,gx=xv[i].second;
      ll cos=xv[i].first-xv[i-1].first;
      node[sx].push_back(P(cos,gx));
      node[gx].push_back(P(cos,sx));

      ll sy=yv[i-1].second,gy=yv[i].second;
      ll cos2=yv[i].first-yv[i-1].first;
      node[sy].push_back(P(cos2,gy));
      node[gy].push_back(P(cos2,sy));
    }

    if(i!=n-1){
      ll sx=xv[i].second,gx=xv[i+1].second;
      ll cos=xv[i+1].first-xv[i].first;
      node[sx].push_back(P(cos,gx));
      node[gx].push_back(P(cos,sx));

      ll sy=yv[i].second,gy=yv[i+1].second;
      ll cos2=yv[i+1].first-yv[i].first;
      node[sy].push_back(P(cos2,gy));
      node[gy].push_back(P(cos2,sy));
    }
  }
  cout<<prim()<<endl;
}


Measured memory_bytes: 28648
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 1000000000;
using namespace std;
int main() {
  string n;
  while (getline(cin, n)) {
    string ans = n;
    for (int i = 0; i < 26; i++) {
      if (ans.find("the") != -1 || ans.find("that") != -1 ||
          ans.find("this") != -1)
        break;
      for (int j = 0; j < ans.size(); j++) {
        if (ans[j] == ' ' || ans[j] == '.')
          continue;
        if (ans[j] == 'z')
          ans[j] = 'a';
        else
          ans[j]++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define pi acos(-1)
#define line cout<<"------------------"<<endl
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define filein freopen("input.txt","r",stdin)
#define fileout freopen("output.txt","w",stdout)
#define inf (int)1e9+7
using namespace std;
string str,str1;
int dp[3009][3009];
int call(int i,int j)
{
    if(i==str.size() or j==str1.size()) return 0;
    int &ret=dp[i][j];
    if(ret!=-1) return ret;
    if(str[i]==str1[j]) return ret=1+call(i+1,j+1);
    return ret=max(call(i+1,j),call(i,j+1));
}
void path(int i,int j)
{

    if(i==str.size() or j==str1.size()) return ;
    if(str[i]==str1[j])
    {
        cout<<str[i];
        path(i+1,j+1);
    }
    else if(dp[i+1][j]>=dp[i][j+1])  path(i+1,j);
    else path(i,j+1);
}
int  main()
{
    memset(dp,-1,sizeof dp);
    cin>>str>>str1;
    call(0,0);
    path(0,0);
}


Measured memory_bytes: 35968
import java.util.Scanner;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        System.out.println(Integer.parseInt(scanner.next()) + Integer.parseInt(scanner.next()) / 2);
    }

}


Measured memory_bytes: 23508
#include<cstdio>
const int maxn = 15;
int n,arr[maxn];
int main(){
    scanf("%d",&n);
    while(n--){
        for(int i = 0;i < 10;++i)scanf("%d",&arr[i]);
        int b = 0,c = 0,flag = 1;
        for(int i = 0;i < 10;++i){
            if(b>arr[i]&&c>arr[i]){
                flag = 0;
                break;
            }else if(b<arr[i] && c<arr[i]){
                if(b<c)c = arr[i];
                else b = arr[i];
            }else if(b < arr[i]){
                b = arr[i];
            }else c = arr[i];
        }
        if(flag)printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;

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

const ld PI = acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
//const int mod = 998244353;

/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);

    char c;
    int n;
    cin >> c;
    char x =  c + 1;
    cout << x << '\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int M, D, cnt;

int main() {

	cin >> M >> D;

	REP(i, 4, M + 1) {
		REP(j, 10, D + 1) {
			int n, tmp = 0, tmp2 = 0;
			n = j;
			tmp = n % 10;
			n /= 10;
			tmp2 = n;
			if (tmp >= 2 && tmp2 >= 2) {
				if (tmp * tmp2 == i)cnt++;
			}
		}
	}

	cout << cnt << endl;


	return 0;
}

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

public class Program
{

    public void Proc()
    {
        int itemCount = int.Parse(Reader.ReadLine());
        int[] items = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        List<int> tmp = new List<int>();
        for (int i = 0; i < items.Length; i++) {
            if(i%2==0) {
                tmp.Add(items[i]);
            } else {
                tmp.Insert(0, items[i]);
            }
        }
        if(itemCount%2!=0) {
            tmp.Reverse();
        }
        Console.WriteLine(string.Join(" ", tmp));
        

    }


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"




4
1 2 3 4



";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 48544
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

/*
using PAIR = pair<string, int>;
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA() cerr << "AAAAA" << endl
#define debug_() cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;

using Graph = vector<vector<int>>;
using P = pair<int, int>;

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

    // int n;
    // cin >> n;
    string s;
    cin >> s;
    if(s.size()%2!=0){
        cout<<"No"<<endl;
        return 0;
    }
    for (int i = 0; i < s.size(); i++)
    {
        if (i % 2 == 0 && s[i] != 'h')
        {
            cout << "No" << endl;
            return 0;
        }
        else if (i % 2 == 1 && s[i] != 'i')
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256