akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int a[101][101],x,y,i,j;
char s[101][101];
int main()
{
	cin>>x>>y;
	for (i=0;i<x;i++)
	  cin>>s[i];
	for (i=0;i<x;i++)
	  for (j=0;j<y;j++)
	    if (s[i][j]=='#')
	    {
	    	a[i][j]++;
	    	a[i][j+1]++;
	    	a[i][j+2]++;
	    	a[i+1][j]++;
	    	a[i+1][j+1]++;
	    	a[i+1][j+2]++;
	    	a[i+2][j]++;
	    	a[i+2][j+1]++;
	    	a[i+2][j+2]++;
		}
	for (i=0;i<x;i++)
	{
		for (j=0;j<y;j++)
	      if (s[i][j]=='#') cout<<'#';
		  else cout<<a[i+1][j+1];
		cout<<endl;
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
 
  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      Map<Integer, Integer> map = new HashMap<>();
      long sum = 0;
      for(int i = 0; i < n; i++) {
        int num = sc.nextInt();
        sum += num;
        map.put(num, map.getOrDefault(num, 0) + 1);
      }
      int q = sc.nextInt();
      for(int i = 0; i < q; i++) {
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(!map.containsKey(b)) {
          System.out.println(sum);
          continue;
        }
        int freq = map.get(b);
        map.remove(b);
        map.put(c, map.getOrDefault(c, 0) + freq);
        sum = sum + freq * (long)(c - b);
        System.out.println(sum);
      }
      
  }
}

Measured memory_bytes: 66084
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    FastScanner in;
    PrintWriter out;

    public static void main(String[] args) {
        new Main().run();
    }

    void solve() {
        int N = in.nextInt();
        int limit = (int)Math.sqrt(N) + 1;
        for (int i = limit ; i >= 0;i--) {
            if (i * i <= N) {
                out.println(i * i);
                break;
            }
        }
    }



    void run() {
        in = new FastScanner();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                }
            }
            return st.nextToken();
        }

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

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

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

}

Measured memory_bytes: 23124
#include <stdio.h>

int main(void){
    char w[101];
    int count[26]={0};
    scanf("%s",w);
    int i;
    for(i=0; w[i] != '\0'; i++){
        count[w[i]-'a']++;
        /*countの0にa、1にb、2にc、3にd...*/
    }for(i=0; i<26; i++){
        if(count[i]%2 == 1){
            printf("No\n");
            return 0;
        }
    }printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n;
    cin >> n;
    int a = s.size();
    if(s.size()%n!=0)
        a++;
    int i = 0;
    while(i<a){
        cout << s[i];
        i += n;
    }
    return 0;
}

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

int main(void){
	int i,j,k,n,max=0;
	char s[101];
	int c['z'-'a'+1];

	scanf("%d",&n);
	scanf("%s",&s);

	for(i=1;i<n;i++){
		for(j=0;j<='z'-'a';j++){
			c[j]=0;
		}
		for(j=0;j<i;j++){
			for(k=i;k<n;k++){
				if(s[j]==s[k]){
					c[s[j]-'a']=1;
					break;
				}
			}
		}
		k=0;
		for(j=0;j<='z'-'a';j++){
			k+=c[j];
		}
		max=max>k?max:k;
	}

	printf("%d",max);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define Maxn 18
#define modp1 998244353
#define modp2 100000007
using namespace std;
int n,m,cnt = 0;
map<pair<int,int>,int> mp;
char s[Maxn][Maxn],s1[Maxn][Maxn];
int ch[Maxn];
bool vis[Maxn];
bool ans=false;
void calc()
{
    for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
            s1[i][j]=s[i][j];
    for (int i=1;i<=(n+1)/2;i++)
        if (ch[i]!=0&&ch[i]<=n)
        {
            for (int j=1;j<=m;j++)
                swap(s1[i][j],s1[ch[i]][j]);
        }
    int cnt=0;
    mp.clear();
    for (int i=1;i<=m;i++)
    {
        int now1=0,now2=0;
        for (int j=1;j<=n;j++)
        {
            now1=(29LL*now1+s1[j][i]-'a'+1)%modp1;
            now2=(29LL*now2+s1[j][i]-'a'+1)%modp2;
        }
        if (mp[make_pair(now1,now2)])
        {
            --cnt;
            --mp[make_pair(now1,now2)];
        } else
        {
            ++cnt;
            now1=0,now2=0;
            for (int j=n;j;j--)
            {
                now1=(29LL*now1+s1[j][i]-'a'+1)%modp1;
                now2=(29LL*now2+s1[j][i]-'a'+1)%modp2;
            }
            ++mp[make_pair(now1,now2)];
        }
    }
    if (cnt<=1) ans=true;
}
void dfs(int x)
{
    if (ans) return;
    if (x<=(n+1)/2)
    {
        for (int i=x+1;i<=2*((n+1)/2)&&(!ans);i++)
           // if (!vis[i])
            {
                ch[x]=i;
                ch[i]=x;
                dfs(x+1);
                ch[i]=0;
            }
    }
    else{ 
/*        if(++cnt == 1)
{        for(int i = 1; i <= n; i++){
                    cout << ch[i] << " ";
                }
                cout << endl;
        }*/        calc();
    }
}
int main()
{

    scanf("%d%d",&n,&m);
    for (int i=1;i<=n;i++)
        scanf("%s",s[i]+1);
    memset(vis,false,sizeof(vis));
    dfs(1);
    if (ans) printf("YES\n"); else printf("NO\n");
    return 0;
}

Measured memory_bytes: 256
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         long N = Long.parseLong(infile.readLine());
         long bruh = 100;
         int res = 0;
         while(bruh < N)
         {
            bruh += bruh/100;
            res++;
         }
         System.out.println(res);
      }
   }

Measured memory_bytes: 32688
import collections
n=int(input())
S=[input() for i in range(n)]
C=[]
CT=[]
ans=""
ABC="abcdefghijklmnopqrstuvwxyz"
for s in S:
  C.append(collections.Counter(s))
for x in ABC:
  count=C[0][x]
  for i in range(1,n):
    count=min(count,C[i][x])
  CT.append(count)
for i in range(26):
  ans+=ABC[i]*CT[i]
print(ans)

Measured memory_bytes: 3316
from collections import defaultdict as dd

# お約束
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
    return int(n) - 1
def parse(*args):
    return tuple(p(v) for p, v in zip(args, input().split()))

# エントリーポイント
def main():
    S = input()
    c = [0, 0]
    for s in S:
        c[s == "1"] += 1
    print((len(S) - abs(c[0] - c[1])))

main()


Measured memory_bytes: 3484
/* winners never quit and quitters never win.
      #swap                                 */
      
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;
const ld PI = 3.141592653589793;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

template <typename T>
void make_unique(vector<T>& vec) {
  sort(all(vec));
  vec.erase(unique(all(vec)), vec.end());
}

#define endl '\n'
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


ll nxt() {
    ll TemporaryVariable;
    cin >> TemporaryVariable;
    return TemporaryVariable;
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    ll n=nxt();
    vc<ll> v(n);
    generate(all(v),nxt);
    ll ans=0;
    rep(a,1,n)
    {
        if(v[a]<v[a-1])
        {
            ans+=v[a-1]-v[a];
            v[a]=v[a-1];
        }
    }
    cout<<ans<<endl;
	printclock;
	return 0;
}

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

int main(){
  int n, t;
  cin >> n;
  double a;
  cin >> t >> a;

  int ans;
  double ansn = 0;

  int h[1010];

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

  ans = 0;
  ansn = abs(a-(t-h[0]*0.006));

  for(int i = 1;i < n;i++){
    if(ansn > abs(a-(t-h[i]*0.006))){
      ans = i;
      ansn = abs(a-(t-h[i]*0.006));
    }
  }

  cout << ans+1 << endl;

  return 0;
}




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

const long long MOD = 998244353;

class Math {
public:
    Math(int N = 0, long long mod = 1e9 + 7)
        : N_(N)
        , mod_(mod)
    {
    }

    long long pow(long long x, long long y)
    {
        ll ans = 1;
        while (y > 0) {
            if (y & 0x1) {
                ans = (ans * x) % mod_;
            }
            x = (x * x) % mod_;
            y >>= 1;
        }
        return ans;
    }

    long long combination(long long n, long long k)
    {
        if (k < 0 || k > n) {
            return 0;
        }
        if (fact_.empty()) {
            build_fact();
        }
        return fact_[n] * (fact_inv_[k] * fact_inv_[n - k] % mod_) % mod_;
    }

    static long long powm(long long x, long long y, long long mod = 1e9 + 7)
    {
        ll ans = 1;
        while (y > 0) {
            if (y & 0x1) {
                ans = (ans * x) % mod;
            }
            x = (x * x) % mod;
            y >>= 1;
        }
        return ans;
    }

private:
    void build_fact()
    {
        if (!fact_.empty()) {
            return;
        }
        fact_.resize(N_ + 1);
        fact_[0] = 1;
        for (ll i = 1; i <= N_; i++) {
            fact_[i] = fact_[i-1] * i % mod_;
        }
        fact_inv_.resize(N_ + 1);
        fact_inv_[N_] = pow(fact_[N_], mod_ - 2);
        for (ll i = N_ - 1; i >= 0; i--) {
            fact_inv_[i] = fact_inv_[i + 1] * (i + 1) % mod_;
        }
    }

    int N_;
    long long mod_;
    vector<long long> fact_;
    vector<long long> fact_inv_;
};

void solve(long long N, long long M, long long K)
{
    Math m(N, MOD);
    ll ans = 0;
    for (ll i = 0; i <= K; i++) {
        ll val = M * m.pow(M - 1, N - i - 1);
        val %= MOD;
        val *= m.combination(N - 1, i);
        val %= MOD;
        ans += val;
        ans %= MOD;
    }
    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    long long K;
    scanf("%lld", &K);
    solve(N, M, K);
    return 0;
}


Measured memory_bytes: 6348
def read_input(trans=int):
    return list(map(trans, input().split()))


X, Y = read_input()

k = (Y-2*X)/2
t = (4*X-Y)/2

if (k-int(k) != 0) or (t-int(t) != 0) or ((0 <= k <= X) == False) or ((0 <= t <= X) == False):
    print("No")
else:
    print("Yes")


Measured memory_bytes: 9184
chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
n = int(input())
seq = [97 for i in range(n)]
i = n - 1
print('a' * n)
while i > 0:
    if seq[i] <= max(seq[:i]):
        seq[i] += 1
        i = n - 1
        print(''.join(map(chr, seq)))
    else:
        seq[i] = 97
        i -= 1


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

int main() {
  string s, t;
  cin >> s >> t;
  if (s == t.substr(0, s.size())) {
	cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

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

  int A(a.length()), B(b.length()), C(c.length());
  int ia(0), ib(0), ic(0);
  a += ".";
  b += ".";
  c += ".";

  char t = 'a';
  while (ia <= A && ib <= B && ic <= C) {
    if (t == 'a') {
      t = a[ia++];
    } else if (t == 'b') {
      t = b[ib++];
    } else if (t == 'c') {
      t = c[ic++];
    }
  }

  char ans;
  if (ia > A) ans = 'A';
  if (ib > B) ans = 'B';
  if (ic > C) ans = 'C';
  cout << ans << endl;
}


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

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

using namespace std;

using ll = long long;

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

    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) {
        cin >> A[i];
    }

    unordered_map<int, int> cnt;
    REP(i, N) {
        ++cnt[A[i] - i];
    }

    ll result = 0;
    REP(i, N) {
        --cnt[A[i] - i];
        result += cnt[-(A[i] + i)];
    }

    cout << result << endl;

    return 0;
}


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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl

typedef pair<int, int> P;
typedef long long ll;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin>>n>>k;
    vector<ll> h(n);
    REP(i,n) cin>>h[i];
    vector<ll> dp(n);
    REP(i,n){
        dp[i] = linf;
        dp[0] = 0;
    }
    REP(i,n){
        FOR(j,1,k+1){
            if(i+j<=n-1){
                dp[i+j] = min(dp[i]+abs(h[i+j]-h[i]), dp[i+j]);
            }
            else continue;
        }
    }
    print(dp[n-1]); 
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
const int MAX_V = 50;
const int MAX_S = MAX_V*50+5;
const ll INF = 1e18;
 
struct Edge {
  int to, a, b;
  Edge(int to, int a, int b):to(to),a(a),b(b) {}
};
 
struct Data {
  int v, s;
  ll x;
  Data(int v, int s, ll x):v(v),s(s),x(x) {}
  bool operator<(const Data& a) const {
    return x > a.x;
  }
};
 
vector<Edge> g[MAX_V];
ll dist[MAX_V][MAX_S+5];
 
int main() {
  int n, m, s;
  cin >> n >> m >> s;
  rep(i,m) {
    int u,v,a,b;
    cin >> u >> v >> a >> b;
    --u; --v;
    g[u].emplace_back(v,a,b);
    g[v].emplace_back(u,a,b);
  }
  rep(i,n)rep(j,MAX_S+5) dist[i][j] = INF;
  s = min(s, MAX_S);
  priority_queue<Data> q;
  auto push = [&](int v, int s, ll x) {
    if (s < 0) return;
    if (dist[v][s] <= x) return;
    dist[v][s] = x;
    q.emplace(v,s,x);
  };
  vector<int> c(n), d(n);
  rep(i,n) cin >> c[i] >> d[i];
  push(0,s,0);
  while (!q.empty()) {
    Data hoge = q.top(); q.pop();
    int v = hoge.v, s = hoge.s;
    ll x = hoge.x;
   // if (dist[v][s] != x) continue;
    {
      int ns = min(s+c[v], MAX_S);
      push(v,ns,x+d[v]);
    }
    for (Edge e : g[v]) {
      push(e.to, s-e.a, x+e.b);
    }
  }
  for (int i = 1; i < n; ++i) {
    ll ans = INF;
    rep(j,MAX_S+5) {
      ans = min(ans, dist[i][j]);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 6256
#include <iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int gcd(int a,int b){
    if (a < b){
        return gcd(b,a);
    }
    else if (a>=b && a%b!=0) {
        return gcd(a%b,b);
    }
    else{
        return b;
    }
}
int main(){
       long int a, b;
       cin >> a >> b;
       cout << gcd(a,b) << endl;
       return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>
//vishu
 int main(void){
 int a, b, c;

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

 int ispoor = 0;
 if (a == b && b != c) ispoor = 1;
 if (b == c && c != a) ispoor = 1;
 if (c == a && a != b) ispoor = 1;

 if (ispoor) {
 puts("Yes");
 } else {
 puts("No");
 }

 return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include <vector>
#include<string.h>
#include<cmath>
using namespace std;


int main(){
   int a,b;
   cin>>a>>b;
    if(a*b==3)
      cout<< 2 <<endl;
    else if(a*b==6)
       cout<< 1 <<endl;
    else
      cout<< 3 <<endl; 
   return 0;
}

Measured memory_bytes: 256
//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define INF 2000000000
#define inf 10000000000000000ll
#define ldb long double
#define pb push_back
#define get(x) x=read()
#define gt(x) scanf("%d",&x)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define gc(a) scanf("%s",a+1)
#define rep(p,n,i) for(RE ll i=p;i<=n;++i)
#define go(x) for(ll i=lin[x],tn=ver[i];i;tn=ver[i=nex[i]])
#define fep(n,p,i) for(RE ll i=n;i>=p;--i)
#define pii pair<ll,ll> 
#define mk make_pair
#define RE register
#define P 1000000007
#define S second
#define gf(x) scanf("%lf",&x)
#define pf(x) ((x)*(x))
#define ull unsigned long long
#define S second
#define F first
#define l(p) t[p].l
#define r(p) t[p].r
#define sum(p) t[p].sum
#define tag(p) t[p].tag
#define zz p<<1
#define yy p<<1|1
#define mod 1000000007
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline ll read()
{
    RE ll x=0,f=1;char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
    return x*f;
}
const ll MAXN=100010;
ll n,k,ans;
ll f[MAXN],c[MAXN];
inline ll ksm(ll b,ll p)
{
	ll cnt=1;
	while(p)
	{
		if(p&1)cnt=cnt*b%mod;
		p=p>>1;b=b*b%mod;
	}
	return cnt;
}
signed main()
{
	//freopen("1.in","r",stdin);
	get(n);get(k);
	fep(k,1,i)
	{
		ll ww=k/i;
		f[i]=ksm(ww,n);
		for(int j=i+i;j<=k;j+=i)f[i]=(f[i]-f[j])%mod;
		ans=(ans+f[i]*i)%mod;
	}
	putl((ans+mod)%mod);
	return 0;
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	int c[10001]={};//for count
	int x;
	for(int i=0;i<n;i++){
		cin>>x;
		c[x]++;
	}
	bool start = false;
	for(int i=0;i<10001;i++){
		for(int j=0;j<c[i];j++){
			if(start == false){
				start = true;
			}else{
				cout<<" ";
			}
			cout<<i;
		}
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1248
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

//シミュレートして，その局面ごとの最善手をうち続ければいい。
//（未完）

int main(void){
	int N,current=0;
	cin>>N;
	string S,t;
	cin>>S;
	string ans=S;
	rep(i,N){
		t = S[i];
		if(t==")"){
			current--;
			if(current==-1){
				current=0;
				ans="("+ans;
			}
		}
		if(t=="("){
			current++;
		}
		if(i==N-1){
			rep(j,current)ans=ans+")";
		}
	}

	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
string S;
int main(){
	cin>>S;


	for(int i=0;i<19;i++){
		if(S[i]==','){
			cout<<" ";
		}else{
			cout<<S[i];
		}
	}
	cout<<endl;


	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j,k,max=0;
  char s[1000001];
  scanf("%s",s);
  for(i=1;s[i];i++){
    if(s[i]=='O'&&s[i-1]=='J'){
      for(j=0;s[i+j]=='O';j++);//printf("%d ",j);
      for(k=0;k<j;k++){//printf("%c %c\n",s[i-k-1],s[i+j+k]);
	if(i-1-k<0)break;
	if(s[i-k-1]!='J'||s[i+j+k]!='I')break;
      }//printf("%d\n",k);
      if(j==k&&max<j)max=j;
    }
  }
  printf("%d\n",max);
  return 0;
}
	
  

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



min_H = min(H)
H = [h - min_H for h in H]
count_water = min_H
# print(H)

def water(L):
    # print(L)
    c = 0
    if L == []:
        return 0
    elif len(L) <= 2:
        # print("case 1", max(L))
        return max(L)
    else:
        min_L = min(L)
        c += min_L
        L = [l - min_L for l in L]
        zero_ind = -1
        for (i,l) in enumerate(L):
            if l == 0:
                c += water(L[zero_ind+1:i])
                zero_ind = i
        if L[-1] != 0:
            c += water(L[zero_ind+1:])
        return c

count_water += water(H)
print(count_water)

Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const int MOD = 1e9 + 7;






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

	ll ans = 0;

	for (int bit = 0; bit < (1 << n); bit++) {
		ll sum = s[0] - '0';

		for (int i = 0; i < n; i++) {
			if (bit & (1 << i)) {
				ans += sum;
				sum = 0;
			}
			sum = sum * 10 + (s[i + 1]-'0');
		}
		ans += sum;
	}
	cout << ans << endl;
	
	
	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> dp(3);
    for(int i = 0; i < n; i++){
        int a, b, c;
        cin >> a >> b >> c;
        int aa = max(dp[1], dp[2]) + a;
        int bb = max(dp[0], dp[2]) + b;
        int cc = max(dp[0], dp[1]) + c;
        dp = {aa, bb, cc};
    }
    cout << *max_element(dp.begin(), dp.end()) << '\n';
}


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

const string digits[10] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
const string digits_string("0123456789");

int K;
vector<string> valid_numbers;

void generate_number(int length, string current, bool start) {

  if(current.length() == length) {
    valid_numbers.push_back(current);
    return;
  }

  if(start) {
    for(int i = 1; i < 10; i++) {
      generate_number(length, current + digits[i], false);
    }
    return;
  }

  int last_digit = current[current.length() - 1];

  if(last_digit == '0') {
    generate_number(length, current + '0', false);
    generate_number(length, current + '1', false);
    return;
  }
  if(last_digit == '9') {
    generate_number(length, current + '8', false);
    generate_number(length, current + '9', false);
    return;
  }

  generate_number(length, current + digits[digits_string.find(last_digit) - 1], false);
  generate_number(length, current + digits[digits_string.find(last_digit)], false);
  generate_number(length, current + digits[digits_string.find(last_digit) + 1], false);  
}

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

  cin >> K;

  for(int length = 1; length <= 10; length++) generate_number(length, "", true);

  cout << valid_numbers[K - 1] << "\n";

  return 0;
}

Measured memory_bytes: 13936
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

typedef string::const_iterator State;
int number(State&);
int factor(State&);
int term(State&);
int expression(State&);

// ??°??????????????????????????????????????°????????????
int number(State &begin) {
    int ret = 0;

    while (isdigit(*begin)) {
        ret *= 10;
        ret += *begin - '0';
        begin++;
    }

    return ret;
}

// ??¬??§?????°???????????????????????????????????????????????????
int factor(State &begin) {
    if (*begin == '(') {
        begin++; // '('????£???°??????
        int ret = expression(begin);
        begin++; // ')'????£???°??????
        return ret;
    } else {
        return number(begin);
    }
    return -1;
}

// ?????????????????????????????????????????????????????????????????????
int term(State &begin) {
    int ret = factor(begin);

    for (;;) {
        if (*begin == '*') {
            begin++;
            ret *= factor(begin);
        } else if (*begin == '/') {
            begin++;
            ret /= factor(begin);
        } else {
            break;
        }
    }

    return ret;
}

// ?????????????????????????????????????????????????????????????????????
int expression(State &begin) {
    int ret = term(begin);

    for (;;) {
        if (*begin == '+') {
            begin++;
            ret += term(begin);
        } else if (*begin == '-') {
            begin++;
            ret -= term(begin);
        } else {
            break;
        }
    }

    return ret;
}

int main(){
    int t;
    cin >> t;
    while(t--){
        string s;
        cin >> s;
        s.erase(--s.end());
        State tmp = s.begin();
        cout << expression(tmp) << endl;
    }
}

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

int main() {
  std::vector<int> al(26, -1);
  std::string s, t;
  std::cin >> s >> t;

  for (size_t i = 0; i < s.size(); i++) {
    if (al[s[i] - 'a'] != -1) {
      if (al[s[i] - 'a'] != t[i] - 'a') {
        std::cout << "No" << std::endl;
        return 0;
      }
    } else {
      al[s[i] - 'a'] = t[i] - 'a';
    }
  }
  std::vector<bool> alb(26, false);
  for (const auto i : al) {
    if (i == -1) {
      continue;
    }
    if (alb[i]) {
      std::cout << "No" << std::endl;
      return 0;
    } else {
      alb[i] = true;
    }
  }
  std::cout << "Yes" << std::endl;
  return 0;
}


Measured memory_bytes: 776
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N;
  while (cin >> N) {
    vector<int> X(N);
    for (auto& x : X) cin >> x;
    int res = 1 << 29;
    for (int p = 0; p <= 100; p++) {
      int sum = 0;
      for (int x : X) {
        int d = abs(x - p);
        sum += d * d;
      }
      chmin(res, sum);
    }
    cout << res << endl;
  }
  return 0;
}


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

int main()
{
    long long int n[3];
    
    cin >> n[0] >> n[1] >> n[2];
    
    if((n[0] % 2 == 0) || (n[1] % 2 == 0) || (n[2] % 2 == 0)) {
        cout << "0\n";
    } else {
        sort(n, n+3);
        cout << n[0] * n[1] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
n = int(input())
s = list(input())

ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n):
    for d in range(n):
        j = i + d
        k = i + 2 * d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
            ans -= 1

print(ans)


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

using namespace std;

const int MAXN = 510;
int uN,vN;//u,v的数目，使用前面必须赋值
int g[MAXN][MAXN];//邻接矩阵
int linker[MAXN];
bool used[MAXN];

bool dfs(int u)
{
    for(int v = 0; v < vN;v++)
    if(g[u][v] && !used[v])
    {
        used[v] = true;
        if(linker[v] == -1 || dfs(linker[v]))
        {
            linker[v] = u;
            return true;
        }
    }
    return false;
}

int hungary()
{
    int res = 0;
    memset(linker,-1,sizeof(linker));
    for(int u = 0;u < uN;u++)
    {
        memset(used,false,sizeof(used));
        if(dfs(u))res++;
    }
    return res;
}

int main()
{
    int n;
    int a[110],b[110],c[110],d[110];
    while(scanf("%d",&n)!=EOF){
        uN=vN=n;
        for(int i=0;i<n;i++){
            scanf("%d%d",&a[i],&b[i]);
        }
        for(int i=0;i<n;i++){
            scanf("%d%d",&c[i],&d[i]);
        }
        memset(g,0,sizeof(g));
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                if(a[i]<c[j]&&b[i]<d[j]){
                    g[i][j]=1;
                }
            }
        }
        printf("%d\n",hungary());
    }
    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define w(x) while(x--)
using namespace std;
int main(int argc, char const *argv[])
{
	int x , y ;
	cin >> x >> y;
	string ans = "No";
	for (int i = 0; i <= x; i++) {
		int j = x - i;
		if (((4 * i) + (2 * j)) == y) {
			ans = "Yes";
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        
		int N =sc.nextInt();
		
		int count =0;
		
		for(int i=1;i<=N;i++){
		    
		    count+=i;
		    
		}
		
		System.out.println(count);
        
        
        
        
    }
}


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

using namespace std;

int main(){

	vector<pair<int,int> > vpii;
	int num,ans;
	char cm;
	while(cin>>num>>cm>>ans&&(num!=0||ans!=0)){
		vpii.push_back(make_pair(ans,num));
	}
	sort(vpii.begin(),vpii.end(),greater<pair<int,int> >());

	int prv=10000000;
	int rank=0;
	map<int,int> mii;
	for(int i = 0; i < vpii.size(); i++){
		if(vpii[i].first<prv){
			rank++;
			mii[vpii[i].second]=rank;
			prv=vpii[i].first;
		}
		else if(vpii[i].first==prv){
			mii[vpii[i].second]=rank;
		}
	}

	int nn;
	while(cin>>nn){
		cout<<mii[nn]<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;
    // abc140d
    static void solve(InputReader in, PrintWriter out){
        int n = in.ni(), k = in.ni();;
        char[] s = in.ns().toCharArray();
        int m = 1;
        for (int i = 1; i < n; i++) if (s[i] != s[i - 1]) m++;
        long ans = n-m;
        if(s[0]==s[n-1]){
            ans += Math.min(k, (m-1)/2)*2;
        }else{
            ans += Math.min(k, (m-2)/2)*2;
            if(m-2<2*k) ans += 1;
        }
        out.println(ans);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int H,W,h,w;
	scanf("%d%d%d%d",&H,&W,&h,&w);
	if (H%h==0 && W%w==0)
	{
		printf("No");
		return 0;
	}
	printf("Yes\n");
	for (int i=0;i<H;i++)
	{
		for (int j=0;j<W;j++)
		{
			if (i%h==0 && j%w==0)
			printf("%d ",(int)1e9-1);
			else if (i%h==h-1 && j%w==w-1)
			printf("%d ",-(int)1e9);
			else
			printf("0 ");
		}
		printf("\n");
	}
}

Measured memory_bytes: 2944
/*
Author : N_o_o_B
Created : May 02 2020 18:28:37 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;
const int maxn = 2e5+5;
int n;
vi a(maxn);
vi adj[maxn];
int d[maxn],ans[maxn];

void dfs(int u,int p,int k){
    int j = lower_bound(d,d+k,a[u]) - d;
    int old = d[j];
    d[j] = a[u];
    if(j==k) k++;
    ans[u] = k;
    for(int v:adj[u]){
        if(v!=p){
            dfs(v,u,k);
        }
    }
    d[j] = old;
}


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    cin >> n;
    rep(i,1,n) cin >> a[i];
    fori(_,n-1){
        int u,v;
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    dfs(1,-1,0);
    rep(i,1,n){
        cout << ans[i] << endl;
    }

    time_taken();
    return 0;
}

Measured memory_bytes: 30028
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
    cin >> first;
    IN(rest...);
    return;
}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
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;


#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }

const int MOD = 1000000007;

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

int main() {
   SS(ll,a)
   SS(string,s)
   if(a>3199)p(s);
   else p("red");
}

Measured memory_bytes: 384
/* ＵＴＦ－８ */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int X;
	std::cin >> X;
	
	int coin500 = X / 500;
	X %= 500;
	int coin5 = X / 5;
	X %= 5;
	int happy = coin500 * 1000 + coin5 * 5;
	std::cout << happy << "\n";
}


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

int H,W;

int A[80][80];
int B[80][80];
int D[80][80];
bool dp[80][80][(80+80)*80];

signed main() {
  cin >> H >> W;

  for(int i=0; i<H; i++) for(int j=0; j<W; j++) cin >> A[i][j];
  for(int i=0; i<H; i++) for(int j=0; j<W; j++) cin >> B[i][j];
  for(int i=0; i<H; i++) for(int j=0; j<W; j++) D[i][j] = (int)abs(B[i][j]-A[i][j]);

  int kmax = 80*(H-1+W-1);
  dp[0][0][D[0][0]] = true;

  for(int h=0; h<H; h++) for(int w=0; w<W; w++) for(int k=0; k<=kmax; k++) {
    if(!dp[h][w][k]) continue;
    if(w+1<W) {
      dp[h][w+1][abs(k-D[h][w+1])] = true;
      if(k+D[h][w+1] <= kmax) dp[h][w+1][k+D[h][w+1]] = true;
    }

    if(h+1<H) {
      dp[h+1][w][abs(k-D[h+1][w])] = true;
      if(k+D[h+1][w] <= kmax) dp[h+1][w][k+D[h+1][w]] = true;
    }
  }

  for(int k=0; k<=kmax; k++) if(dp[H-1][W-1][k]) { cout << k << endl; break; }
}

Measured memory_bytes: 79488
#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;
int main(){
    lli a,b;
    cin >> a >> b;
    if(a>=13)cout << b << endl;
    else if(a>=6 && a<=12) cout << b/2 << endl;
    else cout <<"0" << endl;
 }


Measured memory_bytes: 256
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n; cin >> n;
    cout << n * n * n << endl;
    
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	int x,y;
	int i;
	
	for(i=0;i<3000;i++){
		cin >> x >> y;
		if(x == 0 && y == 0){
			break;
		}
		
		if(x < y){
			cout << x << " " << y << endl;
		}else{
			cout << y << " " << x << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong n;
llong sum[405];
llong dp[405][405];

llong solve(llong s, llong t) {
    if (t - s == 1) return 0;
    if (dp[s][t] != -1) return dp[s][t];

    llong rec = 1ll << 60ll;
    for (int i = s + 1; i < t; i++) {
        rec = min(rec, solve(s, i) + solve(i, t));
    }

    return dp[s][t] = rec + sum[s] - sum[t];
}

int main() {
    for (int i = 0; i < 405; i++) {
        for (int j = 0; j < 405; j++) {
            dp[i][j] = -1;
        }
    }
    
    cin >> n;
    for (llong i = 0; i < n; i++) cin >> sum[i];

    sum[n] = 0;
    for (llong i = n; i > 0; i--) sum[i - 1] += sum[i];

    cout << solve(0, n) << endl;
        
    return 0;
}


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

int countStr(string objStr, string str) {
  int cnt = 0;
  int index = 0;
  while (1) {
    int pos = objStr.find(str, index);  // index 番目以降で検索
    if (pos == string::npos) return cnt;
    cnt++;
    index = pos + str.size();
  }
}

int main() {
  int N; cin >> N;
  string S; cin >> S;
  cout << countStr(S, "ABC") << endl;
}

Measured memory_bytes: 256