akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  string S;
  cin >> S;
  string AGCT = "AGCT";

  int n = S.length();
  int ret = 0;
  REP(i, n) {
    if(AGCT.find(S[i]) == std::string::npos) continue;
    int tmp = 0;
    while((i < n) && (AGCT.find(S[i]) != std::string::npos)) {
      ++tmp;
      ++i;
    }
    ret = max(ret, tmp);
  }
  cout << ret << endl;
  return 0;
}



Measured memory_bytes: 256
N = int(input())
h = list(map(int,input().split()))
ans = 0
i = 0
while sum(h)>0:
    while i < N and h[i] == 0:
        i += 1
    while i < N and h[i] > 0:
        h[i] -= 1
        i += 1
    ans += 1
    i = 0
print(ans)


Measured memory_bytes: 3060
x,n=map(int,input().split())
if(n!=0):
    a=list(map(int,input().split()))
else:
    a=[]

if x not in a:
    print(x)
else:
    a.sort()
    idx=a.index(x)
    i=max(idx-1,0)
    j=min(idx+1,n-1)
    d=1
    ans=0
    while(True):
        if(a[i]!=x-d):
            ans=x-d
            break
        else:
            i=max(i-1,0)
        if(a[j]!=x+d):
            ans=x+d
            break
        else:
            j=min(j+1,n-1)
        d+=1
    print(ans)

Measured memory_bytes: 9224
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

struct Edge {
    ll to, cost;
    Edge(ll to, ll cost) : to(to), cost(cost) {}
};
 
typedef vector<vector<Edge> > AdjList;
AdjList graph;
 
 
vector<ll> dist;
 
bool bellman_ford(ll n, ll s) {
    dist = vector<ll>(n, LINF);
    dist[s] = 0;
    for (int i = 0; i < n; i++) {
        for (int v = 0; v < n; v++) {
            for (int k = 0; k < graph[v].size(); k++) {
                Edge e = graph[v][k];
                if (dist[v] != LINF && dist[e.to] > dist[v] + e.cost) {
                    dist[e.to] = dist[v] + e.cost;
                    if (i == n - 1) return true;
                }
            }
        }
    }
    return false;
}

void find_negative_loop(int n){
    for (int i = 0; i < n; i++) {
        for (int v = 0; v < n; v++) {
            for (int k = 0; k < graph[v].size(); k++) {
                Edge e = graph[v][k];
                if (dist[v] != LINF && dist[e.to] > dist[v] + e.cost) {
                    dist[e.to] = -LINF;
                }
            }
        }
    }
}

int main(){
    ll n, m;
    cin >> n >> m;
    graph = AdjList(n);
    rep(i, m){
        ll from, to, cost;
        cin >> from >> to >> cost;
        from--, to--;
        graph[from].push_back(Edge(to,-cost));
    }
    bellman_ford(n, 0);
    find_negative_loop(n);

    if(dist[n-1] == -LINF) cout << "inf" << endl;
    else cout << -dist[n-1]<< endl;

    return 0;
}


Measured memory_bytes: 384
h, w = map(int,input().split())
s_l = []
for i in range(h):
    s_l.append(list(input()))

for i in range(h):
    s_l[i].insert(w,'*')
    s_l[i].insert(0,'*')

s_add = ['*']*(w+2)
s_l.insert(h,s_add)
s_l.insert(0,s_add)

for i in range(1,h+1):
    for j in range(1,w+1):
        if s_l[i][j] == '.':
            count = 0
            for k in range(i-1,i+2):
                for l in range(j-1,j+2):
                    if s_l[k][l] == '#':
                        count += 1
            s_l[i][j] = str(count)

s_l_result = s_l[1:h+1]
for i in range(h):
    print(''.join(s_l_result[i][1:w+1]))


Measured memory_bytes: 3188
while True:
  l=list(map(str,input().split()))
  if l[0]=="#":
    break
  #print(l)
  y=int(l[1])
  m=int(l[2])
  d=int(l[3])
  if y>=31 and m>=5:
    l[0]="?"
    y=y-30
  elif y>=32:
    l[0]="?"
    y=y-30
  print(l[0],y,m,d)


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
const int maxc=3e3+10;
const int N=2e5+10;
typedef pair<int,int> P;
map<ll,ll> mp;
ll n,a,b,c,d,inf,len;
ll f(ll x){
    int tot=0;
    while(x) {
        x/=10;
        tot++;
    }
    return tot;
}
ll dfs(ll now){
    if(mp[now])
        return mp[now];
    //cout<<now<<endl;
    if(now==0)
        return 0;
    if(now==1)
        return d;
    ll ans=inf;
    //if(len*f(now)<=21)
        //ans=d*ans;
    //else
    if((__int128)now*d>inf)
        ans=inf;
    else
        ans=now*d;
    for(int i=0;i<5;i++){
        ll val=now-i;
        if(val==0){
            ans=min(d*i,ans);
            //cout<<val<<endl;
            return mp[now]=ans;
        }
        if(val%2==0)
            ans=min(ans,dfs(val/2)+a+d*i);
        if(val%3==0)
            ans=min(ans,dfs(val/3)+b+d*i);
        if(val%5==0)
            ans=min(ans,dfs(val/5)+c+d*i);
    }
    for(int i=1;i<5;i++){
        ll val=now+i;
        if(val%2==0)
            ans=min(ans,dfs(val/2)+a+d*i);
        if(val%3==0)
            ans=min(ans,dfs(val/3)+b+d*i);
        if(val%5==0)
            ans=min(ans,dfs(val/5)+c+d*i);
    }

    return mp[now]=ans;
}

int main()
{
    int t;
    scanf("%d",&t);
    inf=1e18;
    while(t--){
        scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
        //cout<<f(n)<<endl;
        mp.clear();
        //len=f(d);
        printf("%lld\n",dfs(n));//cout<<"x"<<endl;
    }
    return 0;
}
/*


1 1 1 1 1 1 1

32 10 8 5 4
42
31
x y x+y
*/


Measured memory_bytes: 6516
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

string s;
int n;

bool check(string t){
    bool f1 = false, f2 = false, f3 = false;
    rep(i,t.size()){
        if(t[i] == '3') f1 = true;
        if(t[i] == '5') f2 = true;
        if(t[i] == '7') f3 = true;
    }
    return (f1 && f2 && f3);
}

int dfs(string t){
    if(t.size() == n){
        if(t <= s && check(t)) return 1;
        return 0;
    }
    int res = 0;
    if(check(t)) res++;
    res += dfs(t+"3");
    res += dfs(t+"5");
    res += dfs(t+"7");
    return res;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> s;
	n = s.size();
    int ans = dfs("");
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		for (int[] n = readInts(); n != null; n = readInts()) {
			int val = n[0] + n[1];
			System.out.println(Integer.toString(val).length());
		}
	}

	static BufferedReader br = new BufferedReader(new InputStreamReader(
			System.in));

	private static int[] readInts() throws IOException {
		String readLine = br.readLine();
		if (readLine == null) {
			return null;
		}
		String[] s = readLine.split(" ");
		int[] result = new int[s.length];
		for (int i = 0; i < result.length; i++)
			result[i] = Integer.parseInt(s[i], 10);

		return result;
	}
}

Measured memory_bytes: 10000
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define fi first
#define ii pair<ll,ll>
#define iii pair<pair<ll, ll>, ll >
#define se second
#define ld long double
#define mod 1000000007
#define popcount __builtin_popcountll
#define x0 zxcxzcsacasd
#define x1 ghfghujfgfg
#define y0 olkjhdnncvcv
#define y1 bhvgrewm345345435
using namespace std;
ld a[200010];
int main(){
    int n, k;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        int x;
        scanf("%d", &x);
        a[i] = log(x);
    }
    ld cur = 0.0;
    for(int i=0;i<k;i++){
        cur+=a[i];
    }
    ld pre = cur;
    for(int i=k;i<n;i++){
        cur = pre - a[i-k] + a[i];
        if(cur>pre)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        pre = cur;
    }
}


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

#define MAX_KW_LEN 16
#define CMND_LEN 8

#define TRUE 1
#define FALSE 0

typedef struct _node {
  int endFlg;
  struct _node *A;
  struct _node *C;
  struct _node *G;
  struct _node *T;
} node_t;

node_t *root = NULL;

node_t* createNewNode() {
  node_t *new;

  new = (node_t*)malloc(sizeof(node_t));
  if (new == NULL)
    exit(EXIT_FAILURE);
  new->A = NULL;
  new->C = NULL;
  new->G = NULL;
  new->T = NULL;
  new->endFlg = FALSE;
  return new;
}

void insertTree(node_t *node, char key[]) {
  int i;
  char c, tail[MAX_KW_LEN];

  // first time
  if (node == NULL) {
    root = createNewNode();
    if (key[0] == '\0')
      root->endFlg = TRUE;
  }

  c = key[0];
  for (i = 0; i < strlen(key); i++)
    tail[i] = key[i + 1];

  switch (c) {
  case 'A':
    if (node->A == NULL)
      node->A = createNewNode();
    if (tail[0] == '\0')
      node->A->endFlg = TRUE;
    else
      insertTree(node->A, tail);
    break;
  case 'C':
    if (node->C == NULL)
      node->C = createNewNode();
    if (tail[0] == '\0')
      node->C->endFlg = TRUE;
    else
      insertTree(node->C, tail);
    break;
  case 'G':
    if (node->G == NULL)
      node->G = createNewNode();
    if (tail[0] == '\0')
      node->G->endFlg = TRUE;
    else
      insertTree(node->G, tail);
    break;
  case 'T':
    if (node->T == NULL)
      node->T = createNewNode();
    if (tail[0] == '\0')
      node->T->endFlg = TRUE;
    else
      insertTree(node->T, tail);
    break;
  default:
    printf("Not defining character!");
    break;
  }
}

int findTree(node_t *node, char key[]) {
  int i;
  char c, tail[MAX_KW_LEN];
  node_t *child;

  if (!strcmp(key, "") && node->endFlg == TRUE)
    return TRUE;
  else if (!strcmp(key, "") && node->endFlg == FALSE)
    return FALSE;
  else {
    c = key[0];
    for (i = 0; i < strlen(key); i++)
      tail[i] = key[i + 1];

    switch (c) {
    case 'A':
      child = node->A;
      break;
    case 'C':
      child = node->C;
      break;
    case 'G':
      child = node->G;
      break;
    case 'T':
      child = node->T;
      break;
    default:
      printf("Not defining character!");
      break;
    }
    if (child == NULL)
      return FALSE;
    else
      return findTree(child, tail);
  }
}

void freeTree(node_t *node) {
  if (node == NULL)
    return;
  freeTree(node->A);
  freeTree(node->C);
  freeTree(node->G);
  freeTree(node->T);
  free(node);
}

int main(void) {
  int i, n;
  char word[MAX_KW_LEN], command[CMND_LEN];

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s %s", command, word);
    if (!strcmp(command, "insert")) {
      insertTree(&root, word);
    }
    else if (!strcmp(command, "find")) {
      if ((findTree(&root, word)) == TRUE)
  	printf("yes\n");
      else
  	printf("no\n");
    }
    else
      printf("Not available command!");
  }
  freeTree(root);

  return 0;
}

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

int main()
{
	//freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    int cc[INF+5]={0};
    for(int i=1;i<=100;i++)
    {
    	for(int j=1;j<=100;j++)
    	{
    		for(int k=1;k<=100;k++)
    		{
    			long long tot=(i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(k*i);
    			if(tot>INF)
    			{
    				continue;
    			}
    			cc[tot]++;
    		}
    	}
    }
    int n;
    cin >> n;
    for(int i=1;i<=n;i++)
    {
    	cout << cc[i] << "\n";
    }
}


Measured memory_bytes: 3668
#define Z(x,i)(x[i]+x[n/2+i])/2
float x[99],y[99],X,Y;
n,i;main(){
	for(gets(x);~scanf("%f %f",x+n,y+n);n++);
	if(!(n&1))for(X=Z(x,0),Y=Z(y,0);
		i<n/2&&fabsf(Z(x,i)-X)<1e-7&&fabsf(Z(y,i)-Y)<1e-7;
	i++);
	printf(i==n/2?"%f %f\n":"NA\n",X,Y);exit(0);
}

Measured memory_bytes: 652
#include<iostream>
#include <cstdlib>
#include<list>
#include<string>
#include<stack>
using namespace std;
int main() {
	int n, s[100000], small = 0, large = 0, cnt = 0; cin >> n; bool b = true;
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
	}
	for (int i = 0; i < n; i++)
	{
		if(s[i]<=s[n-1]){
			small = i; cnt++;
			if (small > large) {
				swap(s[small], s[large]); large+=1;
			}
		}
		else if (b == true) { b = false; large = i; }
if(b==true){large++;}
	}
	for (int i = 0; i < n; i++)
	{
		if (i == cnt-1) {
			printf(" [%d]", s[i]);
		}
		else {
			if (i != 0) { cout << " ";
			}
			cout << s[i];
		}
	}
cout<<endl;
	return 0;
}

Measured memory_bytes: 3584
N, M, C = [int(i) for i in input().split()]
BList = [int(i) for i in input().split()]
ALists = [[int(i) for i in input().split()] for _ in range(N)]

ans = 0
for AList in ALists:
    point = C
    for i, A in enumerate(AList):
        point += A * BList[i]
    if point > 0:
        ans += 1

print(ans)



Measured memory_bytes: 3064
import sys
import heapq


def input():
    return sys.stdin.readline().strip()


def main():
    N, M = map(int, input().split())

    A = list(map(int, input().split()))
    heap = []
    for a in A:
        heapq.heappush(heap, -1 * a)
    for i in range(M):
        a = heapq.heappop(heap)
        a *= -1
        a //= 2
        a *= -1
        heapq.heappush(heap, a)
    print(sum(heap) * (-1))


if __name__ == "__main__":
    main()


Measured memory_bytes: 14180
#include<bits/stdc++.h>
using namespace std;
	inline int read(){
	register int x=0,f=1;
	register char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')	f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')	x=x*10+(ch^48),ch=getchar();
	return x*f;
}
	const int N=1005;
	char s[N][N];
	int n,m,a[N][N];
	struct P{
	int x,y,z;
	P (int xx=0,int yy=0,int zz=0){
		x=xx,y=yy,z=zz;
	}
	bool operator < (const P k) const{
		return z>k.z;
	}
};
priority_queue<P> que;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)	scanf("%s",s[i]+1);
	memset(a,27,sizeof(a));
	a[1][1]=(s[1][1]=='#');
	que.push(P(1,1,a[1][1]));
	while(!que.empty()){
		P k=que.top();	que.pop();
		int x=k.x,y=k.y,z=k.z;
		if(z!=a[x][y])	continue;
		if(x<n){
			int k=z+(s[x+1][y]=='#'&&s[x][y]=='.');
			if(k<a[x+1][y])	a[x+1][y]=k,que.push(P(x+1,y,k));
		}
		if(y<m){
			int k=z+(s[x][y+1]=='#'&&s[x][y]=='.');
			if(k<a[x][y+1])	a[x][y+1]=k,que.push(P(x,y+1,k));
		}
	}
	cout<<a[n][m]<<endl;
	return 0;
}

Measured memory_bytes: 7688
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)1e5
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
ll d[mxn+5][105][2];
int main(){
	int n,i,j,k,e,dd;string s;cin>>s>>dd;n=s.size();
	d[0][0][1]=1;
	for(i=0;i<n;i++){
		for(j=0;j<dd;j++){
			for(e=0;e<2;e++){
				int x=(e?s[i]-48:9);
				for(k=0;k+e<=x;k++) d[i+1][(j+k)%dd][0]=(d[i+1][(j+k)%dd][0]+d[i][j][e])%mod;
				if(e) d[i+1][(j+x)%dd][1]=(d[i+1][(j+x)%dd][1]+d[i][j][e])%mod;
			}
		}
	}cout<<(d[n][0][0]+d[n][0][1]-1+mod)%mod<<endl;
}


Measured memory_bytes: 18688
#include <iostream>
using namespace std;
int main()
{
    int n, m, l;
    cin >> n >> m >> l;
    long a[n][m];
    long b[m][l];
    long c[n][l];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < l; j++)
        {
            cin >> b[i][j];
        }
    }
    for (int i = 0; i < l; i++)
    {
        for (int j = 0; j < n; j++)
        {
            long sum = 0;
            for (int k = 0; k < m; k++)
            {
                sum += a[j][k] * b[k][i];
            }
            c[j][i] = sum;
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < l; j++)
        {
            if (j) cout << " ";
            cout << c[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1 << 30;


int main()
{
    int n;
    cin >> n;
    vl x(n),y(n);
    rep(i,n) cin >> x[i] >> y[i];

    vl dx(n),dy(n);
    rep(i,n) dx[i] = x[i] - y[i];
    rep(i,n) dy[i] = x[i] + y[i];
    ll X = *max_element(all(dx)) - *min_element(all(dx));
    ll Y = *max_element(all(dy)) - *min_element(all(dy));
    cout << max(X,Y) << endl;
    return 0;
}

Measured memory_bytes: 9592
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

S = list(input())
T = list(input())

S.sort()
T.sort(reverse = True)

N = len(S)
M = len(T)

n = min(N, M)
for i in range(n):
    if ord(S[i]) < ord(T[i]):
        print ('Yes')
        exit()
    elif ord(S[i]) > ord(T[i]):
        print ('No')
        exit()

if N < M:
    print ('Yes')
else:
    print ('No')

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
#define INF 2147483647
int tree[262144];

void update(int x,int i){
  i+=(131072-1);
  tree[i]=x;
  while(i){
    i=(i-1)/2;
    tree[i]=min(tree[i*2+1],tree[i*2+2]);
  }
}

int find(int a,int b,int n,int l,int r){
  if(r<=a  || l>=b) return INF;
  if(a<=l && r<=b) return tree[n];
  int m=(l+r)/2;
  return min(find(a,b,n*2+1,l,m),find(a,b,n*2+2,m,r));
}

int main(){
  int n,q,a,b,c;
  cin>>n>>q;
  for(int i=0;i<n;i++) update(INF,i);
  for(int i=0;i<q;i++){
    cin>>a>>b>>c;
    if(a==1){
      cout<< find(b,c+1,0,0,131072)<<endl;
    }
    else update(c,b);
  }
  return 0;
}

Measured memory_bytes: 1964
#include <iostream>
#include <vector>
#include <array>
#include <map>

using namespace std;

int main() {
	map <char, int> ss;
	ss['S'] = 0;
	ss['H'] = 1;
	ss['C'] = 2;
	ss['D'] = 3;
	array <char, 4> suits{'S', 'H', 'C', 'D'};
	array <array <bool, 13>, 4> cards{false, false, false, false, false, false, false, false, false, false, false, false, false,
									false, false, false, false, false, false, false, false, false, false, false, false, false,
									false, false, false, false, false, false, false, false, false, false, false, false, false,
									false, false, false, false, false, false, false, false, false, false, false, false, false};

	short size = 0;
	char suit = 0;
	short rank = 0;

	cin >> size;
	for (short i = 0; i < size; i++) {
		cin >> suit >> rank;

		cards[ss[suit]][rank - 1] = true;
	}
	for (short i = 0; i < 4; i++) {
		for (short a = 0; a < 13; a++) {
			if (cards[i][a] == false) {
				cout << suits[i];
				cout << ' ' << a + 1 << endl;
			}
		}
	}
}



Measured memory_bytes: 3072
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        
        String s=sc.next();
        int x=700;
        if(s.substring(0,1).equals("o")){
            x+=100;
        }
        if(s.substring(1,2).equals("o")){
            x+=100;
        }
        if(s.substring(2,3).equals("o")){
            x+=100;
        }
        System.out.println(x);
    }
}




Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

const string YES = "YES";
const string NO = "NO";

void solve(long long A, long long B, long long C)
{
    for(int i = 1;i <= B ;i++)
    {
        if ((A * i) % B == C)
        {
            cout << YES << endl;
            return;
        }
    }

    cout << NO << endl;
}

int main()
{
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
using namespace std;

int main(){
  int m,n;
  cin >> m >> n;
  cout << (m-1)*(n-1) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

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

//const int MAX = 700000;
static const ll MOD = 1000000007;
//static const ll INF = 100000000;

int main() {
    ll A1, A2, A3;

    // input
    cin >> A1 >> A2 >> A3;

    // process
    if (A1 + A2 + A3 >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

const int MAX_N = 110;
int N;
int ret[MAX_N*MAX_N][2];

int main(int argc, char **argv) {
    std::cin >> N;

    int num = 0;
    int target = (N % 2 == 0) ? N + 1 : N;

    for (int i = 1; i <= N; i++) {
        for (int j = i + 1; j <= N; j++) {
            if (i + j != target) {
                ret[num][0] = i;
                ret[num][1] = j;
                num++;
            }
        }
    }

    std::cout << num << std::endl;

    for (int i = 0; i < num; i++) {
        std::cout << ret[i][0] << " " << ret[i][1] << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

lint lcm(lint a, lint b) {
    return (a / gcd(a, b)) * b;
}

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, d;
    cin >> n >> d;
    lint x[n][d];
    lint check[150];
    REP(i, 150){
        check[i] = i * i;
    }
    REP(i, n){
        REP(j, d){
            cin >> x[i][j];
        }
    }
    lint ans = 0;
    lint dist = 0;
    for (int i=0; i<n; ++i){
        for (int j=i+1; j<n; ++j){
            dist = 0;
            REP(k, d){
                dist += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            //debug(dist);
            REP(k, 150){
                //debug(check[k]);
                if(check[k] == dist){
                    ans++;
                    break;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
import std.algorithm, std.conv, std.range, std.stdio, std.string;

enum St { None, Placed, Handed }

const auto n = 8;

void main()
{
  auto bij = new St[][](n, n);
  auto k = readln.chomp.to!size_t;
  foreach (_; k.iota) {
    auto rd = readln.split.to!(int[]);
    place(bij, rd[1], rd[0]);
  }

  tryPlace(bij, 0);

  foreach (bi; bij)
    writeln(bi.map!(b => b == St.Placed ? 'Q' : '.'));
}

bool tryPlace(St[][] bij, int y)
{
  if (y >= n) return true;
  if (!bij[y].canFind(St.Placed)) {
    foreach (x; 0..n) {
      if (bij[y][x] == St.Handed) continue;
      auto cij = bij.deepDup;
      place(cij, x, y);
      if (tryPlace(cij, y + 1)) {
        deepCopy(bij, cij);
        return true;
      }
    }
    return false;
  } else {
    return tryPlace(bij, y + 1);
  }
}

St[][] deepDup(St[][] bij)
{
  return bij.map!(bi => bi.dup).array;
}

void deepCopy(St[][] bij, St[][] cij)
{
  bij[][] = cij[][];
}

void place(St[][] bij, int x, int y)
{
  bij[y][x] = St.Placed;
  hand(bij, x-1, y-1, -1, -1);
  hand(bij, x  , y-1,  0, -1);
  hand(bij, x+1, y-1, +1, -1);
  hand(bij, x+1, y  , +1,  0);
  hand(bij, x+1, y+1, +1, +1);
  hand(bij, x  , y+1,  0, +1);
  hand(bij, x-1, y+1, -1, +1);
  hand(bij, x-1, y  , -1,  0);
}

void hand(St[][] bij, int x, int y, int dx, int dy)
{
  if (x < 0 || x >= n || y < 0 || y >= n) return;
  bij[y][x] = St.Handed;
  hand(bij, x + dx, y + dy, dx, dy);
}

Measured memory_bytes: 2548
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef pair<LL,LL>PL;
const LL INF=1e18;
vector<PL>V;
LL N,i,j;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>N;
    if(N&1)
    {
        N--;
        for(i=1;i<=N;i++)
            for(j=1;j<=N;j++)
                if(i!=j&&i+j!=N+1)
                    V.emplace_back(min(i,j),max(i,j));
        for(i=1;i<=N;i++)
            V.emplace_back(i,N+1);
    }
    else
        for(i=1;i<=N;i++)
            for(j=1;j<=N;j++)
                if(i!=j&&i+j!=N+1)
                    V.emplace_back(min(i,j),max(i,j));
    sort(V.begin(),V.end());
    V.erase(unique(V.begin(),V.end()),V.end());
    cout<<V.size();
    for(i=0;i<V.size();i++)
        cout<<'\n'<<V[i].first<<' '<<V[i].second;
    cout<<endl;
    return 0;
}


Measured memory_bytes: 640
S = input()

S_list = [c for c in S]
zenhan = 10 * int(S_list[0]) + int(S_list[1])
kouhan =  10 * int(S_list[2]) + int(S_list[3])

if zenhan > 0 and zenhan < 13:
  if kouhan > 0 and kouhan < 13:
    print('AMBIGUOUS')
    exit()
  else:
    print('MMYY')
    exit()
else:
  if kouhan > 0 and kouhan < 13:
    print('YYMM')
    exit()
  else:
    print('NA')
    exit()
  

Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
int N;
void dfs(string s, char mx)
{
  if (s.length() == N)
  {
    printf("%s\n", s.c_str());
  }
  else
  {
    for (char c = 'a'; c <= mx; c++)
    {
      dfs(s + c, ((c == mx) ? (char)(mx + 1) : mx));
    }
  }
}
int main(void)
{
  cin >> N;
  dfs("", 'a');
  return 0;
}


Measured memory_bytes: 1536
#include <iostream>
using namespace std;
int main(void){
    int n;
    long long a;
    long long minValue = 1000000;
    long long maxValue = -1000000;
    long long sum = 0;
    
    cin >> n;
    
    for( int i = 0; i < n; i++){
        cin >> a;
        if(a < minValue)minValue = a;
        if(a > maxValue)maxValue = a;
        sum += a;
    }
    cout << minValue << " " << maxValue << " " << sum << endl;
    
    return 0;
    
}



Measured memory_bytes: 3100
A,B,C=map(int,input().split())
if A==B==C:
    print(0 if A%2 else -1)
else:
    count=0
    while A%2==B%2==C%2==0:
        A,B,C=(B+C)/2,(C+A)/2,(A+B)/2
        count+=1
    print(count)

Measured memory_bytes: 3064
n, k = gets.split.map(&:to_i)
ab = []
n.times do
  ab.push gets.split.map(&:to_i)
end
sab = ab.sort_by { |e| e.first }
count = 0
0.upto(n-1) do |i|
  count += sab[i].last
  if count >= k
    puts sab[i].first
    exit
  end
end


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

int main(){
  int n, count = 0;
  cin >> n;
  vector<int> v1(n); vector<int> v2(n); 
  r(i,n) cin >> v1.at(i);
  r(i,n) {
    cin >> v2.at(i);
    if(v1.at(i)-v2.at(i)>0)count+=v1.at(i)-v2.at(i);
  }
  cout << count << endl;
}

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

using namespace std;

int n, m;
double grow[100][100];
double dp[100][100];//

int main() {
	while (cin >> n >> m, n * m) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cin >> grow[i][j];
			}
		}
		for (int i = 0; i < n; i++)dp[0][i] = 1;
		for (int i = 1; i < m; i++) {
			for (int j = 0; j < n; j++) {
				double M = 0;
				for (int k = 0; k < n; k++) {
					M = max(M, dp[i - 1][k] * grow[k][j]);
				}
				dp[i][j] = M;
			}
		}
		double ans = 0;
		for (int i = 0; i < n; i++) {
			ans = max(ans, dp[m - 1][i]);
		}
		cout << fixed << setprecision(2) << ans << endl;
		for (int i = 0; i < n; i++)for (int j = 0; j < n; j++)grow[i][j] = 0;
		for (int i = 0; i < m; i++)for (int j = 0; j < n; j++)dp[i][j] = 0;
	}
	return 0;
}

Measured memory_bytes: 1444
#include <cstdio>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(-1000<=a,b<=1000){
	if(a<b){
		printf("a < b");
		printf("\n");
	}
	if(a>b){
		printf("a > b");
		printf("\n");
	}
	if(a==b){
		printf("a == b");
		printf("\n");
		}
	}
}


Measured memory_bytes: 2600
#include<stdio.h>
#include<string.h>
int main()
{
	char s[20];
	scanf("%s", s);
	int i, n = strlen(s);
	if (n % 2 > 0)
	{
		printf("No\n");
		return 0;
	}
	for (i = 0; i < n; i++)
	{
		if (i % 2 > 0)
		{
			if (s[i] != 'i')
			{
				printf("No\n");
				return 0;
			}
		}
		else
		{
			if (s[i] != 'h')
			{
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 128
n=int(input())
p=list(map(int,input().split()))

icnt=0
i=0
while i<n:
    if p[i]==i+1:
        if i<n-1 and p[i+1]==i+2:
            icnt+=1
            i+=1
        else:
            icnt+=1            
    i+=1            

print(icnt)


Measured memory_bytes: 20664
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int tmp = n;
        long sum = 0;
        while (n > 0) {
            sum += n % 10;
            n /= 10;
        }

        if (tmp % sum == 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

}


Measured memory_bytes: 21972
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

result_list = []
for a in A:
    result_list.append(a-1)
    result_list.append(a)
    result_list.append(a+1)
C = Counter(result_list).most_common()
print(C[0][1])

Measured memory_bytes: 30940
#include <cstdio>

int n, a[200005];

int index[200005];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) scanf("%d", a + i);
	
	int cur = 0, idx[2] = {1, n};
	
	for (int i = n; i; --i) {
		index[idx[cur]] = i;
		
		if (cur == 0) ++idx[cur];
		else --idx[cur];
		
		cur ^= 1;
	}
	
	for (int i = 1; i <= n; ++i) printf(i == n ? "%d\n" : "%d ", a[index[i]]);
	
	return 0;
}

Measured memory_bytes: 3712
from collections import deque
n,m=map(int,input().split())
ab=[list(map(int, input().split())) for _ in range(m)]
l=[[] for i in range(n)]#各部屋とつながっている部屋
#print(l,ab)
for a,b in ab:
    l[a-1].append(b)
    l[b-1].append(a)
result=[-1]*n
q=deque([1])
#print(l,result)
while True:
    if len(q)==0:
        break
    x=q.popleft()
    for j in l[x-1]:
        if result[j-1]==-1:
            result[j-1]=x
            q.append(j)
    #print(q,result)

print("Yes")
[print(i) for i in result[1:]]

Measured memory_bytes: 59220
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {


			int n = sc.nextInt();
			String s = sc.next();
			
			char[] chars = s.toCharArray();
			
			char[] converted = new char[chars.length];
			
			for(int i = 0 ; i < chars.length ; i++ ) {
				converted[i] = (char)(chars[i] + n);
				if (converted[i] > 'Z' ) {
					converted[i] = (char)(converted[i] - 26);
				}
			}
			
			System.out.println(String.copyValueOf(converted));
		}
	}
}

Measured memory_bytes: 21712
#include <bits/stdc++.h>
using namespace std;
#define LLINF (1LL<<60)
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//C++14 (GCC 5.4.1)

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

    vector<string> s(N);
    rep(i,N) cin >> s.at(i);
    int ABs=0,xA=0,Bx=0,BA=0;
    std::regex separator{"AB"}; // 分割用のセパレータ

        //-----------------------------------
    rep(i,N){
        std::vector<std::string> v = {};
        auto ite = std::sregex_token_iterator(s.at(i).begin(), s.at(i).end(), separator, -1);
        auto end = std::sregex_token_iterator();
        while (ite != end) {
            v.push_back(*ite++);     // 分割文字列を格納
        }
        ABs+=v.size()-1;


        if(s.at(i).at(0)=='B'){
            if(s.at(i).at(s.at(i).size()-1)=='A')BA++;else Bx++;
        }else if(s.at(i).at(s.at(i).size()-1)=='A'){
            xA++;
        }
    }

    int Ans=ABs;
    if(xA+Bx!=0)Ans+=min(xA,Bx)+BA;else Ans+=max(BA-1,0);


    cout << Ans <<endl;
    return (0);
}

Measured memory_bytes: 768
#include <stdio.h>

int main(void)
{
  int a,b,k;
  scanf("%d",&k);
  if (k % 2 == 0) {
    a = k / 2;
    b = a;
  }
  else {
    b = (k + 1) / 2;
    a = b - 1;
  }
  k = a * b;
  printf ("%d\n",k);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod   1000000007
string s;
map<char,int> mp;
int tot;
int main(){
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(mp[s[i]]==0) tot++;
        mp[s[i]]++;
    }
    cout<<(tot==2? "Yes":"No");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int a, b, c; cin >> a >> b >> c;
  if(a > b * c) cout << "No\n";
  else cout << "Yes\n";
  return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll dp[3002][3002];
int main()
{	//dp[i][j] answer of segment [i,j]
	int n;cin>>n;
	ll a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	for(int l=n-1;~l;l--)
	for(int r=l;r<n;r++)
	{
		if(l==r)dp[l][r]=a[l];
		else
		dp[l][r]=max(a[l]-dp[l+1][r], a[r]-dp[l][r-1]);
	}
	cout<<dp[0][n-1]<<"\n";
	
	
	
}


Measured memory_bytes: 70016
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
using ll = long long;
using namespace std;

int main(){
	int n, mod; cin >> n >> mod;
	vector<ll> a(n), sum(n+1);
	for( auto &k : a ){
		cin >> k;
		--k;
	}
	sum[0] = 0;
	for( int i = 0; i < n; ++i ){
		sum[i+1] = sum[i]+a[i];
		sum[i+1] %= mod;
	}
	map<ll, vector<int>> mp;
	for( int i = 0; i <= n; ++i ){
		mp[sum[i]].push_back(i); 
	}
	ll ans = 0;
	for( auto &k : mp ){
		auto &s = k.second;
		for( int l = 0; l < s.size(); ++l ){
			int r = lower_bound(s.begin(), s.end(), s[l]+mod) - s.begin();
			ans += r-l-1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 25216
import java.util.Scanner;
import java.math.*;
 
class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
 
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int m = sc.nextInt();
        sc.close();
 
        //短針と長針のなす角（度数）
        double degree = (30*h + 0.5*m) - 6*m;
 
        double distance = Math.sqrt(a*a + b*b -2*a*b*Math.cos(Math.toRadians(degree)));
 
        System.out.println(distance);
    }    
}

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

using namespace std;

map< int, int > m;
int a[200200];

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

    int ans = 0;
    for(int i = 1; i <= n; i++){
        m[i + a[i]]++;
        ans += m[i - a[i]];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 27904
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	s := nextStr()
	t := nextStr()
	for i := 0; i < n; i++ {
		fmt.Printf("%c%c", s[i], t[i])
	}

	fmt.Println("")
}

// ---- readfunc
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


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

int main(){
    string s;
    int k;
    cin >> s >> k;
    set<string> se;
    rep(i,s.size()){
        for(int j=1;j<=min((int)s.size(),k);j++){
            string t = s.substr(i,j);
            se.insert(t);
        }
    }
    auto itr = se.begin();
    k--;
    while(k--) itr++;
    cout << *itr << endl;
}

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

void pok() {
  cout << "Yes" << endl;
}
void png() {
  cout << "No" << endl;
}

int main() {
  int n; cin >> n;
  int x = n, fx = 0;
  while(n>0) {
    fx += n % 10;
    n /= 10;
  }
  if (x%fx==0) pok();
  else png();
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
typedef priority_queue<int, vector<int>, greater<int> > spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll> > spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int> > bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll> > bpqll;        //大きい順に取り出し

#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, b) for (int(i) = a; (i) < (int)b; i++)
#define IREP(i, v) for (auto i = v.begin(); i != v.end(); i++)
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[8] = {1, -1, 0, 0, 1, -1, -1, 1};
const int dy[8] = {0, 0, 1, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes()
{
    cout << "Yes" << endl;
}
void no()
{
    cout << "No" << endl;
}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w ;
    cin >> h >> w ;
    vstr str(h) ;
    REP(i,h){
        cin >> str[i] ;
    }
    vvint num1(h,vint(w,0)) ;
    vvint num2(h,vint(w,0)) ;
    int cnt ;
    
    REP(i,h){
        cnt = 1 ;
        REP(j,w){
            if(str[i][j]=='.'){
                num1[i][j] = cnt ;
                cnt++ ;
            }
            else{
                cnt = 1 ;
            }
        }
    }

    REP(i,h){
        REP(j,w-1){
            if(str[i][w-2-j]=='.'){
                num1[i][w-2-j] = max(num1[i][w-1-j],num1[i][w-2-j]) ;
            }
        }
    }



    REP(i,w){
        cnt = 1 ;
        REP(j,h){
            if(str[j][i]=='.'){
                num2[j][i] = cnt ;
                cnt++ ;
            }
            else{
                cnt = 1 ;
            }
        }
    }

    REP(i,w){
        REP(j,h-1){
            if(str[h-2-j][i]=='.'){
                num2[h-2-j][i] = max(num2[h-1-j][i],num2[h-2-j][i]) ;
            }
        }
    } 

    vint ans ;

    REP(i,h){
        REP(j,w){
            ans.PB(num1[i][j]+num2[i][j]-1) ;
        }
    }

    sort(ALL(ans)) ;
    reverse(ALL(ans)) ;

    cout << ans[0] ;



    return 0;
}


Measured memory_bytes: 54132
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner s=new Scanner(System.in);
		
		long n=s.nextLong();
		if(n%2==0)
		{long k=n/2;
		System.out.println(k-1);}
		else
		{System.out.println(n/2);}
	}
}


Measured memory_bytes: 23636
#include<stdio.h>
#include<stdlib.h>
long cmp(const void *a,const void *b){
  return *(long*)a - *(long*)b;
}

int main(){
  int n = 0;
  int k = 0;
  int i = 0;
  int min = -1;
  long h[100000] = {};
  scanf("%d %d",&n,&k);
  for(i=0;i<n;i++){
    scanf("%ld",&h[i]);
  }
  qsort(h,n,sizeof(long),cmp);
  for(i=0;i<=n-k;i++){
    if(h[i+k-1] - h[i] < min || min == -1){
      min = h[i+k-1] - h[i];
    }
  }
  printf("%ld",min);
  return 0;
}
      

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char const *argv[])
{
    int s;
    cin>>s;
    vector<int> bucket(1000001,0);
    bucket[s]++;
    int cnt=1;
    while (true)
    {
        cnt++;
        if(s%2==0){
            if(bucket[s/2])break;
            else{
                bucket[s/2]++;
                s=s/2;
            } 
        }
        else
        {
            if (bucket[3*s+1])break;
            else{
                bucket[3*s+1]++;
                s=3*s+1;
            }
        }
    }
    cout << cnt<<endl;
    

    return 0;
}


Measured memory_bytes: 4096
N,K = list(map(int,input().split()))

MOD = 10**9+7
arr = [pow(K//i, N, MOD) for i in range(1,K+1)]

for i in range(K//2,0,-1):
    arr[i-1] -= sum(arr[2*i-1:K:i]) % MOD
    arr[i-1] %= MOD
    
arr = [(i+1)*j%MOD for i,j in enumerate(arr)]

print(sum(arr)%MOD)

Measured memory_bytes: 15512
#include <iostream>
#include <vector>

using namespace std;

int mod = 1000000007;

int main()
{
	long long dp[2010] = {};
	fill(dp, dp + 2010, 1);
	dp[0] = dp[1] = dp[2] = 0;
	for (int i = 0; i < 2010; i++) {
		for (int j = 0; i-j>=3; j++) {
			dp[i] += dp[j];
			dp[i] %= mod;
		}
	}

	int n;
	cin >> n;
	cout << dp[n] << endl;

	return 0;
}

Measured memory_bytes: 3652
x,y=map(int,input().split())

ttl=0
if(x>3 and y>3):
  ttl=0
else:
  for i in range(1,4):
    if i==x:
        ttl=(4-i)*100000
        break
  for j in range(1,4):
    if j==y:
        ttl=ttl+(4-j)*100000
        break
  if ttl==600000:
    ttl=ttl+400000
print(ttl)


Measured memory_bytes: 3060
nyu=input()
alph=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","i","s","t","u","v","w","x","y","z"]
for i in range(25):
    if nyu==alph[i]:
        print(alph[i+1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
int a,b,c,flag=0;
scanf("%d %d %d",&a,&b,&c);
map<int,int>cycle;
for(int i=1;i<=105;++i){
    int res=(a*i)%b;
    if(cycle[res]){
        break;
    }
    if(res==c){
        flag=1;
        break;
    }
    cycle[res]=1;
}
(flag)?printf("YES"):printf("NO");


    return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, k;
  cin >> a >> b >> k;
  set<int> s;
  int cnt = 1;
  int i = a;
  int j = b;
  for(int i = a; i <= min(b, a + k - 1); i++) {
    cout << i << endl;
  }
  for(int i = max(b - k + 1, a + k); i <= b; i++) {
    cout << i << endl;
  }

  return 0;
}

Measured memory_bytes: 256
def deg(ax, ay, bx, by, cx, cy)
	return (bx - ax) * (cy - ay)  - (cx - ax) * (by - ay)
end

while line = gets do
	xa, ya, xb, yb, xc, yc, xd, yd = line.split(",").map(&:to_f)

	d0 = deg(xa, ya, xb, yb, xd, yd)
	d1 = deg(xb, yb, xc, yc, xa, ya)
	d2 = deg(xc, yc, xd, yd, xb, yb)
	d3 = deg(xd, yd, xa, ya, xc, yc)

	if (d0 < 0 && d1 < 0 && d2 < 0 && d3 < 0) ||
	   (d0 > 0 && d1 > 0 && d2 > 0 && d3 > 0) then
		puts "YES"
	else
		puts "NO"
	end 
end

Measured memory_bytes: 6124
loop do
  n = gets.to_i
  break if n == 0
  # taro,hanakoにカードを配布（ソート）
  taro = []
  hanako = []
  cards = Array.new(n*2) {false}
  for i in 0...n do
    k = gets.to_i
    cards[k-1] = true
    taro[i] = k
  end
  for i in 1..(n*2) do
    hanako << i if cards[i-1] == false
  end
  taro.sort!

  # 場に出ているカード
  ba = 0
  turn = :taro
  while !taro.empty? && !hanako.empty?
    if turn == :taro
      if i = taro.index {|m| ba < m}
        # puts "taro #{taro[i]}"
        ba = taro[i]
        taro.delete_at(i)
      else
        ba = 0
      end
      turn = :hanako
    else
      if i = hanako.index {|m| ba < m}
        # puts "hanako #{hanako[i]}"
        ba = hanako[i]
        hanako.delete_at(i)
      else
        ba = 0
      end
      turn = :taro
    end
  end

  puts hanako.length
  puts taro.length
end

Measured memory_bytes: 8640