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

#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define PI acos(-1.0)
const int N=1e5 + 5;
const int M=1e5 + 5;


int main()
{
	ios_base::sync_with_stdio(false);
	int i,n;
	ll s[N],ans=0;
	cin>>n;

	for(i=0;i<n;i++){
		cin>>s[i];
		if(i==0){
			ans+=abs(s[i]);
		}
		else ans+=abs(s[i]-s[i-1]);
	}
	ans+=abs(s[n-1]);
	for(i=0;i<n;i++){
		ll foo;
		if(i==0){
			foo=ans;
			foo-=(abs(s[i]))+abs(s[i]-s[i+1]);
			foo+=abs(s[1]);
		}
		else if(i==n-1){
			foo=ans;
			foo-=(abs(s[i]-s[i-1]))+abs(s[i]);
			foo+=abs(s[i-1]);
		}
		else{
			foo=ans;
			foo-=(abs(s[i]-s[i-1]))+abs(s[i]-s[i+1]);
			foo+=abs(s[i-1]-s[i+1]);	
		}
		cout<<foo<<endl;
	}
		
	
		
	return 0;
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<char> S;
  for(int i = 0;i < s.size();i++){
    S.push_back(s.at(i));
  }
  int k;
  cin >> k;
  char ans = S[k-1];
  for(int i = 0;i < s.size();i++){
    if(S[i] != ans){
      S[i] = '*';
    }
  }
  for(int i = 0;i < s.size();i++){
    cout << S[i];
  }
}


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

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

}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t; cin >> t;
	// while (t--)
	solve();

}

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

typedef long long ll;
const int INF = 1e9;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n,m;
	cin>>n>>m;
	vector<int> nums(n);
	int total = 0;
	for (int i = 0; i < n; i++) {
		cin>>nums[i];
		total += nums[i];
	}
	sort(nums.begin(), nums.end(), greater<int>());
	bool ok = 1;
	double bound = (double)total/(4*m);
	// cout<<total<<' '<<bound<<'\n';
	for (int i = 0; i < m; i++) {
		// cout<<nums[i]<<'\n';
		if (nums[i] < bound){
			ok = 0;
		}
	}
	cout<<(ok? "Yes":"No")<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>   ///C
#include<iostream>
#include<algorithm>
using namespace std;
int a[1000005];
int main()
{
    int n,count=0;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    for(int i=0; i<n; i++)
    {
        if(a[i+1]==a[i])
        {
            i=i+1;
        }
        else
            count++;
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;


string s;

int main(){
	while(getline(cin,s)){
		stack <double> st;
		rep(i,s.size()){
			//cout<<"size "<<s.size()<<endl;
			
			
			if(s[i]=='-'&&s[i+1]<='9'&&s[i+1]>='0'){
				double sum=0.0;
				for(int j=i+1;j<s.size();j++){
					if(s[j]<='9'&&s[j]>='0'){
						sum*=10.0;
						sum+=s[j]-'0';
					}
					else break;
					i=j;
				}
				sum=-sum;
				st.push(sum);
			}
			
			
			else if(s[i]=='+'||s[i]=='-'||s[i]=='*'||s[i]=='/'){
				double a1,a2;
				a2=st.top();
				st.pop();
				a1=st.top();
				st.pop();
				if(s[i]=='+'){
					a1+=a2;
				}
				else if(s[i]=='-'){
					a1-=a2;
				}
				else if(s[i]=='*'){
					a1*=a2;
				}
				else if(s[i]=='/'){
					a1/=a2;
				}
				st.push(a1);
			}
			
			
			
			
			else if(s[i]<='9'&&s[i]>='0'){
				double sum=0.0;
				for(int j=i;j<s.size();j++){
					if(s[j]<='9'&&s[j]>='0'){
						sum*=10.0;
						sum+=s[j]-'0';
					}
					else break;
					i=j;
				}
				st.push(sum);
			}
			//cout<<"st.top = "<<st.top()<<endl;
			
		}
		printf("%.6f\n",st.top());
		
		st.pop();
	}
	return 0;
}

Measured memory_bytes: 1236
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <numeric>

int main() {
  size_t N, W;
  scanf("%zu %zu", &N, &W);

  std::vector<uintmax_t> w(N), v(N);
  for (size_t i = 0; i < N; ++i)
    scanf("%ju %ju", &w[i], &v[i]);

  uintmax_t V = std::accumulate(v.begin(), v.end(), 0uL);
  std::vector<std::vector<uintmax_t>> dp(N+1, std::vector<uintmax_t>(V+1, W+1));
  dp[0][0] = 0;
  for (size_t i = 0; i < N; ++i) {
    for (size_t j = 0; j <= V; ++j) {
      if (j < v[i]) {
        dp[i+1][j] = dp[i][j];
      } else {
        dp[i+1][j] = std::min(dp[i][j], dp[i][j-v[i]]+w[i]);
      }
    }
  }

  for (size_t i = V+1; i--;)
    if (dp[N][i] <= W)
      return !printf("%ju\n", i);

  return 1;
}


Measured memory_bytes: 80256
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<ll,ll>;
using um = unordered_map<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll M;
    cin >> M;
    ll K;
    cin >> K;
    vector<ll> A(N,0);
    vector<ll> B(M,0);
    for(ll i=0;i<N;++i)cin>>A[i];
    for(ll i=0;i<M;++i)cin>>B[i];
    for(ll i=1;i<N;++i){
        A[i]+=A[i-1];
    }
    for(ll i=1;i<M;++i){
        B[i]+=B[i-1];
    }
    ll ans=0;
    for(ll i=0;i<N;++i){
        if(A[i]>K)continue;
        chmax(ans,i+1+(upper_bound(B.begin(), B.end(), K-A[i])-B.begin()));
    }
    for(ll i=0;i<M;++i){
        if(B[i]>K)continue;
        chmax(ans,i+1+(upper_bound(A.begin(), A.end(), K-B[i])-A.begin()));
    }
    prt(ans);

    return 0;
}



Measured memory_bytes: 6360
#include <bits/stdc++.h>
using namespace std;
int call(string s, int i){
    if(s[i] == 'a') return 1;
    if(s[i] == 'b') return 2;
    if(s[i] == 'c') return 3;
}
int main() {
    string a, b, c;
    cin >> a >> b >> c;
    int i=0, j=0, k=0;
    int turn = 1;
    while(true){
        if(turn == 1){
            if(i >= a.size()){
                break;
            }
            turn = call(a, i);
            i++;
        }
        if(turn == 2){
            if(j >= b.size()){
                break;
            }
            turn = call(b, j);
            j++;
        }
        if(turn == 3){
            if(k >= c.size()){
                break;
            }
            turn = call(c, k);
            k++;
        }
    }
    if(turn == 1) cout << "A" << endl;
    else if(turn == 2) cout << "B" << endl;
    else cout << "C" << endl;
}

Measured memory_bytes: 256
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let m = v[0];
	println!("{}", 48 - m);
}

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


int main(){
    int N;
    cin >> N;
    
    vector<int> A(N,0);
    
    for(int a=1;a<=100;a++){
        for(int b=1;b<=100;b++){
            for(int c=1;c<100;c++){
                int sub=(a+b+c)*(a+b+c)-a*b-b*c-c*a;
                if(sub<=N)A[sub-1]++;
                
            }
            
        }
        
    }
    for(int i:A)
        cout << i << endl;
    
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main(){
    ll t=1,a=0,b=0,h,w,n,min=100000000000,k,ans=0;
    string s,s2;
    cin >> a;
    ans += a;
    ans *= a;
    ans *= a;
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
w, h, n = map(int, input().split())
l = [0, w, 0, h]
for i in range(n):
  x, y, a = map(int, input().split())
  if (a == 1):
    l[0] = max(l[0], x)
  elif (a == 2):
    l[1] = min(l[1], x)
  elif (a == 3):
    l[2] = max(l[2], y)
  else:
    l[3] = min(l[3], y)
print(max(0, (l[1] - l[0])) * max(0, (l[3] - l[2])))

Measured memory_bytes: 3064
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    String s = sc.nextStr();
    String t = sc.nextStr();

    boolean answer = false;

    for(int i = 0; i < s.length(); i++){
      boolean checker = true;
      for(int j = 0; j < s.length(); j++){
        if(s.charAt(j) != t.charAt((j+i)%s.length())){
          checker = false;
        }
      }
      if(checker){
        answer = true;
        break;
      }
    }

    System.out.println(answer? "Yes" : "No");
 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

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

class FenwickTree {
private:
    int n;
    vector<ll> dat;
public:
    FenwickTree(int _n): n(_n), dat(_n+1, 0) {}
    FenwickTree(int _n, ll init): n(_n), dat(_n+1, 0) {
        for (int i = 0; i < _n; i++) {
            add(i, init);
        }
    }
    
    void add(int idx, ll value) {
        for (idx++; idx <= n; idx += idx & -idx) {
            dat[idx] += value;
        }
    }

    ll query(int l, int r) {
        ll ans = 0;
        for (r++; r > 0; r -= r & -r) {
            ans += dat[r];
        }
        for (; l > 0; l -= l & -l) {
            ans -= dat[l];
        }
        return ans;
    }
};

bool comp(pair<int,int> a, pair<int,int> b)
{
    return a.second - a.first < b.second - b.first;
}

int main(void)
{
    int n, m;
//    cin >> n >> m;
    scanf("%d%d", &n, &m);

    vector< pair<int,int> > A(n);
    for (int i = 0; i < n; i++) {
//        cin >> A[i].first >> A[i].second;
        scanf("%d%d", &A[i].first, &A[i].second);
    }
    sort(A.begin(), A.end(), comp);

    FenwickTree ft(m+1);

    int idx = 0;
    for (int d = 1; d < m+1; d++) {
        for(; idx < n && A[idx].second - A[idx].first < d; idx++) {
            ft.add(A[idx].first, 1);
            ft.add(A[idx].second+1, -1);
        }
        ll count = n - idx;
        for (int i = 0; i < m+1; i += d) {
            count += ft.query(0, i);
        }
        cout << count << endl;
    }
}


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

int	main()
{
	int		N;
	int64_t	C, K;
	cin >> N >> C >> K;
	vector<int64_t>	vec_T(N);
	for (int i = 0; i < N; ++i)
		cin >> vec_T.at(i);
	sort(vec_T.begin(), vec_T.end());
	int		num_bus = 0;
	int		num_passenger = 0;
	int64_t	bgn = vec_T.at(0), end = bgn + K + 1;
	++num_bus;
	num_passenger = 1;
	int64_t	T;
	for (int i = 1; i < N; ++i) {
		T = vec_T.at(i);
		if (T >= end || num_passenger >= C) {
			bgn = T;
			end = bgn + K + 1;
			++num_bus;
			num_passenger = 1;
		} else 
			++num_passenger;
	}
	cout << num_bus << endl;
}


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

int R, G, B, n;

int main() {
	read(R), read(G), read(B), read(n);
	int ans = 0;
	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j <= n; ++j) {
			ans += R * i + G * j <= n && (n - R * i - G * j) % B == 0;
		}
	}
	print(ans);
}


Measured memory_bytes: 3552
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <time.h>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < n; i++)
#define all(c) (c).begin(), (c).end()
#define P pair<int, int>
#define chmin(x, y) x = min(x, y)

int main()
{
  int x, n;
  cin >> x >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++)
  {
    cin >> p[i];
  }

  vector<int> q;
  for (int i = 0; i < 1000; i++)
  {
    bool in = false;
    for (int j = 0; j < n; j++)
    {
      if (i - 100 == p[j])
      {
        in = true;
      }
    }
    if (!in)
    {
      q.push_back(i - 100);
    }
  }

  int ans = 1000;
  for (int i = 0; i < 1000; i++)
  {
    if (abs(q[i] - x) < abs(ans - x))
    {
      ans = q[i];
    }
    else if (abs(q[i] - x) == abs(ans - x))
    {
      ans = min(ans, q[i]);
    }
  }
  cout << ans << endl;
}


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

int n, maxi=0, res=0, tmp;

int main(){
  cin >> n;
  for(int i=1; i<=n; ++i){
    cin >> tmp;
    if (tmp>=maxi){
      res++;
      maxi=tmp;
    }
  }
  cout << res;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;
namespace mp = boost::multiprecision;

mp::cpp_int LCM(mp::cpp_int a,mp::cpp_int b){
  if(a==0 || b==0) return 0;
  mp::cpp_int tmp,r,x;
  x=a*b;
  if(a<b) tmp=a,a=b,b=tmp;
  r=a%b;
  while(r!=0) a=b,b=r,r=a%b;
  x=x/b;
  return x;
}

mp::cpp_int GCD(lint a,lint b){
  if(a==0 || b==0) return max(a,b);
  else return (a*b)/LCM(a,b);
}

vector<bool> prime;
void primeinit(int N){
    if(N+1>prime.size()){
        prime.resize(N+1,true);
    } 
    prime[0] = false;
    prime[1] = false;
    for(int i=2; i*i<=N;i++) if(prime[i]) for(int j=2; i*j<=N;j++) prime[i*j]=false;
}


int main(void){
    primeinit(1000000);
    int N;
    cin >> N;
    int put=N;
    N=500;
    lint primeno[2000];
    mp::cpp_int ans[N][N];
    rep(i,N) rep(j,N) ans[i][j]=1;
    lint now=0;
    rep(i,2000){
        while(!prime[now]) now++;
        primeno[i]=now;
        now++;
    }
    for(int i=1;i<=500;i+=2) swap(primeno[i],primeno[999-i]);
    int no=0;
    for(int i=N-2;i>=2;i-=2){
        int x=0,y=i;
        while(x<N && y<N){
            ans[y][x]*=primeno[no];
            x++,y++;
        }
        no++;
    }
    for(int i=0;i<N;i+=2){
        int x=i,y=0;
        while(x<N && y<N){
            ans[y][x]*=primeno[no];
            x++,y++;
        }
        no++;
    }
    for(int i=0;i<N;i+=2){
        int x=i,y=0;
        while(x>=0 && y<N){
            ans[y][x]*=primeno[no];
            x--,y++;
        }
        no++;
    }
    for(int i=1;i<N;i+=2){
        int x=N-1,y=i;
        while(x>=0 && y<N){
            ans[y][x]*=primeno[no];
            x--,y++;
        }
        no++;
    }
    rep(i,N) rep(j,N){
        if(ans[i][j]==1){
            mp::cpp_int in=1;
            if(i!=0) in=LCM(in,ans[i-1][j]);
            if(i!=N-1) in=LCM(in,ans[i+1][j]);
            if(j!=0) in=LCM(in,ans[i][j-1]);
            if(j!=N-1) in=LCM(in,ans[i][j+1]);
            ans[i][j]=in+1;
        }
    }
    rep(i,put){
        rep(j,put) cout << ans[i][j] << " ";
        cout << endl;
    }
}

Measured memory_bytes: 11136
def solve():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    ans = 0
    for a in range(A + 1):
        for b in range(B + 1):
            for c in range(C + 1):
                if 500 * a + 100 * b + 50 * c == X:
                    ans += 1
    print(ans)


if __name__ == "__main__":
    solve()


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

#define ll long long

int main(){	
	int n;
	cin>>n;
	int arr[n];
	ll sum=0;
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	for (int i = 0; i < n; ++i)
	{
		/* code */
		for(int j=i+1;j<n;j++){
			sum+=(arr[i]*arr[j]);
		}
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 256
from sys import stdin
def I(): return int(stdin.readline().rstrip())
def LS(): return list(stdin.readline().rstrip().split())

n = I()
info = []
for i in range(n):
    tmp = LS()
    l = []
    l.append(i+1)
    l.append(tmp.pop(0))
    l.append(tmp.pop(0))
    info.append(l)


info.sort(key=lambda x:(x[1],-int(x[2])))

for i in range(n):
    print(info[i][0])

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

int main() {
  string s;
  cin >> s;  
  sort(s.begin(),s.end());
  
  string t;
  cin >> t;
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());

  if(s < t)cout << "Yes" <<endl;
  else cout << "No" << endl;
  
}


Measured memory_bytes: 256
while True:
    a,b = [int(i) for i in input().split()]

    if a == 0 and b == 0:
        break

    if a < b:
        a,b = b,a

    cnt = 0
    while b > 0:
        a, b = b, a % b
        cnt += 1

    print(a, cnt)



Measured memory_bytes: 5616
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll N;
const ll inf = 1e18;
int main()
{
    cin >> N;
    ll ans = inf;
    for(ll i = 1; i * i <= N; ++i){
        if(N % i == 0){
            ans = min(ans, i + N / i - 2);
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3596
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
#include <functional>
#include <cstdlib>
//using
using namespace std;
using vl = vector <long long>;
using vs = vector <string>;
using vc = vector <char>;
using ll= long long;
using vvl = vector<vector<ll> >;
//vector<vector<char> > hyou(N, vector<char>(N));
using vd = vector <double>;
//define
//#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
#define print(n) cout<<n<<endl;
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
//素数判定　O(√A) 
bool is_prime(int x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }
/*順列生成
do {
  // 順列に対する処理
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/

//絶対値　abs()

//グローバル変数宣言
 ll p=0,q=0,r=0;

int main(){
   ll h;
   cin>>h;
   q=1;
   while (h>1)
   {
     h/=2;
     p+=q;
     q*=2;
   }
   print(p+q)
   
}

Measured memory_bytes: 3496
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    int X, A, B;
    cin >> X >> A >> B;
    if(B <= A) {
        cout << "delicious" << endl;
    } else if(B <= A + X) {
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << 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 sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
const ll INF = (1LL<<31) - 1;

template <typename T> struct SegTree {
  /*RMQ*/
  int n;
  vector<T> node;

  SegTree (vector<T> v) {
    int s = v.size();
    n = 1; while (n < s) n <<= 1;
    node.resize(2*n, INF); 

    for (int i = 0; i < s; i++) node[i+n-1] = v[i];
    for (int i = n-2; i >= 0; i--) node[i] = min(node[2*i+1], node[2*i+2]);
  }

  void update(int idx, T value) {
    idx += (n - 1);
    node[idx] = value;
    while (idx > 0) {
      idx = (idx - 1) >> 1;
      node[idx] = min(node[2*idx+1], node[2*idx+2]);
    } 
  }

  T get(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return node[k];
    T vl = get(a, b, 2*k+1, l, (l+r)/2);
    T vr = get(a, b, 2*k+2, (l+r)/2, r);
    return min(vl, vr);
  }

};

int main(){ 
  int n, q;
  cin >> n >> q;
  SegTree<ll> seg(vector<ll>(n,INF));
  while (q--) {
    int c, s, t;
    cin >> c >> s >> t;
    if (c) cout << seg.get(s,t+1) << endl;
    else seg.update(s,t);
  }
  return 0;
} 


Measured memory_bytes: 5752
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair
#define eb emplace_back

const int MAX_N = 2e6+10;

int N, X, T;

void solve()
{
	cout << ((N+X-1)/X)*T<<'\n';
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> N >> X  >> T;
	solve();
	return 0;
}

Measured memory_bytes: 3640
from collections import deque

if __name__ == "__main__":
    K = int(input())
    runruns = []

    queue = deque()
    for i in range(1, 10):
        queue.appendleft(str(i))
        runruns.append(str(i))

    while len(runruns) < K:
        cur = queue.pop()
        for diff in [-1, 0, 1]:
            right = cur[-1]
            if (right == '0' and diff == -1) or (right == '9' and diff == 1):
                continue
            next_right = str(int(right) + diff)
            next_cur = cur + next_right
            runruns.append(next_cur)
            queue.appendleft(next_cur)

    runruns = list(map(int, runruns))
    # runruns.sort()
    # print(runruns)
    print(runruns[K-1])


Measured memory_bytes: 60132
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d,r,l;
    cin>>a>>b>>c>>d;
    r=a+b;
    l=c+d;
    if(r<l){
        cout<<"Right";
    }
    else if(l<r){
        cout<<"Left";
    }
    else{
        cout<<"Balanced";
    }
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
//#define num 1000000007
#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) (a>b)?(a>c)?a:c:(b>c)?b:c
#define min3(a,b,c) (a<b)?(a<c)?a:c:(b<c)?b:c
#define avg(a,b) ((a)+(b))/2
#define push push_back
#define pop pop_back
#define mp make_pair
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }
    return gcd(b, a%b);
}
bool prime[3001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=3000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=3000; i += p) 
                prime[i] = false; 
        } 
    } 
}
ll powe[20];
void power()
{
	powe[0]=1;
	REP(i,1,20)
	{
		powe[i]=(powe[i-1]*10)%num;
        if(powe[i]<0)
        powe[i]+=num;
	}
}
ll A[300005],mx[300005],mn[300005],cur[300005];
void assign(ll n)
{
	REP(i,1,n)
	{
		A[i]=mx[i]=mn[i]=cur[i]=i;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n;
	ll a[100005],b[100005],c[100005],dp[3][100005];
	cin>>n;
	REP(i,0,n)
	{
		cin>>a[i]>>b[i]>>c[i];

		
	}
	dp[0][0]=a[0];
	dp[1][0]=b[0];
	dp[2][0]=c[0];
	REP(i,1,n)
	{
		dp[0][i]=a[i]+max(dp[1][i-1],dp[2][i-1]);
		dp[1][i]=b[i]+max(dp[0][i-1],dp[2][i-1]);
		dp[2][i]=c[i]+max(dp[1][i-1],dp[0][i-1]);
	}
	cout<<max(max(dp[0][n-1],dp[1][n-1]),dp[2][n-1]);
	cout<<endl;
	return 0;
}

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

int a[10005];
int dp[10005];
int n;

///flag == 0求最长不上升子序列的长度
///flag == 1求最长不上升子序列的最少数目
///（即最长上升子序列的长度）
void slove(bool flag)
{
    int ans = 0;
    for(int i = 0; i < n; ++i)
    {
        dp[i] = 1;
        for(int j = 0; j < i; ++j)
        {
            if(!flag && a[j] < a[i])
                dp[i] = max(dp[i], dp[j] + 1);
            if(flag && a[j] >= a[i])
                dp[i] = max(dp[i], dp[j] + 1);
        }
        ans = max(ans, dp[i]);
    }
    if(ans <= 2)
        cout << "YES" << '\n';
    else
        cout << "NO" << '\n';
}

int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        n = 10;
        for(int i = 0; i < 10; ++i)
            cin >> a[i];
        slove(1);
    }
    return 0;
}



Measured memory_bytes: 3000
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>

#define INF 1000000000
using namespace::std;



long Lmax(long x, long y) {
	if (x > y)return x;
	return y;
}

int max(int x, int y) {
	if (x > y)return x;
	return y;
}

long Lmin(long x, long y) {
	if (x < y)return x;
	return y;
}


int min(int x, int y) {
	if (x < y)return x;
	return y;
}

int abs(int a) {
	if (a < 0) {
		return -a;
	}
	return a;
}

int N,wa, K,W,cost[90001],py[90001],px[90001],ans,m,a,r,c,h,num[5],Q,L[100001],R[100001],H,D,A[301][301];
string s[100000];

int main() {
	cin >> H>>W>>D;
	ans = 0;
	for (int i = 1; i <= H;i++) {
		for (int j = 1; j <= W; j++) {
			cin >> A[i][j];
			px[A[i][j]] = i;
			py[A[i][j]] = j;
		}
	}
	a = 0;
		for (int i = 1; i <= D; i++) {
		a = i;
		cost[i] = 0;
		while (1) {
			if (a + D > W*H) {
				break;
			}
			cost[a + D] = cost[a] + abs(px[a] - px[a + D]) + abs(py[a] - py[a + D]);
			a += D;
		}
	}
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		cin >> L[i] >> R[i];
	}

	for (int i = 0; i < Q; i++) {
		if (L[i] % D != 0) {
			ans = cost[R[i]] - cost[L[i]];
		}
		else {
			ans = cost[R[i]] - cost[L[i]];
		}
		cout << ans << endl;
	}

	return 0;
}




Measured memory_bytes: 4096
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

//#include <iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
   string s;
   cin>>s;
   
   if(s=="ARC")
   cout<<"ABC";
   else
   cout<<"ARC";

    return 0;
}


Measured memory_bytes: 3600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Program
    {
        static void Main()
        {
            var a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var b = (a[0] + a[1] -1)/ a[1];
            Console.WriteLine(b*a[2]);
        }
    }
}

Measured memory_bytes: 28196
def f(s):
  for j in range(10):
    s = s*s
    s = int(s/100)
    s = s%10000
    print(s)
    

n = int(input())
t = [int(input()) for i in range(n)]
for i in range(n):
  print("Case {0}:".format(i+1))
  f(t[i])

Measured memory_bytes: 7568
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;
int max(int a,int b){
    if(a>b)return a;
    return b;
}
int min(int a,int b){
    if(a>b)return b;
    return a;
}
int abs(int n){
    if(n>0)return n;
    return -n;
}
void swap(int &a,int &b){
    int temp=a;
    a=b;
    b=temp;
    return;
}
int find(int n,int p[]){
    if(p[n]==n)return n;
    return p[n]=find(p[n],p);
}
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    if(m==1)printf("%d\n",(n-m)*200+m*3800);
    else if(m==2)printf("%d\n",(n-m)*400+m*7600);
    else if(m==3)printf("%d\n",(n-m)*800+m*15200);
    else if(m==4)printf("%d\n",(n-m)*1600+m*30400);
    else printf("%d\n",(n-m)*3200+m*60800);
}

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

int main() {
  int N;
  cin >> N;
  int A[3*N];
  for(int i=0; i<3*N; i++) {
    cin >> A[i];
  }
sort(A, A+(3*N));
  long long ans = 0;
   for(int i=(3*N-2); i>=N; i-=2){
        ans += A[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4768
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int tmp = 1;

    for(int i = 0; i < n; i++){
      if(tmp*2 > tmp + k){
        tmp += k;
      }else{
        tmp *= 2;
      }
    }

    System.out.println(tmp);
  }
}

/*
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String blank = sc.nextLine();
String s = sc.nextLine();
System.out.println();
System.exit(0)
*/


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

using ll=long long;



void solve(){
    ll n;
    cin>>n;
    for(ll i=n; ;i+=n){
        if(i%n==0&&i%2==0){
            cout<<i<<endl;
            break;
        }
    }
}

signed main(){
    //while(1)
    solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())
#define AsceSort(a) sort(a.begin(),a.end())

using namespace std;
typedef long long ll;

int main(void) {
	string n;
	cin >> n;
	REP(i, 3) {
		if (n[i] == '1')n[i] = '9';
		else n[i] = '1';
		cout << n[i];
	}
	cout << endl;
	return 0;
}





Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    int[] a = new int[n];
    for(int i=0;i<n;i++){
      a[i] = Integer.parseInt(sc.next())/2;
    }
    long gcd;
    long lcd = 1;
    for(int i=0;i<n;i++){
      gcd = getGCD(lcd,a[i]);
      lcd = lcd*a[i]/gcd;
      if(lcd > m){
        System.out.println(0);
        return;
      }
    }
    for(int i=0;i<n;i++){
      if((lcd/a[i])%2==0){
        System.out.println(0);
        return;
      }
    }
    System.out.println((m/lcd+1)/2);
    
  }
  
  public static long getGCD(long a,long b){
    if(b==0){
      return a;
    }else{
      return getGCD(b,a%b);
    }
  }
}

Measured memory_bytes: 59064
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1000000000100000000;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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(){
    string s; cin >> s;
    cout << "ABC" << s << ln;
}

Measured memory_bytes: 3604
n = int(input())
s_list = []
for ii in range(n):
    ss = input()
    s_list.append(ss)
c=0
for s in s_list:
    if(s=="A"):
        c+=1     
    else:
        c-=1
        if(c<0):
            break
if(c==0):
    print("YES")
else:
    print("NO")



Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n; cin>>n;
	int x = n/100;
	int y = n%100;
	if(x>=1 && x<=12){
		if(y>=1 && y<=12){
			cout<<"AMBIGUOUS"<<endl;
		}else{
			cout<<"MMYY"<<endl;
		}
	}else{
		if(y>=1 && y<=12){
			cout<<"YYMM"<<endl;
		}else{
			cout<<"NA"<<endl;
		}
	}
}


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

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

    int n = s.length();

    bool isOk = true;

    for (int i = 0; i < n; ++i)
    {
        if (s.at(i) != t.at(i))
        {
            isOk = false;
            break;
        }
    }

    cout << (isOk ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3624
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

#define amen ;
#define vec vector
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef double d;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;
typedef unsigned int ui;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, m;
    cin >> n >> m;
    vector <pair<int, int> > v(n);
    for (auto &it : v)
    {
        cin >> it.first >> it.second;
        //it.first--;
    }
    sort(rall(v));
    multiset <int> st;
    int ans = 0;
    for (int i = 1; i <= m; i++)
    {
        while (len(v) && v.back().first <= i)
        {
            st.insert(v.back().second);
            v.pop_back();
        }
        if (len(st))
        {
            int x = *st.rbegin();
            ans += x;
            st.erase(st.find(x));
        }
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 5632
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)

// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
using namespace std;

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 GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

// I'm trying to ~~~
int main(){
    int M,D; cin>>M>>D;
    int res=M-1;
    if(D>=M) res++;
    cout << res << endl;
    
}



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

int n;
int main(){
    cin>>n;
    if(n<1200){
    cout<<"ABC"<<endl;
    }
    else if(n<2800){
    cout<<"ARC"<<endl;
    }
    else{
    cout<<"AGC"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = a; i <= b; ++i)
#define PER(i, a, b) for (int i = a; i >= b; --i)
#define RVC(i, S) for (int i = 0; i < S.size(); ++i)
#define mp make_pair
#define pb push_back
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
typedef vector<int> VI;
 
inline int read(){
	int x = 0, ch = getchar(), f = 1;
	while (!isdigit(ch)){if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return x * f;
}

LL n, s;
VI tmp;

void check(LL x){
	tmp.clear();
	LL t = n;
	while (t){
		tmp.pb(t % x);
		t /= x;
		// cerr << t << endl;
	}
	int sum = 0;
	RVC(i, tmp) sum += tmp[i];
	if (sum == s){
		cout << x << endl;
		exit(0);
	}
}

int main(){
	cin >> n >> s;
	LL t;
	if (n == s){
		cout << n + 1 << endl;
		return 0;
	}
	REP(i, 2, 1000000) check(i);
	LL ans = 1ll << 60;
	for (LL j, t = 1; t <= n; t = j + 1){
		LL p = n / t;
		j = n / p;
		// cerr << p << endl;
		
		if (n + p - s > 0 && (n + p - s) % p == 0){
			LL b = (n + p - s) / p;
			if (0 <= p && p < b && 0 <= n - p * b && n - p * b < b){
				ans = min(ans, b);
			}
		}
	}
	if (ans == 1ll << 60){
		cout << -1 << endl;
	} else cout << ans << endl;
	return 0; 
}

Measured memory_bytes: 256
#include <cstdio>

typedef long long ll;

const ll N_MAX = 100000, T_MAX = 100000;
ll N;
ll C;
ll s[N_MAX], t[N_MAX];
ll c[N_MAX];

int main()
{
  if (scanf("%lld%lld", &N, &C) < 2) return 0;
  for (int i = 0; i < N; i++)
    if (scanf("%lld%lld%lld", &s[i], &t[i], &c[i]) < 3) return 0;

  ll TT_MAX = (T_MAX + 1) * 2;
  ll cast[TT_MAX], need[TT_MAX];
  for (int t = 0; t <= TT_MAX; t++)
    need[t] = 0;
  for (int k = 1; k <= C; k++) {
    for (int t = 0; t <= TT_MAX; t++)
      cast[t] = 0;
    for (int i = 0; i < N; i++)
      if (c[i] == k) cast[s[i] * 2 - 1]++, cast[t[i] * 2]--;
    for (int t = 1; t < TT_MAX; t++)
      cast[t] += cast[t - 1];
    for (int t = 0; t < TT_MAX; t++)
      if (cast[t] > 0) need[t]++;
  }
  ll res = 0;
  for (int t = 0; t <= TT_MAX; t++)
    res = res < need[t] ? need[t] : res;

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


Measured memory_bytes: 5632
#include "stdio.h"
#include "stdlib.h"
#include "iostream"
#include "math.h"
#include <string.h>


using namespace std;
#define fori0(G) for(int i=0;i<G;i++)
#define fori1(G) for(int i=1;i<=G;i++)
#define forj0(G) for(int j=0;j<G;j++)
#define forj1(G) for(int j=1;j<=G;j++)
#define fork0(G) for(int k=0;k<G;k++)
#define fork1(G) for(int k=1;k<=G;k++)



int main() {
	int n, ba[13],p=11,q=11,r=0;
	cin >> n;
	fork0(n) {
		p = 11;q = 11;r = 0;
		ba[11] = -1;

		fori0(10) { cin >> ba[i]; }
		fori0(1023) {
			p = 11;q = 11;
			forj0(10) {
				//printf("%d,%d", p, q);
				if (i&(int)pow(2, j)) { if (ba[p] > ba[j]) { break; } else { p = j; } }
				else { if (ba[q] > ba[j]) { break; } else { q = j; } }
				if (j == 9) { r = 1; }

			}
		}
		if (r) { printf("YES\n"); }
		else { printf("NO\n"); }
	}
	//system("pause");
	return 0;
}



Measured memory_bytes: 3128
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;

int main()
{
	int A, B, C;
	cin >> A >> B >> C;
	if (C >= A && C <= B) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


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

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int a, b, c;
	cin >> a >> b >> c;
	print(a <= c && c <= b ? "Yes" : "No");
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
from itertools import permutations
import sys
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    link = [[False] * N for i in range(N)]
    for i in range(M):
        a, b = map(int, input().split())
        link[a-1][b-1] = True
        link[b-1][a-1] = True
    
    ans = 0
    for p in permutations(range(1, N)):
        # print(0, p)
        pre = 0
        ok = True
        for t in p:
            if not link[pre][t]:
                ok = False
                break
            pre = t
        if ok:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064