akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define     mkp(a,b)    make_pair(a,b)
#define     PI          3.14159265359
#define     ll              long long
#define     ul              unsigned long long
#define     ld              long double
#define     mset(arr,val)   memset(arr,val,sizeof arr)
#define     MAXN            (long long)2e5+5
#define     eb              emplace_back
#define     mod             (long long)(1e9+7)
#define     FILE_READ       freopen("input.txt","r",stdin)
#define     FILE_WRITE      freopen("output.txt","w",stdout)
using namespace std;
using namespace __gnu_pbds;;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
//    FILE_READ;
//    FILE_WRITE;

    int n;
    cin>>n;
    ld ans=0;
    for(int i=0;i<n;++i) {
        ld x;
        cin>>x;
        x=1.0/x;
        ans+=x;
    }
    ans=1.0/ans;
    cout<<ans;


    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SZ(x) (int)(x).size()
#define mset(a,x) memset(a,x,sizeof(a))
#define dbg(x) cout<<#x<<": "<<(x)<<"\n"
#define pb push_back
#define mp make_pair

int main() {
    string s;
    cin >> s;
    int n = s.length();

    ll ans = 0;
    rep(i,n-1){
        ans += (s[i] != s[i+1]);
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 640
N, M = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(M)]

ans = ["0"] * N
if N > 1: ans[0] = "1"
rep = {}

ok = True
for s, c in sc:
  ans[s - 1] = str(c)
  if s in rep and rep[s] != str(c):
    ok = False
  else:
    rep[s] = str(c)

if ok:
  if ans[0] == "0" and N > 1:
    ok = False

print("".join(ans) if ok else -1)

Measured memory_bytes: 3064
from collections import deque
from sys import exit

As = input()

As = [ord(A) - ord('a') for A in As]
lenA = len(As)
posChars = [lenA] * 26
posNexts = [[] for _ in range(lenA + 1)]
for i in reversed(range(lenA)):
    posNexts[i + 1] = posChars.copy()
    posChars[As[i]] = i
posNexts[0] = posChars.copy()

prevs = [None] * lenA
Q = deque()
Q.append((0, -1))
while Q:
    lenAns, pos = Q.popleft()
    for ch in range(26):
        posNext = posNexts[pos + 1][ch]
        if posNext == lenA:
            ans = [chr(ord('a') + ch)]
            while pos != -1:
                ans.append(chr(ord('a') + As[pos]))
                pos = prevs[pos]
            print(''.join(reversed(ans)))
            exit()
        if prevs[posNext] is None:
            prevs[posNext] = pos
            Q.append((lenAns + 1, posNext)) 


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

int main(){
  ll sum=0,n,y,a,b,c;
  bool flag=false;
  cin >> n >> y;
  r(i,n){
    r(j,n-i){
      if(y==1000*i+5000*j+10000*(n-i-j)){
        a=n-i-j; b=j; c=i;
        flag=true;
        break;
      }
    }
  }
  if(flag)cout << a << " " << b << " " << c << endl;
  else cout << -1 << " " << -1 << " " << -1 << endl;
}


Measured memory_bytes: 256
from collections import deque

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

S = [['#'] * (W + 2)]
for _ in range(H):
    tmp = ['#'] + list(input()) + ['#']
    S.append(tmp)
S.append(['#'] * (W + 2))
#迷路の周りを全て壁で覆うことでどの場所からでも四方に探索できるようにした

move = [[1, 0], [-1, 0], [0, 1], [0, -1]]

ans = 0
# スタート位置を変えながら全探索
for X in range(1, H + 1):
    for Y in range(1, W + 1):
        if S[X][Y] == '#':
            continue
#if ~ continue分はtrueなら下の操作を行うことなく次の番号に移るという意味
        check = [[-1] * (W + 2) for _ in range(H + 2)]
        check[X][Y] = 0
        que = deque()
        que.append([X, Y])
        while que:
            tmp = que.popleft()
            x = tmp[0]
            y = tmp[1]
            flag = True
            for dx, dy in move:
                nx = x + dx
                ny = y + dy
                if S[nx][ny] == '.' and check[nx][ny] == -1:
                    que.append([nx, ny])
                    check[nx][ny] = check[x][y] + 1
                    flag = False
#flagの使い方が上手、真似したい
            if flag:
                ans = max(ans, check[x][y])


print (ans)

Measured memory_bytes: 3316
{-# LANGUAGE FlexibleContexts, OverloadedStrings #-}
import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Data.List
import Text.Printf
import Debug.Trace

istour g [_] = 1
istour g (x:y:ys) = if [x,y] `elem` g
                    then istour g (y:ys)
                    else 0

main = do
  [n,m] <- getInts
  es <- replicateM m $ getInts
  let g = es ++ map (\(x:y:_) -> [y,x]) es
  print $ sum $ map (istour g) $ map (1:) $ permutations [2..n]


-- util
getInts :: IO [Int]
getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

substr :: Int -> Int -> B.ByteString -> B.ByteString
substr b l s = B.take l $ B.drop b s


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

using namespace std;
typedef long long ll;
typedef long double ld;
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)


// Write From This Line
int main()
{
	int n;
	cin >> n;
	int m;
	cin >> m;
	vector<int> a(m);
	rep(i,m) cin >> a[i];
	int sum = 0;
	rep(i,m) sum += a[i];
	n -= sum;
	if(n >= 0){
		cout << n << endl;
	} else {
		cout << -1 << endl;
	}
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using ll = long long;
constexpr int MOD = 1000000007;
using namespace std;

ll f[1000010];
void init() {
    f[0] = 1;
    for (int i = 1; i < 1000010; i++)
      f[i] = (f[i - 1] * i) % MOD;
}
ll inv(ll x) {
    ll res = 1;
    ll k = MOD - 2;
    ll y = x;
    while (k) {
        if (k & 1) res = (res * y) % MOD;
        y = (y * y) % MOD;
        k /= 2;
    }
    return res;
}
ll C(int n, int k) {
    ll a = f[n];
    ll b = f[n-k];
    ll c = f[k];
    ll bc = (b * c) % MOD;
    return (a * inv(bc)) % MOD;
}

int main() {
  init();
  int x, y;
  cin >> x >> y;
  int u, r = 0;
  while (y != x * 2) {
    y -= 1;
    x -= 2;
    r++;
    if (y > x * 2 || y < 0 || x < 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  u = y / 2;
  cout << C(u + r, r) << endl;
  return 0;
}

Measured memory_bytes: 8572
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	vector<int> a(3);
	REP(i, 3) cin >> a[i];
	sort(a.begin(), a.end());
	int ans = 0;
	REPS(i, 1, 3) {
		ans += (a[i] - a[i - 1]);
	}
	cout << ans;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
/*
      author  : nishi5451
      created : 14.08.2020 14:56:00
*/

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


int main(){
    int n;
    cin >> n;
    int ans = 0;
    rep(i,n){
        int l,r;
        cin >> l >> r;
        ans += (r-l)+1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define lli long long int
#define all(c) c.begin(), c.end()
#define mp(x, y) make_pair(x, y)
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define deb(x) cout << #x << " " << x << endl;
#define rep(i, n) for (i = 0; i < n; i++)
#define Rep(i, k, n) for (i = k; i < n; i++)
#define write(x) cout << x << " ";
#define writeLine(x) cout << x << endl;
#define fast std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ppi pair<int, int>
using namespace std;

int main()
{
    fast;

#ifndef ONLINE_JUDGE
    freopen("/home/kalit/Desktop/Data Structures-Algo-Competitive/src/codeforces/input.txt", "r", stdin);
    freopen("/home/kalit/Desktop/Data Structures-Algo-Competitive/src/codeforces/output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    vector<char> a(n);
    bool allRed = true;
    int countRed = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i] == 'W')
        {
            allRed = false;
        }
        else
        {
            countRed++;
        }
    }
    if (allRed)
    {
        cout << 0 << endl;
        return 0;
    }
    int moves = 0;
    for (int i = 0; i < countRed; i++)
    {
        if (a[i] != 'R')
        {
            moves++;
        }
    }
    cout << moves << endl;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int len = S.Length;
            Console.WriteLine(S.Substring(0, len - 8));
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    if (a % b) {
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 3600
N, M = map(int, input().split())
ans = set([1])
balls = [1]*N

for _ in range(M):
    x, y = map(int, input().split())
    if x in ans:
        ans.add(y)
    balls[x-1] -= 1
    if balls[x-1] == 0 and x in ans:
        ans.remove(x)
    balls[y-1] += 1

print(len(ans))


Measured memory_bytes: 54232
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second

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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<string> s(n);
	vector<int> t(n);
	rep(i,n){
		cin>>s[i]>>t[i];
	}
	string x;
	cin>>x;
	int ans=0;
	bool flag=false;
	rep(i,n){
		if(flag){
			ans+=t[i];
		}
		if(x==s[i]){
			flag=true;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 892
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << char(toupper(a[0])) << char(toupper(b[0])) << char(toupper(c[0])) << endl;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void)
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
    {
      cin>>a[i];
    }
for(int i=n-1;i>=0;i--)
    {
      cout<<a[i]<<(i==0?"\n":" ");
    }
  return 0;
}

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

int main() {
  int a,b,k;
  cin >>a>>b>>k;
  for(int i=0;i<k;i++){
    if(a+i>b){break;}
    cout<<a+i<<endl;
  }
  for(int i=k-1;i>=0;i--){
    if(b-i<=a+k-1){continue;}
    cout<<b-i<<endl;
  }
}


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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
const int INF = 1e9;
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");
#define FOR(i, l, r) for (int i = int(l); i < int(r); ++i)
#define print(a)       for(auto x : a) cout << x << " "; cout << "\n"
#define print1(a)      for(auto x : a) cout << x.ff << " " << x.ss << "\n"
#define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << "\n"


ll fast_exp(ll base, ll exp) {ll res=1;while(exp>0) {if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return res%MOD;}
int gcd(int a,int b){while (a&&b)a>b?a%=b:b%=a;return a+b;}
int val(char c){if (c >= '0' && c <= '9')return (int)c - '0';else return (int)c - 'A' + 10;}
ll pows(int a , int b){ll res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}
ll divisibles(ll a, ll b, ll m){if(a%m==0)return (b/m)-(a/m)+1;else return (b/m)-(a/m);}// in [a,b]
string bitstring(int n, int size){string s;while(n){s+=(n%2)+'0';n/=2;}while(s.size()<size){s+='0';}reverse(all(s));return s;}
// dsu start

vi root(200001,0);
vi size(200001,1);
int find(int x){while(x!=root[x])x = root[x];return x;}
bool same(int a,int b){return find(a)==find(b);}
void unite(int a, int b){a = find(a);b = find(b);if(size[a]<size[b])swap(a,b);size[a] += size[b];root[b] = a;}

// dsu end
vi vis(200001,0);
vi adj[200001];

int main()
{	
    std::ios::sync_with_stdio(false);
    //string bitstring = std::bitset< 3 >( 7 ).to_string(); <bits> (num)
    //srand(time(0));
    //cin.tie(NULL);
    //cout.tie(NULL);
 	ll x;
 	cin>>x;
 	ll sum = 0;
 	if(x<=6)
 		cout<<1<<"\n";
 	else if(x<=11)
 		cout<<2<<"\n";
 	else
 	{
 		ll div = x/11;
 		sum+=2*div;
 		x -= 11*div;
 		if(x<=6 && x)
 			++sum;
 		else if(x<=11 && x)
 			sum+=2;
 		cout<<sum<<"\n";
 	}   


}

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

using namespace std;

int main(void) {
    int a, b;
    cin >> a >> b;

    if (a<=0 && 0<=b) {
        cout << "Zero\n";
    } else if (0 < a) {
        cout << "Positive\n";
    } else {
        if ((b-a) & 1) {
            cout << "Positive\n";
        } else {
            cout << "Negative\n";
        }
    }

    return 0;
}


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

vector<ll> a(100000 + 10, 0);

int main(){
    ll n;
    cin >> n;
    for(ll i = 1; i <= n; ++i){
        cin >> a[i];
    }
    ll count = 0;
    for(ll i = 1; i <= n; ++i){
        if(a[a[i]] == i && i < a[i]){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1024
// Sun May  3 14:51:50 IST 2020  
#include <bits/stdc++.h>        
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(ii,a,b)        for(int ii = (int)a ; ii < (int)b  ; ii++ )
#define debug(x)           cerr << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define int64              long long    
#define MOD                998244353 
#define pb                 push_back
#define f_                 first 
#define s_                 second    
#define all(x)             (x).begin(),(x).end() 
#define precise(x)         cout << fixed << setprecision(12) << x << '\n'; 
#define tough_nut          numeric_limits<int64>::min()
const double pi = 3.141592653589793238;
using namespace std ;     
using namespace __gnu_pbds;
 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
const int N = 2e5+7; 
const int INF = INT_MAX; 
const int M = 2019;
int tests(){   
    string s ;
    cin >> s ; 
    int n = s.size();
    int tens  = 1 ;
    int suf = 0 ;
    vector <int> hash(M);
    hash[0]++ ;
    int64 ans = 0 ;
    for(int i=  n-1 ; i > -1 ; i--)
    {
        int digit = s[i]-'0';
        digit *= tens ;
        digit %= M; 
        suf = suf + digit ;
        suf %= M ;
        ans += (int64)hash[suf];
        tens = (10*tens)%M;
        // cout << digit << ' '  << suf << '\n';
        hash[suf] +=1 ; 
    }
    cout << ans << '\n';
    return 0;   
}
int32_t main(){
    I__O ;    
    int cases = 1 ;  
    // cin >> cases ; 
    while(cases--){    
        tests(); 
    }
    return 0 ; 
}
 
// -Wall -Wextra -O2
// -pedantic -std=c++11
// -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<int,int> P;
const ll mod=1e9+7;
const ll inf=1e15;

int n;
vector<vector<int>> a(1010,vector<int>(1010)),id(1010,vector<int>(1010));
vector<bool> used(1e6,false),used2(1e6,false);
vector<vector<int>> g(1e6);
vector<int> dp(1e6,1);

int dfs(int v){
  if(used[v]){
    if(!used2[v]) return -1;
    return dp[v];
  }
  used[v]=true;
  for(auto itr:g[v]){
    int ret=dfs(itr);
    if(ret==-1) return -1;
    dp[v]=max(dp[v],ret+1);
  }
  used2[v]=true;
  return dp[v];
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  FOR(i,1,n+1)FOR(j,1,n) cin>>a[i][j];
  int v=1;
  FOR(i,1,n+1)FOR(j,1,n+1) if(i<j) id[i][j]=v++;
  FOR(i,1,n+1){
    FOR(j,1,n){
      int x=i,y=a[i][j];
      if(x>y) swap(x,y);
      a[i][j]=id[x][y];
    }
    FOR(j,1,n-1) g[a[i][j]].push_back(a[i][j+1]);
  }
  FOR(i,1,v){
    int ret=dfs(i);
    if(ret==-1){
      cout<<-1<<endl;
      return 0;
    }
  }
  int ans=1;
  FOR(i,1,v) ans=max(ans,dp[i]);
  cout<<ans<<endl;
}

Measured memory_bytes: 51584
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>

#define int long

const int INF = 1000000009;
const long LINF = 1123456789012345678;

long n, p, p1;
long ans = 1;

long power(long num1, long num2){
	if(num2 == 1){
		return num1;
	}
	if(num2 % 2 == 1){
		return num1 * power(num1, (num2-1));
	}
	long r = power(num1, num2/2);
	return r*r;
}

signed main(){
	scanf("%ld %ld", &n, &p);
	p1 = p;
	if(n == 1){
		printf("%ld\n", p);
		return 0;
	}
	for(int i = 2; i*i <= p; i++){
		long cnt = 0;
		while(p1 % i == 0){
			p1 /= i;
			cnt++;
		}
		if(cnt >= n){
			ans *= power(i, cnt/n);
		}
	}
	printf("%ld\n", ans);
	return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
#define flash ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define ll long long int
#include <tr1/unordered_map>
#define ld long double
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define f(i,a,b)  for(long long i=a;i<b;i++)
#define all(c) (c).begin(),(c).end()
#include <map>

using namespace std;
ll modex(ll A, ll B)  
{  
    // Base cases  
    if (A == 0)  
        return 0;  
    if (B == 0)  
        return 1;  
  
    // If B is even  
    ll y;  
    if (B % 2 == 0) {  
        y = modex(A, B / 2)%MOD;  
        y = ((y%MOD) *( y%MOD)) % MOD;  
    }  
  
    // If B is odd  
    else {  
        y = A % MOD;  
        y = ((y%MOD )* (modex(A, B - 1) % MOD) )% MOD;  
    }  
  
    return (ll)((y + MOD) % MOD);  
} 
int main()
{


     flash;
     ///////////////////////////////////////////////////////////////////////////////////////



ll n;
cin>>n;
if(n==1)
{
  cout<<0<<endl;
}
else if(n==2)
{
  cout<<2<<endl;
}
else
{
  ll ans = modex(10,n)-(2*modex(9,n))+modex(8,n);
  ans=ans%MOD;
  if(ans<0)
  {
    ans+=MOD;
  }
  cout<<ans%MOD<<endl;

}



    ///////////////////////////////////////////////////////////////////////////////////////

     return 0;

}


Measured memory_bytes: 3636
N,K = (int(X) for X in input().split())
A  = [int(X) for X in input().split()]
Left  = A.index(1)
Right = (N-1)-Left
Count = (Right%(K-1)!=0)+Right//(K-1)
Left  -= (Right%(K-1)!=0)*((K-1)-Right%(K-1))
Count += (Left%(K-1)!=0)+Left//(K-1)
print(Count)

Measured memory_bytes: 20100
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

priority_queue<ll, vector<ll>, greater<ll> > primes;
bool is_prime[55555*5+1]={};

void make_primes(ll n){
    rep(i,n+1)is_prime[i]=true;
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            if(i<55555)primes.push(i);
            ll cnt=2;
            while(i*cnt<=n){
                is_prime[cnt*i]=false;
                cnt++;
            }
        }
    }    
}

int main(void) {
    ll n;
    cin >> n;
    make_primes(55555*5);
    vector<ll> res;
    DEBUG{
        cout << primes.top() << endl;
    }
    while(res.size()<n){
        if(primes.top()%10==1)res.push_back(primes.top());
        primes.pop();
    }
    rep(i,res.size()){
        printf("%lld",res[i]);
        if(i!=res.size()-1)printf(" ");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm> 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
int main(void){
    // Your code here!
    int n;
    int a[10000];
    int b[10000];
    int ans = 0;
    cin >> n;
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        cin >> b[i];
    }
    rep(i,n){
        ans = max(ans,ans+a[i]-b[i]);
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }


main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    for (auto &i : s) {
        int k = i - 'A';
        k += n;
        k %= 26;
        cout << char('A' + k);
    }
    cout << '\n';
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;



int main() {



  int k;
  cin >> k;

  
  long sum = 0;
  for(int a=1 ; a<=k ; a++){
    for(int b=1 ; b<=k ; b++){
      for(int c=1 ; c<=k ; c++){
	sum += __gcd(a,__gcd(b,c));
      }
    }
  }

  cout << sum << endl;

  

  
  
  return 0;
}



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


int main()
{
    int n;
    cin >> n;
    int pi, cmin = 1e6, ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> pi;
        if (pi < cmin) {
            ans++;
            cmin = pi;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == 5 && b == 5 && c == 7)cout << "YES";
	else if (a == 5 && b == 7 && c == 5)cout << "YES";
	else if (a == 7 && b == 5 && c == 5)cout << "YES";
	else cout << "NO";
}


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

using namespace std;

int IsPrime(int a,int b)
{
    int i,p=0,q=0;
    if(a==1||b==1)
    {
        return 0;
    }
    for(i=2;i<=sqrt(a);i++)
    {

        if(a%i==0)
            {
                p=1;
                break;
            }
    }

    for(i=2;i<=sqrt(b);i++)
    {

        if(b%i==0)
            {
                q=1;
                break;
            }

    }
    if(p!=1&&q!=1)
        return 1;
    else
        return 0;

}
int main()
{
    int a,b,i,c=0;
    while( cin>>a)
    {
        c=0;

    for(i=0;i<a;i++)
    {
        if((b=IsPrime(i+1,a-i))==1)
            c++;

    }
    cout<<c<<endl;

}
}

Measured memory_bytes: 2992
#include<bits/stdc++.h>                   // below comment for pbds
#include<ext/pb_ds/assoc_container.hpp>   // to use it make ordered_set
#include<ext/pb_ds/tree_policy.hpp>       // all set fnct + = 1. order_of_key(x); // number of 
#define ll long long                      //element strictly smaller than it;
#define ld long double                    // 2. find_by_order(x),pointer el at x pos after sort  use as s.f();
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;                     
using namespace __gnu_pbds;



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.flush();
	ll t=1;
	ll CaseN=1;  
//	cin>>t;
	while(t--)
	{
		ll x;
		cin>>x;
	ll ans =0;
	ll c = 100;
	while(c<x)
	{
	ans++;	
	ll p = c/100;
	c += p;	
	}
	
	    //cout<<"Case #"<<CaseN<<": ";
		CaseN++;
		// print your ans below;
		cout<<ans<<endl;
	}

return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,c=0;
    cin >> n;
    char s[n];
    cin >> s;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
        {
            c++;
        }
    }
    cout << c ;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,sumA=0;
    int x,y,z,u,sumB=0;
    cin >> a >> b >> c >> d;
    cin >> x >> y >> z >> u;
    
    sumA=a+b+c+d;
    sumB=x+y+z+u;
    
    if(sumA==sumB)
        cout << sumA << endl;
    else if(sumA>sumB)
        cout << sumA << endl;
    else
        cout << sumB << endl;
    
    
}



Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(S: str):
    s = sorted(S)
    if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
        return YES
    else:
        return NO


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    print(solve(S))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;

#define all(x) (x).begin(),(x).end()
#define fastio ios_base::sync_with_stdio(false)

typedef double db;
typedef long long ll;
typedef unsigned long long ull;

typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

int main() {
	fastio;
	int n; string s;
	cin >> n >> s;
	vector < ll > a(n, 0);
	vector < ll > b(n, 0);
	vector < ll > c(n, 0);

	for(int i = 0; i < n; ++i) {
		if(s[i] == 'R') ++a[i];
		if(s[i] == 'G') ++b[i];
		if(s[i] == 'B') ++c[i];
	}
	for(int i = 1; i < n; ++i) {
		a[i] += a[i - 1];
		b[i] += b[i - 1];
		c[i] += c[i - 1];
	}
	ll ans = 0;
	for(int i = 0; i < n; ++i) {
		for(int j = i + 1; j < n; ++j) {
			if((s[i] == 'R' and s[j] == 'G') or (s[j] == 'R' and s[i] == 'G')) {
				ll num = c[n - 1] - c[j];
				ans += num;
				int k = (2 * j) - i;
				if(k < n and s[k] == 'B') --ans;
			}
			if((s[i] == 'G' and s[j] == 'B') or (s[j] == 'G' and s[i] == 'B')) {
				ll num = a[n - 1] - a[j];
				ans += num;
				int k = (2 * j) - i;
				if(k < n and s[k] == 'R') --ans;
			}
			if((s[i] == 'R' and s[j] == 'B') or (s[j] == 'R' and s[i] == 'B')) {
				ll num = b[n - 1] - b[j];
				ans += num;
				int k = (2 * j) - i;
				if(k < n and s[k] == 'G') --ans;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std ;

const int MAX = 2e5 + 10 ;

long long arr[MAX] ;
int n ;

vector< vector<int> >adj(MAX) ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	for(int i = 1 ; i <= n ; ++i)
		arr[i] = 1 ;
	for(int i = 0 ; i < n-1 ; ++i)
	{
		int x , y ;
		cin>>x>>y ;
		if(x > y)
			swap(x , y) ;
		arr[y]-- ;
		adj[x].push_back(y) ;
	}
	long long cost = 0ll ;
	for(int i = 1 ; i <= n ; ++i)
		cost += arr[i] * (n-i+1ll) ;
	long long ans = 0ll ;
	for(int i = 1 ; i <= n ; ++i)
	{
		ans += cost ;
		cost -= arr[i] * (n-i+1ll) ;
		for(auto &j : adj[i])
		{
			arr[j]++ ;
			cost += (n-j+1ll) ;
		}
	}
	return cout<<ans<<"\n" , 0 ;
}		

Measured memory_bytes: 15484
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>

int main(){
  int A, B;
  scanf("%d", &A);
  scanf("%d", &B);
  bool array[4];
  for (int i=0; i<4; i++){
    array[i] = false;
  }
  array[A] = true;
  array[B] = true;
  for (int i=1; i<4; i++){
    if (!array[i]){
      printf("%d\n",i);
    }
  }
  return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define repN_1(i, n) for(int i = 0; i < (int)(n - 1); i++)
#define repM(i, n) for(int i = (int)(n - 1); i >= 0; i--)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	int m, n;
	vector<int> a;
	int tmp;

	cin >> n >> m;

	rep(i, m)
	{
		cin >> tmp;
		n -= tmp;
	}

	if (n < 0)
		cout << -1 << endl;
	else
		cout << n << endl;

	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll 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(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}

int main(){
  int h,w;
  cin>>h>>w;
  v(string) a(h);
  rep(i,h) cin>>a[i];
  int cntp=0;
  rep(i,h){
    rep(j,w){
      if(a[i][j]=='#') cntp++;
    }
  }
  if(cntp==(h+w-1)){
    cout<<"Possible"<<endl;
    return 0;
  }
  cout<<"Impossible"<<endl;
}

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

int p[100000], to[100000];
set<int> used;

int find(int n) {
	if (to[n] != -1) {
		return to[n];
	}
	if (p[n] == 0) {
		return to[n] = n;
	}
	if (used.count(n)) {
		return to[n] = -2;
	}
	used.insert(n);
	return to[n] = find(n + p[n]);
}

int main()
{
	int N;
	cin >> N;
	fill(to, to + 100000, -1);
	for (int i = 0; i < N; i++) {
		cin >> p[i];
	}
	for (int i = 0; i < N; i++) {
		used.clear();
		find(i);
	}
	int res = 0;
	set<int> q;
	q.insert(0);
	used.clear();
	used.insert(0);
	while (!q.empty()) {
		res++;
		auto tmp = q; q.clear();
		for (auto p : tmp) {
			for (int i = 1; i <= 6; i++) {
				if (p + i >= N - 1 || to[p + i] == N - 1) {
					goto end;
				}
				if (to[p + i] != -2 && used.count(to[p + i]) == 0) {
					q.insert(to[p + i]);
					used.insert(to[p + i]);
				}
			}
		}
	}
end:
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 10356
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vec A(n),B(n);
    rep(i,n) cin>>A[i];
    rep(i,n) cin>>B[i];
    reverse(all(B));
    int z=-1,x=0;
    rep(i,n) if(A[i]==B[i]) z=A[i],x++;
    if(z==-1){
        cout<<"Yes\n";
        rep(i,n) cout<<B[i]<<" ";
        return 0;
    }
    int a=n,b=-1,c=n,d=-1;
    rep(i,n){
        if(A[i]==z||B[i]==z) a=min(a,i),b=max(b,i);
        if(A[i]==z&&B[i]==z) c=min(c,i),d=max(d,i);
    }
    if(a+n-1-b<x){
        cout<<"No";
    }
    else{
        rep(i,a){
            if(x==0) continue;
            swap(B[i],B[c+i]);
            x--;
        }
        rep(i,n-1-b){
            if(x==0) continue;
            swap(B[b+i+1],B[c+a+i]);
            x--;
        }
        cout<<"Yes\n";
        rep(i,n) cout<<B[i]<<" ";
    }
}

Measured memory_bytes: 6368
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll N;
void input(){
    fast_io();
    cin >> N;
}

int solve(){
    ll ans = 0;
    ll V = 0,E = 0;
    for (ll i = 0; i < (N-1); i++)
    {
        ll u,v; cin >> u >> v;
        if(u>v) swap(u,v);
        // E += u*(N-u+1);
        // E += v*(N-v+1);
        E += u*(N-v+1);
    }
    // E /= 2;
    
    for (ll i = 1; i <= N; i++)
    {
        V+=i*(N-i+1);
    }
    ans = V-E;
    cout << ans << endl;    
    return 0;
}   

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

Measured memory_bytes: 3648
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int N;
    cin >> N;
    getchar();
	string s;
	while (getline(cin, s))
	{
		// "the"も"this"も"that"も見つからない, 限りループし続ける
		//while (s.find("the") == string::npos
		//	&& s.find("this") == string::npos
		//	&& s.find("that") == string::npos)
		//{
			for (int i=0; i<s.size(); i++)
			{
				/*if (s[i] == 'z') // zの場合はaにリセット
					s[i] = 'a';
				else if (s[i] >= 'a' && s[i] <= 'z') // アルファベットは1文字ズラす
					s[i]++;*/
				s[i] += N;    //n~zまたはN~Zの時に13文字前にずらす
		        if (s[i] > 90) s[i] -= 26;
		        //printf("%c",c);    //文字で出力
			}
		//}
		cout << s << endl;
	}
}

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



int main() {
  string S;
  cin>>S;
  if(S.at(0)=='S'){
    if(S.at(1)=='S'){
      if(S.at(2)=='S'){
        cout<<0<<endl;
      }
      else cout<<1<<endl;
    }
    else{
      if(S.at(2)=='S'){
        cout<<1<<endl;
      }
      else cout<<2<<endl;
    }
  }
  else{
    if(S.at(1)=='S'){
      if(S.at(2)=='S'){
        cout<<1<<endl;
      }
      else cout<<1<<endl;
    }
    else{
      if(S.at(2)=='S'){
        cout<<2<<endl;
      }
      else cout<<3<<endl;
    }
  }
  
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;


struct RollingHash {
	static const int base1 = 1007, base2 = 2009;
	static const int mod1 = 1e9+7, mod2 = 1e9+9;
	vector<ll> hash1,hash2, power1, power2;

	RollingHash(const string &S) {
		int n = (int)S.size();
		hash1.assign(n+1,0);
		hash2.assign(n+1,0);
		power1.assign(n+1,1);
		power2.assign(n+1,1);

		for(int i=0;i<n;i++) {
			hash1[i+1] = (hash1[i] * base1 + S[i]) %mod1;
			hash2[i+1] = (hash2[i] * base2 + S[i]) %mod2;
			power1[i+1] = (power1[i] * base1) % mod1;
			power2[i+1] = (power2[i] * base2) % mod2;
		}
	}

	// ハッシュ値を2つ求めることで、正しさを担保
	// s[left: right]のハッシュ値を取得
	inline pair<ll,ll> get(int l, int r) const {
		ll res1 = hash1[r] - hash1[l] * power1[r-l] % mod1;
		if(res1 < 0 ) res1 += mod1;
		ll res2 = hash2[r] - hash2[l] * power2[r-l] % mod2;
		if(res2 < 0 ) res2 += mod2;
		return {res1, res2};
	}
	
	// S[a:]とS[b:]のLCP(最長共通接頭辞)を求める
	inline int getLCP(int a, int b) const {
		int len = min((int)hash1.size()-a, (int)hash1.size()-b);
		int low = 0, high = len;
		
		// 二分探索
		while(high-low > 1) {
			// 2で割るだけ
			int mid = (low+high) >> 1;
			if(get(a,a+mid) != get(b,b+mid) ) high = mid;
			else low = mid;
		}
		return low;
	}
};

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

	RollingHash rh(s);

	int res = 0;
	for(int i=0;i<n;i++) {
		for(int j=i+1;j<n;j++) {
			int lcp = rh.getLCP(i,j);
			lcp =min(lcp, j-i);
			res = max(res, lcp);
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int h,w;
char s[51][51];

void solve(){
    bool ok=true;
    rep(i,h){
        rep(j,w){
            if(s[i][j]=='#'){
                if(i==0){
                    if(j==0){
                        if(s[i][j+1]=='.'&&s[i+1][j]=='.') ok=false;
                    }else if(j==w-1){
                        if(s[i][j-1]=='.'&&s[i+1][j]=='.') ok=false;
                    }else{
                        if(s[i][j-1]=='.'&&s[i][j+1]=='.'&&s[i+1][j]=='.') ok=false;
                    }
                }else if(i==h-1){
                    if(j==0){
                        if(s[i][j+1]=='.'&&s[i-1][j]=='.') ok=false;
                    }else if(j==w-1){
                        if(s[i][j-1]=='.'&&s[i-1][j]=='.') ok=false;
                    }else{
                        if(s[i][j-1]=='.'&&s[i][j+1]=='.'&&s[i-1][j]=='.') ok=false;
                    }
                }else{
                    if(j==0){
                        if(s[i][j+1]=='.'&&s[i-1][j]=='.'&&s[i+1][j]=='.') ok=false;
                    }else if(j==w-1){
                        if(s[i][j-1]=='.'&&s[i-1][j]=='.'&&s[i+1][j]=='.') ok=false;
                    }else{
                        if(s[i][j-1]=='.'&&s[i][j+1]=='.'&&s[i-1][j]=='.'&&s[i+1][j]=='.') ok=false;
                    }
                }
            }
        }
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

int main(){
    cin>>h>>w;
    rep(i,h){
        rep(j,w) cin>>s[i][j];
    }
    solve();
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner sc=new Scanner(System.in);
		
		//整数の入力
		int a=sc.nextInt();
		int b=sc.nextInt();
		
		int c=a*b;
		
		String Even;
		String Odd;
				
		if(c%2==0) {
			System.out.println("Even");
		}else
			System.out.println("Odd");
	}

}


Measured memory_bytes: 20564
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << -1; return;}

const int INF = 1e9 + 7;

void solve() {
    int n; cin >> n;
    vector <int> w(n);
    loop(i, n)
        cin >> w[i];
    int ans = INF;
    loop(i, n - 1) {
        int sum1 = 0, sum2 = 0;
        loop(j, n)
            j <= i ? sum1 += w[j] : sum2 += w[j];
        ans = min(ans, abs(sum1 - sum2));
    }
    cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;

int main() {

    ll A, B, C, K;
    cin >> A >> B >> C >> K;

    if(A >= K){
        cout << K << endl;
        return 0;
    }else if(A+B >= K){
        cout << A << endl;
        return 0;
    }else if(A+B+C >= K){
        cout << A - (K-A-B) << endl;
        return 0;
    }



}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 3604
import math
def gcd(a,b):
    if a < b: a, b = b, a
    while a % b != 0:
        c = a / b
        a -= c * b
        a, b = b, a 
    return b
def div(a):
    ret = set()
    for i in range(1,int(math.sqrt(a))+1):
        if a % i == 0: ret.add(i); ret.add(a/i);
    return sorted(ret)
n = input()
l = map(int, raw_input().split())
if n==2: ans = div(gcd(l[0], l[1]))
else: ans = div(gcd(gcd(l[0], l[1]), l[2]))
for i in ans: print i

Measured memory_bytes: 6536
#include <cstdio>

int main(int argc, const char *argv[]) {
  int n;
  scanf("%d", &n);

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

  int ans = 0, cur = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] != cur) {
      ans++;
    } else {
      cur++;
    }
  }

  printf("%d\n", ans == n ? -1 : ans);
}


Measured memory_bytes: 896