akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
	string s;
	vector<int> pe, ap;
	int n;
	getline(cin, s);
	pe.push_back(0);
	ap.push_back(0);
	while(n=s.find("peach", pe.back() + 5), ~n)
		pe.push_back(n);
	while(n=s.find("apple", ap.back() + 5), ~n)
		ap.push_back(n);
	for(int i = 1; i < pe.size(); i++)
		s.replace(pe[i], 5, "apple");
	for(int i = 1; i < ap.size(); i++)
		s.replace(ap[i], 5, "peach");
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 2980
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int N = cin.nextInt();
		while(N--!=0){
			String str = cin.next();
			char[] s = str.toCharArray();
			Arrays.sort(s);
			char[] max = new char[8];
			for(int i = 0; i < 8;i++){
				max[i]=s[7-i];
			}
			int MAX = Integer.parseInt(String.valueOf(max));
			int MIN = Integer.parseInt(String.valueOf(s));
			System.out.println(MAX-MIN);
		}
	}

}

Measured memory_bytes: 12000
#pragma GCC optimize ("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
const Int Inf = 1e17;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define mp make_pair
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int(i)=0; i<n; i++)
#define rer(i,l,r) for(int i=l; i<=r; i++)
#define gnr(i,l,r) for(int i=r; i>=l; i--)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(pri2i,n-1)cout<<a[pri2i]<<' '; cout<<a[n-1]<<'\n';}
#define prip(p) cout<<p.fi<<' '<<p.se<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q,key;
string s,sb;
bool ok;

map<int,int>fac;
void dic(int n){
	if(n<=1)return;
  for (int i = 2; i*i <= n; i++){
    while(!(n%i)){
      fac[i]++;
      n/=i;
    }
  }
  if(n!=1)fac[n]++;
  return;
}

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

	Int ans=0; cin>>n;
	rer(i,2,n)dic(i); int n2=0,n4=0,n14=0,n24=0,n74=0;
	for(P p:fac){
		if(p.second>=74){n2++; n4++; n14++; n24++; n74++;}
		else if(p.second>=24){n2++; n4++; n14++; n24++;}
		else if(p.second>=14){n2++; n4++; n14++;}
		else if(p.second>=4){n2++; n4++;}
		else if(p.second>=2){n2++;}
	}
	pri1(n74+n24*(n2-1)+n14*(n4-1)+n4*(n4-1)/2*(n2-2));
}

Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }

const int MAXN = 100000;

int n;
char s[MAXN + 2];

vector<pair<int, int>> ans;

bool solve() {
	if (s[n] == '1' || s[1] == '0' || s[n - 1] == '0') return false;
	vector<int> sz;
	for (int i = 2; i <= n - i; ++i) { if (s[i] != s[n - i]) return false; if (s[i] == '1') sz.PB(i); }
	sz.PB(n);

	ans.clear();
	int at = 0, prv = -1;
	REPSZ(i, sz) {
		int cnt = sz[i] - (i == 0 ? 0 : sz[i - 1]);
		vector<int> id(cnt); REP(j, cnt) id[j] = at++;
		if (prv != -1) ans.PB(MP(prv, id[0]));
		FORSZ(j, 1, id) ans.PB(MP(id[0], id[j]));
		prv = id[0];
	}
	return true;
}

void run() {
	s[0] = '0'; scanf("%s", s + 1); n = strlen(s + 1);
	if (!solve()) { printf("-1\n"); return; }
	REPSZ(i, ans) printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
}

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


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

using namespace std;

typedef long long  ll;

ll n;
ll dp[100001], mdp[100001], odp[100001],omdp[100001],x[100001],v[100001],ox[100001];


int main() {

    ll n, c;
    scanf("%lld %lld", &n, &c);
    ll x[n], v[n], ox[n];
    ll res = 0;
    ll now = 0;
    for (int i = 0; i < n; i++) {
        scanf("%lld %lld", &x[i], &v[i]);//x cm, v kilocalories
        ox[i] = c - x[i];//counterclock length
    }
    
    for (ll i = 0; i < n; i++) {
        now += v[i];
        dp[i] = now - x[i];
        
        if (i == 0)
            mdp[i] = dp[i];
        else
            mdp[i] = max(mdp[i-1], dp[i]);
        
        res = max(res, now - x[i]);
    }
    
    now = 0;
    for (ll i = n-1; i >=0; i--) {
        now += v[i];
        
        odp[i] = now - ox[i];
        
        if (i == n-1)
            omdp[i] = odp[i];
        else
            omdp[i] = max(omdp[i+1], odp[i]);
        
        res = max(res, now-ox[i]);
    }
    
    now = 0;
    for (ll i = n -1; i > 1; i--) {
        now += v[i];
        res = max(res, mdp[i-1] + now - 2*ox[i]);
    }
    now = 0;
    for (ll i = 0; i < n-1; i++) {
        now += v[i];
        res = max(res, omdp[i+1] + now - 2*x[i]);
    }
    
    printf("%lld", res);
    
    
    return 0;
}



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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL);
  int n;
  cin >> n;
  vector<vector<int > >a(2, vector<int>(n)), col(2, vector<int>(n));
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < n; j++)
      cin >> a[i][j];
  }
  col[0][0] = a[0][0];
  col[1][0] = a[0][0]+a[1][0];
  for (int i = 1; i < n; i++) {
    col[0][i] = col[0][i-1]+ a[0][i];
    col[1][i] = a[1][i] + max(col[1][i-1],col[0][i]); 
  }
  cout << col[1][n-1] << endl;
  
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
int main(){
  int n;
  cin>>n;
  vector<int>h(n);
  rep(i,n)cin>>h[i];
  int pre=-1;
  rep(i,n){
    if(h[i]-1>=pre)pre=h[i]-1;
    else if(h[i]>=pre)pre=h[i];
    else {
      puts("No");
      return 0;
    }
  }puts("Yes");
}


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

long long func(long long n) {
  if (n % 2 == 0) {
    if ((n/2) % 2 == 0) return n;
    else return 1 ^ n;
  }
  else {
    if (((n+1)/2) % 2 == 0) return 0;
    else return 1;
  }
}

int main() {
  long long A, B; cin >> A >> B;
  if (A == 0) cout << func(B) << endl;
  else cout << (func(A-1) ^ func(B)) << endl;
}

Measured memory_bytes: 256
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;



      cin>>n>>m;

      for(i=0; i<max(n,m); i++)
      {
          cout<<min(n,m);
      }

      cout<<endl;



}



Measured memory_bytes: 3620
import copy
import heapq
import math
import fractions

def j(n):
    if n:print("Yes")
    else:print("No")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


n,m = ips()
correct = [0 for i in range(n+1)]
wasu = [0 for i in  range(n+1)]
for loop in range(m):
    q,r = input().split()
    q = int(q)
    if r == "WA":
        if correct[q]==0:
            wasu[q]+=1
    else:
        correct[q] = 1
allwa = 0
for i in range(len(correct)):
    if correct[i]:
        allwa+=wasu[i]
print(sum(correct),allwa)

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

using std::cin;
using std::cout;

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

  std::vector<int> a(n);
  for (size_t i = 0; i < n; ++i)
  {
    cin >> a[i];
  }

  auto last_it = a.end();
  do
  {
    auto ait = std::min_element(a.begin(), last_it);
    // int atacker = std::distance(a.begin(), it);
    if (*ait == 1)
    {
      std::cout << 1 << "\n";
      return 0;
    }

    for (auto it = a.begin(); it != last_it; ++it)
    {
      if (ait != it)
      {
        if (*it - *ait < 0)
        {
          *it = 0;
        }
        else
        {
          *it = *it % *ait;
        }
      }
    }

    last_it = std::remove_if(a.begin(), last_it, [](int x) { return x == 0; });
    // std::for_each(a.begin(), last_it, [](int x) { std::cout << x << ","; });
    // std::cout << "\n";
  } while (std::distance(a.begin(), last_it) != 1);

  std::cout << a.front() << "\n";

  // cout << *std::find_if(a.begin(), a.end(), [](int x) { return x > 0; })
  //      << "\n";

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
 
#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
 
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
using namespace std;

const ll mod = 1e9 + 7;

void solve() {
    ll m1, d1, m2, d2;
    cin>>m1>>d1>>m2>>d2;
    if(m1==2 and d1==28){cout<<1;return;}
    else if(m1==2){cout<<0;return;}
    if(m1==1 or m1==3 or m1==5 or m1==7 or m1==8 or m1==10 or m1==12) {
        if(d1==31)cout<<1;
        else cout<<0;
        return;
    }
    if(d1==30)cout<<1;
    else cout<<0;
}

int main()
{
    fastIO;ll t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 256
/***************************************************
 * Problem Name : B.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2020-02-20
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    //~ __FastIO;
    //~ cout << setprecision (10);
    //~ cout << fixed;
    string str;
    cin >> str;

    for (auto s : str) cout << "x";

    nl;
    return 0;
}


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

int main(){
    int n , k , temp ;
    vector<int> v ;
    cin >> n >> k ;
    for(int i=0 ; i<n ;i++){
        cin >> temp  ;
        v.push_back(temp) ;
    }
    sort(v.begin(),v.end()) ;

    if(k>= n){
        cout << "0" <<endl ;
    }else{
        long long s = 0;
        for(int i=0 ;i<n-k ; i++){
            s += v[i] ;
        }
        cout << s <<endl ;
    }
    return 0 ;
}


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

int main() {
    int N;
    cin >> N;
    long long res = 0LL;

    for(int i = 1; i <=N ; ++i) {
        if(i%3 && i%5) {
            res += i;
        } 
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3632
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int y = Integer.valueOf(s.substring(0, 4));
		int m = Integer.valueOf(s.substring(5, 7));
		int d = Integer.valueOf(s.substring(8, 10));

		if ( m >= 5 ){
			System.out.println("TBD");
		}else{
			System.out.println("Heisei");
		}

	}
}

Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const int MAXN = 2000005;
const int mod = 998244353;

int n, m;
lint fact[MAXN], invf[MAXN];

lint ipow(int x, int p){
	lint ret = 1, piv = x;
	while(p){
		if(p & 1) ret = ret * piv % mod;
		piv = piv * piv % mod;
		p >>= 1;
	}
	return ret;
}

lint binom(int x, int y){
	return fact[x] * (invf[y] * invf[x - y] % mod) % mod;
}

int f(int n, int odds, int sum){
	lint ret = 0;
	for(int i=0; i<=odds && i <= sum && i <= n; i++){
		if(sum % 2 == i % 2){
			ret += binom((sum - i) / 2 + n - 1, n - 1) * binom(n, i) % mod;
		}
	}
	return ret % mod;
}

lint g(int n, int sum){
	return binom(sum + n - 1, n - 1);
}

int main(){
	fact[0] = invf[0] = 1;
	for(int i=1; i<MAXN; i++){
		fact[i] = fact[i-1] * i % mod;
		invf[i] = ipow(fact[i], mod - 2);
	}
	cin >> n >> m;
	lint ret = f(n, m, 3 * m);
	for(int i=2*m+1; i<=3*m; i++){
		ret += mod - n * g(n - 1, 3 * m - i) % mod;
	}
	cout << ret % mod << endl;
}


Measured memory_bytes: 31488
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

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

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

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

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

//////////////////////////////////////
map<vll,ll> mp;
ll N;
vll A;

void dfs(ll i, ll j, ll q, ll r) {
	ll ret = INF;

	for (ll k = i + 1; k < j; k++) {
		if (!mp.count({ i,k,q,q + r })) { dfs(i, k, q, q + r); }
		if (!mp.count({ k,j,q + r,r })) { dfs(k, j, q + r, r); }

		ll now = mp[{i, k, q, q + r}] + mp[{k, j, q + r, r}] + (q + r) * A[k];

		ret = min(ret, now);
	}

	if (j == i + 1) { ret = 0; }

	mp[{i, j, q, r}] = ret;
	//cout << i << j << q << r << " " << ret << endl;
}

int main() {
	cin >> N;
	A.assign(N + 1, 0);
	repn(i, N) cin >> A[i];

	dfs(1, N, 1, 1);
	ll ans = mp[{1, N, 1, 1}] + A[1] + A[N];
	cout << ans << endl;
}

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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> out(N);
  //入力部
  for (int j=1;j<=M;j++) {
    int x,y;
    cin >> x >> y;
    out.at(x-1)++;
    out.at(y-1)++;
  }
  //出力部
  for (int i=1;i<=N;i++) {
    cout << out.at(i-1) << endl;
  }
}

Measured memory_bytes: 256
n = int(input())
sList = []
for i in range(n):
    sList.append(input())
D = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for j in sList:
    D[j] += 1
print('AC x', D['AC'])
print('WA x', D['WA'])
print('TLE x', D['TLE'])
print('RE x', D['RE'])

Measured memory_bytes: 16328
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;

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

void readline(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readline(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}
/*
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}*/

int main(){

    int N;
    cin >> N;
    vector<int> A(N);
    readline(N, A);

    ll sum = 0;

    for(int i = 0; i < N; i++){
        sum += A[i] - 1;
    }

    cout << sum;

    return 0;
}

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





int main(){
  


  int64_t n;
  cin>>n;
  
  vector<vector<int64_t>> data(n,vector<int64_t>(10));
  
  
  vector<vector<int64_t>> price(n,vector<int64_t>(11));
  
  
  for (int64_t i=0;i<n;i++){ 
    for (int64_t j=0;j<10;j++){
      int64_t tmp;
      cin>>tmp;
      data.at(i).at(j)=tmp;
    }
  }
  
  for (int64_t i=0;i<n;i++){
    for (int64_t j=0;j<11;j++){
      int64_t tmp;
      cin>>tmp;
      price.at(i).at(j)=tmp;
    }
  }
  
  
  
  
  int64_t answer=-1000000000;
  
  for (int64_t i=1;i<(1<<10);i++){
    bitset<10> s(i);
    
    int64_t tmp=0;
    

    for (int64_t j=0;j<n;j++){
      int64_t count=0;
      for (int64_t k=0;k<10;k++){
        if (data.at(j).at(k)==1 and s.test(k)==1){
          count++;
        }
      }
      tmp+=price.at(j).at(count);
    }
    
    answer=max(answer,tmp);
  }
  
 
    cout<<answer<<endl;
    
    
    
    

      
  
    

  
  
    
  
  
  
}

Measured memory_bytes: 256
//I wanna summarize the graph
//Here we go
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstring>
#define M 5010
#define N 60
using namespace std;
typedef pair<int,int> Pair;
//How to save a Graph?
//It's easy
struct node
{
	int from,to,value,next;
}e[M];
int tot,st[M];
int n,m;
//How to add a point?
void add(int x,int y,int z)
{
	e[++tot].to=y;
	e[tot].from=x;
	e[tot].value=z;
	e[tot].next=st[x];
	st[x]=tot;
}int vis[N],ans,x,y;
void dfs(int now)
{
	vis[now]=1;
	for (int i=st[now];i;i=e[i].next)
		if (!vis[e[i].to] && e[i].value)
			dfs(e[i].to);
}

main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
		scanf("%d%d",&x,&y),
		add(x,y,1),add(y,x,1);
	for (int i=1;i<=tot;i+=2)
	{
		memset(vis,0,sizeof vis);
		e[i].value=0,e[i+1].value=0;
		dfs(1);
		int flag=1;
		for (int j=1;j<=n;j++)
			if (!vis[j])
			{
				flag=0;
				break;
			}
		if (!flag)
			ans++;
		e[i].value=1,e[i+1].value=1;
	}
	printf("%d\n",ans);
 } 

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<unordered_set>
#include<vector>
#include<cstring>
#include<sstream>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;

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

    long long total = 0;
    map<int, int> cnt;

    int tmp;
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        cnt[tmp] ++;
        total += tmp;
    }

    int q;
    cin >> q;

    int b, c;
    for (int i = 0; i < q; i++) {
        cin >> b >> c;

        int v1 = cnt[b];

        total -= cnt[b]*b;
        total += cnt[b]*c;

        cnt[b] = 0;
        cnt[c] += v1;

        cout << total << endl;
    }
}


Measured memory_bytes: 7508
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
  int x3 = x2 + (y1 - y2);
  int y3 = y2 - (x1 - x2);
  int x4 = x3 + (x1 - x2);
  int y4 = y3 + (y1 - y2);
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1000006;
const int M = 1000000007;

int n;
char a[N];

int dp[N][2];

int main()
{
    cin >> a;
    n = strlen(a);
    dp[0][1] = 1;
    for (int i = 0; i < n; ++i)
    {
        if (a[i] == '1')
        {
            dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % M;
            dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % M;
            dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % M;

            dp[i + 1][0] = (dp[i + 1][0] + dp[i][1]) % M;
            dp[i + 1][1] = (dp[i + 1][1] + dp[i][1]) % M;
            dp[i + 1][1] = (dp[i + 1][1] + dp[i][1]) % M;
        }
        else
        {
            dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % M;
            dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % M;
            dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % M;

            dp[i + 1][1] = (dp[i + 1][1] + dp[i][1]) % M;
        }
    }
    cout << (dp[n][0] + dp[n][1]) % M << endl;
    return 0;
}


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

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


Measured memory_bytes: 3096
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;

		while((str=br.readLine()) != null){
			int n = Integer.parseInt(str);
			int un,ri;

			boolean prime[] = new boolean[50100];
			prime[0]=true;

			for(int i=2; i<50100; i++){
				if(!prime[i]){
					for(int j=i*2; j<50100; j=j+i){
						prime[j]=true;
					}
				}
			}

			for(un=n-1;prime[un];un--);
			for(ri=n+1;prime[ri];ri++);

			System.out.println(un + " " + ri);

		}

	}
}

Measured memory_bytes: 20804
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  string s,t; cin >> s >> t;
  if (s == t.substr(0,t.size()-1)) {
    COUT("Yes");
  }
  else COUT("No");

  return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
 #define rep(i, n) for (int i = 0; i < (int)(n); i++)
 #define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
int main(){
    int n;
    cin>>n;
    vector<string> s(n);
    map<string,int> p;
    bool ans = true;
    rep(i,n){
        cin>>s[i];
        p[s[i]]++;
        if(p[s[i]]==2){
            ans = false;
        }
    }
    rep(i,n-1){
        if(s[i][s[i].size()-1]!=s[i+1][0]){
            ans = false;
            break;
        }
    }
    if(ans){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

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

using namespace std;

#define Rep(i,a,b)  for (int i=(a);i<(b);i++)
#define rep(i,n)    for (int i=0;i<(n);i++)
#define all(x)      (x).begin(), (x).end()

#define ll long long

int main()
{
	string s;
	cin >> s;
	rep (i, s.length())
		if (s[i] == '1')
			s[i] = '9';
		else if (s[i] == '9')
			s[i] = '1';
	cout << s << endl;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from itertools import accumulate
INF = float("inf")


def solve(N: int, M: int, V: int, P: int, A: "List[int]"):

    # 降順
    A.sort(reverse=True)
    acc = [0]+list(accumulate(A))

    left = P-1
    right = len(A)
    L = M*(V-N)-acc[P-1]
    K = A[P-1]-M
    while right - left > 1:
        mid = (right + left)//2
        cap = (mid-P+1)*A[mid] - acc[mid]
        if A[mid] < K or cap < L:
            right = mid
        else:
            left = mid
    print(right)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    V = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, V, P, A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21492
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll x, ll y) {
	ll res = 1;
	for (ll i = 0; i < y; i++) res = res * x % mod;
	return res;
}

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

int main() {
	int n;
	cin >> n;
	ll ans = 0;
	for (int a = 1; a <= n; a++) {
		int max_b;
		if (n % a == 0) {
			max_b = n / a - 1;
			ans += max_b;
		}
		else {
			max_b = n / a;
			ans += max_b;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3548
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;

#define mk make_pair



int main(){
    int time;
    cin>>time;
    for(int p=0;p<time;p++){
    
    
        if(p!=0){cout<<endl;}
    int n;
    cin>>n;
    char a[1000][1000];
    fill(&a[0][0],&a[999][1000],' ');
    char t='u';
    a[n+99][100]='#';
    pair<int,int> w=mk(n+99,100);
        int j=0;
    while(j!=2){
        if(t=='u'){
            if(a[w.first-1][w.second]=='#'){break;}
            if(a[w.first-2][w.second]=='#' || w.first==100 || a[w.first-1][w.second+1]=='#'){t='r'; j++; continue;}
            w.first--;
        }
        if(t=='r'){
            if(a[w.first][w.second+1]=='#'){break;}
            if(a[w.first][w.second+2]=='#' || w.second==99+n || a[w.first+1][w.second+1]=='#'){t='d'; j++; continue;}
            w.second++;
        }
        if(t=='d'){
            if(a[w.first+1][w.second]=='#'){break;}
            if(a[w.first+2][w.second]=='#' || w.first==99+n || a[w.first+1][w.second-1]=='#'){t='l'; j++; continue;}
            w.first++;
        }
        if(t=='l'){
            if(a[w.first][w.second-1]=='#'){break;}
            if(a[w.first][w.second-2]=='#' || w.second==100 || a[w.first-1][w.second-1]=='#'){t='u'; j++; continue;}
            w.second--;
        }
        a[w.first][w.second]='#';
        j=0;
    }
    
    for(int i=100;i<n+100;i++){
        for(int t=100;t<n+100;t++){
            cout<<a[i][t];
        }
        cout<<endl;
    }
        
        
        
    }
    
    
    return 0;
}


Measured memory_bytes: 4064
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	sorted := make([]int, n)
	copy(sorted, a)
	sort.Sort(sort.Reverse(sort.IntSlice(sorted)))
	for _, e := range a {
		ans := sorted[0]
		if e == ans {
			ans = sorted[1]
		}
		fmt.Println(ans)
	}
}


Measured memory_bytes: 8064
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn mod_pow(a: i64, b: i64, m: i64) -> i64 {
    let mut ans = 1;
    let mut b = b;
    let mut a = a;
    while b != 0 {
        if b % 2 == 1 {
            ans = (ans * a) % m;
        }
        a = (a * a) % m;
        b /= 2;
    }
    ans
}

fn main() {
    let N: i64 = read();
    let MOD: i64 = 10_i64.pow(9) + 7;
    let mut ans = (mod_pow(10, N, MOD) - mod_pow(9, N, MOD) * 2 + mod_pow(8, N, MOD)) % MOD;
    if ans < 0 {
        ans += MOD;
    }
    println!("{}", ans);
}


Measured memory_bytes: 2128
N, M = map(int, input().split())
A = list(map(int, input().split()))
D = [(A[i], 1) for i in range(N)]

for i in range(M):
  B, C = (map(int, input().split()))
  D.append((C, B))
  
D.sort()
D.reverse()

ans, left = 0, N
for (i, j) in D:
    use = min(j, left)
    ans += use * i
    left -= use
print(ans)

Measured memory_bytes: 34280
inp=input()
former=int(inp[0]+inp[1])
latter=int(inp[2]+inp[3])

if 0< former <=12 and 0< latter <=12:
	print("AMBIGUOUS")
elif 0< former <=12 :
	print("MMYY")
elif 0< latter <=12 :
	print("YYMM")
else:
	print("NA")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
#define def(i,x,y)for(int i=x;i>=y;--i)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define SZ(x) ((int)x.size())
typedef long long LL;
typedef pair<int,int> PII;
int read(){
	char c=getchar();int d=0,f=1;
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f=-1;
	for(;c>='0'&&c<='9';d=d*10+c-48,c=getchar());
	return d*f;
}
const int N=200010;
const int mod=998244353;
int n;char a[N];
int s1[N],s2[N];
int main(){
	scanf("%d%s",&n,a+1);
	ref(i,1,n)s1[i]=s1[i-1]+(a[i]!='.');
	def(i,n,1)s2[i]=s2[i+1]+(a[i]!='#');
	int ans=1e9;
	ref(i,0,n)ans=min(ans,s1[i]+s2[i+1]);
	cout<<ans<<endl;
}

Measured memory_bytes: 2176
#include<cstdio>
char s[101];
int p,tmp,i;
bool flag=false;
inline void read()
{
	char ch;
	while(ch<'A'||ch>'Z') ch=getchar();
	while(ch>='A'&&ch<='Z') s[p++]=ch,ch=getchar();
}
int main()
{
	read();
	for(i=0;i<p;i++) if(s[i]=='C') {flag=true,tmp=i;break;}
    for(i=tmp+1;i<p;i++) if(flag&&s[i]=='F') {printf("Yes\n");return 0;}
    printf("No\n");
	return 0;
}

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

int main(){
    int n,k;
    cin>>n>>k;
    bool check[n+1] ;
    memset(check,false,sizeof(check));
    int count=0;
    while(k--){
        int d;
        cin>>d;
        while(d--) {
            int x;
            cin >> x;
            check[x] = true;
        }
    }
    for(int i=1;i<n+1;i++){
        if(check[i]==false)
            count++;
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include<stdio.h>
int main(){
  int n, S[10000], q, T[10000], i, j, cnt = 0;
 
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    scanf("%d", &S[i]);
 
  scanf("%d", &q);
  for(j = 0; j < q; j++)
    scanf("%d", &T[j]);
   
 
   
  for(i = 0; i < q; i++)
    for(j = 0; j < n; j++)
      if(T[i] == S[j])   {
    cnt++;
    break;
      }
 
  printf("%d\n", cnt);
  return 0;
}

Measured memory_bytes: 648
import Data.List

solve x = if x == 0
    then "NO"
    else "YES"


main = do
    n <- map read . words<$>getLine ::IO [Int]
    a <- map read . words<$>getLine ::IO [Int]
    let aa = sort a
    let b = aa ++ [0]
    let bb = 0:aa
    let c = zipWith (-) b bb
    --let d = find (==0) c
    let e = [e | e <- c, e > -1]
    let f = sort e
    let g = head f
    let h = solve g 
    putStrLn $ h

Measured memory_bytes: 79356
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void solve() {
    int n;
    cin>>n;
    vi a(n);
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
        sum += a[i];
    }
    int m1 = 0 , m2 = 0;
    int a1 = sum / n;
    int a2 = a1 + 1;
    for(int i = 0 ; i< n ; i++){
        m1 += (a[i] - a1) * (a[i] - a1);
        m2 += (a[i] - a2) * (a[i] - a2);
    }
    cout<<min(m1 , m2)<<endl;

}

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

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

	}
	ll r;
	r = b%a;
	if (r == 0)return a;
	else return gcd(r, a);

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

ll MAX(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
//MAX

ll MIN(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
//MIN

bool p_judge(ll p) {

	if (p == 1)return false;
	else if (p == 2)return true;
	else {

		bool flag = true;
		for (int i = 2; i <= sqrt(p); i++) {

			if (p%i == 0) {

				flag = false;
				break;

			}

		}
		return flag;

	}

}
//素数判定,素数=true,合成数=false

int main() {

	string S;
	cin >> S;
	if (S == "abc" || S == "acb" || S == "bac" || S == "bca" || S == "cab" || S == "cba")cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

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

int main() {

  int N, l, r;
  cin >> N;
  
  int  M = 0;
  
  for (int i = 0; i < N; i++) {
    cin >> l >> r;
    
    for (int j = l; j <= r; j++) {
      M++;
    }
  }
    
  cout << M << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define M 100

void caesar(char ch[]){
  int i,j;
  char pre_ch[M];
  int ans;

  for(i=-30;i<=30;i++){
    for(j=0;ch[j];j++)
      if('a'<=ch[j] && ch[j]<='z'){
        pre_ch[j]=ch[j]+i;
        if(pre_ch[j]<'a')
          pre_ch[j]+=26;
        else if('z'<pre_ch[j])
          pre_ch[j]-=26;
      }
      else
        pre_ch[j]=ch[j];

    pre_ch[j]=0;

    for(j=0;pre_ch[j];j++)
      if(pre_ch[j]=='t' && pre_ch[j+1]=='h')
        if(pre_ch[j+2]=='e' ||
            pre_ch[j+2]=='i' && pre_ch[j+3]=='s' ||
            pre_ch[j+2]=='a' && pre_ch[j+3]=='t'){
          printf("%s\n",pre_ch);
          return;
        }
  }
}

int main(void){
  int i;
  int sf;
  char ch[M];
  int c;

  sf=0;

  for(;sf==0;){
    for(i=0;;i++){
      c=scanf("%c",&ch[i]);
      if(c==EOF){
        sf=1;
        break;
      }else if(ch[i]=='\n'){
        ch[i]=0;
        break;
      }
    }
    if(sf==1)
      break;

    caesar(ch);
  }

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cmath>

using namespace std;

int main(int argc, char **argv)
{
	float x, q;
	while(cin >> q){
		if(q == -1){
			break;
		}
		x = q/2;
		while(fabs(x*x*x-q) > 0.00001*q){
			x = x-(x*x*x-q)/(3*x*x);
		}
		printf("%.6f\n", x);
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>

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

using namespace std;

const double EPS=1e-8;

template<class T>
struct interval{
	T a,b;
	int id;
	bool operator<(const interval &I)const{ return a+EPS<I.a || abs(a-I.a)<EPS && b+EPS<I.b; }
};

double calc_width(vector< interval<double> > &I){
	int n=I.size();
	if(n==0) return 0;
	sort(I.begin(),I.end());

	double res=0;
	double left=0,right=0;
	rep(i,n){
		if(i==0 || right+EPS<I[i].a){
			res+=right-left;
			left=I[i].a;
			right=I[i].b;
		}
		else{
			right=max(right,I[i].b);
		}
	}
	res+=right-left;

	return res;
}

int main(){
	for(int test=1,n;scanf("%d",&n),n;test++){
		pair< double,interval<double> > E[200];
		rep(i,n){
			double x,y,r; scanf("%lf%lf%lf",&x,&y,&r);
			E[2*i+0]=make_pair(y-r,(interval<double>){x-r,x+r,i});
			E[2*i+1]=make_pair(y+r,(interval<double>){x-r,x+r,i});
		}
		sort(E,E+2*n);

		vector< interval<double> > I;
		double ans=0,h=0,w=0;
		rep(t,2*n){
			interval<double> J=E[t].second;

			bool in=true;
			rep(i,I.size()) if(I[i].id==J.id) { in=false; I.erase(I.begin()+i); break; }
			if(in) I.push_back(J);

			ans+=(E[t].first-h)*w;
			h=E[t].first;
			w=calc_width(I);
		}

		printf("%d %.2f\n",test,ans+EPS);
	}

	return 0;
}

Measured memory_bytes: 0
//author: dazhong_feliks

#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  
if (N == 1 || N == 2 || N == 3 || N == 4 || N == 5 || N == 6 || N == 7 || N == 8 || N == 9 || 
    
N == 10 || N == 12 || N == 14 || N == 15 || N == 16 || N == 18 || N == 20 || N == 21 || N == 24 ||

N == 25 || N == 27 || N == 30 || N == 32 || N == 36 || N == 40 || N == 42 || N == 45 || N == 48 || N == 49 || N == 54 ||

N == 56 || N == 63 || N == 64 || N == 72 || N == 81){
  cout << "Yes";
  }
else {
  cout << "No" << endl;
}
}

Measured memory_bytes: 256
// フェルマーの小定理
package main

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

const (
	m = 1000000007
)

func mpow(x, y int) int {
	result := 1
	for y != 0 {
		if y&1 == 1 {
			result *= x
			result %= m
		}
		x *= x
		x %= m
		y >>= 1
	}
	return result
}

var (
	fac []int
)

func initFactorialTable(n int) {
	fac = make([]int, n+1)
	fac[0] = 1
	for i := 0; i < n; i++ {
		fac[i+1] = fac[i] * (i + 1) % m
	}
}

func mcomb(n, k int) int {
	if n == 0 && k == 0 {
		return 1
	}
	if n < k || k < 0 {
		return 0
	}
	return (fac[n] * mpow(fac[n-k], m-2) % m) * mpow(fac[k], m-2) % m
}

func main() {
	N := readInt()
	K := readInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = readInt()
	}

	initFactorialTable(N - 1)

	sort.Sort(sort.Reverse(sort.IntSlice(A)))
	maxX := 0
	for i := 0; i < N-K+1; i++ {
		maxX += A[i] * mcomb(N-(i+1), K-1)
		maxX %= m
	}

	sort.Ints(A)
	minX := 0
	for i := 0; i < N-K+1; i++ {
		minX += A[i] * mcomb(N-(i+1), K-1)
		minX %= m
	}

	// maxX も minX も負の可能性があるので正に揃える
	maxX += m
	maxX %= m
	minX += m
	minX %= m

	fmt.Println((maxX - minX + m) % m)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 6212
/**
*	created: 11.09.2020 21:25:54
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rrep(i,n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> inline bool chmax(T &a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> inline bool chmin(T &a, T b) {if (b < a) {a = b; return 1;} return 0;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

// Floyd-Warshall Algorithm
struct graph{
    int n; 
    vector<vector<int>> m;
    graph(int i) : n(i), m(i,vector<int>(i,INF)) {
        rep(i,n) m[i][i] = 0;
    }
    void add_edge(int a, int b, int cost) {
        chmin(m[a][b], cost);
        chmin(m[b][a], cost);
    }
    void floyd_warshall() {
        rep(k,n) rep(i,n) rep(j,n) chmin(m[i][j], m[i][k] + m[k][j]);
    }
};

signed main() {
    int n, m, r; cin >> n >> m >> r;
    vector<int> v(r);
    rep(i,r) {cin >> v[i]; v[i]--;}
    sort(all(v));
    graph g(n);
    rep(i,m) {
        int a, b, c; cin >> a >> b >> c;
        a--; b--;
        g.add_edge(a,b,c);
    }
    g.floyd_warshall();
    int ans = INF;
    do {
        int tmp = 0;
        rep(i,r-1) tmp += g.m[v[i]][v[i+1]]; 
        chmin(ans,tmp);
    } while(next_permutation(all(v)));
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 3736
n = int(input())
height = list(map(int, input().split()))

dp = [0] * n

dp[0] = 0
dp[1] = abs(height[1] - height[0])
# dp[2] = abs(height[2] - height[0])

for i in range(2, n):
    t1 = abs(height[i] - height[i - 1])
    t2 = abs(height[i] - height[i - 2])
    dp[i] = min(t1 + dp[i - 1], t2 + dp[i - 2])
    # print(dp[i])
print(dp[-1])

Measured memory_bytes: 13980
#include <iostream>
#include <string>
using namespace std;
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	string s;
	int cnt=0,n;
	cin >> s;
	n = s.length();

	REP(i,n){
		cnt += (s[i]=='0')? -1:1;
	}

	println(s.length()-abs(cnt));

	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define all(v)           ((v).begin()), ((v).end())
#define sz size()
#define clr(v,d)         memset(v,d,sizeof(v))
#define rep(i, v)        for(int i=0;i<(v).sz;++i)
#define lp(i, n)         for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)     for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)     for(int i=(j);i>=(int)(n);--i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define sci(a)	scanf("%d",&a)
#define scii(a, b)	scanf("%d%d",&a, &b)
#define pri(a)	printf("%d\n",a)
#define prii(a, b)	printf("%d %d\n",a, b)
#define DB1(a)          std::cout<<#a<<"="<<(a)<<endl
#define DB2(a,b)        std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<endl
#define DB3(a,b,c)      std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<endl
#define DB4(a,b,c,d)    std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<endl
#define DB5(a,b,c,d,e)  std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<endl
typedef pair<int, int> pii;
typedef long long ll;
const ll  inf = 1000000000000000000LL;
const double EPS = 1e-9;
const ll mod = 1000000007ll;
#define PI acos(-1)

const int maxn = 300500;



int a[maxn];

int main(){
	int n; sci(n);
	lp(i, n) sci(a[i]);
	int ret = 0;
	while (true){
		bool f = 1;
		lp(i, n) if (a[i] % 2) f = 0;
		if (!f) break;
		ret++;
		lp(i, n) a[i] = a[i] / 2;
	}
	pri(ret);
}



Measured memory_bytes: 256
N=gets.to_i
ps=[nil]+gets.split.map(&:to_i)
ps_i=[]*(N+1)
ps.each_with_index do |o,i|
    next if i==0
    ps_i[o]=i
end
cd=[0,ps_i[N],N+1]
ans=0
(1..N-1).to_a.reverse.each do |e|
    ndx=cd.bsearch_index{|x|ps_i[e]<x}
    cd.insert(ndx,ps_i[e])
    if cd[ndx+1]==N+1
        r=0
    else
        r=e*(cd[ndx+2]-cd[ndx+1])*(cd[ndx]-cd[ndx-1])
    end
    if cd[ndx-1]==0
        l=0
    else
        l=e*(cd[ndx-1]-cd[ndx-2])*(cd[ndx+1]-cd[ndx])
    end
    ans+=r+l
end
p ans


Measured memory_bytes: 14484