akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;
typedef long long ll;
typedef pair<int, ll> p;
typedef vector<int> room;
typedef vector<room> rooms;
typedef vector<rooms> roomlist;

struct edge {
    int to;
    ll cost;
};
typedef vector<vector<edge>> graph;

const ll INF = 1145141919810364364;

void addRoom(int x, int y, rooms &rooms, roomlist &tate, roomlist &yoko, int &roomcount) {
    rooms.push_back({x, y});
    tate[x].push_back({y, roomcount});
    yoko[y].push_back({x, roomcount});
    roomcount++;
}

void addSelfEdge(graph &g, int v, int &roomcount) {
    g[v].push_back({v + roomcount, 1});
    g[v + roomcount].push_back({v, 1});
}

void dijkstra(graph &g, vector<ll> &dis) {
    priority_queue<p, vector<p>, greater<>> que;
    dis[0] = 0;
    que.push({0, 0});

    while (!que.empty()) {
        p now = que.top();
        que.pop();
        int nowv = now.second;
        ll nowd = dis[nowv];

        if (nowd < now.first)continue;

        for (auto &next:g[nowv]) {
            int nt = next.to, nc = next.cost;
            if (dis[nt] > nowd + nc) {
                dis[nt] = nowd + nc;
                que.push({dis[nt], nt});
            }
        }
    }
}

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

    int m, n, k;
    cin >> m >> n >> k;

    bool canTurnFirst = false;
    rooms rooms;
    roomlist tate(m); // 左からx列目の情報
    roomlist yoko(n); // 上からx行目の情報
    int roomcount = 0;
    addRoom(0, 0, rooms, tate, yoko, roomcount);
    for (int i = 0; i < k; i++) {
        int x, y;
        cin >> x >> y;

        if ((x == 1 && y == 1) || (x == m && y == n)) {
            if (x == 1) canTurnFirst = true;
            continue;
        }

        addRoom(--x, --y, rooms, tate, yoko, roomcount);
    }
    addRoom(m - 1, n - 1, rooms, tate, yoko, roomcount);

    graph graph(roomcount * 2);
    for (auto &v:tate) {
        sort(v.begin(), v.end());
        for (int j = 1; j < v.size(); j++) {
            int l = v[j - 1][1], r = v[j][1], cost = v[j][0] - v[j - 1][0];
            graph[l].push_back({r, cost});
            graph[r].push_back({l, cost});
        }
    }
    for (auto &v:yoko) {
        sort(v.begin(), v.end());
        for (int j = 1; j < v.size(); j++) {
            int l = v[j - 1][1] + roomcount, r = v[j][1] + roomcount, cost = v[j][0] - v[j - 1][0];
            graph[l].push_back({r, cost});
            graph[r].push_back({l, cost});
        }
    }
    for (int i = 0; i < roomcount - 1; i++) {
        if (i == 0 && !canTurnFirst)continue;
        addSelfEdge(graph, i, roomcount);
    }

    vector<ll> dis(roomcount * 2, INF);
    dijkstra(graph, dis);

    ll ret = min(dis[roomcount - 1], dis[roomcount * 2 - 1]);
    cout << (ret == INF ? -1 : ret) << endl;
    return 0;
}


Measured memory_bytes: 91068
h,w=map(int,input().split())
n=int(input())
a=list(map(int,input().split()))
ans=[]
c=0
cnt=0
flg=True
for i in range(h):
    t=[]
    for j in range(w):
        if a[c]<=cnt:
            c+=1
            cnt=0
        if flg:
            t.append(c+1)
        else:
            t.insert(0,c+1)
        cnt+=1
    flg=not flg
    ans.append(t)
for i in ans:
    print(' '.join(list(map(str,i))))

Measured memory_bytes: 3572
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

int main(){
    int n; cin >> n;
    vector<vector<pair<int,int>>> v(n);
    vector<bool> b(n);
    vector<int>  cl(n);
    
    rep(i,n-1){
        int uu,vv,w; cin >> uu >> vv >> w;
        v[uu-1].push_back(mp(vv-1,w));
        v[vv-1].push_back(mp(uu-1,w));   
    }
    
    rep(i,n) b[i] = false;
    b[0] = true;
    int pos = 0, count = 1;
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int ver = q.front();
        int tc = cl[ver];
        q.pop();
        for(auto x: v[ver]){
            int tov = x.first;
            int dist = x.second;
            if(b[tov] == false){
                b[tov] = true;
                cl[tov] = tc^(dist%2);
                q.push(tov);
                count++;
            }
        }
    } 

    rep(i,n) cout << cl[i] << endl;
    return 0;
}

Measured memory_bytes: 6784
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PokerPlaying {
    class Class2 {
        
        static void Main(string[] args) {
            new Class2().solve();
        }
        void solve() {
            while (true) {
                int num_Food = int.Parse(Console.ReadLine());
                if (num_Food == 0) {
                    return;
                }
                string[][] input = new string[num_Food][]; 
                for (int i = 0; i < num_Food; i++) {
                    string[] miniImput = Console.ReadLine().Split(' ');
                    input[i] = new string[miniImput.Length];
                    for (int j = 0; j < miniImput.Length; j++) {
                        input[i][j] = miniImput[j];
                    }
                }
                printOrder(input);
            }
        }

        void printOrder(string[][] foodList) {
            List<int> order = new List<int>();
            for (int i = 0; i < foodList.Length; i++) {
                int nextOrder = 0;
                double g = 0;
                for (int j = 0; j < foodList.Length; j++) {
                    if (order.Contains(j)) continue;
                    if (isPossible(j, foodList, order) && int.Parse(foodList[j][1]) > g) {
                        nextOrder = j;
                        g = int.Parse(foodList[j][1]);
                    }
                }
                order.Add(nextOrder);
            }
            for (int i = 0; i < foodList.Length; i++) {
                Console.WriteLine(foodList[order[i]][0]);
            }
        }

        bool isPossible(int idx, string[][] list, List<int> skipList) {
            int weigh = 0;
            for (int i = 0; i < list.Length; i++) {
                if (i == idx || skipList.Contains(i)) continue;
                weigh += int.Parse(list[i][1]);
            }
            if (int.Parse(list[idx][2]) >= weigh) {
                return true;
            } else return false;
        }
    }
}

Measured memory_bytes: 9312
using System;
using System.Linq;
namespace AtCoder_Begginer_Contest1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ABK = Console.ReadLine().Split();
            long A = long.Parse(ABK[0]);
            long B = long.Parse(ABK[1]);
            long K = long.Parse(ABK[2]);
            if (A >= K) { A = A - K; }
            else if (B + A >= K){ B = B-K+A;  A = 0; }
            else {A = 0;B = 0;}
            Console.WriteLine(A + " " + B);
        }
    }
}

Measured memory_bytes: 11220
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define N 100010
using namespace std;
int n, w[N];
ll s, m, x, y, a[N];
int main(){
	scanf("%d", &n);
	for(int i=1; i<=n; i++)scanf("%d", &w[i]);
	if(n==1){printf("YES"); return 0;}
	s=0; for(int i=1; i<=n; i++)s+=w[i]; m=(ll)n*(n+1)/2;
	if(s%m){printf("NO"); return 0;}
	x=s/m; w[n+1]=w[1];
	for(int i=1; i<=n; i++){
		y=w[i+1]-w[i]-x;
		if(y>=1||y%n){printf("NO"); return 0;}
		a[i+1]=-y/n;
	}
	a[1]=a[n+1];
	s=0; for(int i=1; i<=n; i++)s+=a[i];
	if(s!=x)printf("NO"); else printf("YES");
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl "\n"
#define pb push_back
#define mod 1000000007
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int dx8[]={1,-1,0,0,1,1,-1,-1};
int dy8[]={0,0,1,-1,1,-1,1,-1};

ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

 // void dfs(ll node){
 // 	vis[node]=1;
 // 	res.pb(node);
 //    vector<ll> ans;


 // 	for(auto i:v[node]){
 // 		if(!vis[i]){
 // 			ans.pb(i);

 // 		}
 // 	}
 // 	sort(ans.begin(),ans.end());

 // 	for(auto i:ans){
 // 		if(!vis[i])
 // 			dfs(i);
 // 	}




 // }

void solve(){

// ll n;
// cin>>n;
// if(n==1){
// 	cout<<0<<endl;

// }
// else if(n==2){
// 	cout<<1<<endl;

// }
// else{
// 	ll ans;
// 	ans=





	

// }
	ll  s;
        cin>>s;
        ll dp[s+100];
        memset(dp,0,sizeof(dp));
                dp[0]=1;
           dp[1]=0;
            dp[2]=0;
               dp[3]=1;ll x=0;

        for(ll i=4;i<=s;i++)
        {
        	x=0;
            dp[i]=0;
            

            for(ll j=3;j<=i;j++)
            {
                if(i-j<0)continue;
                x=(x%mod+dp[i-j]%mod)%mod;
            }
            dp[i]=x%mod;
        }




        cout<<dp[s]<<endl;




return;
}



int main()
{  
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
    fast;
    

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



#ifndef ONLINE_JUDGE
	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif
return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;
	long long  n,p;
	while (cin>>n>>s)
	{
		int l = s.length();
		int b, m;
		b = m = -1;
		for (int i = 0; i < l; i++)
		{
			if (s[i] != '0')
			{
				b = i;
				break;
			}
		}
		for (int i = b; i < l; i++)
		{
			if (s[i] == '.')
			{
				m = i;
				break;
			}
		}
		p = 0;
		if (m != -1)
		{
			for (int i = l-1; i > m; i--)
			{
				p = (s[i] - '0') * n + p;
				p = p / 10;
			}
		}
		if (b != -1)
		{
			if (b == m)
				cout << p << endl;
			else
			{
				for (int i = m-1; i >= b; i--)
				{
					p = (s[i] - '0') * n + p;
					s[i] = p % 10;
					p /= 10;
				}
				
				if (p)
				{
					cout << p;
				}
				for (int i = b; i < m; i++)
				{
					cout << (int)s[i];
				}
				cout << endl;
			}
		}
	}
	return 0;
}


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

int main(void)
{
    int n, i, titen;
    double sa, kion[100000], a, t, h[100000];

    scanf("%d",&n);
    scanf("%lf %lf",&t,&a);
    for(i=0; i<n; i++){
        scanf("%lf",&h[i]);
        kion[i] = fabs(a  - (t - h[i]*0.006));
    }

    sa = kion[0];
    titen = 1;
    for(i=1; i<n; i++){
        if(sa > kion[i]){
            sa = kion[i];
            titen = i+1;
        }
    }

    printf("%d",titen);

    return 0;
}

Measured memory_bytes: 128
package main


import (
	"fmt"
	"io"
	"math"
	"os"
)

func main() {
	solve(os.Stdin, os.Stdout)
}

func solve(stdin io.Reader, stdout io.Writer) {
	var a, b int

	fmt.Fscanf(stdin, "%d%d", &a, &b)
	ans := int(math.Max(float64(a*b), math.Max(float64(a+b), float64(a-b))))
	fmt.Fprintln(stdout, ans)
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

string a,b,c;
int main(){
    cin >> a >> b >> c;
    cout << a.substr(0,1) + b.substr(0,1) + c.substr(0,1) << '\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main() {
  int s[3];
  for (int i=0; i<3; i++) cin >> s[i];
  int K;
  cin >> K;
  
  sort(s,s+3,greater<int>());
  int ans = s[0];
  for (int i=0; i<K; i++) {
    ans *= 2;
  }
  cout << s[1] + s[2] + ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  if(n==1){
    int a;
    cin >> a;
    if(a==0) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
  }
  int a[n],b[n];
  if(n%2==1) for(int i=0; i<n; i++){
    b[i] = ((i+1)/2)*2;
    cin >> a[i];
  }else for(int i=0; i<n; i++){
    b[i] = (i/2)*2+1;
    cin >> a[i];
  }
  sort(a,a+n);
  for(int i=0; i<n; i++){
    if(a[i]!=b[i]){
      cout << 0 << endl;
      return 0;
    }
  }
  long long int ans=1;
  for(int i=0; i<n/2; i++){
    ans *= 2;
    ans %= 1000000007;
  }
  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<deque>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

ll h,w;

int main()
{
	cin >> w >> h;
	vector<pair<ll,int> > v;
	
	REP(i,w){ll tmp;scanf("%d",&tmp);v.PB(MP(tmp,0));}
	REP(i,h){ll tmp;scanf("%d",&tmp);v.PB(MP(tmp,1));}
	
	sort(ALL(v));
	
	ll ans = 0;
	int a=0,b=0;
	
	REP(i,w+h)
	{
		if(v[i].SE == 0)
		{
			ans += v[i].FI * (h+1-b);
			a++;
		}
		else
		{
			ans += v[i].FI * (w+1-a);
			b++;
		}
	}
	
	cout << ans << endl;
	
	
	return 0;
}

Measured memory_bytes: 6512
using System;

namespace tst
{
    class Program
    {
        public static void Main()
        {
            int x = int.Parse(Console.ReadLine());
            int index = -1;
            while (true)
            {
                bool flag = true;
                index++;
                if (x == 2)//２は素数
                {
                    break;
                }
                else if ((x + index) % 2 == 0)//偶数は素数じゃない
                {
                    continue;
                }
                else
                {
                    for (int i = 3; i < x; i += 2)
                    {
                        if ((x + index) % i == 0)
                        {
                            flag = false;
                        }
                    }
                    if (flag) break;
                }
            }
            Console.WriteLine(x + index);
        }

    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
main(){
    set<int> st;
    int N,A;
    cin >> N;
    for(int i = 0;i < N;i++){
        cin >> A;
        if(!st.erase(A)){
            st.insert(A);
        }
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
#include <string>
//#include <boost/multiprecision/cpp_int.hpp>
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define llu  long long 
#define fp cout<<fixed<<setprecision(9);
#define ifor(j,n) for(int i=j ;i<n;i++)
#define jfor(k,n) for(ll j=k ;j<n;j++)
#define pb push_back
#define mod 1000000007
using namespace std;
//using namespace boost::multiprecision;

//Compiler version g++ 6.3.0
int search (vector <long long> v,long long m,int n) 
{ 

    int start = 0;
    int ans = -1; 
    while (start <=n) 
    { 
     int mid = (start + n) / 2;
     if (v[mid] <= m) 
         start = mid + 1;
     else
   { 
   ans = mid; 
   n = mid - 1; 

       } 

    } 
    return ans; 
} 

int main()
{
 FAST 

   long long k,count=1,num=7;
   cin>>k;
  if(k%2==0)
  {
    cout<<-1;
    return 0;
  }
  while(count<=k)
   {
     if(num%k==0)
     {
       cout<<count;
       return 0;
     }
     num=num*10+7;
    
     num%=k;
     count++;
   }
   cout<<-1;
 
   

    
 
 
        
      
    
        
 
      
         
            
             
       
      
       
    
   
     }   
        
       
        
        
        
       
          
    

Measured memory_bytes: 3652
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,x,n) for(int i=x;i<n;i++)
#define breps(i,x,n) for(int i=x;i>=n;i--)
#define exrep(x,vec) for(auto&& x : vec);
#define PI 3.14159265358979323846264338327950288
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

/**
* ------------- ここからコード -------------
*/

int main(void) {

	ll A, B, C, D, N, M, L,X;
	ll T, S;
	ll ans = 0;

	cin >> N >> X >> T;

	ans = (N / X) * T;
	ans += (N % X == 0 ? 0 : T);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    
    int k1 = a/100;
    int k2 = (a%100)/10;
    int k3 = a%10;
    
    if(k1 == k3){
    	System.out.println("Yes");
    }else{
    	System.out.println("No");
    }
  }
}

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

void solve() {
    int n, m, c;
    cin >> n >> m >> c;

    int b[m];
    rep(0, m) cin >> b[i];

    int a, p, cnt = 0;
    for (int i = 0; i < n; i++) {
        p = 0;
        for (int j = 0; j < m; j++) {
            cin >> a;
            p += (a * b[j]);
        }
        if ((p + c) > 0) cnt++;
    }

    cout << cnt << endl;
}

int main() {
    solve();

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;

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

const int inf = 1<<29;
int a[10][10],ans,n,res;
int perm[10],d[10];
bool use[10];

void dist(int sum,bool *used,int *p,int *data,int now) {
  if(sum > ans) return;
  if(n == now) {
    ans = sum;
    return;
  }

  int i,j;
  rep(i,n) {
    if(used[i]) continue;
    used[i] = true;
    int tmp = 0;
    rep(j,now)
      tmp = max(tmp, data[j]+a[i][p[j]]);

    data[now] = tmp;
    p[now] = i;
    dist(data[now],used,p,data,now+1);
    used[i] = false;
  }
}

int main() {
  int i,j,t;
  while(scanf("%d", &n), n) {
    memset(a, 0, sizeof(a));
    memset(perm, 0, sizeof(perm));
    memset(d, 0, sizeof(d));
    memset(use, false, sizeof(use));
    rep(i,n)
      rep(j,n)
	scanf("%d", &a[i][j]);

    rep(i,n) {
      rep(j,n) a[i][j] = max(a[i][j], a[j][i]);
    }
    ans = inf;

    dist(0,use,perm,d,0);
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 764
// In the name of GOD
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     IOS         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	mod         1000000007
#define 	inf         10000000000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b,ll m=mod)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2,m);
	if(b%2==0)
		return((c%m)*(c%m))%m;
	return ((((c%m)*(c%m))%m)*(a%m))%m;
}
/********************************************************/
//	d.erase(unique(all(d)), d.end());



int main()
{
	IOS;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	// cin>>t;
	string s;
	while(t--)
	{
		cin>>n;
		// ll a[n];
		repe(i,1,n+1)
		{
			repe(j,1,n+1)
			{
				repe(k,1,n+1)
				{
					m=__gcd(i,j);
					c+=(__gcd(m,k));
				}
			}
		}
		
		cout<<(c);

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

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, P> P3;
typedef pair<P, P> PP;
constexpr ll MOD = ll(1e9 + 7);
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()




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


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include<set> 
#include<math.h>
#define pai arccos(-1);
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;

int main() {
  int mn = 1e9;
	int n,x;
  cin>>n>>x;
  vector<int> m(n);
  rep(i,n){
    cin>>m[i];
  }
  int sum=0;
  rep(i,n){
    sum += m[i];
  }
  rep(i,n){
    mn = min(mn,m[i]);
  }
  
  int count = (x-sum)/mn;
  cout<<n+count<<endl;
	}


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



int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  
  int ans = 0;
  for (int x: a) {
    ans += x;
  }
  ans -= n;

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main  {
   public static void main(String[] args)  {
      Scanner sc = new Scanner(System.in);
          
      double a = sc.nextDouble();
      double b = sc.nextDouble();
      double h = sc.nextDouble();
      double m = sc.nextDouble();
      
      if (h == 12 && m == 0) {
         System.out.println("0");
      } else {
         double t = (h*60 + m) * 360 / (12*60);
         double l = m*360/60;
         double ang = t - l;
         double coss = Math.cos(Math.toRadians(ang));
         double ans = Math.sqrt(a*a + b*b - 2*a*b*coss);
         System.out.println(ans);
      }   
   }
}

Measured memory_bytes: 37452
#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef double ld;
const int N = 200001;


vector<int> g[N];
vector<ll> q[N];
int used[N];
ll a[N];
int cur;
int minn = 1e9 + 7;

void dfs(int v)
{
    q[cur].push_back(a[v]);
    used[v] = 1;
    for (int i = 0; i < g[v].size(); i++)
    {
        int u = g[v][i];
        if (!used[u])
            dfs(u);
    }
}

vector<ll> qq;

int main()
{
    //freopen("in.txt", "r", stdin);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < m; i++)
    {
        int x, y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    int t = 0;
    for (int i = 0; i < n; i++)
        if (!used[i])
        {
            cur = t;
            dfs(i);
            t++;
            sort(q[cur].begin(), q[cur].end());
        }
    if (t == 1)
    {
        cout << 0;
        return 0;
    }
    if (t * 2 - 2 > n)
    {
        cout << "Impossible";
        return 0;
    }
    ll ans = 0;
    for (int i = 0; i < t; i++)
    {
        ans += q[i][0];
        for (int j = 1; j < q[i].size(); j++)
            qq.push_back(q[i][j]);
    }
    sort(qq.begin(), qq.end());
    for (int i = 0; i < t - 2; i++)
        ans += qq[i];
    cout << ans;
    return 0;
}


Measured memory_bytes: 16632
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,m;
	int ans=0;
	cin >>n>>m;
	int x,y;
	vector<pair<int,bool>>dis(n,mp(1,false));
	dis[0].S=true;
	rep(i,m){
		cin>>x>>y;
		x--;
		y--;
		dis[y].F++;
		dis[x].F--;
		if(dis[x].S==true){
			dis[y].S=true;
		}
		if(dis[x].F==0){
			dis[x].S=false;
		}
	}
	rep(i,n){
		ans+=(dis[i].S==true);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4016
x, y = map(int, input().split())
ans = 0
if x==1:
    if y==1:
        print(1000000)
        exit()
    else:
        ans += 300000
elif x==2:
    ans += 200000
elif x==3:
    ans += 100000
if y==1:
    ans+=300000
elif y==2:
    ans+=200000
elif y==3:
    ans+=100000
print(ans)

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

using namespace std;

vector <int> v;
map <int , int> mp;
int main() {
	int n;
	ios::sync_with_stdio(0);	
	cin >> n;
	for(int i = 0 ; i < n ; i++) {
		int t;
		cin >> t;
		if(!mp.count(t) ) {
			v.push_back(t);
		}
		mp[t]++;
	}
	sort(v.begin() , v.end());
	int ans = 0;
	for(int i = 0 ; i < v.size() ; i++) {
		for(int j = i + 1 ; j < v.size() ; j++) {
			for(int k = j + 1 ; k < v.size() ; k++) {
				if(v[i] + v[j] > v[k]) {
					int tmp = mp[v[i]] * mp[v[j]] * mp[v[k]];
					ans += tmp;
				}
			}
		}
	}
	cout << ans << "\n";
	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	int N, K, Q, tmp;
	cin >> N >> K >> Q;
	vector<int> a(N, 0);
	
	int border = Q - K + 1;
	for(int i=0; i<Q; i++) {
		cin >> tmp;
		a[tmp-1]++;
	}
	
	for(int i=0; i<N; i++) {
		cout << ((a[i] >= border) ? "Yes" : "No") << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<int>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  int r,c,k;
  cin >> r >> c >> k;
  ll o[r][c];
  rep(i,r)rep(j,c)o[i][j]=0;
  rep(i,k){
    ll a,b,c;
    cin >> a >> b >> c;
    a--;
    b--;
    o[a][b]=c;
  }
  vector<vector<vector<ll>>> dp(r, vector<vector<ll>>(c, vector<ll>(4)));
  rep(i,r)rep(j,c)rep(l,4)dp[i][j][l]=0;
  dp[0][0][1]=o[0][0];
  rep(i,r){
    rep(j,c){
      if(i+j==0)continue;
      if(o[i][j]==0){
        rep(l,4){
          if(j!=0){
            dp[i][j][l]=max(dp[i][j][l],dp[i][j-1][l]);
          }
          if(i!=0){
            dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][l]);
          }
        }
      }
      else{
        if(j!=0){
          rep(l,4){
            dp[i][j][l]=max(dp[i][j][l],dp[i][j-1][l]);
            if(l!=3)dp[i][j][l+1]=max(dp[i][j][l+1],o[i][j]+dp[i][j-1][l]);
          }
        }
        if(i!=0){
          rep(l,4){
            dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][l]);
            dp[i][j][1]=max(dp[i][j][1],o[i][j]+dp[i-1][j][l]);
          }
        }
      }
    }
  }
  ll ans=0;
  rep(i,4)ans=max(ans,dp[r-1][c-1][i]);
  cout << ans << endl;
}


Measured memory_bytes: 706724
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

int main(){
int n,i;
double x1,y1,x2,y2,x3,y3,px,py,r;

cin >> n;

for(i=0;i<n;i++){

cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

px=((y1-y3)*(pow(y1,2.0)-pow(y2,2.0) +pow(x1,2.0) -pow(x2,2.0))-(y1-y2)*(pow(y1,2.0) -pow(y3,2.0) +pow(x1,2.0) -pow(x3,2.0))) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3));
py=((x1-x3)*(pow(x1,2.0) -pow(x2,2.0) +pow(y1,2.0) -pow(y2,2.0)) -(x1-x2)*(pow(x1,2.0) -pow(x3,2.0) +pow(y1,2.0) -pow(y3,2.0))) / (2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));


r=sqrt(pow(x1-px,2.0)+pow(y1-py,2.0));

printf("%.3f %.3f %.3f\n",px,py,r);



}
}

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

int main(){
  int s,k;
  cin >>k>>s;
  int ans=0;
  for(int i=0;i<=k;i++){
    for(int j=0;j<=k;j++){
      if(s-i-j<=k&&s-i-j>=0)
        ans++;
    }
  }
  cout << ans<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String X = scan.next();
        String Y = scan.next();
        int a = Integer.parseInt(X, 16);
        int b = Integer.parseInt(Y, 16);
        if (a==b) {
            System.out.println("=");
        } else {
            System.out.println(a<b? "<" : ">");
        }
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

struct UnionFind {
    vector<int> par, siz;

    UnionFind(int n) : par(n), siz(n, 1) {
        iota(par.begin(), par.end(), 0);
    }

    int root(int x) {
        if (par[x] == x)
            return x;
        else
            return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    int size(int x) {
        return siz[root(x)];
    }
};

signed main() {
    int n, q;
    cin >> n >> q;
    UnionFind uf(n);
    int t, u, v;
    rep(i, q) {
        cin >> t >> u >> v;
        if(t)
            cout << uf.same(u,v) << endl;
        else
            uf.unite(u, v);
    }
    return 0;
}

Measured memory_bytes: 4852
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int sum = 0;
        while(scan.hasNext()){
        	char[] ch = scan.next().toCharArray();
        	String ns = "";
        	for(int i = 0;i < ch.length;i++){
        		if(Character.isDigit(ch[i])){
        			ns += ch[i];
        			if(i == ch.length-1){
        				sum += Integer.parseInt(ns);
        			}
        			continue;
        		}
        		if(!ns.equals("")){
        			sum += Integer.parseInt(ns);
        			ns = "";
        		}
        	}
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 17172
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

const int max_n = 100000+10;

int N,M;
Int dp[max_n];

int main(void) {
    cin>>N>>M;
    for(int i = 0;i < M;i++) {
        int a;
        cin>>a;
        dp[a] = -1;
    }

    dp[0] = 1;
    for(int i = 1;i <= N;i++) {
        if(dp[i] == -1)
            continue;

        if(i-1 >= 0 && dp[i-1] != -1) {
            dp[i] += dp[i-1];
            dp[i] %= MOD;
        }
        if(i-2 >= 0 && dp[i-2] != -1) {
            dp[i] += dp[i-2];
            dp[i] %= MOD;
        }

    }

    cout<<dp[N]<<endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    string s; cin >> s;
    string ans = "";
    rep(i,s.size()){
        if(s[i] == '0') ans += '0';
        else if(s[i] == '1') ans += '1';
        else {
            if(!ans.empty()) ans.pop_back();
        }
    }
    cout << ans << endl;
}

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

int main() {
    ll X, Y, A, B, C; cin >> X >> Y >> A >> B >> C;
    vector<int> va(A), vb(B), vc(C);
    for (int i = 0; i < A; i++) cin >> va[i];
    for (int i = 0; i < B; i++) cin >> vb[i];
    for (int i = 0; i < C; i++) cin >> vc[i];
    sort(va.begin(), va.end(), greater<int>());
    sort(vb.begin(), vb.end(), greater<int>());
    vc.insert(vc.end(), va.begin(),va.begin()+X);
    vc.insert(vc.end(), vb.begin(),vb.begin()+Y);
    sort(vc.begin(),vc.end(), greater<int>());

    cout << accumulate(vc.begin(),vc.begin()+X+Y, 0LL) << endl;
}

Measured memory_bytes: 2808
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   
   String S = sc.next();
   String T = sc.next();
   int a = sc.nextInt();
   int b = sc.nextInt();
   String X = sc.next();
 
   if(S.equals(X)) a--;
   else b--;
   System.out.println(a+ " " + b);
 }
}

Measured memory_bytes: 22868
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef long long lint;
typedef double ld;

void a();void b();void c();void d();void e();void f();

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

	int r, d, x;
	cin >> r >> d >> x;
	fore(i, 1, 10){
		cout << r * x  - d << '\n';
		x = r * x - d;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    string s, t;
    cin >> s >> t;
    
    int pos = 0;
    
    for ( pos = 0; pos < n; pos++ ) {
        bool ok = true;
        for ( int j = 0; j < n - pos; j++ ){
            if ( s[pos + j] != t[j] ){
                ok = false;
                break;
            }
        }
        if (ok) break;
    }
    
    cout << pos + n << endl;
    
    return 0;
}


Measured memory_bytes: 256
import fractions

A, B, C, D = map(int, input().split())

C_count = B // C - (A - 1) // C
D_count = B // D - (A - 1) // D

lcm = C * D // fractions.gcd(C, D)

CD_count = B // lcm - (A - 1) // lcm

can_divide = C_count + D_count - CD_count
print(B - A + 1 - can_divide)


Measured memory_bytes: 66156
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;

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

const int maxn = 101,maxa = 10001,maxb = 10001,maxc = 10001;

unsigned int n,a,b,c,x;
int y[maxn];

int main()
{
    while(cin >>n>>a>>b>>c>>x &&(n&&c))
    {
        REP(n) cin>>y[i];

        int now = 0;
        int ans = -1;
    
        REP(10001)
        {
            //cout << x <<endl;
            if(y[now] == x) now++;
                
            if(now == n)
            {
                ans = i;
                break;
            }
            x = ((a * x) + b) % c;
        }


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

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

string rep;
char ans[222],fir;

int main(void){
	int n,i,j,l,r,x,y,m;
	cin >> n;
	l = 0; r = n;
	cout << "?";
	for(j=1; j<=n; ++j){
		cout << " " << (j);
	}
	cout << endl;
	cout.flush();
	cin >> rep;
	if(rep[0]=='-'){
		return 0;
	}
	fir = rep[0];
	while(r-l>1){
		m = (l+r)/2;
		cout << "?";
		for(j=1; j<=n; ++j){
			cout << " " << (m+j);
		}
		cout << endl;
		cout.flush();
		cin >> rep;
		if(rep[0]=='-'){
			return 0;
		}
		if(rep[0]==fir){
			l = m;
		}else{
			r = m;
		}
	}
	r = l+n;
	ans[l] = fir;
	ans[r] = 'R'+'B'-fir;
	++l;
	for(i=0; i<n*2; ++i){
		if(l-1<=i && i<=r){
			continue;
		}
		cout << "? " << (i+1);
		for(j=l; j<r; ++j){
			cout << " " << (j+1);
		}
		cout << endl;
		cout.flush();
		cin >> rep;
		if(rep[0]=='-'){
			return 0;
		}
		ans[i] = rep[0];
	}
	for(i=l; i<r; ++i){
		cout << "? " << (i+1);
		x = (n-1)/2; y = (n-1)/2;
		for(j=0; j<l-1; ++j){
			cout << " " << (j+1);
		}
		for(j=r+1; j<n*2; ++j){
			cout << " " << (j+1);
		}
		cout << endl;
		cout.flush();
		cin >> rep;
		if(rep[0]=='-'){
			return 0;
		}
		ans[i] = rep[0];
	}
	cout << "! ";
	for(i=0; i<n*2; ++i){
		cout << ans[i];
	}
	cout << endl;
	cout.flush();
	return 0;
}


Measured memory_bytes: 724
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

template <int64_t MOD>
class Modint {
  using Self = Modint<MOD>;

  int64_t m_value;

 public:
  Modint(int64_t value) : m_value((value % MOD + MOD) % MOD) {}
  Self pow(int64_t e) const {
    if (e == 0) {
      return (Self)1;
    } else if (e % 2 == 0) {
      return ((*this) * (*this)).pow(e / 2);
    } else {
      return (*this).pow(e - 1) * (*this);
    }
  }
  Self inv() const { return pow(MOD - 2); }
  Self& operator=(const Self& rh) {
    m_value = rh.m_value;
    return *this;
  }
  Self operator-() const { return Self(-m_value); }
  Self operator+(const Self& other) const {
    return Self(m_value + other.m_value);
  }
  Self operator-(const Self& other) const {
    return Self(m_value - other.m_value);
  }
  Self operator*(const Self& other) const {
    return Self(m_value * other.m_value);
  }
  Self operator/(const Self& other) const { return (*this) * other.inv(); }
  Self& operator+=(const Self& rh) { return (*this) = (*this) + rh; }
  Self& operator-=(const Self& rh) { return (*this) = (*this) - rh; }
  Self& operator*=(const Self& rh) { return (*this) = (*this) * rh; }
  int64_t value() const { return m_value; }
};

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

  using Mint = Modint<1'000'000'007>;

  const int N = K + s.size();
  vector<Mint> fact(N + 1, 1);
  rep(i, N) { fact[i + 1] = fact[i] * (i + 1); }

  Mint result = 0;
  irep(i, K) {
    Mint v = fact[s.size() + i - 1] / fact[s.size() - 1] / fact[i] *
             Mint(25).pow(i) * Mint(26).pow(K - i);
    result += v;
  }

  cout << result.value() << endl;

  return 0;
}

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

int main(){
  int N;
  int i;
  int m=0;
  string S;
  cin >> S;
  N=S.size();
  for(i=0;i<N;i+=2){
    if(S.at(i)=='0'){
      m++;
    }
  }
  for(i=1;i<N;i+=2){
    if(S.at(i)=='1'){
      m++;
    }
  }
  if(m>N/2){
    m=N-m;
  }
 cout << m << endl;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio( false ), cin.tie( nullptr ), cout.tie( nullptr );
    
    int a, b; cin >> a >> b; int c = b - a, d = b + a; cout << ( c * c - d ) / 2; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long  ll;
#define EPS 1e-9
#define PI acos(-1.0)
const int MOD = 1e9 + 7;



int main() {
   ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
   int n;
   cin >> n;
   vector<int> c(n + 1 , -inf) , a(n);
   for(int &x : a) {
      cin >> x;
   }

   c[0] = 0;
   for(int i = 0 ; i < n ; ++i){
      c[a[i]] = max(c[a[i]] , c[a[i] - 1] + 1);
   }

   int mx = *max_element(all(c));
   cout << (mx < 1 ? -1 : n - mx) << "\n";
}

Measured memory_bytes: 1792
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<cstdlib>
#define range(i,a,b) for(int i = (a); i <= (b); i++)
#define rep(i,b) for(int i = 1; i <= (b); i++)
#define rrep(i,b) for(int i = (b); i >= 1; i--)
#define all(a) (a).begin(), (a).end()
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
typedef long long ll;
const int N=1e5+11,INF=~0u>>2;
bool vis[N],flag=1;
int n,m,q,a[N],b[N],id[N],cnt[N],len;
int read(){
	int 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*10+ch-'0';ch=getchar();}
	return f*x;
}
int main(){
//	freopen("ex.in","r",stdin);
	n=read();m=read();q=read();
	rep(i,q) a[i]=read();
	rrep(i,q) if(!vis[a[i]]) b[++len]=a[i],vis[a[i]]=1;
	rep(i,m) if(!vis[i]) b[++len]=i;
//	rep(i,m) show(b[i]);
//	show(len);
	rep(i,m) id[b[i]]=i;
	cnt[0]=n;
	rep(i,m) vis[i]=0;
	rrep(i,q){
		int t=id[a[i]];
		if(cnt[t-1]>0) cnt[t-1]--,cnt[t]++,vis[t]=1;
		else if(!vis[t]){
			flag=0;
			break;
		}
	}
	len=0;
	while(cnt[len]==0) len++;
	range(i,len+1,m-1) flag&=b[i]<b[i+1];
	puts(flag?"Yes":"No");
	return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char c;
	cin>>c;
	if(c-'a'>=0 && c-'a'<26)
	{
		cout<<"a"<<endl;
	}
	else if(c-'A'>=0 && c-'A'<26)
	{
		cout<<"A"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll x,y;
    cin >> x >> y;
    
    cout << x + y/2 << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
//cout << fixed << setprecision(0)
int main() { 
  int n;cin >> n;
  vector<int> a(n);
  rep(i,n){
    int b;cin >> b;
    a.push_back(b);
  }
  sort(a.rbegin(),a.rend());
  int ans;
  rep(i,n){
    if(i%2==0)ans+=a[i];
    else ans-=a[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

class ModInv:
    def __init__(self, size, MOD):
        self.inv = [0] * (size + 1)
        self.inv[1] = 1
        for i in range(2, size + 1):
            self.inv[i] = (-(MOD // i) * self.inv[MOD%i]) % MOD

if n == 1:
    print(1)
    print(1)
    exit()

MOD = 10 ** 9 + 7

b = sorted(a)

for i in range(n):
    if b[i] == b[i + 1]:
        break

first = a.index(b[i])
for i in range(first + 1, n + 1):
    if a[i] == a[first]:
        second = i

w = n + first - second

inv = ModInv(n + 1, MOD)
c = [1] * (n + 2)
d = [1] * (n + 2)

for i in range(n + 1):
    d[i + 1] = (d[i] * inv.inv[i + 1]) % MOD
for i in range(n + 1):
    c[i + 1] = (c[i] * (i + 1)) % MOD

print(n)
for k in range(2, n + 2):
    ans = (((c[n+1] * d[n+1-k]) % MOD) * d[k]) % MOD
    if w >= k - 1:
        ans -= (((c[w] * d[w-k+1]) % MOD) * d[k-1]) % MOD
    print( ans % MOD )


Measured memory_bytes: 21248
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string ans ="No";
    cin >> n;

    for(int i =0;i<26;i++){
        for(int j =0;j<15;j++){
            if(4*i+7*j==n){
                ans = "Yes";
                break;
            }
        }
    }

    cout << ans<<endl;
}

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

int main()
{
	int a[3];

	cin >> a[0] >> a[1] >> a[2];

	sort(a, a + 3);

	cout << a[2] * 10 + a[1] + a[0] << endl;
	
	return 0;
}

Measured memory_bytes: 256