akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
struct edge{ll to,cost;};
const int inf = 1<<28;
const ll INF = 1LL<<53;
const int COMBMAX = 500005;
const ll MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
#define repf(i,n) for(int i=0;i<=n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define eachdo(v, e) for(const auto& e : v)
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (ll)distance(v.begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (ll)distance(v.begin(), upper_bound((v).begin(), (v).end(), e))
ll mpow(ll a, ll n,ll mod=MOD){ll res=1;while(n>0){if(n&1)res=res*a%mod;a=a*a%mod;n>>=1;}return res;}
template<class T1, class T2> ll bcount(T1 v, T2 a){return upper_index(v,a)-lower_index(v,a);} 
template<class T> bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
template<class T> void debug2(T v){rep(i,v.size()){rep(j,v[i].size())cout<<v[i][j]<<" ";cout<<endl;}}
template<class T> void rdv(T &v){rep(i,v.size())cin>>v[i];}
template<class T> void rdvv(T &v){rep(i,v.size()){rep(j,v[i].size())cin>>v[i][j];}}



int main(){ 
    ll N;cin >> N;
    vl s(N);rdv(s);
    vector<vector<ll>> dp(N+1,vector<ll>(10005,0));
    dp[0][0] = 1;
    rep(i,N)rep(j,10005){
        chmax(dp[i+1][j],dp[i][j]);
        if (0<=j-s[i]) chmax(dp[i+1][j],dp[i][j-s[i]]); 
    }
    for(int i = 10004;0<=i;--i){
        if (dp[N][i] == 1 && i%10!=0 ){
            cout << i << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
const int MAXN =1e5+5;
const long long MODN =1e9+7;
int main(){
	int N,K;
	cin>>N>>K;
	vector<vector<pair<int,int>>> gra(MAXN);
	for(int i=0;i<N-1;i++){
		int a,b;
		cin>>a>>b;
		a-=1;
		b-=1;
		gra[a].emplace_back(b,0);
		gra[b].emplace_back(a,0);
	}
	int dist[MAXN];
	memset(dist,INF,sizeof(dist));
	int u=0;
	queue<int> q;
	q.push(u);
	dist[u]=0;
	vector<int> mvfinal;
	mvfinal.push_back(K);
	while(!q.empty()){
		int u=q.front();q.pop();
		int count=-1;
		for(int i=0;i<(int)gra[u].size();i++){
			int nx=gra[u][i].first;
			if(dist[nx]!=INF)continue;
			count++;
			dist[nx]=dist[u]+1;
			if(dist[nx]==1){
				
				mvfinal.push_back(K-count-1);
			}else {
				
				mvfinal.push_back(K-count-2);}
			q.push(nx);
		}
	}
	long long sum=1;
	for(int i=0;i<mvfinal.size();i++){
		sum*=mvfinal[i];
		sum%=MODN;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 7796
N = int(input())
ss = [ input() for _ in range(N)]
M = int(input())
ts = [ input() for _ in range(M)]

result = {}
for s in ss:
    if not s in result:
        result[s] = 0
    result[s] += 1
for t in ts:
    if not t in result:
        result[t] = 0
    result[t] -= 1
ans = max(0, max(result.values()))

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
	string s; cin >> s;
  	bool w = s.length() % 2 == 0;
  	char c[] = {'h', 'i'};
  	for (int i = 0; i < s.length(); i++) {
    	w &= c[i%2] == s[i]; 
    }
  	cout << (w ? "Yes" : "No") << endl;
}

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

using namespace std;

#define ll long long




void solve() {

	int n, k;
	cin >> n >> k;
	int cnt= 0;
	while(n--) {
		int x;
		cin >> x;
		if(x >= k) {
			cnt++;
		}
	}
	cout << cnt;


	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	solve();

	return 0;
}


Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {
    Double A,B,N;

    public Main() {
        Scanner scanner = new Scanner(System.in);
        A = Double.parseDouble(scanner.next());
        B = Double.parseDouble(scanner.next());
        N = Double.parseDouble(scanner.next());

        double x = Math.min(B-1, N);
        int max = (int)(Math.floor(A*x/B)-A*Math.floor(x/B));
        System.out.println(max);
    }

    public static void main(String[] args) {
        new Main();
    }
}

Measured memory_bytes: 35836
import java.util.Scanner;

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

   if(s%10==2||s%10==4||s%10==5||s%10==7||s%10==9){
     System.out.println("hon");
   }
   else if(s%10==0||s%10==1||s%10==6||s%10==8){
     System.out.println("pon");
   }
   else if(s%10==3){
     System.out.println("bon");
   }
 
 }
}


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



int main (){
    int N;
    cin>>N;
    vector<int> Vec(N);
    bool Cl=true;
    for(int i=0; i<N; i++){
        cin>>Vec.at(i);
    }
    Vec.at(0)--;

    for(int i=0; i<N-1; i++){
        if(Vec.at(i)<Vec.at(i+1)+1){
            if(Vec.at(i)<Vec.at(i+1)){
              	Vec.at(i+1)--;
            }
            continue;
        }
        else{
            Cl=false;
            break;
        }
    }
    cout<<(Cl?"Yes":"No")<<endl;
    
}

Measured memory_bytes: 640
#include<stdio.h>
#include<vector>
using namespace std;

int N, par[101010], grd[101010];
vector<int> con[101010];

void dfs(int ix){
	for(auto e : con[ix]){
		if(par[ix] == e) continue;
		par[e]=ix;
		dfs(e);
		grd[ix] ^= grd[e]+1;
	}
}

int main(){
	scanf("%d", &N);
	for(int i=0; i<N-1; i++){
		int s, e;
		scanf("%d%d", &s, &e);
		con[s].push_back(e), con[e].push_back(s);
	}
	dfs(1);
	puts(grd[1] ? "Alice" : "Bob");
	return 0;
}


Measured memory_bytes: 11264
#include<iostream>
using namespace std;
int main() {
    while (1) {
        int m, n;
        cin >> n >> m; //何マス？ 何回振んねん
        if (n == 0 && m == 0) {
            return 0;
        }
        int nn[1001];
        for (int i = 1; i <= n; i++) {
            cin >> nn[i];
        }
        int tmp = 1;
        int cnt = 0;
        int mm[1001];
        for (int i = 1; i <= m; i++) {
            cin >> mm[i];
        } //先に一括で読み込まんと0 0が機能せーへん
        for (int i = 1; i <= m; i++) {
            tmp += mm[i];
            cnt++;
            if (tmp >= n) {
                cout << cnt << endl;
                cnt = 0;
                break;
            }
            tmp += nn[tmp];
            if (tmp >= n) {
                cout << cnt << endl;
                cnt = 0;
                break;
            }
        }
    }
}



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

void trace(const vector<int>& a) {
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << ((i != a.size() - 1)? " " : "");
  }
  cout << endl;
}

int bubble_sort(vector<int>& a) {
  bool flag = true;
  int count = 0;
  while (flag) {
    flag = false;
    for (int j = a.size() - 1; j >= 1; j--) {
      if (a[j] < a[j - 1]) {
        swap(a[j], a[j - 1]);
        flag = true;
        count++;
      }
    }
  }
  return count;
}

int main() {
  int n;
  cin >> n;
  vector<int> a;
  while (n--) {
    int i;
    cin >> i;
    a.push_back(i);
  }
  int count = bubble_sort(a);
  trace(a);
  cout << count << endl;
}



Measured memory_bytes: 3148
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

// #pragma GCC optimize(2)
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> ppl;
#define ain(a,n) for(ll i=0;i<(n);++i)  cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define mp make_pair
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
// #define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 300005
#define BLOCK 555
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 200005;
const long double epsilon = 1e-9;
inline ll myceil(ll a, ll  b) {
    return (ceil(1.0 * a / b * 1.0));
}
ll binexp(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll modinvfermat(ll a, ll m)
{
    return binexp(a, m - 2, m);
}
void task(bool flag)
{
    if (flag)
        cout << "YES\n";
    else
        cout << "NO\n";
}
ll lcm(ll a, ll b)
{
    return ((1LL * a * b) / (__gcd(a, b)));
}



signed main() {
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    fast
    ll n;
    cin >> n;
    if (n < 3)
        cout << 0 << END;
    else
    {
        vl dp(n + 1, 0);
        dp[0] = 1;
        FOR(j, 1, n)
        {
            FOR(i, 3, n)
            {
                if (j - i < 0)
                    continue;
                (dp[j] += dp[j - i]) %= MOD;
            }
        }
        cout << dp[n] << END;
    }


// #ifndef ONLINE_JUDGE
//     cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
// #endif
    return 0;
}



Measured memory_bytes: 3652
package main

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

func exec(stdin *Stdin, stdout *Stdout) {
	n := stdin.ReadInt()
	if n%2 == 0 {
		stdout.Println(n / 2)
	} else {
		stdout.Println(n/2 + 1)
	}
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32))
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}


Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
int main() {
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a-c)/(b+c)<<endl;
	return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

const ll M = 1000000007;

ll f[20000010];
//ll g[20000010];
ll modpow(ll x,ll k){
	if(k == 0)return 1;
	ll ret = modpow(x,k/2);
	ret *= ret; ret %= M;
	if(k%2 == 1){
		ret *= x;
		ret %= M;
	}
	return ret;
}

int main(){
	f[0] = 1;
	for(ll i = 1 ; i <= 20000000 ; i ++){
		f[i] = f[i-1]*i;
		f[i] %= M;
		//g[i] = modpow(f[i],M-2);
	}
	
	ll H,W,K;
	cin >> H >> W >> K;
	
	ll ret = 0;
	ll X = f[H+W-2];
	X *= modpow(f[H+W-K],M-2);
	X %= M;
	for(ll i = 2 ; i <= K ; i ++){
		ll Y = X*i; Y %= M;
		Y *= i-1; Y %= M;
		ret += Y;
		if(ret >= M)ret -= M;
		//X *= K-i;
		//X %= M;
	}
	ret *= H;
	ret %= M;
	ret *= W;
	ret %= M;
	
	ll Z = (K+3)*K; Z /= 2;
	Z %= M;
	Z *= f[H+W];
	Z %= M;
	Z *= modpow(f[H+W-K],M-2);
	Z %= M;
	cout << (ret+Z)%M << endl;
}



Measured memory_bytes: 156544
#include <iostream>
#include <stdio.h>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
    int n;
    string s, t;
    cin >> n >> s >> t;
    for (int i = 0; i < n;++i) {
        cout << s[i] << t[i];
    }

    
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>

int main() {
  
  char H[50];
  char A[50];
  int h, a, result;
  int ret = scanf("%s %s", H, A);
  h = atoi(H);
  a = atoi(A);
  if(h == 0 || a == 0) {
    return -1;
  }
  if(ret == EOF) {
    return -1;
  }
  
  if(h < 1 || h > 10000) {
    return -1;
  }
  if(a < 1 || a > 10000) {
    return -1;
  }
  if((h % a) == 0) {
    result = h / a;
  }
  else {
    result = h / a + 1;
  }
  printf("%d\n", result);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
//main definations
#define UI unsigned int
#define LLI long long int
#define ULLI unsigned long long int
#define PI   3.14159258
void read_array(int *a, int n);
void write_array(int *a, int n);
void sort_array(int *a, int n);
//codechef only
#define TC for(UI defined_i=1;defined_i<=t;defined_i++)
using namespace std;
int main(){
	int n;
	cin>>n;
	int ans=0;
	while(n>0){
		if(n%10==9){
			ans=1;
			break;
		}
		n=n/10;
	}
	if(ans==1){
		cout<<"Yes"<<endl;	
	}
	else{
		cout<<"No"<<endl;
	}
	
    return 0;
}
void read_array(int *a, int n){
	for(int i=0;i<n;i++){
		cin>>*(a+i);
	}
}
void write_array(int *a, int n){
	for(int i=0;i<n;i++){
		cout<<*(a+i)<<" ";
	}
}
void sort_array(int *a, int n){
	sort(a,a+n);
}

Measured memory_bytes: 256
def merge(A,left, mid, right):
    global cnt
    L = A[left:mid] + [1000000001]
    R = A[mid:right] + [1000000001]
    i = j = 0
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1 
        else:
            A[k] = R[j]
            j += 1
    cnt += right - left

def mergeSort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)

if __name__ == '__main__':
    n = int(input())
    A = list(map(int,input().split()))
    cnt = 0
    mergeSort(A, 0, n)
    print(*A)
    print(cnt)



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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while (x->left != NIL){
    x = x->left;
  }
  return x;

}

Node treeMaximum(Node x){
  while (x->right != NIL)
    {x = x->right;}
  return x;

}

Node treeSearch(Node x, int k){
  if (x == NIL || k == x->key)
    return x;
  if (k < x->key)
    return treeSearch(x->left, k);
  else
    return treeSearch(x->right, k);


}

Node treeSuccessor(Node x){
  Node y;
  if (x->right != NIL)
    return treeMinimum(x->right); // case 1
  y = x->parent;
  while (y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y; // case 2

}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if (z->left == NIL || z->right == NIL)
    y = z;
  y = treeSuccessor(z);
  if (y->left != NIL)x = y->left;
  else
    x = y->right;
  if (x != NIL)
    x->parent = y->parent;

  if (y->parent == NIL)
    root = x;
  else if (y == y->parent->left)
    y->parent->left = x;
  else
    y->parent->right = x;
  if (y != z)
    z->key = y->key;







       
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  x = root;
  while (x != NIL){
    y = x;
    if (z->key < x->key)
      x = x->left;
    else
      x = x->right;
  }
  z->parent = y;
  if( y == NIL )// Tree is empty
    root = z;
  else if (z->key < y->key)
    y->left = z;
  else
    y->right = z;



}

void inorder(Node u){
  if (u != NIL){
    inorder(u->left);
    printf (" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
  if(u == NULL){
    return;
  }
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 24040
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		long mod = 1000000007;

		long total = 1;
		long without_0 = 1;
		long wo_0and9 = 1;

		for(int i = 0; i < N; i++) {
			total = total * 10 % mod;
			without_0 = without_0 * 9 % mod;
			wo_0and9 = wo_0and9 * 8 % mod;
		}

		long ans = (total - without_0 * 2 % mod + wo_0and9 + mod) % mod;
		System.out.println(ans);
	}
}



Measured memory_bytes: 35716
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const int INF=1e9;
int main(){
	int N;int s,t;cin>>N>>s>>t;
	int A[N],B[N],C[N];
	int dp[401][401];
	long use[401][401][40]={};
	rep(i,0,401)rep(j,0,401) dp[i][j]=INF;
    dp[0][0]=0;
	rep(i,0,N) cin>>A[i]>>B[i]>>C[i];
	rep(i,0,401)rep(j,0,401){
		if(dp[i][j]==INF) continue;
		rep(k,0,N){
			if(use[i][j][k]) continue;
			int a=A[k];int b=B[k];int c=C[k];
			if(dp[i+a][j+b]>dp[i][j]+c){
                rep(l,0,N) use[i+a][j+b][l]=use[i][j][l];
                use[i+a][j+b][k]=1;
                dp[i+a][j+b]=dp[i][j]+c;
            }
		}
	}
	int i=1;int ans=INF;
	while(s*i<401&&t*i<401){
		ans=min(ans,dp[s*i][t*i]);
		i++;
	}
	if(ans==INF) cout<<-1<<endl;
	else cout<<ans<<endl;
}

Measured memory_bytes: 51200
public class Main {

	private static int K;

	public static void main(String[] args) {
		var sc = new java.util.Scanner(System.in);
		K = sc.nextInt();
		long sum = 0;
		for (int i = 1; i <= K; i++) {
			for (int j = 1; j <= K; j++) {
				for (int k = 1; k <= K; k++) {
					sum += gcd(gcd(i, j), k);
				}
			}
		}
		System.out.println(sum);
	}

	public static long gcd(long p, long q) {
		return (p % q == 0) ? q : gcd(q, p % q);
	}
}


Measured memory_bytes: 35652
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
#include<iostream>
#include<cstdlib>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define fir first
#define sec second
#define pb  push_back
#define mp  make_pair

typedef long long ll;

const int N = 120;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}

void minimize(vector<pair<int,int> > &in,int &num){
  int g=-1;
  if (in.size() == 1){
    if (in[0].sec == 0){
      num=1;
      return;
    }
    g=gcd(in[0].sec,num);
    num/=g;
    in[0].sec/=g;
    return;
  }
  rep(j,in.size()){
    if (in[j].sec == 0);
    else if (g==-1)g=in[j].sec;
    else g=gcd(g,in[j].sec);
  }
  if (g>0 && num%g == 0){
    num/=g;
    rep(j,in.size())in[j].sec/=g;
  }
}

bool check(int n,vector<pair<int,int> > *in,int *num,int l){
  rep(i,n){
    if (l % num[i] != 0)return false;
  }
  
  vector<int> out(l,0);
  rep(i,n){
    int tmp=l/num[i];
    rep(j,in[i].size()){
      out[in[i][j].sec*tmp]|=in[i][j].fir;
    }
  }

  rep(i,out.size())printf("%02X",out[i]);
  printf("\n");  
  return true;
}

void solve(int n,vector<pair<int,int> >*in,int *num){
  REP(i,1,1025){
    if (check(n,in,num,i))return;
  }
  printf("Too complex.\n");
}

main(){
  int te;
  int num[N];
  vector<pair<int,int> > in[N];
  cin>>te;
  while(te--){
    int n;
    cin>>n;
    rep(i,n){
      in[i].clear();
      string inp;
      cin>>inp;
      num[i]=inp.size()/2;
      rep(j,inp.size()/2){
	if (inp[j*2]=='0'&&inp[j*2+1]=='0')continue;
	in[i].pb(mp(
		    (inp[j*2]-'0')*16+(inp[j*2+1]-'0'),
		    j
		    )
		 );
      }

      if (in[i].size() == 0)num[i]=1;
      minimize(in[i],num[i]);

//       cout <<"num " <<  num[i] << endl;
//              rep(j,in[i].size()){
//        	cout<<in[i][j].fir <<" " << in[i][j].sec << endl;
//              }
//              cout << endl;
    }


    solve(n,in,num);
  }
  return false;
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n;
    cin>>n;
    vl as(n);
    cin>>as;

    if (n == 1) {
        if (as[0]) cout<<-1<<endl;
        else cout<<0<<endl;
        return 0;
    }

    ll ans = as.back();
    for (int i = n - 2; i >= 0; --i) {
        if (as[i] > i) {
            cout<<-1<<endl;
            return 0;
        }
        if (as[i] + 1 < as[i + 1]) {
            cout<<-1<<endl;
            return 0;
        }
        if (as[i] + 1 == as[i + 1]) continue;
        ans += as[i];
    }
    cout<<ans<<endl;
}

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


int main(){
    string s;
    cin >> s;
    size_t n = s.size();
    int cnt_a = 0;
    int cnt_b = 0;
    int ans;
    rep(i,n) {
        if(i%2==0 && s[i] != '0') cnt_a++;
        else if(i%2==1 && s[i] != '1') cnt_a++;
    }
    rep(i,n) {
        if(i%2==0 && s[i] != '1') cnt_b++;
        else if(i%2==1 && s[i] != '0') cnt_b++;
    }
    ans = min(cnt_a, cnt_b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,k,n) for(int i =k;i<n;i++)
#define INF 1e15
typedef long long ll;
using namespace std;
int main()
{

  int n;
  ll x;
  cin >> n >> x;
  
  vector<ll>a(n);
  rep(i,0,n) cin >> a[i];
  
  vector<vector<ll>>cost(n,vector<ll>(n,INF));
  rep(i,0,n)cost[i][0]=a[i];
  rep(i,1,n){
     rep(j,0,n){
        cost[j][i]=min(cost[j][i-1],a[(j-i+n)%n]);
     }
  }
  ll ans = INF;
  rep(i,0,n){
    ll sum=0;
rep(j,0,n){
    sum+=cost[j][i];
}
    ans=min(ans,sum+i*x);
  }
   
  cout << ans << endl;
}

Measured memory_bytes: 31616
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
int main() {
	int n, A[200],count=0;
	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> A[i];
	}
	while (true) {
		bool X = false;
		for (int i = 0;i < n;i++) {
			if (A[i] % 2 != 0) X = true;
		}
		if (X) break;

		for (int i = 0;i < n;i++) {
			A[i]=A[i] / 2;
		}
		count++;
	}
	cout << count<<endl;

	system("PAUSE");
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep2(i,a,n) for(int i = (a);i < (n);i++)
#define rep(i,n) rep2(i,0,n)
#define INF (1LL << 60)

int main(void){
    int n;
    cin >> n;
    map<int,int> mp;
    int l[n];
    rep(i,n){
        cin >> l[i];
        l[i]--;
        mp[l[i]]++;
    }
    sort(l,l+n);
    
    vector<int> num(10000,0);
    for(int i = l[0];i <= l[n-1]+l[n-2];i++){
        num[i] = num[i-1] + mp[i]; 
    }
    
    //b-a+1,a-b+1 <= c <= a+b-1
    
    ll alina = 0;
    for(int a = 0;a < n;a++){
        for(int b = a+1;b < n;b++){
            int sum = l[a]+l[b]+1;
            int sum2 = l[b]-l[a]-1;
            
            for(int c = b+1;c < n;c++){
                if(sum <= l[c])break;
                if(sum > l[c] && l[c] > sum2)alina++;
            }
        }
    }
    cout << alina << endl;
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 100005
ll r[SIZE],m[SIZE];
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll A,B,M,minA=LONG_MAX,minB=LONG_MAX;
	cin>>A>>B>>M;
	for(ll i=0;i<A;++i){
		cin>>r[i];
		minA=min(minA,r[i]);
	}
	for(ll i=0;i<B;++i){
		cin>>m[i];
		minB=min(minB,m[i]);
	}
	ll ans=LONG_MAX;
	for(ll i=0;i<M;++i){
		ll x,y,c;
		cin>>x>>y>>c;
		ans=min(ans,r[x-1]+m[y-1]-c);
		// cout<<ans<<endl;
	}
	// cout<<minA+minB<<endl;
	cout<<min(ans,minA+minB)<<endl;

}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){

	int h1, h2, k1, k2, a, b, c, d;
	cin>>h1>>h2>>k1>>k2>>a>>b>>c>>d;
	int A, B, C, D, sum1, sum2;
	A = h1 / 10;
	B = h2 / 20;
	C = k1 / 10;
	D = k2 / 20;
	sum1 = h1 * a + h2 * b + A * c + B * d;
	sum2 = k1 * a + k2 * b + C * c + D * d;
	
	if(sum1 > sum2) cout<<"hiroshi"<<endl;
	if(sum1 < sum2) cout<<"kenjiro"<<endl;
	if(sum1 == sum2) cout<<"even"<<endl;

	return 0;
}



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

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

    string S;
    cin >> S;

    map<char, long long> mp;
    mp['R'] = 0;
    mp['G'] = 0;
    mp['B'] = 0;
    for (int i = 0; i < N; i++) mp[S[i]]++;

    long long ans = mp['R'] * mp['G'] * mp['B'];
    for (int i = 0; i < N - 2; i++) {
        for (int j = 1; j < (N - i + 1) / 2; j++) {
            if (S[i] != S[i + j] && S[i + j] != S[i + j + j] && S[i] != S[i + j + j]) {
                //minusCount++;
                ans--;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
n = int(input())
MOD = 10**9+7
#末尾の4文字が *AGC,*ACG,*GAC,A*GC,AGTCのいずれにもならない
#dp
dp = [[0]*4 for i in range(100)]
#0~3 = A,C,G,T

for i in range(n):
    if i == 0:
        for j in range(4):
            dp[i][j] = 1
    elif i == 1:
        for j in range(4):
            dp[i][j] = sum(dp[i-1])
    elif i == 2:
        for j in range(4):
            if j == 0 or j == 3:
                dp[i][j] = sum(dp[i-1])
            if j == 1:
                dp[i][j] = sum(dp[i-1]) - 2
            if j == 2:
                dp[i][j] = sum(dp[i-1]) - 1
    else:
        for j in range(4):
            if j == 0 or j == 3:
                dp[i][j] = sum(dp[i-1])
            if j == 1:
                dp[i][j] = sum(dp[i-1]) - dp[i-2][0] - dp[i-2][2]-dp[i-3][0]*3
            if j == 2:
                dp[i][j] = sum(dp[i-1]) - (sum(dp[i-3]) - dp[i-3][2])        
print(sum(dp[n-1])%MOD)

Measured memory_bytes: 38640
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			
			if (H == 0 && W== 0) break;
			
			StringBuilder sb1 = new StringBuilder();
			StringBuilder sb2 = new StringBuilder();
			
			for(int i =0; i < W; i++) {
				sb1.append("#");
				// 端っこだけ「＃」にするif文。つまり「5」が入力された場合、0番目と4番目だけを「＃」にする。else文の中では1番目～3番目「.」にする。
				if(i == 0 || i == W -1) {
					sb2.append("#");
				} else {
					sb2.append(".");
				}
			}
			
			for(int i = 0; i < H; i++) {
				if(i == 0 || i == H -1) {
					System.out.println(sb1.toString());
				} else {
					System.out.println(sb2.toString());
				}	
			}
			System.out.println();
			
		}
		sc.close();

	}

}



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

def calc(h, n):
    a = N*h*n
    b = 4*h*n - N*n - N*h
    if b != 0:
        if a % b == 0 and a // b <= 3500 and a // b >= 1:
            return a // b
        else:
            return -1
    else:
        return -1

ans = 0
for h in range(1, 3501):
    for n in range(h, 3501):
        w = calc(h, n)
        if w > 0:
            ans = (h, n, w)
            break
print(ans[0],ans[1], ans[2])


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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vll vector<long long>
#define inf 1000000100
#define infll 1LL << 50

int main()
{
    int n, k;
    cin >> n >> k;
    vi data;
    for(int i = 0; i < n; ++i)
    {
        int l;
        cin >> l;
        data.pb(l);
    }
    sort(data.rbegin(), data.rend());
    int ans = 0;
    for(int i = 0; i < k; ++i)
    {
        ans += data[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	ld a; scanf("%Lf", &a);
	a /= 3;
	printf("%.30Lf\n", a*a*a);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
using namespace std;



int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    ll r;
    cin >> r;
    cout << r*r;

    return 0;
}


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

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

typedef long long int ll;
#define int ll
typedef vector<int> vi;
typedef pair<int,int> pii;

const int N = 2e5 + 10;

int n,m;
vi adj[N];

bool vis[N];
int pre[N], a = -1,b;
void dfs_cycle(int u, int p) {
    vis[u] = true;
    pre[u] = p;
    for (int v : adj[u]) if (v != p) {
        if (vis[v]) {
            if (a == -1) {
                a = v; 
                b = u;
            }
        }
        else dfs_cycle(v,u);
    }
}

vi cycle;
bool cyc[N];
void build_cycle() {
    for (int x = b; x != -1; x = pre[x]) {
        //cerr << x << ' ' << pre[x] << endl;
        cyc[x] = true;
        cycle.pb(x);
        if (x == a) break;
    }
}

ll res = 0;
int bal[N];
void dfs(int u, int p) {
    bal[u] = 1;
    for (int v : adj[u]) if (!cyc[v] && v != p) {
        dfs(v,u);
        bal[u] -= bal[v];
    }
    if (p != -1) res += abs(bal[u]);
}

void result(ll res) {
    cout << res << '\n';
    exit(0);
}

#undef int
int main() {
#define int ll
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    memset(vis,0,sizeof vis);
    memset(cyc,0,sizeof cyc);

    cin >> n >> m;
    forn(_,m) {
        int u,v; cin >> u >> v;
        u--; v--;
        adj[u].pb(v);
        adj[v].pb(u);
    }

    if (m == n) {
        dfs_cycle(0,-1); build_cycle();
        vi cbal;
        for (int r : cycle) {
            dfs(r,-1);
            cbal.pb(bal[r]);
        }

        if (si(cycle) % 2) {
            ll total = 0;
            forn(i,si(cbal)) {
                if (i%2 == 0) total -= cbal[i]; else total += cbal[i];
            }
            if (total%2) result(-1);
            total /= 2;
            for (auto b : cbal) {
                res += abs(total);
                total = -total-b;
            }
            result(res);
        }
        else {
            vector<ll> cum;
            cum.pb(0);
            forn(i,si(cbal)) {
                if (i%2 == 0) cum.pb(cum.back()-cbal[i]);
                else cum.pb(cum.back()+cbal[i]);
            }
            if (cum.back() != 0) result(-1);

            cum.pop_back(); sort(all(cum));
            ll med = cum[si(cum)/2];
            for (ll x : cum) res += abs(x-med);
            result(res);
        }
    }
    else {
        dfs(0,-1);
        if (bal[0] != 0) result(-1);
        result(res);
    }

    return 0;
}


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

int main(){
    int n;
    cin>>n;
    int arr[4][3][10]={0};
    int b,f,r,v;
    for(int i=0;i<n;++i){
        cin>>b>>f>>r>>v;
        arr[b-1][f-1][r-1]+=v;
    }
    for(int i=0;i<4;++i){
        for(int j=0;j<3;++j){
            for(int k=0;k<10;++k){
                cout<<" "<<arr[i][j][k];
            }
            cout<<endl;
        }
        if(i!=3)cout<<"####################"<<endl;
    }
}


Measured memory_bytes: 3032
def main():
    h = int(input())
    w = int(input())
    n = int(input())

    count = 0
    painted = 0

    while painted < n:
        if h > w:
            painted += h
            w -= 1
            count += 1
        else:
            painted += w
            h -= 1
            count += 1
    print(count)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using Int = long long;

struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;


struct RollingHash{
  typedef unsigned long long ull;
  string S;
  ull B;
  Int len;
  vector<ull> hash,p;
  RollingHash(){}
  RollingHash(string S_,ull B_=1000000007LL):
    S(S_),B(B_),len(S.length()),hash(len+1),p(len+1){
    hash[0]=0;p[0]=1;
    for(Int i=0;i<len;i++){
      hash[i+1]=hash[i]*B+S[i];
      p[i+1]=p[i]*B;
    }
  }
  //S[l,r)
  ull find(Int l,Int r){
    return hash[r]-hash[l]*p[r-l];
  }
};

struct RollingHash2{
  typedef unsigned long long ull;
  string S;
  ull B;
  Int len;
  vector<ull> hash,p;
  const ull MOD = 1000000007LL;
  RollingHash2(){}
  RollingHash2(string S_,ull B_=177771):
    S(S_),B(B_),len(S.length()),hash(len+1),p(len+1){
    hash[0]=0;p[0]=1;
    for(Int i=0;i<len;i++){
      hash[i+1]=(hash[i]*B+S[i])%MOD;
      p[i+1]=p[i]*B%MOD;
    }
  }
  //S[l,r)
  ull find(Int l,Int r){
    return (hash[r]+MOD-hash[l]*p[r-l]%MOD)%MOD;
  }
};
struct RollingHash3{
  typedef unsigned long long ull;
  string S;
  ull B;
  Int len;
  vector<ull> hash,p;
  const ull MOD = 1000000009LL;
  RollingHash3(){}
  RollingHash3(string S_,ull B_=12309097):
    S(S_),B(B_),len(S.length()),hash(len+1),p(len+1){
    hash[0]=0;p[0]=1;
    for(Int i=0;i<len;i++){
      hash[i+1]=(hash[i]*B+S[i])%MOD;
      p[i+1]=p[i]*B%MOD;
    }
  }
  //S[l,r)
  ull find(Int l,Int r){
    return (hash[r]+MOD-hash[l]*p[r-l]%MOD)%MOD;
  }
};

//INSERT ABOVE HERE
signed main(){
  string s;
  cin>>s;
  Int n=s.size();
  {
    string t(s);
    t.erase(unique(t.begin(),t.end()),t.end());
    if(t.size()==1u){
      cout<<n<<endl<<1<<endl;
      return 0;
    }
  }

  vector<vector<Int> > v(n+1);
  for(Int i=1;i<=n;i++)
    for(Int j=i+i;j<=n;j+=i)
      v[j].emplace_back(i);

  RollingHash  rh1(s);
  RollingHash2 rh2(s);
  RollingHash2 rh3(s);
  auto check=[&](Int l,Int r)->Int{
    for(Int x:v[r-l])
      if(rh1.find(l,r-x)==rh1.find(l+x,r)&&
	 rh2.find(l,r-x)==rh2.find(l+x,r)&&
	 rh3.find(l,r-x)==rh3.find(l+x,r)) return 0;
    return 1;
  };
  
  if(check(0,n)){
    cout<<1<<endl<<1<<endl;
    return 0;
  }

  //assert(0);
  assert(check(0,n-1));
  cout<<2<<endl;
  
  Int ans=0;
  for(Int i=1;i<n;i++)
    ans+=check(0,i)&&check(i,n);
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 112488
#include <iostream>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;
  if (A < 6) {
    cout << 0 << endl;
  } else if (A < 13) {
    cout << B/2 << endl;
  } else {
    cout << B << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

#define ll long long int
#define mod 1000000007

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int n,w;
    cin >> n>>w;
    vector<ll>weight(n);
    vector<ll>value(n);
    for(ll i =0;i<n;i++){
        ll x,y;
        cin >> x >> y;
        weight[i] = x;
        value[i] = y;
    }
    vector<vector<ll>> dp(n,vector<ll>(w+1));
    
    for(ll j = 0; j < w+1; j++){
        dp[0][j] = weight[0] <= j ? value[0]:0;
    }
    
    for(ll i =1;i<n;i++){
        for(ll j = 0; j < w+1; j++){
            if(j-weight[i] >= 0)
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-weight[i]] + value[i]);
            else
            dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[n-1][w];
}









Measured memory_bytes: 79488
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

typedef complex<double> P;

int main(){

	string s;
	while(getline(cin,s)){
		for (int i = 0; i < 26; i++)
		{
			for(int j = 0; j < (int)s.size(); j++){
				if('a' <= s[j] && s[j] <= 'z'){
					char c = (s[j] - 'a' + 1) % 26 + 'a';
					s[j] = c;
				}
			}

			if(s.find("the") != string::npos || s.find("this") != string::npos || s.find("that") != string::npos)
				break;
		}

		cout << s << endl;
	}

	return 0;
}

Measured memory_bytes: 0
N,Y = map(int,input().split())

Y //= 1000
res = [-1,-1,-1]

for i in range(N+1):
  remN = N-i
  remY = Y - 10*i
  if remY < 0:
    break
  for j in range(remN+1):
    if remY - 5*j == remN - j:
      res = [i,j,N-i-j]
      
print(" ".join(map(str,res)))

Measured memory_bytes: 67156
// https://atcoder.jp/contests/abc127/tasks/abc127_a
#include <bits/stdc++.h>
using namespace std;

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

  int ans = 0;
  if (A>12) ans = B;
  else if (A > 5) ans = B / 2;

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>

using namespace std;

int main (void)
{
	for (int u = 0; u < 300; u++)
	{
		long long n,a[1001];

		cin >> n;
		if (n == 0)
		{
			break;
		}

		long p = 1000001;

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

		sort(a,a + n);

		for (int i = 0; i < n; i++)
		{
			for (int j = 1; j < n; j++)
			{
				if (i < j && a[j] - a[i] < p)
				{
					p = 0;
					p = a[j] - a[i];
				}
			}
		}

		cout << p << endl;
	}
}


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

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
vector<ll>  od,ev;
ll aod=0,aev=0;
rep(i, n){
  cin >> a[i];
  if(i%2&&a[i]>=0){od.push_back(i);aod+=a[i];}
  else if(a[i]>=0){ev.push_back(i);aev+=a[i];}
}
vector<ll> b;
if(od.size()==0&&ev.size()==0){
  ll mx=-1e+10;
  ll it;
  rep(i,n)if(mx<a[i]){it=i;mx=a[i];}
  cout << mx << endl;
  b.push_back(it);
}
else if(aod>aev){
  b=od;
  cout << aod << endl;
}
else{
  b=ev;
  cout << aev << endl;
}
vector<ll> ans;
for(ll i=b.size()-1;i>0;i--){
  rep(j,(b[i]-b[i-1])/2){
    ans.push_back(2+j);
  }
}
rep(i,b.front())ans.push_back(1);
rep(i,n-b.back()-1)ans.push_back(b.back()+2+i);
cout << ans.size() << endl;
rep(i,ans.size())cout << ans[ans.size()-i-1] << endl;
return 0;
}

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

namespace _0261
{
    class Program
    {
        static readonly long[] MayaUnit = new long[] { 20, 20, 18, 20, 1 };
        const int BYEAR = 2012, BMONTH = 12, BDAY = 21, MAYACYCLE = 13;

        static void Main(string[] args)
        {
            while (true)
            {
                string s = RSt();
                if (s == "#") break;

                long[] vs = Array.ConvertAll(s.Split('.'), e => long.Parse(e));
                Console.WriteLine(vs.Length == 5 ? CalcAd(vs) : CalcMaya(vs));
            }
        }

        private static string CalcAd(long[] vs)
        {
            long days = 0;
            for (int i = 0; i < vs.Length; i++) days = (days + vs[i]) * MayaUnit[i];
            DateTime newDate = new DateTime(BYEAR, BMONTH, BDAY).AddDays(days);
            return newDate.ToString("yyyy.M.d");
        }

        private static string CalcMaya(long[] vs)
        {
            long days = GetDays(vs[0], vs[1], vs[2]) - GetDays(BYEAR, BMONTH, BDAY);

            long[] mayaDate = new long[MayaUnit.Length];
            for (int i = MayaUnit.Length - 1; i > 0; i--)
            {
                mayaDate[i] = days % MayaUnit[i - 1];
                days /= MayaUnit[i - 1];
            }
            mayaDate[0] = days % MAYACYCLE;
            return WAr(mayaDate, ".");
        }

        private static long GetDays(long year, long month, long day)
        {
            long y = year - 1;
            long days = y * 365 + y / 4 - y / 100 + y / 400;

            y = year % 400 + 400;
            days += (new DateTime((int)y, (int)month, (int)day) - new DateTime((int)y, 1, 1)).Days;
            return days;
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 18556
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e5+5,M=2*N,inf=1e8;
int n,i,et,he[N],l[N],r[N];bool flag;
struct edge{int l,to;}e[M];
int read(){
	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
void put(int x){if (x>9) put(x/10);putchar(x%10+48);}
void write(int x){
	if (x<0) putchar('-'),x=-x;
	put(x);putchar('\n');
}
void dfs1(int x,int fa){
	for (int i=he[x];i;i=e[i].l){
		int y=e[i].to;if (y==fa) continue;
		dfs1(y,x);
		l[x]=max(l[x],l[y]-1);
		r[x]=min(r[x],r[y]+1);
	}
}
void dfs2(int x,int fa){
	for (int i=he[x];i;i=e[i].l){
		int y=e[i].to;if (y==fa) continue;
		if (l[x]==l[y]) flag=0;
		l[y]=max(l[y],l[x]-1);
		r[y]=min(r[y],r[x]+1);
		dfs2(y,x);
	}
}
int main(){
	for (n=read(),i=1;i<n;i++){
		int x=read(),y=read();
		e[++et].l=he[x];he[x]=et;e[et].to=y;
		e[++et].l=he[y];he[y]=et;e[et].to=x;
	}
	for (i=1;i<=n;i++) l[i]=-inf,r[i]=inf;
	for (i=read();i--;){
		int x=read();l[x]=r[x]=read();
	}
	dfs1(1,0);flag=1;dfs2(1,0);
	for (i=1;i<=n;i++) if (l[i]>r[i]) flag=0;
	if (!flag){puts("No");return 0;}
	for (puts("Yes"),i=1;i<=n;i++) write(l[i]);
}

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


int main(){
    long long n;
    cin >>n;
    long long ans = 0;
    long long total =0;
    for (int i=1; i<n+1;++i){
        if(i%3==0||i%5==0){
            ans +=i;
        }
    }
    for (int i = 1; i<n+1 ;++i){
        total +=i;

    }
    cout << total-ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int m = (n-1)/2;
    int k = (n+3)/2;
    bool flg = true;
    rep(i, n/2) {
        if (s[i] != s[n-1-i]) flg = false; 
    }
    rep(i, m/2) {
        if (s[i] != s[m-1-i]) flg = false;
    }
    //cout << flg << endl;
    for (int i = k/2-1; i < n; ++i) {
        if (s[i] != s[n-1-i]) flg = false;
    }
    cout << ((flg) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
/******************************************
* AUTHOR : Ashish Joshi* 
* INSTITUTION : NIT Hamirpur *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define loop(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define set(b,i) (b|(1<<i))
#define unset(b,i) (b&!(1<<i))
#define cbit(b,i) bool(b&(1<<i))

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ios_base& scientific (ios_base& str);

map<string,int> m1;
m1["SUN"]=7, m1["MON"]=6, m1["TUE"]=5;
m1["WED"]=4, m1["THU"]=3, m1["FRI"]=2, m1["SAT"]=1;
string s;
getline(cin,s);
cout<<m1[s]<<endl;

return 0;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  int n;
  scanf("%d", &n);

  vector<int> a(n);
  REP(i, n) {
    scanf("%d", &a[i]);
  }

  a.insert(a.begin(), 0);
  a.push_back(0);

  int sum = 0;
  FOR (i, 1, n + 2) {
    sum += abs(a[i] - a[i - 1]);
  }

  vector<int> ans(n);
  FOR (i, 1, n + 1) {
    if (a[i - 1] <= a[i] && a[i] <= a[i + 1]) {
      ans[i - 1] = sum;
    } else {
      ans[i - 1] = sum - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1]);
    }
  }

  for (auto x : ans) {
    cout << x << endl;
  }
}


Measured memory_bytes: 2040
from itertools import product
s = input()
for bit in product(['-', '+'], repeat=len(s)-1):
    q = ''
    for i in range(len(s)*2-1):
        if i % 2 == 0:
            q += s[i//2]
        else:
            q += bit[(i-1)//2]
    ans = eval(q)
    if ans == 7:
        print(q+'=7')
        exit()


Measured memory_bytes: 38256