akhauriyash/Code-Regression huggingface dataset:
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<math.h>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
#include<unordered_map>
#include<list>
#include<fstream>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
const ll E=1e18+7;
#define F first
#define S second
#define MK make_pair
const ll MOD=1000000007;






int main(){
    ll n;
    cin>>n;
    vector<ll> l(n),r(n);
    for(int i=0;i<n;i++){
        cin>>l[i]>>r[i];
    }
    l.push_back(0);
    r.push_back(0);
    sort(r.begin(),r.end());
    sort(l.begin(),l.end(),greater<ll>());
    ll ans=0;
    for(int i=0;i<n;i++){
        ans=max(ans,ans+l[i]-r[i]);
        
    }
    cout<<ans*2<<endl;
    
    
    
    
    
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define F first
#define S second
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define sz size()
#define all(A)    A.begin(), A.end()
#define mem(a, b) memset(a, b, sizeof(a))   // all elements of A are b=0 or b=-1 else don't work
#define f0(i,b)   for(ll i=0;i<(b);i++)
#define f1(i,b)   for(ll i=1;i<=(b);i++)
#define f2(i,a,b) for(ll i=(a);i<=(b);i++)
#define f3(i,b,a) for(ll i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(ll i=(a);i!=(b);i+=(c))
#define mod 1000000007

#define whilee(i,t)  while(i!=t)
#define  sl(a)  scanf("%lld",&a)
#define  pl(a)  printf("%lld\n",a)

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;

//for(auto it =A.begin(); it!=A.end(); it++)
//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//count(A.begin(), A.end(), X); //counts the occurrences of X
//distance(A.begin(),A.end());  //distance between first to last element
//accumulate(A.begin(), A.end(), 0); //add
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());
//swap(S[0], T[0]);

//scanf("%lld",&x);
//printf("%lld\n",x);
//while (scanf("%lld %lld", &a, &b) == 2)
//printf("Case %lld: %lld\n", t++, a);

//vector <ll> A;
//deque <ll> A;
//queue <ll> A;
//stack <ll> A;
//list <int> A;
//set <ll> A;
//map <ll,ll> A;
//pair <ll,ll> A ;
//vector <pair <ll,ll>> A ;
//bitset<32> bset1;
//char ch;
//string S, T, U;
ll i, j, k, a, b, c, d, e, f, g, h, l, m, n, o, p, q, r, s, t=1, u, v, w, x, y, z, maxx=INT_MIN, minn=INT_MAX, ans=0, sum=0, cnt=0;

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

    //scan(n);
    cin>>n;
    cout<<3*n*n<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
int main()
{
	int n,k, x, y, sum;
	scanf("%d %d %d %d", &n, &k ,&x ,&y);
	
	if(n>k){
		sum=k*x+y*(n-k);
	} else {
		sum=n*x;
	}
	
	printf("%d", sum);
}

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

string shuffle(string str, int h){
    string head = str.substr(0,h);
    string tail = str.substr(h, str.size()-h);
    return tail + head;
}

int main(){
    string cards;
    int m, h;
    while(1){
        cin >> cards;
        if ( cards == "-" ) break;
        cin >> m;
        for(int i = 0; i < m; i++){
            cin >> h;
            cards = shuffle(cards, h);
        }
        cout << cards << endl;
    }
    return 0;
}


Measured memory_bytes: 3140
import java.io.*;

class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));// ??\????????????????????????
            String line = br.readLine();
            System.out.println(getFactorial(line));
            
   
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private static long getFactorial(String line) {
    	long x = Integer.parseInt(line);
    	long y = (long) Math.pow(x,3);
		return y;
	}  
}

Measured memory_bytes: 24160
K = gets.to_i

# if [0, 2, 4, 5, 6, 8].include?(K % 10)
#   puts -1
#   exit
# end
# -1条件がこれでいい根拠は無い（通したら通った）

n = 0
1_000_000.times.each do |i|
  n = n * 10 + 7
  if n % K == 0
    puts i + 1
    exit
  end
  n = n % K
end

puts -1


Measured memory_bytes: 14332
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")

template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 2e18;

vector<int>G[100010];

vector<P>edges;
int deg[100010];
int K = 0;
map<P, int>mp;
void dfs(int n, int col) {
	int c = 1;
	for (auto nxt : G[n]) {
		if (c == col)c++;
		mp[{n, nxt}] = c;
		dfs(nxt, c);
		c++;
	}
}
void solve() {
	int N; cin >> N;
	REP(i, N - 1) {
		int u, v; cin >> u >> v;
		u--, v--;
		edges.push_back({ u,v });
		G[u].push_back(v);
		deg[u]++;
		deg[v]++;
	}
	
	REP(i, N) {
		K = max(K, deg[i]);
	}
	dfs(0, 0);
	print(K);
	REP(i, N - 1) {
		int u = edges[i].first, v = edges[i].second;
		cout << mp[{u, v}] << endl;
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//test();
	solve();
}

Measured memory_bytes: 16884
import math as math

while 1:
    n = int(input())
    if n == 0:
        break

    s = list(map(float, input().split()))

    su = sum(s)
    m = su / n

    a = 0

    for i in range(n):
        a += ((s[i] - m) ** 2) / n

    print(math.sqrt(a))



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

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"("<<(x).FI<<", "<<(x).SE<<")"<<endl;
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

typedef long long ll;
typedef pair<ll, ll> P;

int hist[1100000];
int main()
{
  int s; cin >> s;
  int now = s;
  hist[now]++;
  for (int i = 2; i < 1100000; i++) {
    if (now % 2 == 1) {
      now = 3*now + 1;
    } else {
      now = now / 2;
    }
    hist[now]++;
    if (hist[now] >= 2) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <cctype>
#include <map>
#include <stdio.h>
#include <string.h>


#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using namespace std;

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

    int o[5];
    int d[5];
    int min = 20;
    int num = -1;
    int ans = 0;

    for(int i = 0; i < 5; i ++){
        cin >> o[i];
        d[i] = o[i]%10;
        if(d[i] != 0){
            if(d[i] < min){
                num = i;
                min = d[i];
            }
        }
    }

    for(int i = 0; i < 5; i ++){
        if(i == num) ans += o[i];
        else if(o[i]%10 == 0){
            ans += o[i];
        }else{
            ans += ((o[i]/10)+1)*10;
        }
    }
    cout << ans;

    return 0;
}









Measured memory_bytes: 3648
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    a = [int(i) for i in input().split()]

    for i in range(1,100):
        count = 0
        
        if a[1] ==1:
            print(0)
            break
            
        if i > 1:
            count = a[0] + (a[0]-1)*(i-1)
        else:
            count = a[0]

        if count >= a[1]:
            print(i)
            break



Measured memory_bytes: 3828
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力

		String str = sc.next();
		
		int forward = Integer.parseInt(str.substring(0,2));
		int back = Integer.parseInt(str.substring(2));
		//System.out.print(forward + " " + back);
		
		if(forward > 12 &&( back > 12 || back == 0)){
			System.out.print("NA");
		}else if(forward > 12){
			System.out.print("YYMM");
		}else if(forward == 0 && (back == 0 || back > 12)){
			System.out.print("NA");
		}else if(forward == 0){
			System.out.print("YYMM");
		}else if(back > 12){
			System.out.print("MMYY");
		}else if(back != 0){
			System.out.print("AMBIGUOUS");
		}else{
			System.out.print("MMYY");

		}
		
		
	}
	
	
	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	




static String deletestr(String base,String remove){
	boolean flag = true;
	for(int i = 0;i < remove.length();i++){
		if(i == base.length()){
			flag = false;
			break;
		}
		if(base.charAt(i) - remove.charAt(i) != 0 && base.charAt(i) - remove.charAt(i) != 32 &&remove.charAt(i) - base.charAt(i)  != 32){
			flag = false;
			break;
		}
	}

	if(flag){
		base = base.substring(remove.length());
	}

	return base;

}



}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}




Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(box) box.begin(), box.end()

using namespace std;

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

const long long INF = LLONG_MAX/3;

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

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[b]+=siz[a];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=998244353;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};
signed main(){
	string s;
	cin>>s;
	bool ok=true;
	rep(i,s.size()){
		if(i+1>=s.size()){
			ok=false;
			continue;
		}else
		{
			if(!(s[i]=='h'&&s[i+1]=='i'))ok=false;
		}
		i++;
	}
	if(ok)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int n, count = 0;
    scanf("%d", &n);
    int a[4] = {n/1000, n/100%10, n/10%10, n%10};
    for(int i = 0; i < 3; i++) if(a[i] == a[i+1]) count++;
    if(count > 0) printf("Bad\n");
    else printf("Good\n");
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
using namespace std;
int main(){
	int time,code;
	vector<int> line;
	long max;
	long doll=0;
	vector<int>::iterator he,he2;
	while(true){
		cin>>time;
		if(time!=0){
			line.clear();
		}else {
			break;
		}
		for(int i=0;i<time;++i){
			cin>>code;
			line.push_back(code);
		}
		max=line[0];
		for(he=line.begin();he!=line.end();++he){
			for(he2=he;he2!=line.end();++he2){
				doll+=*he2;
				if(doll>max){
					max=doll;
				}
			}
			doll=0;
		}
		cout<<max<<endl;
	}
	return 0;
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define gc getchar
#define pc putchar
#define cs const
#define st static

cs ll mod=998244353;

inline
void outint(int a){
	st char ch[13];
	if(a==0)pc('0');
	while(a)ch[++ch[0]]=(a-a/10*10)^48,a/=10;
	while(ch[0])pc(ch[ch[0]--]);
}

ll fac[4002],inv[4002],ifac[4002];

ll ans[4002];

inline
ll C(int n,int m){
	if(n<m)return 0;
	return fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}

inline
void init(){
	fac[0]=fac[1]=inv[1]=ifac[1]=ifac[0]=1;
	for(int re i=2;i<=4000;++i){
		inv[i]=(mod-mod/i)*inv[mod%i]%mod;
		fac[i]=fac[i-1]*i%mod;
		ifac[i]=ifac[i-1]*inv[i]%mod;
	}
}

inline
ll calc(ll a,ll k,ll n){
	ll ans=0;
	for(int re i=0;i<=min(a>>1,n>>1);++i){
		ll tmp=C(a>>1,i)*C(k+n-i*2-1,k-1)%mod;
		if(i&1)ans=(ans-tmp+mod)%mod;
		else ans=(ans+tmp)%mod;
	}
	return ans;
}

int n,k;

int main(){
	init();
	cin>>k>>n;
	for(int re i=1;i<=k;++i){
		if(i&1)ans[i]=(calc(i,k-1,n)+calc(i,k-1,n-1))%mod;
		else ans[i]=calc(i,k,n);
	}
	for(int re i=1;i<=k;++i)outint(ans[i]),pc('\n');
	for(int re i=k-1;i;--i)outint(ans[i]),pc('\n');
	return 0;
}

Measured memory_bytes: 384
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
// #include<deque>
// #include<multiset>
// #include<bitset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

// Nimは嘘解法

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  int a;
  for(int i = 0; i < n; i++) {
    cin >> a;
    if(a % 2 == 1) {
      cout << "first" << endl;
      return 0;
    }
  }
  cout << "second" << endl;
  return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

LL fact[100010];
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  LL N, M;
  cin >> N >> M;
  if(abs(N-M) > 1){
	cout << 0 << endl;
	return 0;
  }

  fact[0] = 1;
  for(int i=1;i+1<100010;++i)
	fact[i] = fact[i-1] * i % MOD;
  LL ans = fact[N] * fact[M] % MOD * (N == M? 2: 1) % MOD;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
char s[5][5]; 
int main(){
	for(int i=0;i<2;i++)
	    for(int j=0;j<3;j++)
	        cin>>s[i][j];
	if(s[0][0]==s[1][2]&&s[0][1]==s[1][1]&&s[0][2]==s[1][0]) cout<<"YES";
    else cout<<"NO";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int check = 0;
    for(int i = 0 ; i < 3 ; i++)
    {
        if(s.at(i)==s.at(i+1)){
            check=1;
            break;
        }
    }
    if(check){
        cout<<"Bad"<<endl;

    }
    else {
        cout<<"Good"<<endl;
    }
}


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

void solve(int N, int D, vector<int> X, vector<int> Y)
{
    int res = 0;
    for (int i = 0; i < N; i++)
    {
        int64_t x = X.at(i), y = Y.at(i);
        if (x * x + y * y <= (int64_t)D * D)
            res++;
    }
    cout << res << endl;
}

int main()
{
    int N;
    cin >> N;
    int D;
    cin >> D;
    vector<int> X(N);
    vector<int> Y(N);
    for (int i = 0; i < N; i++)
    {
        cin >> X.at(i);
        cin >> Y.at(i);
    }
    solve(N, D, move(X), move(Y));
    return 0;
}


Measured memory_bytes: 4784
mod = 10 ** 9 + 7
n,k = map(int,input().split())
lis = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    lis[a-1] += [b-1]
    lis[b-1] += [a-1]
li = [0] * n
l = [0]
li[0] = 1
ans = k
while l:
    ll = l.pop()
    for lll in lis[ll]:
        if li[lll] > 0:
            continue
        else:
            ans = (ans * max(k-li[ll],0))%mod
            li[ll] += 1
            li[lll] = 2
            l.append(lll)
print(ans%mod)

Measured memory_bytes: 23556
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    string S, T;
    cin >> S >> T;
    
    rep(i, S.size()) {
        string str = S;
        str += S[0];
        S = "";
        REP(i, str.size()) S += str[i];
        if (S == T) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <iostream>

static const int kExtremelyHighPrice = 2000 * 1000 * 1000 + 3;

int main()
{
    int input_size;
    int number;
    int current_min = kExtremelyHighPrice;
    int current_max_profit = -kExtremelyHighPrice;

    std::cin >> input_size;
    for(int i = 0; i < input_size; i++) {
        std::cin >> number;
        int profit = number - current_min;
        if(current_max_profit < profit) {
            current_max_profit = profit;
        }
        if(number < current_min) {
            current_min = number;
        }
    }

    printf("%d\n", current_max_profit);
    return 0;
}

Measured memory_bytes: 3224
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, K;
  cin>>N>>K;
  int tmp;
  vector<int> arr;
  map<int, int> amap;
  for(int i=0;i<N;++i) {
    cin>>tmp;
    if(amap[tmp]==0) arr.push_back(tmp);
    amap[tmp]++;
  }
  vector<int> arr1;
  for(int i=0;i<arr.size();++i) {
    arr1.push_back(amap[arr[i]]);
  }
  sort(arr1.begin(), arr1.end(), greater<int>());
  int ans = 0;
  for(int i=K;i<arr1.size();++i) ans += arr1[i];
  cout<<ans<<endl;
}



Measured memory_bytes: 15092
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        System.out.println(
            new BufferedReader(new InputStreamReader(System.in))
                .lines()  // Stream<String> : ???n
                .mapToInt(Integer::parseInt)  // IntStream : ???n
                .mapToObj(n -> Stream.of(IntStream.iterate(n - 1, i -> i - 1), IntStream.iterate(n + 1, i -> i + 1))) // Stream<Stream<IntStream>> : ???n???[[n-1, n-2, ...], [n+1, n+2, ...]]
                .map(ss -> ss.flatMap(s -> s.filter(x -> IntStream.rangeClosed(2, (int)Math.sqrt(x))
                                                                  .allMatch(y -> x % y != 0))  // ?´???°????????£??????????????°
                                            .limit(1)  // ?????????1???
                                            .mapToObj(String::valueOf))  // Stream<Stream<String>> : ???n?????????????´???°2???
                             .collect(Collectors.joining(" ")))  // Stream<String> : ???n?????????
                .collect(Collectors.joining("\n")));  // String : ??¨n?????????
    }
}

Measured memory_bytes: 31084
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

vector<int>A;
vector<int>B;
int N;

int main() {
	cin >> N;
	int big = -1;
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		int tmp;
		cin >> tmp;
		big = max(tmp, big);
		A.push_back(tmp);
		B.push_back(big);
		if (tmp == big)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.append(X)
x.sort(reverse = True)
y.append(Y)
y.sort()
if x[0] < y[0]:
  print("No War")
else:
  print("War")

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

int main() {
  string s;
  string t;
  cin >> s >> t;
  cout << t << s << endl;
}


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

// vector<int> dp(100000, 1e9);

int main()
{
    int a, b, ans;
    cin >> a >> b;
    ans = (a + b) / 2;

    if((a+b)%2==0)printf("%d",ans);
    else   printf("%d",ans+1);

    return 0;
}

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

int main() {
    int N, M, C;
    cin >> N >> M >> C;
    vector <int> B(M);
    vector <int> A(M);
    for (int j=0; j<M; j++) cin >> B.at(j);
    int ans = C;
    int res = 0;
    for (int i=0; i<N; i++) {
        for (int j=0; j<M; j++) cin >> A.at(j);
        for (int j=0; j<M; j++) ans += A.at(j)*B.at(j);
        if (ans>0) res++;
        ans=C;
    }
    cout << res;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <fstream>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    int n, y;
    cin >> n >> y;

    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; i + j <= n; j++)
        {
            int k = n - i - j;
            if (i * 10000 + j * 5000 + k * 1000 == y)
            {
                printf("%d %d %d\n", i, j, k);
                return 0;
            }
        }
    }
    
    cout << "-1 -1 -1" << endl;
    return 0;    
}

Measured memory_bytes: 256
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE BangPatterns #-}

-- Default Imports

import Control.Monad
import Control.Monad.ST
import Control.Monad.Trans.Class

import qualified Control.Monad.Reader as Reader
import Control.Monad.Reader (Reader, ReaderT, runReader, runReaderT)

import qualified Data.Array.MArray as MArray
import qualified Data.Array.ST as STArray
import Data.Array.ST (STArray, STUArray, runSTArray, runSTUArray)
import Data.Ix (Ix)

import qualified Data.Bits as Bits
import Data.Bits ((.&.), (.|.))

import qualified Data.ByteString.Char8 as BS
import Data.ByteString.Char8 (ByteString)

import qualified Data.Char as Char
import qualified Data.List as List
import qualified Data.Map as Map
import Data.Map (Map)
import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
import Data.Set (Set)

import qualified Data.Vector as Vector
import qualified Data.Vector.Generic as GVector
import qualified Data.Vector.Mutable as MVector
import Data.Vector.Mutable (STVector)
import qualified Data.Vector.Unboxed as UVector

import Numeric

import Debug.Trace
-- ----------

-- Custom Import Here


-- ----------

-- Default Definitions

type Vector = Vector.Vector
-- type GVector = GVector.Vector
type UVector = UVector.Vector

readIntToList :: ByteString -> [Int]
readIntToList = List.unfoldr (fmap (second $ BS.dropWhile Char.isSpace) . BS.readInt)

readToList :: Read a => ByteString -> [a]
readToList = List.unfoldr $ fmap (mapTaken . mapRemain) . span' (not . Char.isSpace)
	where
		mapTaken  = first $ read . BS.unpack
		mapRemain = second $ BS.dropWhile Char.isSpace
		span' pred s
			| BS.null taken = Nothing
			| otherwise     = Just (taken, remain')
			where
				(taken, remain) = BS.span pred s
				remain' = BS.dropWhile Char.isSpace remain

readToListN :: Read a => Int -> ByteString -> [a]
readToListN n = take n . readToList

readIntToVector :: ByteString -> Vector Int
readIntToVector = Vector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVector :: ByteString -> UVector.Vector Int
readIntToUVector = UVector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToVectorN :: Int -> ByteString -> Vector.Vector Int
readIntToVectorN n = Vector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVectorN :: Int -> ByteString -> UVector.Vector Int
readIntToUVectorN n = UVector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace


first :: (a -> a') -> (a, b) -> (a', b)
first f (a, b) = (f a, b)

second :: (b -> b') -> (a, b) -> (a, b')
second f (a, b) = (a, f b)

average :: Fractional a => [a] -> a
average xs = sum xs / (fromIntegral . length) xs

-- ----------

ans :: Int -> Int
ans 0 = 0
ans 1 = 1
ans n = 1 + 2 * ans (n `div` 2)

main :: IO ()
main = do
	h <- readLn
	print $ ans h


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

typedef long long ll;
typedef long double ld;
typedef double db;


int main()
{
    //ios_base::sync_with_stdio(false);
    //cout<<setprecision(20);
    int n;
    int k;
    int a[200000];
    cin>>n>>k;
    int x,y;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]==1) x=i;
    }
    y=n-1-x;
    k--;
    int ans=0;
    if(x%k==0){
        ans+=x/k;
    }
    else{
        y-=(k-x%k)%k;
        ans+=x/k+1;
    }
    if(y<0){
        cout<<ans;
        return 0;
    }
    if(y%k==0){
        ans+=y/k;
    }
    else{
        ans+=y/k+1;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3

N = int(input())
A = list(map(int, input().split()))

D = {400:0, 800:0, 1200:0, 1600:0, 2000:0, 2400:0, 2800:0, 3200:0}

cnt = 0
for a in A:
    if a < 400:
        D[400]+=1
    elif a < 800:
        D[800]+=1
    elif a < 1200:
        D[1200]+=1
    elif a < 1600:
        D[1600]+=1
    elif a < 2000:
        D[2000]+=1
    elif a < 2400:
        D[2400]+=1
    elif a < 2800:
        D[2800]+=1
    elif a < 3200:
        D[3200]+=1
    elif a >= 3200:
        cnt += 1

mi = 0
ma = 0

for k, v in D.items():
    if v !=0:
        mi += 1

ma = mi + cnt
if mi == 0: mi = 1

print(str(mi) + ' ' + str(ma))


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

using namespace std;
using ll = long long;


int main()
{
    int n, q;
    cin >> n;
    vector<int> a(n), b;
    int no = 0;
    for(int i = 0; i < n; i++) cin >> a[i];
    b = a;
    sort(b.begin(), b.end());
    for(int i = 0; i < n; i++)if(a[i] != b[i])no++;

    if(no == 0) {
        cout << 0 << endl;
        return 0;
    }

    cin >> q;
    for(int i = 0; i < q; i++) {
        int x, y; cin >> x >> y;
        x--, y--;
        if(a[x] == b[x])no++; //乱す
        if(a[y] == b[y])no++;
        swap(a[x], a[y]);
        if(a[x] == b[x])no--; //整列
        if(a[y] == b[y])no--;
        if(no == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;


}


Measured memory_bytes: 5268
<?php
# 入力部
// fscanf(STDIN, "%s %s", $s, $t);
fscanf(STDIN, "%d %d", $h, $a);
// fscanf(STDIN, "%s", $u);
// fscanf(STDIN, "%d %d", $n, $r);
// $s1 = fgets(STDIN); //"\n"の2文字
// $s2 = fgets(STDIN);
// fscanf(STDIN, "%d", $n);
// fscanf(STDIN, "%s", $s);
// fscanf(STDIN, "%s", $s2);
// fscanf(STDIN, "%d %d %d", $a, $b, $c);


# 処理部
// $arr = str_split($s);
// $arr2 = str_split($s2);
// $arr1 = explode(" ", $s1);
// $arr2 = explode(" ", $s2);
// for ($i = 0; $n > $x * $i; $i++) {
// }
// if (strpos($s, 'RRR') !== false) {
//   $r = 3;
// } elseif (strpos($s, 'RR') !== false) {
//   $r = 2;
// } elseif (strpos($s, 'R') !== false) {
//   $r = 1;
// } else {
//   $r = 0;
// }
// $s = "No";
// if ($x >= 30) {
//   $s = "Yes";
// }
// for ($i = 0; $i * 1000 < $n; $i++) {
// }
// $c = "a";
// if (ctype_upper($a)) {
//   $c = "A";
// }
// $s = "Yes";
// echo count($arr1);
// for ($i = 0; $i < strlen($s1); $i++) {
//   if ($arr1[$i] != $arr2[$i]) {
//     $s = "No";
//   }
// }
// $unit;
// switch ($n % 10) {
//   case 0:
//   case 1:
//   case 6:
//   case 8:
//     $unit = "pon";
//     break;
//   case 3:
//     $unit = "bon";
//     break;
//   default:
//     $unit = "hon";
//     break;
// }
// if ($s == "ABC") {
//   $r = "ARC";
// } else {
//   $r = "ABC";
// }
// $r = "NG";
// for ($i = $a; $i <= $b; $i++) {
//   if ($i % $k == 0) {
//     $r = "OK";
//   }
// }
// $r = "safe";
// if ($s <= $w) {
//   $r = "unsafe";
// }
// $r = "No";
// if (strpos($n, "7") !== false) {
//   $r = "Yes";
// }
// $r = "No";
// if ($arr[2] == $arr[3] && $arr[4] == $arr[5]) {
//   $r = "Yes";
// }
// $r = "Yes";
// if ($s == "AAA" || $s == "BBB") {
//   $r = "No";
// }
// if ($n % 2 == 0) {
//   $r = $n / 2;
// } else {
//   $r = ($n + 1) / 2;
// }
// if ($n < 10) {
//   $r += (10 - $n) * 100;
// }
// $arr = array($a, $b, $c);
// $arr = array_unique($arr);
// if (count($arr) == 2) {
//   $r = "Yes";
// } else {
//   $r = "No";
// }
// if ($s == $u) {
//   $a--;
// } else {
//   $b--;
// }
for ($i = 0; $h > 0; $i++) {
  $h -= $a;
}

# 出力部
// echo ($n * ($n - 1) / 2) + ($m * ($m - 1) / 2) . "\n";
// echo $z . " " . $x . " " . $y . "\n";
// echo ($i * 1000) - $n . "\n";
// echo json_encode($arr) . "\n";
echo $i . "\n";
// echo $a . " " . $b . "\n";


Measured memory_bytes: 16080
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <cstdlib>
using namespace std;

class Main{
	public:
	vector<int> g[40];
	int B[40];
	map<string,int> dic;
	int get(string x){
		if( dic.count(x) ) return dic[x];
		int t = dic.size();
		return dic[x] = t;
	}

	int N;
	long long kill[40];
	int answer;
	int maximum;
	int dfs(long long cond){
		int killnum = -1;
		int id = -1;
		int allsum = 0;
		for(int i = 0 ; i < N ; i++){
			if( !(cond >> i & 1) ){
				int killtmp = __builtin_popcountll(kill[i]&~cond);
				if( killtmp > killnum ){
					killnum = killtmp;
					id = i;
				}
				allsum += B[i];
			}
		}
		if( answer + allsum <= maximum ) return 0;
		if( killnum == -1 ){
			maximum = answer;
		}else{
			answer += B[id];
			dfs(cond|kill[id]|(1ll<<id));
			answer -= B[id];
			dfs(cond|(1ll<<id));
		}
	}
	int main(){
		answer = maximum = 0;
		for(int i = 0 ; i < 40 ; i++) kill[i] = 0;
		if( cin >> N, N == 0 ) exit(0);
		for(int i = 0 ; i < N ; i++){
			string A; int id,C;
			cin >> A;
			id = get(A);
			cin >> B[id] >> C;
			for(int j = 0 ; j < C ; j++){
				string h; cin >> h;
				int id2 = get(h);
				g[id].push_back(id2);
			}
		}
		for(int i = 0 ; i < N ; i++){
			for(int j = 0 ; j < g[i].size() ; j++)
				kill[i] |= 1ll<<g[i][j];
		}
		answer = B[0];
		dfs(kill[0]|1);
		cout << maximum << endl;
	}
};

int main(){
	while(1){
		Main().main();
	}
}

Measured memory_bytes: 1260
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)
int main()
{
  ll a;
  double b;
  cin >> a >> b;
  ll b2 = 100 * b + 0.0001;
  cout << ll(a * b2 / 100) << endl;
  return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <map>
using namespace std;
int main(void){
    map<char, char> mp;
    mp['A'] = 'T';
    mp['T'] = 'A';
    mp['C'] = 'G';
    mp['G'] = 'C';
    char b;
    cin >> b;
    cout << mp[b] << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 1005
#define ll long long
using namespace std;
ll dp[maxn],n,a[maxn],anss,l[maxn],r[maxn],id,ans[maxn],tail;
int main()
{
	scanf("%lld",&n);
	dp[0]=-0x3f3f3f3f;
	for(int i=1;i<=n;++i) scanf("%lld",&a[i]),dp[i]=a[i];
	for(int i=1;i<=n;++i) 
	for(int j=1;j<i;++j) 
	{
		if((i-j)%2==0)
		if(dp[j]+a[i]>dp[i]) dp[i]=max(dp[i],dp[j]+a[i]),l[i]=j;
	}
	for(int i=1;i<=n;++i) if(dp[i]>dp[id]) id=i;
	
	ll ans1=0;
	for(int i=1;i<=n;i+=2)
		if(a[i]>0) ans1+=a[i];
		
	ll ans2=0;
	for(int i=2;i<=n;i+=2)
		if(a[i]>0) ans2+=a[i];
	
	if(ans1==0 && ans2==0){
		ans1=-1e18;
		for(int i=1;i<=n;i++)
			ans1=max(ans1,a[i]);
	}
	else ans1=max(ans1,ans2);
	cout<<ans1<<endl;

	for(int i=n;i>id;--i) ans[++tail]=i;
	while(l[id]!=0){
		int mid=(id+l[id])>>1;
		for(int i=mid;i>l[id];--i)
		ans[++tail]=i;
		id=l[id];
	}
	for(int i=1;i<id;++i) ans[++tail]=1;
	printf("%lld\n",tail);
	for(int i=1;i<=tail;++i) printf("%lld\n",ans[i]);
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		int N=100001;
		int Tmax=20;
		double[] E;
		
		E=new double[N+1];
		double[][] P=new double[2][];
		P[0]=new double[Tmax];
		P[1]=new double[Tmax];
		
		E[1]=1.0;
		P[1][1]=1.0;
		double[] winP=new double[Tmax];
		for(int i=0;i<Tmax;i++)winP[i]=1.0/Math.Pow(2.0,(double)i);
		
		//期待値の和の線形性を使う。
		//n回後の弁当の個数の和の期待値=Σ(k回目に得られる弁当の個数の期待値）
		//　　　　　　　　　　　　　　 =Σ(k回目に弁当を得られる確率)*1個
		
		for(int i=2;i<N;i++){
			int now=i%2;
			int prev=now^1;
			double pget=0.0;
			P[now]=new double[Tmax];
			for(int j=0;j<Tmax;j++){
				if(j==0){
					P[now][j+1]+=P[prev][j]*1.0;
					pget+=P[now][j+1];
				}else{
					if(j+1<Tmax){
						P[now][j+1]+=P[prev][j]*winP[j];
						pget+=P[prev][j]*winP[j];
					}
					P[now][0]+=P[prev][j]*(1-winP[j]);
				}
			}
			E[i]=E[i-1]+pget;
		}
		
		while(true){
			String s="";
			while(String.IsNullOrEmpty(s))s=Console.ReadLine();
			var d=int.Parse(s);
			if(d==0)break;
			Console.WriteLine("{0}",E[d]);
		}
		
		
	}

	
	public Sol(){
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

Measured memory_bytes: 7300
package main
import (
    "bufio"
    "fmt"
    "math"
    "os"
    "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
    if sc.Scan() {
        ret, _ := strconv.Atoi(sc.Text())
        return ret
    }
    return 0
}

func main(){
    n := readInt()
    var capacities [5]int
    min_cap := int(1e15)
    for i := range capacities {
        cap := readInt()
        capacities[i] = cap
        if cap < min_cap {
            min_cap = cap
        }
    }
    
    requiredTime := int(math.Ceil(float64(n) / float64(min_cap))) + 4

    fmt.Println(requiredTime)
}


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

int main ()
{
 string s;
 cin >> s;
 int n=0;
 int sz=s.size();
 for(int i=0; i <=(sz / 2)-1;i++)
 {
  if (s[i] != s[sz-i-1]) n++;
 }
 cout << n << endl;
 return 0;
}

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    bool flag=true;
    if(n%2==0){
        for(int i=0; i<n/2; i++){
            if(s.at(i)!=s.at(n/2+i)){
                flag=false;
            }
        }
    }
    else flag=false;
    if(flag==true) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long ansT = 1;
		long ansA = 1;
		for (int i = 0; i < n; i++) {
			long t = sc.nextLong();
			long a = sc.nextLong();

			long mt = (ansT + t - 1) / t;
			long ma = (ansA + a - 1) / a;
			long m = Math.max(mt, ma);

			ansT = m * t;
			ansA = m * a;
		}
		sc.close();

		System.out.println(ansT + ansA);
	}
}


Measured memory_bytes: 23124
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int n, a[2][101];
    scanf("%d", &n);
    int max1 = 0, count;
    for(int i = 0; i < n; i++) scanf("%d", &a[0][i]);
    for(int i = 0; i < n; i++) scanf("%d", &a[1][i]);
    for(int i = 0; i < n; i++){
        count = 0;
        for(int j = i; j>=0; j--) count+=a[0][j];
        for(int j = i; j < n; j++) count+=a[1][j];
        max1 = max(count, max1);
    }
    printf("%d\n", max1);
    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define sq(x)   (x)*(x)
#define PI      acos(-1.0)
#define all(x) x.begin(),x.end()
#define nl      '\n'

typedef long long int ll;
typedef unsigned long long int  llu;


int main()
{
	faster
	ll n;
	cin>>n;
	ll a[n],sum=0,i;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(i=0;i<n-1;i++)
	{
		if(a[i]>a[i+1])
		{
			sum+=a[i]-a[i+1];
			a[i+1]=a[i];
		}
	}
	cout<<sum<<nl;
	return 0;

}


Measured memory_bytes: 5152
#include <stdio.h>

int main(void)
{
	int n,x[100];
	int count=0;
	
	scanf("%d",&n);
	
	for(int i=0;i<n;i++){
		scanf("%d",&(x[i]));
	}
	
	for(int j=0;j<n-1;j++){
		if(x[j]==x[j+1]){
			x[j+1]=n+1;
			count++;
		}
	}
	
	printf("%d\n",count);
	
	return 0;
}
		
	
		
	

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll x,y,h,H,idx_H;
int main() {
    int N; cin >> N;
    vector<tuple<ll, ll, ll>> A(N);
    for (int i=0; i<N; ++i) {
        cin >> x >> y >> h;
        if (h > 0) idx_H = i;
        A[i] = make_tuple(x,y,h);
    }
    for (int cx = 0; cx<=100; cx++){
        for (int cy=0; cy<=100; cy++){
            H = get<2>(A[idx_H]) + abs(get<0>(A[idx_H])-cx) + abs(get<1>(A[idx_H])-cy);
            bool can = true;
            for (auto a : A) {
                tie(x,y,h) = a;
                // if (h != max((H - abs(x-cx) - abs(y-cy)), (ll)0)) can = false;
                if (h > 0 && h != H - abs(x-cx) - abs(y-cy)) can = false;
                if (h== 0 && (H - abs(x-cx) - abs(y-cy)) > 0) can = false;
            }
            if (can) {
                cout << cx << " " << cy << " " << H << endl;
                return 0;
            }
        }
    }

}

Measured memory_bytes: 3564
#include <iostream>
#include <algorithm>
#include <utility>

int main()
{
	using std::cin;
	using std::cout;
	using std::endl;
	int a, b, c;
	cin >> a >> b >> c;
	cout << std::max({ a,b,c }) * 9 + a + b + c << endl;
}

Measured memory_bytes: 888
n,k,c=map(int,input().split())
s=input()
l=len(s)
cand=[]
for i in range(l):
  if s[i]=='o':
    cand.append(i+1)
cnt1=[0]*(n+2)
cnt2=[0]*(n+2)
prev=0
cnt=0
for i in range(l):
  if s[i]=='o' and i>=prev:
    cnt+=1
    cnt1[i+1]=cnt
    prev=i+(c+1)
  else:
    cnt1[i+1]=cnt
prev=l
cnt=0
for i in range(l-1,-1,-1):
  if s[i]=='o' and i<=prev:
    cnt+=1
    cnt2[i+1]=cnt
    prev=i-(c+1)
  else:
    cnt2[i+1]=cnt
ans=[]
for i in range(len(cand)):
  tmp=cand[i]
  if cnt1[tmp-1]+cnt2[tmp+1]<k:
    ans.append(tmp)
for val in ans:
  print(val)

Measured memory_bytes: 30112
#include <bits/stdc++.h>
using namespace std;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long 
//typedef pair<ll, ll> P;
const ll INF=1LL<<60;
ll gcd(ll x,ll y){return y? gcd(y,x%y) :x;}

ll dp[200010];
int main(){
    int n,k;
    cin>>n>>k;
    vector<ll>h(n);
    rep(i,200010)dp[i]=INF;
    rep(i,n)cin>>h[i];
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=1;i<n;i++){
        for(int j=0;j<k;j++){
            if(i-j-1>=0)chmin(dp[i],dp[i-j-1]+abs(h[i]-h[i-j-1]));
        }
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 5504
S = input()

max = 0
count = 0
for i in range(len(S)):
    if(S[i] != 'A' and S[i] != 'T' and S[i] != 'G' and S[i] != 'C'):
        if(count > max):
            max = count
        count = 0
    else:
        count += 1

if(count > max):
    max = count

print(max)

Measured memory_bytes: 3064
import numpy as np
import math

rotate = int(input())

x = 0
y = 1
heading = 90

count = 1

while True:
    heading += rotate
    x += np.cos(np.deg2rad(heading))
    y += np.sin(np.deg2rad(heading))
    count += 1
    #print('heading', heading)
    #print('x : ', x)
    #print('y : ', y)

    if math.isclose(x, 0.0,abs_tol=0.000001) and math.isclose(y, 0.0,abs_tol=0.0000001):
        break

print(count)

Measured memory_bytes: 27204
n, p = map(int,input().split())
a=list(map(int, input().split()))
odd=0
even=0
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

for i in a:
    if i%2==0:
        even+=1
    else:
        odd+=1

o_pattern=0
for i in range(p,odd+1,2):
    o_pattern += cmb(odd,i)

e_pattern=0
for i in range(even+1):
    e_pattern += cmb(even,i)

print(o_pattern*e_pattern)

Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long long unsigned int ull;
#define INF 1LL << 29

int main() {
	int N, M;
	cin >> N >> M;
	vector<pair<int, int> > dic(M);
	vector<bool> bridge(N - 1, true);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		dic[i] = { b,a };
	}
	sort(dic.begin(), dic.end());
	reverse(dic.begin(), dic.end());
	int ans = 0;
	for (int i = M - 1; i >= 0; i--) {
		int flag = false;
		for (int j = dic[i].first - 1; j >= dic[i].second; j--) {
			if (bridge[j] == false) {
				flag = true;
				break;
			}
		}
		if (!flag) {
			bridge[dic[i].first - 1] = false;
			ans++;
		}
	}
	cout << ans << endl;
}

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

int main(){
    int t;
    while(cin >> t, t){
        int n, sum = 0;
        cin >> n;
        for(int i=0;i<n;i++){
            int s, f;
            cin >> s >> f;
            sum += f-s;
        }
        if(sum >= t){
            cout << "OK" << endl;
        }else{
            cout << t-sum << endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 3088
#include <iostream>

using namespace std;

void resolve()
{
    int P[] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
               1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K;
    cin >> K;

    cout << P[K - 1] << endl;
}

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


Measured memory_bytes: 256
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int profit = 0;
		int[][] vc = new int [2][N];
		
		for(int i = 0; i < 2; i++) {
			for(int j = 0; j < N; j++) {
				vc[i][j] = sc.nextInt();
			}
		}
		
		for( int j = 0; j < N; j++) {
			if(vc[0][j] - vc[1][j] > 0) {
				profit += vc[0][j] - vc[1][j];
			}
		}
		System.out.println(profit);
	}
}

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

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

  bool Nconsist = false;

  for (int i = 0; i <= 25; ++i) {
    for (int ii = 0; ii <= 20; ++ii) {
      if(4*i + 7*ii == N)  Nconsist = true;
    }
  }

  if(Nconsist) cout << "Yes" << endl;
  else cout << "No" << endl;
 

}

Measured memory_bytes: 256