akhauriyash/Code-Regression huggingface dataset:
n, m = list(map(int, input().split()))
lr = [list(map(int, input().split())) for _ in range(m)]

l_list = [_lr[0] for _lr in lr]
r_list = [_lr[1] for _lr in lr]

a = min(r_list)
b = max(l_list)
print(max(a - b + 1, 0))


Measured memory_bytes: 67032
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
int main(){
	LL n, m, k;
	cin >> n >> m >> k;
	n -= k;
	n = n / (m + k);
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
l = [[0] * 2 for i in range(N)] # [ペナルティ数, 過去に正解したかどうか, ]
ok = 0
ng = 0

for i in range(M):
    p, s = input().split()
    p = int(p)-1
    if s == 'WA':
        l[p][0] += 1
    elif l[p][1] == 0:
        l[p][1] += 1
        ok += 1
        ng += l[p][0]
        
print('{} {}'.format(ok, ng))

Measured memory_bytes: 13172
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> hi(n,0);
  vector<int> dp(n, 9999999);
  dp[0] = 0;

  for(int i=0; i<n; i++){
    cin >> hi[i];
  }


  for(int i=1; i<n; i++){
    if( i == 1 ){
      dp[i] = dp[i-1] + abs(hi[i-1] - hi[i]);
      continue;
    }
    if( dp[i-1] + abs( hi[i-1] - hi[i] ) < dp[i-2] + abs(  hi[i-2] - hi[i] ) ) dp[i] = dp[i-1] + abs(hi[i-1] - hi[i]);
    else dp[i] = dp[i-2] + abs( hi[i-2] - hi[i] );
  }
  cout << dp[n-1];
  return 0;
}


Measured memory_bytes: 1024
void main() {
  problem();
}

void problem() {
  auto a = scan;

  long solve() {
    long ans;
    long count;
    foreach(c; a) {
      if (c == 'R') {
        count++;
        if (ans < count) ans = count;
      } else {
        count = 0;
      }
    }

    return ans;
  }

  solve().writeln;
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

// -----------------------------------------------


Measured memory_bytes: 2752
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,cnt=0,cnt1=0;
	string s;
	cin>>s;
	for(i=0;i<3;i++){
		if(s[i]=='A'){
			cnt++;
		}
		else{
			cnt1++;
		}
	}
	if(cnt>=1&&cnt1>=1){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
T, A  = map(int, input().split())
H = list(map(int, input().split()))

MIN = 10000
ans = 10000

for i in range(N):
  if MIN > abs((T - H[i]*0.006) - A):
    MIN = abs((T - H[i]*0.006) - A)
    ans = i

print(ans+1)

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

using namespace std;

const int N = 300005;

int n;
int a[N];
int sum[2][N];
int p[N], q[N];
bool f[N];

bool check(int x) {
	int j = -1;
	for (int i = 1; i <= n; i += 2) {
		if (i > 1 && f[i - 2] && q[i] > q[j + 2]) j = i - 2;
		f[i] = (sum[1][i] - sum[1][j + 1] + sum[0][j + 1] + sum[0][n] - sum[0][i]) >= x;
	}
	return f[n];
}

int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	int all = 0;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i], all += a[i];
		sum[0][i] = sum[0][i - 1] + (i % 2 == 0) * a[i];
		sum[1][i] = sum[1][i - 1] + (i % 2 == 1) * a[i];
	}
	int lim = max(sum[0][n], sum[1][n]);
	if (n % 2 == 0) {
		cout << lim << ' ' << all - lim; return 0;
	}
	for (int i = 1; i <= n; ++i) p[i] = i;
	sort(p + 1, p + 1 + n, [&] (int x, int y) {
		return sum[0][x - 1] - sum[1][x - 1] < sum[0][y - 1] - sum[1][y - 1];
	});
	for (int i = 1; i <= n; ++i) q[p[i]] = i;
	int l = lim, r = all;
	while (l < r) {
		int mid = (l + r + 1) >> 1;
		if (check(mid)) l = mid; else r = mid - 1;
	}
	cout << l << ' ' << all - l;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl;

typedef long long ll;
const ll INF = 99999999999999;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846;

using namespace std;

int main()
{
    string a, b;
    cin >> a >> b;

    cout << b + a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
using namespace std;
 
int main() {
	ios::sync_with_stdio(false);
	int n,k;
	cin >> n >> k;
	if (n==1) cout << k;
	else if (k==1) cout << n;
	else cout << k*(int)pow(k-1,n-1);
}

Measured memory_bytes: 256
X = gets.chomp
A = X.split('')[0].to_i
B = X.split('')[1].to_i
C = X.split('')[2].to_i
D = X.split('')[3].to_i

if A+B+C+D == 7
    puts "#{A}+#{B}+#{C}+#{D}=7"
elsif A+B+C-D == 7
    puts "#{A}+#{B}+#{C}-#{D}=7"
elsif A+B-C+D == 7
    puts "#{A}+#{B}-#{C}+#{D}=7"
elsif A-B+C+D == 7
    puts "#{A}-#{B}+#{C}+#{D}=7"
elsif A+B-C-D == 7
    puts "#{A}+#{B}-#{C}-#{D}=7"
elsif A-B+C-D == 7
    puts "#{A}-#{B}+#{C}-#{D}=7"
elsif A-B-C+D == 7
    puts "#{A}-#{B}-#{C}+#{D}=7"
else
    puts "#{A}-#{B}-#{C}-#{D}=7"
end


Measured memory_bytes: 1788
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <cassert>
#include <iterator>
#include <complex>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(x, y) memset((x),(y),sizeof(x))
const LL INF = 1e9 + 7;
const int N = 1e2 + 10;
int sum(LL x)
{
	int ret = 0;
	while (x)
	{
		ret++;
		x /= 10;
	}
	return ret;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int ans = INF;
	LL n;
	cin >> n;
	for (LL i = 1; i*i <= n; i++)
	{
		if (n%i) continue;
		ans = min(ans, max(sum(i), sum(n / i)));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define WHITE 0
#define GRAY 1
#define BLACK 2
vector<vector<int>> M(100, vector<int>(100));
vector<int> C(100);
int n, tt;
vector<int> ST(100), PT(100);

int next(int u) {
  rep(i, n) {
    if (M.at(u).at(i) == 1 && C.at(i) == WHITE) {
      return i;
    }
  }
  return -1;
}

void dfs_visit(int u) {
  stack<int> S;
  S.push(u);
  ST.at(u) = ++tt;
  C.at(u) = GRAY;
  while (S.size() > 0) {
    int t = S.top();
    int v = next(t);
    if (v!=-1) {
      if (C.at(v) == WHITE) {
        S.push(v);
        ST.at(v) = ++tt;
        C.at(v) = GRAY;
      }
    } else {
      S.pop();
      PT.at(t) = ++tt;
      C.at(t) = BLACK;
    }
  }
}

void dfs() {
  tt = 0;
  rep(u, n) if (C.at(u) == WHITE) dfs_visit(u);
}

int main() {
  cin >> n;
  rep(i, n) {
    int id, k; cin >> id >> k;
    rep(j, k) {
      int num; cin >> num;
      M.at(id-1).at(num-1) = 1;
    }
  }
  dfs();

  rep(i,n) cout << i+1 << " " << ST.at(i) << " " << PT.at(i) << endl;
  return 0;
}



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

int main() {
  int N, n1, n2, n3, n4;
  cin >> N;

  n4 = N/1000;
  n3 = (N-n4*1000)/100;
  n2 = (N-n4*1000-n3*100)/10;
  n1 = N-n4*1000-n3*100-n2*10;
  
/*  cout << n1 << endl;
  cout << n2 << endl;
  cout << n3 << endl;
  cout << n4 << endl;
*/   
  if ((n1 == n2 && n2 == n3) || (n2 == n3) && (n3 == n4)) {
    cout << "Yes" << endl;
  }
  else {
  	cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)

int a,b;

int main(){
	while(cin>>a>>b&&a){
		int m[4],n[4],x=0,y=0;
		rep(i,4){
			m[i]=(a/(int)pow(10.0,i))%10;
			n[i]=(b/(int)pow(10.0,i))%10;
			x+=m[i]==n[i];
		}
		rep(i,4)rep(j,4)if(i!=j)y+=m[i]==n[j];
		cout<<x<<" "<<y<<endl;
	}
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    forn(i, 0, n) cin >> a[i] >> b[i];
    ll ans = 0, add = 0;
    ford(i, 0, n) {
        a[i] += add;
        ll res = b[i] - a[i] % b[i];
        if (res == b[i]) res = 0;
        ans += res;
        add += res;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
#include <string.h>

using namespace std;
bool isUsed[501];

void solve()
{
	int n, m;
	while (cin >> n >> m, n || m)
	{
		memset(isUsed, 0, sizeof(isUsed));
		vector< vector<int> > connect(n, vector<int>(n));
		for (int i = 0; i < m; ++i)
		{
			int a, b;
			cin >> a >> b;
			--a; --b;
			connect[a][b] = 1;
			connect[b][a] = 1;
		}
		int ans = 0;
		isUsed[0] = true;
		queue<int> que;
		for (int i = 0; i < n; ++i)
		{
			if (connect[0][i])
			{
				++ans;
				que.push(i);
				isUsed[i] = true;
			}
		}
		while (!que.empty())
		{
			int p = que.front();
			que.pop();
			for (int i = 0; i < n; ++i)
			{
				if (connect[p][i] && isUsed[i] == false)
				{
					++ans;
					isUsed[i] = true;
				}
			}
		}
		cout << ans << endl;
	}
}

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

Measured memory_bytes: 2124
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

bool judge_prime(ll x){
    for(ll i=2;i*i <= x;i++){
        if(x%i == 0)return false;
    }
    return true;
}

int main() {
    
    ll x;
    cin >> x;
    while(true){
        if(judge_prime(x)){
            cout << x << endl;
            break;
        }
        x++;
    }

}

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

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    int passed = 0;
    int overseas = 0;
    for (auto &c : s) {
        if (passed < a + b) {
            if (c == 'a') {
                cout << "Yes\n";
                passed++;
            } else if (c == 'b') {
                if (overseas < b) {
                    cout << "Yes\n";
                    passed++;
                    overseas++;
                } else {
                    cout << "No\n";
                }
            } else if (c == 'c') {
                cout << "No\n";
            }
        } else {
            cout << "No\n";
        }
    }

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution
}


Measured memory_bytes: 848
#include <bits/stdc++.h>
using namespace std;
int n,x;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x;
		if(x%2) continue;
		else if(x%3==0 || x%5==0) continue;
		else{
			cout<<"DENIED";
			return 0;
		} 
	}
	cout<<"APPROVED";
	return 0;
}

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

int main() {
	int S[100000];
	int numS;

	cin >> numS;
	for (int i = 0; i < numS; i++) {
		cin >> S[i];
	}

	int numT;
	int sum = 0;
	cin >> numT;
	for (int i = 0; i < numT; i++) {
		int key;
		cin >> key;
		if (*lower_bound(S, S + numS, key) == key) sum++;
	}

	cout << sum << endl;

	return 0;
}

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

int cost(int i, int n, int k, int h[], int dp[])
{
	if(dp[i]!=-1)
	return dp[i];
	if(i==n-1)
	return 0;
	int ans=INT_MAX;
	for(int j=i+1; j<=k+i && j<n; ++j)
	{
		ans=min(ans, abs(h[i]-h[j])+cost(j,n,k,h,dp));
	}
	return dp[i]=ans;
}

int main() {
	int n,  k;
	cin>>n>>k;
	int h[n], dp[n];
	for(int i=0; i<n; ++i)
	{
		cin>>h[i];
		dp[i]=-1;
	}
	dp[n-1]=0;
	cout<<cost(0,n,k,h,dp);
	return 0;
}

Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
int a[4005],b[4005],l[4005],r[4005],mx[4005];
char sa[2005],sb[2005];
int main()
{
	scanf("%s%s",sa,sb);int n=strlen(sa);
	for(int i=1;i<=n;i++)a[i]=sa[i-1]-'0',b[i]=sb[i-1]-'0',a[n+i]=a[i];
	bool f=0;
	for(int i=1;i<=n;i++)if(b[i]==1)f=1;
	for(int i=1;i<=n;i++)
	{
		bool ff=1;
		for(int j=1;j<=n;j++)if(a[i+j]!=b[j])ff=0;
		if(ff){f=1;break;}
	}
	if(!f){puts("-1");return 0;}
	for(int i=1;i<=n;i++)
	{
		l[i]=b[i]?0:n+1;r[i]=b[i]?0:n+1;
		for(int j=1;j<=n;j++)if(i!=j&&b[j])
		{
			if(i<j)r[i]=min(r[i],j-i),l[i]=min(l[i],n+i-j);
			else l[i]=min(l[i],i-j),r[i]=min(r[i],n-i+j);
		}
	}
	for(int i=1;i<=n;i++)l[n+i]=l[i],r[n+i]=r[i]; 
	int ans=5*n;
	for(int i=0;i<=n;i++)
	{
		int res=0;
		for(int j=1;j<=n;j++)if(a[j+i]!=b[j])res++;
		for(int j=0;j<=n;j++)mx[j]=0; 
		for(int j=1;j<=n;j++)if(a[j+i]!=b[j]&&l[j+i])mx[l[j+i]-1]=max(mx[l[j+i]-1],r[j+i]);
		for(int j=n;j>=1;j--)mx[j-1]=max(mx[j-1],mx[j]);
		int rot=5*n;
		for(int j=0;j<=n;j++)
		{
			int tl=-j,tr=mx[j],p=-i,t=5*n,t1=5*n;
			if(tl<=p&&p<=tr)t1=min(tr-tl+tr+p-tl,tr-tl-tl+tr-p);
			else if(tl>p)t1=tr+tr-p;
			p+=n;
			if(tl<=p&&p<=tr)t=min(tr-tl+tr+p-tl,tr-tl-tl+tr-p);
			else if(tr<p)t=p-tl-tl;
			rot=min(rot,min(t,t1));
		}
		ans=min(ans,res+rot);
	}
	printf("%d\n",ans);
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  int x;
  cin >> x;
  for(int i = 0; i < x; ++i)
  cout << "ACL";

}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3584
n = int(input())
csf = []
for i in range(n - 1):
    csf.append(list(map(int, input().split())))
for i in range(n):
    t = 0
    for j in range(n - i - 1):
        c, s, f = (csf[i + j][k] for k in range(3))
        t = (max(t - 1, s - 1) // f + 1) * f + c
    print(t)

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
int main()
{
    int n;
    cin >> n;
    ll a[n];
    REP(i, n) cin >> a[i];
    ll sum = 0;
    REP(i, n) sum += a[i];
    ll ss = 0, tt = 0;
    ss += a[0], tt = sum - a[0];
    ll ans = abs(ss - tt);
    for (int i = 1; i < n - 1; i++) {
        ss += a[i];
        tt -= a[i];
        ans = min(ans, abs(ss - tt));
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <deque>
#include <algorithm>

using namespace std;

void insertionSort(deque<int>& a, int n, int g, int& cnt) {
    for (int i = g; i <= n - 1; ++i) {
        int v = a[i];
        int j = i - g;
        while ((j >= 0) && (a[j] > v)) {
            a[j + g] = a[j];
            j = j - g;
            ++cnt;
        }
        a[j + g] = v;
    }
}

void shellSort(deque<int> &a, int n) {
    int cnt = 0;
    
    int m = 1;
    deque<int> g;
    g.push_front(1);

/*    if (n < 8) {
        m = 1;
        g.push_back(1);
    }
    else {
        int nx = n;
        for (; ; ) {
            nx /= 4;
            ++m;
            if (nx > 1) {
                g.push_back(nx);
            }
            else {
                g.push_back(1);
                break;
            }
        }

    }*/

    for (int j = 1; ; ++j) {
        
        int h = 3;
        for (int i = 0; i < j; ++i) {
            h *= 3;
        }
        h = (h - 1) / 2;

        if (h >= n) break;
        g.push_front(h);
        ++m;
    }

    for (int i = 0; i <= m - 1; ++i) {
        insertionSort(a, n, g[i], cnt);
    }

    cout << m << endl;
    for (int i = 0; i < m; ++i) {
        cout << g[i] << " ";
    }
    cout << endl << cnt << endl;
    for (int i = 0; i < n; ++i) {
        cout << a[i] << " ";
    }

}
int main(int argc, char* argv[]) {
    deque<int> a;
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        a.push_back(x);
    }

    shellSort(a, n);

    return 0;
}




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

int main()
{
	int Q;
	int c, a, n;

	scanf("%d", &Q);

	for (int i = 0; i < Q; i++){
		int cnt = 0;
		scanf("%d%d%d", &c, &a, &n);
		// type CAN
		while (c && a && n){ // coder:1, algorithmer:1, navigator:1
			c--;
			a--;
			n--;
			cnt++;
		}
		// type CCA
		while (c >= 2 && a){ // coder:2, algorithmer:1
			c -= 2;
			a--;
			cnt++;
		}
		// type CCC
		while (c >= 3){ // coder:3
			c -= 3;
			cnt++;
		}
		printf("%d\n", cnt);
	}

	return (0);
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <sstream>

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

using namespace std;

template<class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmix(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<int>;
using vvi = vc<vi>;

using ll = long long;


int main() {
    int  n, m, l;
    auto s  = string();
    auto ss = stringstream();
    getline(cin, s);

    REP(i, int(s.size())) {
        if (isupper(s[i])) s[i] = tolower(s[i]);
        else s[i] = toupper(s[i]);
    }

    cout << s + "\n";
    return 0;
}



Measured memory_bytes: 3148
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const X = input[0].map(Number);

  let answer = 0;

  X.forEach((x, index) => {
    if (x === 0) {
      answer = index + 1;
    }
  });

  return answer;
};

console.log(main(read()));


Measured memory_bytes: 29592
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define ll long long

int main() {
  int a,b;cin>>a>>b;
  int ans=a+b;
  ans=max(ans,a-b);
  ans=max(ans,a*b);
  cout<<ans;
}

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

using  namespace std;
int main() {
    int n, k;
    cin >> n >> k;
    map<int, int> m;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (m.count(x) == 0) {
            m.emplace(x, 0);
        }
        m[x]++;
    }
    vector<int> a(m.size());
    int i = 0;
    for (auto v:m) {
        a[i++] = v.second;
    }
    sort(a.begin(), a.end());
    int sum = 0;
    if (a.size() < k){
        cout << sum << endl;
        return 0;
    }
    for (i = 0; i < a.size() - k; i++) {
        sum += a[i];
    }
    cout << sum << endl;
}


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

int main(int argc, char const *argv[])
{
	int n;
	while(~scanf("%d",&n)){
		int b[n+5];
		for (int i = 0; i < n-1; ++i)
		{
			scanf("%d",&b[i]);
		}
		int a[n+5]; //max(a1,a2)
		a[0]=b[0];
		for (int i = 0; i < n-1; ++i)
		{
			if (b[i]<b[i+1])
			{
				a[i+1]=b[i];
			}
			else{
				a[i+1]=b[i+1];
			}
		}
		a[n-1]=b[n-2];
		int ans=0;
		for (int i = 0; i < n; ++i)
		{
			//printf("%d\n",a[i] );
			ans+=a[i];
		}
		printf("%d\n",ans );
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("avx,popcnt")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
const int maxn = 1<<17, mod = 1e9 + 7;
ll n, _a[maxn], a[maxn], mn[maxn], mx[maxn];

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	char t;
	for(int r = 0, i = 0; i < n; i++) {
		if(i) cin >> t;
		else t = '+';
		cin >> a[i];
		if(t == '-') a[i] = -a[i];
		_a[i] = a[i];
		if(r) a[i] = -a[i];
		if(t == '-') r ^= 1;
	}
	//for(int i = 0; i < n; i++) cout << a[i] << " "; cout << '\n';
	ll ss = 0, _mn = 0, _mx = 0;
	for(int i = n; i--;) {
		ss += a[i];
		mn[i] = min(mn[i+1] + a[i], _a[i] < 0 ? ss + _mn : (1ll<<60));
		mx[i] = max(mx[i+1] + a[i], _a[i] < 0 ? ss + _mx : -(1ll<<60));
		_mn = min(_mn, -ss-mx[i]);
		_mx = max(_mx, -ss-mn[i]);
		//cout << i << " " << mn[i] << " " << mx[i] << '\n';
	}
	cout << mx[0];
	return 0;
}


Measured memory_bytes: 3840
#define _USE_MA_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a>b)swap(a,b);
    Yes(a<c&&c<b);
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

#define pb push_back
#define mk make_pair
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define sf(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pf(a) printf("%d\n",a);
#define pfl(a) printf("%lld\n",a);
#define TEST int test; cin >> test;while(test--)
#define ii pair<int,int>
#define iil pair<ll,ll>
#define loop(i,a,b) for(int i = a ; i < b ; i++)
#define INF 2147483647


int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const double pi = acos(-1.0);
ll power(ll x, unsigned long long y)
{
    int res = 1;     // Initialize result

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x);

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x);  // Change x to x^2
    }
    return res;
}


map<ll, ll> mp;
vector<ll>v;
void solve()
{
    ll n, m, k, pos, pos1;

    cin >> n >> k;
    ll a[n+10], p[n+10];
    int f = 0;
    for(int i = 1 ; i <= n ; i++)
    {
        cin >> a[i];
        p[a[i]] = i;

    }

    ll i = 1;
    m = k;
    while(m--)
    {
        if(a[i] == i)
        {
            //cout << a[i] << endl;
            f = 1;
            break;
        }
        //cout << a[i] << endl;
        if(mp.find(a[i]) != mp.end())
        {
            pos = a[i];
            break;
        }
        v.pb(a[i]);
        mp[a[i]] = 1;
        i = a[i];
    }
    //cout << m << endl;
    if(f) cout << a[i] << endl;
    else if(m == -1) cout << i << endl;
    else
    {
        for(int i = 0 ; i < v.size() ; i++)
        {
            if(v[i] != pos) k--;
            else
            {
                pos1 = i;
                break;
            }

        }
        //if(v.size() == 1) cout << v[0] << endl;
//        else
//        {
            ll diff = v.size() - pos1;
            k %= diff;
            if(k == 0) k = diff;
            cout << v[pos1 + k - 1] << endl;
        //}

    }


}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    solve();
    return 0;
}


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

using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()

#include "bits/stdc++.h"

struct RMQ {
  using t = long long;
  constexpr static t id() { return std::numeric_limits<t>::min()/2; }
  static t op(const t &a, const t &b) { return std::max(a, b); }
};

struct RmQ {
  using t = long long;
  constexpr static t id() { return 1e9; }
  static t op(const t &a, const t &b) { return std::min(a, b); }
};

template <typename M>
struct SegmentTree {
  int n;
  using T = typename M::t;
  std::vector<T> nodes;

  SegmentTree(std::vector<T> v) {
    int sz = (int)v.size();
    n = 1;
    while (n < sz) n *= 2;
    nodes.resize(2 * n - 1, M::id());
    for (int i = 0; i < sz; i++) nodes[i + n - 1] = v[i];
    for (int i = n - 2; i >= 0; i--)
      nodes[i] = M::op(nodes[i * 2 + 1], nodes[i * 2 + 2]);
  }
  SegmentTree(int _n) {
    n = 1;
    while (n < _n) n *= 2;
    nodes.resize(2 * n - 1, M::id());
  }
  void update(int k, T a) {
    k += n - 1;
    nodes[k] = a;
    while (k > 0) {
      k = (k - 1) / 2;
      nodes[k] = M::op(nodes[2 * k + 1], nodes[2 * k + 2]);
    }
  }
  T get(int k) { return nodes[k + n - 1]; }
  T query(int a, int b) { return query(a, b, 0, 0, n); }

 private:
  T query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return M::id();
    if (a <= l && r <= b)
      return nodes[k];
    else {
      T vl = query(a, b, 2 * k + 1, l, (r + l) / 2),
        vr = query(a, b, 2 * k + 2, (r + l) / 2, r);
      return M::op(vl, vr);
    }
  }
};
int main() {
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  vector<int> dist(n + 1,1e9), rdist(n + 1,1e9);
  auto calc = [&](vector<int> &d) {
    SegmentTree<RmQ> st(n + 1);
    st.update(0, 0);
    d[0] = 0;
    REP(i, n) {
      if (s[i + 1] == '1') continue;
      d[i + 1] = st.query(max(0, i + 1 - m), i + 1)+1;
      st.update(i + 1, d[i + 1]);
    }
  };
  calc(dist);
  reverse(ALL(s));
  calc(rdist);
  reverse(ALL(s));
  reverse(ALL(rdist));
  int d = dist[n];
  if(1e9<=d){
      cout<<-1<<endl;
      return 0;
  }
  vector<vector<int>> pos(n+1);
  REP(i, n + 1) { if(rdist[i]<1e9)pos[rdist[i]].push_back(i); }
  int now=0;
  int rem=d;
  vector<int> ans;
  while(now<n){
      auto c=*lower_bound(ALL(pos[rem-1]),now);
      ans.push_back(c-now);
      rem--;
      now=c;
  }
  for(auto a:ans)cout<<a<<" ";
  cout<<endl;

}


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

int main() {
  int n; cin >> n;
  vector<int> A(n);
  double inv;
  for(int i = 0; i < n; ++i){ 
    cin >> A[i];
    inv += 1.0 / A[i];
  }
  cout << 1/inv << endl;
}


Measured memory_bytes: 256
N = int(input())
a = []
for _ in range(N):
    a.append(int(input()))

cnt = 0
s = a[0]

if s == 2:
    print(cnt + 1)
else:
    for i in range(N):
        s = a[s-1]
        cnt += 1
        if s ==  2:
            print(cnt + 1)
            break
        if i == N-1:
            print('-1')

Measured memory_bytes: 7084
#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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, x;
	cin >> a >> b >> x;
	ll ans = b/x + 1 - (a == 0 ? 0LL : (a-1)/x + 1);
	cout << ans << endl;
	return 0;
}

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

int main() {
  ll N,M;
  cin >> N >> M;
  vector<ll> S(M);
  vector<ll> C(M);
  for(ll i=0;i<M;i++){
    cin >> S.at(i) >> C.at(i);
  }
  vector<ll> Number(N,-1);
  for(ll i=0;i<M;i++){
    for(ll j=0;j<i;j++){
      if(S.at(j)==S.at(i) && C.at(j)!=C.at(i)){
        cout << -1 << endl;
        return 0;
      }
    }
    Number.at(S.at(i)-1)=C.at(i);
  }
  if(Number.at(0)==0 && N!=1){
    cout << -1 << endl;
    return 0;
  }
  else if(Number.at(0)==-1 && N!=1){
    Number.at(0)=1;
  }
  else if(Number.at(0)==-1 && N==1){
    Number.at(0)=0;
  }
  for(ll i=0;i<N;i++){
    if(Number.at(i)==-1){
      Number.at(i)=0;
    }
    cout << Number.at(i);
  }
}


Measured memory_bytes: 3604
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

typedef long long int64;
typedef pair<int, int> ii;
const int MOD = 1e9 + 7;

int main() {
    int n, m;
    scanf("%d", &n);
    scanf("%d", &m);
    vector<vector<int>> v(n);
    for (int i = 0; i < n; ++i) {
	vector<int> vv(m);
	for (int j = 0; j < m; ++j) {
	    scanf("%d", &vv[j]);
	}
	v[i] = vv;
    }
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
	for (int j = i + 1; j < n; ++j) {
	    int sum = 0;
	    for (int k = 0; k < m; ++k) {
		sum += pow(v[i][k] - v[j][k], 2);
	    }
	    int res = sqrt(sum);
	    if (res * res == sum) ++cnt;
	}
    }
    printf("%d\n", cnt);
    return 0;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


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

  vector<int> b(m);
  REP (i, m) cin >> b[i];

  int ans = 0;
  REP (i, n) {
    LL sum = 0;
    REP (j, m) {
      int a;
      cin >> a;
      sum += b[j] * a;
    }
    if (sum + c > 0) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_set>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

typedef long long ll;

int M;
struct K {
  int d;
  ll c;
};

K vs[200000+10];

int main(void) {
  scanf("%d", &M);
  ll sum = 0;
  ll len = 0;
  REP(i, M) {
    scanf("%d%lld", &vs[i].d, &vs[i].c);
    sum += vs[i].d * vs[i].c;
    len += vs[i].c;
  }
  ll res = 0;
  // cerr << len << " " << sum << endl;
  res += len-1;
  res += (sum-1) / 9;
  cout << res << endl;
  return 0;
}


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

int main() {

    int a,b;
    cin >> a >> b;

    if(a == 1){
        if(b == 2){
            cout << 3 << endl;
        }
        if(b == 3){
            cout << 2 << endl;
        }
    }
    if(a == 2){
        if(b == 1){
            cout << 3 << endl;
        }
        if(b == 3){
            cout << 1 << endl;
        }
    }
    if(a == 3){
        if(b == 2){
            cout << 1 << endl;
        }
        if(b == 1){
            cout << 2 << endl;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define BUF 1e5
constexpr int INF = (1LL << 31) - 1;
constexpr ll mod = 1e9 + 7;
using namespace std;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
class LazySegmentTree {
public:
    vector<T> node;
    vector<bool> lazyflag;
    vector<T> lazy;
    int size;
    int n;
    LazySegmentTree() {}
    LazySegmentTree(vector<T> in) {
        int in_sz = in.size();
        n = 1;
        while (n < in_sz) {
            n *= 2;
        }
        size = n * 2 - 1;
        node.resize(size, 0);
        lazy.resize(size, 0);
        lazyflag.resize(size, 0);
        for (int i = 0; i < in_sz; i++) {
            node[n - 1 + i] = in[i];
        }
        init_dfs(0);
    }

    int init_dfs(int now) {
        if (2 * now + 1 >= size)
            return node[now];
        node[now] = init_dfs(2 * now + 1) + init_dfs(2 * now + 2);
        return node[now];
    }
    void eval(int now, int l, int r) {
        if (lazyflag[now] == 1) {
            node[now] += lazy[now];
            if (r - l > 1) {
                lazy[2 * now + 1] += lazy[now] / 2;
                lazyflag[2 * now + 1] = 1;
                lazy[2 * now + 2] += lazy[now] / 2;
                lazyflag[2 * now + 2] = 1;
            }
            lazyflag[now] = 0;
            lazy[now] = 0;
        }
    }

    void add(int a, int b, T val) {
        _add(a, b + 1, val, 0, 0, n);
    }

    void _add(int a, int b, T val, int now, int l, int r) {
        eval(now, l, r);
        if (r <= a || b <= l)
            return;
        if (a <= l && r <= b) {
            lazy[now] += (r - l) * val;
            lazyflag[now] = 1;
            eval(now, l, r);
            return;
        }
        _add(a, b, val, 2 * now + 1, l, (l + r) / 2);
        _add(a, b, val, 2 * now + 2, (l + r) / 2, r);
        node[now] = node[2 * now + 1] + node[2 * now + 2];
    }

    T query(int a, int b) {
        return _query(a, b + 1, 0, 0, n);
    }

    T _query(int a, int b, int now, int l, int r) {
        if (r <= a || b <= l)
            return 0;
        eval(now, l, r);
        if (a <= l && r <= b)
            return node[now];
        T val_l = _query(a, b, 2 * now + 1, l, (l + r) / 2);
        T val_r = _query(a, b, 2 * now + 2, (l + r) / 2, r);
        return val_l + val_r;
    }
};

int main() {
    cin >> N >> Q;
    vector<ll> v(N, 0);
    LazySegmentTree<ll> lst(v);
    for (int q = 0; q < Q; q++) {
        int c;
        cin >> c;
        if (c == 0) {
            int s, t, x;
            cin >> s >> t >> x;
            s--, t--;
            lst.add(s, t, x);
            // int tmp = 2;
            // for (int i = 0; i < lst.size; i++) {
            //     cout << lst.node[i] + lst.lazy[i] << " ";
            //     if (tmp - 1 == i + 1) {
            //         cout << endl;
            //         tmp *= 2;
            //     }
            // }
        } else {
            int s, t;
            cin >> s >> t;
            s--, t--;
            cout << lst.query(s, t) << endl;
        }
    }
}


Measured memory_bytes: 8680
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;

const int INF = 1 << 29;
typedef pair<int, int> P;

int n;

int main(void)
{
	while(cin >> n && n)
	{
		long long dp[101][21] = {0};
		vector<int> input; input.resize(n);
		for(int i = 0; i < n; i++) cin >> input[i];
		dp[0][input[0]] = 1;
		for (int i = 0; i < n - 2; i++)
		{
			for (int j = 0; j <= 20; j++)
			{
				if(!dp[i][j]) continue;
				if(j + input[i + 1] <= 20) dp[i + 1][j + input[i + 1]] += dp[i][j];
				if(j - input[i + 1] >= 0) dp[i + 1][j - input[i + 1]] += dp[i][j];
			}
		}
		cout << dp[n - 2][input[n - 1]] << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>

using namespace std;

int main(){

    int N;cin>>N;
    map<int,int> have;
    REP(i,N){
        int d;cin>>d;
        have[d]++;
    }
    int M;cin>>M;
    REP(i,M){
        int t;cin>>t;
        if(have[t]==0){
            cout<<"NO"<<endl;
            return 0;
        }
        have[t]--;
    }
    cout<<"YES"<<endl;

    return 0;
}

Measured memory_bytes: 9600
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	pre := s[0]
	for i := 1; i < 4; i++ {
		if pre == s[i] {
			fmt.Println("Bad")
			return
		}
		pre = s[i]
	}
	fmt.Println("Good")
}


Measured memory_bytes: 512
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long const mod = (1e9)+7;

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    if(a+b+c>= 22)
        cout<<"bust"<<"\n";
    else
        cout<<"win"<<"\n";
}

Measured memory_bytes: 3528
#include<stdio.h>
int main()
{
	int n,a,b,x,y;
	while(scanf("%d",&n),n)
	{
		for(a=b=0;n--;)scanf("%d%d",&x,&y),x==y?a+=x,b+=y:((x>y?a:b)+=x+y);
		printf("%d %d\n",a,b);
	}
	return 0;
}

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

int main() {
    int n, cnt = 0;
    string s;
    cin >> n >> s;
    rep(i,n-1){
        if(s[i] != s[i+1]) cnt++;
    }
    cout << cnt+1 << endl;
}


Measured memory_bytes: 512
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt(); //A cm 時針
    int B = sc.nextInt(); //B cm 分針
    double H = sc.nextInt(); //時
    double M = sc.nextInt(); //分
    
    //時針の0時からの傾き
    double Y = 360 * (H / 12)+30*(M/60);
    //分針の0時からの傾き
    double X = 360 * (M / 60);
    //求める角度
    double angle = X - Y;
    //求める長さ
    double C = 0.00000000000000;
    C = A*A + B*B - 2*A*B*Math.cos(Math.toRadians(angle));
    
    //System.out.println(angle);
    System.out.println(Math.sqrt(C));
    
   
  }
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9+7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amin(T& a,T b){ a=min(a,b);}
template <class T> void amax(T& a,T b){ a=max(a,b);}

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

	cin >>n >>m;
	VI a(m);
	rep(i, m) cin >>a[i];
	const VI mt ={0, 2,5,5,4,5,6,3,7,6};
	vector<string> dp(n+5);
	rep(j, n)  if(sz(dp[j])>0 || j==0) rep(i, m){
		int pp = j+mt[a[i]];
		auto nws = dp[j] + to_string(a[i]);
		if(pp > n ) continue;
		if(sz(dp[pp]) < sz(dp[j]) +1 ||
			(sz(dp[pp]) == sz(dp[j]) +1 &&  dp[pp] <  nws)) dp[pp] =  nws;
	}
	
	//for(auto x : dp) cout<<x <<": "; puts("dp");
	
	cout << dp[n] <<"\n";
	return 0;
}



Measured memory_bytes: 33024
#include <cstdio>

int main(){
    int x; scanf("%d", &x);
    int ans;
    if (x>=400 && x<=599) ans = 8;
    else if (x>=600 && x<=799) ans = 7;
    else if (x>=800 && x<=999) ans = 6;
    else if (x>=1000 && x<=1199) ans = 5;
    else if (x>=1200 && x<=1399) ans = 4;
    else if (x>=1400 && x<=1599) ans = 3;
    else if (x>=1600 && x<=1799) ans = 2;
    else if (x>=1800 && x<=1999) ans = 1;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1736
const Main = input => {
    const inp = input.split("\n");//["K", "A B"]
    const ab = inp[1].split(" ");//["A", "B"]
    const k = parseInt(inp[0], 10);
    const a = parseInt(ab[0], 10);
    const b = parseInt(ab[1], 10);

    let result = "NG";
    const min = Math.ceil(a / k);
    if(a <= k*min && k*min <= b) result = "OK";
    console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int a,b;
    Scd2(a,b);

    YesNo(a==b);

    return 0;
}



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

using namespace std;
using ll = long long;

int main() {
  ll N;
  cin >> N;
  vector<ll> H(N);
  ll m = 0;
  ll ret = 0;
  for (int i = 0; i < N; ++i) {
    cin >> H[i];
    if(H[i] >= m){
      ret++;
      m = H[i];
    }
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <queue>
#include <unordered_map>
#define ll long long
#define pii pair <int, int>
#define pll pair <long long, long long>
#define plxy pair <long long, pll>
#define INT_MAX 1e18
#define Keep_calm_You_are_still_learning ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
using namespace std;
const int mod=1e9+7;
const int N=1e5+5;
ll fact[1000006],inv[1000006];
ll fp(ll base,ll exp)
{
    if (exp == 0)
        return 1;
    ll ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}
void calcFacAndInv(ll n)
{
    fact[0] = inv[0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        fact[i] = (i * fact[i - 1]) % mod;
        inv[i] = fp(fact[i], mod - 2);
    }
}
ll ncr(ll n, ll r)
{
    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}

ll npr(ll n, ll r)
{
    return (fact[n] * inv[n - r]) % mod;
}
ll n,k;
int main()
{
    Keep_calm_You_are_still_learning
    calcFacAndInv(1e5);
    cin>>n>>k;
    for(ll i=k;i>=1;i--)
    {
        if(n-k+1>=k-i+1)
        {
            cout<<(((ncr(n-k+1,k-i+1))%mod)*((ncr(k-1,i-1))%mod))%mod<<endl;
        }
        else
        {
            cout<<0<<endl;
        }
    }
    return 0;
}


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

void trace(int i, int min, int now) {
    cout << i << " (min, now)=(" << min << ", " << now << ")\n";
}

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

    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i];

    int count = 0;
    int min_elem = 2 * 100001;
    rep(i, n) {
        min_elem = min(p[i], min_elem);
        if (p[i] <= min_elem) {
            count++;
        }
        // trace(i, min_elem, p[i]);
    }

    cout << count << endl;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A+B > C+D)
    cout << "Left" << endl;
  else if (A+B < C+D)
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
}

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

int main(){
    int n; cin >> n;
    int times = 0;
    string ans = "No";

    for(int i = 0; i < n; i++){
        int a, b; cin >> a >> b;
        if(a == b){
            times++;
        }else{
            times = 0;
        }
        if(times == 3){
            ans = "Yes";
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 3596
X,Y,A,B,C= map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

ep = p[:X][::-1]
eq = q[:Y][::-1]
ans = sum(ep)+sum(eq)

ip = 0
iq = 0
for pr in r:
    if ip >= X:
        if iq >= Y:
            break
        elif eq[iq] < pr:
            ans += -eq[iq] + pr
            iq += 1
        else:
            break
    elif iq >= Y:
        if ep[ip] < pr:
            ans += -ep[ip] + pr
            ip += 1
        else:
            break
    else:
        if ep[ip] < eq[iq]:
            if pr > ep[ip]:
                ans += -ep[ip] + pr
                ip += 1
            else:
                break
        else:
            if pr > eq[iq]:
                ans += -eq[iq] + pr
                iq += 1
            else:
                break
print(ans)





Measured memory_bytes: 105444
#include<bits/stdc++.h>
using namespace std;
 
#define INF 1234567890
#define ll long long

int N;

int main()
{
	scanf("%d", &N);
	int cnt = 0;
	for(int i=1; i<=N; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		if (a == b) cnt++;
		else cnt = 0;
		if (cnt == 3) return !printf("Yes");
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 3820
#include <stdio.h>

int main(){

  int n,x,c;
  int i,k,t;

  while(1){
    scanf("%d%d",&n,&x);
    if(n+x==0) break;
    c=0;
    
    for(i=1; i<n+1; ++i){
      for(k=i+1; k<n+1; ++k){
	for(t=k+1; t<n+1; ++t){
	  if(x==i+k+t){
	    ++c;
	  }
	}
      }
    }

    printf("%d\n",c);
  }


  return 0;
}



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

using namespace std;

#define int long long
#define mem(v , val) memset(v , val , sizeof val)
#define endl '\n'


void solve()
{
    int n , k;
    cin >> n >> k;
    int a[n];
    for(int i = 0 ;i < n ; i++)
        cin >> a[i];

    sort(a , a + n);

    int sum = 0;
    for(int i = 0 ; i < k;  i++)
        sum += a[i];

    cout << sum << endl;
    return;
}


int32_t main()
{
    int t= 1;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(long long i=0;i<n;i++)
#define REPP(i,m,n) for(long long i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
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 main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> v(N);
    REP(i,N) cin >> v[i];
    sort ALL(v);
    double a = v[0];
    REP(i,N-1){
        a += v[i+1];
        a/=2;
    }
    cout << scientific << a << endl;
}

Measured memory_bytes: 256