akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
typedef long long ll;
using namespace std;

int ans[2001][2001];

int main(void){
  string s[2001];
  int i,j,k,h,w,tmp,d;
  
  cin>>h>>w;
  for(i=0;i<h;i++){
    cin>>s[i];
  }
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      ans[i][j]=0;
    }
  }
  
  for(i=0;i<h;i++){
    tmp=-1;
    for(j=0;j<w;j++){
      if(s[i][j]=='#'){
        d=j-tmp-1;
        for(k=tmp+1;k<j;k++){
          ans[i][k]+=d;
        }
        tmp=j;
      }
    }
    d=j-tmp-1;
    for(k=tmp+1;k<j;k++){
      ans[i][k]+=d;
    }
  }
  
  for(i=0;i<w;i++){
    tmp=-1;
    for(j=0;j<h;j++){
      if(s[j][i]=='#'){
        d=j-tmp-1;
        for(k=tmp+1;k<j;k++){
          ans[k][i]+=d;
        }
        tmp=j;
      }
    }
    d=j-tmp-1;
    for(k=tmp+1;k<j;k++){
      ans[k][i]+=d;
    }
  }

  int max=0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(max<ans[i][j]){
        max=ans[i][j];
      }
    }
  }

  cout<<max-1<<endl;
  return 0;
}

Measured memory_bytes: 19968
#include<stdio.h>
#define MAX 100
#define INF 999999
#define NIL -1
#define WHITE 0
#define BLACK 2

int prim();

int n, G[MAX][MAX];

int main()
{
  int i, j;

  scanf("%d", &n);
  for(i=0; i<n; i++)
    {
      for(j=0; j<n; j++)
	{
	  scanf("%d", &G[i][j]);
	}
    }
  
  printf("%d\n", prim());
  
  return 0;
}

int prim()
{
  int u, i, v, mincost, d[n], pi[n], color[n], sum=0;

  for(u=0; u<n; u++)
    {
      d[u] = INF;
      pi[u] = NIL;
      color[u] = WHITE;
    }

  d[0] = 0;
  while(1)
    {
      mincost = INF;

      for(i=0; i<n; i++)
	{
	  if(color[i] != BLACK && d[i] < mincost)
	    {
	      mincost = d[i];
	      u = i;
	    }
	}
      
      if(mincost == INF) break;
      
      color[u] = BLACK;
      
      for(v=0; v<n; v++)
	{
	  if(color[v] != BLACK && G[u][v] < d[v] && G[u][v] != -1)
	    {
	      pi[v] = u;
	      d[v] = G[u][v];
	    }
	}
    }

  for(i=0; i<n; i++)
    {
      if(d[i] != INF) sum += d[i];
    }

  return sum;
}

Measured memory_bytes: 632
#include<cstdio>
#include<cmath>

struct Point{
  double x;
  double y;
  
  void print(){
    std::printf("%f %f\n",x,y);
  }
};

void koch(int n,Point p1,Point p2){
  Point s,t,u;
  
  if(n == 0) return;
  
  s.x = (2 * p1.x + p2.x) / 3.0;
  s.y = (2 * p1.y + p2.y) / 3.0;
  t.x = (p1.x + 2 * p2.x) / 3.0;
  t.y = (p1.y + 2 * p2.y) / 3.0;
  
  u.x = (t.x - s.x) * cos(60.0 * M_PI / 180.0)
    - (t.y - s.y) * sin(60.0 * M_PI / 180.0) + s.x;
  
  u.y = (t.x - s.x) * sin(60.0 * M_PI / 180.0)
    + (t.y - s.y) * cos(60.0 * M_PI / 180.0) + s.y;
  
  koch(n - 1,p1,s);
  s.print();
  koch(n - 1,s,u);
  u.print();
  koch(n - 1,u,t);
  t.print();
  koch(n - 1,t,p2);
}

int main(){
  int n;
  Point p1,p2;
  
  std::scanf("%d",&n);
  
  p1.x = 0.0;
  p1.y = 0.0;
  p2.x = 100.0;
  p2.y = 0.0;
  
  p1.print();
  koch(n,p1,p2);
  p2.print();
  
  return 0;
}


Measured memory_bytes: 2732
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

#define INF 100000000000

using namespace std;

typedef long long ll;

int main() {
    ll H, N;
    cin >> H >> N;
    vector<pair<ll, ll>> eqp;
    ll max_a = 0;
    for (ll i=0; i<N; ++i) {
        ll a, b;
        cin >> a >> b;
        max_a = max_a < a ? a : max_a;
        eqp.emplace_back(pair<ll, ll>{a, b});
    }

    // 初期化
    ll dp[H+max_a];
    for (ll i=0; i<H+max_a; ++i) {
        dp[i] = INF;
    }
    dp[0] = 0;

    for (ll i=0; i<H+max_a; ++i) {
        for (ll j=0; j<eqp.size(); j++) {
            if (0 <= i - eqp[j].first) {
                dp[i] = min(dp[i], dp[i - eqp[j].first] + eqp[j].second);
            }
        }
    }

    ll res = INF;
    for (ll i=H; i<H+max_a; ++i) {
        res = min(res, dp[i]);
    }

    cout << res << endl;

    return 0;

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=605;
const ll P=37,Q=89;
int n,ans;
ll a[N][N],b[N][N],p[N][N],q[N][N],d[N];
char c[N][N];
void work(ll a[][N],ll p[][N]){
	for(int i=1;i<=n;i++){
		for(int k=1;k<=n;k++)d[k]=a[1][k];
		for(int j=1;j<n;j++)
			for(int k=1;k<=n;k++)a[j][k]=a[j+1][k];
		for(int k=1;k<=n;k++)a[n][k]=d[k];
		memset(d,0,sizeof(d));
		for(int j=1;j<=n;j++)
			for(int k=1;k<=n;k++)d[j]=d[j]*P+a[k][j];
		for(int j=1;j<=n;j++){
			p[i][j]=0;
			for(int k=0;k<n;k++)p[i][j]=p[i][j]*Q+d[(j+k-1)%n+1];
		}
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%s",c[i]+1);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)a[i][j]=c[i][j];
	work(a,p);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)b[i][j]=c[j][i];
	work(b,q);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)if(p[i][j]==q[j][i])ans++;
	printf("%d\n",ans);
	return 0;
}


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

struct UnionFind {
  vector<int> d;

  UnionFind(int n=0): d(n,-1) {}

  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }

  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }

  bool same(int x, int y) { return find(x) == find(y);}
  
  int size(int x) { return -d[find(x)];}
};

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

  UnionFind uf(n);

  rep(i,m){
    int a,b;
    cin >> a >> b;
    --a;
    --b;
    uf.unite(a,b);
  }

  int ans = 0;
  rep(i,n) ans = max(ans,uf.size(i));

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }

constexpr int MOD = 1000000007;

int main()
{
    int N, L = 0;
    cin >> N;

    vector<int> st(N * 2 + 1);
    REP(_, N)
    {
        int A, B;
        cin >> A >> B;
        if (A < 0 and B > 0) st[B] = 1;
        else if (A > 0 and B < 0) st[A] = 1;
        else if (A > 0 and B > 0) st[A] = st[B] = 2;
        else L++;
    }

    vector<vector<lint>> dp[2];
    REP(d, 2) ndarray(dp[d], N + 1, N + 1);
    dp[0][0][0] = 1;

    int G = 0, H = 0, t = 0;

    REP(i, 2 * N)
    {
        int n = 2 * N - i;
        REP(j, N + 1) REP(k, N + 1) dp[(i + 1) & 1][j][k] = 0;
        REP(j, N + 1) REP(k, N + 1) if (dp[i & 1][j][k])
        {
            int pa2 = G - j - k - (H - k) * 2;
            if (st[n] == 1)
            {
                // 既に見えている
                if (k < N) (dp[(i + 1) & 1][j][k + 1] += dp[i & 1][j][k]) %= MOD;
                if (j) (dp[(i + 1) & 1][j - 1][k] += dp[i & 1][j][k]) %= MOD;
            }
            else if (st[n] == 2)
            {
                // 既にペアまで決まっている（のでなにもしない）
                dp[(i + 1) & 1][j][k] = dp[i & 1][j][k];
            }
            else
            {
                // 見えていない
                if (j < N) (dp[(i + 1) & 1][j + 1][k] += dp[i & 1][j][k]) %= MOD;
                if (j) (dp[(i + 1) & 1][j - 1][k] += dp[i & 1][j][k] * (lint)(L - pa2 / 2) % MOD) %= MOD;
                if (k) (dp[(i + 1) & 1][j][k - 1] += dp[i & 1][j][k] * k) %= MOD;
            }
        }
        G += (st[n] <= 1);
        H += (st[n] == 1);
    }
    cout << dp[0][0][0] << endl;
}


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

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

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
 for(int i=0; i<N; i++){
   string j;
   cin >> j;
   if(j =="Y"){
     cout << "Four" <<endl;
   break;}
   if(i<N-1){
     continue;}
   else{
     cout << "Three" <<endl;}   
 }
}

Measured memory_bytes: 3596
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;

inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || '9'<ch){if(ch=='-')f=-1;ch=getchar();}
	while('0'<=ch && ch<='9')x=x*10+(ch^48),ch=getchar();
	return x*f;
}

char s[100];

int main()
{
	scanf("%s",s+1);
	int len=strlen(s+1);
	for(int i=1;i<=len-8;i++)
		putchar(s[i]);
	puts("");

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
using namespace std;
// I hope you understand what i have coded :D , All the best
// shubhamk840@gmail.com
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define endl '\n'
#define stackofi stack<int>
#define queueofi queue<int>  
#define vectoriterator vector<int>::iterator
#define mapiterator map<int,int>::iterator
#define setiterator set<int>:: iterator
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define MOD 1000000007
// macros for inputting 1-D and 2-D array.
#define stringiterator string:: iterator
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ai(arr,n) for(int i=0;i<n;i++)cin>>arr[i];
#define ao(arr) for(auto wtf:arr) cout<<wtf<<" ";
#define mi(arr,m,n) for(int i=0;i<m;i++){ for(int j=0;j<n;j++) cin>>arr[i][j];}
#define mo(arr,m,n) for(int i=0;i<m;i++){ for(int j=0;j<n;j++) cout<<arr[i][j]<<" "; cout<<endl;}
#define countsetbits(x) __builtin_popcount(x)
#define ll long long
#define debugger cout<<"I AM EXECUTING"<<endl
#define debug(x) cout<<#x<<"->"<<x<<endl;
#define F first
#define S second
#define testcases int asdf; cin>>asdf; while(asdf--)
#define space cout<<endl
#define vi vector<int>
#define si set<int>
#define vc vector<char>
#define sc set<char>
#define vll vector<long long int>
#define vs vector<string>
#define vpp vector<pair<int,int>> 
#define mp make_pair
string sconvert(int n)
{
	stringstream ss;
	ss<<n;
	string str = ss.str();
	return str;
}
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second > b.second); 
}
template<typename KeyType, typename ValueType>  // for finding max element in the map.
std::pair<KeyType,ValueType> get_max( const std::map<KeyType,ValueType>& x ) {
  using pairtype=std::pair<KeyType,ValueType>; 
  return *std::max_element(x.begin(), x.end(), [] (const pairtype & p1, const pairtype & p2) {
        return p1.second < p2.second;
  }); 
}

int add(int a, int b, int mod = MOD) {
    if (a + b >= mod) {
        return a + b - mod;
    }
    return a + b;
}
 
int sub(int a, int b, int mod = MOD) {
    if (a - b < 0) {
        return a - b + mod;
    }
    return a - b;
}
 
int mul(int a, int b, int mod = MOD) {
    return (int)(1ll * a * b % mod);
}


int  single()
{
	
	vi arr(5);
	ai(arr,5);
	for(int i=0;i<5;i++)
	if(arr[i]==0)
	{
		cout<<i+1<<endl;
		return 0;
	}
	return 0;
}
void multiple()
{
	testcases
    {
		single();
	}
}

int main()
{
  IOS;
  single();
  
}















Measured memory_bytes: 3580
N = int(input())
H = [int(i) for i in input().split()]

C = [0] * N

C[-1] = False
for i in range(len(H)-1):
    if H[i+1] <= H[i]:
        C[i] = True
    else:
        C[i] = False

res = 0
tmp = 0
for i in range(len(C)):
    if C[i]:
        tmp += 1
    else:
        res = max(res,tmp)
        tmp = 0

print(res)

Measured memory_bytes: 14252
n,m=gets.split.map &:to_i
s=[]
ans=0
n.times do |i|
  k,*s[i]=gets.split.map &:to_i
end
(1..m).to_a.each{|j|
  dame=0
  for i in 0..s.size-1
    if s[i].include?(j)
    else
      dame=1
    end
  end
  ans+=1 if dame==0
}
puts ans


Measured memory_bytes: 14336
using namespace std;
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
void solve()
{
int n;
cin>>n;
int i=1;
while((i*n)%360)
{
	//cout<<i<<endl;
	i++;
}
cout<<i<<endl;
}
int main()
{

FASTIO
solve();
  return 0;
}


Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        Integer n = Integer.valueOf(arr01[0]);

        List<String> list = new ArrayList<>();
        for (int i = 1; i < 1 + n; i++) {
            String temp = mylist.get(i);

            char[] c = temp.toCharArray();
            Arrays.sort(c);
            String str1 = new String(c);
            list.add(str1);

        }

        //昇順でソート
        //        Collections.sort(list);

        HashMap<String, Integer> map = new HashMap<String, Integer>();

        for (int i = 0; i < list.size(); i++) {

            if (map.containsKey(list.get(i))) {
                int val = map.get(list.get(i));
                map.put(list.get(i), val + 1);
            } else {
                map.put(list.get(i), 1);
            }

        }

        long mysum = 0;
        for (Integer v : map.values()) {
            long ans_temp = (long) v * (v - 1);
            mysum += ans_temp / 2;
        }

        System.out.println(mysum);

    }
}


Measured memory_bytes: 53072
#include<iostream>
#include<vector>
#include<algorithm>
#define inf 1000000009
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	vector<int> dp(n,inf);
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	dp[0]=0;
	for(int i=0;i<n;i++){
		for(int j=1;j<=k;j++){
			if(i+j<n){
				dp[i+j]=min(dp[i+j],dp[i]+abs(a[i]-a[i+j]));
			}
		}
	}
	cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
//#define M 1000000007
#define N 100001
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll n, x, m;
unordered_map<int,int> M;     // value found -> at index
ll prefSum[N];
void printArray(int*, int);

int main() {
    scanf("%lld %lld %lld", &n, &x, &m);
    ll ans = x, curr, prev = x, i;
    prefSum[0] = x;     M[x] = 0;

    for(i=1; i<n; i++) {
        curr = (prev * prev) % m;

        if(M.find(curr) == M.end()) {
            M[curr] = i;
            prefSum[i] = curr + prefSum[i - 1];
            ans += curr;
        }
        else
            break;    

        prev = curr;
    }

    if(i != n) {
        ll rem = n - i;
        ll cycleLen = i - M[curr];
        ll cycleSum = (M[curr] == 0) ? prefSum[i - 1]: prefSum[i - 1] - prefSum[M[curr] - 1];

        ans += (rem / cycleLen) * cycleSum;
        
        rem = rem % cycleLen;
        ll extraSum = (M[curr] == 0) ? prefSum[rem - 1]: prefSum[M[curr] + rem - 1] - prefSum[M[curr] - 1];

        ans += extraSum;
    }

    printf("%lld\n", ans);
	return 0;
}

void printArray(int *nums, int n) {
    for(int i=0; i<n; i++) printf("%d ", nums[i]);
    printf("\n");
}

Measured memory_bytes: 5704
// Copyright 2020 yaito3014
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int X;
  cin >> X;
  cout << (X / 500 * 1000 + X % 500 / 5 * 5) << endl;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    mean = round(sum(A)/N)
    cost = 0
    for i in range(N):
        cost += (A[i]-mean)**2
    print(cost)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
# coding: utf-8
# Your code here!

from collections import defaultdict

N, M = map(int, input().rstrip().split(' '))
if M == 0:
    A = [0]
else:
    A = sorted([int(input()) for _ in range(M)]) + [N + 1]
    
dp = [0] * (N+1)
dp[0] = 1
if A[0] != 1:
    dp[1] = 1
    index_A = 0
else:
    dp[1] = -1
    index_A = 1
    
for i in range(2,N+1):
    if A[index_A] == i:
        dp[i] = -1
        index_A += 1
    else:
        if dp[i-1] != -1:
            dp[i] += dp[i-1]
        if dp[i-2] != -1:
            dp[i] += dp[i-2]
            
print(dp[N] %  (1000000007))


Measured memory_bytes: 468932
#include <cstdio>
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
using namespace std;

int fib[45] = {1, 1};

signed main()
{
   cin.tie(0), ios::sync_with_stdio(false);
   int n;
   cin >> n;
   for(int i=2; i<=n; ++i){
      fib[i] = fib[i-1] + fib[i-2];
   }
   outl( fib[n] );
}




Measured memory_bytes: 3136
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;


int main(void){
	int n; cin >> n;
	vector<int> data;

	for(int i = 0; i < n; i++){
		int tmp;
		cin >> tmp;
		data.push_back(tmp);
	}

	int s1,s2,ans;
	ans = 1000;

	

	for(int i = 1; i < n; i++){
		s1 = 0; s2 = 0;

		for(int t = 0; t < i; t++){
			s1 = s1 +data[t];
		}
		for(int t = i ; t < data.size(); t++){
			s2= s2 +data[t];
		}

		if(s1 - s2 > 0){
			if(s1 - s2 < ans){
				ans = s1 - s2;
			} 
		} else {
			if(s2 - s1 < ans){
				ans = s2 - s1;
			}
		}

	}

	cout << ans << endl;
}

Measured memory_bytes: 256
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"yx
axy"# => r#"Yes"#,
r#"ratcode
atlas"# => r#"Yes"#,
r#"cd
abc"# => r#"No"#,
r#"w
ww"# => r#"Yes"#,
r#"zzz
zzz"# => r#"No"#,
}


fn solve(src: &str) -> String {
    input! {
        source = src,
        mut s: chars,
        mut t: chars,
    }
    s.sort();
    t.sort();
    t.reverse();

    let mut ans = "Yes";

    for i in 0..s.len() {
        if t.len() <= i || s[i] > t[i] || (i == s.len() - 1 && s.len() == t.len() && s[i] == t[i]) {
            ans = "No";
            break;
        }
        if s[i] < t[i] {
            break;
        }
    }

    ans.to_string()
}

Measured memory_bytes: 4352
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100;
const int MAXCAP=100000;


int n,cap;
int cost[MAXN],val[MAXN];

ll dp[MAXCAP+1];

ll solve() {
	memset(dp,0,sizeof(dp));
	REP(i,n) for(int j=cap;j>=cost[i];--j) dp[j]=max(dp[j],dp[j-cost[i]]+val[i]);
	ll ret=0; REPE(j,cap) ret=max(ret,dp[j]); return ret;
}

void run() {
	scanf("%d%d",&n,&cap);
	REP(i,n) scanf("%d%d",&cost[i],&val[i]);
	printf("%lld\n",solve());
}

int main() {
	run();
	return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

template<typename FI,typename Compare>
pair<FI,FI> search_continuous(FI first,FI last,Compare comp){
	FI top = find_if(first,last,comp);
	if(top==last){
		return make_pair(last,last);
	}
	FI end = find_if_not(top,last,comp);
	return make_pair(top,end);
}

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

	int N=in();
	vector<string> V(N),W;
	REP(i,N){
		V[i] = in<string>();
		sort(ALL(V[i]));
	}
	sort(ALL(V));
	ll sum = 0;
	auto start = V.begin(),end = V.end();
	while(start!=end){
		auto res = search_continuous(start,end,[&](string s){return s==*start;});
		ll dist = distance(res.first,res.second);
		sum += dist*(dist-1)/2;
		start = res.second;
	}

	out(sum);
	return 0;
}


Measured memory_bytes: 5760
s=input()
k=int(input())
mydict=set()
while(1):
    tmp=[]
    for i in range(0,len(s)):
        if(s[i] in mydict):
            continue
        if(len(tmp)==0):
            tmp.append(i)
            continue
        if(s[i] < s[tmp[0]]):
            tmp=[i]
        elif(s[i] == s[tmp[0]]):
            tmp.append(i)
    for i in tmp:
        for j in range(k):
            try:
                mydict.add(s[i:i+j+1])
            except:
                pass
    if(len(mydict)>=k):
        break

result=list(mydict)
result.sort()
print(result[k-1])

Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#define START(a) (a>0?a:0)
int s,ans,ttt,a,b,c,t[1000][1000];
int main(void){
	while(scanf("%d",&s)!=EOF){
		ans=0;
		for(a=START(s-3000);a<=1000 && s>=a;a++){
			for(b=START(s-a-2000);b<=1000 && s>=a+b;b++){
				ans+=1001-abs(1000-(s-a-b));
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define LEN 100000
/*typedef struct pp{
char name[100];
int t;
}P;*/
pair<string,int> Q[LEN+10];
pair<string,int> tmp;
//P Q[LEN+10];
int n,q,t=0;
queue<pair<string,int>> R;

/*int solve(int a){
  if(a<=q) return a;
  else return a-q;
}*/

int main(){
  cin >> n >> q;
  for(int i=0;i<n;++i){
    //scanf("%s", Q[i].first);
    //scanf("%d", &Q[i].second);
    cin >> Q[i].first >> Q[i].second;
    R.push(Q[i]);
  }
  while(! R.empty()){
    if(get<1>(R.front())<=q){
      t+=get<1>(R.front());
      cout << get<0>(R.front()) << " " << t << endl;
      R.pop();
    }
    else{
      t+=q;
      get<1>(R.front())-=q;
      tmp=R.front();
      R.pop();
      R.push(tmp);
    }
  }

  return 0;
}



Measured memory_bytes: 7944
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;

int H,W, dist[10], c[10][10];
ll cost = 0;

void process() {
    F0R(i,10) dist[i] = MOD;
    priority_queue<pii,vector<pii>,greater<pii>> pq;
    pq.push({0,1}); dist[1] = 0;
    while (pq.size()) {
        pii x = pq.top(); pq.pop();
        if (x.f > dist[x.s]) continue;
        F0R(i,10) if (c[i][x.s]+x.f < dist[i]) {
            dist[i] = c[i][x.s]+x.f;
            pq.push({dist[i],i});
        }
    }
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> H >> W;
    F0R(i,10) F0R(j,10) cin >> c[i][j];
    process();
    F0R(i,H) F0R(j,W) {
        int A; cin >> A;
        if (A != -1) cost += dist[A];
    }
    cout << cost;
}

// read!
// ll vs. int!

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

using namespace std;

#define MAX 1000000

int three_seg(long long h, long long w)
{
	long long S[5];
	long long ans = MAX;
	long long min_v, max_v;
	
	for (int l = 1; l < h; l++)
	{
		long long wd = w / 2;
		long long hd = (h - l) / 2;

		S[0] = l * w;
		S[1] = (h - l) * wd;
		S[2] = (h - l) * (w - wd);
		S[3] = hd * w;
		S[4] = ((h - l) - hd) * w;

		min_v = min(min(S[0], S[1]), S[2]);
		max_v = max(max(S[0], S[1]), S[2]);

		if (ans > max_v - min_v)
			ans = max_v - min_v;

		min_v = min(min(S[0], S[3]), S[4]);
		max_v = max(max(S[0], S[3]), S[4]);

		if (ans > max_v - min_v)
			ans = max_v - min_v;
	}

	return ans;
}

int main()
{
	int H, W;
	cin >> H >> W;

	int ans = min(three_seg(H, W), three_seg(W, H));

	cout << ans << endl;

	return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n, k;
	cin >> n >> k;

	vector<int> v(n);
	for (auto &a : v) {
		cin >> a;
	}

	int ans = 0;
	for (int left = 0; left <= k; left++) {
		for (int right = 0; right <= k - left; right++) {
			if (left + right > n) {
				break;
			}

			int score = 0;
			vector<int> vec;

			for (int i = 0; i < left; i++) {
				score += v[i];
				vec.push_back(v[i]);
			}

			for (int i = n - right; i < n; i++) {
				score += v[i];
				vec.push_back(v[i]);
			}

			int d = k - left - right;

			sort(begin(vec), end(vec));
			for (int i = 0; i < d; i++) {
				if (i >= vec.size() || vec[i] >= 0) {
					break;
				}

				score -= vec[i];
			}
			ans = max(ans, score);
		}
	}

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


Measured memory_bytes: 256
X = int(input())
def primeCheck(n):
    if n==2:
        return True
    for divisor in range(2, int(n**(0.5)+1)):
        if n % divisor == 0:
            return False
    return True
while(True):
    if primeCheck(X):
        print(X)
        break
    X += 1

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int main()
{
	ll n,a,b;
	scanf("%lld %lld %lld",&n,&a,&b);
	if(a%2==b%2)
	{
		printf("%lld\n",(b-a)/2);
	}
	else
	{
		ll ret=a+(b-a-1)/2;
		ll na=n-b+1,nb=n-a+1;
		ret=min(ret,na+(nb-na-1)/2);
		printf("%lld\n",ret);
	}
	return 0;
}

Measured memory_bytes: 256
n,d=map(int,input().split())
x =[0]*n
y=[0]*n

import math

for i in range(n):
    x[i],y[i]=map(int,input().split())

cnt=0
for elem in zip(x,y):
    if (math.sqrt(elem[0]**2+elem[1]**2) <=d):
        cnt+=1

print(cnt)

Measured memory_bytes: 24680
package main

import (
	"fmt"
	"math"
)

func main() {
	var N int
	fmt.Scanf("%d", &N)

	i := 0.
	count := 0
	for {
		min := int(math.Pow(10, i))
		max := int(math.Pow(10, i+1)) - 1
		if N < min {
			break
		} else if N < max {
			count += N - min + 1
			break
		} else {
			count += max - min + 1
		}
		i += 2
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;

class Program {
  static int n, m;
  static char[][] map;
  private static readonly int[] dy = new[] {1, -1, 0, 0};
  private static readonly int[] dx = new[] {0, 0, 1, -1};
  public static int Main() {
    Scanner cin = new Scanner();
    while (true)
    {
      n = cin.nextInt();
      m = cin.nextInt();
      if (n == 0 && m == 0)
      {
        break;
      }
      map = new char[m][];
      for (int i = 0; i < m; i++)
      {
        map[i] = cin.next().ToCharArray();
      }
      int b = 0, w = 0;
      for (int i = 0; i < m; i++)
      {
        for (int j = 0; j < n; j++)
        {
          if (map[i][j] == '.')
          {
            char color = getColor(j, i);
            if (color == 'B')
            {
              b += dfs(j, i, color);
            }
            if (color == 'W')
            {
              w += dfs(j, i, color);
            }
          }
        }
      }
      Console.WriteLine("{0} {1}", b, w);
    }
    return 0;
  }

  private static char getColor(int nowx, int nowy)
  {
    if (map[nowy][nowx] != '.')
    {
      return map[nowy][nowx];
    }
    map[nowy][nowx] = 'C';
    char res = '.';
    for (int i = 0; i < 4; i++)
    {
      if (nowy + dy[i] < 0 || nowy + dy[i] == m || nowx + dx[i] < 0 || nowx + dx[i] == n || map[nowy + dy[i]][nowx + dx[i]] == 'C')
      {
        continue;
      }
      char c = getColor(nowx + dx[i], nowy + dy[i]);
      if ((res != '.' && res != c && c != '.') || c == 'e')
      {
        res = 'e';
      }
      else if(c != '.')
      {
        res = c;
      }
    }
    return res;
  }

  private static int dfs(int nowx, int nowy, char color)
  {
    if (map[nowy][nowx] != 'C')
    {
      return 0;
    }
    map[nowy][nowx] = color;
    int res = 1;
    for (int i = 0; i < 4; i++)
    {
      if (nowy + dy[i] < 0 || nowy + dy[i] == m || nowx + dx[i] < 0 || nowx + dx[i] == n) {
        continue;
      }
      res += dfs(nowx + dx[i], nowy + dy[i], color);
    }
    return res;
  }

}

class Scanner {
  string[] s;
  int i;

  char[] cs = new char[] { ' ' };

  public Scanner() {
    s = new string[0];
    i = 0;
  }

  public string next() {
    if (i < s.Length) return s[i++];
    do {
      s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
    } while ((s.Length == 1 && s[0] == "") || s.Length == 0);
    i = 0;
    return s[i++];
  }

  public int nextInt() {
    return int.Parse(next());
  }

  public long nextLong() {
    return long.Parse(next());
  }

  public double nextDouble() {
    return double.Parse(next());
  }

}

Measured memory_bytes: 5904
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		long b = sc.nextLong();
		long c = sc.nextLong();
		// 文字列の入力
		if(a + b + c < 22){
			System.out.println("win");
		}else{
			System.out.println("bust");
		}
		
		
		
	}
}

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

int main(){
  string s,t;
  cin >> s >> t;
  bool ans=false;
  for(int i=0;i<s.size();i++){
  if(s==t){
    ans=true;
    break;
  }else{
    s=s.back()+s.substr(0,s.size()-1);
  }
  }
  if(ans){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{
    
    public static void main(String[] arg){
        Scanner scan =new Scanner(System.in);
        int x=scan.nextInt();
        int a=scan.nextInt();

        if(x<a){
            System.out.print(0);
        }
        else {
            System.out.print(10);
        }

    }
}

Measured memory_bytes: 21844
package main

import (
	"fmt"
	"math"
)

var S string
var ans int

func main() {
	fmt.Scan(&S)

	for i := 1; i < len(S)-1; i = i + 2 {
		for j := 0; j <= i/2; j++ {
			t := int(math.Ceil(float64(i) / 2))
			if S[j] == S[t+j] {
				if j == i/2 {
					ans = t * 2
				}
			} else {
				break
			}
		}
	}
	fmt.Println(ans)
}

/*  ----------------------------------------  */

func gcd(x, y uint64) uint64 {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}

func pow(x, y int) uint64 { return uint64(math.Pow(float64(x), float64(y))) }
func abs(x int) int       { return int(math.Abs(float64(x))) }
func floor(x int) int     { return int(math.Floor(float64(x))) }

type XY struct {
	x int
	y int
}

type SortBy [][]int

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	if a[i][0] == a[j][0] {
		return a[i][1] > a[j][1]
	}
	return a[i][0] > a[j][0]
}


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

signed main() {
#ifdef LOCAL
  assert(freopen("c.in", "r", stdin));
#endif
  string s;
  cin >> s;
  string t;
  int cnt = 0;
  vector<int> a;
  for (auto c : s) {
    if (c == 'x') {
      ++cnt;
    } else {
      a.push_back(cnt);
      cnt = 0;
      t += c;
    }
  }
  a.push_back(cnt);
  string tr = t;
  reverse(tr.begin(), tr.end());
  if (tr != t) {
    cout << -1 << '\n';
    return 0;
  }
  int len = int(a.size()) / 2;
  int res = 0;
  for (int i = 0; i < len; ++i) {
    res += abs(a[i] - a[int(a.size()) - i - 1]);
  }
  cout << res << '\n';
}

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

int main(){
    string s,t;
    cin>>s>>t;

    int ans = 10000000;

    for(int i=0; i<s.size() - t.size()+1; i++){
        int tmp = 0;
        for(int j=0; j<t.size(); j++){
            if(s[i+j] != t[j]) tmp++;
        }

        ans = min(ans,tmp);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ll inf = 1LL << 60;
const ld pi = (acos(-1));
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  string s; cin >> s;
  if(s=="ABC") cout << "ARC" << endl;
  if(s=="ARC") cout << "ABC" << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  
  cin>>A;
  cin>>B;
  if ((A*B)%2 == 0){
    cout<< "Even" <<endl;
  }
  else {
    cout<<  "Odd" <<endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 315;
const int MM = 1000000007;

int main()
{
	ll A, B, C;
	scanf("%lld%lld%lld", &C, &A, &B);
	if( A >= C ) printf("1\n");
	else if( A <= B ) printf("-1\n");
	else printf("%lld\n", (C-A+A-B-1) / (A-B) * 2 + 1);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const ll N=3e5;
using namespace std;
int city[N];
int main()
{
    int n,x;
    cin>>n>>x;
    for (int i=0;i<n; i++)
    {
        int t;
        cin>>t;
        city[i]=abs(x-t);
    }
    for (int i=0;i<n-1; i++)
    {
        while (city[i]!=0 && city[i+1]!=0)
        {
            if (city[i]>city[i+1])
            {
                 city[i]=city[i]%city[i+1];
                 continue;
            }
            if (city[i]<city[i+1])
            {
                 city[i+1]=city[i+1]%city[i];
                 continue;
            }
            break;
        }
        city[i+1]=max(city[i],city[i+1]);
        if (city[i+1]==1)
        {
            cout<<1;
            return 0;
        }
    }
    cout<<city[n-1];
}

Measured memory_bytes: 640
n = int(input())
s = list(int(input()) for _ in range(n))
s.sort()

if all(num % 10 == 0 for num in s):
    print(0)
else:
    if sum(s) % 10 == 0:
        for num in s:
            if num % 10 != 0:
                print(sum(s) - num)
                break
    else:
        print(sum(s))

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

int main(){
    int K;
    cin >> K;

    if(K % 2 != 0) {
        cout << (K / 2) * (K / 2 + 1) << endl;
    } else {
        cout << (K / 2) * (K / 2) << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

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

	vector<vector<pair<int,int> > > mp(n,vector<pair<int,int> >(n));

	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			mp[i][j]=make_pair(0,-1);

	for(int i=n-1;i>=0;i--)
	{
		for(int j=n-1;j>i;j--)
		{
			if(j==n-1)
			{
				if(s[i]==s[j])
				{
					mp[i][j]=make_pair(1,i);
				}
			}
			else
			{
				if(s[i]==s[j])
				{
					if(mp[i+1][j+1].first==0)
					{
						mp[i][j]=make_pair(1,i);
					}
					else
					{
						mp[i][j]=make_pair(mp[i+1][j+1].first+1,mp[i+1][j+1].second);
						if(mp[i][j].second==j)
						{
							mp[i][j].second--;
							mp[i][j].first--;
						}
					}
				}
			}
		}
	}

	int ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(mp[i][j].first>ans)ans=mp[i][j].first;
		}
	}

	cout << ans << endl;
}







Measured memory_bytes: 195968
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pii;
#define fi first
#define se second
#define mod 1000000007
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
map<string,ll> mp;
int main()
{
	ios;
	ll n,i;
	string s;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>s;
		mp[s]++;
	}
	cout<<mp.size()<<endl;
  for(int zz=0;zz<1000;zz++) if(zz%2==0) zz++; 
    for(int zz=0;zz<1000;zz++) if(zz%2==0) zz++; 
    for(int zz=0;zz<1000;zz++) if(zz%2==0) zz++; 
    for(int zz=0;zz<1000;zz++) if(zz%2==0) zz++; 
    for(int zz=0;zz<1000;zz++) if(zz%2==0) zz++; 
    for(int zz=0;zz<1000;zz++) if(zz%2==0) zz++; 
    for(int zz=0;zz<1000;zz++) if(zz%2==0) zz++; 
    for(int zz=0;zz<1000;zz++) if(zz%2==0) zz++; 
    for(int zz=0;zz<1000;zz++) if(zz%2==0) zz++; 
}


Measured memory_bytes: 19232
package main

import (
	"bufio"
	"fmt"
	"math"
	"math/rand"
	"os"
	"time"
)

var D int
var cs []int
var ss [][]int

func main() {
	D = ReadInt()
	cs = ReadInts(26)
	ss = make([][]int, D)
	for i := 0; i < D; i++ {
		ss[i] = ReadInts(26)
	}

	// naives
	answers := []int{}
	last := make([]int, 26)
	for d := 1; d <= D; d++ {
		maxT, maxScore := -1, math.MinInt32
		for i := 0; i < 26; i++ {
			s := ss[d-1][i] - cs[i]*(d-last[i])
			if s > maxScore {
				maxT, maxScore = i, s
			}
		}
		last[maxT] = d
		answers = append(answers, maxT+1)
	}

	rand.Seed(12345677)

	lastAnswers := answers
	lastScore := scores(lastAnswers)

	start := time.Now()
	timeout := 1930 * time.Millisecond
	for time.Now().Sub(start) < timeout {
		d, q := rand.Intn(D)+1, rand.Intn(26)+1
		// newAnswers := Dup(lastAnswers)
		orig := lastAnswers[d-1]
		lastAnswers[d-1] = q
		newScore := scores(lastAnswers)
		if newScore >= lastScore {
			lastScore = newScore
		} else {
			lastAnswers[d-1] = orig // revert
		}
	}

	for _, v := range lastAnswers {
		fmt.Println(v)
	}
}

func Dup(xs []int) []int {
	return append([]int{}, xs...)
}

func scores(answers []int) int {
	last := make([]int, 26)
	score := 0
	for d := 1; d <= D; d++ {
		t := answers[d-1] - 1
		score += ss[d-1][t]
		last[t] = d
		for i := 0; i < 26; i++ {
			score -= cs[i] * (d - last[i])
		}
	}
	return score
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 2064
N,T=map(int,input().split())
li=list(map(int,input().split()))
ans=0
if N==1:
  print(T)
else:
  for n in range(N-1):
    if T<li[n+1]-li[n]:
      ans+=T
    else:
      ans+=li[n+1]-li[n]
  ans+=T
  print(ans)


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

#define ll = long long;

using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()

using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair


int main() {
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
      cin>>a[i];
  }
  int y=0;
   long long int c=0,j=0,f=0,i=0;
  for(int i=1;i<n;i++){
      if(a[i]<a[i-1]){
          c+=a[i-1]-a[i];
          a[i]=a[i-1];
      }
      //cout<<c<<endl;
  }
   cout<<c<<endl;
 
}


Measured memory_bytes: 4392
using System;
using System.Text.RegularExpressions;

namespace AizuOnLine
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = string.Empty;

            while (true)
            {
                string str = Console.ReadLine();

                if (str == null)
                {
                    break;
                }

                input += str;
            }

            input = input.ToLower();

            for (int i = 97; i < 123; i++)
            {
                string test = Convert.ToChar(i).ToString();

                int before = input.Length;
                input = input.Replace(test, "");
                int after = input.Length;

                Console.WriteLine("{0} : {1}", test, before - after);
            }
        }
    }
}

Measured memory_bytes: 9340
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll l=1,r=1,tmp;
    while(r*r<N){
      l=r;
      r=2*r;
    }
    while(r-l>1){
      tmp=(l+r)/2;
      if(tmp*tmp>=N)r=tmp;
      if(tmp*tmp<=N)l=tmp;
    }
    if((l+1)*(l+1)<=N)l=l+1;
    cout << l*l <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;

bool ok=0;
string s,t,r;

void solve(){
	int pos=0;
	for(int i=0;i<t.size();i++){
		if(pos==r.size())break;
		if(t[i]==r[pos]){
			pos++;
		}
	}
	if(pos==r.size())ok=true;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> s >> t;
	r="";
	for(int i=0;i<s.size();i+=2){
		r+=s[i];
	}
	solve();
	r="";
	for(int i=1;i<s.size();i+=2){
		r+=s[i];
	}
	solve();
	if(ok){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
}


Measured memory_bytes: 3260
N = int(raw_input())
P = map(int, raw_input().split())

answer = 0

prev_bigger = P[0] < P[1]
for i in range(2, N):
    current_bigger = P[i-1] < P[i]
    if prev_bigger and current_bigger:
        answer += 1
    elif not prev_bigger and not current_bigger:
        answer += 1
    prev_bigger = current_bigger

print(answer)

Measured memory_bytes: 2568
#include <iostream>

int main(){
   int N, K, Q;
   std::cin >> N >> K >> Q;
   int A;
   int P[N];
   for(int i=0; i<N; ++i) P[i] = 0;
   for(int i=0; i<Q; ++i) {
      std::cin >> A;
      P[--A]++;
   }
   for(int i=0; i<N; ++i){
      if(Q-P[i]<K) std::cout << "Yes" << std::endl;
      else std::cout << "No" << std::endl;
   }
   return 0;

}


Measured memory_bytes: 1024
# B - Five Dishes
import numpy as np
n=[]
for i in range(5):
    t = int(input())
    n.append(t)
n = np.array(n)
dl = [0]
s = np.ceil(n/10)*10

if max(n%10)==0:
    print(int(np.sum(s)))
    exit()
m = [e for e in n%10 if e not in dl]
print(int(np.sum(s)-(10-min(m))))

Measured memory_bytes: 27208
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i, n, N) for(ll i=(n);i<(N);i++)
#define RREP(i, n, N) for(ll i=(N-1);i>=(n);i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(), (v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

string S;

int main() {

    cin>>S;


    int ans = 999;

    REP(i,0,S.size()-2){
        int a = 0;
        int d = 100;
        REP(j,0,3){
            a += (S[i+j]-'0')*d;
            d /= 10;
        }
        ans = min(ans, abs(753 - a));
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
 
     int a,b;
     scanf("%d %d", &a, &b);
     if (a>b){
          printf("a > b\n"); 
     }
     else if (a<b){
          printf("a < b\n");
     }
     else {
          printf("a == b\n");
     }
     return 0;
}


Measured memory_bytes: 2088