akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  ll H,W;
  cin >> H >> W;
  ll diff = LINF;
  // pat 1
  // AAA
  // BBB
  // CCC
  diff = min(diff,(W * (H%3 == 0 ? 0 : 1)));
  // pat 2
  // ABC
  // ABC
  // ABC
  diff = min(diff,H * (W%3==0 ? 0 : 1));
  // pat 3
  // AAC
  // BBC
  ll h1 = H/2;
  ll h2 = H-h1;
  rep(i,W+1) {
    ll w1 = i;
    ll w2 = W-i;
    ll A = h1 * w1;
    ll B = h2 * w1;
    ll C = H * w2;
    ll ma = max(A,max(B,C));
    ll mi = min(A,min(B,C));
    diff = min(diff,ma-mi);
  }
  // pat 4
  // AB
  // AB
  // CC
  ll w1 = W/2;
  ll w2 = W-w1;
  rep(i,H+1) {
    ll h1 = i;
    ll h2 = H-i;
    ll A = w1 * h1;
    ll B = w2 * h1;
    ll C = W * h2;
    ll ma = max(A,max(B,C));
    ll mi = min(A,min(B,C));
    diff = min(diff,ma-mi);
  }
  cout << diff << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    
    string S;
    int a = 0;
    cin >> S;
  if(S =="hi" || S =="hihi" || S =="hihihi" || S =="hihihihi" || S =="hihihihihi"){
  
    a++;
  }
  
  if(a > 0){

cout<<"Yes"<<endl;
  }else{
cout<<"No"<<endl;
  }
}
  


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
			int n = sc.nextInt();
			int[][] card  = new int[2][n];
			for(int i = 0; i < n ; i++){	
				card[0][i] = sc.nextInt();
				card[1][i] = sc.nextInt();
			}
			int[][] dp = new int[n][n];
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					if(j == i){
						dp[j][i] = 0;
					}else{
						dp[j][i] = Integer.MAX_VALUE/2;	
					}
				}
			}
			for(int i = 1; i < n; i++){
				for(int j = 0; j + i < n; j++){
					for(int k = j; k < j + i; k++){
						dp[j][j + i] = Math.min(dp[j][j + i], dp[j][k] + dp[k + 1][j + i] + card[0][j] * card[1][k] * card[0][k + 1] * card[1][j + i]); 
					}
				}
			}
			System.out.println(dp[0][n - 1]);
	}

}

Measured memory_bytes: 12000
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int h[100005];
long long f[100005];
int main() 
{
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		cin >> h[i];
	for (int i = 2; i <= n + 5; i++)f[i] = 1e11;
	f[1] = 0;
	for (int i = 1; i < n; i++)
	{
		for (int j = 1; i + j <= n && j <= k; j++)
			f[i + j] = min(f[i + j], f[i] + abs(h[i + j] - h[i]));
	}
	cout << f[n] << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    ll h;
    int n;
    cin >> h >> n;
    ll a[n];
    ll sum = 0;
    rep(i,n){
        cin >> a[i];
        sum += a[i];
    }
    if(sum >= h) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e9;

int main(){
  ll N;
  cin>>N;
  
  vector<ll>a(N);
  vector<ll>b(N);
  vector<ll>right(N);
  vector<ll>left(N);
  ll ans=0;
  ll ans2=0;
  ll sum=0;
  for(ll i=0;i<N;i++){
    cin>>a[i];
    b[i]=(a[i]-i-1);
  }
  sort(b.begin(),b.end());
if(N%2==1){
 ans=(-1)*b[(N/2)];
  for(ll i=0;i<N;i++){
    sum+=abs(b[i]+ans);
  }
}
  
  else{
ans=(-1)*(b[(N/2)-1]+b[N/2])/2;
    for(ll i=0;i<N;i++){
      sum+=abs(b[i]+ans);
  
  
  
}
  
  }
  
  cout<<sum<<endl;
}
    
    

  
   

  

Measured memory_bytes: 6528
from collections import Counter
N,M=list(map(int,input().split()))
cards=list(map(int,input().split()))
all_c=Counter(cards)

for i in range(M):
    time,val=list(map(int,input().split()))
    if val in all_c.keys():
        all_c[val]+=time
    else:
        all_c[val]=time
    """
    try:
        all_c[val]+=time
    except:
        all_c[val]=time
    """

tmp=list(all_c.keys())
tmp.sort(reverse=True)
total=0
sum_time=0
for i in tmp:
    if sum_time>=N:
        break
    sum_time+=all_c[i]
    if sum_time<N:
        total+=i*all_c[i]
    else:
        total+=i*(all_c[i]+N-sum_time)
print(total)


Measured memory_bytes: 32448
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
using namespace std;

typedef long long ll;
int main() {
	int n;
	int arr[101];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
	}
	sort(arr, arr + n);
	int ans = 2e9;
	for (int i = 1; i <= 100; i++) {
		int cnt = 0;
		for (int j = 0; j < n; j++) {
			cnt += (i-arr[j])*(i-arr[j]);
		}
		ans = min(ans, cnt);
	}
	printf("%d", ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int N,sum,i,k;
  cin >> N;
  vector<int> a(N+1);
  for(i=0;i<N+1;i++)
  {
    a.at(i)=0;
  }
  for(i=1;i<=N-1;i++)
  {
    cin >> k;
    a.at(k)++;
  }
  for(i=1;i<N+1;i++)
  {
   cout << a.at(i) << endl;
  }

}

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

vector<int> data;

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

  int ans = 0;
  int i=min(A,B);
  while(ans != K){
    if(A%i==0 && B%i==0){
      ans++;
      data.push_back(i);
    }
    i--;
  }
  cout << data[K-1] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>

#define lowbit(x) (x&(-x))
#define MAX(a,b) (a<b?b:a)
#define MIN(a,b) ((a)<(b)?(a):(b))
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = 2e5;
const int maxn = 2e5 + 5;
ll mod = 1e9 + 7;

int n;
int a, b, c[maxn], w[maxn];

int minw[maxn];

int p[maxn];
int find(int u)
{
	return u == p[u] ? u : p[u] = find(p[u]);
}
void merge(int u, int v)
{
	u = find(u); v = find(v);
	if (u^v)
	{
		p[u] = v;
	}
}

vector<int> col[maxn];
int cnt[maxn], show[maxn], tot;

ll f[maxn], inv[maxn];
ll ss(ll a, ll b)
{
	ll ans = 1;
	while (b)
	{
		if (b & 1) (ans *= a) %= mod;
		(a *= a) %= mod;
		b >>= 1;
	}
	return ans;
}
int main()
{
	scanf("%d%d%d", &n, &a, &b);
	f[0] = inv[0] = 1;
	for (int i = 1; i <= N; i++)
	{
		f[i] = f[i - 1] * i%mod;
		inv[i] = ss(f[i], mod - 2);
	}
	int min1 = 1, min2 = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d%d", c + i, w + i);
		p[i] = i;
		if (!minw[c[i]] || w[i] < w[minw[c[i]]]) minw[c[i]] = i;

		if (c[i] != c[1]) min2 = i;
	}
	
	if (w[min1] > w[min2]) swap(min1, min2);
	for (int i = 1; i <= n; i++)
	{
		if (c[i] == c[min1])
		{
			if (w[min1] > w[i]) min1 = i;
		}
		else if (c[i] == c[min2])
		{
			if (w[min2] > w[i]) min2 = i;
		}
		else
		{
			if (w[min1] > w[i])
			{
				min2 = min1;
				min1 = i;
			}
			else if (w[min2] > w[i])
				min2 = i;
		}
	}

	if (!(min1 && min2))
	{
		printf("1");
		return 0;
	}
	if (w[min1] + w[min2] <= b) merge(min1, min2);
	for (int i = 1; i <= n; i++)
	{
		if(w[i]+w[minw[c[i]]]<=a) merge(i, minw[c[i]]);
		if (c[i] != c[min1] && w[i] + w[min1] <= b) merge(i, min1);
		if (c[i] != c[min2] && w[i] + w[min2] <= b) merge(i, min2);
	}

	ll ans = 1;
	for (int i = 1; i <= n; i++) col[find(i)].push_back(c[i]);
	for (int i = 1; i <= n; i++)
	{
		int m = col[i].size();
		for (int j = 0; j < m; j++)
		{
			if (!cnt[col[i][j]])
			{
				show[++tot] = col[i][j];
			}
			++cnt[col[i][j]];
		}
		(ans *= f[col[i].size()]) %= mod;
		for (int j = 1; j <= tot; ++j)
		{
			(ans *= inv[cnt[show[j]]]) %= mod;
		}
		for (int j = 0; j < m; j++)
		{
			--cnt[col[i][j]];
		}
		tot = 0;
	}
	printf("%lld", ans);
}

Measured memory_bytes: 18560
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
const int mod = 1e9 + 7;

int main()
{
	long long ans = 1, i;
	int n;
	scanf("%d", &n);
	for(i = 1; i <= n; i++)
		ans = (ans % mod) * (i % mod) % mod;
		printf("%lld\n", ans);

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0; i < (n); i++)

const int MAX_N = 1000000;
const int INF = 10000000;

int main() {
  vector<int> simen, odd_simen;

  int n = 1, nv = 1;
  while (nv <= MAX_N) {
    simen.push_back(nv);
    if (nv % 2 == 1) odd_simen.push_back(nv);
    n++;
    nv = n*(n+1)*(n+2) / 6;
  }
  vector<int> dp(MAX_N + 1, INF);
  vector<int> odd_dp(MAX_N + 1, INF);
  dp[0] = odd_dp[0] = 0;

  for (int i = 1; i <= MAX_N; i++) {
    for(int j = 0; j < simen.size(); j++) {
      if (i < simen[j]) break;
      dp[i] = min(dp[i], dp[i - simen[j]] + 1);
    }
    for(int j = 0; j < odd_simen.size(); j++) {
      if (i < odd_simen[j]) break;
      odd_dp[i] = min(odd_dp[i], odd_dp[i - odd_simen[j]] + 1);
    }
  }

  while (true) {
    int m;
    cin >> m;
    if (m == 0) break;

    cout << dp[m] << " " << odd_dp[m] << endl;
  }
  return 0;
}

Measured memory_bytes: 8796
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld long double
#define   pb push_back
#define  sz(x)  (int)x.size()
#define  ff first
#define  ss second
#define  pii  pair<int,int>
using namespace std;

inline void solve(){ 
    int a,b;
    cin>>a>>b;
    if (a==1) a += 100;
    if (b==1) b += 100;
    if (a>b) cout << "Alice" << endl; 
    if (a<b) cout << "Bob" << endl; 
    if (a==b) cout << "Draw" << endl; 
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


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

results = {
	'AC': 0,
	'WA': 0,
	'TLE': 0,
	'RE': 0,
}

for _ in range(n):
  r = input()
  results[r] += 1

for r in ('AC', 'WA', 'TLE', 'RE'):
  print('{} x {}'.format(r, results[r]))


Measured memory_bytes: 9180
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint 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)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;


lint D;
lint decrease[26];
lint satis[365][26];
lint prv[26];

lint downscore(lint passed) {
	lint sum = 0;
	REP(i, 26) {
		sum += decrease[i] * (passed - prv[i]);
	}
	return -sum;
}

int main() {
	cin >> D;
	REP(i, 26) {
		cin >> decrease[i];
	}
	REP(i, D) {
		REP(j, 26) {
			cin >> satis[i][j];
		}
	}

	lint score = 0;
	REP(i, D) {
		lint maxv = -INF, max_idx = 0;
		REP(s, 26) {
			lint inst = 0;
			inst += satis[i][s];
			inst += downscore(i + 1);
			chmax(inst, 0ll);
			if (maxv < inst) {
				maxv = inst;
				max_idx = s;
			}
		}
		prv[max_idx] = i + 1;
		cout << max_idx + 1;
		if (i != D - 1) cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3696
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	a := make([]int, N)
	for i := range a {
		fmt.Scan(&a[i])
	}
	m := make(map[int]int)
	for _, v := range a {
		m[v]++
	}
	cnt := 0
	if len(m) > K {
		va := make([]int, len(m))
		i := 0
		for _, v := range m {
			va[i] = v
			i++
		}
		sort.Sort(sort.Reverse(sort.IntSlice(va)))
		for _, v := range va[K:] {
			cnt += v
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 13440
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
using ull = unsigned long long;

typedef pair<ll, ll> P;
typedef pair<double, double >pd;
typedef pair<string, string> sP;
typedef pair<ll, P> PP;
typedef pair<P, P> PPP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 5e14;
const double eps = 1e-10;
const double PI = acos(-1);
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

ll  d, g, p[20], c[20];
ll dp[200010];

int main() {
	cin >> d >> g;
	g /= 100;
	for (int i = 1;i <= d;i++) {
		cin >> p[i] >> c[i];
		c[i] /= 100;
	}
	fill(dp, dp + 200010, INF);
	dp[0] = 0;
	for (ll i = 1;i <= d;i++) {
		queue<P>q;
		for (int j = 0;j <= g;j++) {
			if (dp[j] != INF)q.push(P(j, dp[j]));
		}
		for (ll j = 1;j <= p[i];j++) {
			int sz = q.size();
			for (int k = 0;k < sz;k++) {
				P t = q.front();
				q.pop();
				if (j != p[i]) {
					q.push(P(min(g, t.fr + i), t.sc + 1));
					dp[min(g, t.fr + i)] = min(dp[min(g, t.fr + i)], t.sc + 1);
				}
				else {
					q.push(P(min(g, t.fr + i + c[i]), t.sc + 1));
					dp[min(g, t.fr + i + c[i])] = min(dp[min(g, t.fr + i + c[i])], t.sc + 1);
				}
			}
		}
	}
	cout << dp[g] << endl;
	return 0;
}


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

int main() {
  string str;
  cin >> str;
  if(str.at(2) == str.at(3) && str.at(4) == str.at(5)){
    cout << "Yes" <<endl;
  }else{
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <set>

using namespace std;

int main(int argc, char* argv[]) {
  long long N, M;
  cin >> N >> M;

  set<long long> a;
  for (int i = 0; i < M; ++i) {
    int tmp;
    cin >> tmp;
    a.insert(tmp);
  }

  long long dp[N + 1];
  dp[0] = 1;
  for (int i = 0; i <= N; ++i) {
    if (a.find(i + 1) == a.end())
      if (i == 0)
        dp[i + 1] = dp[i];
      else
        dp[i + 1] = (dp[i] + dp[i - 1]) % 1000000007;
    else
      dp[i + 1] = 0;
  }

  cout << dp[N] << endl;

  return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD=1000000007;
const long double PI=3.14159265358979;
const ll MAX=0;

int main() {
  ll N;
  cin>>N;
  ll a[N];
  rep(i,N){
    cin>>a[i];
  }
  ll ans=0;
  for(int i=0;i<N;i+=2){
    if(a[i]%2==1){
      ans++;
    }
  }
  cout<<ans;
}



Measured memory_bytes: 3624
//07/03/2020
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define debug printf("Debug\n");

#define ll long long
#define ull unsigned long long

#define pi acos(-1.0)
#define mod 1000000007

#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define in_fre  freopen("in.txt", "r", stdin);
#define out_fre freopen("out.txt", "w", stdout);

struct Node{
    ll val,pos;
};
struct OverloadedNode{
    ll val,pos;
    bool operator < (const OverloadedNode &rhs) const {
        if(val==rhs.val) return pos<rhs.pos;
        else return val<rhs.val;
    }
};

template<typename T> using Pbds=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//typedef tree<OverloadedNode,null_type,less<OverloadedNode>,rb_tree_tag,tree_order_statistics_node_update>OverloadedPbds;

/*Containers*/
//vector<ll>v;
//deque<ll>dq;
//stack<ll>stk;
//map<ll,ll>mp;
//unordered_map<ll,ll>ump;
//set<ll>st;
//multiset<ll>mst;
//unordered_set<ll>ust;
//unordered_multiset<ll>umst;
//priority_queue<ll,deque<ll>,greater<ll>>pq;
//Pbds<ll>ost;
/*OverLoaded Containers*/
//vector<OverloadedNode>v;
//deque<OverloadedNode>dq;
//stack<OverloadedNode>stk;
//map<OverloadedNode,OverloadedNode>mp;
//set<OverloadedNode>st;
//multiset<OverloadedNode>mst;
//priority_queue<OverloadedNode>pq;
//OverloadedPbds oost;
/*Global Variables*/

int main(){
    _fastio
    string s;
    cin>>s;
    if(s[0]==s[1]&&s[1]==s[2]) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;




    return 0;
}


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

using namespace std;

int main()
{
    int n, q, com, b, e, min, max;
    cin >> n;
    vector<int> a(n);
    // data insert
    for (int i=0; i<n; ++i){
        cin >> a[i];
    }
    cin >> q;
    for (int i=0; i<q; ++i){
        cin >> com >> b >> e;
        min = 1000000001;
        max = -1000000001;
        for(int j=b; j<e; j++){
            if(a[j] <= min){
                min = a[j];
            }
            if(a[j] >= max){
                max = a[j];
            }
        }
        if(com){
            cout << max << endl;
        }
        else {
            cout << min << endl;
        }
    }
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<lol, lol>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}
//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  int i = 0, ans = 0;
  n --;
  while(i < n){
    if(s[i] == 'W' && s[n] == 'R'){
      swap(s[i], s[n]);
      ans ++;
      i ++;
      n --;
    } else if(s[i] == 'R'){
      i ++;
    } else if(s[n] == 'W'){
      n --;
    }
  }
  cout << ans << '\n';
  return 0;
}


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

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.setf(ios::fixed);
	cout.precision(4);
	
	long long W, H, x, y;

	cin >> W >> H >> x >> y;

	double ans = double(W) * double(H) / 2;

	if (2 * x == W && 2 * y == H) {
		cout << ans << " 1\n";
	} else {
		cout << ans << " 0\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,c=0,i=1;
  cin>>n;
  while(n>c){
    c+=i;
    i++;
  }
  i--;
  c-=i;
  if(c==n){
    for(int j=1;j<i;j++){
      cout<<j<<endl;
    }
  }else{
    c+=i;
    int k=c-n;
    for(int j=1;j<=i;j++){
      if(j==k)
        continue;
      cout<<j<<endl;
    }
  }
}

Measured memory_bytes: 256
def insertionSort(a, n):
    for i in range(1, n):
        v = a[i]
        j = i - 1
        while j >= 0 and a[j] > v:
            a[j + 1] = a[j]
            j -= 1
        a[j + 1] = v
        print(*a)


n = int(input())
l = list(map(int, input().split()))
print(*l)
insertionSort(l, n)



Measured memory_bytes: 5976
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
  int n;
  cin>>n;
  if(n==0){
    cout<<1<<endl;
  }
  else if(n==1){
    cout<<0<<endl;
    
  }
  return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string ans = "Yes";
            for (var i = 0; i < S.Length; i++)
            {
                if (i % 2 == 0)
                {
                    if (S[i] == 'L')
                    {
                        ans = "No";
                        break;
                    }
                }
                else
                {
                    if (S[i] == 'R')
                    {
                        ans = "No";
                        break;
                    }
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

int main() {
  string A,B,C;
  cin >> A >> B >> C;
  
  if(A[A.size()-1]==B[0]&& B[B.size()-1]==C[0]){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  for(int i = 1; i <= 9; i++){
    for(int j = 1; j <= 9; j++){
      if(i * j == N){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

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

#define fa(x,v) for(auto x:v)
#define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define spc " "
#define endl '\n'
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(s) (ll)int(s.length())
#define sz(v) (ll)int(v.size())
#define MOD 1000000007

void Fast_IO() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    freopen("debug.out","w",stderr);
    #endif
} 

// Code Here

int main()
{
    // Fast_IO();
    ll n, m, x; cin >> n >> m >> x;
    ll a[n][m], c[n];
    f(i,0,n-1) {
        cin >> c[i];
        f(j,0,m-1) cin >> a[i][j];
    }
    bool can = false;
    ll ans = 1e9;
    f(mask,0,(1LL << n)-1) {
        ll this_cost = 0;
        vector <ll> know(m,0);
        f(i,0,n-1) if(mask & (1LL << i)) {
            this_cost += c[i];
            f(j,0,m-1) know[j] += a[i][j];
        }
        bool nope = false;
        f(j,0,m-1) if(know[j] < x) nope = true;
        if(nope) continue;
        can = true;
        ans = min(ans, this_cost);
    }
    if(can) cout << ans;
    else cout << -1;
    return 0;
}

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

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> l(N);
  for (int i = 0; i < N; ++i) {
    cin >> l[i];
  }
  sort(l.rbegin(), l.rend());
  int ans = 0;
  for (int i = 0; i < K; ++i) {
    ans += l[i];
  }

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



Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
typedef int Def;
int n,m,w;
vp in;
class DIJ{
	public:
	struct edge{
		Def to,cost;
	};
	vector<vector<edge> >G;
	vector<vector<Def> >d;//distance
	void dij(){
		d=vector<vector<Def> >(w,vector<Def>(n+m+1,inf));
		d[w-3][0]=d[w-2][0]=0;//now oktime ->time
		priority_queue<tp>q;
		q.push(tp(0,w-2,0));//time now v_0 n-1を通ったか
		q.push(tp(0,w-3,0));//time now v_0 n-1を通ったか
		while(!q.empty()){
			Def cost,pos,t;
			tie(cost,pos,t)=q.top();
			cost*=-1;
			q.pop();
			if(cost>d[pos][t])continue;
			rep(i,w)if(i!=pos){
				int j=abs(in[pos].first-in[i].first)+abs(in[pos].second-in[i].second)-1-t;
				j=max(0,j);
//				if(i==w-1&&j)continue;
				Def to=i;
				Def ncost=cost+j;//e.cost*v;
				Def nt=j;
				if(abs(in[pos].first-in[to].first)+abs(in[pos].second-in[to].second)-1
					>t+nt)continue;
				if(ncost<d[to][nt]){
					d[to][nt]=ncost;
					q.push(tp(-ncost,to,nt));
				}
			}
		}
		Def out=inf;
		rep(i,n+m+1)out=min(out,d[w-1][i]);
		cout<<out<<endl;
//		cout<<d[w-1][0]<<endl;
	}
};
int main(){
	cin>>n>>m>>w;
	in=vp(w+3);
	rep(i,w)cin>>in[i].first>>in[i].second;
	in[w]={1,0};
	in[w+1]={0,1};
	in[w+2]={n,m+1};
	w+=3;
	DIJ dij;
	dij.dij();
}







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

int main()
{
	long long n,k,a,b,c;
	cin>>n>>k;
	
	a=n/k;
	b=n%k;
	c=fabs(n-(a+1)*k);
	if(b>c)
		cout<<c;
	else
		cout<<b;
	return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::collections::HashSet;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let n = read::<usize>();
    let w = read_vec::<i32>();

    let answer = solve(n, &w);
    println!("{}", answer);
}


fn solve(n: usize, w:&[i32]) -> i32 {
    let sum_all: i32 = w.iter().sum();
    let mut sum : i32 = 0;
    let mut min_diff:i32 = sum_all;
    for i in 0..n {
        sum += w[i];
        let v = (sum * 2 - sum_all).abs();
        if v < min_diff {
            min_diff = v;
        } else {
            break;
        }
    }
    return min_diff;
}

Measured memory_bytes: 4352
import sys
import math
 
"n = list(map(int,input().split()))[0] // WA"
n = int(input())
T,A = 1,1
for i in range(n):
    t,a = map(int,input().split(" "))
    coef = max((T+t-1)//t,(A+a-1)//a)
    T,A = coef * t, coef * a 
print(T+A) 

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vvi = V< V<int> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
 
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
#define in2(N,s,t) rep(i,N){in(s[i] , t[i]);}
#define in3(N,s,t,u) rep(i,N){in(s[i] , t[i] , u[i]);}
using vd = V<double>; using vs = V<string>; using vvl = V< V<> >;
template<typename T>using heap = priority_queue< T , V<T> , greater<T> >;
 
using P = pair<ll,ll>; using vp = V<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
//////////////////


void solve(){
  ini(N);
  vi a(N); in(a);
  vi flg(N + 1) , ok(N + 1);
  rep(i , N){
    flg[a[i]] = 1;
    if(flg[a[i] - 1]) ok[a[i]] = 1;
  }
  int m = 0 , cur = 0;
  rep1(i , N){
    cur = ok[i] ? cur + 1 : 0;
    amax(m , cur);
  }
  out(N - m - 1);
}

Measured memory_bytes: 2560
n = int(input())
k = int(input())
x_li = list(map(int,input().split()))
s = 0
for i in range(n):
  a = abs(k-x_li[i])
  if a < x_li[i]:
    s += a*2
  else:
    s += x_li[i]*2

print(s)

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

main(){
	vector<int> e[400],c[400];
	int n,m,i,j;
	while(cin >> n >> m){
		for(i=0;i<m;i++){
			int x,y,z;
			cin >> x >> y >> z;
			e[y].push_back(x);
			c[y].push_back(z);
		}
		vector<int> dp(n, -1);
		dp[0] = 0;
		do{
			for(i=0;i<n;i++){
				if(dp[i] != -1) continue;
				for(j=0;j<e[i].size();j++) if(dp[e[i][j]]==-1) break;
				if(j == e[i].size()) break;
			}
			int Max = 0;
			for(j=0;j<e[i].size();j++) Max = max(Max, dp[e[i][j]] + c[i][j]);
			dp[i] = Max;
		}while(i != n-1);
		cout << dp[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1256
#include<stdio.h>

int main(int argc, char *argv[])
{
	int a,b;
	scanf("%d%d\n", &a, &b);
	if (1 <= a && b <= 100) 
	{
		int A = a * b; 
		int S = a + a + b + b; 
		printf("%d %d\n", A, S);

	}
	else
	{
		printf("error");
	}
	return 0;
}

Measured memory_bytes: 2716
#include <stdio.h>
#include <math.h>

int main(){
    int n, n1, c1, n2, c2;

    scanf("%d%d%d%d%d",&n,&n1,&c1,&n2,&c2);

    int s1, s2;
    int p1, p2;

    s1 = ceil((double)n/n1);
    s2 = ceil((double)n/n2);

    p1 = c1 * s1;
    p2 = c2 * s2;

    int price;

    price = p1;
    if(p2<p1){
        price = p2;
    }

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



Measured memory_bytes: 2104
<?php
class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
}

class out {
    public static function println($str = "") {
        echo $str . PHP_EOL;
    }
}

$sc = new Scanner;
$b = $sc->nextInt();
$c = $sc->nextInt();

$d = $b * $c;
if ($d % 2 == 0) {
  out::println('Even');
} else {
  out::println('Odd');
}

?>


Measured memory_bytes: 3828
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int m,n;
int i,x,y,test[25][25],mark[25];

void search(int i){
	mark[i]=1;
	int j;
	for(j=1;j<=m;j++){if(test[i][j]>0 && mark[j]==0)search(j);}
	printf("%d\n",i);
}

int main(){
	scanf("%d %d",&m,&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&x,&y);
		test[y][x]=1;
	}
	for(i=1;i<=m;i++){
		if(mark[i]==0)search(i);
	}
	return 0;
}

Measured memory_bytes: 596
#include <stdio.h>

 int main(){
 long long  N;
 long long  count;
 long long  sum= 0;
   
  scanf("%lld" , &N);
 
 for (count = 1 ; count <= N ; count++){
 	
 if((count % 3 != 0)&&(count % 5 != 0))	sum = sum + count;
 
 }
 
 printf("%lld\n" , sum);
 	
 	return 0;
 	
 }

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

int p,a=0,mi=10000000;

int main(void){
    int n;cin>>n;
    for(int i=0;i<n;i++){
        cin>>p;
        if(p<mi)a++;
        mi=min(mi,p);
    }
    cout<<a<<endl;
    
    return 0;
}


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

int main(){
	int n,m,d,h,i,j,r,s;
	string str;
	for(;cin>>n,n;cout<<r<<endl){
		vector<int>monster(n);
		for(h=i=0;i<n;i++){
			cin>>monster[i];
			if(h<monster[i])h=monster[i];
		}
		vector<pair<int,int> >_all,_single;
		vector<int>all(h+1),single(h+1);
		for(cin>>i;i--;){
			cin>>str>>m>>str>>d;
			if(d){
				if(str=="All")_all.push_back(make_pair(m,d));
				else _single.push_back(make_pair(m,d));
			}
		}
		for(i=1;i<=h;i++){
			all[i]=9999999;//(h+_all[0].second-1)/_all[0].second*_all[0].first;
			single[i]=9999999;//(h+_single[0].second-1)/_single[0].second*_single[0].first;
			for(j=0;j<_all.size();j++){
				all[i]=min(all[i],all[max(0,i-_all[j].second)]+_all[j].first);
			}
			for(j=0;j<_single.size();j++){
				single[i]=min(single[i],single[max(0,i-_single[j].second)]+_single[j].first);
			}
		}
		if(all.empty()){
			for(r=j=0;j<monster.size();j++)r+=single[monster[j]];
		}else if(single.empty()){
			r=all[h];
		}else{
			r=9999999;//(h+all[h]-1)/all[h];
			for(i=0;i<=h;i++){
				s=all[i];
				for(j=0;j<monster.size();j++)s+=single[max(0,monster[j]-i)];
				//cout<<i<<' '<<s<<' '<<all[i]<<endl;
				if(r>s)r=s;
			}
		}
	}
}

Measured memory_bytes: 1968
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

struct edge{
    int to, c, h, r;
    edge(int to, int c, int h, int r) : to(to), c(c), h(h), r(r) {}
};

struct State{
    int v, c, h;
    State(int v, int c, int h) : v(v), c(c), h(h) {}
    bool operator<(const State& right) const {
        return c > right.c;
    }
};

const int INF = 1000000000;
int pass[1<<9];
int dp[102][26];

int main(){
    while(true){
        int N, M, H, K;
        cin >> N >> M >> H >> K;
        if(N == 0) break;

        vector<vector<edge>> G(N);
        for(int i=0;i<M;i++){
            int a, b, c, h, r;
            cin >> a >> b >> c >> h >> r;
            a--; b--; r--;
            G[a].emplace_back(b, c, h, r);
            G[b].emplace_back(a, c, h, r);
        }

        int S, T;
        cin >> S >> T;
        S--; T--;

        int P;
        cin >> P;

        memset(pass, -1, sizeof(pass));
        pass[0] = 0;
        for(int i=0;i<P;i++){
            int l, d;
            cin >> l >> d;
            int bit = 0;
            for(int j=0;j<l;j++){
                int k;
                cin >> k;
                bit |= (1 << (k-1));
            }
            for(int j=0;j<(1<<K);j++){
                if(pass[j] != -1){
                    int nbit = j | bit;
                    if(pass[nbit] != -1) pass[nbit] = min(pass[nbit], pass[j] + d);
                    else pass[nbit] = pass[j] + d;
                }
            }
        }

        int ans = INF;
        for(int i=0;i<(1<<K);i++){
            if(pass[i] == -1) continue;
            priority_queue<State> que;
            que.emplace(S, 0, 0);

            memset(dp, -1, sizeof(dp));
            dp[S][0] = 0;

            while(que.size()){
                State s = que.top();
                if(s.v == T) break;
                que.pop();
                if(dp[s.v][s.h] < s.c) continue;
                for(edge& e : G[s.v]){
                    int nc = s.c + (((i >> e.r)&1) == 1 ? 0 : e.c);
                    int nh = s.h + e.h;
                    if(nh > H) continue;
                    if(dp[e.to][nh] == -1 || dp[e.to][nh] > nc){
                        dp[e.to][nh] = nc;
                        que.emplace(e.to, nc, nh);
                    }
                }
            }
            if(que.size()) ans = min(ans, pass[i] + que.top().c);
        }

        if(ans != INF) cout << ans << endl;
        else cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3212
#include <iostream>
#include <string>
#include <vector>
using ll=long long;
using namespace std;

int main(){
    ll X,K,D;
    cin>>X>>K>>D;

    if(X<0){
        X*=-1;
    }
    ll ans;

    ll plusmin=X/D;
    if(K>plusmin){
        K-=plusmin;
        if(K%2==0){
            ans=X%D;
        }else{
            ans=D-X%D;
        }
    }else{
        ans=X-K*D;
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3636
n=int(input())
oristr=input()
max=0
for i in range(n-1):
  former=oristr[0:i+1]
  latter=oristr[i+1:n]
  common=0
  for j in range(26):
    if chr(j+97) in former and chr(j+97) in latter:
      common+=1
  if max<=common:
    max=common
print(max)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
 
int main() {
  string A, B;
  cin>>A>>B;
  
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  reverse(B.begin(), B.end());
  if(A<B){
    cout << "Yes";
    return 0;
  }
  cout << "No";
}

Measured memory_bytes: 3632
N, M = map(int, input().split())

A = []
for _ in range(N):
  A.append(input().strip())
B = []
for _ in range(M):
  B.append(input().strip())

def f():
  for i in range(N - M + 1):
    for j in range(N - M + 1):
      same = True
      for ii in range(M):
        for jj in range(M):
          if B[ii][jj] != A[i + ii][j + jj]:
            same = False
      if same:
        print("Yes")
        return 
  print("No")

f()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<cctype>
#include<cstring>
#include<list>
#include<map>
#include<sstream>
#include<set>
#include<string>
#include<vector>
typedef long long ll;
using namespace std;
#define MN 300005
#define MM 600005
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define F2(i,a,b) for(int i=a;i<(b);++i)
#define RF(i,a,b) for(int i=a;i>=(b);--i)
#define fast  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define int long long
signed main()
{
   int n,m;
   cin>>n>>m;
   int sum=n;
   for(int i=0;i<m;i++){
       int t;
       cin>>t;
       sum-=t;
   }
   if(sum>=0)cout<<sum<<endl;
   else cout<<-1<<endl;
   return 0;
}


Measured memory_bytes: 3632
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		while(n!=0){
			int sum=in.nextInt();
			int ans=sum;
			for(int i=1;i<n;i++){
				int x=in.nextInt();
				sum=Math.max(sum+x,x);
				ans=Math.max(ans,sum);
			}
			n=in.nextInt();
			System.out.println(ans);
		}
		in.close();
	}
}

Measured memory_bytes: 33332
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli n;

void output(pdd x){
    printf("%.12lf %.12lf\n",x.first,x.second);
}

void coch(pdd from,pdd to,lli d){
    if(d == 0){
        output(from);
        return;
    }
    pdd s = pdd((from.first*2+to.first)/3,(from.second*2+to.second)/3);
    pdd t = pdd((from.first+to.first*2)/3,(from.second+to.second*2)/3);
    pdd t_s = pdd(t.first-s.first,t.second-s.second);
    pdd u = pdd(s.first+t_s.first/2-t_s.second*sqrt(3.0)/2,s.second+t_s.first*sqrt(3.0)/2+t_s.second/2);
    coch(from,s,d-1);
    coch(s,u,d-1);
    coch(u,t,d-1);
    coch(t,to,d-1);
}

int main(){
    cin >> n;
    coch(pdd(0,0),pdd(100,0),n);
    output(pdd(100,0));
    return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
#include <map>
#include <set>
using namespace std;

int main() {
    long long n, m;
    cin >> n >> m;
    vector<pair<long long, long long>> v;
    for (long long i = 0;i < n;i++) {
        long long a, b;
        cin >> a >> b;
        v.push_back(make_pair(a, b));
    }
    sort(v.begin(), v.end());
    long long ans = 0;
    long long j = 0;
    while (m > 0) {
        ans += v[j].first * v[j].second;
        m -= v[j].second;
        j++;
    }
    ans += v[j - 1].first * m;
    cout << ans << endl;
}



Measured memory_bytes: 2420
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<VE>f(n, VE(10));
	rep(i, n)rep(j, 10)cin >> f[i][j];
	vector<VE>p(n, VE(11));
	rep(i, n)rep(j, 11)cin >> p[i][j];
	int ans = -INF;
	rep(bit, (1 << 10)) {
		int now = 0;
		if (bit == 0)continue;
		VE cnt(n);
		rep(i, 10) {
			if (bit & (1 << i)) {
				rep(j, n) {
					if (f[j][i])cnt[j]++;
				}
			}
		}
		rep(i, n) {
			now += p[i][cnt[i]];
		}
		chmax(ans, now);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<string.h>
#include<unistd.h>
#include<stdio.h>
 
int main(){
  int i;
  int sum = 0;
  int divider = 10;
  int temp;
  scanf("%d",&i);
  temp = i;
  while(1){
    sum = sum + i % divider;
    i = i / divider ;
    if (i==0){
      break;
    }
  }
  if(temp%sum==0){
    printf("Yes");
  }
  else{
    printf("No");
  }
}

Measured memory_bytes: 128
from itertools import chain
 
double = lambda c: int(c)*2
 
N = int(input())
T = tuple(map(double,input().split()))
V = tuple(map(double,input().split()))
 
dp = [0]
 
for t,v_max,vf_max in zip(T,V,chain(V[1:],(0,))):

  ndp = [None]*(min(vf_max,v_max)+1)
  
  for vf in range(len(ndp)):
    vi = min(len(dp)-1,vf+t)
    while vi >= 0 and dp[vi] is None:
      vi -= 1

    if vi < max(0,vf-t):
      ndp[vf] = None
    else:
      vp = (vf+t+vi)/2
      ndp[vf] = dp[vi] + 2*vp*vp-vf*vf-vi*vi - 2*max(0,vp-v_max)**2
  dp = ndp
 
print(dp[0]/8)

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

int main(){
  int N;
  cin >> N;
  vector<int> L(N);
  rep(i,N)
    cin >> L.at(i);
  sort(L.begin(),L.end());
  int sum = 0;
  rep(i,N-1)
    sum += L.at(i);
  if(sum>L.at(N-1))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int N;
string s;
char ans[100000];

#define other(c) (c == 'S' ? 'W' : 'S')

bool correct(char first, char second)
{
	bool ret = true;

	ans[0] = first;
	ans[1] = second;

	repc(i, 1, N - 2) {
		if (ans[i] == 'S' && s[i] == 'o') ans[i + 1] = ans[i - 1];
		else if (ans[i] == 'S' && s[i] == 'x') ans[i + 1] = other(ans[i - 1]);
		else if (ans[i] == 'W' && s[i] == 'o') ans[i + 1] = other(ans[i - 1]);
		else if (ans[i] == 'W' && s[i] == 'x') ans[i + 1] = ans[i - 1];
	}

	if (ans[N - 1] == 'S' && s[N - 1] == 'o' && ans[0] != ans[N - 2]) ret = false;
	if (ans[N - 1] == 'S' && s[N - 1] == 'x' && ans[0] == ans[N - 2]) ret = false;
	if (ans[N - 1] == 'W' && s[N - 1] == 'o' && ans[0] == ans[N - 2]) ret = false;
	if (ans[N - 1] == 'W' && s[N - 1] == 'x' && ans[0] != ans[N - 2]) ret = false;

	if (ans[0] == 'S' && s[0] == 'o' && ans[1] != ans[N - 1]) ret = false;
	if (ans[0] == 'S' && s[0] == 'x' && ans[1] == ans[N - 1]) ret = false;
	if (ans[0] == 'W' && s[0] == 'o' && ans[1] == ans[N - 1]) ret = false;
	if (ans[0] == 'W' && s[0] == 'x' && ans[1] != ans[N - 1]) ret = false;

	return ret;
}

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

	if (correct('S', 'S')) {}
	else if (correct('S', 'W')) {}
	else if (correct('W', 'S')) {}
	else if (correct('W', 'W')) {}
	else {
		cout << -1 << endl;
		return 0;
	}

	rep(i, N) printf("%c", ans[i]);
	putchar('\n');

	return 0;
}


Measured memory_bytes: 640