akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

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

using namespace std;
using ll = long long;

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    // もっとも高い濃度(%)
    double max_density = -1;
    // もっとも高い濃度の砂糖水の質量
    int ans1 = 0;
    // もっとも高い濃度の砂糖水の砂糖の質量
    int ans2 = 0;

    for (int i = 0; 100 * A * i <= F; i++) {
        for (int j = 0; 100 * A * i + 100 * B * j <= F; j++) {
            for (int k = 0; 100 * A * i + 100 * B * j + C * k <= F && C * k <= E * (A * i + B * j); k++) {
                for (int l = 0; 100 * A * i + 100 * B * j + C * k + D * l <= F && C * k + D * l <= E * (A * i + B * j); l++) {

                    double density = (double) (C * k + D * l) / (double) (100 * A * i + 100 * B * j + C * k + D * l) * 100;

                    if (max_density < density) {
                        max_density = density;
                        ans2 = C * k + D * l;
                        ans1 = 100 * A * i + 100 * B * j + C * k + D * l;
                    }
                }
            }
        }
    }

    cout << ans1 << " " << ans2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  Int n,q;
  cin>>n>>q;
  vector<Int> a(n),xs(q);
  for(Int i=0;i<n;i++) cin>>a[i];
  for(Int i=0;i<q;i++) cin>>xs[i];

  vector<Int> s(n+1,0);
  for(Int i=0;i<n;i++) s[i+1]=s[i]+a[i];
  vector<Int> t(n+1,0);
  for(Int i=0;i<n;i++)
    t[i+1]=(i?t[i-1]:0)+a[i];

  for(Int x:xs){
    auto check=
      [&](Int k)->Int{        
        if(a[n-k]<=x) return 0;
        Int l=-1,r=n-k;
        while(l+1<r){
          Int m=(l+r)>>1;
          if(abs(a[m]-x)<=abs(a[n-k]-x)) r=m;
          else l=m;
        }
        Int len=(n-(k+1))-r+1;
        return len+1>=k;
      };    
    Int l=1,r=n+1;
    while(l+1<r){
      Int m=(l+r)>>1;
      if(check(m)) l=m;
      else r=m;      
    }
    //cout<<l<<" "<<n-l*2<<endl;
    Int ans=(s[n]-s[n-l])+(n-l*2>=0?t[n-l*2]:0);
    cout<<ans<<"\n";
  }
  cout<<flush;
  return 0;
}


Measured memory_bytes: 4864
using System;
using System.Collections.Generic;
using System.Linq;

class MainClass
{
    static void Main()
    {
        string s = Console.ReadLine();
        var K = int.Parse(Console.ReadLine());

        int loop = 0;
        List<string> vs = new List<string>();
        char fw = 'a';
        while (vs.Count < K)
        {
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == fw)
                {
                    for (int j = 0; j < Math.Min(6,s.Length-i); j++)
                    {
                        string w = s.Substring(i, j+1);
                        if (!vs.Contains(w)) vs.Add(w);
                    }
                }
            }
            fw++;
        }
        vs.Sort();
        Console.WriteLine(vs[K-1]);
        //Console.WriteLine(string.Join(" ",vs));
    }
}

Measured memory_bytes: 28848
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include <stdio.h>
#include <sstream>


bool sort_pair( std::pair< int64_t, int64_t > origin, std::pair< int64_t, int64_t > another )
{
    return origin.first > another.first;
}

int main()
{
    int a;
    std::string b;
    std::cin>> a;
    std::cin>> b;
    std::vector< int > list( 1000, 0 );

    for( int i = 0; i < 1000; i++ )
    {
        std::vector< std::string > check( 3 );
        std::ostringstream oss1;
        std::ostringstream oss2;
        std::ostringstream oss3;
        oss1 << i / 100;
        oss2 << ( i % 100 ) / 10;
        oss3 << i % 10;

        check[0] = oss1.str();
        check[1] = oss2.str();
        check[2] = oss3.str();
        int c = 0;

        for( int r = 0; r < a; r++ )
        {
            std::string aaa = b.substr( r , 1 );
            
            if( aaa == check[c] )
            {
                c += 1;
                if( c == 3 )
                {
                    list[i] = 1;
                    break;
                }
            }
        }
    }

    int s = 0;
    for( int i = 0; i < 1000; i++ )
    {
        if( list[i] == 1 )
        {
            s += 1;
        }
    }

    std::cout<< s;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  float D, T, S;
  cin >> D >> T >> S;
  cout << (D/S <= T ? "Yes" : "No") << endl;
}

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

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    int ans = 0;
    if(c - a + b > 0)  ans = c - a + b;
    else    ans = 0;
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <numeric>

//#include <map>

using namespace std;

class HW{
public:
	int H, W;
};

int main()
{
	vector<HW> vData;

	while (1)
	{
		int H, W;
		cin >> H >> W;
		if (H == 0 && W == 0)break;

		HW thw;
		thw.H = H;
		thw.W = W;
		vData.push_back(thw);
	}

	for (int i = 0; i < vData.size(); i++)
	{
		int H, W;
		H = vData.at(i).H;
		W = vData.at(i).W;
		for (int y = 0; y < H; y++)
		{
			for (int x = 0; x < W; x++)
			{
				if (y == 0 || y == H - 1 || x == 0 || x == W - 1)
				{
					cout << "#";
				}
				else
				{
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3096
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
 
  while(true){
   int t;
 cin>>t;
   if(t==0){
   break;
   }
   
 
 int s=1000-t;
 int w=s/500;
 int e=(s%500)/100;
  int r=((s%500)%100)/50;
  int y=(((s%500)%100)%50)/10;
  int u=((((s%500)%100)%50)%10)/5;
  int o=(((((s%500)%100)%50)%10)%5);
  cout<< w+e+r+y+u+o <<endl;
}
  
} 


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int A,B;
string S;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B>>S;
	int h=0;
	FOR(i,S.size()) {
		if(S[i]=='-') {
			x=i;
			h++;
		}
	}
	if(h!=1) return _P("No\n");
	if(x==A && A+B+1==(int)S.size()) _P("Yes\n");
	else _P("No\n");
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

struct Node
{
  double p1;
  double p2;
};

int kock(int n,struct Node A,struct Node B)
{
  struct Node a, b, c;
  if(n == 0)
    {
      return 0;
    }
  a.p1 = (2*A.p1 + B.p1) / 3;
  a.p2 = (2*A.p2 + B.p2) / 3;
  b.p1 = (A.p1 + 2*B.p1) / 3;
  b.p2 = (A.p2 + 2*B.p2) / 3;
  c.p1 = (b.p1 - a.p1) * cos(M_PI/3) - (b.p2 - a.p2) * sin(M_PI / 3) + a.p1;
  c.p2 = (b.p1 - a.p1) * sin(M_PI/3) + (b.p2 - a.p2) * cos(M_PI / 3) + a.p2;
  kock(n - 1, A, a);
  printf("%f %f\n", a.p1, a.p2);
  kock(n - 1, a, c);
  printf("%f %f\n", c.p1, c.p2);
  kock(n - 1, c, b);
  printf("%f %f\n", b.p1, b.p2);
  kock(n - 1, b, B);
  return 1;
}

int main()
{
  int n;
  struct Node A = {0.0, 0.0}, B = {100.0, 0.0};
  scanf("%d", &n);
  printf("%f %f\n", A.p1, A.p2);
  kock(n, A, B);
  printf("%f %f\n", B.p1, B.p2);
  return 0;
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
int a[33]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main()
{
	int n;cin>>n;
	cout<<a[n-1];
	return 0;
}

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

int main() {
    string n; cin >>n;
    int ret;
    ret = n[0] - '0';
    for (int i = 1; i < n.size(); i++) {
        if (n[i]=='9') {
            ret += 9;
        }
        else {
            ret -= 1;
            ret += (n.size()-i)*9;
            break;
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
s=input()
n=len(s)
A,B=-1,-1
for i in range(n-1):
    if s[i]==s[i+1]:
        A,B=i+1,i+2

for i in range(n-2):
    if s[i]==s[i+2]:
        A,B=i+1,i+3

print(A,B)

Measured memory_bytes: 3188
#include <iostream>
#include <cstring>
#include <string>
#include <stdexcept>

using namespace std;

bool isoperator(string str){
    if(str == "+" || str == "-" || str == "*" || str == "/"){
        return true;
    }
    return false;
}

template <typename T>
class Stack {
public:
    Stack(int s) : xs {new T[s]}, s {} {};
    void push(T v){
        xs[s++] = v;
    };
    T pop(){
        return xs[--s];
    };
    int size(){ return s; };
    T peek(){ return xs[s-1]; };
    void print(){
        for(int i = 0; i < s-1; ++i){
            cout << xs[i] << ' ';
        }
        cout << xs[s-1] << '\n';
    }
private:
    T* xs;
    int s;
};

void proc(Stack<int>& st, string op){
    int a = st.pop();
    int b = st.pop();
    int v = 0;
    if(op == "+"){
        v = a+b;
    } else if(op == "-"){
        v = b-a;
    } else if(op == "*"){
        v = a*b;
    } else if(op == "/"){
        v = b/a;
    }
    //cout << "a, b = " << a << ", " << b << '\n';
    //cout << "v = " << v << '\n';
    st.push(v);
}

int main(){
    string str;
    auto st = Stack<int>(200);
    while(cin >> str){
        if(isoperator(str)){
            proc(st, str);
        } else {
            st.push(stoi(str));
        }
        //cout << "peek = " << st.peek() << '\n';
        //st.print();
    }
    cout << st.peek() << '\n';
}

Measured memory_bytes: 1200
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
long long dp[100010];

int main(){
    int n, w, ans = 0;
    cin >> n >> w;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    for(int i = 0; i < n; i++){
        for(int j = w; j >= a[i]; j--){
            dp[j] = max(dp[j], dp[j - a[i]] + b[i]); 
        }
    }
    cout << *max_element(begin(dp), begin(dp) + w + 1) << endl;
    return 0;
}


Measured memory_bytes: 1024
n = int(input())
hs = list(map(int, input().split()))

ans = 0
tmp = 0
start = hs[0]
for i in range(n-1):
    if hs[i] >= hs[i+1]:
        tmp += 1
        ans = max(ans, tmp)
    else:
        tmp = 0
        continue
print(ans)

    

Measured memory_bytes: 15020
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main()
{
ll ans,n;

cin >> n;
ans=n*(n-1)/2-n/2;
cout << ans << endl;
if(n%2){
    for(int i = 1; i < n+1; i++){
        for(int j = i+1;  j< n+1; j++){
            if(i+j!=n)cout << i<< " "<<j << endl;
        }
    }
}
else{
    for(int i = 1; i < n+1; i++){
        for(int j = i+1;  j< n+1; j++){
            if(i+j!=n+1){cout << i<< " "<<j << endl;}
        }
    }
}

return 0;
}





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

using namespace std;

int n, X[1005];
vector<int> adjlist[1005];
int dp[1005][5005];
int ans[1005];
void dfs(int x){
	for(auto i : adjlist[x]){
		dfs(i);
	}
	if(adjlist[x].size() == 0){
		ans[x] = 0;
		return;
	}
	for(int j = 5000; j>=0; j--) dp[x][j] = INT_MAX;
	dp[x][0] = 0;
	for(auto i : adjlist[x]){
		for(int j = 5000; j>=0; j--){
			// dp[j] is the min other value when one value is >= j
			// values are ans[i].first and ans[i].second
			dp[x][j] = min((j<ans[i] or dp[x][j-ans[i]] == INT_MAX) ? INT_MAX : dp[x][j-ans[i]] + X[i],
					(j<X[i] or dp[x][j-X[i]] == INT_MAX) ? INT_MAX : dp[x][j-X[i]] + ans[i]);
		}
	}
	ans[x] = INT_MAX;
	for(int j = 0; j<=X[x]; j++){
		if(dp[x][j] == INT_MAX) continue;
		ans[x] = min(ans[x], dp[x][j]);
	}
	if(ans[x] == INT_MAX){
		cout << "IMPOSSIBLE";
		exit(0);
	}
}
int main(){
//	freopen("bichrometree.in", "r", stdin);
	cin >> n;
	for(int i = 2; i<=n; i++){
		int parent; cin >> parent;
		adjlist[parent].push_back(i);
	}
	for(int i = 1; i<=n; i++){
		cin >> X[i];
	}
	dfs(1);
	cout << "POSSIBLE";
}


Measured memory_bytes: 19328
#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<cstdlib>
#include<set>
#include<unordered_map>
#define l(x) (x<<1)
#define r(x) ((x<<1)|1)
#define low(x) (x&(-x))
#define IL inline
#define reg register
#define LL long long
#define N 1000010
#define MOD 998244353
#define MO 1000000007
#define INF 0x3f3f3f3f
using namespace std;

LL T,n,m,i,j,k,x,y,z,Ans,sum,cnt;
LL a[N],b[N],p[N],v[N];
char c[N];

struct Data{
	LL x,y;
}d[N];

IL LL Abs(LL x){return (x<0)?-x:x;}
IL void Swap(LL &a,LL &b){a^=b^=a^=b;}
IL LL Min(LL a,LL b){return (a<b)?a:b;}
IL LL Max(LL a,LL b){return (a>b)?a:b;}
IL bool cmp(const Data a,const Data b){return a.x<b.x;}

IL LL Mi(LL x,LL y){
	LL p=x,t=1,Res=1;
	for (;t<=y;(t&y)?Res=(Res*p)%MOD:0,p=(p*p)%MOD,t<<=1);
	return Res;
}

IL LL read(){
	LL p=0,f=1;	char	c=getchar();
	while (c<48||c>57)	{if (c=='-')	f=-1;	c=getchar();}
	while (c>=48&&c<=57)	p=(p<<1)+(p<<3)+c-48,c=getchar();
	return p*f;
}

inline int Gcd(int x,int y){return (y==0)?x:Gcd(y,x%y);}

int main(){
	#ifdef __Marvolo
	freopen("zht.in","r",stdin);
	freopen("zht.out","w",stdout);
	#endif
	n=read();
	for (i=1;i<=n;i++)	a[i]=read();
	a[0]=a[1];
	for (i=1;i<=n;i++)	a[0]=Gcd(a[0],a[i]);
	if (a[0]!=1){
		puts("not coprime");
		return 0;
	}

	for (i=2;i<=1000000;i++){
		if (v[i])	continue;
		++cnt;	p[cnt]=i;	v[i]=i;
		for (j=i*i;j<=1000000;j+=i)
			if (!v[j])	v[j]=i;
	}
	v[1]=1;
	for (i=1;i<=n;i++){
		x=a[i];
		while (v[x]>1){
			if (b[v[x]] && b[v[x]]!=i)	goto END;
			b[v[x]]=i;	x/=v[x];
		}
	}
	puts("pairwise coprime");
	return 0;
	END:;
	puts("setwise coprime");
	return 0;
}

Measured memory_bytes: 20444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000001;
constexpr ll INF= 9 * 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

int main() {
    int N,K;
    cin >> N >> K;
    vector<int> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    int ret = 0;
    for(int i = 0;i <= min(K,N);i++) {
        for(int j = 0;j <= min(K - i,N - i);j++) {
            priority_queue<int,vector<int>,greater<int>> que;
            for(int k = 0;k < i;k++) {
                que.push(vec.at(k));
            }
            for(int k = 0;k < j;k++) {
                que.push(vec.at(N - 1 - k));
            }
            for(int k = 0;k < K - i - j;k++) {
                if(que.empty()) {
                    break;
                }
                if(que.top() < 0) {
                    que.pop();
                }
                else {
                    break;
                }
            }
            int cnt = 0;
            while(!que.empty()) {
                cnt += que.top();
                que.pop();
            }
            ret = max(ret,cnt);
        }
    }
    cout << ret << endl;
}

Measured memory_bytes: 256
x1,y1,x2,y2=gets.split.map(&:to_i)
w=x1-x2
h=y1-y2

if x1 == x2 && y1 >y2
  x3=x2+h
  y3=y2
  x4=x1+h
  y4=y1
elsif x1 == x2 && y1 <y2
  x3=x2+h
  y3=y2
  x4=x1+h
  y4=y1
elsif x1 < x2 && y1 ==y2
  x3=x2
  y3=y2+w
  x4=x1
  y4=y1+w
elsif x1 > x2 && y1 ==y2
  x3=x2
  y3=y2-w
  x4=x1
  y4=y1-w
elsif x1 <= x2 && y1 <y2
  x3=x2+h
  y3=y2-w
  x4=x1+h
  y4=y1-w
elsif x1 <= x2 && y1 >y2
  x3=x2+h
  y3=y2-w
  x4=x1+h
  y4=y1-w
elsif x1 > x2 && y1 <y2
  x3=x2+h
  y3=y2-w
  x4=x1+h
  y4=y1-w
elsif x1 > x2 && y1 >y2
  x3=x2+h
  y3=y2-w
  x4=x1+h
  y4=y1-w
end
puts "#{x3} #{y3} #{x4} #{y4}"

Measured memory_bytes: 1788
S = input()
T = input()
l1 = len(S)
l2 = len(T)
ans = l2
for i in range(l1-l2+1):
    x = 0
    for j in range(l2):
        if T[j] != S[i+j]:
            x += 1
    ans = min(x,ans)
print(ans)

Measured memory_bytes: 67468
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	if (b % a == 0) cout << a + b << endl;
	else cout << b - a << endl;
}

Measured memory_bytes: 256
S = input()
f, r = int(S[:2]), int(S[2:])
#print(f)
#print(r)
if (f > 12 or f == 0) and 0 < r <= 12:
  ans = "YYMM"
elif 0 < f <= 12 and (r > 12 or r == 0):
  ans = "MMYY"
elif 0 < r <= 12 and 0 < f <= 12:
  ans = "AMBIGUOUS"

else:
  ans = "NA"
print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long x = sc.nextLong();
    long k = sc.nextLong();
    long d = sc.nextLong();

    System.out.println(solve(Math.abs(x), k, d));
  }
  static long solve(long x, long k, long d){
    long a = x / d;
    if(a == 0){
      if(k % 2 == 0){
        return x;
      } else {
        return Math.abs(x - d);
      }
    } else if(a >= k){
      x = x - (k * d);
      return Math.abs(x);
    } else {
      // (a < k)
      x = x - (a * d);
      k -= a;
      if(k % 2 == 0){
        return Math.abs(x);
      } else {
        return Math.abs(Math.abs(x) - d);
      }
    }
  }
}

Measured memory_bytes: 35544
#--Fizz Buzz
N = int(input())

j = 0
for i in range(1, N+1):
  if i % 15 == 0:
    #fizzbuzz.append('FizzBuzz')
    pass
  elif i % 3 == 0:
    #fizzbuzz.append('Fizz')
    pass
  elif i % 5 == 0:
    #fizzbuzz.append('Buzz')
    pass
  else:
    j = j + i

print(j)



Measured memory_bytes: 9164
#include<bits/stdc++.h>
#include "string.h"
using namespace std;
#define int long long int


int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(30)<<fixed;

	
	int n;
	cin>>n;
	int t=1^n;
	cout<<t<<endl;
	return 0;
}

Measured memory_bytes: 3604
s = input()
if s[0]=='R' and s[0]==s[1]==s[2]:
  print(3)
elif s[0]=='R' and (s[0]==s[1]):
  print(2)
elif s[1]=='R' and (s[1]==s[2]):
  print(2)
elif s[0]=='R' or s[1]=='R' or s[2]=='R':
  print(1)
else:
  print(0)

Measured memory_bytes: 8916
#外出している X さんは、ABC に参加するためにスマートウォッチで最適な帰宅経路を調べることにしました。
#スマートウォッチであるあなたは、N 個の帰宅経路を見つけました。
#X さんが i 番目の経路を使う場合、コスト ci かけて時間 ti で帰宅できます。
#時間 T 以内に帰宅できる経路のうち、コストが最小となる経路のコストを求めてください。

N, T = map(int, input().split())
C = []

for i in range(N):
    c, t = map(int, input().split())
    if t<=T:
        C.append(c)
ans=sorted(C)
if len(ans)>=1:
    print(ans[0])
else:
    print('TLE')

Measured memory_bytes: 38256
group1 = [1,3,5,7,8,10,12]
group2 = [4,6,9,11]
group3 = [2]

x,y=map(int,input().split())
if (x in group1) and (y in group1):
    print('Yes')
elif (x in group2) and (y in group2):
    print('Yes')
elif (x in group3) and (y in group3):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            line.pop();
            line
        }
    )
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let iter = line.split_whitespace();
            iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    )
}

fn solve(vs: Vec<usize>) -> usize {
    use std::cmp::max;

    let n = vs.len();
    let mut od = [0; 100000+1];
    let mut ev = [0; 100000+1];

    for (i, &v) in vs.iter().enumerate() {
        if (i % 2 == 1) {
            od[v] += 1;
        } else {
            ev[v] += 1;
        }
    }

    let mut od1=(0,0);
    let mut od2=(0,0);
    let mut ev1=(0,0);
    let mut ev2=(0,0);

    for i in 0..100001 {
        if (od1.0 < od[i]) {
            od2 = od1;
            od1 = (od[i], i);
        } else if (od2.0 < od[i]) {
            od2 = (od[i], i);
        }

        if (ev1.0 < ev[i]) {
            ev2 = ev1;
            ev1 = (ev[i], i);
        } else if (ev2.0 < ev[i]) {
            ev2 = (ev[i], i);
        }
    }

    if (od1.1 != ev1.1) {
        n - od1.0 - ev1.0
    } else {
        n - max(od1.0 + ev2.0, od2.0 + ev1.0)
    }
}

fn main() {
    let _n = parse_line!(usize);
    let vs = parse_vec!(usize);

    println!("{}", solve(vs));
}

#[test]
fn solve_test() {
    assert_eq!(solve(vec![3,1,3,2]), 1);
    assert_eq!(solve(vec![105, 119,105,119,105,119]), 0);
    assert_eq!(solve(vec![1,1,1,1]), 2);
}


Measured memory_bytes: 7932
N=int(input())
a=[int(i) for i in input().split()]
S=sum(a)
if S%(N*(N+1)//2)==0:
  k=S//(N*(N+1)//2)
else:
  print("NO")
  exit()
D=[]
a.append(a[0])
for i in range(N):
  D.append(a[i+1]-a[i]-k)

for d in D:
  if d>0 or d%N!=0:
    print("NO")
    exit()
    
print("YES")
    
  


Measured memory_bytes: 63472
a, b, x = map(int, input().split())

import math
if x <= ((a ** 2) * b) / 2:
    n = 2 * x / (a * b)
    ans = math.acos(n / (math.sqrt(b ** 2 + n ** 2)))
else:
    n = 2 * b - (2 * x / (a ** 2))
    ans = math.acos(a / math.sqrt(a ** 2 + n ** 2))

print(math.degrees(ans))

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

int main(){
  int n;
  cin>>n;
  int dig;
  int i=0;
  while(n>0){
    dig=n%10;
    n/=10;
    i++;
    if(dig==7){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}

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

#define all(s) s.begin(), s.end()
#define pb push_back
#define ii pair<int, int>
#define x first
#define y second
#define bit(x, y) ((x >> y) & 1)

vector<int> a, b;

int main() {
    ios::sync_with_stdio(false); cin.tie(0); 
    cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int u, v;
        cin >> u >> v;
        a.pb(u + v);
        b.pb(u - v);
    }
    sort(all(a));
    sort(all(b));
    cout << max(a.back() - a[0], b.back() - b[0]);
    return 0;
}

Measured memory_bytes: 5116
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(0); 
    cin.tie(0);   
	ll n,a[200009],dp[200009],m,k,ans=0,fl=0;
	string s;
	cin>>n>>k;
	for(int i=0;i<n;i++)
		cin>>a[i];
	dp[0]=0;
	if(n>1)
		dp[1]=abs(a[0]-a[1]);
	for(int i=2;i<n;i++)
	{
		m=max(ll(0),i-k);
		ll mi=1000000000000000;
		// cout<<m<<" ";
		while(m<i)
		{
			mi=min(dp[m]+abs(a[m]-a[i]),mi);
			m++;
		}
		dp[i]=mi;
		// cout<<dp[i]<<" ";
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 5100
S = input()
anslist = [0]*len(S)
c = 0
d = 0
for i in range(len(S)):
    if S[i] == "R":
        c += 1
    else:
        d += 1
        if i == len(S)-1 or S[i+1] == "R":
            if c%2 == 0:
                anslist[i-d] = c/2
                anslist[i-d+1] = c/2
            else:
                anslist[i-d] = (c+1)/2
                anslist[i-d+1] = (c-1)/2
            if d%2 == 0:
                anslist[i-d] += d/2
                anslist[i-d+1] += d/2
            else:
                anslist[i-d] += (d-1)/2
                anslist[i-d+1] += (d+1)/2
            c = 0
            d = 0
for i in range(len(S)):
    print(int(anslist[i]), end=" ")

Measured memory_bytes: 7152
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt(), q = in.nextInt();
			DisjointSet set = new DisjointSet(n);
			for (int i = 0; i < q; i++) {
				int com = in.nextInt(), x = in.nextInt(), y = in.nextInt();
				if (com == 0) {
					set.unite(x, y);
				} else {
					out.println(set.same(x, y) ? 1 : 0);
				}
			}

		}
	}

	static class DisjointSet {

		int[] p, rank;

		public DisjointSet(int size) {
			p = new int[size];
			rank = new int[size];

			for (int j = 0; j < size; j++) {
				makeSet(j);
			}
		}

		private void makeSet(int x) {
			p[x] = x;
			rank[x] = 0;
		}

		public int findSet(int x) {
			return p[x] == x ? x : findSet(p[x]);
		}

		public void link(int x, int y) {
			if (rank[x] > rank[y]) {
				p[y] = x;
			} else if (rank[x] < rank[y]) {
				p[x] = y;
			} else if (rank[x] == rank[y]) {
				p[x] = y;
				rank[y]++;
			}
		}

		public void unite(int x, int y) {
			link(findSet(x), findSet(y));
		}

		public boolean same(int x, int y) {
			return findSet(x) == findSet(y);
		}




	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}



Measured memory_bytes: 58380
n = int(input())
A = list(map(int, input().split()))
from fractions import gcd
def lcm(a, b):
  return a * b // gcd(a, b)
temp = A[0]
for i in range(n-1):
  temp = lcm(A[i+1], temp)

max_mod = sum([(temp-1) % num for num in A])
print(max_mod)

Measured memory_bytes: 66664
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;

int main() {
    string s;
    cin >> s;
    int n = s.size()-1;
    auto judge = [](string s) {
        int ns = s.size();
        if(ns%2 != 0) return false;
        string as = s.substr(0,ns/2);
        string bs = s.substr(ns/2);
        return as == bs;
    };
    while(true) {
        s = s.substr(0,n);
        if(judge(s)) break;
        n--;
    }
    cout << n << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,q1[N],q2[N];
struct seg{ int id,l,r; }S[N];

bool cmp1(int a,int b) { return S[a].r<S[b].r; }
bool cmp2(int a,int b) { return S[a].l>S[b].l; }

long long go(long long &lst,int id) {
	long long ret=0;
	if (abs(S[id].l-lst)<abs(S[id].r-lst)) ret=abs(S[id].l-lst),lst=S[id].l;
	else ret=abs(S[id].r-lst),lst=S[id].r;
	return ret;
}

bool vis[N];
long long solve(int k) {
	long long ans=0,lst=0;
	int t1=1,t2=1;
	memset(vis,0,sizeof(vis));
	while (t1<=n || t2<=n) {
		if (k==1) {
			while (t1<=n && vis[q1[t1]]) t1++;
			if (t1<=n && !(S[q1[t1]].l<=lst && lst<=S[q1[t1]].r)) ans+=go(lst,q1[t1]);
			vis[q1[t1]]=1;
		} else {
			while (t2<=n && vis[q2[t2]]) t2++;
			if (t2<=n && !(S[q2[t2]].l<=lst && lst<=S[q2[t2]].r)) ans+=go(lst,q2[t2]);
			vis[q2[t2]]=1;
		}
		k=3-k;
	}
	ans+=abs(lst);
	return ans;	
}

int main()
{
	cin>>n;
	for (int i=1;i<=n;i++) {
		int x,y; scanf("%d%d",&x,&y);
		S[i]=(seg){i,x,y};
		q1[i]=i; q2[i]=i;
	}
	sort(q1+1,q1+n+1,cmp1);
	sort(q2+1,q2+n+1,cmp2);
	long long ans=0;
	ans=max(ans,solve(1));
	ans=max(ans,solve(2));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
#define ll long long
#define dbg1(x) cerr<<#x<<"="<<(x)<<" "
#define dbg2(x) cerr<<#x<<"="<<(x)<<"\n"
#define dbg3(x) cerr<<#x<<"\n"
using namespace std;
#define se second
#define fi first
#define reg register
#define mp make_pair
inline ll read()
{
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
const int MN=1e5+5;
ll N,D[MN],siz[MN],fa[MN];
struct edge{int to,nex;}e[MN<<1];int hr[MN],en;
void ins(int x,int y){e[++en]=(edge){y,hr[x]};hr[x]=en;}
pair<ll,int> a[MN];
ll dfs(int x)
{
	reg int i;ll r=0;
	for(i=hr[x];i;i=e[i].nex) r+=dfs(e[i].to)+siz[e[i].to];
	return r;
}
int main()
{
	N=read();reg int i,j;
	for(i=1;i<=N;++i) D[i]=read(),a[i]=mp(D[i],i);
	std::sort(a+1,a+N+1);
	for(i=N;i>1;--i)
	{
		int x=a[i].se;
		++siz[x];
		int pos=lower_bound(a+1,a+N+1,mp(D[x]+2*siz[x]-N,0))-a;
		if(pos>=i||D[x]+2*siz[x]-N!=a[pos].fi) return 0*puts("-1");
		fa[x]=a[pos].se;siz[fa[x]]+=siz[x];ins(fa[x],x);
	}
	++siz[a[1].se];
	if(dfs(a[1].se)!=D[a[1].se]) return 0*puts("-1");
	for(i=1;i<=N;++i)for(j=hr[i];j;j=e[j].nex)printf("%d %d\n",i,e[j].to);
	return 0;
}

Measured memory_bytes: 8832
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;
const LL m = 1e9+7;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

vector<LL> pr;
LL phi[MAXN];

LL po(LL a, LL n){
	if(n==0) return 1;
	LL an = po(a,n/2);
	an = (an*an)%m;
	if(n&1) an = (an*a)%m;
	return an;
}

int main(){
  fio();
  LL n,k; cin>>n>>k;
  phi[1] = 1;
  for(LL i=2; i<=k; i++){
  	if(phi[i]==0){
  		pr.pb(i);
  		phi[i] = i-1;
  	}
  	for(auto p:pr){
  		if(i*p>k) break;
  		if(i%p==0){
  			phi[i*p] = p*phi[i];
  		}
  		else{
  			phi[i*p] = phi[i]*phi[p];
  		}
  	}
  }
  LL an = 0;
  for(LL i = 1; i<=k; i++){
  	an = (an + po(k/i,n)*phi[i]%m)%m;
  }
  cout<<an<<endl;
  return 0;
}

Measured memory_bytes: 4500
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  string s;
  cin>>s;
  bool mae=false,usiro=false;
  if(s[0]=='0'&&s[1]!='0' ||s[0]=='1' &&s[1]<'3') mae=true;
  else mae=false;
  if(s[2]=='0'&&s[3]!='0' ||s[2]=='1' && s[3]<'3') usiro=true;
  else usiro=false;
  if(mae&&usiro) cout<<"AMBIGUOUS"<<endl;
  else if(mae&&!usiro) cout<<"MMYY"<<endl;
  else if(!mae&&usiro) cout<<"YYMM"<<endl;
  else cout<<"NA"<<endl;
}

Measured memory_bytes: 256
use std::io;
use std::str::FromStr;
use std::collections::HashSet;

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn input_char_vec() -> Vec<char> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().chars().collect()
}

fn main() {
    let (h, w) = input_tuple();
    let mut grid: Vec<Vec<char>> = Vec::new();
    for _ in 0..h {
        let row = input_char_vec();
        grid.push(row);
    }

    for i in 0..h as usize {
        for j in 0..w as usize {
            if grid[i][j] == '#' {
                let mut flag = false;
                if i > 0 && grid[i-1][j] == '#' {
                    flag = true;
                }
                if i < h as usize - 1 && grid[i+1][j] == '#' {
                    flag = true;
                }
                if j > 0 && grid[i][j - 1] == '#' {
                    flag = true;
                }
                if j < w as usize - 1 && grid[i][j + 1] == '#' {
                    flag = true;
                }
                if !flag {
                    println!("No");
                    return;
                }
            }
        }
    }
    println!("Yes");
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  string s;
  cin >> s;
  int n = s.size();
  int ans = 0;
  rep(i, n) ans += s[i] == '+' ? 1 : -1;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[100010];
struct s{
	int num;
	int count;
}b[100010];
int main(){
	int i,n,j=1,sum=0;
	cin>>n;
	for(i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+n+1);
	memset(b,0,sizeof(b));
	i=2;
	b[1].count=1;
	while(i<=n){
	  if(a[i]==a[i-1])
			b[j].count++;
	  else{
	  	j++;
	  	b[j].count=1;}
	  i++;
	}
	for(i=1;i<=j;i++)
	  sum=sum+b[i].count%2;
	cout<<sum;
	return 0;
} 

Measured memory_bytes: 1408
#include <iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;

int main(){
  long a,v,b,w,t;
  cin >> a >> v >> b >> w >> t;
  
  if(a<b){
    if((b-a) <= (v-w)*t){
      cout << "YES";
    }
    else{cout << "NO";}
  }
  else if(a>b){
    if((a-b) <= (v-w)*t){
      cout << "YES";
    }
    else{cout << "NO";}
  }
  
  return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
const ll MOD = 998244353;
ll modex(ll a, ll p, ll m = MOD) {
	if (!p) return 1;
	if (p & 1) return a * modex(a, p - 1, m) % m;
	ll v = modex(a, p >> 1, m);
	return v * v % m;
}
void sub(ll& x, ll y) {
	x -= y;
	if (x < 0) x += MOD;
}
int main() {
	int n;
	scanf("%d", &n);
	const int MX = 1e6;
	vector<ll> num(MX + 1), sum(MX + 1), sumsq(MX + 1), F(MX + 1);
	for (int i = 0; i < n; ++i) {
		int a;
		scanf("%d", &a);
		++num[a];
	}
	for (int d = 1; d <= MX; ++d) {
		for (int x = d; x <= MX; x += d) {
			sum[d] += num[x] * x;
			sumsq[d] += num[x] * x * x;
		}
		sum[d] %= MOD;
		sumsq[d] %= MOD;
	}
	ll inv2 = (MOD + 1) >> 1;
	ll ans = 0;
	for (int i = MX; i >= 1; --i) {
		F[i] = (sum[i] * sum[i] - sumsq[i]) % MOD * inv2 % MOD;
		for (int j = i + i; j <= MX; j += i)
			sub(F[i], F[j]);
		ans = (ans + F[i] * modex(i, MOD - 2)) % MOD;
	}
	printf("%lld\n", ans);
}


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

using namespace std;

int main()
{
    string a,b;
    cin>>a>>b;
    int c=0;
    for(int i=0; i<b.size()-1; i++)
    {
        if(a[i]!=b[i])
            c++;
    }
    if(c==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3628
list = list(map(int,input().split(" ")))

X = []
cnt = 0
for i in range(1, 1 + int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    X.append(i)
    cnt = 1
X.sort(reverse=True)
if (cnt == 1):
  print(X[list[2]-1])
else:
  print(1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    char a;
    cin >> a;
    if(int(a)<=int('Z')){
        cout<<"A"<<endl;
    }else{
        cout<<"a"<<endl;
    }

  return 0;
}

Measured memory_bytes: 3620
N = gets.to_i
a = gets.split.map(&:to_i)
l = a[0]
for i in 0..N-1 do
  l = l.lcm(a[i])
end
ans = 0
for i in 0..N-1 do
  ans += l/a[i]
end
print(ans%1000000007)

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri(), q = ri();
	int a[n];
	for (auto &i : a) i = ri();
	std::sort(a, a + n);
	for (int i = 0; i < q; i++) {
		int l = ri(), r = ri();
		std::cout << std::upper_bound(a, a + n, r) - std::lower_bound(a, a + n, l) << std::endl;
	}
	return 0;
}





Measured memory_bytes: 3616
#include <iostream>
using namespace std;
int gcd(int a,int b){
  if(b == 0) return a*a;
  return gcd(b,a%b);
}
int main(){
  int w,h,c;
  cin >>w>>h>>c;
  cout <<w*h/gcd(w,h)*c<<endl;
  return 0;
}

Measured memory_bytes: 3052
#include <iostream>
using namespace std;
const int INF=1e9;
int n, h, a[1002], b[1002], F[10002];
int main() 
{
    cin>>h>>n;
    for(int i=0;i<n;i++)	cin>>a[i]>>b[i];
    for(int i=0;i<=h;i++)	F[i]=INF;
    for(int i=0;i<=h;i++)
    	for(int j=0;j<n;j++)
        	if (a[j]>=i)	F[i]=min(F[i],b[j]);
        	else F[i]=min(F[i],F[i-a[j]]+b[j]);
    cout<<F[h];
    return 0;
}

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


long long int gcd(long long int x, long long int y)
{
	long long int r;

	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}

long long int calcLCM(long long int x, long long int y)
{
	return (x / gcd(x, y) * y);
}

int main()
{
	int i;
	long long int buff;
	long long int lcm = 1;

	scanf("%d", &i);

	for (int j = 0; j < i; j++) {
		scanf("%lld", &buff);
		if (lcm % buff == 0) {
			continue;
		}
		lcm = calcLCM(lcm, buff);
	}

	printf("%lld", lcm);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)

void solve(){
    ll n, s;
    cin>>n>>s;
    ll a[n];
    loop(i,0,n){
        cin>>a[i];
    }

    ll dp[n][s+1];
    loop(i,0,n) loop(j,0,s+1) dp[i][j] = 0;
    loop(i,0,n) dp[i][0] = ((i+1)*(i+2))/2;
    dp[0][a[0]] = 1;
    for(ll i=1; i<n; i++){
        for(ll j=1; j<s+1; j++){
            dp[i][j] = 2*dp[i-1][j];
            if(i >= 2) dp[i][j] = (dp[i][j] - dp[i-2][j] + mod1)%mod1;
            if(j >= a[i]){
                dp[i][j] = (dp[i][j] + dp[i-1][j-a[i]])%mod1;
                if(i >= 2) dp[i][j] = (dp[i][j] - dp[i-2][j-a[i]] + mod1)%mod1;
            }
            if(j == a[i]) dp[i][j] = (dp[i][j] + 1)%mod1;
        }
    }
    // loop(i,0,n){
    //     loop(j,0,s+1){
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    print(dp[n-1][s]);
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }

}


Measured memory_bytes: 70656
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
	int A, B;
	vector<int> v(3);

	cin >> A >> B;

	v[0] = A + B;
	v[1] = A - B;
	v[2] = A * B;
	
	sort(v.begin(), v.end(), greater<int>());

	cout << v[0] << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun solve() {
    val N = rd.readInt()
    val A = rd.readIntArray()
    val diff = ArrayList<Int>()

    for (i in 0 until N-1) {
        if (A[i] < A[i+1]) diff.add(1)
        else if (A[i] > A[i+1]) diff.add(-1)
    }

    var cnt = 0
    var i = 0
    while (i < diff.size-1) {
        if (diff[i]*diff[i+1] < 0) {
            cnt++
            i+=2
        } else {
            i++
        }
    }

    val ans = cnt + 1
    println(ans)
}


//val rd = debug.Reader("agc", "013", "a", "sample-1")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!! }
    catch (e: Exception) { throw e }
    finally { rd.close() }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int)
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
    val readListIntCol: (Int) -> List<Int> = { N -> (0 until N).map { readInt() } }
    val readListIntCols: (Int) -> List<List<Int>> = { N -> (0 until N).map { br.readLine().split(' ').map { it.toInt() } } }
    val readListLongCol: (Int) -> List<Long> = { N -> (0 until N).map { readLong() } }
    val readListLongCols: (Int) -> List<List<Long>> = { N -> (0 until N).map { br.readLine().split(' ').map { it.toLong() } } }
    val close: () -> Unit = { br.close() }
    protected fun finalize() { close() }
}


Measured memory_bytes: 52968
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner s = new Scanner(System.in);
		String Base = s.next();
		if (Base.equals("A")){
			System.out.println("T");
		}
		else if (Base.equals("T")){
			System.out.println("A");
		}
		else if (Base.equals("G")){
			System.out.println("C");
		}
		else System.out.println("G");
	}
}


Measured memory_bytes: 21716