akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int, ii> iii;
typedef vector<pair<pair<int,int>,int>> viii;
typedef vector<pair<pair<ll,ll>,ll>> viiil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000
#define MOD 1000000007;

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int c = 0;
    rep(i, n) {
        if (s[i] == 'R') {
            c++;
        }
    }
    int fs = 0;
    rep(i, c) {
        if (s[i] == 'R') {
            fs++;
        }
    }
    cout << c - fs << endl;
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    //querySolve();
    solve();

}


Measured memory_bytes: 3764
n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))
p.sort()

l1 = []
l2 = []
l3 = []

for i in range(n):
    if p[i] <= a:
        l1.append(p[i])
 
for i in range(n):
    if a+1 <= p[i] <= b:
        l2.append(p[i])
 
for i in range(n):
    if b < p[i]:
        l3.append(p[i])

print(min(len(l1),len(l2),len(l3)))




Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<cassert>
#include<map>
#include<set>

typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 5000000000000;
//typedef std::pair<int, int> P;
struct edge { int to;double cost; };
#define VMAX 1010

     ll N,K;
     ll A,B,C;
     ll P[11];
     ll ans;
     std::priority_queue<std::pair<ll,string>> Q;
     std::priority_queue<string,vector<string>,greater<string>> Q1;
     std::map<string, ll> M;
     ll gcd(ll a,ll b){
         if(b==0)return a;
         return gcd(b,a%b);
     }
int main() {
    cin>>N;
    EREP(i,N){
        EREP(j,N){
            EREP(k,N){
                ans+=gcd(gcd(i,j),k);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int n, ans=0; cin >> n;
    vector<int> sum(n), d(n);
    for(int i = 0; i < n; i++){
        cin >> d[i];
        if(i) sum[i] = sum[i-1] + d[i];
        else sum[i] = d[i];
    }
    for(int i = 0; i < n; i++){
        ans += d[i] * (sum[n-1] - sum[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct node
{
    ll x,y;
}a[110];
int ans,n;
map<pair<ll,ll>,int>s;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i].x>>a[i].y;
	for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
    if(i!=j) s[{a[i].x-a[j].x,a[i].y-a[j].y}]++;
    for(auto i:s) ans=max(ans,i.second);
    printf("%d\n",n-ans);
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline

h, n = map(int, input().split())
A = []
B = []
for i in range(n):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)

Ama = max(A)

dp=[float("inf")]*(h+Ama+1)
dp[0]=0

for i in range(n):
    for j in range(A[i], h+Ama+1):
        dp[j]=min(dp[j],dp[j-A[i]]+B[i])
print(min(dp[h:]))

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

int main()
{
	// fast;
	// #ifndef ONLINE_JUDGE
 //        freopen("input.txt", "r", stdin) ;
 //        // freopen("out.txt", "w", stdout);
 //    #endif
    int n,k,x,y;
    scanf("%d %d %d %d",&n,&k,&x,&y);
    if (n<=k)
    {
    	printf("%d", n*x);
    }
    else
    {
    	printf("%d", k*x + (n-k)*y);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto i:a) cout << i << " "; cout << endl
#define adb2(a) for(auto i:a) cout << i.first << " " << i.second << endl;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define N 100010
using namespace std;

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

    if(s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;

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

    vector<int> a(n);

    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }

    cout << a.at(n - 1);
    for (int i = n - 2; i >= 0; i--) {
        cout << " " << a.at(i);
    }
    cout << endl;
}



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

int main() {
  int n;
  while(cin >> n && n) {
    int sum = 0;
    for(int i = 0; i < n; ++i) {
      int x, y, h, w;
      cin >> x >> y >> h >> w;
      int s = x + y + h;
      if(s <= 60 && w <= 2) sum += 600;
      else if(s <= 80 && w <= 5) sum += 800;
      else if(s <= 100 && w <= 10) sum += 1000;
      else if(s <= 120 && w <= 15) sum += 1200;
      else if(s <= 140 && w <= 20) sum += 1400;
      else if(s <= 160 && w <= 25) sum += 1600;
    }
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
// D - Floor Function

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

ll A, B, N;

ll calc(ll x) {
	return (((ll)(A * x / B)) - A * ((ll)(x / B)));
}

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

	cout << calc(min(B-1, N)) << endl;

	return 0;
}

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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, s=0, bs=0, m=0, c=0;
  cin >> n;
  vecll a(n), b(n);
  forll(i, 0, n){
	cin >> a[i];
	s += a[i];
  }
  forll(i, 0, n){
	cin >> b[i];
	a[i] = a[i] - b[i];
	if (a[i] < 0){
	  m -= a[i];
	  c++;
	}
	bs += b[i];
  }

  if (bs > s){
	cout << -1 << endl;
	return 0;
  }
  
  sort(a.begin(), a.end());
  
  forll(i, 0, n){
	if (m <= 0)
	  break;
	m -= a[a.size() - i - 1];
	c++;
  }
  cout << c << endl;
  
}


Measured memory_bytes: 1792
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int a=sc.nextInt();
		int[] x=new int[n];
		for(int i=0; i<n; i++){
			x[i]=sc.nextInt();
		}
		long[][][] dp=new long[n][2501][n+1];
		dp[0][x[0]][1]=1;
		long ans=0;
		for(int i=1; i<n; i++){
			dp[i][x[i]][1]=1;
			for(int j=0; j<=50*i; j++){
				for(int k=1; k<=n; k++){
					dp[i][j+x[i]][k]+=dp[i-1][j][k-1];
					dp[i][j][k]+=dp[i-1][j][k];
				}
			}
		}
		for(int i=1; i<=n; i++){
			ans+=dp[n-1][a*i][i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 87016
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
const int N=5e5+5;
char s[N];
typedef std::pair<int,int> P;
int main() {
    int n;
    scanf("%s",s+1);
    n=strlen(s+1);
    long long ans=0;
    int l=0,r=0;char now='<';
    std::vector<P> g;
    for(int i=1;i<=n;i++) {
        if(s[i]!=now) {
            if(s[i]=='<') g.push_back(P(l,r)),l=1,r=0,now=s[i];
            else {
                now=s[i];
                r++;
            }
        }
        else if(s[i]=='<') l++;
        else r++;
    }
    if(l+r) g.push_back(P(l,r));
    for(P c:g) {
        l=c.first,r=c.second;
        if(l<r) std::swap(l,r);
        ans+=1LL*l*(l+1)/2+1LL*r*(r-1)/2;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1912
X = int(input())

if 400<= X <= 599:
    print(8)
elif 600<= X <=799:
    print(7)
elif 800<= X <=999:
    print(6)
elif 1000<= X <=1199:
    print(5)
elif 1200<= X <=1399:
    print(4)
elif 1400<= X <=1599:
    print(3)
elif 1600<= X <=1799:
    print(2)
elif 1800<= X <=1999:
    print(1)

Measured memory_bytes: 61660
'''
A = 500 とする。
このとき、X = 10^9 となるのは、 B = 499.9968... のとき。
→ AまたはB (の絶対値) が大きすぎると、Xが10^9に収まらない。

A, Bの探索範囲は -120~120で十分。
'''

from itertools import product

def main():
    X = int(input())
    for A, B in product(range(-150, 150), range(-150, 150)):
        if A**5 - B**5 == X:
            print(A, B)
            return

main()



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

using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll A[300001];
int main() {
    ll n,k;
	cin>>n>>k;
	
	for(int i=0;i<n;i++) cin>>A[i];
	sort(A,A+n);
	ll ans=1,sign=1;
	int l=0,r=n-1;
	if(k%2){
        ans=A[r--];
        --k;
        if(ans<0) sign=-1;
	}
	while(k){
        ll x=A[l]*A[l+1],y=A[r]*A[r-1];
        if(x*sign>y*sign){
            ans=x%mod*ans%mod;
            l+=2;
        }else{
            ans=y%mod*ans%mod;
            r-=2;
        }
        k-=2;
	}
	cout<<(ans+mod)%mod<<endl;
	return 0;
}


Measured memory_bytes: 5144
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("in.txt");ofstream coutt("out.txt");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Use __builtin_popcountll for ll;
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 

signed main(){
    FASTER;
    char c;cin>>c;
    bool up= (c>='A' && c<='Z');
    if(up)cout<<"A";
    else cout<<"a";
}



Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;


int main(){FIN

    map<char,char>mp;
    map<char,char>mp2;
    vll check(26);
    vll check2(26);
    string s,t;cin>>s>>t;
    bool ok = true;
    REP(i,s.size()){
        if (check[s[i]-'a'] == 0){
            mp[s[i]] = t[i];
            check[s[i]-'a']++;
        }
        else {
            if (mp[s[i]] != t[i]){
                ok = false;
                break;
            }
        }
    }
        REP(i,s.size()){
        if (check2[t[i]-'a'] == 0){
            mp2[t[i]] = s[i];
            check2[t[i]-'a']++;
        }
        else {
            if (mp2[t[i]] != s[i]){
                ok = false;
                break;
            }
        }
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

map<string,int> M;
vector<int> V;

int cal(string s,int n)
{
  string Atom;
  for(int i=0;i<s.length();i++){
    if(s[i]=='('){
      int sum1=0;
      for(int j=i+1;j<s.length();j++){
	if(s[j]=='(')sum1++;
	if(s[j]==')'){
	  if(sum1==0){
	    int a=cal(s.substr(i+1,j-i-1),V.size());
	    if(a==-1)return -1;
	    V.push_back(a);
	    i=j;
	    break;
	  }
	  else sum1--;
	}
      }
    }
    else if('0'<=s[i] && s[i]<='9'){
      int a;
      if('0'<=s[i+1] && s[i+1]<='9'){
	a=(s[i+1]-'0');
	a+=10*(s[i]-'0');
	i++;
      }
      else a=(s[i]-'0');
      int b=V.back();
      V.pop_back();
      V.push_back(b*a);
    }
    else if(s[i]==')'){
      int ans=0;
      for(int j=n;j<V.size();j++)ans+=V[j];
      V.erase(V.begin()+n,V.end());
      return ans;
    }
    else {
      Atom.clear();
      Atom=s[i];
      int a=M[Atom],b=M[Atom+s[i+1]];
      if(a==0 && b==0)return -1;
      if(b!=0){
	V.push_back(b);
	i++;
      }
      else V.push_back(a);

    }
  }
  int ans=0;
  for(int i=n;i<V.size();i++)ans+=V[i];
  V.erase(V.begin()+n,V.end());
  return ans;
}

int main()
{
  string s;
  int t;
  while(1){
    cin>>s;
    if(s=="END_OF_FIRST_PART")break;
    cin>>t;
    M[s]=t;
  }
  while(1){
    cin>>s;
    if(s=="0")break;
    V.clear();
    int ans=cal(s,0);
    if(ans==-1)cout<<"UNKNOWN"<<endl;
    else cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1264
a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
k = gets.to_i

if b-a <= k && c-a <= k && d-a <= k && e-a <= k && c-b <= k && d-b <= k && e-b <=k && d-c <= k && e-c <= k && e-d <= k
 puts("Yay!")
 else puts(":(")
end

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define all(v) (v).begin(), (v).end()
#define MP make_pair

using namespace std;


int main(){
	int m;
	cin >> m;
	while(m--){
		set<string> m;
		string train;

		cin >> train;

		for(int i = 1; i < train.size(); i++){
			string s, t, rs, rt;
			s = train.substr(0, i);
			t = train.substr(i, train.size()-i);
			rs = s;
			rt = t;
			reverse(all(s));
			reverse(all(t));

			m.insert(s+t);
			m.insert(t+s);
			m.insert(s+rt);
			m.insert(rt+s);
			m.insert(rs+t);
			m.insert(t+rs);
			m.insert(rs+rt);
			m.insert(rt+rs);
		}
		cout << m.size() << endl;
	}


	return 0;
}

Measured memory_bytes: 1292
#include<cstdio>
#include<algorithm>

using namespace std;

int map[11][11]={-1};
int point[2]={1,1};
int m=0;//向き→0↓1←2↑3
int date[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
char cdate[4]={'R','D','L','U'};


bool fun()
{

	m=(m+2)%4;
	for(int i=0;i<4;i++)
	{
		m=(m+1)%4;
		if(map[point[1]+date[m][1]][point[0]+date[m][0]]==1)
		{
			point[0]+=2*date[m][0];
			point[1]+=2*date[m][1];
			printf("%c",cdate[m]);
			break;
		}
	}
	if(point[0]==1&&point[1]==1)return false;
	else true;
}

int main()
{
	for(int i=0;i<5;i++)
	{
		char c[15];
		scanf("%s",c);
		for(int j=0;j<4;j++)
		{
			map[i*2+1][(j+1)*2]=c[j]-'0';
		}
		if(i!=4)
		{
			scanf("%s",c);
			for(int j=0;j<5;j++)
			{
				map[(i+1)*2][j*2+1]=c[j]-'0';
			}
		}
	}

	fun();
	while(fun()){};
	printf("\n");
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>

using namespace std;

const int maxn=1e3+10;

const long long int f=1e9+7;

long long dp[maxn][maxn];

int main()
{
    int w,h;
    cin>>h>>w;
    string s[h];
    for(int i=0;i<h;i++)
    {
        cin>>s[i];
    }
    dp[0][0]=1;
    for(int i=1;i<w;i++)
    {
        if(s[0][i]=='#')
            dp[0][i]=0;
        else dp[0][i]=dp[0][i-1];
    }
    for(int i=1;i<h;i++)
    {
        if(s[i][0]=='#')
            dp[i][0]=0;
        else dp[i][0]=dp[i-1][0];
    }
    for(int i=1;i<h;i++)
    {
        for(int j=1;j<w;j++)
        {
            if(s[i][j]=='#')
                dp[i][j]=0;
            else dp[i][j]=((dp[i-1][j]+dp[i][j-1])%f);
        }
    }
    cout<<dp[h-1][w-1];
	return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main(){
  int n,k;
  cin>>n>>k;
  if(k==1){
   cout<<0<<endl;
    return 0;
  }
  n-=k;
  cout<<n<<endl;
}

Measured memory_bytes: 3624
#include<stdio.h>
int n[3];

int max() {
  if (n[0] >= n[1] && n[0] >= n[2]) return 0;
  else if (n[1] >= n[2]) return 1;
  else return 2;
}


int main(void) {

  int k;
  for (int i = 0; i < 3; i++) {
    scanf("%d", &n[i]);
  }
  scanf("%d", &k);
  
  for (int i = 0; i < k; i++) {
    n[max()] = 2*n[max()];
  }
  
  printf("%d", n[0]+n[1]+n[2]);
  return 0;
}


Measured memory_bytes: 128
main(require("fs").readFileSync("/dev/stdin", "utf8").replace(/\r?\n$/, "").split(/\r?\n/));

function main(lines){
	var buildings = createNestedArray(4, 3, 10);
	lines.slice(1).forEach(function(line){
		var ary = line.split(" ").map(Number);
		buildings[ary[0]-1][ary[1]-1][ary[2]-1] += ary[3];
	});
	console.log(buildings.map(function(building){
		return building.map(function(floor){
			return " " + floor.join(" ");
		}).join("\n");
	}).join("\n####################\n"));
}

function createNestedArray(){
	return nest(Array.prototype.slice.call(arguments));
	function nest(numList){
		var nextList = numList.slice(1);
		if(numList.length == 0) return 0;
		else{
			var ary = [];
			for(var i=0;i<numList[0];i++){
				ary.push(nest(nextList));
			}
			return ary;
		}
	}
}

Measured memory_bytes: 15600
(let ((n (read))
      (k (read))
      (s (read))
      (ans nil))
  (setf ans (append (loop :for i :from 1 :to k
                          :collect s)
                    (if (< s (expt 10 9))      
                        (loop :for i :from (1+ k) :to n
                              :collect (1+ s))
                        (loop :for i :from (1+ k) :to n
                              :collect 1))))
  (format t "~{~A~^ ~}" ans)
  (format t "~%"))


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

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n;
	cin>>n;
	string s;
	cin>>s;
	int x=0,res=0;
	for(int i=0;i<n;++i){
		x+=s[i]=='I'?1:-1;
		res=max(res,x);
	}
	cout<<res<<'\n';
}




Measured memory_bytes: 3624
#include<iostream>
#include<map>
using namespace std;
int a[100100],b[100100],n,c,ans;
map<int,int> m;
bool no=false;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	if(n==1)
		cout<<"Yes"<<endl;
	else
	{
		for(int i=1;i<n;i++)
			b[i]=a[i]-a[i-1];
		for(int i=1;i<n;i++)
		{
			if(b[i]<-1)
			{
				cout<<"No"<<endl;
				break;
			}
			else if(b[i]==-1)
			{
				if(m[i-1]>=1)
				{
					cout<<"No"<<endl;
					no=true;
					break;
				}
				a[i-1]--;
				m[i-1]++;
				for(int o=i-1;o>=2;o--)
				{
					if(a[o-1]>a[o]+1)
					{
						cout<<"No"<<endl;
						no=true;
						break;
					}
					else if(a[o-1]==a[o]+1)
					{
						if(m[o-1]>=1)
						{
							cout<<"No"<<endl;
							no=true;
							break;
						}
						else
						{
							a[o-1]--;
							m[o-1]++;
						}
					}
					else
						break;
				}
			}
			if(no==true)
				break;
			if(i==n-1)
				cout<<"Yes"<<endl;
		}
	}
}

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

int main(void){
    vector<int> a(3);
    cin>>a[0]>>a[1]>>a[2];
    sort(a.begin(),a.end());
    if (a[0]+a[1]==a[2]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, c,k=0, i, j,l=1e9+7;
  string s, r, y;
  cin>>n>>a;
 rep(i,0,n) 
 {
   cin>>b>>c;
   if(c<=a) l=min(l,b);
 }
 if(l==1e9+7) cout<<"TLE";
 else
 cout<<l;
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
 //  cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n;
  in(n);
  out(n * (n + 1) / 2);
  memi;
}

Measured memory_bytes: 256
def main():
    a, b = [int(x) for x in input().split()]
    if (a+b)%2 == 0:
        k = int((a+b)/2)
        if (a<k and k<b) or (b<k and k<a):
            print(k)
    else:
        print('IMPOSSIBLE')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
#define X first
#define Y second
typedef long long LL;
typedef pair<int, int> pii;
const int N = 1e5 + 100;

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


Measured memory_bytes: 256
n, d = map(int, input().split())
#x = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
import numpy as np
cnt = 0
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        dis = 0
        for k in range(d):
            dis += (x[i][k] - x[j][k])**2
        if np.sqrt(dis).is_integer():
            cnt += 1
print(int(cnt/2)) 

Measured memory_bytes: 12492
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    int N;
    cin >> N;
    map<string, int> b;
    rep(i, 0, N)
    {
        // **ASCENDING ORDER** from n to m (m is **EXCLUDED**)
        string S;
        cin >> S;
        b[S]++;
    }

    int maximum = -1;
    for(auto itr = b.begin(); itr != b.end(); ++itr) 
    {
        maximum = max(maximum, itr->second);
    }

    vector<string> ans;
    for(auto itr = b.begin(); itr != b.end(); ++itr) 
    {
        if (itr->second == maximum)
        {
            ans.push_back(itr->first);
        }
    }

    sort(ans.begin(), ans.end());
    for (auto &&i : ans)
    {
        cout << i << endl;
    }
    
}


Measured memory_bytes: 26868
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>

using namespace std;

int main()
{
    int a,b,k;
    cin >> a >> b >> k;
    for(int i=0; i<k; i++){
        if(a+i<=b){
            cout << a+i << endl;
        }
    }
    for(int i=0; i<k; i++){
        if(b-k+i+1>a+k-1 && b-k+i+1>=a){
            cout << b-k+i+1 << endl;
        }
    }


    return 0;
}

Measured memory_bytes: 256
K = int(input())
# kouho = [int('7' * i) for i in range(1, 1000)]
ans = -1
t = 7
amari = 7 % K
if K == 1 or K == 7:
    print(1)
    exit(0)
for i in range(1, 1000000):
    t = (t * 10) % K
    a = (t + amari) % K
    if a == 0:
        ans = i + 1
        print(ans)
        exit(0)
    else:
        amari = a
print(ans)

Measured memory_bytes: 9152
//problem_a.go

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	//"strings"
)

const (
	mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

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

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getIntSlice(n int) []int {
	ns := []int{}
	for i := 0; i < n; i++ {
		ns = append(ns, getInt())
	}
	return ns
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func getStringSlice(n int) []string {
	ss := []string{}
	for i := 0; i < n; i++ {
		ss = append(ss, getString())
	}
	return ss
}

func sortIntSlice(ns []int) []int {
	sort.Sort(sort.IntSlice(ns))
	return ns
}

func rsortIntSlice(ns []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(ns)))
	return ns
}

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

func solve() {
	n := getInt()
	if n%2 == 0 {
		fmt.Fprintln(wr, n/2)
	} else {
		fmt.Fprintln(wr, n/2+1)
	}
}

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

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}


Measured memory_bytes: 640
A, B, C = map(int, input().split())
if (A != 5 and A!=7):
	print('NO')
if (B != 5 and B!=7):
	print('NO')
if (C != 5 and C!=7):
	print('NO')
if(A + B + C != 17):
	print('NO')
else:
	print('YES')


Measured memory_bytes: 3060
#include <iostream>

using namespace std;



int main()
{
    long long n, q, h, s, d;
    cin >> q >> h >> s >> d;
    cin >> n;
    if (q * 2 < h)
        h = q * 2;
    if (h * 2 < s)
        s = h * 2;
    if (s * 2 < d)
        d = s * 2;
    cout << n / 2 * d + n % 2 * s;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;

    int ab=a+b;
    int cd=c+d;

    if(ab>cd){
        cout<<"Left"<<endl;
    }
    if(ab==cd){
        cout<<"Balanced"<<endl;
    }
    if(ab<cd){
        cout<<"Right"<<endl;
    }

    //上皿天秤が左に傾くなら Left を、
    //釣り合うなら Balanced を、右に傾くなら Right を出力してください。

}


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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i < N; i++){
    cin >> A.at(i);
  }
  int x=0;
  while(true){
    bool correct=false;
    for(int i=0; i < N; i++){
      if(A.at(i)%2==1){
        correct = true;
      }
    }
    if(correct) break;
    for(int i=0; i < N; i++){
      A.at(i)/=2;
    }
    x++;
  }
  cout<<x<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define sll set<ll>
#define str string
#define rev reverse
#define mp make_pair
#define pb push_back
#define acc accumulate
#define vll vector<ll>
#define eb emplace_back
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll> >
#define dq deque<ll>
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back

void dp(ll n,ll a[])
{
    ll ans[n],i;
    for(i=0;i<n;i++)
    {
        if(i==0)
            ans[0]=0;
        else if(i==1)
            ans[1]=abs(a[1]-a[0]);
        else
        {
            ans[i]=min(ans[i-2]+abs(a[i]-a[i-2]),ans[i-1]+abs(a[i]-a[i-1]));
        }
        //cout << ans[i] << " ";
    }
    //cout << endl;
    cout << ans[n-1] << endl;


}

void solve()
{
    ll n,i;
    cin >> n;
    ll a[n];
    for(i=0;i<n;i++)
    {
        cin >> a[i];
    }
    dp(n,a);
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    solve();
     return 0;
}

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

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

  int a, b;
  a = stoi(s.substr(0,2));
  b = stoi(s.substr(2,2));

  if(a > 12){ // aが年
    if(b > 12) cout << "NA" << endl;
    else if(b == 0) cout << "NA" << endl;
    else cout << "YYMM" << endl;
  }
  else if(b > 12){ // bが年
    if(a > 12 || a == 0) cout << "NA" << endl;
    else cout << "MMYY" << endl;
  }
  else{
    if(a == 0 && b == 0) cout << "NA" << endl;
    else if(a == 0) cout << "YYMM" << endl;
    else if(b == 0) cout << "MMYY" << endl;
    else cout << "AMBIGUOUS" << endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    int l[n],r[n];

    l[0]=a[0];
    for(int i=1;i<n;i++){
        l[i]=gcd(l[i-1],a[i]);
    } 
    reverse(all(a));
    r[0]=a[0];
    for(int i=1;i<n;i++) r[i]=gcd(r[i-1],a[i]);

    int ans=0;
    rep(i,n){
        int tmp;
        if(i==0){
            tmp=r[n-2];
        }
        else if(i==n-1){
            tmp=l[n-2];
        }
        else{
            tmp=gcd(l[i-1],r[n-2-i]);
        }
        ans=max(ans,tmp);
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<int>> v(n+1); 
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        v[a].pb(b);
    }
    rep(i, v.size()) sort(all(v[i]));
    rep(i, q) {
        int a, b;
        cin >> a >> b;
        int ans = 0;
        REP(i, a, b+1) {
            ans += upper_bound(all(v[i]), b) - lower_bound(all(v[i]), a-1);
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define N 1000010
using namespace std;
int num[N],fa[N];
int find(int x){return x==fa[x]?fa[x]:fa[x]=find(fa[x]);}
int nxt[N<<1],to[N<<1],head[N],cnt;
void add(int u,int v)
{
	nxt[++cnt]=head[u];
	to[cnt]=v;
	head[u]=cnt;
}
int ton[N],tot;
void dfs(int u,int d)
{
	num[u]=d;
	for(int i=head[u];i;i=nxt[i])
	{
		int v=to[i];
		if(v==fa[u]) continue;
		fa[v]=u;
		dfs(v,-d);
		num[u]+=num[v];
	}
}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int ru=1,rv=1;
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1;i<=m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		int hx=find(u),hy=find(v);
		if(hx==hy)  ru=u,rv=v;
		else fa[fa[u]]=fa[v],add(u,v),add(v,u);
	}
	fa[ru]=0;
	if(m==n-1)
	{
		dfs(1,1);
		int ans=0;
		if(num[1]){puts("-1");return 0;}
		for(register int i=1;i<=n;i++) ans+=abs(num[i]);
		printf("%d\n",ans);
		return 0;
	}
	dfs(ru,1);
	int u=rv;
	while(u) ton[++tot]=num[u],u=fa[u];
	if(tot&1)
	{
		int ans=0;
		if(num[ru]&1){puts("-1");return 0;}
		for(int u=rv;u;u=fa[u])
		num[u]-=num[ru]>>1;
		for(int i=1;i<=n;i++) ans+=abs(num[i]);
		printf("%d\n",ans);
		return 0;
	}
	if(num[ru]){puts("-1");return 0;}
	sort(ton+1,ton+tot+1);
	for(register int u=rv;u;u=fa[u]) num[u]-=ton[tot>>1];
	int ans=0;
	for(register int i=1;i<=n;i++)
	ans+=abs(num[i]);
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 21760
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans = 0;
        
        for(int i=0; i<s.length()/2; i++){
            if(s.charAt(i)!=s.charAt(s.length()-1-i)) ans++;
        }
        
        System.out.println(ans);
    }
}

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

int main() {
	int n, first, second, third;
	first = second = 1;
	scanf("%d", &n);

	for (int i = 0; i != n; i++) {
		third = first + second;
		first = second;
		second = third;
	}

	printf("%d", first);
	printf("\n");

	return 0;
}


Measured memory_bytes: 2104
while True:
	n,m = map(int,raw_input().split())
	if n == 0 and m == 0 : break

	traffic = [0]
	if n != 0:
		traffic = map(int,raw_input().split())
	if m != 0:
		traffic += map(int,raw_input().split())
	
	traffic.sort()
	
	max = traffic[0]
	next = traffic[0]
	for var in traffic[1:]:
		if var - next > max:
			max = var - next
		next = var
		
	print max

Measured memory_bytes: 7380
import java.util.*;
class Main
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int x=sc.nextInt();
        int arr[]=new int[x];
        int count=0;
        for(int i=0;i<x;i++)
        {
            arr[i]=sc.nextInt();
        }
        for(int i=0;i<x;i++)
        {
            for(int j=i+1;j<x;j++)
            {
                for(int k=j+1;k<x;k++)
                {
                    int a=arr[i];
                    int b=arr[j];
                    int c=arr[k];
                    if(arr[i]!=arr[j] && arr[j]!=arr[k] && arr[k]!=arr[i])
                    {
                        if((a+b<=c)||(a+c<=b)||(b+c<=a))
                        {
                            continue;
                        }
                        else
                        {
                            count++;
                        }
                    }
                }
            }
        }
    System.out.println(count);

    }
}

Measured memory_bytes: 36412
//Moh_K_Imar .......
//29/08/2020  ... 5,32.
//Ya Rab....
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
int main(){
    ll a;
    cin>>a;
    if(a==25)cout<<"Christmas"<<endl;
    else if (a==24)cout<<"Christmas Eve"<<endl;
    else if (a==23)cout<<"Christmas Eve Eve"<<endl;
    else if (a==22)cout<<"Christmas Eve Eve Eve"<<endl;

    return 0;
}



Measured memory_bytes: 3572
n = int(input())
s = input()
white = s.count(".")
black = s.count("#")

min_num = min(black, white)
black_num = 0
for i, color in enumerate(s, start = 1):
    if color == "#":
        black_num += 1
    min_num = min(min_num, black_num + white - (i - black_num))
    
print(min_num)

Measured memory_bytes: 3500
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
    int C, N;
    cin>>C>>N;
    vector<vector<int>> H(N, vector<int>(N/2));
    vector<vector<int>> V(N/2, vector<int>(N));
    for (int y=0; y<N; y++)
    {
        string l;
        cin>>l;
        for (int x=0; x<N; x++)
        {
            if (l[x] == '1')
            {
                H[y][x<N/2 ? x : N-x-1] ^= 1;
                V[y<N/2 ? y : N-y-1][x] ^= 1;
            }
        }
    }

//    for (int y=0; y<N; y++)
//    {
//        for (int x=0; x<N/2; x++)
//            cout<<H[y][x];
//        cout<<endl;
//    }

    int Hc = 0;
    for (int y=0; y<N; y++)
    for (int x=0; x<N/2; x++)
        Hc += H[y][x];
    int Vc = 0;
    for (int y=0; y<N/2; y++)
    for (int x=0; x<N; x++)
        Vc += V[y][x];
    int ans = Hc==0 && Vc==0 ? 1 : 0;
    for (int i=0; i<C-1; i++)
    {
        int D;
        cin>>D;
        for (int j=0; j<D; j++)
        {
            int x, y;
            cin>>y>>x;
            x--, y--;
            H[y][x<N/2 ? x : N-x-1] ^= 1;
            if (H[y][x<N/2 ? x : N-x-1] == 1)
                Hc++;
            else
                Hc--;
            V[y<N/2 ? y : N-y-1][x] ^= 1;
            if (V[y<N/2 ? y : N-y-1][x] == 1)
                Vc++;
            else
                Vc--;
        }
        //cout<<Hc<<" "<<Vc<<endl;
        if (Hc==0 && Vc==0)
            ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6840
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<list>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#define ll long long

using namespace std;

int main(){
  int K;
  cin >> K;
  int ans=0;
  for(int a=1;a<K+1;a++){
    for(int b=1;b<K+1;b++){
      for(int c=1;c<K+1;c++){
        ans+=gcd(gcd(a,b),c);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<int,P> PP;

vector<PP> v;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main()
{
	
	int n,l,ans = 0,m=INF;
	cin >> n >> l;
	int ans_m = 0;
	for(int i = 0;i <n ; i++){
		ans += l + i;
		if(abs(l+i) < m){
			m = abs(l+i);
			ans_m = l+i;
		}
	}
	cout << ans - ans_m<< endl;
	return 0;
}


Measured memory_bytes: 256
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    
    print('ACL'*n)

if __name__ == '__main__':
    main()


Measured memory_bytes: 72624
#include <iostream>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

int p[1010][1010];
int dp[1010][1010];

int main(){
	int h,w,n;
	while(cin >> h >> w >> n,n){
		n--;
		rep(i,h)rep(j,w) cin >> p[i][j];
		rep(i,h)rep(j,w) dp[i][j]=0;
		dp[0][0]=n;
		rep(i,h)rep(j,w){
			if(dp[i][j]&1){
				if(p[i][j]){
					dp[i][j+1]+=dp[i][j]/2+1;
					dp[i+1][j]+=dp[i][j]/2;
				}else{
					dp[i][j+1]+=dp[i][j]/2;
					dp[i+1][j]+=dp[i][j]/2+1;
				}
				p[i][j]^=1;
			}else{
				dp[i+1][j]+=dp[i][j]/2;
				dp[i][j+1]+=dp[i][j]/2;
			}
		}
		int ch=0,cw=0;
		while(ch<h&&cw<w){
			if(p[ch][cw])
				cw++;
			else
				ch++;
		}
		cout << ch+1 << " " << cw+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 10992
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
    string k;
    int n;
    cin>>k>>n;
    int dig=k.size();
    vector<vector<vector<ll>>> dp(dig+1,vector<vector<ll>>(n,vector<ll>(2,0)));
    //dp[桁][今までの桁和][越えたら1flag]
    dp[0][0][0]=1;
    for(int i=0;i<dig;i++){
        const int tar=k[i]-'0';
        for(int j=0;j<n;j++){
            for(int k=0;k<2;k++){
                for(int d=0;d<(k?10:(tar+1));d++){
                    dp[i+1][(j+d)%n][k||d<tar]=(dp[i+1][(j+d)%n][k||d<tar]+dp[i][j][k])%mod;
                }
            }
        }
    }
    ll ans=(dp[dig][0][0]+dp[dig][0][1]+mod-1)%mod;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 55296
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
int compare(const void *a,const void *b){
    if(*(int *)a>*(int *)b)return 1;
    return -1;
}
int main()
{   long long h,w;
    scanf("%lld%lld",&h,&w);
    if(h==1||w==1){
        printf("1");
        return 0;
    }
    if(h*w%2==0){
        printf("%lld",h*w/2);
    }else if(h*w/2%2==0){
        printf("%lld",h*w/2+1);
    }else{
        printf("%lld",h*w/2);
    }
    return 0;
}


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

int main() {
  
  int d;
  int t;
  int s;

  cin >> d;
  cin >> t;
  cin >> s;
  
  int c = t*s ;

  if (c < d) {
    cout << "No";
  }
  
 else{cout << "Yes";}
  
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int p[100];

int main(){
	p[1] = 1;
	p[2] = 2;
	p[3] = 4;
	for(int i = 4; i <= 30; i++){
		p[i] = p[i-1] + p[i-2] + p[i-3];
	}

	int n;
	while(cin >> n, n){
		cout << p[n]/3650+1 << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,K;
    cin >> N >> K;
    vector<int> d(K);
    map<int,int> mp;
    for(int i = 0; i < K; i++){
        cin >> d[i];
        vector<int> A(d[i]);
        for(int j = 0; j < d[i]; j++){
            cin >> A[j];
            mp[A[j]]++;
        }
    }
    cout << N - mp.size() << endl;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  ll n, k, a_input;
  cin >> n >> k;
  int digit_size = (int)(log(k) / log(2) + 1.0);
  if (k == 0) digit_size = 0;

  vector<ll> digit(digit_size, 0);

  vector<ll> a(n);
  for(int i = 0; i < n; ++i)
  {
    cin >> a_input;
    a[i] = a_input;
    if (digit_size == 0) continue;
    int d = 0;
    while(a_input > 0)
    {
      digit[d] += (a_input & 1);
      a_input >>= 1;
      d++;
    }
  }

  ll num = 0;
  for(int i = digit_size - 1; i >= 0; --i)
  {
    ll d = ((digit[i] * 2 <= n ? 1LL : 0LL) << i);
    if (num + d <= k) num += d;
  }

  //cout << num << endl;

  ll ans = 0;
  for(int i = 0; i < n; ++i)
  {
    ans += (a[i] ^ num);
    //cout << "add " << (a[i] ^ num) << endl;
  }
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

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

S1 = 0

min_ans = float('inf')

for i in range(N):
    S1 += list[i]
    S2 = abs(S1-sum(list[i+1:]))
    min_ans = min(min_ans,S2)

print(min_ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <functional>
#include <cassert>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int,int> Pi;
typedef long long int ll;
const int INF=(ll)(1<<30)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int n;
int a[3010];

int main(){
	cin>>n;
	int ans=0;
	REP(i,n){
		int t;
		cin>>t;
		ans+=(t-1);
	}
	cout<<ans<<endl;
	return 0;
}
		

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main()
{
 int n,k;
  cin>>n>>k;
  int snukes[n];
  for(int i=0;i<n;i++)
  {
    snukes[i]=0;
  }
  for(int i=0;i<k;i++)
  {
    int d;
    cin>>d;
    for(int j=0;j<d;j++)
    {
      int di;
      cin>>di;
      
      snukes[di-1]=1;
    }
  }
  int count=0;
  for(int i=0;i<n;i++)
  {

    if(snukes[i]!=1)
    	count++;
  }
  cout<<count;
  return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>

int main()
{

   int a, b;
   scanf("%d %d", &a, &b);

   if(a<b) {
      printf("a < b\n", a, b);
   } else if(a>b) {
      printf("a > b\n", a, b);
   } else {
      printf("a == b\n", a, b);
   }

   return 0;
}

Measured memory_bytes: 2684
#!/usr/bin/env python3
(n, ), *p = [[*map(int, i.split())] for i in open(0)]
t, x, y = 0, 0, 0
for a, b, c in p:
    d = abs(x - b) + abs(y - c) - a + t
    if d <= 0 and d % 2 < 1:
        t, x, y = a, b, c
    else:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 87220
#include <bits/stdc++.h>
#define INF 100100100
#define MOD 1000000007

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

#define FOR(i,n) for(ll i=0;i<n;i++)

struct edge{ll to,cost;};

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0); 
   ll A,B;
   cin >> A >> B;
   ll MAX = -INF;
   MAX = max(MAX,A+B);
   MAX = max(MAX,A*B);
   MAX = max(MAX,A-B);
   cout << MAX << endl;
   return 0;
}


Measured memory_bytes: 256
S = input()
N = len(S)
def f(a:str): #回文
  l = len(a)
  m = l // 2
  for i in range(m):
    if a[i] != a[l-i-1]:
      return False
  else:
    return True
if f(S) and f(S[:(N-1)//2]) and f(S[(N+1)//2:]):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main() {
  int n;
  int a;
  // string s = "Hello World";
  cin >> n;
  switch (n) {
    case 111:
      a = 999;
      break;
    case 119:
    a = 991;
    break;
    case 191:
    a = 919;
    break;
    case 911:
    a = 199;
    break;
    case 199:
    a = 911;
    break;
    case 919:
    a = 191;
    break;
    case 991:
    a = 119;
    break;
    case 999:
    a = 111;
    break;
  }
  cout << a << endl;
}


Measured memory_bytes: 256
s = list(input())
l = len(s) - 1
for i,j in enumerate(s):
  if i % 2 == 1:
    if j == "L" or j == "U" or j == "D":
      if i == l:
      	print("Yes")
      continue
    else:
      print("No")
      break
  elif i % 2 == 0:
    if j == "R" or j == "U" or j == "D":
      if i == l:
      	print("Yes")
      continue
    else:
      print("No")
      break

Measured memory_bytes: 3064
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		cs: Chars,
	}

	if cs[0] == 'R' {
		if cs[1] == 'R' {
			if cs[2] == 'R' {
				println!("3");
				return;
			}
			else {
				println!("2");
				return;
			}
		}
		else {
			println!("1");
			return;
		}
	}
	else {
		if cs[1] == 'R' {
			if cs[2] == 'R' {
				println!("2");
				return;
			}
			else {
				println!("1");
				return;
			}
		}
		else {
			if cs[2] == 'R' {
				println!("1");
				return;
			}
			else {
				println!("0");
				return;
			}
		}
	}
}



Measured memory_bytes: 2148