akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}

#define MAXN ((int)3e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define LOG(x) if(DEBUG) cerr << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int n,m,k;
map <int, map<int,int>> mp;

int r[MAXN];
int c[MAXN];

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin >> n >> m >> k;

	for (int i = 0; i < k; ++i)
	{
		int a,b;
		cin >> a >> b;
		mp[a][b]++;

		r[a]++;
		c[b]++;
	}

	int rmax = 0;
	int cmax = 0;
	
	vector <int> ridx, cidx;

	for (int i = 0; i < MAXN; ++i)
	{
		if(rmax < r[i])
		{
			rmax = r[i];
			ridx.clear();
			ridx.pb(i);
		}
		else if(rmax == r[i])
		{
			ridx.pb(i);
		}

		if(cmax < c[i])
		{
			cmax = c[i];
			cidx.clear();
			cidx.pb(i);
		}
		else if(cmax == c[i])
		{
			cidx.pb(i);
		}
	}

	bool f = 1;

	for (int x : ridx)
	{
		for (int y : cidx)
			if(mp[x][y] == 0)
			{
				f = 0;
				break;
			}

		if(f == 0) break;
	}

	cout << rmax + cmax - (f) << endl;
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/

Measured memory_bytes: 50864
package main

import (
        "fmt"
        "sort"
)

func solution(s, t string) string {
        sb := make([]byte, len(s))
        tb := make([]byte, len(t))
        for i := range s {
                sb[i] = s[i]
        }
        for i := range t {
                tb[i] = t[i]
        }

        sort.SliceStable(sb, func(i, j int) bool { return sb[i] < sb[j] })
        sort.SliceStable(tb, func(i, j int) bool { return tb[i] > tb[j] })

        if string(sb) < string(tb) {
                return "Yes"
        }
        return "No"
}

func main() {
        var s, t string
        fmt.Scan(&s, &t)
        fmt.Println(solution(s, t))
}

Measured memory_bytes: 1840
import std.stdio;
import std.string;
import std.algorithm;
import std.conv;
import std.array;
import std.math;
import std.range;

void main()
{
    foreach(line; stdin.byLine)
    {
        auto s = line.chomp;
        if(s == "0") return;

        writeln(reduce!"a+b"(0, s.map!"a-'0'"));
    }
}

Measured memory_bytes: 1040
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long

#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 unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

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

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

const int mod = 1e9 + 7;

map<int, int> m;

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

	rep(i, N) {
		m[read()]++;
	}

	int ans = 0;

	for (auto p : m) {
		if (p.fst > p.scd) {
			ans += p.scd;
		} else if (p.fst < p.scd) {
			ans += p.scd - p.fst;
		}
	}

	cout << ans << endl;
}



Measured memory_bytes: 6272
c1 = list(map(int, input().split()))
c2 = list(map(int, input().split()))
c3 = list(map(int, input().split()))
s = [c1,c2,c3]

s1 = s[0][0] - s[0][1] - s[1][0] + s[1][1]
s2 = s[1][1] - s[1][2] - s[2][1] + s[2][2]
if  s1== 0 and s2==0:
    if s[0][0] + s[2][2] == s[0][2] + s[2][0]:
        print('Yes')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 3064
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 200005;
const int mod = 1000000007;

int a[maxn];
int p[maxn];
int c[2019];
int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  string s;
  cin>>s;
  int n = s.size();
  p[0]=1;
  for(int i=1;i<=n;i++)p[i]=p[i-1]*10%2019;
  for(int i=n-1;i>=0;i--){
    a[i] = (s[i]-'0') * p[n-i-1]%2019;
    if(i<n-1)a[i] = (a[i]+a[i+1])%2019;
    c[a[i]]++;
  }
  ll ret = c[0];
  for(int i=n-1;i>=1;i--){
    c[a[i]]--;
    ret+=c[a[i]];
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 5316
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = 2000000000;
// const ll MOD = 1000000007;

int H, W, D;
int Q;

int magic(int i, int j, int x, int y) { return abs(x - i) + abs(y - j); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> H >> W >> D;
  unordered_map<int, pair<int, int>> a_map;
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      int ai;
      cin >> ai;
      a_map[ai] = make_pair(i, j);
    }
  }
  cin >> Q;

  int dp[90001];
  fill(dp, dp + 90001, 0);
  for (int i = D + 1; i <= H * W; i++) {
    dp[i] = dp[i - D] + magic(a_map[i - D].first, a_map[i - D].second,
                              a_map[i].first, a_map[i].second);
  }

  while (Q--) {
    int L, R;
    cin >> L >> R;
    cout << dp[R] - dp[L] << endl;
  }

  return 0;
}


Measured memory_bytes: 5284
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	double PI = acos(-1);
	//cout << PI << endl;
	//printf("%.10f", PI);
	double rad = c*PI / 180;
	cout << fixed << setprecision(5);
	cout << a*b*sin(rad)/2 << endl << a + b + sqrt(a*a + b*b - 2 * a*b*cos(rad)) << endl << b*sin(rad) << endl;
	return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;

int ans[2010]={};

signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int s;
  cin>>s;
  
  ans[3]=1;
  repi(i,3,s+1){
    ans[i]=1;
    repi(j,3,i-2){
      ans[i]+=ans[j];
      ans[i]%=MOD;
    }
  }
  cout<<ans[s]<<endl;


  return 0;
}


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

int main() {
  string s;
  cin >> s;
  vector<char> nai(0);
  for(char a = 'a'; a <= 'z'; a++) {
    bool flag = true;
    for(int i = 0; i < s.size(); i++) {
      if(s[i] == a) flag = false;
    }
    if(flag) nai.push_back(a);
  }
  if(nai.size() == 0) cout << "None" << endl;
  else cout << nai[0] << endl;
}

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

typedef long long ll;

const int MOD = 1e9 + 7;

int main() {
    int N, K; cin >> N >> K;
    ll ans = 0;
    for (int i = K; i <= N+1; i++) {
        ll mini = (ll)i * (i - 1) / 2;
        ll maxi = (ll)(2 * N - i + 1) * i / 2;
        ans = ans + maxi - mini + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#include<algorithm>
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll k,x;
	cin>>k>>x;
	if(k*500>=x){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3616
sx, sy, tx, ty = [int(_) for _ in input().split()]
dx = tx-sx
dy = ty-sy
print('R'*dx+'U'*(dy+1)+'L'*(dx+1)+'D'*(dy+1)+'R' +
      'D'+'R'*(dx+1)+'U'*(dy+1)+'L'*(dx+1)+'D'*dy)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,Q,k;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);
      
    cin>>n>>s>>Q;
    rep(i,Q){
        cin>>k;
        d=0;m=0;cnt=0;ans=0;
        rep(i,n){
            if(s[i]=='D')d++;
            else if(s[i]=='M')cnt+=d,m++;
            else if(s[i]=='C')ans+=cnt;
            if(i>=k-1){
                if(s[i-k+1]=='D')cnt-=m,d--;
                else if(s[i-k+1]=='M')m--;
            }
        }
        Cout(ans);
    }
    return 0;
}


Measured memory_bytes: 1948
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cassert>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

ll rec(ll a, ll b) {
    if (a == b) return a;
    if (b % a == 0) return 2 * a * (b / a) - a;
    return 2 * a * (b / a) + rec(b % a, a);
}

int main() {
    ll N, X;
    cin >> N >> X;
    if (2 * X < N) {
        cout << 2 * X + N + rec(N - 2 * X, X) << "\n";
    } else if (2 * X == N) {
        cout << 3 * X << "\n";
    } else {
        cout << N + rec(X, N - X) << "\n";
    }
    return 0;
}


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

int main(void)
{
  char s[4];
  cin>>s;
  int dn=0;
  for(int i=0;i<4;i++){
    if(s[i]=='+')
      dn++;
    if(s[i]=='-')
      dn=dn-1;
  }
  cout<<dn<<endl;
}

Measured memory_bytes: 256
alist = [int(i) for i in input().split()]
blist = [int(i) for i in input().split()]
clist = [int(i) for i in input().split()]
n = int(input())
call_num = []
for i in range(n):
  call_num.append(int(input()))
lists = [alist,blist,clist]
dummy_list = [[0 for i in range(3)] for j in range(3)]
for i in call_num:
  for l,jlist in enumerate(lists):
    for m,k in enumerate(jlist):
      if k == i:
        dummy_list[l][m]=1
flag = 0
for i in range(3):
  if sum(dummy_list[i]) == 3:
    flag = 1
  if dummy_list[0][i]+dummy_list[1][i]+dummy_list[2][i]==3:
    flag = 1
if dummy_list[0][0]+dummy_list[1][1]+dummy_list[2][2] == 3:
  flag=1
if dummy_list[2][0]+dummy_list[1][1]+dummy_list[0][2] == 3:
  flag = 1
if flag==1:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
    int r,D,x;
    cin >> r >> D >> x;
    
    
    for(int i=0;i<10;i++){
        cout << r*x-D << endl;
        x = r*x-D;
    }
    return 0;
}



Measured memory_bytes: 384
s = input()
for i in range(2**3):
    l = []
    for j in range(3):
        if (i>>j)&1:
            l.append("+")
        else:
            l.append("-")
    if eval("{}{}{}{}{}{}{}".format(s[0],l[0],s[1],l[1],s[2],l[2],s[3])) == 7:
        print("{}{}{}{}{}{}{}=7".format(s[0],l[0],s[1],l[1],s[2],l[2],s[3]))
        break

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 1000000007LL
#define EPS 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 100005
string s;

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

    cin >> s;
    if(s == "hi" || s == "hihi" || s == "hihihi" || s == "hihihihi" || s == "hihihihihi"){
        cout << "Yes\n";
    } else{
        cout << "No\n";
    }

    return 0;
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

int main() {
  string s, t;
  cin >> s >> t;
  int a, b;
  cin >> a >> b;
  string u;
  cin >> u;
  if(u == s) cout << a-1 << " " << b << endl;
  else cout << a << " " << b-1 << endl;
}


Measured memory_bytes: 256
main :: IO ()
main = do
    [a, b, k] <- fmap (map read . words) getLine :: IO [Int]
    print $ solve a b k

solve :: Int -> Int -> Int -> Int
solve a b k = let g = gcd a b in kthdiv k g g

kthdiv :: Int -> Int -> Int -> Int
kthdiv k g cur = if g `mod` cur == 0
    then case k of
        1  -> cur
        k' -> kthdiv (k' - 1) g (cur - 1)
    else kthdiv k g (cur - 1)


Measured memory_bytes: 508
#include<stdio.h>
#include<ctype.h>

typedef struct
{
    char alphabet;
    int num;
} numAl;

int main()
{
    numAl nA[26];
    char c;
    int i, j;
    for(i=0, c='a';c<='z';i++, c++)
    {
        nA[i].alphabet = c;
        nA[i].num = 0;
    }

    char buffer[1200];
    while(fgets(buffer, 1200, stdin)!=0)
    {
        for(i=0;'\n'!=buffer[i];i++)
    {
        for(j=0;j<26;j++)
        {
            if(tolower(buffer[i])==nA[j].alphabet)
            {
                nA[j].num++;
                break;
            }
        }
    }
    }
    
    for(i=0;i<26;i++)
    {
        printf("%c : %d\n", nA[i].alphabet, nA[i].num);
    }
    
    return(0);
}


Measured memory_bytes: 2060
N, K = map(int, input().split())
ans = 0
MOD = 10 ** 9 + 7
for k in range(K, N + 2):
    mini = k * (k - 1) // 2
    maxi = k * (2 * N - k + 1) // 2
    add = maxi - mini + 1
    ans = (ans + add) % MOD
print(ans)

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

int main(){
  string S;
  cin >> S;
  int min=753;
  for(int i=0; i<S.size()-2; i++){
    int tmp = (S[i]-'0')*100+(S[i+1]-'0')*10+(S[i+2]-'0');
    if(min>abs(tmp-753)) min = abs(tmp-753);
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
N, M =map(int, input().split())


if N == 1:
  print(1)
  sys.exit()

a =[1]*N
mod = 1000000007
for i in range(M):
  a[int(input())-1]=0

  
dp = [0]*N

dp[0] = a[0]*1
dp[1] = (dp[0] + 1)*a[1]

for i in range(2,N):
  dp[i] = (dp[i-1]+dp[i-2]) *a[i]
  
print(dp[-1]%mod)
  

Measured memory_bytes: 463476
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 200010;
const int MAXK = 110;
const int MAXQ = 200010;

int n, q, f[MAXN];
vector<int> a[MAXN];

void dfs(int u, int p, int now) {
    f[u] += now;
    FOR(i,0,SZ(a[u])-1) {
        int v = a[u][i];
        if (v == p) continue;
        dfs(v, u, f[u]);
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> q;
    FOR(i,1,n-1) {
        int u, v;
        cin >> u >> v;
        a[u].emplace_back(v);
        a[v].emplace_back(u);
    }
    FOR(i,1,q) {
        int u, v;
        cin >> u >> v;
        f[u] += v;
    }
    dfs(1, 0, 0);
    FOR(i,1,n) cout << f[i] << ' ';
    return 0;
}


Measured memory_bytes: 29696
while(<>){
	chomp;
	next if($. == 1);
	push(@x,$_);
}

$cnt = 0;
for $i (0 .. $#x - 1){
	@a = split(/ /, $x[$i]);
	for $n ($i + 1 .. $#x){
		@b = split(/ /, $x[$n]);
		$c = 0;
		for $d (0 .. $#a){
			$c += abs($a[$d] - $b[$d]) ** 2;
		}
		$cnt++ if(sqrt($c) =~ /^\d+$/);
	}
}

print "$cnt\n";

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

using namespace std;

const int MAX = 5 ;

int main()
{
    map< pair<int , int> , int>mp ;
    for(int i = 0 ; i < 3 ; ++i)
    {
        int a , b ;
        cin>>a>>b ;
        mp[{a , b}] = 1 ;
        mp[{b , a}] = 1 ;
    }
    vector<int>v = {1 , 2 , 3 , 4} ;
    do
    {
        int cnt = 1 ;
        for(int i = 1 ; i < v.size() ; ++i)
        {
            if(mp[{v[i-1] , v[i]}] != 1)
                break;
            cnt++;
        }
        if(cnt == 4)
            return cout<<"YES\n" , 0 ;
    }
    while(next_permutation(v.begin() , v.end()));
    return cout<<"NO\n" , 0 ;
}


Measured memory_bytes: 256
import sys

n = int(input())

for a in range(1,3501):
  for b in range(1,3501):
    if((4*a*b - n*b - n*a) > 0):
      c = (n*a*b) / (4*a*b - n*b - n*a)
      if(c.is_integer()):
        print('%d %d %d' % (a, b, c))
        sys.exit()

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

	cin >>n>> s;
	for(int i=0;i<s.length();i++){
		s[i]+=n;
		if (s[i]>'Z') s[i]-=26;
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

unsigned long long pow10(int n) {
    unsigned long long x;
    for (x = 1; n--;) {
        x *= 10;
    }
    return x;
}

int is_prime(unsigned long long x) {
    unsigned long long i, l;
    for (i = 3, l = sqrt(x) + 1; i < l; i += 2) {
        if (x % i == 0) return 0;
    }
    return 1;
}

long long find_number(int n, int c) {
    unsigned long long i, l, x, d;
    if (c < 0) {
        if (n == 1) {
            return 11;
        }
        else {
            return pow10(n * 2) - 1;
        }
    }

    for (i = pow10(2 * n + 1) - 1, l = pow10(2 * n);
         i > l; i -= 2) {
        for (x = i, d = pow10(2 * n);
             d > 1; x = (x%d)/10, d /= 100) {
            if (x / d != x % 10) break;
        }
        if (d == 1 && x == c && is_prime(i)) {
            return i;
        }
    }
    return pow10(n * 2 + 1) - 1;
}


int main(void) {
    int n, c, i;
    while (scanf("%d%d", &n, &c) == 2 && n) {
        if (n < 10) {
            printf("%llu\n", find_number(n, c));
        }
        else {
            printf("%llu%llu\n", find_number(n / 2, c), find_number(n / 2, c));
        }
    }
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <string>
using namespace std;
int main(){
	char str[110000];
	cin>>str;
	int num[26] = {0};
	int length=0;
	int a = 0;
	while (str[a] != '\0') {
		length++;
		a++;
	}
	bool flag = false;
	for (int i = 0;i <length ;i++) 
		num[str[i] - 'a']++;
	for (int k = 0;k < 26;k++) {
		if (num[k] == 0) {
			cout << (char)(k + 'a');
			flag = true;
			break;
		}
	}
	if (!flag) cout << "None";

}

Measured memory_bytes: 3648
#include<stdio.h>
int main()
{
	int N,M;
	int L[100000],R[100000];
	int Rmin,Lmax;
	scanf("%d%d",&N,&M);
	for(int i=0;i<M;i++)
		scanf("%d%d",&L[i],&R[i]);
		Lmax=L[0],Rmin=R[0];
	for(int i=0;i<M-1;i++)
	{
		if(L[i+1]>Lmax)
		{
			Lmax=L[i+1];
		}
		
		if(R[i+1]<Rmin)
		{
			Rmin=R[i+1];
		}
		
	}
	
	printf("%d",(Rmin-Lmax+1 > 0) ?Rmin-Lmax+1:0);
	
	return 0;
}

Measured memory_bytes: 896
/**
 * @Author: yujirotakahashi
 * @Date:   2020-05-17T20:22:10+09:00
 * @Last modified by:   yujirotakahashi
 * @Last modified time: 2020-05-31T22:01:48+09:00
 */

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

/*******  All Required define Pre-Processors and typedef Constants *******/
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define Dcout(a) cout << setprecision(20) << a << endl
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
//const ll INF = (1LL << 60);
//const double pi=acos(-1.0);
using ll = long long;
using PAIR = pair<int, int>;
#define debug cout << "line : " << __LINE__ << " debug" << endl
/****** Template of some basic operations *****/
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/**************************************/

/******** User-defined Function *******/


/**************************************/

/********** Main()  function **********/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n; cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  ll sum = 1;
  ll sum2 = 1000000000000000000;
  rep(i,n){
      if(a[i]==0){
          cout << 0 << endl;
          return 0;
      }
  }
  rep(i,n){

       sum *= a[i];
       sum2 /= a[i];
       if(sum2==0){
           cout << -1 << endl;
           return 0;
       }
       if(sum>1000000000000000000){
           cout << "-1" << endl;
           return 0;
       }
   }

   cout << sum << endl;

  return 0;
}
/********  Main() Ends Here *************/


Measured memory_bytes: 3924
#include <bits/stdc++.h>
#include <vector>
#include <math.h>

using namespace std;


int main(){

 int n; cin>>n;
 vector<int>v(n);

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

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

 long long ans=INT_MAX;

 for(int i = v[0];i<=v[n-1];i++){
    long long tmp = 0;
    for(int j=0;j<n;j++){
        tmp += (i-v[j]) * (i-v[j]);
    }

     ans=min(ans,tmp);
}

  cout<<ans<<endl;


return 0;
}









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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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; }

typedef tuple<int,int,int> tpl;

int main(void){
    int H,W; cin >> H >> W;
    char A[H][W]; REP(i,H)REP(j,W) cin >> A[i][j];

    int d[H][W];
    priority_queue<tpl,vector<tpl>,greater<tpl>> q;
    REP(i,H)REP(j,W){
        if(A[i][j] == '#') q.push(tpl(0,i,j));
        d[i][j] = INT_INF;
    }
    
    while(q.size()){
        tpl t = q.top(); q.pop();
        int cost=get<0>(t), x=get<1>(t), y=get<2>(t);
        if(chmin(d[x][y], cost)){
            if(x) q.push(tpl(cost+1,x-1,y));
            if(x<H-1) q.push(tpl(cost+1,x+1,y));
            if(y) q.push(tpl(cost+1,x,y-1));
            if(y<W-1) q.push(tpl(cost+1,x,y+1));
        }
    }

    int ans = 0;
    REP(i,H)REP(j,W) chmax(ans, d[i][j]);
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 56164
#include <bits/stdc++.h>
using namespace std;
 
int main(void)
{
  int a[3];
  for(int i = 0; i < 3; i++)
  	cin >> a[i];
  cout << a[2] << ' ' << a[0] << ' ' << a[1] << '\n';
  
  return 0;
}

Measured memory_bytes: 256
K, A, B = list(map(int, input().split()))

if (A + 2 >= B):
    print(K + 1)
elif (A >= K):
    print(K + 1)
else:
    rest = K - (A - 1)
    if (rest%2 == 0):
        print((B - A) * int(rest / 2) + A)
    else:
        print((B - A) * int(rest / 2) + A + 1)


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

int main(){
  int L,N,x,y;
  cin>>N>>L;
  string ans;
  x=0;
  vector<string>a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  ans="";
 sort(a.begin(),a.end());
    for(int i=0;i<N;i++){
      ans+=a[i];
  }
        cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    char c[3][4]={0};

    for (int i=0;i<3;i++){
	scanf("%s",c[i]);
    }

    for (int i=0;i<3;i++){
	printf("%c",c[i][i]);
    }

    printf("\n");

    return 0;
}

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

int main()
{
    int n, k;
    cin >> n >> k;
    long long ans = 0;
    for(int i=0; i<k; i++){
        if((i*2)%k != 0) continue;
        long long c = n/k;
        if(i!= 0 && n%k >= i) c++;
        long long t = c*c*c;
        ans += t;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
 
int main() {
  double teihenn, takasa, mizu,rad,kuuki,arc,kodo;
    cin >> teihenn >> takasa >> mizu;
  if(teihenn*teihenn*takasa <= (double)2*mizu){
  kuuki=teihenn*teihenn*takasa-mizu;
    arc=kuuki*(double)2/teihenn/teihenn;
    kodo = atan2(arc , teihenn);
    kodo=kodo*(double)180/3.1415926535897932384;
  }
 else{
    arc=mizu*(double)2/teihenn/takasa;
    kodo=atan2(arc,takasa);
   kodo=90-kodo*(double)180/3.1415926535897932384;
  }
    
 cout << fixed << setprecision(10);
    cout<<kodo;
 
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int main(){
    int N;
    cin >> N;
    if(N < 4){
        cout << "No" << endl;
        return 0;
    }
    int n7 = N / 7;
    int n4 = N / 4;
    for(int i = 0 ;i <= n7 ;i++){
        for(int j = 0; j <= n4;j++){
            if((i * 7 + j * 4)  == N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(void){
    int N,M;
    cin >> N >> M;
    int tempInt;
    string tempStr;
    int ACcount=0;
    int WAcount=0;
    int WAtemp[N];
    map<int,string> ISmap;
    for(int i=0;i<M;i++){
        cin >> tempInt;
        cin >> tempStr;
        if(tempStr=="AC"){
            if(ISmap[tempInt]=="WA"){
                ISmap[tempInt]="AC";
                WAcount+=WAtemp[tempInt];
                ACcount++;
            }else if(ISmap[tempInt]=="AC"){
                //NULL
            }else{
                ISmap[tempInt]="AC";
                ACcount++;
            }
        }else{
            if(ISmap[tempInt]=="WA"){
                WAtemp[tempInt]++;
            }else if(ISmap[tempInt]=="AC"){
                
            }else{
                ISmap[tempInt]="WA";
                WAtemp[tempInt]=1;
            }
        }
        
    }
    
    cout << ACcount << " " << WAcount << endl;
    
    
    return 0;
}

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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int n;
	cin >> n;
	int a = sqrt(n);
	cout << a * a << "\n";
}

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


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

using namespace std;

int n, z, w;
vector<int> A;
const int INF = 2e9;
vector<array<vector<int>, 2>> DP;

int dfs(int i, int x, int y, int p){
    if (DP[i][p][p ? x : y] != -1)
        return DP[i][p][p ? x : y];
    if (i == n) {
        return abs((x == 0 ? z : A[x - 1]) - (y == 0 ? w : A[y - 1]));
    }

    int res = (p == 0) ? -INF : INF;
    if (p == 0){
        res = max(res, dfs(i + 1, i + 1, y, 1 - p));
        res = max(res, dfs(i + 1, i + 1, y, p));
    } else {
        res = min(res, dfs(i + 1, x, i + 1, 1 - p));
        res = min(res, dfs(i + 1, x, i + 1, p));
    }

    return DP[i][p][p ? x : y] = res;
}

int main(){
    cin >> n >> z >> w;
    A.resize(n);
    copy_n(istream_iterator<int>(cin), n, A.begin());
    DP.resize(n + 1);
    for (int i = 0; i <= n; i++){
        DP[i][0].assign(n + 1, -1);
        DP[i][1].assign(n + 1, -1);
    }

    cout << dfs(0, 0, 0, 0) << endl;
}


Measured memory_bytes: 31872
using System;
					
public class Program
{
	public static void Main()
	{
		var input = Console.ReadLine();
		var split1 = input.Split(' ');
		var width = double.Parse(split1[0]);
		var height = double.Parse(split1[1]);
		var targetX = double.Parse(split1[2]);
		var targetY = double.Parse(split1[3]);
		
		Console.WriteLine(((width*height) / 2).ToString("F6") + " " + ((targetX *2 ==width && targetY *2 == height) ? 1 : 0));
	
	}
}

Measured memory_bytes: 11220
import math

q = int(input())
lis = [list(map(int, input().split())) for _ in range(q)]
for i in range(q):
	product = lis[i][0]*lis[i][1]
	rootInt = int(math.sqrt(product))
	if lis[i][0] == lis[i][1]:
		print((lis[i][0]-1)*2)
	elif math.sqrt(product) == rootInt:
		print((rootInt-2)*2+1)
	else:
		if rootInt*(rootInt+1) < product:
			print((rootInt-1)*2+1)
		else:
			print((rootInt-1)*2)

Measured memory_bytes: 3064
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		for(int i=1; i<10; i++){
			for(int j=1; j<10; j++){
				System.out.println(i+"x"+j+"="+i*j);
			}
		}

	}

}

Measured memory_bytes: 16852
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n; ll k;
vector<ll>arr;
bool check(ll var)
{
	ll cnt=0;
	for(int i=0; i<n; i++){
		if(arr[i]<=var)
		 continue;
		cnt+=(ceil(arr[i]/double(var))-1);
	}
	if(cnt<=k)
	 return true;
	return false;
}
int main()
{
	cin>>n>>k;
	arr.resize(n);
	for(int i=0; i<n; i++)
	 cin>>arr[i];
	ll s=1,e=1e9;
	ll ans=e;
	while(s<=e)
	{
		ll mid=(s+e)/2;
		if(check(mid)){
			ans=mid;
			e=mid-1;
		}
		else
		 s=mid+1;
	}
	cout<<ans;
	return 0;
	
	
}

Measured memory_bytes: 4760
N = int(input())
S = input()

tobi = lambda x: 1 if x=='E' else 0
S = list(map(tobi, list(S)))

ans = [sum(S[1:])]
for i in range(1, N):
    check1, check2 = 0, 0
    if S[i] == 1:
        check1 = 1
    if S[i-1] == 0:
        check2 = 1
    ans.append(ans[-1] - check1 + check2)
print(min(ans))

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

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

  ll ans = (1ULL << 63) - 1;
  for (int i = -100; i <= 100; i++) {
    ll sum = 0;
    for (int j = 0; j < n; j++) {
      sum += (a[j] - i) * (a[j] - i);
    }
    ans = min(ans, sum);
  }

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


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

using namespace std;

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

  for (long long i = 1; i <= 3500; i++) {
    for (long long j = 1; j <= 3500; j++) {
      // k/l
      long long k = 4 * i * j - n * j - n * i;
      long long l = i * j * n;      
      if (k > 0 && l % k == 0) {
        cout << i << ' ' << j << ' ' << l / k << endl;
        return 0;
      }
    }
  }
  cout << endl;
}


Measured memory_bytes: 256
import sys
import os
N = int(input())
A = list(map(int,input().split()))

colors = [0]*8
higher = 0
for a in A:
    if a <=399:
        colors[0] =1
    elif a<= 799:
        colors[1] =1
    elif a<= 1199:
        colors[2] =1
    elif a<= 1599:
        colors[3] =1
    elif a<= 1999:
        colors[4] =1
    elif a<= 2399:
        colors[5] =1
    elif a<= 2799:
        colors[6] =1
    elif a<= 3199:
        colors[7] =1
    else:
        higher +=1
print(max(1,sum(colors)),sum(colors)+higher)


Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
  int n;
  scanf("%d", &n);
  int arr[n+1];
  for(int i=0; i<n; i++) scanf("%d", &arr[i]);
  arr[n] = 1000000007;
  int tmp = 0, ans = 0;
  for(int i=0; i<n; i++){
    if(arr[i] >= arr[i+1]) tmp++;
    else{
      ans = (tmp>ans)? tmp:ans;
      tmp = 0;
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 512
from itertools import permutations as perm

n, m, r = map(int, input().split())
r = list(map(lambda x: int(x) - 1, input().split()))
d = [[10 ** 10] * n for _ in range(n)]
for i in range(m):
    abc = tuple(map(int, input().split()))
    a = abc[0] - 1
    b = abc[1] - 1
    c = abc[2]
    d[a][b] = c
    d[b][a] = c
for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])
            d[j][i] = d[i][j]

ans = 10 ** 10
for arr in perm(r):
    rep = 0
    for i in range(len(arr) - 1):
        rep += d[arr[i]][arr[i + 1]]
    ans = min(ans, rep)
print(ans)


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

using namespace std;

using ll = long long;
const ll INF = 1LL << 60;

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

int main(void) {
    int n;
    cin >> n;
    vector<ll> h(n);
    vector<ll> cost(n, INF);
    for (auto &_h : h) {
        cin >> _h;
    }

    cost[0] = 0;
    for (int i = 1; i < n; ++i) {
        chmin(cost[i], cost[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) chmin(cost[i], cost[i - 2] + abs(h[i] - h[i - 2]));
    }

    cout << cost[n - 1] << endl;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

#define MAX_BIN 17
unsigned long long int crop(unsigned long long int num, int a){
    unsigned long long int downmask=(1<<a)-1;
    unsigned long long int upmask=((1<<MAX_BIN)-1)^((1<<(a+1))-1);
    unsigned long long int ans=(num&downmask)+((num&upmask)>>1);
    return ans;
}
unsigned long long int insert(unsigned long long int num, int bit,int a){
    unsigned long long int downmask=(1<<a)-1;
    unsigned long long int upmask=((1<<MAX_BIN)-1)^((1<<a)-1);
    unsigned long long int ans=(num&downmask)+((num&upmask)<<1)+(bit<<a);
    return ans;
}

vector<unsigned long long int> GrayCodeGenerator(unsigned long long int a,unsigned long long int b,int binary_digit){
    //printf("###hoge [%ld:%ld]\n",a.to_ulong(),b.to_ulong());
    if(binary_digit==1){
        vector<unsigned long long int> ans;
        ans.push_back(a);
        ans.push_back(b);
        return ans;
    }
    int dig;
    for(int i=binary_digit-1;i>=0;i--){
        if((a&(1<<i))!=(b&(1<<i)))dig=i;
    }
    //printf("%d\n",dig);
    unsigned long long int adash=crop(a,dig);
    unsigned long long int bdash=crop(b,dig);
    //printf("%lld %lld\n",a.to_ullong(),adash.to_ullong());
    unsigned long long int c=adash;
    c=c^(1<<(binary_digit-2));
    vector<unsigned long long int> p=GrayCodeGenerator(adash,c,binary_digit-1);
    vector<unsigned long long int> q=GrayCodeGenerator(c,bdash,binary_digit-1);
    REP(i,p.size())p[i]=insert(p[i],(a&(1<<dig))>>dig,dig);
    REP(i,q.size())q[i]=insert(q[i],(b&(1<<dig))>>dig,dig);
    std::copy(q.begin(),q.end(),std::back_inserter(p));
    return p;
}

int main()
{
    int n,a,b;
    scanf("%d %d %d",&n,&a,&b);
    std::bitset<17> dif(a^b);
    if(dif.count()%2==0){
        printf("NO\n");
        return 0;
    }
    printf("YES\n");
    vector<unsigned long long int> ans=GrayCodeGenerator(a,b,n);
    for(unsigned long long int i : ans){
        printf("%lld\n",i);
    }
    return 0;
}

Measured memory_bytes: 2288
#include<bits/stdc++.h>
using namespace std;
int main() {
  double A, B, H, M; cin >> A >> B >> H >> M;
  double m = (M / 60), h = ((H + m) / 12);
  double x = max(h - m, m - h);
  cout << fixed << setprecision(16);
  cout << sqrt(A * A + B * B - 2 * A * B * cos(x * 2 * M_PI)) << endl;
}

Measured memory_bytes: 4256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <math.h>
#define rep(i, start, end) for (int i = start; i < end; ++i)
using namespace std;
typedef long long ll;

int n, k, q;
int b[100010];

int main() {
   cin >> n >> k >> q;
   rep(i, 0, q) {
      int a;
      cin >> a;
      b[a - 1] += 1;
   }

   rep(i, 0, n) {
      if (b[i] + k - q > 0) {
         cout << "Yes" << endl;
      } else {
         cout << "No" << endl;
      }
   }

   return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
	int W[10], K[10];
	for (int i = 0; i < 10; i++) {
		cin >> W[i];
	}
	for (int i = 0; i < 10; i++) {
		cin >> K[i];
	}
	sort(W, W + 10, greater<int>());
	sort(K, K + 10, greater<int>());
	int tW = 0, tK = 0;
	for (int i = 0; i < 3; i++) tW += W[i];
	for (int i = 0; i < 3; i++) tK += K[i];
	cout << tW << ' ' << tK << endl;
	return 0;
}

Measured memory_bytes: 1176
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			int sl = s.length();
			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < sl; i++) {
				sb.append("x");
			}
			System.out.print(sb.toString());
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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


int main(){
    ll N,M,X;
    cin>>N>>M>>X;
    v C(N);
    vv A(N,v(M));
    rep(i,0,N){
        cin>>C[i];
        rep(j,0,M)cin>>A[i][j];
    }
    ll min_ans = INF;
    rep(i,0,10000){
        v sum(M);
        ll money = 0;
        ll n = i;
        rep(j,0,N){
            if(n%2 == 1){
                money += C[j];
                rep(k,0,M){
                    sum[k] += A[j][k];
                }
            }
            n/=2;
        }
        bool ok = true;
        rep(j,0,M){
            if(sum[j] < X)ok = false;
        }
        if(ok)min_ans = min(min_ans,money);
    }
    if(min_ans ==INF){
        cout<<-1;
    }
    else{
        cout<<min_ans;
    }
    return 0;
}

Measured memory_bytes: 3612
int main(){
	int number[6],i,temp;
	char order[100];

	for(i = 0; i < 6; i++){
		scanf("%d",&number[i]);	/*?????¢?????°???*/
	}
	scanf("%s",order);
	for(i = 0; order[i] != '\0'; i++){	/*??????*/
		if(order[i] == 'N'){		/*?????¢?????????????????°???????????????*/
			temp = number[0];
			number[0] = number[1];
			number[1] = number[5];
			number[5] = number[4];
			number[4] = temp;
		}
		if(order[i] == 'S'){
			temp = number[0];
			number[0] = number[4];
			number[4] = number[5];
			number[5] = number[1];
			number[1] = temp;
		}
		if(order[i] == 'E'){
			temp = number[0];
			number[0] = number[3];
			number[3] = number[5];
			number[5] = number[2];
			number[2] = temp;
		}
		if(order[i] == 'W'){
			temp = number[0];
			number[0] = number[2];
			number[2] = number[5];
			number[5] = number[3];
			number[3] = temp;
		}
	}
	printf("%d\n",number[0]);

	return 0;
}

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

H, W = [int(x) for x in input().split()]
S = H * W
res1 = 10 ** 10
res2 = 10 ** 10

# ヨコ向きに一枚切る
for i in range(1, H):
    S1 = i * W
    x = W
    y = H - i

    # ヨコに半分
    S2 = (y // 2) * x
    S3 = S - S1 - S2
    res1 = min(res1, max(S1, S2, S3) - min(S1, S2, S3))

    # タテに半分
    S2 = y * (x // 2)
    S3 = S - S1 - S2
    res1 = min(res1, max(S1, S2, S3) - min(S1, S2, S3))

# タテ向きに一枚切る
for j in range(1, W):
    S1 = H * j
    x = W - j
    y = H

    # ヨコに半分
    S2 = (y // 2) * x
    S3 = S - S1 - S2
    res2 = min(res2, max(S1, S2, S3) - min(S1, S2, S3))

    # タテに半分
    S2 = y * (x // 2)
    S3 = S - S1 - S2
    res2 = min(res2, max(S1, S2, S3) - min(S1, S2, S3))

print(min(res1, res2))



Measured memory_bytes: 43228
from collections import deque


def main():
    n = int(input())
    tree = AdjacentListGraph([Vertex() for _ in range(n)])
    for _ in range(n - 1):
        a, b, c = map(int, input().split())
        tree.add_edge(a - 1, b - 1, c)
        tree.add_edge(b - 1, a - 1, c)
    q, k = map(int, input().split())
    distances = distances_from(tree, k - 1)
    # print(distances)
    answers = []
    for _ in range(q):
        x, y = map(int, input().split())
        answers.append(distances[x - 1] + distances[y - 1])
    print("\n".join(map(str, answers)))


def distances_from(
    graph: "Graph", from_: int, break_if=lambda node: False
) -> "List[int]":
    distances = [None for _ in range(graph.size)]
    distances[from_] = 0
    queue = deque([from_])
    while queue:
        node = queue.popleft()
        if break_if(node):
            break
        curDist = distances[node]
        for edge in graph.edges_from(node):
            if distances[edge.to] is not None:
                continue
            delta = edge.weight if edge.weight else 0
            distances[edge.to] = curDist + delta
            queue.append(edge.to)
    return distances


class Vertex:
    __slots__ = ("data", "edges")

    def __init__(self, data=None):
        self.data = data
        self.edges = []

    def add_edge(self, to, weight=None):
        self.edges.append(Edge(to, weight))

    def remove_edge(self, to: int) -> bool:
        for i, edge in enumerate(self.edges):
            if edge.to == to:
                del self.edges[i]
                return True
        return False


class Edge:
    __slots__ = ("to", "weight")

    def __init__(self, to, weight=None):
        self.to = to
        self.weight = weight


class AdjacentListGraph:
    def __init__(self, vertices):
        self.vertices = vertices
        self.size = len(vertices)

    def get_weight(self, from_: int, to: int):
        for edge in self.vertices[from_].edges:
            if edge.to == to:
                return edge.weight
        return None

    def edges_from(self, from_: int):
        return self.vertices[from_].edges

    def add_edge(self, from_: int, to: int, weight=None) -> bool:
        return self.vertices[from_].add_edge(to, weight)

    def remove_edge(self, from_: int, to: int) -> bool:
        return self.vertices[from_].remove_edge(to)

    def is_adjacent(self, from_: int, to: int) -> bool:
        return to in {edge.to for edge in self.edges_from(from_)}


if __name__ == "__main__":
    main()


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

int main(){
  int n;
  cin>>n;
  if(n<105)cout<<0;
  else if(n<135)cout<<1;
  else if(n<165)cout<<2;
  else if(n<189)cout<<3;
  else if(n<195)cout<<4;
  else cout<<5;
}

Measured memory_bytes: 256
n=int(input())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

arr2=[]
arr2=factorization(n)

def cnt(nn):
    if nn<3:
        return 1
    elif nn<6:
        return 2
    elif nn<10:
        return 3
    elif nn<15:
        return 4
    elif nn<21:
        return 5
    elif nn<28:
        return 6
    elif nn<36:
        return 7
    elif nn<45:
        return 8
    elif nn<55:
        return 9
    else:
        return 10
icnt=0
for i in range(len(arr2)):
    icnt=icnt+cnt(arr2[i][1])

if n==1:
    print(0)
else:
    print(icnt)


Measured memory_bytes: 9524
#include <cstdio>

int main()
{
	register int a, b;
	register int sum, mul, dif, tmp, out;
	scanf("%d%d", &a, &b);	
	sum = a + b;
	mul = a * b;
	dif = a - b;
	tmp = (sum > mul) ? sum : mul;
	out = (tmp > dif) ? tmp : dif;  	
	printf("%d", out);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<stdio.h>


using namespace std;
int main(void)
{
	int h, w;
	cin >> h >> w;
	vector<vector<char> > v(h+1, vector<char>(w+1));
	int i, j,num;
	vector<int> n(h, 0);
	vector<int> m(w, 0);
	for (i = 0; i < h; i++)
	{
		for (j =0 ; j < w; j++)
		{
			cin >> v[i][j];
		}
	}
	for (i = 0; i < h; i++)
	{
		 num = 0;
		for (j = 0; j < w; j++)
		{
			if (v[i][j] == '.')
			{
				num++;
			}
			if (num == w)
			{
				n[i] = 1;
			}
		}
	}

	for (j = 0; j < w; j++)
	{
	    num = 0;
		for (i = 0; i < h; i++)
		{
			if (v[i][j] == '.')
			{
				num++;
			}
			if (num == h)
			{
				m[j] = 1;
			}
		}
	}

	for (i = 0; i < h; i++)
	{
		for (j = 0; j < w; j++)
		{
			if (n[i] == 1)
			{
				while(n[i]==1)
				i++;
			}
			if (m[j])
			{
				while(m[j]==1)
				j++;
			}
			if (i == h || j == w)
			{
				continue;
			}
			cout << v[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n,s,a=100,c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        c+=s;
        if(s%10>0&&s<a){
            a=s;
        }
    }
    if(a==100){
        c=0;
    }else if(c%10==0){
        c-=a;
    }
    cout<<c<<endl;
}


Measured memory_bytes: 256