akhauriyash/Code-Regression huggingface dataset:
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fivecxed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; } value
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> vec(n);
  REP(i,n) {
    cin >> vec[i];
    if(vec[i] % 2 == 0 && vec[i] % 3 != 0 && vec[i] % 5 != 0) {
      cout << "DENIED" << endl;
      return 0;
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}
//templete by private_yusuke


Measured memory_bytes: 256
from collections import Counter
S = input()

counter = dict(Counter(S))
counter = sorted(counter) 
alphabets = "abcdefghijklmnopqrstuvwxyz"

found = False
for letter in alphabets:
    if letter in counter:
        continue
    else:
        found = True
        print(letter)
        break

if found is not True:
    print("None")


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007

int bs(ll k,vector<ll> & v){
  int l = -1,r = v.size();
  while(r-l > 1){
    int mid = (l+r)/2;
    if(v[mid] < k)l = mid;
    else r = mid;
  }
  return r;
}

int main(){
  
  ll n;
  cin >> n;
  vector<vector<ll>> v(30);
  vector<P> w(n);
  rep(i,n){
    string s;cin >> s;
    ll a = 0,b = 0,digit = 0;
    rep(k,s.size()){
      if(s[k] == '.'){
        for(ll j = k+1;j < s.size();j++)b = b*10+s[j]-'0',digit++;
        break;
      }
      a = a*10+s[k]-'0';
    }
    a *= 1000000000ll;
    rep(g,9-digit)b *= 10ll;
    a += b;
    ll two = 0,five = 0;
    while(!(a & 1))two++,a >>= 1;
    while(!(a % 5))five++,a /= 5;
    w[i] = make_pair(five,two);
    v[five].push_back(two);
  }
  rep(i,30)sort(ALL(v[i]));
  ll res = 0;
  rep(i,n){
    ll k = max(0,18-w[i].first);
    for(ll j = k;j < 30;j++){
      ll pos = max(0,bs(18-w[i].second,v[j]));
      ll l = v[j].size();
      res += l - pos;
    }
    if(w[i].first >= 9 && w[i].second >= 9)res--;
  }
  res >>= 1;
  cout << res << "\n";
  

  return 0;
}

Measured memory_bytes: 7080
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000007

typedef  long long ll;

using namespace std;

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

ll deg(int i){
  ll ret = 1;
  while(i != 0){
    if(i/10 == 0){
      break;
    }
    i/=10;
  }
  return i;
}

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


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


Measured memory_bytes: 3652
#include <stdio.h>

int main (){

     int n[1000], x[1000];
     int a=0;
     int b;
     int c[1000] = {0};

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

     for (b = 0; b < a; b++){
          int i, j, k;
          for (i = 1; i < n[b] + 1; i++) {
               for (j = i + 1; j < n[b] + 1; j++) {
                   for (k = j + 1; k < n[b] + 1; k++) {
                        if (x[b] == i + j + k){
                             c[b] = c[b] + 1;
                        }
                   }
                }
           }
           printf("%d\n", c[b]);
      }

     return 0;

}

Measured memory_bytes: 2688
// https://atcoder.jp/contests/abc126_a

#include <iostream>
using namespace std;

int r, D, x;

int main()
{
    cin >> r >> D >> x;
    for (int i = 0; i < 10; ++i)
    {
        x = r * x - D;
        cout << x << endl;
    }
}


Measured memory_bytes: 256
#pana a 
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(a[k-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n; cin >> n;
  VI a(n);
  for (int & x: a) cin >> x;
  sort(a.rbegin(), a.rend());
  ll ans = 0;
  for (int i = 1; i < n; i++) {
    ans += a[i/2];
  }
  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 3932
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

int main() {
	int n;
	cin >> n;
	int dp[200020] = {};
	for (int i = 0; i < n - 1; i++) {
		int a;
		cin >> a;
		dp[a]++;
	}
	for (int i = 1; i <= n; i++) {
		cout << dp[i] << endl;
	}
}

Measured memory_bytes: 4396
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld double
#define ff first
#define ss second
ll mod = 1000000007;
void fun(){
	string s; cin>>s;
	int ans=0;
	for(int i=1;i<(int)s.length();++i){
		if(s[i]!=s[i-1]) ++ans; 
	}
	cout<<ans<<"\n";
	return;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t=1; //cin>>t;
	while(t--){
		fun();
	}
	return 0;
}



Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int A,B,C;
  cin>>A>>B>>C;
  int a=min({A,B,C});
  int b=max({A,B,C});
  int ans=10*b+a+(A+B+C-b-a);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#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(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//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() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素



signed main(){
  int H,W;
  cin>>H>>W;
  vector<string> game_map(H);
  vector<vector< int> > dist;
  queue<pair<int,int> > que;
  que.push(MP(0,0));
  vector<int> a(W,-1);
  for(int i=0;i<H;i++){
    cin>>game_map.at(i);
    dist.PB(a);
  }
  dist[0][0]=1;
  int first_white=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(game_map[i][j]=='.')first_white++;
    }
  }
  while(!que.empty()){

    pair<int,int> now=que.front();
    que.pop();
    for(int i=-1;i<=1;i++){
      for(int j=-1;j<=1;j++){
        if(i==0&&j==0){
          continue;
        }
        if((i!=0&&j!=0))continue;
        if(now.F+i<0||now.F+i>=H||now.S+j<0||now.S+j>=W){
          continue;
        }
        if(game_map[now.F+i][now.S+j]=='#')continue;
        if(dist[now.F+i][now.S+j]<0){
          que.push(MP(now.F+i,now.S+j));
          dist[now.F+i][now.S+j]=dist[now.F][now.S]+1;
        }
      }
    }



    
  }

    if(dist[H-1][W-1]==-1){
      cout<<"-1"<<endl;
    }else{
      cout<<first_white-dist[H-1][W-1]<<endl;
    }

}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n,c;
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		c=0;
		while(n!=1){
			if(n%2==0)n/=2;
			else      n=3*n+1;
			c++;
		}
		printf("%d\n",c);
	}
	return 0;
}

Measured memory_bytes: 600
#include<stdio.h>

int main(){
    int A[3];
    int K;
    int max=0;
    int index;
    int i, ans = 0;

    for(i=0; i<3; i++){
        scanf("%d", &A[i]);
        if(max<A[i]){
            max = A[i];
            index = i;
        }
    }

    scanf("%d", &K);

    for(i=0; i<K; i++){
        A[index] = A[index]*2;
    }
    for(i=0; i<3; i++){
        ans += A[i];
    }
    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int i,j,r,c;
    int t[101][101];
    int sum;
    
    for(i=0; i<101; i++){
        for(j=0; j<101; j++){
            t[i][j]=0;
        }
    }
    
    scanf("%d %d",&r,&c);
    
    for(i=0; i<r; i++){
        sum = 0;
        for(j=0; j<c; j++){
            scanf("%d",&t[i][j]);
            sum += t[i][j];
        }
        t[i][c] = sum;
    }
    
    for(i=0; i<c+1; i++){
        sum = 0;
        for(j=0; j<r; j++){
            sum += t[j][i];
        }
        t[r][i] = sum;
    }
    
    for(i=0; i<r+1; i++){
        for(j=0; j<c+1; j++){
            if(j!= 0)printf(" ");
            printf("%d",t[i][j]);
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2104
#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>
#include <functional>
using namespace std;
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)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

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

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

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from, to}}的に使う。
const ll INF = 1001001001001001001;
const double pi = acos(-1);

int main()
{
    ll n, m;
    cin >> n >> m;
    vector<ll> a(m);
    vector<ll> v(n + 1, 0);
    v[0] = 1;
    v[1] = 1;
    for (int i = 0; i < m; i++)
    {
        cin >> a[i];
        v[a[i]] = -1;
    }
    for (int i = 2; i < n + 1; i++)
    {
        if (v[i] != -1)
        {
            (v[i] = max(v[i - 1], 0ll) + max(v[i - 2], 0ll)) %= 1000000007;
        }
    }
    cout << max(v[n], 0ll) << endl;
    // debug_vec(v);

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int a[1000007],n,id;
int main()
{
	cin>>n;
	int maxx=-1;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]>maxx){
			maxx=a[i];
			id=i;
		}
	}
	int mid=maxx/2+(maxx%2==1?1:0),ans,cnt=1999999999;
	for(int i=1;i<=n;i++){
		if(i==id) continue;
		if(abs(mid-a[i])<=cnt){
			cnt=abs(mid-a[i]);
			ans=a[i];
		}
	}
	cout<<maxx<<" "<<ans;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline T read(){
	T f=0,x=0;char c=getchar();
	while(!isdigit(c)) f=c=='-',c=getchar();
	while(isdigit(c)) x=x*10+c-48,c=getchar();
	return f?-x:x;
}
#define int long long
namespace run{
	inline char getc(){
		char c=getchar();
		while(c!='L' && c!='R' && c!='U' && c!='D') c=getchar();
		return c;
	}

	const int N=20009,inf=1e18;
	int head[N],nex[N],to[N],w[N],fl[N],cnt=1;
	inline void add(int u,int v,int flow,int c){
	//	cout<<u<<" "<<v<<" "<<flow<<" "<<c<<endl;
		nex[++cnt]=head[u],head[u]=cnt,to[cnt]=v,w[cnt]=c,fl[cnt]=flow;
		nex[++cnt]=head[v],head[v]=cnt,to[cnt]=u,w[cnt]=-c,fl[cnt]=0;
	}
	int S,T,dist[N],vis[N],pre[N],mnfl[N];
	queue<int> q;
	inline bool spfa(){
		for(int i=1;i<=T;i++) dist[i]=-inf;
		dist[S]=0,q.push(S),mnfl[S]=inf;

		while(!q.empty()){
			int u=q.front();q.pop();
			vis[u]=0;
			for(int i=head[u];i;i=nex[i]){
				if(fl[i]>0 && dist[to[i]]<dist[u]+w[i]){
					dist[to[i]]=dist[u]+w[i],pre[to[i]]=i;
					mnfl[to[i]]=min(mnfl[u],fl[i]);
					if(!vis[to[i]]) q.push(to[i]),vis[to[i]]=1;
				}
			}
		}
		if(dist[T]==-inf) return 0;
		return 1;
	}
	inline void upd(){
		int tmp=T;
		while(tmp!=S){
			int nxt=to[pre[tmp]^1];
			fl[pre[tmp]]-=mnfl[T],fl[pre[tmp]^1]+=mnfl[T];
			tmp=nxt;
		}
	}

	typedef pair<int,int> P;
	int n,X[N],Y[N],V[N],m,A[N],B[N];char s[N];
	P L[N],R[N];
	int main(){
		n=read<int>();
		for(int i=1;i<=n;i++)
			X[i]=read<int>(),Y[i]=read<int>(),V[i]=read<int>();
		m=read<int>();
		for(int i=1;i<=m;i++)
			s[i]=getc(),A[i]=read<int>(),B[i]=read<int>();
		
		int ans=0;
		for(int k=1;k<=n;k++){
			for(int i=1;i<=2*n+2*k+2;i++) head[i]=0;
			cnt=1;
			for(int i=1;i<=k;i++) L[i]=P(-inf,inf),R[i]=P(-inf,inf);
			for(int i=1;i<=m;i++){
				if(s[i]=='L') for(int j=B[i]+1;j<=k;j++) L[j].first=max(L[j].first,A[i]+1);
				if(s[i]=='R') for(int j=1;j<=k-B[i];j++) L[j].second=min(L[j].second,A[i]-1);
				if(s[i]=='D') for(int j=B[i]+1;j<=k;j++) R[j].first=max(R[j].first,A[i]+1);
				if(s[i]=='U') for(int j=1;j<=k-B[i];j++) R[j].second=min(R[j].second,A[i]-1);
			}

			for(int i=1;i<=k;i++)
				for(int j=1;j<=n;j++){
					if(L[i].first<=X[j] && X[j]<=L[i].second) add(i,j+k,1,0);
					if(R[i].first<=Y[j] && Y[j]<=R[i].second) add(k+n+j,i+k+2*n,1,0);
				}

			S=2*k+2*n+1,T=S+1;
			for(int i=1;i<=k;i++) add(S,i,1,0),add(i+k+2*n,T,1,0);
			for(int i=1;i<=n;i++) add(i+k,i+k+n,1,V[i]);

			int ret=0;
			while(spfa()) ret+=dist[T]*mnfl[T],upd();
			ans=max(ans,ret);
		}
		printf("%lld\n",ans);
		return 0;
	}
}
#undef int
int main(){
#ifdef my
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	return run::main();
}

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

int main() {
  int a,b,c,d; cin >> a >> b >> c >> d;
  if((abs(b-a)<=d&&abs(c-b)<=d)||(abs(c-a)<=d)) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

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

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

  int a[12];
  for(int i=0;i<12;i++) cin >> a[i];

  sort(a, a+12);

  bool flag = false;
  int count = 0;
  for(int i=0;i<12;i++){
    if(i == 0){
      count = 0;
      continue;
    } else if(i == 4){
      count = 4;
      continue;
    } else if(i == 8){
      count = 8;
      continue;
    } else{
      if(a[count] != a[i]) flag = true;
    }
  }

  if(flag) cout << "no" << endl;
  else cout << "yes" << endl;

  return 0;
}



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


int main() {
  ll N = 0;
  vector<ll> h(100000);
  vector<ll> jump_cost(100000);
  cin >> N;
  rep (i, N) cin >> h.at(i);

  rep (i, N){
    if (i == 0){
      jump_cost.at(i) = 0;
      continue;
    }
    else if (i == 1){
      jump_cost.at(i) = jump_cost.at(i-1) + abs(h.at(i-1) - h.at(i));
      continue;
    }
    else{
      jump_cost.at(i) = min(jump_cost.at(i-1) + abs(h.at(i-1) - h.at(i)), jump_cost.at(i-2) + abs(h.at(i-2) - h.at(i)));
    }
  }
  cout << jump_cost.at(N-1) << endl;
}


Measured memory_bytes: 1792
object Main extends App{
val n = scala.io.StdIn.readInt()
val as = scala.io.StdIn.readLine().split("\\s").map(_.toInt).sortBy(_ * -1)

var cnt = 0
for (i <- 0 until as.length) {
  if (i%2==0) cnt += as(i) else cnt -= as(i)
}
println(cnt)
}

Measured memory_bytes: 25404
#include<iostream>
using namespace std;
int main(){
  int N,max,counter;
  cin>>N;
  int arr[N];
  for(int i=0;i<N;i++){
    cin>>arr[i];
  }
  max = arr[N-1];
  if(N==1){
	counter = 1;
  }
  for(int i =N-2;i >= 0;i--){
  	counter = 0;
    if(arr[i] <= max+1){
      counter = 1;
      if(max > arr[i]){
	      max = arr[i];
        }

	}else{
      cout<<"No"<<endl;
      break;
 	 }
  } 
  if(counter == 1){
  cout<<"Yes"<<endl;
  }
  return 0;
}



Measured memory_bytes: 640
(defun main ()
  (let ((n (read))
        (b (make-array 1 :element-type 'integer
                         :initial-element 200000
                         :adjustable t
                         :fill-pointer 1))
        (ans 0))
    (dotimes (i (1- n))
      (vector-push-extend (read) b))
    (vector-push-extend 200000 b)
    (loop for i from 0 below n
          do (incf ans (min (aref b i) (aref b (1+ i)))))
    (format t "~A~%" ans)))

(main)


Measured memory_bytes: 16228
#include <iostream>
    using namespace std;
     
    int main() {
    	string S;
    cin>>S;
    if(S[6]>'4')
    {
    cout<<"TBD"<<endl;
    }
    else if(S[6]=='1')
    {
    if(S[5]=='1')
    {
    cout<<"TBD"<<endl;
    }
    else 
    cout<<"Heisei"<<endl;
    }
     
    else if(S[6]=='2')
    {
    if(S[5]=='1')
    {
    cout<<"TBD"<<endl;
    }
    else 
    cout<<"Heisei"<<endl;
    }
    else if(S[6]=='3')
    {
    cout<<"Heisei"<<endl;
    }
    else if(S[6]=='4')
    {
    cout<<"Heisei"<<endl;
    }
    	
    else if(S[6]=='0')
    {
    cout<<"TBD"<<endl;
    }	
    }


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <string>
#include <vector>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n - 1); i >= 0; --i)
#define D(n, retu)                                                             \
  REP(i, n) { cin >> retu[i]; }
#define mod 1000000007
#define INF 93193111451418101
#define MIN -93193111451418101
//#define INF 931931114518101
using namespace std;
typedef pair<ll, ll> P;
template <typename T> void fill_all(T &arr, const T &v) { arr = v; }
template <typename T, typename ARR> void fill_all(ARR &arr, const T &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
#define yo 100001
//------------------変数-----------------------//
char grid[100][100];
ll n, m;
P p[100];
std::vector<vector<ll>> G(100);
bool vis[100];
//-------------------関数----------------------//

ll dfs(ll v, ll a, ll b) {
  vis[v] = false;
  REP(i, G[v].size()) {
    if (v == a && G[v][i] == b) {
      continue;
    } else if (v == b && G[v][i] == a) {
      continue;
    }
    if (!vis[G[v][i]]) {
      continue;
    }
    dfs(G[v][i], a, b);
  }
}

int main() {
  cin >> n >> m;
  REP(i, m) {
    ll a, b;
    cin >> a >> b;
    p[i] = P(a, b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  ll cnt = 0;
  REP(i, m) {
    fill_all(vis, true);
    dfs(1, p[i].first, p[i].second);

    REP(i, n) {
      if (vis[i + 1] == true) {
        cnt++;
        break;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
Adj_dict = {}
for i in range(n):
    new = {i:[]}
    Adj_dict.update(new)
for _ in range(m):
    a, b = map(int, input().split())
    Adj_dict[a-1].append(b-1)
    Adj_dict[b-1].append(a-1)

Visit_list = [True] + [False for _ in range(n-1)]
count = 0

def Path(dict, start, Visited):

    if all(Visited):
        global count
        count += 1
        return

    for node in dict[start]:
        if Visited[node] == False:
            Visited[node] = True
            Path(dict, node, Visited)
            Visited[node] = False
    return

Path(Adj_dict, 0, Visit_list)
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
#define pb push_back
#define mp make_pair
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;
 
const int inf = int(1e9);
const int mod = 1e9 + 7;
const int N = 1e6 + 555;
const long double PI = acos(-1.0);

set<int> st[27];
void solve()
{
	string a, b;
	cin >> a >> b;
	for(int i = 0; i < sz(a); ++i){
		st[a[i] - 'a'].insert(i);
	}
	ll cur = -1;
	ll s = sz(a);
	ll res = 0;
	for(int i = 0; i < sz(b); ++i){
		if(st[b[i] - 'a'].empty()){
			cout << -1;
			return;
		}	
		auto it = st[b[i] - 'a'].upper_bound(cur);
		if(it == st[b[i] - 'a'].end()) res += s, cur = *st[b[i] - 'a'].begin();
		else {
			cur = *it;
		}
	}
	cout << res + (cur + 1);

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

Measured memory_bytes: 5200
#include <stdio.h>          // printf()

int
main(int argc, char** argv)
{
	int i, j;

	for (i = 1; i <= 9; ++i)
	{
		for (j = 1; j <= 9; ++j)
			printf("%dx%d=%d\n", i, j, i * j);
	}

	return 0;
}

Measured memory_bytes: 524
// --------------
// Tejas Pandey  |
// 05 - 07 - 20  |
// Atcoder BC 173|
// --------------

#include <bits/stdc++.h>
using namespace std;
     
#define mod 1000000007
#define vi vector<int>
typedef long long int ll;
     
int main (void){
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  //cin >> t;
  while(t--){
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0;i < n;i++) cin >> a[i];
	sort(a,a+n);
	ll ans = 0,cur = n - 1,rem = 1;
	for(int i = 0;i < n - 1;i++){
		if(!rem) rem = 2,cur--;
		ans += a[cur];
		rem--;
	}
	cout << ans << "\n"; 
  }
  return 0;
}


Measured memory_bytes: 5224
#include <bits/stdc++.h>
 using namespace std;
 typedef long long ll;
 #define rep(i, n) for(int i = 0; i < (int)(n); i++)
 int main() {
   ll N, c_m = 0, c_a = 0, c_r = 0, c_c = 0, c_h = 0;
   ll ans;
   string tmp;
   cin >> N;
   rep(i, N) {
     cin >> tmp;
     if (tmp.at(0) == 'M') c_m++;
     if (tmp.at(0) == 'A') c_a++;
     if (tmp.at(0) == 'R') c_r++;
     if (tmp.at(0) == 'C') c_c++;
     if (tmp.at(0) == 'H') c_h++;
   }
   ans = c_m * c_a * c_r + c_m * c_a * c_c + c_m * c_a * c_h + c_m * c_r * c_c + c_m * c_r * c_h + c_m * c_c * c_h + c_a * c_r * c_c + c_a * c_r * c_h + c_a * c_c * c_h + c_r * c_c * c_h;
   cout << ans << endl;
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int A, B, T;
    cin >> A >> B >> T;
    cout << T / A * B << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 100

int bubble[N];
int n,count=0;

void print(){
	int i;
	for(i=0;i<n-1;i++){
		printf("%d ",bubble[i]);
	}	
	printf("%d\n%d\n",bubble[i],count);
}

void Bubble(){
	int i,j,tmp;
	for(i=0;i<n-1;i++){
		for(j=n-1;j>i;j--){
			if(bubble[j] < bubble[j-1]){
				tmp=bubble[j];
				bubble[j] = bubble[j-1];
				bubble[j-1] = tmp;
				count++;
			}
		}
	}
}

int main(){
	int i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&bubble[i]);
	}
	Bubble();
	print();
return 0;
}

Measured memory_bytes: 2720
# -*- coding: utf-8 -*-
import numpy as np

H, W = [int(x) for x in input().split()]
N = int(input())
a = [int(x) for x in input().split()]

grid = []
for i, ai in enumerate(a):
    grid = grid + ([i+1] * ai)

grid = np.array(grid).reshape((H, W))

for i in range(H):
    if i % 2 ==0:
        print(' '.join(map(str, list(grid[i,:]))) )
    else:
        print(' '.join(map(str, list(grid[i,::-1]))) )


Measured memory_bytes: 21668
#include <iostream>
#include <string>

using namespace std;

int main(void) {
    string s;
    cin >> s;
    for(int i=0; i<s.size(); i++) {
        if(i%2 == 0) {
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
int n, m;
int start;
struct edge
{
    int to, cost;
    edge(int to, int cost) : to(to), cost(cost) {}
};
vector<edge> G[18];
int dp[1<<18][18];
int dfs(int bit, int now)
{
    if(dp[bit][now] >= 0) return dp[bit][now];
    if(now == 0 and __builtin_popcount(bit) == n) return dp[bit][now] = 0;
    int res = INF;
    for(int u = 0; u < G[now].size(); u++)
    {
        edge e = G[now][u];
        if(bit & (1<<e.to)) continue;
        res = min(res, dfs(bit | (1<<e.to), e.to) + e.cost);
    }
    return dp[bit][now] = res;
}
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    memset(dp, -1, sizeof(dp));
    cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        int s, t, d; cin >> s >> t >> d;
        G[s].push_back(edge(t, d));
    }
    int ans = dfs(0, 0);
    cout << (ans == INF ? -1 : ans) << endl;
    return 0;
}




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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end()
#define P pair<int , int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void){

  int X;  cin >> X;
  int keep = X % 100, limit = X / 100, diff = 5;
  int ans = 0;
  while(limit){

    if(keep >= diff){
      keep -= diff;
      limit -= 1;
    }else
      diff -= 1;

    if(keep == 0){
      ans = 1;
      break;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.cpp
 * Author: baisganon
 *
 * Created on 2017/06/04, 20:12
 */

#include<iostream>
using namespace std;

int BinarySearch(int x,int S[],int N){
    int B = 0;
    int T = N-1;
    
    while(B<=T){
        int mid = (B+T)/2;
        if(S[mid]==x){
            return mid;
        }else if(S[mid]<x){
            B = mid+1;
        }else{
            T = mid-1;
        }
    }
    
    return -1;
}

int main(){
	int data1;
	cin >> data1;
	int* list1 = new int[data1+1];
	for(int i=0;i<data1;i++){
		cin >> list1[i];
	}

	int data2;
	cin >> data2;
	int* list2 = new int[data2];
	for(int i=0;i<data2;i++){
		cin >> list2[i];
	}

	int count=0;
	for(int i=0;i<data2;i++){
		if(BinarySearch(list2[i],list1,data1)!=-1)
			count++;
	}
	
	cout << count << endl;
	delete[] list1,list2;
	return 0; 
}

Measured memory_bytes: 3256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する

class Dijkstra{
public:
    struct edge{ll to,cost;};
    typedef pair<ll,ll> P;//firstは最短距離、secondは頂点の番号

    int V;//超点数
    vector<vector<edge> > G;//グラフ,G[i]はiから出る辺の集合,G[i][j]はiから出る辺のj番目の辺
    vector<ll> d; //最短距離

    //0origin
    Dijkstra(int N){
        V = N;
        G = vector<vector<edge> >(N);
        d = vector<ll>(N);
    };

    void dijkstra(int s){
        priority_queue<P,vector<P>,greater<P> > que;
        fill(d.begin(),d.end(),INFl);
        d[s] = 0;
        que.push(P(0,s));

        while(!que.empty()){
            P p = que.top();que.pop();
            ll v = p.second;
            if(d[v] < p.first) continue;
            for(int i = 0; i < G[v].size(); i++){
                edge e = G[v][i];
                if (d[e.to] > d[v] + e.cost && !(d[e.to] == INFl && d[v] == INFl)) {
                    d[e.to] = d[v] + e.cost;
                    que.push(P(d[e.to],e.to));
                }
            }
        }

    }
    /* 頂点fromに頂点toに達するコストcostの辺を貼る */
    void addEdge(int from,int to,int cost){
        edge e;
        e.to = to;
        e.cost = cost;
        G[from].push_back(e);
    }
};


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

    int K;
    cin >> K;
    Dijkstra dij(K);
    rep(i,1,K){
        dij.addEdge(i,(i+1)%K,1);
        dij.addEdge(i,i * 10 % K,0);
    }

    dij.dijkstra(1);
    cout << dij.d[0] + 1 << endl;


    return 0;
}


Measured memory_bytes: 9212
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b;
    cin >> n >> a >> b;
    ll ans = 0;
    ans += ((n)/(a+b))*a;
    n -= ((n)/(a+b))*(a+b);
    ans += min(n,a);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
struct UnionFind{
    vl par;
    UnionFind(ll N):par(N){
        rep(i,N)par[i]=i;
    }
    ll root(ll x){
        if(par[x]==x)return x;
        return par[x]=root(par[x]);
    }
    bool same(ll x,ll y){
        return root(x)==root(y);
    }
    void unite(ll x,ll y){
        x=root(x),y=root(y);
        if(x==y)return;
        par[x]=y;
        return;
    }
};
int main(){
    ll N,M,K;cin>>N>>M>>K;
    UnionFind tree(N);
    vector<set<ll>> block(N),follow(N);
    rep(i,M){
        ll A,B;cin>>A>>B;
        tree.unite(--A,--B);
        follow[A].insert(B);
        follow[B].insert(A);
    }
    rep(i,K){
        ll A,B;cin>>A>>B;
        block[--A].insert(--B);
        block[B].insert(A);
    }
    vl count(N);
    rep(i,N){
        count[tree.root(i)]++;
    }
    rep(i,N){
        ll ans=count[tree.root(i)]-1;
        for(auto p:follow[i])if(tree.same(i,p))ans--;
        for(auto p:block[i])if(tree.same(i,p))ans--;
        if(i)cout<<" ";cout<<ans;
    }cout<<endl;
    return 0;
}

Measured memory_bytes: 32128
from itertools import permutations
a = list(map(int, input()))

op = ['+', '+', '+', '-', '-', '-']
for ops in permutations(op, 3):
    now = a[0]
    for i in range(3):
        if ops[i] == '+':
            now += a[i+1]
        else:
            now -= a[i+1]
    if now == 7:
        print("{}{}{}{}{}{}{}=7".format(
            a[0], ops[0], a[1], ops[1], a[2], ops[2], a[3]))
        exit()


Measured memory_bytes: 9080
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n,m = readInts()
    A = readInts()
    if n - sum(A) < 0:
        print('-1')
    else:
        print(n - sum(A))
if __name__ == '__main__':
  main()


Measured memory_bytes: 9884
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int main() {
  int n = 0;
  cin >> n;
  char s[200];
  cin >> s;
  if(n % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }
  for(int i = 0, j = (n >> 1); j < n; ++i, ++j) {
    if(s[i] != s[j]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int ans;
	if (s == "SUN")
		ans = 7;
	else if (s == "MON")
		ans = 6;
	else if (s == "TUE")
		ans = 5;
	else if (s == "WED")
		ans = 4;
	else if (s == "THU")
		ans = 3;
	else if (s == "FRI")
		ans = 2;
	else if (s == "SAT")
		ans = 1;
	cout << ans << endl;
}

Measured memory_bytes: 3592
#include <iostream>

using namespace std;

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

    int ans = 0;
    for(int i = 0; i < 101; ++i)
    {
        if(((A <= i) && (i <= B)) && ((C <= i) && (i <= D)))
        {
            ans++;
        }
    }
    cout << max(ans-1, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    char[] S = sc.next().toCharArray();
    
    for (int i = 0; i < S.length; i++) {
      S[i] = (char)((S[i] - 'A' + N) % 26 + 'A');
    }
    System.out.print(String.valueOf(S));
  }
}

Measured memory_bytes: 23764
#include<iostream>
using namespace std;
typedef long long LL;

LL gcd(LL a,LL b) {
	if (b == 0)return a;
	return gcd(b,a%b);
}
LL lcm(LL a, LL b) {
	if (b == 0)return 0;

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

int main() {
	int a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f, a, b, c, d, e, f) {

		LL cx=0, cy=0, cz=0;

		int x = 1, y = 1, z = 1;

		do {
			x = (a*x) % b;
			cx++;
		} while (x != 1);

			do {
				y = (c*y) % d;
				cy++;
			} while (y != 1);

			do {
				z = (e*z) % f;
				cz++;
			} while (z != 1);

			cout << lcm(lcm(cy, cx), cz) << endl;
	}
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i=0;i<N;i++){
    cin >> d.at(i);
  }
  int64_t ans=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      ans+=d.at(i)*d.at(j);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
tdlist = lambda i, j, value=0: [[value] * j for _ in range(i)]
MOD = 10**9+7

s = [-1 if x == "?" else int(x) for x in input()[::-1]]
n = len(s)
m = 13
dp = tdlist(n+1, m)
dp[0][0] = 1

digrem = 1
for i in range(n):
    adds = [digrem * j % m for j in range(10)]
    for j in range(m):
        if not dp[i][j]: continue
        if s[i] == -1:
            for k in range(10):
                dp[i+1][(j+adds[k]) % m] += dp[i][j]  % MOD     
        else:
            dp[i+1][(j+adds[s[i]]) % m] += dp[i][j] % MOD

    digrem = digrem * 10 % m

print(dp[n][5] % MOD)


Measured memory_bytes: 64984
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll h[100010];
    rep(i, n) cin >> h[i];
    h[n] = h[n + 1] = LINF;
    ll Min[100010];
    rep(i, 100010) Min[i] = LINF;
    Min[0] = 0;

    rep(i, n) {
        Min[i + 1] = min(Min[i + 1], Min[i] + abs(h[i + 1] - h[i]));
        Min[i + 2] = min(Min[i + 2], Min[i] + abs(h[i + 2] - h[i]));
    }

    cout << Min[n - 1] << endl;

    return 0;
}


Measured memory_bytes: 1792
a,b,c,d = map(int, input().split())
flg = ''
while flg == '':
    c = c-b
    if c <= 0:
        flg = 'taka'
        break
    a = a-d
    if a <= 0:
        flg = 'aoki'
        break
if flg == 'taka':
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9108
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
using static AtCoder.AtCoderLib;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new ABC125().SolveD(new ConsoleInput(Console.In, ' '));
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }

    public static class AtCoderLib
    {
        // ユークリッドの互除法 
        public static int Gcd(int a, int b)
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
    }
  class ABC125
  {
    public void SolveD(ConsoleInput cin)
        {
            var n = cin.ReadInt;
            var A = cin.ReadIntArray(n);
            int count = 0;
            long sum = 0;
            int min = (int)Pow(10, 9);
            foreach (var a in A)
            {
                sum += Abs(a);
                if (min > Abs(a)) min = Abs(a);
                if (a <= 0) count++;
            }
            if (count % 2 == 1) sum -= min * 2;
            WriteLine(sum);
            ReadLine();
        }
  }
}


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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 200007 , mo = 1000000007;

int n,col[_],las[_]={0};
lint f[_]={0};

int main()
{
	n=ty();
	for(int i=1;i<=n;i++)col[i]=ty();

	for(int i=1;i<=n;i++)
	{
		f[i]=f[i-1];
		if(las[col[i]] && col[i]!=col[i-1])f[i]=(f[i]+f[las[col[i]]]+1)%mo;
		las[col[i]]=i;
	}
	printf("%lld\n",(f[n]+1)%mo);

	return 0;
}


Measured memory_bytes: 3456
import java.io.*;
import java.util.*;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int na[][] = new int[n][2];
        int ma[][] = new int[m][2];
        for (int i = 0; i < n; i++) {
            na[i][0] = sc.nextInt();
            na[i][1] = sc.nextInt();
        }
        for (int i = 0; i < m; i++) {
            ma[i][0] = sc.nextInt();
            ma[i][1] = sc.nextInt();
        }
        int pos = -1;
        long min = Integer.MAX_VALUE;
        String s = "";
        for (int i = 0; i < n; i++) {
            pos = -1;
            min = Long.MAX_VALUE;
            for (int j = 0; j < m; j++) {
                long abs = Math.abs((na[i][0] - ma[j][0])) + Math.abs((na[i][1] - ma[j][1]));
                if (abs < min) {
                    min = abs;
                    pos = j + 1;
                }
            }
            s += pos + "\n";
        }
        System.out.println(s);
        bw.flush();
    }
}


Measured memory_bytes: 23124