akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x,y;
    for(int i=0;i<3000;i++){
        cin >> x >> y;
        if(x==0 && y==0){
            break;
        }
        if(x>y){
            cout << y << " " << x << endl; 
        }else cout << x <<" " <<  y << endl; 
    }
    return 0;
}



Measured memory_bytes: 3080
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

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

int n, m;

vector<int>graph[5678];
vector<int>ans;
int dev[5678];//in

int main()
{
	scanf("%d", &n);
	scanf("%d", &m);
	REP(i, m)
	{
		int win,lose;
		scanf("%d %d", &win, &lose);
		--win; --lose;
		graph[win].push_back(lose);
		dev[lose]++;
	}
	queue<int>que;
	REP(i, n)
	{
		if (!dev[i])
		{
			que.push(i);
			ans.push_back(i);
		}
	}
	while (!que.empty())
	{
		int q = que.front(); que.pop();
		for (auto to : graph[q])
		{
			--dev[to];
			if (!dev[to])
			{
				que.push(to);
				ans.push_back(to);
			}
		}
	}
	bool flag = true;
	REP(i, n - 1)
	{
		if (find(graph[ans[i]].begin(), graph[ans[i]].end(), ans[i + 1]) == graph[ans[i]].end())
		{
			flag = false;
		}
	}
	for (int v : ans)
	{
		printf("%d\n", v + 1);
	}
	printf("%d\n", flag ? 0 : 1);
	return 0;
}

Measured memory_bytes: 3416
from bisect import bisect_right as br
n,m,t=map(int,input().split())
arr=[]
brr=[]
for i in range(1):
    arr=list(map(int,input().split()))
    
for i in range(1):
    brr=list(map(int,input().split()))
for i in range(1,n):
    arr[i]+=arr[i-1]
for i in range(1,m):
    brr[i]+=brr[i-1]

#print(arr)
ans=0
for i in range(n):
    if(arr[i]<=t):
        ind=br(brr,t-arr[i])
        #print(t-arr[i],ind)
        ans=max(ans,ind+i+1)
ind=br(brr,t)
ans=max(ans,ind)
print(ans)
    


            
    
    
    


Measured memory_bytes: 40112
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a= new int[5];
		for(int i=0; i<5; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		for(int i=4; i>0; i--) {
			System.out.print(a[i] + " ");
		}
		System.out.println(a[0]);
	}
}



Measured memory_bytes: 26276
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
 
using namespace std;
 
double EPS = 1e-10;
 
int main() {
    double ax, ay, bx, by, cx, cy, dx, dy;
 
    while( cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy ) {
        bx -= ax; by -= ay;
        dx -= cx; dy -= cy;
 
        if( abs((bx * dx) + (by * dy)) < EPS ) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

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

using namespace std;

const int MAX_N = 50, MAX_M = MAX_N, INDEX = 1;

int n, m;

bool a[MAX_N + INDEX][MAX_N + INDEX], b[MAX_M + INDEX][MAX_M + INDEX];

bool isGood(int r, int c) {
    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= m; j++) {
            if (a[r + i - 1][c + j - 1] != b[i][j]) {
                return false;
            }
        }
    }

    return true;
}

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

    cin >> n >> m;

    for (int i = 1; i <= n; i++) {
        string s;

        cin >> s;

        for (int j = 1; j <= n; j++) {
            a[i][j] = s[j - 1] == '#';
        }
    }

    for (int i = 1; i <= m; i++) {
        string s;

        cin >> s;

        for (int j = 1; j <= m; j++) {
            b[i][j] = s[j - 1] == '#';
        }
    }

    for (int i = 1; i + m - 1 <= n; i++) {
        for (int j = 1; j + m - 1 <= n; j++) {
            if (isGood(i, j)) {
                cout << "Yes" << endl;

                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
// Problem : E - Red Scarf
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_e
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define vi vector<int>
#define vstr vector<string>
#define vdb vector<double>
#define vbool vector<bool>
#define vvi vector<vector<int> >
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define vpair vector<pii > 
#define mkp make_pair
#define scan(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) {cout<<a[i]<<' ';}cout<<'\n'
#define mem(a,v) memset(a,v,sizeof(a))
#define loop(i,a,b) for (int i = a; i < b; i++)
#define loope(i,a,b) for (int i = a; i <= b; i++)
#define bloop(i,a,b) for(int i = a;i>=b;i--)
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::fixed );std::cout.precision(9)
#define PI 3.14159265
#define S second
#define F first
#define CHECK cout<<"CHEDEDWB"<<endl
#define CHECK1(a) cout<<a<<endl
#define CHECK2(a,b) cout<<a<<' '<<b<<endl;
#define br '\n'
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
using namespace std;
int mod = 1e9+7;
int inf = 1e18;
int m_inf = INT_MIN;
// int extendedgcd(int a,int b,int &x,int &y){
	// if(a == 0){
		// x = 0; y = 1;
		// return b;
	// }
	// int x1,y1;
	// int d = extendedgcd(b%a,a,x1,y1);
	// x = y1 - (b/a)*x1;y = x1;
	// return d;
// }
// int expmod(int a,int b) {
// 	if(b == 1) return a;
// 	if(b == 0) return 1;
// 	int m1 = expmod(a,b/2)%mod;
// 	if(b%2) return ((m1*m1)%mod*a%mod)%mod;
// 	return (m1*m1)%mod;
// }
// int power(int a,int b) {
// 	if(b == 1) return a;
// 	if(b == 0) return 1;
// 	int m1 = power(a,b/2);
// 	if(b%2) return m1*m1*a;
// 	return m1*m1;
// }
// int logn(int n, int r) 
// { 
//     return (n > r - 1) ? 1 + logn(n / r, r) : 0; 
// } 

// int nCr(int n,int r)
// {
	// r = min(r,n-r);
	// if(r<0)
		// return 0;
	// if(r == 0)
		// return 1;
	// int ans = 1;
	// for(int i = 1;i<=r;i++)
	// {
		// ans = ans*(n-i+1)/i;
	// }
	// return ans;
// 		
// }
// vi factmod(int n)
// {
	// vi ans(n+1);
	// ans[0] = 1;
	// loop(i,1,n+1)
	// {
		// ans[i] = (ans[i-1]*i)%mod;
	// }
	// return ans;
// }
// int nCrmod(int n,int r,vi &fact)
// {
	// int x1,y1;
	// extendedgcd(fact[r],mod,x1,y1);
	// int x2,y2;
	// extendedgcd(fact[n-r],mod,x2,y2);
	// int ans = (fact[n]*((x1+mod)%mod))%mod;
	// ans = (ans*((x2+mod)%mod))%mod;
	// return ans;
// }

// void dfs(vector<vector<int> > &adj,int root,vbool &vis)
// {
// 	vis[root] = true;
// 	for(int i = 0;i<adj[root].size();i++){
// 		int v = adj[root][i];
// 		if(!vis[v])		
// 			dfs(adj,v,vis);
// 	}
// }

int32_t main() 
{
	FastIO; PRECISION;
	int t = 1;
	// cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		vi arr(n);
		scan(arr,n);
		int ans = 0;
		loop(i,0,n)
		{
			ans^=arr[i];
		}
		loop(i,0,n)
		{
			cout<<(ans^arr[i])<<' ';
		}
	}
}

Measured memory_bytes: 4752
#include <iostream>
#include <string>
 
using namespace std;
 
// ???????????\?????????????????°??°
// 1???????????°???3??¢????????????????????§
// ????????°?????????????????´???
// 1??????????????????????????????????????°???????¶?????????????
// 3????????°??????????????´??????1???????????????
// ????????????????????´???
// 1????????°????????°?????°????????????????¶????
 
// ????????¶??????????????????
struct Diamond {
    bool first;
    bool second;
    bool third;
    Diamond() : first(), second(), third(){};
 
    int onHit() {
        int result = 0;
        if (third != false) {
            result = 1;
        }
        if (second != false) {
            third = true;
        }
        if (first != false) {
            second = true;
        }
        first = true;
        return result;
    }
    int onHomeRun() {
        // ????????§???1???????????§1??§?????????
        int result = 1;
        if (third != false) {
            result++;
        }
        if (second != false) {
            result++;
        }
        if (first != false) {
            result++;
        }
        first = false;
        second = false;
        third = false;
        return result;
    }
};
 
int main() {
 
    int n;
 
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int out_count = 0;
        int point = 0;
        Diamond dia;
        while (out_count < 3) {
            string temp;
            cin >> temp;
 
            if (temp == "HIT") {
                point += dia.onHit();
            }
            else if (temp == "HOMERUN") {
                point += dia.onHomeRun();
            }
            else {
                // ????????????OUT??¨???????????????
                out_count++;
            }
        }
        cout << point << endl;
    }
    return 0;
}

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

int main() {
  int x;
  cin >> x;
  int ans = 10 - x/200;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3616
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,w;
  cin>>n>>w;
  vector<ll> weight(n),value(n);
  rep(i,n) cin>>weight[i]>>value[i];
  ll dp[n+1][w+1];
  rep(i,w+1) dp[0][i]=0;
  rep(i,n){
    rep(j,w+1){
      if(j>=weight[i]) dp[i+1][j]=max(dp[i][j],dp[i][j-weight[i]]+value[i]);
      else dp[i+1][j]=dp[i][j];
    }
  }
  cout<<dp[n][w]<<endl;
}

Measured memory_bytes: 79232
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
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;}
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
bool CAN=true;
using namespace std;

int main(){
  ll N,ans=0;
  cin>>N;
  ll P[N+1],POS[N+1];
  for(int i=1; i<=N; ++i){
    cin>>P[i];
    POS[P[i]]=i;
  }
  
  multiset<ll> S={0,0,N+1,N+1};
  
  for(int i=N; i>=1; --i){
    auto itr1=S.lower_bound(POS[i]);
    auto itr2=S.lower_bound(POS[i]);
    ll R1=*itr1,R2,L1,L2;
    itr1++;
    R2=*itr1;
    itr2--;
    L1=*itr2;
    itr2--;
    L2=*itr2;
    
    if(i<N) ans+=i*((L1-L2)*(R1-POS[i])+(R2-R1)*(POS[i]-L1));
    S.insert(POS[i]);
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 9788
//code by lynmisakura.wish to be accepted
/****************************/
#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<pair<int,int>> vpi;

const long long Mod = 998244353;
const long long mod = 1000000007;
const long long INF = 10000000000000;

#define itn int
#define endl "\n"
#define pb push_back
#define mp make_pair
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, int mo) { int ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int main(void){
	
	int a;string s;cin >> a >> s;
	if(a >= 3200){
		cout << s << endl;
	}else{
		cout << "red" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
  char s[1001];
  int x;
  while(1)
  {
    cin.getline(s,1001);
    if(atoi(s)==0)break;
    int sum=0;
    for(int i=0;s[i];i++)
      sum+=int(s[i]-'0');
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 3092
# 初期入力
import sys
input = sys.stdin.readline
S =input().strip()

s12 =int(S[:2])
s34 =int(S[2:])
mm=[1,2,3,4,5,6,7,8,9,10,11,12]
yy=[i for i in range(100)]
if s12 in yy and s12 in mm and s34 in yy and s34 in mm:
    print("AMBIGUOUS")
elif s12 in yy and s34 in mm:
    print("YYMM")
elif s12 in mm and s34 in yy :
    print("MMYY")
else:
    print("NA")


Measured memory_bytes: 3064
a=2,3,5
def f(n):
 m=s.get(n)
 if m is None:s[n]=(m:=min([d*n]+[abs(p*k-n)*d+c+f(k)for p,c in zip(a,b)for k in(n//p,0--n//p)]))
 return m
for _ in[0]*int(input()):n,*b,d=map(int,input().split());s={0:0,1:d};print(f(n))

Measured memory_bytes: 10976
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <bitset>
#include <list>
#include <iomanip>
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rrep(i,a,n) for(ll i=n;i>=a;i--)
#define elif else if
#define all(s) s.begin(),s.end()
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF = 1e+17;
const ll MODcdf = 998244353;
bool pairCompare(const P& firstElof,const P& secondElof){
    return firstElof.first<secondElof.first;
}
string A="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string a="abcdefghijklmnopqrstuvwxyz";
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll a,b;cin>>a>>b;
    if(a>=13)cout<<b<<endl;
    elif(a<=5)cout<<0<<endl;
    else cout<<b/2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	
	string s; cin >> s;
	
	int c1=0,c2=0;
	
	rep(i,s.size()){
		if(s[i]=='0') c1++;
		else c2++;
	}
	
	cout << min(c1,c2)*2 << endl;

	
	return 0;
}



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

#define ii pair<int,int> 
const int MAXN = 1e5 + 5;

int n;
vector<ii> eList[2];
vector<int> adj[MAXN];
int p[MAXN], lvl[MAXN];
int col[MAXN];
bool visited[MAXN];

void build(){
	for(int i = 0; i < MAXN; ++i){
		p[i] = i;
		lvl[i] = 0;
	}
}

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

bool isSameParent(int a, int b){
	return getParent(a) == getParent(b);
}

void conn(int a, int b){
	int pa = getParent(a), pb = getParent(b);
	if(pa != pb){
		if(lvl[pa] > lvl[pb]){
			p[pb] = pa;
		}else{
			p[pa] = pb;
			if(lvl[pa] == lvl[pb])
				lvl[pb]++;
		}
	}
}

void dfs(int pos, int color){
	visited[pos] = true;
	col[pos] = color;
	for(int i : adj[pos]){
		if(visited[i])
			continue;
		dfs(i, 1-color);
	}
}

int main(){
	scanf("%d", &n);
	build();
	for(int i = 0; i < n-1; ++i){
		int u, v, w;
		scanf("%d %d %d", &u, &v, &w);
		if(w%2 == 0){
			eList[0].push_back(ii(u, v));
		}else{
			eList[1].push_back(ii(u, v));
		}
	}
	// Connect all even as 1 vertex
	for(ii i : eList[0]){
		//printf("Connect %d, %d\n", i.first, i.second);
		conn(i.first, i.second);
	}
	//Connect all vertex with odd length
	for(ii i : eList[1]){
		int pa = getParent(i.first), pb = getParent(i.second);
		//printf("Edge %d, %d (%d, %d)\n", pa, pb, i.first, i.second);
		adj[pa].push_back(pb);
		adj[pb].push_back(pa);
	}
	// Coloring
	dfs(getParent(1), 0);
	for(int i = 1; i <= n; ++i){
		printf("%d\n", col[getParent(i)]);
	}
}

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

int main (){
    int H, W;

    while(1){
        cin >> H >> W;
        if (H == 0 && W == 0) break;
        for (int i = 0; i < H; i++){
            for (int j = 0; j < W; j++){
                if ((i+j)%2 == 0){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << "\n";
        }
        cout << endl;
    }
    return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++)cin >> a.at(i);
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (i == 0)ans += a.at(i);
		else if (a.at(i) > a.at(i - 1))ans += a.at(i) - a.at(i - 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
s = input()
for i in range(int(input())):
    t = input().split()
    a = int(t[1])
    b = int(t[2])
    if t[0] == "replace":s = s[:a] + t[3] + s[b + 1:]
    elif t[0] == "print":print(s[a:b + 1])
    elif t[0] == "reverse":
        r = s[a:b + 1]
        s = s[:a] + r[::-1] + s[b + 1:]


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int N,M;
    cin >> N >> M;

    priority_queue<ll> q;

    rep(i,N)
    {
        ll tmp;
        cin >> tmp;
        q.push(tmp);
    }

    rep(i,M)
    {
        ll n = q.top();
        q.pop();
        q.push(n/2);
    }

    ll ans = 0;
    rep(i,N)
    {
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;
}


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

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

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

    ll n,m;
    cin >> n >> m;

    ll t = 100*n + 1800*m;

    cout << pow(2,m) * t << endl;

    
}

Measured memory_bytes: 4216
#include <iostream>
using namespace std;
int main(void){
	for (;;){
		int N,M,a[1000]={0},b,c,d,e=0,j;
		cin>>N>>M;
		if (N==0&&M==0) break;
		for (b=0;b<N;b++){
			cin>>a[b];
		}
		d=0;
		for (b=0;b<M;b++){
			cin>>c;
			d=d+c;
			d=d+a[d];
			e++;
			if (d>=N-1){
				for (j=b+1;j<M;j++){
					cin>>c;
				}
			break;
			}
			
		}
		cout<<e<<endl;
	}
	return 0;
}

Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
int n;
int a[30],b[30],c[30];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	for(int i=1;i<=n;i++)
	cin>>b[i];
	for(int i=1;i<=n-1;i++)
	cin>>c[i];
	int sum=b[a[1]];
	for(int i=2;i<=n;i++)
	{
		sum=sum+b[a[i]];
		if(a[i]==a[i-1]+1)
		{
			sum=sum+c[a[i-1]];
		}
	}
	printf("%d",sum);
	return 0;
} 

Measured memory_bytes: 256
#if 0
サイズを指定せずにBを定義したら上手くいかなかったので、サイズを指定して定義した。
二分探索にlower_boundを用いることは知っていたが、はじめて実際に使用した。
#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int N;
int A[100010];
vector<int> B(100010);

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  int l = 0;
  B[l] = A[0];
  for (int i = 1; i < N; i++) {
    if (A[i] > B[l]) {
      B[l+1] = A[i];
      l++;
    }
    else {
      auto it = lower_bound(B.begin(), B.begin()+l, A[i]);
      B[it-B.begin()] = A[i];
    }
  }
  cout << l+1 << endl;
}



Measured memory_bytes: 3568
#include <iostream>
#include <vector>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

#include <vector>
template<typename T_mc_data>

class ModComb
{
private:
    int max_n;
    T_mc_data mod; // M
    vector<vector<T_mc_data>> table;

public:

    // 引数: n の最大値、M は mod の値
    ModComb(int n, T_mc_data M) : table(n + 1, vector<T_mc_data>(n + 1))
    {
        max_n = n;
        mod = M;
        for(int i = 0; i <= n; i++) {
            table[i][0] = 1;
            table[i][i] = 1;
            for(int j = 1; j < i; j++) {
                table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
            }
            /* // デバッグ出力
            for(int j = 0; j <= i; j++) {
                cout << table[i][j] << " ";
            }
            cout << endl;
            */
        }
    }

    // aCb を求める
    T_mc_data calc(T_mc_data a, T_mc_data b)
    {
        if(a > max_n || a < b || a < 0) return 0; // error
        if(a == 0 && b == 0) return 1;
        return table[a][b];
    }
};

/////


int main()
{
    int N, K;
    cin >> N >> K;
    ll mod = 1000000007;
    ModComb<ll> mc(N, mod);

    rep(i, K) {
        ll ans = 0;
        // (N-K+1)C(i+1) 赤い石の間に青い石を入れる総数
        IFD cout << "i: " << i << endl << N - K + 1 << " " << i + 1 << " " << K - 1 << endl;
        ans = mc.calc(N - K + 1, i + 1);
        if(i != 0) {
            // (K-1)C(i) 青い石の塊ごとに何個ずつにするかの総数
            ans = ans * mc.calc(K - 1, i) % mod;
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 31616
from fractions import gcd


def space():
    return list(map(int, input().split()))


A, B, C, D = space()
E = int(C * D / gcd(C, D))

c = B // C - (A-1) // C
d = B // D - (A-1) // D
e = B // E - (A-1) // E

print(1 + B - A - (c + d - e))


Measured memory_bytes: 66028
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

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

#define dump(x) cerr << #x << " = " <<(x)<<endl;
#define debug(x) cerr << #x << " = " <<(x) << "(L" << __LINE__ << ")" << __FILE__ << endl;

#define BIT_ON(x,b) ((x)|=(b))
#define BIT_OFF(x,b) ((x)&=~(b))
#define BIT_IS_ON(x,b) (((x)&(b))==(b))


using namespace std;
typedef long long ll;

int main(void){
  ll N,H;
  int i;
  scanf("%lld %lld", &N,&H);
  ll maxSlash = 0;
  
  vector<pair<ll,ll>> v(N);
  REP(i,N) {
    scanf("%lld %lld", &v[i].first, &v[i].second);
    
    maxSlash = max(maxSlash, v[i].first);

  }

  ll throwAttackDamege = 0;
  ll throwAttackCounts = 0;
  vector<bool> betterSord(N);
  REP(i,N){
    if(v[i].second > maxSlash){
      betterSord[i]= true;
      throwAttackDamege += v[i].second;
      throwAttackCounts++;
  
    }
    else{
      betterSord[i] = false;
    }
  }

  if(throwAttackDamege < H){
    ll t = H - throwAttackDamege;
    
    ll slashCounts;
    if(t%maxSlash==0) slashCounts = t/maxSlash;
    else slashCounts = t/maxSlash + 1;

    cout << slashCounts + throwAttackCounts << endl;
  }

  else{
    vector<ll> tV(N);
    REP(i,N) tV[i] = v[i].second;
    sort(tV.begin(), tV.end(), greater<ll>());

    int throwCount = 0;
    while(H>0){
      H -= tV[throwCount];
      throwCount++;
    }
    cout << throwCount << endl;
  }
      


  return 0;
}



Measured memory_bytes: 2560
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int t=s.nextInt(),l,i,j,c,d;t-->0;){String o=s.next();char[]a=s.next().toCharArray(),b;l=a.length;for(i=o.length();i-->0;){b=a.clone();c=o.charAt(i);if(c!=69)for(j=0;j<l;++j)if(c==80||c==77)a[j]=(char)(47<(d=b[j])&&d<58?c>77?d-1<48?57:d-1:d+1>57?48:d+1:d);else a[j]=b[c<67?l-j-1:c<74?(j+1)%l:(j+l-1)%l];else for(j=0;j<l/2;a[j+l/2+(l%2<1?0:1)]=b[j++])a[j]=b[j+l/2+(l%2<1?0:1)];}System.out.println(new String(a));}}}

Measured memory_bytes: 12000
#include<cstdio>

using namespace std;

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

int main(){
	int t;	scanf("%d",&t);
	for(int k=0;k<t;k++){
		int w,h;	scanf("%d%d",&h,&w);
		char field[20][21];
		int x,y,dir;
		for(int i=0;i<h;i++){
			scanf("%s",field[i]);
			for(int j=0;j<w;j++){
				if(field[i][j]=='^')	x=j,y=i,dir=1;
				if(field[i][j]=='v')	x=j,y=i,dir=3;
				if(field[i][j]=='<')	x=j,y=i,dir=2;
				if(field[i][j]=='>')	x=j,y=i,dir=0;
			}
		}

		int n;	scanf("%d ",&n);
		while(n--){
			char c=getchar();
			if(c=='U' || c=='D' || c=='L' || c=='R'){
				if(c=='U')	dir=1,field[y][x]='^';
				if(c=='D')	dir=3,field[y][x]='v';
				if(c=='L')	dir=2,field[y][x]='<';
				if(c=='R')	dir=0,field[y][x]='>';
				int xx=x+dx[dir],yy=y+dy[dir];
				if(0<=xx && xx<w && 0<=yy && yy<h && field[yy][xx]=='.'){
					field[yy][xx]=field[y][x];
					field[y][x]='.';
					x=xx,y=yy;
				}
			}
			else{
				int sx=x,sy=y;
				while(0<=sx && sx<w && 0<=sy && sy<h){
					if(field[sy][sx]=='*'){ field[sy][sx]='.'; break; }
					if(field[sy][sx]=='#')	break;
					sx+=dx[dir],sy+=dy[dir];
				}
			}
		}

		for(int i=0;i<h;i++)	puts(field[i]);
		if(k<t-1)	putchar('\n');
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a == b)
		cout << "Draw";
	else if (a == 1)
		cout << "Alice";
	else if (b == 1)
		cout << "Bob";
	else if (a > b)
		cout << "Alice";
	else
		cout << "Bob";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define PI 3.1415926535900
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rrep(i, n) for (long long i = 0; (long long)(n) < i; i--)
#define Int long long
using namespace std;


int main() {
    Int a,b;
    cin >> a>>b;
    int i,temp;
    rep(i,b){
        cin >> temp;
        a = a - temp;
    }
    if(a >= 0){
        cout<<a<<endl;
    }else{
        cout<<-1<<endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cmath>

using namespace std;
int main()
{
    int x[1000];
    char y[1000];
    int i=0;
    int j=0;
    int k=0;
    while(1){
        if(i==0){
            cin >> x[j];
            i=1;
            j++;
        }else{
            cin >> y[k];
            if(y[k]=='='){
                break;
            }
            i=0;
            k++;
        }
    }
    
    int ans;
    if(y[0]=='+'){
        ans=x[0]+x[1];
    }else if(y[0]=='-'){
        ans=x[0]-x[1];
    }else if(y[0]=='*'){
        ans=x[0]*x[1];
    }else{
        ans=x[0]/x[1];
    }
    int b=2;
    for(int a=1;a<k;a++){
        if(y[a]=='+'){
            ans=ans+x[b];
        }else if(y[a]=='-'){
            ans=ans-x[b];
        }else if(y[a]=='*'){
            ans=ans*x[b];
        }else{
            ans=ans/x[b];
        }
        b++;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3104
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<int> D(N);
    rep(i, N) cin >> D[i];
    sort(all(D));

    vector<bool> time(48);
    time[0] = time[24] = true;
    int ans = 12;
    rep(i, N) {
        if (D[i] == 0) {
            ans = 0;
            break;
        }

        int d1 = 12;
        rep(t, 0, 48) d1 = time[t] ? min(d1, min(abs(D[i] - t), abs(24 + D[i] - t))) : d1;
        int d2 = 12;
        rep(t, 0, 48) d2 = time[t] ? min(d2, min(abs(24 - D[i] - t), abs(48 - D[i] - t))) : d2;
        if (d1 > d2) {
            ans = min(ans, d1);
            time[D[i]] = time[24 + D[i]] = true;
        }
        else {
            ans = min(ans, d2);
            time[24 - D[i]] = time[48 - D[i]] = true;
        }
    }

    write(ans);
}

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    L = ST()
    N=len(L)
    #dp[i][j]:=i桁目までみた j:= 未満が確定したなら1 else 0
    dp = [[0] * 2 for _ in range(N + 1)]
    dp[0][0] = 1

    for i, s in enumerate(L, start=1):
        #a+b=0
        if s == "0":
            dp[i][1] += dp[i - 1][1]
            dp[i][0] += dp[i - 1][0]
        else:
            dp[i][1] += dp[i - 1][1] + dp[i - 1][0]
        
        #a+b=1
        if s == "1":
            dp[i][1] += dp[i - 1][1] * 2
            dp[i][0] += dp[i - 1][0] * 2
        else:
            dp[i][1] += dp[i - 1][1] * 2
        dp[i][0] %= mod
        dp[i][1] %= mod


    print(sum(dp[-1])%mod)


if __name__ == '__main__':
    main()

Measured memory_bytes: 54364
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int N;
    cin >> N;
    ll A[100000], B[100000];
    for(int i=0;i<N;i++)
        cin >> A[i];
    for(int i=0;i<N;i++)
        cin >> B[i];
    
    ll difference = 0, dif[100000] = {}, score = 0, num = 0;
    for(int i=0;i<N;i++){
        dif[i] = A[i] - B[i];
        difference += dif[i];   // 総和の余裕
        if(dif[i] < 0){
            score += dif[i]*(-1);    // 不足点の合計
            num++;                   // 準備度が不足している科目数
        }
    }
    // 合格できない
    if(difference < 0){
        cout << -1 << endl;
        return 0;
    }

    if(score == 0){
        cout << 0 << endl;
        return 0;
    }


    // 降順ソート
    sort(dif, dif + N, greater<int>());
    for(int i=0;i<N;i++){
        score -= dif[i];
        if(score < 0){
            cout << num + i + 1 << endl;
            return 0;
        }
    }

}

Measured memory_bytes: 2560
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 705
int flag=0;
int color[MAX];
int vis[MAX];
vector<int> v[MAX];
int zero=0;
int one=0;
void dfs(int node, int par)
{
    vis[node]=1;
    if(color[node]) one++;
    else zero++;
    for(auto i: v[node])
    {
        if(i==par) continue;
        if(vis[i]){
            int val=color[node]^ color[i];
            if(val==0) { flag=1; return ; }
            else continue;
        }
        
        color[i]=color[node]^1;
        dfs(i,node);
    }
}
struct node{
    int first,second,third;
};
vector<struct node> arr;
int dp[MAX][MAX];
ll n;
ll C(ll x)
{
    ll val=(x)*(x-1);
    return val/2;
}
ll solve(int i, int sum)
{
    if(i==arr.size()){
        return C(sum)+C(n-sum);
    }
    if(dp[i][sum]!=-1) return dp[i][sum];
    ll x=solve(i+1,sum+arr[i].first);
    ll y= solve(i+1,sum+arr[i].second);
    return dp[i][sum]=min(x,y);
}
int graph[MAX][MAX];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll m; cin>>n>>m;
    
    for(int i=1;i<=m;i++){
        ll a,b; cin>>a>>b;
        graph[a][b]=1;
        graph[b][a]=1;
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(i==j) continue;
            if(graph[i][j]==0)  v[i].push_back(j);
        }
    }
    for(int i=1;i<=n;i++){
        if(vis[i]==0)
        {
            zero=0; one=0;
            // cout<<i<<endl;
            dfs(i,i);
            struct node st; st.first=zero; st.second=one; st.third=i;
            arr.push_back(st);
            if(flag==1) break;
        }
    }
    if(flag)  { cout<<"-1"<<endl; return  0; }
    memset(dp,-1,sizeof(dp));
    ll ans=solve(0,0);
    cout<<ans<<endl;
}

Measured memory_bytes: 4480
#include<cstdio>
#include<vector>
using std::vector;
struct Segment{
    int l,r;
    int bit;
    Segment(int l,int r,int bit):l(l),r(r),bit(bit){}
};
int x[100005], y[100005];
int color[100005];
int sum[2005][2005];
int c[2005][2005];

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

vector<Segment> getSegment(int x,int mod){
    vector<Segment>res;
    int mid = mod/2-1;
    if(x<=mid){ 
        //l may bigger than r
        res.push_back(Segment(0,mid-x,0));
        res.push_back(Segment(mid-x+1,mod-1-x,1));
        res.push_back(Segment(mod-x,mod-1,0));
    }
    else{
        res.push_back(Segment(0,mod-1-x,1));
        res.push_back(Segment(mod-x,mod-x+mid,0));
        res.push_back(Segment(mod-x+mid+1,mod-1,1));
    }
    return res;
}

void rangeAdd(int x0,int x1,int y0,int y1){
    c[x0][y0]++;
    c[x0][y1+1]--;
    c[x1+1][y0]--;
    c[x1+1][y1+1]++;
    /*for(int i = x0; i <= x1; i++){
        for(int j = y0; j <= y1; j++) sum[i][j]++;
    }*/
}

void addContribu(int x0,int x1,int y0,int y1){
    if(x0>x1 || y0>y1) return ;
    else rangeAdd(x0+1,x1+1,y0+1,y1+1);
}

int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    int mod = 2*k;
    for(int i = 1; i <= n; i++){
        char cc[2];
        scanf("%d%d%s",&x[i],&y[i],cc);
        x[i] %= mod, y[i] %= mod;
        if(cc[0]=='W') color[i] = 0;
        else color[i] = 1;
    }
    for(int i = 1; i <= n; i++){
        vector<Segment>segX = getSegment(x[i],mod);
        vector<Segment>segY = getSegment(y[i],mod);
        for(Segment sx: segX){
            for(Segment sy: segY){
                int bit = (sx.bit+sy.bit)%2;
                if(bit==color[i]){
                    addContribu(sx.l,sx.r,sy.l,sy.r);
                }
            }
        }
    }
    int ans = 0;
    sum[0][0] = 0;
    for(int i = 1; i <= mod; i++){
        for(int j = 1; j <= mod; j++){ 
            sum[i][j] = sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+c[i][j];
            if(sum[i][j]>ans) ans = sum[i][j];
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 35684
#include <stdio.h>

int main(){

    double N = 0.0;
    int count = 0;

    scanf("%lf", &N);

    for (int i = 1; i < (N / 2.0); i++){
        if((N - i) > 0){
            count++;
        } 
    }

    printf("%d", count);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

template<class T> inline bool chmin(T& a, T b) 
{ if (a > b) { a = b; return true; } return false; }

template<class T> inline bool chmax(T& a, T b) 
{ if (a < b) { a = b; return true; } return false; }

template<class T> inline auto __lcm(T& a, T& b) 
{ return a * b / __gcd(a, b); }

template<typename T> void remove(std::vector<T>& vector, unsigned int index)
{ vector.erase(vector.begin() + index); }


int main() {
  string S;  cin >> S;

  string Sf, Sb = "";
  for (int i = 0; i < S.size()/2; ++i) {
    Sf.push_back(S[i]);
    Sb.push_back(S[S.size()-1-i]);
  }

  int res = 0;
  for (int i = 0; i < Sf.size(); ++i) {
    if (Sf[i] != Sb[i]) res++;
  }

  print(res);

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

ll a[99];
int main(){
	ll a,b,c;
	scanf("%lld%lld%lld",&a,&b,&c);
	printf("%lld",min(a*b,c));
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FSP(x) fixed << setprecision(x)
using namespace std;
using ll = long long;
constexpr ll INF = LLONG_MAX;
//constexpr ll P = 1e9 + 7;
//constexpr ll P = 998244353;
constexpr long double PI = acosl(-1);
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}

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

	ll n, m;
	cin >> n >> m;
	vector<ll> x(n), y(n), z(n);
	for (ll i = 0; i < n; i++) cin >> x[i] >> y[i] >> z[i];

	ll ans = 0;
	for (ll i = 0; i < 8; i++) {
		bitset<3> dir = i;
		vector<ll> m_dist(n, 0);
		for (ll i = 0; i < n; i++) {
			m_dist[i] += x[i] * (dir[0]?-1:1);
			m_dist[i] += y[i] * (dir[1]?-1:1);
			m_dist[i] += z[i] * (dir[2]?-1:1);
		}
		sort(ALL(m_dist));
		ll sum = 0;
		for (ll i = 0; i < m; i++) sum += m_dist[n - 1 - i];
		ans = max(ans, sum);
	}
	cout << ans << endl;
}

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

int main()
{
    string x,y,p,q;
    int a,b;
    cin >> x;
    cin >> y;

    if(x.length()>y.length()) {
        cout << "GREATER" << endl;
        return 0;
    }
    else if(x.length()<y.length()) {
        cout << "LESS" << endl;
        return 0;
    }
    else
    {
        for (int i = 0; i < x.length(); i++)
        {
            p = x.at(i);
            a = atoi(p.c_str());
            q = y.at(i);
            b = atoi(q.c_str());
            if(a>b) {
                cout << "GREATER" << endl;
                return 0;
            }
            else if(a<b) {
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
    }
    return 0;
}

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

int stoi(char c) {
  int num = c - '0';
  return num;
}
int main() {
  string S;
  cin >> S;
  int number = 0;
  number += stoi(S.at(0)) * pow(10, 7);
  number += stoi(S.at(1)) * pow(10, 6);
  number += stoi(S.at(2)) * pow(10, 5);
  number += stoi(S.at(3)) * pow(10, 4);
  number += stoi(S.at(5)) * pow(10, 3);
  number += stoi(S.at(6)) * pow(10, 2);
  number += stoi(S.at(8)) * pow(10, 1);
  number += stoi(S.at(9)) * pow(10, 0);
  if (number < 20190431) {
    cout << "Heisei" << endl;
  } else {
    cout << "TBD" << endl;
  }
}

Measured memory_bytes: 256
N = int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0

Measured memory_bytes: 39576
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  ll A,B,C,K;
  cin>>A>>B>>C>>K;
  if(K<=A){
    cout<<K<<endl;
  }else if(K<=A+B){
    cout<<A<<endl;
  }else{
    cout<<A-(K-A-B)<<endl;
  }
}



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

const int inf = 1e9;
const ll linf = 1e18;

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

    ll a, b, k; cin >> a >> b >> k;
    cout << max(0ll, a - k) << " " << max(0ll, min(b, a + b - k)) << endl;
    return 0;
}

Measured memory_bytes: 256
l, r = map(int, input().split())

rem_l = l%2019
rem_r = r%2019

ans = -1

if r - l >= 2019:
    ans = 0

elif rem_l >= rem_r:
    ans = 0

else:
    ans = float('INF')
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            temp = (i * j) % 2019
            if temp < ans:
                ans = temp

print(ans)


Measured memory_bytes: 9160
#include<cstdio>
#include<cstring>

#define MAXN 200000
char str[MAXN+5];

int main(){
    scanf("%s",str+1);
    int len=strlen(str+1);
    for(int i=1;i<=len;i++){
        if(str[i]==str[i+1]){
            printf("%d %d",i,i+1);
            return 0;
        }
        if(str[i]==str[i+2]){
            printf("%d %d",i,i+2);
            return 0;
        }
    }
    printf("-1 -1");
}


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

int main() {

  char ch[1200];
  int i,n;
  n=0;
  char a[1200];

  while(1) {
    scanf("%c",&a[n]);
    if(a[n] == '\n') {
      break;
    }
    ch[n] = a[n];
    if('A' <= a[n] && a[n] <= 'Z') {
      ch[n] = a[n] + 32;
    } else if(a[n] >= 'a' && a[n] <= 'z') {
      ch[n] = a[n] - 32;

    }
    
    
    n = n +1;
    
  }
  
  for(i=0; i<n ; i++) {
    printf("%c" ,ch[i]);
  }
  printf("\n"); 
  return 0;
  
}


Measured memory_bytes: 2020
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

LL calc(LL n) {
	return (n)*(n - 1) / 2;
}

int main() {
	LL n; cin >> n;
	vector<LL> a(n);
	vector<LL> tb(200010);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		tb[a[i]]++;
	}

	LL base = 0;
	for (int i = 0; i < tb.size(); i++) {
		base += calc(tb[i]);
	}

	for (int i = 0; i < n; i++) {
		cout << base - (tb[a[i]] - 1) << endl;
	}

	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back


using namespace std;

const int maxm = 1000000000 + 7;

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


//----------->CODE BEGINS --------------->


int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

   
  int n,l;
  cin>>n>>l;

  vector<string>v(n);

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

    
  }
  
  sort(v.begin(),v.end());


  for(int i=0;i<n;i++)
  {
    cout<<v[i];
  }
  
  
  
}
 

Measured memory_bytes: 3620