akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (x % y == 0) return y;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x * y / GCD(x, y);}
//cout << fixed << setprecision(10);

int main(){
  ll n,x=0,y=0,xsum=0,ysum=0;cin>>n;
  vector<ll>v(n); rep(i,n) cin>>v[i];
  rep(i,n){
    xsum+=v[i]; ysum+=v[i];
  if(i%2==0){
    if(xsum<=0){
  x+=abs(xsum)+1; xsum=1;
  }
    if(ysum>=0){
    y+=ysum+1; ysum=-1;
    }
  }
    else{
    if(xsum>=0){
    x+=xsum+1; xsum=-1;
    }
      if(ysum<=0){
      y+=abs(ysum)+1; ysum=1;
      }
    }
  }
  cout<<min(x,y)<<endl;
}

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

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

double tax(int tax_pc, int value) {
  return value * (100 + tax_pc) / 100;
}


int main(int argc, char *argv[])
{
  int tax1, tax2, i, j, temp;
  int sum1, sum2;

  while (true) {
    
    cin >> tax1 >> tax2 >> sum1;
    if (tax1 == 0 && tax2 == 0 && sum1 == 0) break;
    int maximum = 0;
    for (i = 1; i < sum1; i++) {
      for (j = 1; j < sum1; j++) {
	if (sum1 == tax(tax1, i) + tax(tax1, j)) {
	  sum2 = tax(tax2, i) + tax(tax2, j);
	  if (sum2 > maximum) {
	    //cout << "i is " << i << endl;
	    //cout << "j is " << j << endl;
	   
	    maximum = sum2;
	  }
	}
      }
    }
    
    cout << maximum << endl;
  }
  

    
  return 0;
}

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

using namespace std;

/*template<typename T>
inline void swap1(T& a, T& b){
T t=a;a=b;b=t;  
}
:*/


int main(){

	long long a,b;
	int N,count=0;
	cin >> N;
	vector<int> A(N);
	
	
	for(int i=0;i<N;i++){
		cin >> A[i];
	}
	
	
/*	for(int i=0;i<N-1;i++){
		for(int j=i+1;j<N;j++){
			if(A[i]<A[j]){swap1(A[i],A[j]);}
		}
	}
*/	
	
	//拡張for文(C++11)
	/*for(int i : A){
		cout << i <<endl;
	}*/
	
	
	//降順に並び替え
	sort(A.rbegin(),A.rend());
	
	for(int i=0;i<N-1;i++){
			if(A[i]==A[i+1]){
				if(count==0){
					a=A[i];
					count++;
					i++;
				}else if(count==1){
					b=A[i];
					cout<<a*b<<endl;
					return 0;
				}
			}
	}
	
	cout<<0<<endl;
	//return 0;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
const int MOD = 1e9+7,MAX = 1e5;

int main()
{
	int w,h,x,y,z;
	cin >> w >> h >> x >> y >> z;
	if(x-z>=0&&x+z<=w&&y-z>=0&&y+z<=h)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(ll i = (begin); i < (end); i++)
#define rep(i, n) FOR(i, 0, n)
using ll = long long;
using namespace std;
#define all(x) (x).begin(),(x).end()
using pii = pair<int, int>; using vi = vector<int>; using vl = vector<ll>;

signed main() {
    int n, k;
    cin >> n >> k;
    vi h(n);
    rep(i, n) cin>>h[i];
    vi dp(n, INT_MAX);
    dp[0] = 0;
    FOR(i,1,min(k,n)) rep(j,i) {
        dp[i] = min(dp[i], dp[j] + abs(h[j] - h[i]));
    }
    rep(i,n-k) {
        rep(j,k)
            dp[i+k] = min(
                dp[i+j] + abs(h[i+k] - h[i+j]),
                dp[i+k]);
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)

int a[] = { 1, 5, 10, 50, 100, 500 };
int N[6];
int ret[666667];

int min(int x, int y) { return x < y ? x : y; }

int main()
{
	REP(p, 1, 666667) {
		int t = p;
		rep(i, 6) { int k=t/a[5-i]; ret[p]+=k; t-=k*a[5-i]; }
	}
	int P;
	while (scanf("%d", &P), P) {
		int s = 0;
		rep(i, 6) { scanf("%d", N+i); s += a[i] * N[i]; }

		int res = (1<<29);
		REP(p, P, s+1) {
			int t = p;
			int pay = 0;
			rep(i, 6) { int k=min(N[5-i], t/a[5-i]); pay+=k; t-=k*a[5-i]; }
			if (!t) res = min(res, pay+ret[p-P]);
		}
		printf("%d\n", res);
	}
	return 0;
}

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

int main(){
   string s; cin>>s;
   int ans=0;
   int cnt=0;
   for(int i=0;i<s.size();i++){
      if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
         cnt++;
      }
      else cnt=0;
      ans=max(ans,cnt);
   }
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF (1<<26)

int D,N;
int dp[101][101];
int a[101],b[101],c[101];

int main(){
  while(1){
    scanf("%d %d",&D,&N);
    if(D==0&&N==0)break;
    for(int i=0;i<N;i++)scanf("%d %d %d",&a[i],&b[i],&c[i]);
    fill(dp[0],dp[101],INF);    
    dp[0][0]=0;    
    for(int i=0;i<D;i++){
      for(int j=0;j<=100;j++){
        if(dp[i][j]==INF)continue;
        int cost=dp[i][j];
        for(int k=0;k<N;k++){
          if(j<c[k])continue;
          int &to=dp[min(D,i+a[k])][min(100,j+b[k])];
          to=min(to,cost+1);
        }
      }
    }
    int ans=INF;
    for(int i=0;i<=100;i++)
      ans=min(ans,dp[D][i]);
    if(ans==INF)cout<<"NA"<<endl;
    else cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            //System.Threading.Thread.Sleep(1000);
        }

        public void Solve(ConsoleInput cin)
        {
            int a = cin.ReadInt;
            int b = cin.ReadInt;

            var s = new DateTime(2018, 1, 1);
            var d = new DateTime(2018, a, b);
            int cnt = 0;
            do
            {
                if (s.Month == s.Day) cnt++;
                s = s.AddDays(1);
            } while (s <= d);

            Console.WriteLine(cnt);
        }
    }

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

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define all(a) a.begin(),a.end()
#define fi first
#define se second
#define deb(x) cout << #x << "=" << x << endl
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
int M=1e9+7,N=205001;

int mm(int x,int y){x%=M,y%=M;return (x*y)%M;}//Modular Multiply
int po(int x,int y){ if(!y)return 1;int a=po(x,y/2)%M;if(y%2)return mm(a,mm(a,x));return mm(a,a);}//(x**y)%M



void solve() {
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max({a*c,a*d,b*c,b*d});
}


signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--) solve();
	return 0;
}





Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18

using namespace std;
vector<vector<ll>> edge;
vector<ll> can_visit;

void dfs(ll cur){

  for (int i = 0; i < edge[cur].size(); i++){
    ll u = edge[cur][i];

    if (can_visit[cur] & 1){
      if (!((can_visit[u] >> 1) & 1)){
        can_visit[u] |= 2;
        dfs(u);
      }
    }
    if ((can_visit[cur] >> 1) & 1){
      if (!(can_visit[u] & 1)){
        can_visit[u] |= 1;
        dfs(u);
      }
    }
  }
}

int main(void){
  ll n, m;
  cin >> n >> m;
  edge = vector<vector<ll>> (n, vector<ll>(0));
  for (int i = 0; i < m; i++){
    ll x, y;
    cin >> x >> y;
    
    x--; y--;
    edge[x].emplace_back(y);
    edge[y].emplace_back(x);
  }
  
  can_visit = vector<ll>(n, 0);
  can_visit[0] = 1;

  dfs(0);
  
  ll e = 0, o = 0;
  for (int i = 0; i < n; i++){
    if (can_visit[i] == 1)
      e++;
  }
  for (int i = 0; i < n; i++){
    if (can_visit[i] == 2)
      o++;
  }

  cout << n*(n-1)/2 - e*(e-1)/2 - o * (o-1)/2 - m << endl;

  return 0;
}


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

int main()
{
  string s;
  cin >> s;
  int n = s.length();
  vector<vector<int64_t>> dp(n + 1, vector<int64_t>(13));
  dp[0][0] = 1;

  for (int i = 0; i < n; i++) {
    int c = s[i] == '?' ? -1 : s[i] - '0';
    for (int j = 0; j < 10; j++) {
      if (c != -1 && c != j) continue;
      for (int k = 0; k < 13; k++) {
        int r = (k * 10 + j) % 13;
        dp[i + 1][r] = (dp[i + 1][r] + dp[i][k]) % 1000000007;
      }
    }
  }
  cout << dp[n][5] << endl;
}


Measured memory_bytes: 13696
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty())return out;
    constexpr bool is_vector_v = is_vector<T>::value;
    if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
    else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
    return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

template <typename T>
vector<pair<int, T>> rle(vector<T> a)
{
    int n = (int)a.size();
    vector<pair<int, T>> res;
    if (n == 0)
    {
        return res;
    }
    T now = a[0];
    int con = 0;
    for (int i = 0; i < n; ++i)
    {
        if (a[i] == now)
        {
            con++;
        }
        else
        {
            res.push_back(pair<int, T>(con, now));
            now = a[i];
            con = 1;
        }
    }
    res.push_back(pair<int, T>(con, now));
    return res;
}

vector<char> stv(string s){
    int n = (int)s.size();
    vector<char> res(n);
    for(int i=0;i<n;++i){
        res[i] = s[i];
    }
    return res;
}

int main() {
    int n;
    string s;
    cin >> n >> s;
    put(rle(stv(s)).size());
    return 0;
}


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

int main() {
	long X, Y; cin >> X >> Y;
	long ans=1, i=X;
	while(true){
	    if(Y/2>=i){
	        ++ans;
	        i *= 2;
	    }
	    else break;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n, k, q = map(int, input().split())
q_list = [int(input()) for i in range(q)]

arr = [k - q] * n

for q_i in q_list:
    arr[q_i - 1] += 1

for go_or_not in arr:
    if go_or_not > 0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 10448
sec = int(input())
h = int(sec/3600)
#print(h)
h_mod = int(sec%3600)
#print(h_mod)
min = int(h_mod//60)
min_mod = int(h_mod%60)
#print(min)
#print(min_mod)
print ( str(h) + ":" + str(min) + ":" + str(min_mod) )

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

int main() {
  vector<vector<int64_t>> c(51, vector<int64_t>(51));
  rep(i, 51){
    rep(j, i+1){
      if(j == 0 || j == i) c[i][j] = 1;
      else c[i][j] = c[i-1][j-1] + c[i-1][j];
    }
  }
  int64_t n, p, s = 0, a = 0, b = 0, g = 0, h = 0;
  cin >> n >> p;
  vector<int64_t> v(n);
  rep(i, n) cin >> v[i];
  rep(i, n){
    v[i] %= 2;
    s += v[i];
    if(v[i] == 0) ++b;
  }
  s %= 2;
  if(s == p){
    rep(i, b+1) g += c[b][i];
    for(int i = 0; i <= n-b; i += 2) h += c[n-b][i];
    a += g * h;
  }
  else{
    rep(i, b+1) g += c[b][i];
    for(int i = 1; i <= n-b; i += 2) h += c[n-b][i];
    a += g * h;
  }
  cout << a << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N,M,L,R,i,maxL,minR,ans;
    cin >> N >> M;
    maxL=1;
    minR=N;
    for(i=0;i<M;i++){
        cin >> L >> R;
        if(maxL<L)maxL=L;
        if(minR>R)minR=R;
    } 
    ans=minR-maxL+1;
    if(ans<0)cout << 0 <<endl;
    else cout << ans << endl;
}



Measured memory_bytes: 256
import bisect
A, B, Q = map(int, input().split())

INF = 10**18

s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]

for q in range(Q):
  x = int(input())
  b = bisect.bisect_right(s, x)
  d = bisect.bisect_right(t, x)
  res = INF
  for S in [s[b-1], s[b]]:
    for T in [t[d-1], t[d]]:
      d1 = abs(S - x) + abs(T - S)
      d2 = abs(T - x) + abs(S - T)
      res = min(res, d1, d2)
      
  print(res)


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

#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcd(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  vt<int> vec;
  for(int i = 1, num = 1; num <= 1e6; ++i, num = i * (i + 1) * (i + 2) / 6) {
    vec.push_back(num);
  }

  vt<int> dp1(1e6 + 1, INF), dp2(1e6 + 1, INF);
  dp1[0] = dp2[0] = 0;
  rep(i, 1, 1e6 + 1) {
    rep(j, 0, vec.size()) {
      if(i >= vec[j]) {
        dp1[i] = min(dp1[i], dp1[i - vec[j]] + 1);
        if(vec[j] % 2 == 1) dp2[i] = min(dp2[i], dp2[i - vec[j]] + 1);
      }
    }
  }

  int n;
  while(cin >> n, n != 0) cout << dp1[n] << " " << dp2[n] << endl;
}


Measured memory_bytes: 10684
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nya_n "(=^･ω･^=)"
typedef long long ll;
using namespace std;

int n, a, x[50], y[50], xmn, xmx, ymn, ymx, cnt;
ll mn;

/*
ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	ll g = gcd(x, y);
	return x / g * y;
}*/



int main(){
	cin >> n >> a;
	lp(n) {
		cin >> x[i] >> y[i];
	}
	mn = llmax;
	lp(n) {
		xmn = x[i];
		LP(n, j) {
			xmx = x[j];
			if (xmn <= xmx) {
				LP(n, k) {
					ymn = y[k];
					LP(n, l) {
						ymx = y[l];
						if (ymn <= ymx){
							cnt = 0;
							LP(n, m) {
								if (xmn <= x[m] && x[m] <= xmx&&ymn <= y[m] && y[m] <= ymx) {
									cnt++;
									if (cnt == a) {
										mn = min(mn, (ll(xmx) - ll(xmn))*(ll(ymx) - ll(ymn)));
										break;
									}
								}
							}
						}
					}
				}
			}
		}
	}
	cout << mn << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    ll x, y; cin >> x >> y;
    int count = 0;
    while (x <= y){
        count++;
        x *= 2;
    }
    cout << count << endl;
}

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

int main() {

    int N;
    cin >> N;
   /* vector<int>A(N);
    for (int i = 0; i < N; i++) { cin >> A.at(i); }
    */
  if(N%7==0){cout<<"Yes"<<endl;}
  else{
    while(N>0){
      if(N%4==0){cout<<"Yes"<<endl;break;}
      N-=7;
      if(N<=0){cout<<"No"<<endl;}
    }}

    
}
    

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

using namespace std;

vector<long long> vec[4];

long long val(int a,int b,int c,int d){
  long long sum=0;
  for(int i=1;i<=a;i++){
    sum=sum+vec[0][i-1];
  }
  for(int i=1;i<=b;i++){
    sum=sum+vec[1][i-1];
  }
  for(int i=1;i<=c;i++){
    sum=sum+vec[2][i-1];
  }
  for(int i=1;i<=d;i++){
    sum=sum+vec[3][i-1];
  }
  return sum;
}

int main(){
  long long N,W; cin >> N >> W;
  long long w_1,v_1; cin >> w_1 >> v_1;
  vec[0].push_back(v_1);
  for(int i=2;i<=N;i++){
    long long w,v; cin >> w >> v;
    vec[w-w_1].push_back(v);
  }
  for(int i=0;i<4;i++) sort(vec[i].begin(),vec[i].end(),greater<int>());
  long long ans=0;
  for(int a=0;a<=vec[0].size();a++){
    for(int b=0;b<=vec[1].size();b++){
      for(int c=0;c<=vec[2].size();c++){
        for(int d=0;d<=vec[3].size();d++){
          if(a*w_1+b*(w_1+1)+c*(w_1+2)+d*(w_1+3)<=W){
            long long v=val(a,b,c,d);
            ans=max(ans,v);
          }
        }
      }
    }
  }
  cout << ans << endl;
}

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


void solve(long long a, long long b){
    if(b < a){
        swap(a, b);
    }
    const char ca = '0' + static_cast<char>(a);
    string x;
    REP(i, b){
        x += ca;
    }
    cout << x << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(a, b);
    return 0;
}


Measured memory_bytes: 256
//        VIVEK UPADHYAY
//        MANIT, BHOPAL(M.P)


//                         JAB-TAK TODEGA NHI,
//                         TAB -TAK CHODEGA NHI :D
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<endl
#define ok cout<<"ok\n" ;
typedef long long ll;
const int MAXN = 1e6 + 10 ;
const int MAX = 1e7 ;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e18 ;
int main() {
    int N , K ;
    cin >> N >> K ;
    ll a[N] ;
    for(int i=0;i<N;i++) cin >> a[i] ;
    
    
    ll mx = inf ;
    for(int i=0;i<N;i++){
        int st = i , ed = i+K-1 ;
        if(ed < N)
            mx = min(mx , min(abs(a[st]) + abs(a[ed]-a[st]) , abs(a[ed]) + abs(a[ed] - a[st]))) ;
    }
    cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#define ll long long
#define pi (acos(-1))
using namespace std;
int main()
{
        ll n;cin>>n;
    ll t;
    ll ans = 0;
    for (ll i = 0; i != n; ++i)
    {
        cin >> t;
        ans = gcd(ans, t);
    }
    std::cout << ans << std::endl;
    return 0;
}


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

string s,t,b="~";

bool OK(string a,string b){
	for(int i=0;i<a.size();i++){
		if(a[i]=='?') continue;
		if(a[i]!=b[i]) return false;
	}
	return true;
}

int main(){
	cin>>s>>t;
	for(int i=0;i<=(int)s.size()-(int)t.size();i++){
		string now=s.substr(i,t.size());
		if(OK(now,t)){
			string ans=s;
			for(int j=0;j<i;j++) if(s[j]=='?') ans[j]='a';
			for(int j=i;j<i+t.size();j++) ans[j]=t[j-i];
			for(int j=i+t.size();j<s.size();j++) 
				if(s[j]=='?') ans[j]='a';
			b=min(b,ans);
		}
	}
	if(b=="~") cout<<"UNRESTORABLE"<<endl;
	else cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;

int main(){
    int N, T;
    cin >> N >> T;
    vector<int> t(N);
    rep(i, N) cin >> t[i];
    ll ans = T;
    for (int i=1; i<N; i++) {
        ans += min(T, t[i]-t[i-1]);
    }
    cout << ans << endl;
    return 0;
}

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

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

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(ll, A);
    CIN(ll, B);
    CIN(ll, C);
    CIN(ll, D);

    ll ac, bc, ad, bd;
    ac = (A - 1) / C;
    bc = B / C;
    ad = (A - 1) / D;
    bd = B / D;

    ll lcm = C * D / gcd(C, D);
    ll acd, bcd;
    acd = (A - 1) / lcm;
    bcd = B / lcm;

    ll ans = (B-A+1) -( (bc+bd-bcd) - (ac+ad-acd) );

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

v = []
p = []
count = 0
m = 0
def rec(l, n):
	global count
	if len(l) == n:
		c = 0
		for k, sw in enumerate(v):
			st = set()
			for i in range(n):
				if l[i] == 1:
					st.add(i + 1)
			# print(st)
			if len(sw.intersection(st)) % 2 != p[k]:
				return
		# print("c: {}".format(c))
		count += 1
		# print(l)
		return
	l.append(0)
	rec(list(l), n)
	l.pop()
	l.append(1)
	rec(list(l), n)

def main():
	global v
	global p
	global m
	n, m = map(int, input().strip().split())
	for i in range(m):
		tmp = list(map(int, input().strip().split()))
		v.append(set(tmp[1:]))
	p = list(map(int, input().strip().split()))
	rec([], n)
	print(count)

if __name__ == '__main__':
	main()


Measured memory_bytes: 42736
R, C, K = map(int, input().split())
item = [[0]*(C+1) for _ in range(R+1)]
for _ in range(K):
    r, c, v = map(int, input().split())
    item[r][c] = v


dp = [[[0]*(C+1) for _ in range(R+1)] for _ in range(4)]

for i in range(R+1):
    for j in range(C+1):
        for k in range(4):
            here = dp[k][i][j]
            # 次の"行"に移動する場合（下に移動するので今まで獲得したアイテムの個数はリセットされる）
            if i + 1 <= R:
                # 移動先のアイテムを取らない場合
                dp[0][i+1][j] = max(dp[0][i+1][j], here)
                # 移動先のアイテムをとる場合
                dp[1][i+1][j] = max(dp[1][i+1][j], here+item[i+1][j])
            # 次の列に移動する場合（右に移動するのでその行で獲得したアイテムの個数は維持される）
            if j + 1 <= C:
                dp[k][i][j+1] = max(dp[k][i][j+1], here)
                # 現在のkが3未満のときのみ，移動先のアイテムをとることが可能
                if k < 3:
                    dp[k+1][i][j+1] = max(dp[k+1][i][j+1], here+item[i][j+1])

ans = 0
for k in range(4):
    ans = max(ans, dp[k][-1][-1])
print(ans)


Measured memory_bytes: 428704
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
	int i,flag=0,x=0;
	char a[101];
	gets(a);
	for(i=0;i<strlen(a);i++)
	{
		if(a[i]=='C') flag=1;
		if(flag==1&&a[i]=='F') x=1;
	}
	if(x==1) printf("Yes");
	else printf("No");
	return 0;
 } 

Measured memory_bytes: 128
def solve():
    s = read()
    result = think(s)
    write(result)


def read():
    return read_line(n=3)


def read_int(n):
    return list(map(int, read_line().split()[:n]))


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(s):
    return s.count('1')


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 38256
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
----
List = {}
function List.new()
    return setmetatable({first = 0, last = -1}, {__index = List})
end

function List.clone(origin)
    local child = List.new()
    for k,v in pairs(origin) do
        child[k] = v
    end
    return child
end

function List:count()
    return self.last - (self.first - 1)
end

function List:pushleft(value)
    local first = self.first - 1
    self.first = first
    self[first] = value
end

function List:popright()
    local last = self.last
    if self.first > last then error("list is empty") end
    local value = self[last]
    self[last] = nil -- to allow garbage collection
    self.last = last - 1
    return value
end
----
local H, W = read.nnl()
local S = {}
for i=1,H do
    S[i] = read.l():totable()
end
local function bfs(i1, j1)
    if S[i1][j1] ~= '.' then
        return -1
    end
    local seen = {}
    for i=1,H do
        seen[i] = {}
    end
    local q = List.new()
    q:pushleft({i1, j1, 0})
    seen[i1][j1] = true
    local dmax = 0
    while q:count() > 0 do
        local i, j, d = table.unpack(q:popright())
        local function checkdo(newi, newj)
            if newi >= 1 and newi <= H then
                if not seen[newi][newj] and S[newi][newj] == '.' then
                    q:pushleft({newi, newj, d+1})
                    dmax = math.max(dmax, d+1)
                    seen[newi][newj] = true
                end
            end
        end
        checkdo(i+1,j)
        checkdo(i-1,j)
        checkdo(i,j+1)
        checkdo(i,j-1)
    end
    return dmax
end
local ans = 0
for i=1,H do
    for j=1,W do
        ans = math.max(ans, bfs(i, j))
    end
end
print(ans)


Measured memory_bytes: 1136
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
using namespace std;
const int INF = 1000000000000;
const int mod = 1000000007;
int test[345678], kari[345678];
signed main() {
	int n, a = 1, b, ans = 0; cin >> n;
	for(int h = 1; h <= n; h++) {
		a *= h; a %= mod;
	}
	cout << a % mod << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long, long long> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<pair<ll,ll> > vii;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef pair<ll,pair<ll,ll> > iii;
#define PI 3.141592653589793
#define mod (ll)(1000*1000*1000+7)
//# define N 300005
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=((ans%m)*(a%m))%m; b/=2; a=((a%m)*(a%m))%m; } return ans%m; }
# define INF (ll)1e18
# define LN 20  
typedef pair<ll,pair<ll,ll> > pii;
# define INF1 (ll)1e10
# define maxn 300005
# define offset 2000005
#define N 100005
const ld eps = 1e-10L;

/*void LPS()
{
	len = s.length();
    lps[0] = 0;
    for(ll i=1;i<len;i++){

        ll j = lps[i-1];
        while(j > 0 && s[j] != s[i])    j = lps[j-1];
        if(s[i] == s[j])    j++;
        lps[i] = j;
    }
}*/

/*************************************************
struct Coupon {
	ll l;
	ll r;
	ll id;

	Coupon(ll l, ll r, ll id): l(l), r(r), id(id) {} // Initialization

	bool operator<(const Coupon& c) { // Sorting
		return l < c.l;    
	}
};

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

	ll b=0;
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		if(s[i]=='B')
			b++;
		else
			ans+=b;
	}
	cout << ans;
}

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

#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
using namespace std;
using ll = long long;

/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/

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

vector<pair<ll, ll>> prime_factorize(ll N) {
  vector<pair<ll, ll>> results;
  for (ll i=2; i*i<N; i++) {
    if (N%i != 0) continue;
    ll ex = 0;
    while(N%i == 0) {
      ex++;
      N /= i;
    }
    results.push_back(make_pair(i, ex));
  }
  if ( N!= 1) results.push_back({N, 1});
  return results;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll A, B;
    cin >> A >> B;
    ll x = gcd(A, B);

    auto results = prime_factorize(x);

    print(results.size() + 1);
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define f(i,n) for(int i=0; i<n; ++i)
#define fi(i,st,n) for(int i=st; i<=n; ++i)
#define veci vector<int>
#define vecp vector<pair<int,int> >
#define vecl vector<ll>
int prime[100000+10];

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

ll power(ll a, ll n, ll mod) {
	ll res = 1;
	while(n > 0) {
		if(n&1) {
			res = (res*a)%mod;
		}
		a = (a*a)%mod;
		n = n/2;
	}
	return res;
}

ll sum(int arr[], int n) {
	ll res = 0;
	f(i,n) {
		res += arr[i];
	}
	return res;
}

void seive() {
	prime[1] = 0;
	for(int i=2; i<=100000; i++) {
		prime[i] = 1;
	}
	for(ll i=2; i<=100000; i++) {
		if(prime[i]) {
			for(ll j=i*i; j<=100000; j+=i) {
				prime[j] = 0;
			}
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t = 1;
//	cin>>t;
	while(t--){
		int n;
		cin>>n;
		string s;
		cin>>s;
		int ans = 0;
		int l = 0, r = n-1;
		while(l < r) {
			if(s[l] == 'W') {
				while(r > l and s[r] == 'W') r--;
				if(r > l) {
					ans++;
					swap(s[l],s[r]);
				}
			}
			l++;
		}
		cout<<ans<<"\n";
 	}
 	return 0;
}


Measured memory_bytes: 3768
Scanf.scanf "%d %d" (fun n t ->
    let ab = Array.init n (fun _ -> Scanf.scanf " %d %d" (fun a b -> a, b)) in
    Array.sort compare ab;
    let dp = Array.make (t + 1) 0 in
    Array.iter (fun (a, b) ->
        for j = t - 1 downto 0 do
            let idx = min t (j + a) in
            dp.(idx) <- max dp.(idx) (dp.(j) + b)
        done
    ) ab;
    Array.fold_left max 0 dp |> Printf.printf "%d\n"
)

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll t[2]; cin>>t[0]>>t[1];
	ll a[2],b[2]; cin>>a[0]>>a[1]>>b[0]>>b[1];
	a[0]*=t[0]; b[0]*=t[0]; a[1]*=t[1]; b[1]*=t[1];
	if(a[0]+a[1]==b[0]+b[1])
	{
		cout<<"infinity\n"; return 0;
	}
	else
	{
		if(a[0]+a[1]>b[0]+b[1])
		{
			swap(a[0],b[0]); swap(a[1],b[1]);
		}
		if(a[0]<b[0])
		{
			cout<<0<<'\n'; return 0;
		}
		ll tmp = (a[0]-b[0])/(b[0]+b[1]-a[0]-a[1]);
		ll ans = tmp*2+1;
		if((a[0]-b[0])%(b[0]+b[1]-a[0]-a[1])==0) ans--;
		cout<<ans<<'\n';
	}
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a_tot = sum(a)

for i in range(n):
	a[i], b[i] = a[i] - b[i], b[i] - a[i]
	if b[i] > 0:
		a[i+1] -= b[i]
	if a[i] < 0:
		a[i] = 0
	if a[i+1]<0:
		a[i+1] = 0
print(a_tot-sum(a))

Measured memory_bytes: 24180
/* PRACTICA 3 */

#include<stdio.h>
#include<math.h>
#include <stdlib.h>


int main(){

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

    int *a = (int*)calloc(100007, sizeof(int));

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

    int ans = a[0];
    for(i = 0; i < 100007; ++i)
        ans = (ans < a[i] ? a[i] : ans);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 512
n,k = map(int,input().split())
x = list(map(int,input().split()))

ans = 10**9
for i in range(n-k+1):
    a = min((abs(x[i])+abs(x[i]-x[i+k-1])),(abs(x[i+k-1])+abs(x[i]-x[i+k-1])))
    if a < ans:
        ans = a
print(ans)

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

typedef long long ll;
const int MAX_N = 100000;

int main() {
	int N, four = 0, odd = 0;

	std::cin >> N;
	for(int i = 0; i < N; ++i) {
		ll a;
		std::cin >> a;
		if(a % 2 != 0) ++odd;
		else if(a % 4 == 0) ++four;
	}

	if(odd <= four || (odd == four + 1 and odd + four == N)) {
		std::cout << "Yes" << std::endl;
	} else {
		std::cout << "No" << std::endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 200005;
long long f[maxn], s[maxn];
long long ans;
 
int main(){
    int n, x; cin >> n;
    for(int i = 1; i <= n; i++){
        scanf("%d", &x);
        f[i] = f[i-1] + x;    //计算异或前缀和
        s[i] = s[i-1] ^ x;    //计算加法前缀和
    }
    int l = 1;
    ans=0;
    for(int r = 1; r <= n; r++){         //枚举元素
        for(; f[r] - f[l-1] != (s[r] ^ s[l-1]); l++);//如果符合条件的话 则立即退出进行计算
        ans += r - l + 1;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 6944
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B;
    cin >> A >> B;
    if(A %2 == 0 || B%2 == 0){
        print("No");
    }else{
        print("Yes");
    }
    

}


Measured memory_bytes: 892
#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	int x,y,z;
	x=a+b;
	y=a-b;
	z=a*b;
	if(x>=y && x>=z){
		printf("%d",x);
	}
	else if(y>=x && y>=z){
		printf("%d",y);
	}
	else{
		printf("%d",z);
	}
	return 0;
}

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

int main()
{
        int N, L;
        int A[100005];

        cin >> N >> L;

        int pos = -1;
        for ( int i = 0; i < N; i++ ) {
                cin >> A[i];
                if ( i > 0 && A[i] + A[i - 1] >= L ) pos = i - 1;
        }

        if ( pos == -1 ) {
                cout << "Impossible" << endl;
        } else {
                cout << "Possible" << endl;
                for ( int i = 0; i < pos; i++ ) {
                        cout << i + 1 << endl;
                }
                for ( int i = N - 2; i > pos; i-- ) {
                        cout << i + 1 << endl;
                }
                cout << pos + 1 << endl;
        }
        
        return ( 0 );
}


Measured memory_bytes: 1280
# coding: utf-8


def main():
    N = int(input())
    ans = 0
    B = list(map(int, input().split()))
    ans += B[0] + B[-1]

    for i in range(1, N - 1):
        ans += min(B[i - 1], B[i])

    print(ans)

if __name__ == "__main__":
    main()


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

int main(){
  string str;

  while(getline(cin,str)){
    int flg = 0;

    while(true){
      for(int i = 0 ; i < str.length() ; i++){
	string key1 = str.substr(i,3),key2 = str.substr(i,4);
	if(key1 == "the" || key2 == "that" || key2 == "this") flg = 1;
      }

      if(flg) break;
      else{
	for(int j = 0 ; j < str.length() ; j++){
	  if('a' <= str[j] && str[j] <= 'z'){
	    str[j] -= 'a' - 'A';
	    str[j] = (char)('A'+(str[j]-'A'+26+1)%26);
	    str[j] += 'a' - 'A';
	  }
	  else continue;
	}
      }
    }
    cout << str << endl;
  }

  return 0;
}

Measured memory_bytes: 2996
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];

  int sum = 0;
  int ave;
  for(int i=0;i<n;i++){
    sum += a[i];
  }
  ave = sum/n;

  int avem = ave-1,avep = ave+1;
  int c = 0,cm = 0,cp = 0;
  for(int i=0;i<n;i++){
    c += (a[i]-ave)*(a[i]-ave);
    cm += (a[i]-avem)*(a[i]-avem);
    cp += (a[i]-avep)*(a[i]-avep);
  }

  cout << min(c,min(cm,cp)) << endl;
}


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

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

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( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main(){
    int N; cin >> N;
    map<string, int> used;

    char t;
    REP( i, N ){
        string s; cin >> s;
        
        used[s]++;

        if( i != 0 ){
            if( t != s[0] ){
                cout << "No" << endl;
                return 0;
            }
        }

        t = s[s.size() - 1];
    }

    for( auto p : used ){
        if( p.second >= 2 ){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
char in[220][220];
int sum[220][220];
int rec(int a,int b,int c,int d){
	return sum[c+1][d+1]-sum[a][d+1]-sum[c+1][b]+sum[a][b];
}
int tmp[220];
short to[220][220][220][20];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)scanf("%s",in[i]);
	int ret=mod;
	for(int i=0;i<a;i++){
		for(int j=0;j<b;j++){
			if(in[i][j]=='#'){
				sum[i+1][j+1]++;
			}
		}
	}
	for(int i=0;i<=a;i++){
		for(int j=0;j<=b;j++){
			sum[i][j+1]+=sum[i][j];
		}
	}
	for(int i=0;i<=a;i++){
		for(int j=0;j<=b;j++){
			sum[i+1][j]+=sum[i][j];
		}
	}
	for(int i=b-1;i>=0;i--){
		for(int j=0;j<=16;j++){
			for(int l=i;l<b;l++){
				to[i][a][l][j]=a;
			}
			if(j==0){
				
				for(int l=i;l<b;l++){
					int la=a;
					for(int k=a-1;k>=0;k--){
						while(la>k&&rec(k,i,la-1,l)!=(la-k)*(l-i+1)&&rec(k,i,la-1,l)!=0){
							la--;
						}
						to[i][k][l][j]=la;
			//			printf("%d %d %d %d: %d\n",i,k,l,j,(int)to[i][k][l][j]);
					}
				}
				continue;
			}
			for(int k=a-1;k>=0;k--){
				int bes=i;
				for(int l=i;l<b;l++){
					to[i][k][l][j]=to[i][to[i][k][l][j-1]][l][j-1];
					int las=-mod;
					for(int m=bes;m<l;m++){
						short cur=min(to[i][k][m][j-1],to[m+1][k][l][j-1]);
						if(las<=cur){
							las=cur;
							bes=m;
							to[i][k][l][j]=max(to[i][k][l][j],cur);
						}else break;
					}
			//		printf("%d %d %d %d: %d\n",i,k,l,j,(int)to[i][k][l][j]);
				}
			}

		}
	}
	for(int i=0;i<=16;i++){
		if(to[0][0][b-1][i]==a){
			ret=i;
			break;
		}
	}
	printf("%d\n",ret);
}

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


int main(){


    int k, x, t, i;

    vector<int> a;


    cin >> k >> x;


    a.push_back(x);


    for( i = 1 ; i < k ; i = i + 1 ){

         t = x + i;

         a.push_back(t);

         t = x - i;

         a.push_back(t);

         }


    sort( a.begin(), a.end() );


    for( i = 0 ; i < a.size() ; i = i + 1 ){

         cout << a.at(i);

         if( i == a.size() - 1 ) cout << endl;

         else cout << " ";

         }

    
    return 0;


    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

// (top,front)
int R[7][7]={
    {-1, -1, -1, -1, -1, -1, -1},
    {-1, -1,  3,  5,  2,  4, -1},
    {-1,  4, -1,  1,  6, -1,  3},
    {-1,  2,  6, -1, -1,  1,  5},
    {-1,  5,  1, -1, -1,  6,  2},
    {-1,  3, -1,  6,  1, -1,  4},
    {-1, -1,  4,  2,  5,  3, -1},
};

using vi = vector<int>;
using vvi = vector<vi>;
const vvi I(3,vi(3));

vvi T,F;
vvi t,f;
vector<int> ans;

void check(){
    vvi r(I);
    int rsum = 0;
    rep(i,3)rep(j,3){
        r[i][j] = R[T[j][0]][F[i][0]];
        if(r[i][j]==-1) return;
        rsum += r[i][j];
    }

    rep(fi,3)rep(fj,3){
        if(f[fi][fj]==0){
            for(int i=1; i<=6; ++i){
                if(R[t[0][fj]][i] == r[fi][0]){
                    f[fi][fj] = i;
                }
            }

            if(f[fi][fj]==0) return;
        }
    }

    rep(ti,3)rep(tj,3){
        if(t[ti][tj]==0){
            for(int i=1; i<=6; ++i){
                if(R[i][f[0][tj]] == r[0][ti]){
                    t[ti][tj] = i;
                }
            }

            if(t[ti][tj]==0) return;
        }
    }


    rep(ti,3)rep(fi,3)rep(x,3){
        int rv = r[fi][ti];
        if(R[t[ti][x]][f[fi][x]] != rv) return;
    }

    ans.pb(rsum);
}

void dfs(int d){
    if(d==8){
        t = T;
        f = F;
        check();
        return;
    }

    if(d<3){
        if(T[d][0]==0){
            for(int i=1; i<=6; ++i){
                T[d][0] = i;
                dfs(d+1);
                T[d][0] = 0;
            }
        }
        else dfs(d+1);
    }
    else if(d<6){
        if(F[d-3][0]==0){
            for(int i=1; i<=6; ++i){
                F[d-3][0] = i;
                dfs(d+1);
                F[d-3][0] = 0;
            }
        }
        else dfs(d+1);
    }
    else{
        if(T[0][d-5]==0){
            for(int i=1; i<=6; ++i){
                T[0][d-5] = i;
                dfs(d+1);
                T[0][d-5] = 0;
            }
        }
        else dfs(d+1);
    }
}

void solve(){
    T = I;
    F = I;
    rep(i,3)rep(j,3) cin >>T[i][j];
    rep(i,3)rep(j,3) cin >>F[i][j];

    ans.clear();
    dfs(0);

    sort(all(ans));
    ans.erase(unique(all(ans)), ans.end());
    int n = ans.size();
    if(n==0) cout << 0 << endl;
    else rep(i,n) cout << ans[i] << " \n"[i==n-1];
}

int main(){
    int n;
    cin >>n;
    rep(i,n) solve();
    return 0;
}



Measured memory_bytes: 3184
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include <climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const int MOD = 1e9 +7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;
    double ans=(double)0;
    rep(i,n){
        int a=i+1;
        double b=1;
        while(a<k){
            b *=0.5;
            a *=2;
        }
        ans +=b;
    }
    cout.precision(11);
    ans *= (double)1/(double)n;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if((n%10==7)||((n/10)%10==7)||((n/100)%10==7))
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>

using namespace std;
#define li long long int
#define FOR(i, a, b) for (int i = a ; i < b ; ++i)
#define REP(i, n) for (int i = 0 ; i < n ; ++i)

li gcd(li a,li b) {
    return a % b == 0 ? b : gcd(b, a % b);
}

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

    li fx = 0;
    li temp = N;
    
    while(temp > 0) {
        fx += temp % 10;
        temp /= 10;
    }
    cout << (N % fx == 0 ? "Yes" : "No") << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int X, N; cin >> X >> N;
  set<int> p;
  for (int i = 0; i < N; ++i) {
    int x; cin >> x; p.insert(x);
  }
  for (int d = 0;; ++d) {
    if (!p.count(X-d)) {
      cout << X-d << endl;
      return 0;
    }
    if (!p.count(X+d)) {
      cout << X+d << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 3640