akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#include <bits/stdc++.h>
#define pb(X) push_back(X)
#define x first
#define y second
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
using namespace std;

typedef pair<int, int> pii;

int n;

int main() {
	//INIT
	int n;
	cin >> n;
	map<string,int> A;
	vector<string> Ans;
	int a = 0;
	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		if (A.count(s)) {
			++A[s];
		} else {
			A[s] = 1;
		}
		if (A[s] > a) {
			a = A[s];
		}
	}
	for (auto i : A) {
		if (i.y == a) Ans.push_back(i.x);
	}
	sort(Ans.begin(), Ans.end());
	for (auto i : Ans) {
		cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 26868
A,B=map(int,input().split())
def gcd(a,b):#最大公約数を返す。Euclid
    if a<b:
        a,b=b,a
    c=a%b
    if c==0:
        return b
    return gcd(b,c)
print(int(A*B/gcd(A,B)))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define sz(x) ((int)x.size())
#define pb push_back
#define ii pair<int,int>
#define iii pair<ii,int>
#define ppb pop_back
#define st first
#define nd second
#define ll long long
#define N 200005
#define inf 2000000005
#define MOD 1000000007
#define LOG 40
#define EPS 0.000000001
using namespace std;

int n;
int k[N], l[N], r[N], nxt[N];

int find(int x) {

	if(x == -1 or x == n or nxt[x] == x)
		return x;
	return nxt[x] = find(nxt[x]);

}

void solve() {

	cin >> n;
	ll ans = 0;
	vector<int> ind;
	for(int i = 0; i < n; i++) {
		cin >> k[i] >> l[i] >> r[i];
		ans += r[i];
		ind.pb(i);
	}
	sort(ind.begin(), ind.end(), [&](int i, int j) {
		return l[i] - r[i] > l[j] - r[j];
	});
	for(int i = 0; i < n; i++)
		nxt[i] = i;
	int L_cnt = 0;
	for(int i: ind) {
		if(l[i] - r[i] <= 0)
			break ;
		int L = find(k[i] - 1);
		if(L != -1) {
			ans += l[i] - r[i];
			nxt[L] = L - 1;
			r[i] = -1;
			L_cnt++;
		}
	}
	for(int i = 0; i < L_cnt; i++)
		nxt[i] = L_cnt;
	for(int i = L_cnt; i < n; i++)
		nxt[i] = i;
	reverse(ind.begin(), ind.end());
	for(int i: ind) {
		if(r[i] == -1)
			continue ;
		int R = find(k[i]);
		if(R != n) {
			nxt[R] = R + 1;
		}
		else {
			ans += l[i] - r[i];
		}
	}	
	cout << ans << "\n";

}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);

	int t;
	cin >> t;
	while(t--)
		solve();

}

Measured memory_bytes: 7416
#include <stdio.h>
 
using namespace std;
 
void output(int H[3][10]){
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            printf(" %d",H[i][j]);
        }
        printf("\n");
    }
}
 
 
int main(){
    int H1[3][10],H2[3][10],H3[3][10],H4[3][10],n,h_num,f_num,r_num,div_num;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 10; j++){
            H1[i][j] = H2[i][j] = H3[i][j] = H4[i][j] = 0;
        }
    }
    scanf("%d",&n);
    for(int i = 0; i < n; i++){
        scanf("%d %d %d %d",&h_num,&f_num,&r_num,&div_num);
        switch(h_num){
        case 1:
            H1[f_num-1][r_num-1] += div_num;
            break;
        case 2:
            H2[f_num-1][r_num-1] += div_num;
            break;
        case 3:
            H3[f_num-1][r_num-1] += div_num;
            break;
        case 4:
            H4[f_num-1][r_num-1] += div_num;
            break;
        }
    }
 
    output(H1);
    printf("####################\n");
    output(H2);
    printf("####################\n");
    output(H3);
    printf("####################\n");
    output(H4);
 
}


Measured memory_bytes: 2724
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=2e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

ll bit[MAXn], h[MAXn], d[MAXn];

void ins(ll x,ll k)
{
    while(x < MAXn)bit[x] = max(bit[x], k), x += x & -x;
}
ll qr(ll x)
{
    ll ret = 0;
    while(x) ret = max(ret, bit[x]), x -= x & -x;
    return ret;
}


int main()
{
    IOS();
    ll n;
    cin>>n;
    REP(i,n) cin>>h[i];
    REP(i,n) cin>>d[i];
    ll ans = 0;
    REP(i,n)
    {
        ll x = qr(h[i]);
        x += d[i];
        ins(h[i], x);
        ans = max(ans, x);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 4992
char*p,x[1001*100],b[1001],*q;
A(){
	while(p>x&&p[-1]!='\n')
		p--;
}
E(){
	while(*p&&*p!='\n')
		p++;
}
F(){
	if(*p)
		p++;
}
B(){
	if(p>x)
		p--;
}
main(c){
	for(p=x;p<x+13||strcmp(p-13,"\nEND_OF_TEXT\n");p++)
		*p=getchar();
	p[-13]=0;
	p=x;
	for(;~scanf("%s",&c);){
		switch(c){
		case 'a':
			A();
			break;
		case 'e':
			E();
			break;
		case 'p':
			A(),B(),A();
			break;
		case 'n':
			E(),F(),A();
			break;
		case 'f':
			F();
			break;
		case 'b':
			B();
			break;
		case 'd':
			if(*p)
				memmove(p,p+1,strlen(p));
			break;
		case 'k':
			q=p;
			if(*p=='\n')
				p++;
			else
				E();
			memcpy(b,q,p-q);
			b[p-q]=0;
			p=memmove(q,p,strlen(p)+1);
			break;
		case 'y':
			memmove(p+strlen(b),p,strlen(p)+1);
			memcpy(p,b,strlen(b));
			p+=strlen(b);
			break;
		}
	}
	puts(x);
	exit(0);
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
using namespace std;
#define ll int64_t
#define REP(i, n) for (ll i=0; i<n; i++)

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

    ll N;
    cin >> N;
    vector<ll> A(N), B(N), D(N), ok;
    ll ng = 0;
    ll ans = 0;

    REP(i, N) cin >> A[i];
    REP(i, N) cin >> B[i];

    REP(i, N){
        D[i] = A[i] - B[i];
        if(D[i] < 0){
            ng -= D[i];
            ans++;
        }else{
            ok.push_back(D[i]);
        }
    }

    // cout << ans << "\n";

    sort(ok.begin(), ok.end(), greater<ll>());

    ll i=0;
    while(ng > 0 && i < ok.size()){
        ans++;
        ng -= ok[i];
        i++;
    }

    if(ng <= 0) cout << ans << "\n";
    else cout << -1 << "\n";

}

Measured memory_bytes: 3576
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	String S = sc.next();
      	String x = "";
      	for(int i = 0; i < S.length(); i++){
        	x += "x";
        }
      	System.out.println(x);
    }
}

Measured memory_bytes: 38516
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,n;
  cin>>h>>n;
  int ans=0;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    ans+=a[i];
  }
  if(ans>=h){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3680
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 110
int a[MAXN],b[MAXN],n,m,cnt,first,last;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]%2) cnt++;
	}
	if(cnt>2) printf("Impossible\n");
	else
	{
		bool first=1;
		for(int i=1;i<=m;i++)
			if(a[i]%2)
			{
				if(first) swap(a[i],a[1]),first=0;
				else swap(a[i],a[m]);
			}
		for(int i=1;i<=m;i++)
			printf("%d ",a[i]);
		printf("\n");
		if(cnt==2)
		{
			a[1]--,a[m]++;
			if(a[1]==0)
				printf("%d\n",m-1);
			else printf("%d\n",m);
			for(int i=1+(a[1]==0);i<=m;i++)
				printf("%d ",a[i]);
		}
		else if(cnt==1)
		{
			if(m==1&&a[1]!=1) printf("2\n%d 1\n",a[1]-1);
			else if(m==1&&a[1]==1) printf("1\n1\n");
			else
			{
				a[1]--,a[m]++;
				if(a[1]==0)
					printf("%d\n",m-1);
				else printf("%d\n",m);
				for(int i=1+(a[1]==0);i<=m;i++)
					printf("%d ",a[i]);
			}
		}
		else
		{
			if(m==1) printf("2\n%d 1\n",a[1]-1);
			else
			{
				a[1]--,a[m]++;
				if(a[1]==0)
					printf("%d\n",m-1);
				else printf("%d\n",m);
				for(int i=1+(a[1]==0);i<=m;i++)
					printf("%d ",a[i]);
			}
		}
	}
}

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

int sisyagonyuu(double);

int main(void) {
	int num,tanka,kosuu;
	int kakaku;
	double kosuuave;
	num=0;kakaku=0;kosuuave=0;
	while(1) {
		if(scanf("%d,%d",&tanka,&kosuu)==-1)break;
		kakaku+=tanka*kosuu;
		kosuuave+=kosuu;
		num++;
	}
	printf("%d\n",kakaku);
	printf("%d\n",sisyagonyuu(kosuuave/num));
	return 0;
}

int sisyagonyuu(double a) {
	double aa;
	aa=a-floor(a);
	if(aa>=0.5)return floor(a)+1; else return floor(a);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define F first
#define S second
#define mod 1000000000
#define all(a) a.begin(),a.end()
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define dbg_v(v) cout<<#v<<":";for(auto c:v) cout<<" "<<c; cout<<endl;
int power(ll x,ll y){ll res = 1;while(y>0){if(y&1)res = (res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}

void solve(){
	string s,t;
	cin>>s>>t;
	int ns=(int)s.length();
	int nt=(int)t.length();
	int ans=1e9;
	for(int i=0;i<=ns-nt;i++){
		string tm=s.substr(i,nt);
		int cnt=0;
		for(int j=0;j<nt;j++){
			if(t[j]!=tm[j])
				cnt++;
		}
		ans=min(cnt,ans);
	}
	cout<<ans<<endl;
}

int main(){ 
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);	
	int T=1;
	//cin>>T;
	while(T--)
		solve();
}



Measured memory_bytes: 3656
#include<stdio.h>
#include<string.h>

int main(void){

  int k;//num of black stone
  int x;//
  int i;

  int rear;
  int front;

  scanf("%d%d",&k,&x);
  rear=x-k+1;
  front=x+k-1;
  for(i=rear;i<=front;i++){
    printf("%d ",i);
  }


return 0;

}


Measured memory_bytes: 128
#include<cstdio>
#include<vector>

using namespace std;

#define abs(a) ( (a < 0) ? ( (a) * (-1) ) : (a) )
typedef long long int lli;

struct pos{
  lli s, t;
};

int N, M;

lli ans, disA = 999999999, dis;

vector<pos> ab, cd;

int main(){
  scanf("%d %d", &N, &M);
  ab.resize(N);
  cd.resize(M);
  for(auto& i : ab){
    scanf("%lld %lld", &(i.s), &(i.t));
  }
  for(auto& i : cd){
    scanf("%lld %lld", &(i.s), &(i.t));
  }
  //printf("\n");
  int l = 1;
  for(auto i : ab){
    for(auto j : cd){
      //printf("pos:%lld %lld %lld %lld\n", i.s, i.t, j.s, j.t);
      dis = abs(i.s - j.s) + abs(i.t - j.t);
      //printf("dis:%lld %lld %lld\n", abs(i.s - j.s), abs(i.t - j.t), dis);
      if(disA > dis){
        ans = l;
        disA = dis;
      }
      l++;
    }
    printf("%lld\n", ans);
    l = 1;
    disA = 999999999;
  }

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() 
{
  int x[5000] = {0};
  int y[5000] = {0};
  int i;
  for(i = 0;i < 5000;i++){
    cin >> x[i] >> y[i];
    if(x[i] == 0 && y[i] == 0){
      break;
    }
  }
  i = 0;
  while(x[i] + y[i] != 0){
    if(x[i] < y[i]){
      cout << x[i] << " " << y[i] << endl;
    }else{
      cout << y[i] << " " << x[i] << endl;
    }
    i++;
  }
  return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for(ll i=0; i<n; i++)
#define all(v) v.begin(), v.end()
#define vec vector
typedef long long ll;
const int INF = 1001001001;

/*　<<stringで読み込んだ数列を一桁ずつint型へ変換>>
 
    string str;
    int N[桁数];
 
    cin >> str;
 
    for (int i = 0; i < 桁数; ++i) {
 
        N[i] = (int)(str[i] - '0');  //str[i]　はchar型なのでchar→intへ変換
 
        //cout << N[i] << endl;  //確認のため表示
    }
*/
 


///////////////////////////////////////////////////////////////////////////


int main() {
    
    string s;
    cin >> s;
    int size;
    size = s.size();

    ll ans = 0;
    rep(i,1<<size-1){
        string rem = s;
        int cnt = 1;
        rep(j,size-1){
            if(i>>j&1){
                ll target = stoll(rem.substr(0,cnt));
                ans += target;
                rem = rem.substr(cnt);
                cnt = 1;
            }
            else cnt++;
        }
        if(rem.size()) ans += stoll(rem);
    }
        cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <queue>
#include<string>
#include<cstring>
#include<complex>
#include<cmath>
using namespace std;
#define rep(i, n)   for(int i = 0; i < (int)(n); i++)
#define rrp(i, n)   for(int i = ((int)(n)); i >=0; i--)
#define mpp(i,j,k)  make_pair((int)(i),make_pair((int)(j),(int)(k)))
typedef pair<int,pair<int,int > > ppp;
typedef pair<int,int> pp;
typedef vector<int> vi;
typedef vector<vi>  vvi;

int h,w;
int c[10][10];
int d[10];
int x,y;
int main(){
cin>>h>>w;

rep(i,10)rep(j,10)cin>>c[j][i];
rep(i,10)d[i]=1000000;
d[1]=0;
priority_queue<pp,vector<pp>,greater<pp>> q;
q.push(make_pair(0,1));
while (q.size()){
int dd=q.top().first;
int p=q.top().second;
q.pop();
rep(i,10){
 if(i!=p && d[i]>d[p]+c[p][i])d[i]=d[p]+c[p][i],q.push(make_pair(d[i],i));
 }
}
y=0;
rep(i,h)rep(j,w){cin>>x;if(x>=0)y+=d[x];}
cout<<y<<endl;
  return 0;}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  
  int i,n,xi,ci,c=1000000000;
  
  cin>>n;
  for(i=0;i<n;i++){
	cin>>xi;
    ci = 0;
    while(xi%2!=1)xi/=2,ci++;
    if(c>ci) c = ci;
  }
  cout<<c;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#define MAX_N 90005
#define int long long

using namespace std;

int n,m,d,q;
int x[MAX_N];
int y[MAX_N];
int s[MAX_N];

void read()
{
	scanf("%lld%lld%lld",&n,&m,&d);
	int k;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			scanf("%lld",&k);
			x[k]=i,y[k]=j;
		}
	}
}

inline int abs(int x)
{
	return x>0 ? x : -x;
}

inline int cost(int i,int j)
{
	return abs(x[i]-x[j])+abs(y[i]-y[j]);
}

void work()
{
	for(int i=d+1;i<=n*m;i++) s[i]=s[i-d]+cost(i,i-d);
	scanf("%lld",&q);
	int l,r;
	while(q--)
	{
		scanf("%lld%lld",&l,&r);
		printf("%lld\n",s[r]-s[l]);
	}
}

signed main()
{
	read();
	work();
}


Measured memory_bytes: 3200
#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>

using namespace std;

int main() {
    long double a, b, h, m;
    cin >> a >> b >> h >> m;

    long double c;
    c = (360.0 * m / 60.0) - 360.0 * (h * 60.0 + m) / 720.0;
    if (c < 0) {
        c = c * -1;
    }
    if (c >= 180) {
        c = 360 - c;
    }
    //cout << cos(c/180) << "\n";

    cout << std::setprecision(11) << sqrtl(a * a + b * b - 2 * a * b * cosl(c * 3.1415926535897932384626 / 180));


    return 0;
}

Measured memory_bytes: 4156
#include <cstdio>
#include <cctype>


int main(){
    
    char ch;

    while(true){
        scanf("%c", &ch);
        if(ch=='\n'){
            break;
        }
        if(isalpha(ch)){
            if(islower(ch)){
                printf("%c", toupper(ch));
            }
            if(isupper(ch)){
                printf("%c", tolower(ch));
            }
        }else{
            printf("%c", ch);
        }
    }
    printf("\n");

    return 0;
}




Measured memory_bytes: 2696
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
char sign[307];
string ans;
int a, b, c;
int A, B;
string print(int n) {
	string s = "";
	for (int j = 0; j < n; j++) {
		s += "|";
	}
	return s;
}

int main()
{
	int n; cin >> n;
	cout << n * n << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char s[600001];
int i,j,k,n,m,f[600001][27],g[600001][21];
void build(){
	int i,j;
	for (i=0;i<=20;i++) g[n+1][i]=g[n+2][i]=n+1;
	for (i=n;i;i--)
	 for (j=1,g[i][0]=f[i][0];j<=20;j++) g[i][j]=g[g[i][j-1]+1][j-1];
}
bool query(int x,int v){
	int i;
	x--;
	for (i=20;x<v;x=g[x][i])
	 for (x++;i&&g[x][i]>v;i--);
	return x==v;
}
int main(){
	scanf("%s",s);n=strlen(s);
	for (i=0;i<=26;i++) f[n+1][i]=f[n+2][i]=n+1;
	for (i=n;i;i--){
		k=s[i-1]-'a'+1;f[i][k]=i;
		for (j=k+1;j<=26;j++) f[i][j]=f[f[i][j-1]+1][j-1];
		f[i][0]=f[f[i][26]+1][26];
		for (j=1;j<k;j++) f[i][j]=f[f[i][0]+1][j];
	}
	build();
	scanf("%d",&m);
	for (i=1;i<=m;i++){
		scanf("%d%d",&j,&k);
		puts((query(j,k))?"Yes":"No");
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

ll n, k;
vector<ll> w;

bool check(ll p) {
    ll sum = 0, cnt = 1;

    for (ll i = 0; i < n; i++) {
        if (w[i] > p) return false;
        
        if (sum + w[i] > p) {
            sum = w[i];
            cnt++;
        } else {
            sum += w[i];
        }
    }

    return (cnt <= k);
}

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

    cin >> n >> k;

    w.resize(n);

    for (ll i = 0; i < n; i++) cin >> w[i];

    ll left = 0, right = 100000LL * 100000LL + 1, mid;

    while (left + 1 < right) {
        mid = (left + right) / 2;

        if (check(mid)) {
            right = mid;
        } else {
            left = mid;
        }
    }

    cout << right << endl;

    return 0;
}



Measured memory_bytes: 3640
# -*- coding: utf-8 -*-
import sys


def main():
    arr =input()
    even = arr[0::2]
    odd = arr[1::2]

    even = even.replace("U","")
    even = even.replace("D","")
    even = even.replace("R","")

    if len(even) > 0:
        print("No")
        sys.exit()

    odd = odd.replace("U","")
    odd = odd.replace("D","")
    odd = odd.replace("L","")

    if len(odd) > 0:
        print("No")
    else:
        print("Yes")










if __name__ =='__main__':
    main()

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)>(b)?(b):(a))

int cmp(const void*a, const void*b){
	return *(char*)a-*(char*)b;
}
int cmp2(const void *a, const void*b){
	return *(char*)b-*(char*)a;
}
int main(void){
	int i,j;
	char s[101],t[101];
	scanf("%s",s);
	scanf("%s",t);
	int sn = strlen(s);
	int tn = strlen(t);
	qsort(s,sn,sizeof(char),cmp);
	qsort(t,tn,sizeof(char),cmp2);
	printf("%s\n",strcmp(s,t)<0?"Yes":"No");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
// sort(a.begin(), a.end(), std::greater<int>());

int main()
{
    string a;
    cin>>a;
    int ans=0;
    rep(i,3){
        if(a[i]=='o')
        ans++;
    }
    cout<<700+ans*100<<endl;
    return 0;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n,m;
  cin >> n >> m;
  vector<int32> a(n),b(n),c(n);
  vector<int32> d(m),e(m),f(m);
  map<int32,int32> compx,compy;
  compx[0] = -1;
  compy[0] = -1;
  REP(i,n){
    cin >> a[i] >> b[i] >> c[i];
    compx[a[i]] = -1;
    compx[b[i]] = -1;
    compy[c[i]] = -1;
  }
  REP(i,m){
    cin >> d[i] >> e[i] >> f[i];
    compx[d[i]] = -1;
    compy[e[i]] = -1;
    compy[f[i]] = -1;
  }
  vector<int32> decx,decy;
  for(auto& p : compx){
    p.second = decx.size();
    decx.pb(p.first);
  }
  for(auto& p : compy){
    p.second  = decy.size();
    decy.pb(p.first);
  }

  int32 h = decx.size() * 2;
  int32 w = decy.size() * 2;
  vector<vector<int32>> dist(h, vector<int32>(w,INF));
  REP(i,n){
    int32 ca = compx[a[i]] * 2;
    int32 cb = compx[b[i]] * 2;
    int32 cc = compy[c[i]] * 2;
    FOR(j,ca,cb+1){
      dist[j][cc] = -1;
    }
  }
  REP(i,m){
    int32 cd = compx[d[i]] * 2;
    int32 ce = compy[e[i]] * 2;
    int32 cf = compy[f[i]] * 2;
    FOR(j,ce,cf+1){
      dist[cd][j] = -1;
    }
  }

  queue<pii> que;
  que.emplace(compx[0]*2,compy[0]*2);
  dist[compx[0]*2][compy[0]*2] = 0;
  while(!que.empty()){
    auto [cx,cy] = que.front();que.pop();
    REP(k,4){
      int32 nx = cx + dx[k];
      int32 ny = cy + dy[k];
      if(nx < 0 || h <= nx || ny < 0 || w <= ny){
        ANS("INF");
        return 0;
      }
      if(dist[nx][ny] != INF)continue;
      dist[nx][ny] = 0;
      que.emplace(nx,ny);
    }
  }
  int64 ans = 0;
  REP(k,h/2-1)REP(l,w/2-1){
    int32 i = k*2+1;
    int32 j = l*2+1;
    if(dist[i][j] != 0)continue;
    int32 dx = decx[k+1] - decx[k];
    int32 dy = decy[l+1] - decy[l];
    ans += dx * dy;
  }
  ANS(ans);
  return 0;
}

Measured memory_bytes: 285424
#include <iostream>
#include <cmath>

using namespace std;

int main() {
	string s;
	cin >> s;
	int m = 9999;
	for(int i = 0; i < s.length() - 2; ++i) {
		int n = (int)((s[i] - '0') * 100 + (s[i+1] - '0') * 10 + s[i+2] - '0');
		if (m > abs(n - 753)) {
			m = abs(n - 753);
		}
	}
	cout << m << endl;
	return 0;
}


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

struct Node {
  int value;
  struct Node *next;
  struct Node *prev;
};

void insert(struct Node *dummy, int x) {
  struct Node *newNode = (struct Node *) malloc(sizeof(struct Node));

  newNode->value = x;
  
  newNode->prev = dummy;
  newNode->next = dummy->next;

  dummy->next->prev = newNode;
  dummy->next = newNode;
}

struct Node *search(struct Node *dummy, int x) {
  struct Node *node = dummy->next;

  struct Node *result = NULL;

  while (node != dummy) {
    if (node->value == x) {
      result = node;

      break;
    }

    node = node->next;
  }

  return result;
}

void deleteNode(struct Node *dummy, struct Node *node) {
  if ((dummy == node) || (node == NULL)) {
    return;
  }

  node->prev->next = node->next;
  node->next->prev = node->prev;
}

void deleteFirst(struct Node *dummy) {
  deleteNode(dummy, dummy->next);
}

void deleteLast(struct Node *dummy) {
  deleteNode(dummy, dummy->prev);
}

void printNodes(struct Node *dummy) {
  struct Node *node = dummy->next;

  while (node != dummy) {
    std::cout << node->value;

    node = node->next;

    if (node != dummy) {
      std::cout << " ";
    } else {
      std::cout << std::endl;
    }
  }
}

int main() {
  std::ios_base::sync_with_stdio(false);
  
  struct Node *dummy = (struct Node *) malloc(sizeof(struct Node));

  dummy->next = dummy;
  dummy->prev = dummy;
  
  int n = 0;

  std::cin >> n;

  for (int i = 0; i < n; i++) {
    std::string command;
    
    std::cin >> command;

    if (command == "insert") {
      int x = 0;

      std::cin >> x;

      insert(dummy, x);
    } else if (command == "delete") {
      int x = 0;

      std::cin >> x;
      
      deleteNode(dummy, search(dummy, x));
    } else if (command == "deleteFirst") {
      deleteFirst(dummy);
    } else if (command == "deleteLast") {
      deleteLast(dummy);
    }

    //    printNodes(dummy);
  }
  
  printNodes(dummy);
  
  return 0;
}

Measured memory_bytes: 35604
#include<stdio.h>
#define MOD 1000000007
#define MAX 200000

typedef long long int lli;


#define tasu(a,b) (((a)+(b)) % MOD)

int main(void){
  int n,i;
  scanf("%d",&n);
  int c[n],moumita[MAX+1];
  for(i=0;i<MAX+1;i++)moumita[i]=-1;
  for(i=0;i<n;i++){
    scanf("%d",&c[i]);
  }

  int num[n],temp;
  num[0]=1;
  moumita[c[0]]=0;
  for(i=1;i<n;i++){
    temp=c[i];
    if(moumita[temp]==-1 ||moumita[temp]== i-1 ){
      num[i]=num[i-1];
    }else{
      num[i]=tasu(num[i-1],num[moumita[temp]]);
    }
    moumita[temp]=i;
  }

  //  for(i=1;i<=n;i++)
  printf("%2d",num[i-1]);
 
  return 0;
}




Measured memory_bytes: 2560
/* author : akshatjai258 */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define int ll
#define mod int(1e9 + 7)
#define inf int(1e9)
#define endl "\n"
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define fi first
#define mem0(a) memset(a, 0, sizeof(a))
#define mem1(a) memset(a, -1, sizeof(a))
#define memf(a) memset(a, false, sizeof(a))
#define all(v) v.begin(), v.end()
#define se second
#define mp make_pair
#define pb push_back
#define w(x)  \
	int x;    \
	cin >> x; \
	while (x--)
#define ps(x, y) fixed << setprecision(y) << x
void prep()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
}
bool dp[100001];
int32_t main()
{
	prep();
	//dp[i]--- first one to move wins       when i stones are remaining
	
	int n,k;
	cin>>n>>k;
	vi stones(n);
	for(int i=0;i<n;i++)
	{
		cin>>stones[i];
	}
	for(int i=0;i<=k;i++)
	{
		for(auto x:stones)
		{
			if(i>=x&&!dp[i-x])
			{
				dp[i]=true;
			}
		}
	}
	if(dp[k]) cout<<"First";
	else cout<<"Second";
			
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;
const int IINF = 1e9;
const ll INF = 1e18;
const int MOD = 1e9 + 7;

#define dump(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl

template <typename T>
void dumpvec(vector<T> vec) {
  for (T cnt : vec) {
    cout << cnt << ", ";
  }
  cout << endl;
}

void chmin(ll &a, ll b) {
  if (a > b) {
    a = b;
  }
}
void chmax(ll &a, ll b) {
  if (a < b) {
    a = b;
  }
}

vector<string> split(string s, string delimiter) {
  int first = 0;
  int last = s.find_first_of(delimiter);
  vector<string> result;

  while (first < s.size()) {
    string sub = s.substr(first, last - first);
    result.push_back(sub);
    first = last + 1;
    last = s.find_first_of(delimiter, first);

    if (last == string::npos) {
      last = s.size();
    }
  }

  return result;
}

string join(vector<string> strings, string delimiter) {
  string result = "";
  for (int i = 0; i < strings.size(); i++) {
    if (result != "") result += delimiter;
    result += strings[i];
  }
  return result;
}

class Solution {
 public:
  void solve() {
    string s;
    cin >> s;

    // 50%を超えるには
    // 1. XYXがあるか. abababa -> 結局abaがあれば対象
    // 2. XXがあるか abaabba -> 結局aaがあれば対象
    // をみつければいい
    for (char c = 'a'; c <= 'z'; c++) {
      for (int i = 0; i < s.length() - 1; i++) {
        // 連続して同じcharなら50%超え
        if (s[i] == c && s[i + 1] == c) {
          cout << (i + 1) << " " << i + 2 << endl;
          return;
        }
      }
      for (int i = 0; i < s.length() - 2; i++) {
        // 一つ飛びに同じcharなら50%超え
        if (s[i] == c && s[i + 2] == c) {
          cout << i + 1 << " " << i + 3 << endl;
          return;
        }
      }
    }
    cout << -1 << " " << -1 << endl;
  }
};

int main() { Solution().solve(); }

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{
	int n,sum=0;
	string a;
	cin>>n>>a;
	for(int i=0;i<n-2;i++) if(a[i]=='A'&&a[i+1]=='B'&&a[i+2]=='C') sum++;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int N;
	int W[100];
	cin >> N;
	int sum=0;
	int ans = 0;
	int ans2 = 0;
	for (int i = 0;i < N;i++) {
		cin >> W[i];
		sum += W[i];
	}
	for (int i = 0;i < N;i++) {
		ans2 = abs(ans - sum);
		ans += W[i];
		sum -= W[i];
		if (ans >= sum) {
			if (abs(ans - sum) <= ans2) {
				cout << abs(ans - sum) << endl;
				break;
			}
			else {
				cout << ans2 << endl;
				break;
			}
		}
	}
	return 0;
}

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

using namespace std;

typedef int itn;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef map<int, int> M;
typedef pair<int, int> P;
typedef stack<int> S;
typedef queue<int> Q;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    VI vx = VI(n, 0);
    VI vy = VI(m, 0);
    for (int i = 0; i < n; ++i) cin >> vx[i];
    for (int i = 0; i < m; ++i) cin >> vy[i];
    sort(vx.begin(), vx.end());
    sort(vy.begin(), vy.end());
    bool f = false;
    for (int i = y; i > x; --i)
    {
        if ((vx[(int)vx.size()-1] < i) && (i <= vy[0])) f = true;
    }
    if (f) cout << "No War" << endl;
    else cout << "War" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int N , M , ans1 , ans2=1000000000 , ans;
  cin>>N>>M;
  vector<int> A(N) , B(N) , C(M) , D(M);
    for(int i =0;i<N;i++){
    cin>>A[i]>>B[i];
  }
    for(int i =0;i<M;i++){
    cin>>C[i]>>D[i];
  }
  for(int i =0;i<N;i++){
    ans2=1000000000;
    for(int j=0;j<M;j++){
      ans1=abs(A[i]-C[j])+abs(B[i]-D[j]);
      if(ans2>ans1){
        ans2=ans1;
        ans=j;
      }
      }
      cout<<ans+1<<endl;
  }
}

Measured memory_bytes: 256
import math
import itertools
import statistics
#n = int(input())
n, l = list(map(int, input().split()))
total = 0
for i in range(1, n+1):
    total += (l+i-1)
    #print(l+i-1)
total2 = total

m = abs(total)
for i in range(1, n+1):
    if abs(total-(total2-(l+i-1))) < m:
        m = abs(total-(total2-(l+i-1)))
        #print(total2-(l+i-1))

#print(total)
#print(total2)
#print(m)
if total > 0:
    print(total2-m)
else:
    print(total+m)




Measured memory_bytes: 5148
#include<stdio.h>
int main()
{
int a, b, c, i;
int count = 0;
scanf("%d %d %d", &a, &b, &c);
for (i = a; i<=b; i++)
{
if (c%i == 0)
{
count++;
}
}
printf("%d\n",count);
}


Measured memory_bytes: 2740
import sys
dp=[[[0]*331 for i in xrange((1<<10)+1)] for j in xrange(12)]
#dp[12][1025][331]
dp[0][0][0]=1
for i in xrange(10):
    for j in xrange(1<<10):
        for c in xrange(331):
            if dp[i][j][c]==0:
                continue
            for k in xrange(10):
                if (j>>k&1)==0:
                    dp[i+1][j|(1<<k)][(i+1)*k+c]+=dp[i][j][c]
ans=[[0]*331 for unused in xrange(12)]
for i in xrange(11):
    for j in xrange(1<<10):
        for c in xrange(331):
            ans[i][c]+=dp[i][j][c]
for line in sys.stdin.readlines():
    n,s=map(int,line.strip().split())
    if s>330:
        print 0
    else:
        print ans[n][s]

Measured memory_bytes: 37252
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cassert>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<utility>
using namespace std;

int n;

vector<int> prime;
vector<int> prime_list;
void prime_set(long n){
        n+=100;
        prime.resize(n);
        for(int i=0;i<n;i++){
                prime[i]=1;
        }
        prime[0]=prime[1]=0;
        for(int i=0;i*i<n;i++){
                if(prime[i]){
                        for(int j=i*2;j<n;j+=i){
                                prime[j]=0;
                        }
                }
        }
        for(int i=0;i<n;i++){
                if(prime[i])prime_list.push_back(i);
        }
}

bool input(){
	cin>>n;
	if(n==0){
		return false;
	}
  return true;
}

int solve(){
	int sum=0;
	for(int i=0; i<n ; i++){
		sum=sum+prime_list[i];
	}

  return sum;
}


int main(){
	prime_set(10000000);
  while(input()){
    cout<<solve()<<endl;
  }
  return 0;
}

Measured memory_bytes: 44388
#include<iostream>
using namespace std;
bool g[114][514];
int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int u, k; cin >> u >> k;
		for (int j = 0; j < k; j++) {
			int v; cin >> v;
			g[u][v] = true;
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (j != 1)cout << ' ';
			cout << g[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 3136
n = int(input())
l = sorted(map(int, input().split()))
ans=0
for i in range(n):
  for j in range(i):
    for k in range(j):
      if l[i]!=l[j]and l[k]!=l[j]and l[k]!=l[i]:
        if l[k] +l[j] > l[i]:
          ans+=1
print(ans)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	double n;
	int ans=0;
	cin >>n;

	//cout<<n*2.0*PI<<endl;
	printf("%.8lf",n*2.0*PI);
}

Measured memory_bytes: 3796
class Combination():
    def __init__(self,n,mod):
        self.mod = mod
        self.factorial = [0 for _ in range(n+1)]
        self.inv = [0 for _ in range(n+1)]
        self.factorial[0] = 1
        self.inv[0] = 1
        for i in range(n):
            self.factorial[i+1] = self.factorial[i]*(i+1)%mod
            self.inv[i+1] = self.inv[i]*pow(i+1,mod-2,mod)%mod
    def comb(self,m,k):
        return self.factorial[m]*self.inv[k]*self.inv[m-k]%self.mod
        
MOD = 10**9+7
H,W,A,B = map(int,input().split())

cb = Combination(H+W,MOD)

ans = 0

for i in range(H-A):
    ans += cb.comb(B-1+i,i)*cb.comb(W-B-1+H-i-1,H-i-1)
    ans %= MOD
    
print(ans)

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  vector<int> x(4), y = {1, 1, 2, 2};
  for (int i = 0; i < 6; i++) {
    int a;
    cin >> a;
    x.at(a - 1)++;
  }
  
  sort(x.begin(), x.end());
  
  if (x == y) cout << "YES\n";
  else cout << "NO\n";
}

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

int main() {
  int a,b,c,x  ;
  cin >> x;
  int first = x%10;
  int second = ((x-first)/10)%10;
  int third = (x-first-second)/100;
  cout << first+second+third << endl;
}


Measured memory_bytes: 256
inpt =[int(i) for i in input().split()]
sort = sorted(inpt)
min = sort[0]
med = sort[1]
max = sort[2]

a = max - med
tmp = min + a
if (max-tmp)%2==0:
    ans = a + (max-tmp)/2
else:
    ans = a + int((max-tmp)/2) + 2

print(int(ans))


Measured memory_bytes: 3060
#import<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long LL;
LL i,j,k,m,n,s,v,w,x,a[200040];
main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>k;
	m=n*(n+1)*(n+2)/6+1;
	for(i=k-2;i++<n;)
	{
		v=i*(i+1)/2;
		w=v+(n-i)*(i+1);
		s=(s+w-v+1)%1000000007;
	}
	cout<<s;
}

Measured memory_bytes: 3656
#include "bits/stdc++.h"
#define ll long long
#define PI 3.1415926535897932384626433832795l
#define MAX_NUM 1000000000
using namespace std;
template <typename T> inline T __lcm(T a,T b)
{
    return (a*b)/__gcd(a,b);
}

ll h[1000000];
ll dp[1000000];
ll n,k;
ll fun(ll i)
{
    if(i>=n)
    {
        return MAX_NUM;
    }
    if(i==n-1)
    {
        return 0;
    }
    if(dp[i]!=-1)
    {
        return dp[i];
    }
    //return dp[i]=min(fabs(h[i]-h[i+1])+fun(i+1),fabs(h[i]-h[i+2])+fun(i+2));
    ll minimum=MAX_NUM;
    for(int j=1;j<=k;j++)
    {
        ll temp=fabs(h[i]-h[i+j])+fun(i+j);
        minimum=min(minimum,temp);
    }
    return dp[i]=minimum;
}

int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    memset(dp,-1,sizeof(dp[0])*1000000);
    ll ans=fun(0);
    printf("%lld\n",ans);
}

Measured memory_bytes: 15104
# -*- coding: utf-8 -*-
A, B, C, D = map(int, input().split())

ans = 0
def gcd(a, b):
    while b :
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

CD = (C * D) // gcd(C, D) 

def l(a, x):
    if a // x == 0:
        return 1
    if a % x != 0:
        t = a // x + 1
        return t
    t = a // x
    return t

cl = l(A, C)
dl = l(A, D)
cdl = l(A, CD)
cr = B // C
dr = B // D
cdr = B // (CD)

ans = B - A + 1 - (cr - cl + 1) - (dr - dl + 1) + (cdr - cdl + 1)
        
print(ans)

Measured memory_bytes: 3064
S = input()
T = input()
lenS = len(S)
lenT = len(T)
lowest = lenT

for st in range(lenS-lenT+1):
    cnt = lenT
    for i in range(lenT):
        if S[st+i] == T[i]:
            cnt -= 1
    if cnt < lowest:
        lowest =cnt
print(lowest)

Measured memory_bytes: 9128
#include<iostream>

using namespace std;
int r, D, x2000;

int main(void) {
	cin >> r >> D >> x2000;

	int xn = x2000;
	for (int i = 0; i < 10; i++) {
		xn = r*xn - D;
		cout << xn << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner input = new Scanner(System.in);
		while(input.hasNext()){
			String[] s = input.nextLine().split(",");
            double x1 = Double.parseDouble(s[0]);
            double y1 = Double.parseDouble(s[1]);
            double x2 = Double.parseDouble(s[2]);
            double y2 = Double.parseDouble(s[3]);
            double x3 = Double.parseDouble(s[4]);
            double y3 = Double.parseDouble(s[5]);
            double x4 = Double.parseDouble(s[6]);
            double y4 = Double.parseDouble(s[7]);
            if(intersect(x1,y1,x2,y2,x3,y3,x4,y4) || intersect(x3,y3,x4,y4,x1,y1,x2,y2)){
            	System.out.println("NO");
            }else{
            	System.out.println("YES");
            }
		}
	}

	static boolean intersect(double x1,double y1,double x2, double y2,double x3, double y3, double x4,double y4){
        return (((x3 - x4) * (y1 - y3) + (y3 - y4) * (x3 - x1))*((x3 - x4) * (y2 - y3) + (y3 - y4) * (x3 - x2)) < 0);
    }
}

Measured memory_bytes: 17168
from collections import deque
n = int(input())
data = deque(list(input() for _ in range(n)))

ans = deque([])
co = 0

for i in data:
    if i[6] == ' ':
        if i[0] == 'i':
            ans.insert(0, i[7:])
            co += 1
        else:
            try:
                ans.remove(i[7:])
                co -= 1
            except:
                pass
    else:
        if i[6] == 'F':
            del ans[0]
            co -= 1
        else:
            del ans[-1]
            co -= 1

for i in range(0, co-1):
    print(ans[i], end=' ')
print(ans[co-1])


Measured memory_bytes: 213184
K = str(input())
D = int(input())
L = len(K)
mod = 10 ** 9 + 7

dp = [[[0] * 2 for _ in range(D)] for _ in range(L+1)]
dp[0][0][0] = 1

for i in range(L):
    nd = int(K[i])
    for j in range(D):
        for k in range(2):
            #lim = 9 if k == 1 else nd
            for d in range(10):
                nk = k
                if k == 0:
                    if d > nd:
                        continue
                    if d < nd:
                        nk = 1
                dp[i+1][(j+d) % D][nk] += dp[i][j][k]
                dp[i+1][(j+d) % D][nk] %= mod

ans = (dp[L][0][0]+dp[L][0][1]-1+mod) % mod

#for i in range(L+1):
#    print(dp[i])
print(ans)

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int r = 0;
    double s = 0;
    double ans = 0;
    for (int i = 0; i < n; i++) {
        while (r < n && r-i < k) {
            s += a[r]+1;
            r++;
        }
        ans = max(ans, s/2);
        s -= a[i]+1;
    }
    cout.precision(7);
    cout << ans << endl;
}



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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

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

  while(true){
    int d,e;
    cin >> d >> e;
    if(d==0) break;
    double ans = 200;
    for(int i=0;i<=d;i++){
      ans = min(ans,abs(sqrt(i*i+(d-i)*(d-i))-e));
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3224
#(36)簡単な計算
while True:
    a,op,b=input().split()
    if op=='?':
        break
    elif op=='+':
        print(int(a)+int(b))
    elif op=='-':
        print(int(a)-int(b))
    elif op=='*':
        print(int(a)*int(b))
    elif op=='/':
        print(int(a)//int(b))


Measured memory_bytes: 5596
fun main(args: Array<String>) {
    val n = readInt()
    println(n / 2 + n % 2)
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)


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

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

    long long ans = 0;
    for (int i = 0; i <= K; i++) {
        for (int j = 0; j <= K; j++) {
            if (S - i - j >= 0 && S - i - j <= K) {
                ans++;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
using namespace std;

int main() {
    int last_month = 4280;
    int w;
    while (cin >> w, 0 <= w) {
        int rate = 1150;
        if (30 < w) rate += (w - 30) * 160;
        if (20 < w) rate += min(10, (w - 20)) * 140;
        if (10 < w) rate += min(10, (w - 10)) * 125;
        cout << last_month - rate << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, X;
int A[100010];

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

void solve() {
	cin >> N >> X;
	for(int i = 0; i < N; i++) {
		cin >> A[i];
	}
	A[N] = X;
	sort(A, A + N + 1);
	int res = A[1] - A[0];
	for(int i = 1; i < N; i++) {
		res = gcd(res, A[i + 1] - A[i]);
	}
	cout << res << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 640
import sys

rule = list(map(int,input().split()))
S = str(input())
S_list = list(S.split('-'))

for i in range(len(S_list)):
	hoge_list = list(S_list[i])
	if len(hoge_list) != rule[i]:
		print('No')
		sys.exit()
print('Yes')


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

using namespace std;

int n, dp[100010][2], h[100010];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i=0; i<n; i++){
        cin >> h[i+1];
    }
    dp[2][0] = abs(h[1]-h[2]);
    dp[2][1] = 10010;
    dp[3][1] = abs(h[1]-h[3]);
    dp[3][0] = abs(h[2]-h[3])+dp[2][0];
    for (int i=4; i<=n; i++){
        dp[i][0] = min(dp[i-1][0], dp[i-1][1]) + abs(h[i]-h[i-1]);
        dp[i][1] = min(dp[i-2][0], dp[i-2][1]) + abs(h[i]-h[i-2]);
        ///cout << dp[i][0] << " " << dp[i][1] << endl;
    }
    cout << min(dp[n][0], dp[n][1]);
    return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(),x=sc.nextInt(),ans=Math.abs(sc.nextInt()-x);
		for(int i=1;i<n;i++) {
			int temp = Math.abs(sc.nextInt()-x);
			ans = gcd(ans,temp);
		}
		sc.close();
		System.out.println(ans);
	}

	static int gcd(int a, int b) {
		if(a<b) {
			int temp = a;
			a=b;
			b=temp;
		}
		int r=a%b;
		while(r!=0) {
			a=b;
			b=r;
			r=a%b;
		}
		return b;
	}
}

Measured memory_bytes: 45176