akhauriyash/Code-Regression huggingface dataset:
/*
auth - @sportykush
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
 
//#define mp make_pair
#define bug(x) cout << x << endl
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define pb emplace_back
#define vii vector<int>
#define vll vector<ll>
#define vpll vector< pair <ll,ll> >
#define pll pair <ll,ll>
#define pii pair <int,int>
#define pq priority_queue< int >
#define khtm "\n"
#define F first
#define S second
#define fr(i,a,n) for(i=a;i<n;i++)
#define mem(arr,l) memset(arr,l,sizeof arr)
#define ALL(x) x.begin(), x.end()
#define frr(i,a,n) for(i=n-1;i>=a;i--)
#define mod 1000000007
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase ll T; cin>>T; while(T--)
const int MAX = 1e6 +2;
const int inf = (int) 1e9;
const int N = 1010;

/*
important builtin functions
__gcd(value1, value2)
__builtin_ffs(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
  Number of set bits: __builtin_popcount(x)
*/
 

ll i,j,k,l,m,r,n;
ll a[MAX];

ll powerX(ll x,  ll y) 
 
{  
    ll res = 1;     // Initialize result  
  
    x = x % mod; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % mod;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % mod;  
    }  
    return res;  
} 

int main()
{
 
  #ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
//cout << setprecision(15) << fixed;
fast

cin >> n >> k;
a[k] = 1;
ll ans = k;
for(i = k-1 ; i>=1 ; i--)
{
	ll tmp = k/i;
	a[i] = powerX(tmp,n);
	for(j = 2*i ; j <= k ; j+=i)
	{
		a[i] = a[i] + mod - a[j];
		if(a[i] >= mod)
			a[i] -= mod;
	}
	ans = ans + ((a[i]%mod) * (i%mod));

}
cout << ans % mod;


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

Measured memory_bytes: 4428
#include <bits/stdc++.h>
// atoi : atoi(変数名.c_str())
// to_string(数値)
// %0桁数d とすると表示桁数が「桁数」に満たない場合に0埋めされる
// find(): int i = 変数名.find(“文字列”) 何番目にあるかを得る
// cout << (条件 ? "Yes" : "No") << endl;
// printf("%02d:%02d:%02d",hour,minute,second);
// 降順 sort(a.begin(),a.end(),greater<int>());
// bitset<ビット数> 変数名;  // すべてのビットが0の状態で初期化される
// bitset<ビット数> 変数名("ビット列");  // 指定したビット列で初期化される
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  char a,b;
  cin >> a >> b;
  if(a > b) cout << ">" << endl;
  else if(a < b) cout << "<" << endl;
  else cout << "=" << endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

class Main {

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

  private Scanner sc = new Scanner(System.in);

  private void run() {
    int[][] card = new int[3][3];
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        card[i][j] = Integer.parseInt(sc.next());
      }
    }

    int N = Integer.parseInt(sc.next());
    boolean[][] bingo = new boolean[3][3];
    for (int i = 0; i < N; i++) {
      int number = Integer.parseInt(sc.next());
      for (int j = 0; j < 3; j++) {
        for (int k = 0; k < 3; k++) {
          if (card[j][k] == number) {
            bingo[j][k] = true;
          }
        }
      }
    }

    if (bingo[0][0] && bingo[0][1] && bingo[0][2]) {
      System.out.println("Yes");
    } else if (bingo[1][0] && bingo[1][1] && bingo[1][2]) {
      System.out.println("Yes");
    } else if (bingo[2][0] && bingo[2][1] && bingo[2][2]) {
      System.out.println("Yes");
    } else if (bingo[0][0] && bingo[1][0] && bingo[2][0]) {
      System.out.println("Yes");
    } else if (bingo[0][1] && bingo[1][1] && bingo[2][1]) {
      System.out.println("Yes");
    } else if (bingo[0][2] && bingo[1][2] && bingo[2][2]) {
      System.out.println("Yes");
    } else if (bingo[0][0] && bingo[1][1] && bingo[2][2]) {
      System.out.println("Yes");
    } else if (bingo[0][2] && bingo[1][1] && bingo[2][0]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 23892
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
int kaisu;
int x,y,z;
int kekka;

cin >> kaisu;

for(int i = 1; i <= kaisu; i++){
cin >> x >> y >> z;
int array[3];
array[0] = x;
array[1] = y;
array[2] = z;
if( array[0] < array[1] ){
swap(array[0],array[1]);
}
if( array[0] < array[2] ){
swap(array[0],array[2]);
}
if( array[1] < array[2] ){
swap(array[1],array[2]);
}

if ((array[1]*array[1]+array[2]*array[2]) == array[0]*array[0]){
cout << "YES"<<endl;
}
else {
cout << "NO" << endl;
}

}

return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    // cout << setprecision(8) << setiosflags(ios::fixed);

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

    if (m <= 1) {
        if (k != 0) cout << "-1\n";
        else {
            const int len = pow(2, m);
            for (int i = 0; i < len; ++i)
                cout << i << " " << i << " \n"[i == len - 1];
        }
    }
    else {
        if (pow(2, m) <= k) cout << "-1\n";
        else {
            const int ub = pow(2, m) - 1;
            for (int i = 0; i <= ub; ++i)
                if (i != k) cout << i << " ";
            cout << k << " ";
            for (int i = ub; 0 <= i; --i)
                if (i != k) cout << i << " ";
            cout << k << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s;
    cin >> s;
    if (s.size() >= 4 && string(s.begin(), s.begin() + 4) == "YAKI") {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
 
    return 0;
}

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

vector<vector<int>> a(100001);
int s[100001];
int count(int i)
{
    int t=0;
    int j;
    for(j=0;j<a[i].size();j++)
    {
        if(s[a[i][j]]==-1)
        s[a[i][j]]= 1+count(a[i][j]);

        if(t<s[a[i][j]])
        t=s[a[i][j]];
    }
    return t;
}
int main()
{
  int n,m,x,y,i;
  cin>>n>>m;
  
  for(i=0;i<m;i++)
    {
        cin>>x>>y;
        a[x].push_back(y);
    }
  int t=0;
  
  memset(s,-1,sizeof(s));

  for(i=1;i<=n;i++)
  {
      if(s[i]==-1)
      {
          s[i]=1+count(i);
      }
      if(t<s[i])
      t=s[i];
  }
  cout<<t-1;
    
  return 0;
}


Measured memory_bytes: 8192
#include "bits/stdc++.h"
using namespace std;

int n;
string s,c;
stack<char> stk;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>n>>s;
	c=s;
	for(int i=0;i<n;i++){
		if(s[i]=='('){
			stk.push(s[i]);
		}
		else if(s[i]==')' && stk.empty()){
			// add ( or ) to string s
			c = '(' + c;
		}
		else if(s[i]==')' && !stk.empty()){
			// works, pop
			stk.pop();
		}
	}
	while(!stk.empty()){
		c+=')';
		stk.pop();
	}
	cout<<c;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main
{
	static int h,w;
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		int dx[]={1,0,-1,0};
		int dy[]={0,1,0,-1};
		int M=100000;
		for(;;)
		{
			w=in.nextInt();
			h=in.nextInt();
			if((w|h)==0)
				return;
			int field[][]=new int[h][w];
			int cost[]=new int[4];
			for(int i=0;i<h;i++)
				for(int j=0;j<w;j++)
					field[i][j]=in.nextInt();
			for(int i=0;i<4;i++)
				cost[i]=in.nextInt();
			int dp[][][]=new int[h][w][4];//現在置と向いてる方向
			boolean visit[][][]=new boolean[h][w][4];
			visit[0][0][0]=true;
			for(int i=0;i<h;i++)
				for(int j=0;j<w;j++)
					for(int k=0;k<4;k++)
						dp[i][j][k]=M;
			dp[0][0][0]=0;
			for(;;)
			{
				boolean flag=false;
				for(int i=0;i<h;i++)
					for(int j=0;j<w;j++)
						for(int k=0;k<4;k++)
						{
							if(!visit[i][j][k])
								continue;
							for(int l=0;l<4;l++)
							{
								int addcost=cost[l];
								int nextk=k;
								if(field[i][j]==l)
									addcost=0;
								nextk=(k+l)%4;
								int nexth=i+dy[nextk];
								int nextw=j+dx[nextk];
								if(nextw>=0&&nexth>=0&&nextw<w&&nexth<h)
								{
									if(dp[nexth][nextw][nextk]>dp[i][j][k]+addcost)
									{
										dp[nexth][nextw][nextk] = dp[i][j][k] + addcost;
										flag=visit[nexth][nextw][nextk]=true;
									}
								}
							}
						}
				if(!flag)
					break;
			}
			int ans=M; 
			for(int k=0;k<4;k++) 
				ans= Math.min(ans, dp[h-1][w-1][k]);
			System.out.println(ans);
		}
	}
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0; i < n; i++) {
			if(a[i] % 2 != 0 && (i+1) % 2 != 0) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}


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

int k,j,x;
string a;
char i,z;
bool ada[27],valid;


int main(){
	cin>>a;
    for(i='a';i<='z';i++){
        for(j=0;j<=a.length()-1;j++){
            x=0;
            if(a[j]==i){
                x=i-'a'+1;
                ada[x]=true;
            }
        }
    }
    valid=false;
    for(k=1;k<=26;k++){
        if(ada[k]==false){
            valid=true;
            z='a'+k-1;
            cout<<z;
            break;
        }
    }
    if(valid==false){
        cout<<"None";
    }
}

Measured memory_bytes: 3736
import java.util.*;


public class Main {
	public static void main(String[] args) {
		try {
			Scanner sc = new Scanner(System.in);
			while(true){
				int a = sc.nextInt(), d = sc.nextInt(), n = sc.nextInt();

				if(a==0&&d==0&&n==0){
					sc.close();
					break;
				}

				int index = 0;
				while(true){
					if(prime(a)){
						index++;
					}
					if(index==n) break;
					a += d;
				}

				System.out.println(a);
			}
			sc.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static boolean prime(int a){
		if(a==1) return false;
		int limit = (int)Math.sqrt(a);

		boolean p = true;
		for(int i=2;i<=limit;i++){
			if(a%i==0){
				p = false;
				break;
			}
		}

		return p;
	}
}

Measured memory_bytes: 20956
#!/usr/bin/env python

n = int( input() )
xy = []
for _ in range(n): xy.append( [ int(x) for x in input().strip().split() ] )
#
if n==1:
    print( 1 )
    exit()
#
xy.sort( key=lambda x: (x[0],x[1]) )
distmap = dict()
for i in range(n):
    xi,yi = xy[i]
    for j in range(i+1,n):
        xj, yj = xy[j]
        xd = xj - xi
        yd = yj - yi
        k = "{} {}".format(xd,yd)
        distmap[k]= distmap.get(k,0) + 1
#
d = max( distmap.values() )
print( n-d )


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

using namespace std;

int main(){

  int n,m;

  while(1){

	cin >> n >> m;

	if(n == 0 && m == 0)
	  break;

	vector<string> N(n);
	vector<int> M(n);
	vector<string> B(m);

	for(int i=0;i<n;++i)
	  cin >> N[i] >> M[i];

	for(int i=0;i<m;++i)
	  cin >> B[i];

	int sum = 0;
	
	for(int i=0;i<n;++i){
	  for(int j=0;j<m;++j){
		for(int k=7;k>=0;--k){
		  if(N[i][k] == '*' || (k == 0 && N[i][k] == B[j][k])){
			sum += M[i];
			break;
		  }
		  
		  if(N[i][k] != B[j][k])
			break;
		  
		}
	  }
	}
	cout << sum << endl;
  }

}



Measured memory_bytes: 3228
N=int(input())
c=input()
right_r=0
right_w=0
left_r=0
left_w=0
for i in range(N):
	if c[i]=='R':
		right_r+=1
	else:
		right_w+=1
ans=right_r
for j in range(N):
	cnt=0
	if c[j]=='W':
		left_w+=1
		right_w-=1
	else:
		left_r+=1
		right_r-=1
	if right_r<=left_w:
		cnt+=right_r
		cnt+=left_w-right_r
	else:
		cnt+=left_w
		cnt+=right_r-left_w
	if cnt<ans:
		ans=cnt
print(ans)

Measured memory_bytes: 9440
#include <stdio.h>

int main(void) {
    int i, j, N, B[64] = {0};
    long long max, f = 0LL, D, K, A[100010];
    scanf("%d%lld", &N, &K);
    for (i=1;i<=N;i++) {
        scanf("%lld", &A[i]);
        for (j=0;j<=63;j++) {
            if (A[i] & (1LL<<j)) B[j]++;
        }
    }

    max = 0LL;
    if (K > 0) {
        D = 0LL;
        for (j=63-__builtin_clzll(K);j>=0;j--) {
            if (N > 2*B[j] && D + (1LL<<j) <= K) {
                max += (N - 2*B[j]) * (1LL<<j);
                D += 1LL<<j;
            }
        }
    }
    for (j=0;j<=63;j++) {
        f += B[j] * (1LL<<j);
    }
    f += max;
    printf("%lld\n", f);
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include<math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)

int K[100001][3];
int dp[100001][3];

int main() {
	int N;
	cin >> N;
	
	
	rep(i, N) {
		rep(j, 3) {
			cin >> K[i][j];
		}
	}

	rep(i, N) {
		for (int j = 0; j < 3; ++j) {
			for (int x = 0; x < 3; ++x) {
				if (j == x)continue;
					if(dp[i][j] < dp[i - 1][x] + K[i][j])dp[i][j] = dp[i - 1][x] + K[i][j];
			}
		}
	}
	
	int ans = 0;
	rep(i, 3) {
		if (ans < dp[N - 1][i])ans = dp[N - 1][i];
	}

	cout << ans << endl;


return 0;
} 

Measured memory_bytes: 2560
#include <stdio.h>

#define MAX(A,B) \
  ( (A) > (B) ? (A) : (B) )

char  d[ 1024 ][ 1024 ];
int   n;

static int
solve (
  int x,
  int y
  )
{
  int res;
  int i;

  for ( res = 0; x + res < n && y + res < n; ++res )
  {
    for ( i = 0; i <= res; ++i )
    {
      if ( d[ y + res ][ x + i ] != '.'
        || d[ y + i ][ x + res ] != '.' )
      {
        return ( res );
      }
    }
  }

  return ( res );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int i;

  for ( ; ; )
  {
    int res = 0;
    int x, y;

    scanf ( " %d", &n );
    if ( !( n ) ) break ;

    for ( i = 0; i < n; ++i )
    {
      scanf ( " %s", d[ i ] );
    }

    for ( y = 0; y < n; ++y )
    for ( x = 0; x < n; ++x )
    {
      res = MAX( res, solve ( x, y ) );
    }

    printf ( "%d\n", res );
  }

  return ( 0 );
}

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

int main()
{
    int n,i;
    cin >> n;
    vector<int> ans(n);
    for(i=1;i<n;i++){
        int a;//いちいち初期化//
        cin >> a;
        ans[a-1]++;
    }
    for(i=0;i<n;i++){
        cout << ans[i] << endl;
    }
    return 0;

}

Measured memory_bytes: 3988
#include<stdio.h>
#include<string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

// ??????????????°????????????
int getChar(char ch) {
    if(ch == 'A') return 1;
    else if(ch == 'C') return 2;
    else if(ch == 'G') return 3;
    else if(ch == 'T') return 4;
    else return 0;
}

// ?????????????????°??????????????????key???????????????
long long getKey(char str[]) {
    long long sum = 0, p = 1, i;
    for ( i = 0; i < strlen(str); i++) {
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M - 1)); }

int find(char str[]) {
    long long key, i, h;
    key = getKey(str); //??????????????°????????????
    for ( i = 0; ; i++) {
        h = (h1(key) + i * h2(key)) % M;
        if( strcmp(H[h], str) == 0 ) return 1;
        else if( strlen(H[h]) == 0 ) return 0;
    }
    return 0;
}

int insert(char str[]) {
    long long key, i, h;
    key = getKey(str); // ??????????????°????????????
    for ( i = 0; ; i++) {
        h = (h1(key) + i * h2(key)) %M;
        if(strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0) {
            strcpy(H[h], str);
            return 0;
        }
    }
    return 0;
}

int main() {
    int i, n, h;
    char str[L], com[9];
    for( i =0; i<M; i++ ) H[i][0] = '\0';
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%s %s", com, str); //?????????????????¢??°

        if(com[0] == 'i') {
            insert(str);
        } else {
            if( find(str) ) {
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }
    return 0;
}

Measured memory_bytes: 17048
#include <bits/stdc++.h>
    
#define int long long
    
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
#define MOD (int)(1e9)+7
    
using namespace std;
    
int dy[4]={1, 0, -1, 0};
int dx[4]={0, 1, 0, -1};
    
bool check(int a, int b){
    if((a<=0 && b>0) || (a>=0 && b<0)) return true;
    return false;
}
    
int32_t main(){
    int n;
    cin >> n;
    
    int sum=0;
    FOR(i, 1, n+1){
        sum+=i;

        if(sum>=n){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 384
#!/usr/bin/env python
#pyrival orz
import os
import sys
from io import BytesIO, IOBase

"""
    for _ in range(int(input())):
    n,m=map(int,input().split())
    n=int(input())
    a = [int(x) for x in input().split()]
"""

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    a.sort(reverse=True)
    # print(a)
    ans=0
    k=n
    ans-=a[0]
    for x in a:
        if k==0:
            break
        if k==1:
            ans+=x
            break
        ans+=2*x
        k-=2
    print(ans)

# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Measured memory_bytes: 95192
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
using namespace std;

int gcd(int a, int b);

int main()
{
    int N, X;
    cin >> N >> X;
    vector<int> x;
    for(int i=0; i<N; i++)
    {
    	int y;
    	cin >> y;
    	x.push_back(y);
    }

    for(int i=0; i<N; i++)
    {
    	x[i] = abs(x[i]-X);
    }
    
    int ans = x[0];
    for(int i=1; i<N/2+1; i++)
    {
    	ans = gcd(x[i], gcd(ans, x[N-i]));
    }

    cout << ans << endl;

	return 0;
}


int gcd(int a, int b)
{
    int m = min(a,b);
    int M = max(a,b);
	if(M%m==0) return m;
	else return gcd(m, M%m);
}

Measured memory_bytes: 892
void main() {
	auto ip = readAs!(int[]), A = ip[0], B = ip[1], C = ip[2];
	ip.sort();
	writeln((ip[0] * ip[1]) / 2);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


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

using namespace std;

int main(){
        int N;
        cin>>N;
        vector <int> a1, a2;
        for(int i=0;i<N;i++){
                int aa;
                cin>>aa;
                a1.push_back(aa);
        }
        for(int i=0;i<N;i++){
                int aa;
                cin>>aa;
                a2.push_back(aa);
        }
        int ans=a1[0];
        for(int i=0;i<N;i++){
                ans+=a2[i];
        }
        int vans=ans;
        for(int i=1;i<N;i++){
                vans+=a1[i];
                vans-=a2[i-1];
                ans=max(vans, ans);
        }
        cout<<ans<<endl;
        return 0;
}


Measured memory_bytes: 256
h,w,k = map(int,input().split())
raw = []
for _ in range(h):
  tmp = input()
  add = []
  for j in range(w):
    if tmp[j] == '.':
      add.append(0)
    else:
      add.append(1)
  raw.append(add)
ans = 0
time1 = [0 for i in range(h)]
time2 = [0 for j in range(w)]
def nex(time):
  l = len(time)
  for i in range(l):
    if time[i] == 0:
      time[i] = 1
      return time
    else:
      time[i] = 0
  else:
    return 'over'
from copy import deepcopy as dc
while time1 != 'over':
  use = dc(raw)
  for i in range(h):
    if time1[i] == 1:
      for j in range(w):
        use[i][j] = 0
  while time2 != 'over':
    now = dc(use)
    for j in range(w):
      if time2[j] == 1:
        for i in range(h):
          now[i][j] = 0
    cnt = 0
    for i in range(h):
      cnt += sum(now[i])
    #print(time1,time2,cnt)
    if cnt == k:
      ans += 1
    time2 = nex(time2)
  time1 = nex(time1)
  time2 = [0 for _ in range(w)]
print(ans)
#print(raw)

Measured memory_bytes: 75144
N = int(input())
B = [int(i) for i in input().split(" ")]
B.append(10**5+1)
Sum = B[0]

for i in range(N-1):
    Sum += B[i]
    if B[i+1]<B[i]:
        Sum = Sum -B[i] + B[i+1]
print(Sum)

Measured memory_bytes: 3060
import scala.io.StdIn._
 
object Main extends App{
  val sc = new java.util.Scanner(System.in)
  val n = sc.next
  if((n(0)==n(1))&&(n(1)==n(2))||(n(1)==n(2))&&(n(2)==n(3))){
    println("Yes")
  }
  else{
    println("No")
  }  
}

Measured memory_bytes: 27456
const input = require('fs').readFileSync('/dev/stdin', 'utf-8').trim();
const num_pairs = input.split(/\r?\n/).map(str => str.split(" ").map(n => Number(n)));

for (let l = 0; l < num_pairs.length; l++) {
  const H = num_pairs[l][0];
  const W = num_pairs[l][1];

  if (H === 0 && W === 0) break;

  for (let i = 0; i < H; i++) {
    for (let j = 0; j < W; j++) {
      if ( (i+j) % 2 === 0) {
        process.stdout.write("#");
      } else {
        process.stdout.write(".");
      }
    }
    console.log("");
  }
  console.log("");
}



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

using namespace std;

bool f(char ch,char *s)
{
    int len=strlen(s);
    for(int i=0; i<len; i++)
        if(ch==s[i])return false;
    return true;
}

int main()
{
    char s[110],ss[110];
    int n,an=0,t,k;
    cin>>n>>s;
    for(int p=1; p<=n; p++)
        {
            k=0;t=0;
            memset(ss,0,sizeof(ss));
            for(int i=0; i<p; i++)
            for(int j=n-1; j>=p; j--)
                if(s[i]==s[j]&&f(s[i],ss))
                {
                    t++;
                    ss[k++]=s[i];
                    break;
                }
            if(t>an)an=t;
        }
    cout<<an;
    return 0;
}


Measured memory_bytes: 256
import math
a,b,C=map(int,input().split())
C=math.radians(C)
S=a*b*math.sin(C)/2
L=math.sqrt(a**2+b**2-2*a*b*math.cos(C))+a+b
h=b*math.sin(C)
print(S)
print(L)
print(h)

Measured memory_bytes: 7816
#include <iostream>
#include <string>
typedef long long ll;

int main() {
  int n,i,tmp=0,ans=0;
  ll a[100000];
  std::cin >> n;
  for (i=0;i<n;++i)std::cin >> a[i];
  for (i = 0; i < n-1; ++i) {
    if (a[i]>=a[i+1]){
      ++tmp;
      if (tmp>ans){ans=tmp;}
    }else{
      tmp=0;

    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1024
import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))
from collections import defaultdict


def main():
    _ = int(input())
    a = list(sorted(map(int, input().split())))
    dicta = defaultdict(lambda: 0)
    for _a in a:
        dicta[_a] += 1
    
    ans = 0
    for da in reversed(a):
        if dicta[da] <= 0:
            continue
        dicta[da] -= 1
        aa2 = 1
        while da >= aa2:
            aa2 *= 2
        
        if aa2-da in dicta and dicta[aa2-da] > 0:
            dicta[aa2-da] -= 1
            ans += 1
    
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 104276
#include<bits/stdc++.h>
using namespace std;
int n,k,i,w[1<<17],ng,ok=1e9,m,t,r;
int f(int m){
  r=1;t=0;
  for(i=0;i<n;i++){
    t+=w[i];
    if(t>m)r++,t=w[i];
    if(w[i]>m)return 0;
  }
  return r<=k;
}
int main(){
  cin>>n>>k;
  for(i=0;i<n;i++)cin>>w[i];
  while(abs(ok-ng)>1){
    m=(ok+ng)/2;
    if(f(m))ok=m;
    else ng=m;
  }
  cout<<ok<<endl;
}



Measured memory_bytes: 3512
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int p;fixprec(int p):p(p){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.p);}
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> H(N);
    for(int &h : H) cin >> h;
    vector2d<int> edge(N);
    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    int ans = 0;
    for(int i = 0; i < N; i++) {
        bool x = true;
        for(int j : edge[i]) {
            x &= H[j] < H[i];
        }
        ans += x ? 1 : 0;
    }
    cout << ans << endl;
    return 0;
}



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

using namespace std;
static const int SIZE = 1000001;
int dp[SIZE];

void solve()
{
	long long int n, a, b;
	while (cin >> n >> a >> b, n || a || b)
	{
		memset(dp, 0, sizeof(dp));
		dp[0] = 1;
		for (int i = 0; i <= n; ++i)
		{
			if (dp[i] == 1)
			{
				if (i + a <= n)
				{
					dp[i + a] = 1;
				}
				if (i + b <= n)
				{
					dp[i + b] = 1;
				}
			}
		}
		int ans = 0;
		for (int i = 1; i <= n; ++i)
		{
			if (dp[i] == 0)
			{
				++ans;
			}
		}
		cout << ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 5076
#![allow(unused_imports)]
#![allow(clippy::many_single_char_names)]

// language: Rust(1.42.0)
// check available crates on AtCoder at "https://atcoder.jp/contests/language-test-202001"
// My Library Repo' is at "https://github.com/Loptall/prcn_lib"

/*
    そう甘くはないんだな〜w
*/

// from std...
use std::cmp::{
    max, min, Ordering,
    Ordering::{Equal, Greater, Less},
    Reverse,
};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::convert::TryInto;
use std::mem::swap;
use std::num::{NonZeroU32, ParseIntError};
use std::ops::{
    Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div, DivAssign,
    Index, IndexMut, Mul, MulAssign, Neg, Rem, RemAssign, Shl, ShlAssign, Shr, ShrAssign, Sub,
    SubAssign,
};
use std::process::exit;
use std::{f32, f64, i128, i16, i32, i64, i8, isize, u128, u16, u32, u64, u8, usize};

// Dep' crates are...
use itertools::*;
use itertools_num::*;
use lazy_static::lazy_static;
use maplit::{btreemap, btreeset, hashmap, hashset};
use num_bigint::{BigInt, BigUint};
use num_complex::Complex;
use num_integer::{binomial, gcd, lcm, multinomial, Integer};
use num_rational::Rational;
use num_traits::{clamp, one, pow, zero, Num, NumAssignOps, NumOps, One, Pow, Zero};
use permutohedron::Heap;
use proconio::{
    fastout, input, is_stdin_empty,
    marker::{Bytes, Chars, Isize1, Usize1},
};
use rand::random;

pub const MOD10E9_7: usize = 1000000007;
pub const MOD99_: usize = 998244353;
pub const MAX: usize = std::usize::MAX;
pub const PI: f64 = f64::consts::PI;
pub const A: u8 = 65;

// code...
// #[fastout]
fn main() {
    input! {
        n: usize, k: usize
    }

    let ans = (1900 * k + 100 * (n - k)) * 2usize.pow(k as u32);
    println!("{}", ans);
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define hell 1000000007
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll long long 
#define pi 3.14159265358979323846
using namespace std;
//const ll N=1e18;
ll pr(ll a,ll b,ll c)
{
	if(b==0)
	return 1LL;
	ll ans=1;
	while(b>0)
	{
		if(b%2)
		ans=((ans%c)*(a%c))%c;
		a=((a%c)*(a%c))%c;
		b/=2;
		a%=c;
		ans%=c;
	}
	return ans;
}

void solve()
{ll k,n,m,x,h,l,r,c,d,w,mini,maxi=INT_MAX,prev,res;
 long double a,b;
 cin>>a>>b;
 a*=b;
 cout<<(ll)floor(a);
}

  
int main()
{
  fast
  //for(ll i=0;i<=9;i++)
  //cal(1,3234566667,i);
  //sort(v.begin(),v.end());
  //pre();
ll t=1;
//chk();
//cin>>t;
//SieveOfEratosthenes();
//cout<<"ok";
while(t--)
{ //cout<<"ok";

solve();
 //cout<<ma<<endl;
}
return 0;}
/*
ll pr(ll a,ll b,ll c)
{
	if(b==0)
	return 1LL;
	ll ans=1;
	while(b>0)
	{
		if(b%2)
		ans=((ans%c)*(a%c))%c;
		a=((a%c)*(a%c))%c;
		b/=2;
		a%=c;
		ans%=c;
	}
	return ans;
}
vector<ll> fact(N+1);
void pre()
{
	fact[0]=1;
	for(ll i=1;i<=N;i++)
	fact[i]=fact[i-1]*i,fact[i]%=hell;
	
}
*/

Measured memory_bytes: 3752
#!/usr/bin/env python3
n, a, b, c = map(int, input().split())
s = [input() for _ in range(n)]
ans = []
for i in range(n):
    if s[i] == "AB":
        if a < b:
            ans.append("A")
            a += 1
            b -= 1
        elif a > b:
            ans.append("B")
            a -= 1
            b += 1
        else:
            if i + 1 < n and s[i + 1] == "AC":
                ans.append("A")
                a += 1
                b -= 1
            else:
                ans.append("B")
                a -= 1
                b += 1
    if s[i] == "AC":
        if a < c:
            ans.append("A")
            a += 1
            c -= 1
        elif a > c:
            ans.append("C")
            a -= 1
            c += 1
        else:
            if i + 1 < n and s[i + 1] == "AB":
                ans.append("A")
                a += 1
                c -= 1
            else:
                ans.append("C")
                a -= 1
                c += 1
    if s[i] == "BC":
        if b < c:
            ans.append("B")
            b += 1
            c -= 1
        elif b > c:
            ans.append("C")
            b -= 1
            c += 1
        else:
            if i + 1 < n and s[i + 1] == "AB":
                ans.append("B")
                b += 1
                c -= 1
            else:
                ans.append("C")
                b -= 1
                c += 1
    if a < 0 or b < 0 or c < 0:
        print("No")
        exit()
print("Yes")
print(*ans, sep="\n")


Measured memory_bytes: 91700
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
//    for(auto& it : m)
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
//  priority_queue<ll int> pq;
//  priority_queue <ll int, vector<ll int>, greater<ll int> > pq;
//  vector<ll int> v;
//  vector< pair<ll int,ll int> > v;
//  set<ll int>::iterator it=s.begin();
//  unordered_map<  pair<ll int,ll int>, ll int> mp;

ll int power(ll int x, ll int y, ll int p)  
{  
   ll int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
int n,m;
bool isval(int x,int y)
{
  if(x<0||x>n-1||y<0||y>m-1)
    return false;
  return true;
}

int main()
{
  fastio();
ll int T;
T=1;


while(T--)
{
ll int k,x,i,j,flag;
ll int n,m;
cin>>n>>m>>x;
int bk[m],a[n][m],c[n],tans=0,ans=INT_MAX;
for(i=0;i<n;i++)
{cin>>c[i];
  for(j=0;j<m;j++)
  {
    cin>>a[i][j];
  }
}
for(i=0;i<=pow(2,n)-1;i++)
{
  flag=0;tans=0;
  for(j=0;j<m;j++)bk[j]=0;
  for(j=0;j<n;j++)
  {
    ll int tt=pow(2,j);
    if(tt&i)
    {
      tans+=c[j];
      for(k=0;k<m;k++)
      {
        bk[k]+=a[j][k];
      }
    }
    
  }
 // cout<<tans<<endl;
  for(j=0;j<m;j++)
    {
      if(bk[j]<x)
        flag=1;
    }
    if(!flag)ans=min(ans,tans);

}
if (ans==INT_MAX)ans=-1;
cout<<ans<<endl;
}
    return 0;
}

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

signed main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);

    int n, m, c;
    std::cin >> n >> m >> c;

    std::vector<int> b(m);
    for (int &i : b) std::cin >> i;

    std::vector<std::vector<int>> a(n, std::vector<int>(m));
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            std::cin >> a[i][j];
        }
    }

    int ans = 0;

    for (int i = 0; i < n; i++) {
        int sum = c;
        for (int j = 0; j < m; j++) {
            sum += a[i][j] * b[j];
        }

        ans += (sum > 0);
    }

    std::cout << ans;

    return 0;
}

Measured memory_bytes: 3644
#include <iostream>

using namespace std;

void print(int[], int);

int main(){
//	SelectionSort(A)
//	1 for i = 0 to A.length-1
//	2     mini = i
//	3     for j = i to A.length-1
//	4         if A[j] < A[mini]
//	5             mini = j
//	6     swap A[i] and A[mini]
	int N, i, j, mini, cnt = 0;
	cin >> N;
	int A[N];
	for(i = 0; i < N; i++){
		cin >> A[i];
	}
	for(i = 0; i < N; i++){
		mini = i;
		for(j = i; j < N; j++){
			if(A[j] < A[mini]){
				mini = j;
			}
		}
		if(i != mini){
			swap(A[i], A[mini]);
			cnt++;
		}
	}
	print(A, N);
	cout << cnt << endl;
	return 0;
}

void print(int A[], int N){
	cout << A[0];
	for(int k = 1; k < N; k++){
		cout << ' ' << A[k];
	}
	cout << endl;
}


Measured memory_bytes: 3072
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include<queue>
#include<set>
#include<climits>
using namespace std;

int main()
{
  int n, d, x, result = 0;
  int a[d];

  cin >> n >> d >> x;

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

  for (int i = 0; i < n; i++)
  {
    int date = 0, l = 1;
    while (date <= d)
    {
      date = a[i] * (l) + 1;
      l++;
      result++;
    }
  }

  cout << result + x << endl;

}


Measured memory_bytes: 256
sx, sy,tx,ty = map(int,input().split())
rout =''
for i in range(tx-sx):
	rout = rout +'R'
for i in range(ty-sy):
	rout = rout +'U'
for i in range(tx-sx):
	rout = rout +'L'
for i in range(ty-sy):
	rout = rout +'D'
rout = rout + 'D'
for i in range(tx-sx+1):
	rout = rout + 'R'
for i in range(ty-sy+1):
	rout = rout + 'U'
rout = rout +'L'

rout = rout + 'U'
for i in range(tx-sx+1):
	rout = rout + 'L'
for i in range(ty-sy+1):
	rout = rout + 'D'
rout = rout +'R'
print(rout)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int A, B, Q; ll S[101010], T[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> A >> B >> Q;
    rep(i, 0, A) cin >> S[i];
    rep(i, 0, B) cin >> T[i];


    rep(q, 0, Q) {
        ll x; cin >> x;
        ll ans = infl;

        // 左だけ
        if (S[0] < x and T[0] < x) {
            int s = lower_bound(S, S + A, x) - S - 1;
            int t = lower_bound(T, T + B, x) - T - 1;
            chmin(ans, max(x - S[s], x - T[t]));
        }

        // 右だけ
        if (x < S[A-1] and x < T[B-1]) {
            int s = lower_bound(S, S + A, x) - S;
            int t = lower_bound(T, T + B, x) - T;
            chmin(ans, max(S[s] - x, T[t] - x));
        }

        // 左右
        ll shrine = infl;
        if (S[0] < x) {
            int id = lower_bound(S, S + A, x) - S - 1;
            chmin(shrine, x - S[id]);
        }
        if (x < S[A - 1]) {
            int id = lower_bound(S, S + A, x) - S;
            chmin(shrine, S[id] - x);
        }
        
        ll temple = infl;
        if (T[0] < x) {
            int id = lower_bound(T, T + B, x) - T - 1;
            chmin(temple, x - T[id]);
        }
        if (x < T[B - 1]) {
            int id = lower_bound(T, T + B, x) - T;
            chmin(temple, T[id] - x);
        }
        chmin(ans, shrine*2 + temple);
        chmin(ans, shrine + temple * 2);

        printf("%lld\n", ans);
    }
}


Measured memory_bytes: 2944
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_assignments)]
use proconio::input;
use proconio::marker::Usize1;
use std::collections::*;
use std::cmp::*;
use std::f64::consts::*;

const MOD: u64 = 1000000007;
const INF: usize = std::usize::MAX / 4;

fn main() {
    input! {
        N: usize,
    }

    let mut ans = 0;
    for i in 1..N+1 {
        if i % 3 != 0 && i % 5 != 0 {
            ans += i;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2112
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func max(a int, b int) int {
	if a >= b {
		return a
	}
	return b
}

func solve(N int, M int) [][]int {
	res := make([][]int, M)
	if N % 2 == 1 {
		for i := 0; i < M; i++ {
			res[i] = []int{i + 1, N - i}
		}
	} else {
		preM := (M+1) / 2
		for i := 0; i < preM; i++ {
			res[i] = []int{i + 1, N - i}
		}
		for i := preM; i < M; i++ {
			res[i] = []int{i + 1, N - i - 1}
		}
	}

	return res
}

var sc = bufio.NewScanner(os.Stdin)

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

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

func nextInt64() int64 {
	sc.Scan()
	hoge := sc.Text()
	i, e := strconv.ParseInt(hoge, 0, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N, M := nextInt(), nextInt()
	//fmt.Println(solve(N, M))
	res := solve(N, M)
	for _, v := range res {
		fmt.Printf("%d %d\n", v[0], v[1])
	}
}


Measured memory_bytes: 6628
a=int(input())
b=int(input())
c=int(input())
x=int(input())

cnt=0

for i in range(a+1):
    ayen=i*500
    if ayen<=x:
        for j in range(b+1):
            byen=j*100
            if ayen+byen<=x:
                extra=x-ayen-byen
                if extra<=c*50:
                    cnt+=1

print(cnt)

Measured memory_bytes: 9196
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<list>
#include<vector>
#include<cmath>

using namespace std;

int main(){

    int a, b;
    cin >> a >> b;

    if(a<6)b = 0;
    else if(a<13)b = b/2;

    cout << b << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  string s; cin >> s;
  set<char> chars;
  for (int i = 0; i < s.size(); i++)
    chars.insert(s[i]);
  
  for (int i = 0; i < 26; i++) {
    char c = (char)('a' + i);
    // debug(c);
    if (chars.find(c) == chars.end()) {
      outl(c);
      return;
    }
  }
  outl("None");
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>

char str[1000005];
int dy[1000005][2];

int min(int a, int b) {
	if (a > b) return b;
	return a;
}

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

int main(void) {
	scanf("%s", str);
	int len = strlen(str);
	int sum = 0;
	int p = 1;
	for (int i = len-1; i >= 0; i--) {
		int val = str[i] - '0';
		if (i == len - 1) {
			dy[p][0] = val;
			dy[p][1] = 10 - val;
			p++;
		}
		else {
			dy[p][0] = min(val + dy[p - 1][0], val + 1 + dy[p - 1][1]);
			dy[p][1] = min(10 - val + dy[p - 1][0], abs(-(10 - val) + 1) + dy[p - 1][1]);
			p++;
		}
	}

	printf("%d", min(dy[len][0], dy[len][1] + 1));
	return 0;
}

Measured memory_bytes: 8960
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void print_YES_NO(bool answer){cout<<(answer?"YES":"NO")<<endl;}
void print_Yes_No(bool answer){cout<<(answer?"Yes":"No")<<endl;}
void print_POSSIBLE_IMPOSSIBLE(bool answer){cout<<(answer?"POSSIBLE":"IMPOSSIBLE")<<endl;}

int dp[200005];
char ca[200005];

int main(){
	int n;
	int i,j,k;
	int a,b,c;
	cin>>ca;
	n=strlen(ca);
	dp[1]=1;
	for(i=0;i<n;i++){
		dp[i+3]=max(dp[i]+2,dp[i+3]);
		if(i+2==n)dp[i+2]=max(dp[i]+1,dp[i+2]);
		if(ca[i+1]!=ca[i])dp[i+2]=max(dp[i+1]+1,dp[i+2]);
	}
	cout<<dp[n]<<endl;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define int long long
using namespace std;
using PII = pair<int, int>;
const int INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

struct Edge {
    int to;
    int idx;
    int color;
};

void dfs(map<int, vector<Edge>>& m, int from, int color, int k) {
    for (auto && x : m[from]) {
        if (color > k - 1) {
            color = 0;
        }
        x.color = ++color;
        dfs(m, x.to, color, k);
    }
}

signed main() {
    int n;
    cin >> n;
    vector<int> c(n, 0);
    map<int, vector<Edge>> m;
    int min_e = INF;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        min_e = min(min_e, a);
        c[a-1]++;
        c[b-1]++;
        m[a].push_back({b, i, 0});
    }
    int k = *max_element(c.begin(), c.end());
    dfs(m, min_e, 0, k);
    vector<int> ans(n - 1);
    for (auto&& x : m) {
        for (auto&& e : x.second) {
            ans[e.idx] = e.color;
        }
    }
    cout << k << "\n";
    for (auto&& x : ans) {
        cout << x << "\n";
    }
}

Measured memory_bytes: 13184
N,T =map(int,input().split())
k = [list(map(int,input().split())) for i in range(N)]
for i in range(len(k)):
    k[i].append(i)
k.sort(key=lambda k:k[1])
tt = [k[i] for i in range(N) if k[i][1]<=T]
if tt == []:
    print("TLE")
else:
    tt.sort(key=lambda k:k[0])
    print(tt[0][0])

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

int main(){
    int n, ans=0;
    string s, t="ABC";
    cin >> n >> s;

    rep(i, n){
        if(s.substr(i, 3)==t) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include <math.h>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for(int I = STAT; I > END; I--)

int main(){
    string N;
    cin >> N;
    int n, total = 0, num;
    n = N.size();
    num = stoi(N);
    Fp(i, 1, n - 1){
        if(i % 2 == 1){
            total += (pow(10, i) - pow(10, i - 1));
            //cout << i << ": " << total << endl;
        }
    }
    if((n - 1) % 2 == 1){
        total += (pow(10, n - 1) - pow(10, n - 2));
        //cout << n - 1 << ": " << total << endl;
    }
    if(n % 2 == 1){
        total += ((num - pow(10, n - 1)) + 1);
        //cout << n << ": "<< total << endl;
    }
    
    cout << total << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define vi vector<int>
#define Sort(v) sort(v.begin(),v.end())

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

void rect(int x,int y){
    rep(i,x){
        if(i == 0 || i==x-1){
            rep(j,y) cout <<"#";
        }
        else{
            cout << "#";
            rep(j,y-2) cout << ".";
            cout << "#";
        }
        cout << endl;
    }
    cout << endl;
}

int main(){
    while(true){
        int a,b;
        cin >> a >> b;
        
        if(a==0 and b==0) break;
        
        rect(a,b);
    }
    
    
}








Measured memory_bytes: 3088