akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define INF 1e9
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N, M, Q, H, W, D, L, R, K, X;
ll A;
ll B;
ll ans;
string S;
ll a[100000000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll minnum, maxnum;
ll minpos = 1, maxpos = 1;
int main() {
	cin >> N;
	rep(i, 1, N + 1) {
		cin >> a[i];
		minnum = min(minnum, a[i]);
		if (a[i] == minnum)
			minpos = i;
		maxnum = max(maxnum, a[i]);
		if (a[i] == maxnum)
			maxpos = i;
	}
	cout << N * 2 << endl;
	ll count = 0;
	if (abs(maxnum) < abs(minnum)) {
		rep(i, 1, N + 1) {
			if (0 < a[i]) {
				cout << minpos << " " << i << endl;
				count++;
			}
		}
		urep(i, N, 2) {
			cout << i << " " << i - 1 << endl;
			count++;
		}
		rep(i, count, N * 2) {
			cout << 1 << " " << 1 << endl;
		}
	}
	else {
		rep(i, 1, N + 1) {
			if (a[i] < 0) {
				cout << maxpos << " " << i << endl;
				count++;
			}
		}
		rep(i, 1, N) {
			cout << i << " " << i + 1 << endl;;
			count++;
		}
		rep(i, count, N * 2) {
			cout << N << " " << N << endl;
		}
	}
	cin >> ans;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
A = [0]

for s in S:
    if s == '.':
        A.append(A[-1] + 1)
    else:
        A.append(A[-1])
ans = float('inf')
for i in range(N + 1):
    ansi = (i - A[i]) + (A[-1] - A[i])
    ans = min(ans, ansi)
print(ans)


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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%lld %lld",&n1,&n2)
#define slll(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define nl puts("");
#define pb push_back
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define sz(x) x.size()
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define line puts("-------");
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
typedef long long int ll;
using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    cout<<b<<a;
}


Measured memory_bytes: 256
#include<stdio.h>


int gcd( int x, int y )
{
	int t;
	while( 0 < y ) {
		t = y;
		y = x % y;
		x = t;
	}
	
	return x;
}

int main( )
{	
    int x, y;
     
    scanf( "%d%d", &x, &y );
     
    int t;
    if( y < x ) {
        t = x;
        x = y;
        y = t;
    }
     
    printf( "%d\n", gcd( x, y ) );
	
	return 0;
}

Measured memory_bytes: 592
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		List<List<Integer>> lists = new ArrayList<List<Integer>>();
		for (int i = 0; i < n; i++) {
			int head = sc.nextInt();
			List<Integer> list = new ArrayList<Integer>();
			for (int j = 0; j < head; j++) {
				list.add(sc.nextInt());
			}
			lists.add(list);
		}
		if(lists.size()==1) {
			System.out.println(lists.get(0).size());
			return;
		}
		int cnt = 0;
		List<Integer> tmp = lists.get(0);
		for (int j = 0; j < tmp.size(); j++) {
			int check = tmp.get(j);
			boolean flag = false;
			for (int p = 0; p < lists.size(); p++) {
				if (lists.get(p) == tmp) {
					continue;
				} else {
					if (lists.get(p).contains(check)) {
						flag = true;
					} else {
						flag = false;
						break;
					}
				}
			}
			if (flag == true) {
				cnt++;
			}
		}

		System.out.println(cnt);
	}
}


Measured memory_bytes: 24788
n,k=map(int,input().split())
s=input()
#n,k=10**5,10**5
#s=""
#for i in range(5*10**4):
#  s+="10"
l=[]
a=0
b=s[0]
for i in range(n):
  if b==s[i]:
    a+=1
  else:
    l.append(a)
    a=1
    b=s[i]
l.append(a)
l=[0,0]+l
for i in range(1,len(l)):
  l[i]+=l[i-1]
ans=0
b=int(s[0])
if k*2+1<=len(l):
  aa=[k*2-1,k*2,k*2+1]
  for a in aa:
    for i in range(b,len(l)-a,2):
      ans=max(ans,l[i+a]-l[i])
else:
  aa=[len(l)-2,len(l)-1,len(l)]
  for a in aa:
    for i in range(b,len(l)-a,2):
      ans=max(ans,l[i+a]-l[i])
print(ans)

Measured memory_bytes: 7148
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
int gcd(int a,int b){if(a<b)swap(a,b);int c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int main(){
  int s, w; cin >> s >> w;
  if(s <= w)
  puts("unsafe");
  else
  puts("safe");
  
  return 0;
}


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

using ll = long long;

//constant
const ll MOD = 1e+9 + 7;
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// view vector
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }


// ***************************************

int main(void) {

	int N;
	cin >> N;

	vector<vector<ll>> dp(3, vector<ll>(N + 1, 0));
	ll a, b, c;
	REP(i, N) {
		cin >> a >> b >> c;
		
		dp[0][i + 1] = max({ dp[1][i] + a, dp[2][i] + a, dp[0][i]});
		dp[1][i + 1] = max({dp[0][i] + b, dp[2][i] + b , dp[1][i]});
		dp[2][i + 1] = max({dp[0][i] + c, dp[1][i] + c , dp[2][i]});

	}

	cout << max({ dp[0][N], dp[1][N] , dp[2][N] }) << endl;

	return 0;
}

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

int main() {
	string s;
	cin >> s;
	auto f = [&](int a) {
		for(int i = 0; i < a; i++) {
			if(i+a >= s.size()) return false;
			if(s[i] != s[i+a]) return false;
		}
		return true;
	};
	for(int i = s.size(); i >= 0; i--) {
		if(f(i)) {
			if(i * 2 == s.size()) continue;
			cout << i * 2<< endl;
			return 0;
		}
	}
}

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

const int INF =1e9;
const int MOD =1e9+7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

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

int main()
{
int x,y,z;
cin>>x>>y>>z;
cout<<z<<" "<<x<<" "<<y<<endl;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vd(T) vector<vector<T>>
#define v(T) vector<T>
#define mod (ll)(1e9+7)
#define pp(T) pair<T,T>
#define pb push_back
#define mp make_pair
#define NN 100005
#define IO ios_base::sync_with_stdio(NULL),cin.tie(0),cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define DEBUG cout<<"***********DEBUGGING***********"<<endl
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 
ll power(ll a,ll b){ if(b==0) return 1; ll s=power(a,b/2); s*=s;if(b&1) return s*a; return s;}
ll powermod(ll a,ll b,ll m){ if(b==0) return 1; ll s=power(a,b/2);s*=s; s%=m; if(b&1) return (s*a)%m; return s;}
inline int add(ll a,ll b,ll m=0){
    if(m==0) return a+b;
    return (a%m+b%m)%m;
}

inline int sub(ll a,ll b ,ll m=0){
    if(m==0) return a-b;
    return ((a%m-b%m)%m+m)%m;
}

inline int mul(ll a,ll b,ll m=0){
    if(m==0)return (a*b);
    return ((a%m)*(b%m))%m;
}

inline int div(ll a,ll b,ll m=0){
    if(m==0) return a/b;
    return ((a%m)*(powermod(a,b,m-2)%m))%m;
}

bool isopen(char c){
    return ((c=='(')||(c=='{')||(c=='['));
}

ll longest_balanced_parenthesis(string a,ll n){
    stack<char> s;
    ll start=0;
    ll ans=0,m=0;
    for(ll i=0;i<n;i++){
        if(isopen(a[i])){
            s.push(a[i]);
        }
        else{
            if(isopen(a[i])|| s.empty()){
                m=max(m,ans);
                continue;
            }
            else{
                s.pop();
                ans+=2;
                m=max(ans,m);
            }
        }
    }

    return m;

}

ll setup_k(ll *a,ll k){
  ordered_set x;
  // Now , insert and then check number of integers less than k by just using x.order_of_key(k+1)
}

int main() {

    IO; 

    char c;
    cin>>c;
    if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u'){
        cout<<"vowel"<<endl;
    }
    else{
        cout<<"consonant"<<endl;
    }
    
    

}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << (b ? "YES" : "NO") << endl
#define Yes(b) cout << (b ? "Yes" : "No") << endl

const int MAX = 2e5+10;

ll N, M;
string S;
set<int> adj[MAX];
int A[MAX], B[MAX];

bool solve() {
    set<int> rm;
    REP (i, N) {
        FORI (iter, adj[i]) {
            if (S[*iter] == 'A') A[i]++;
            else B[i]++;
        }
        if (A[i] == 0 || B[i] == 0) rm.insert(i);
    }

    int count = 0;
    while (!rm.empty()) {
        count++;
        int n = *rm.begin();
        rm.erase(rm.begin());

        FORI (iter, adj[n]) {
            int e = *iter;
            if (e == n) continue;
            adj[e].erase(adj[e].find(n));
            if (S[n] == 'A') A[e]--;
            else B[e]--;
            if (A[e] == 0 || B[e] == 0) rm.insert(e);
        }
    }

    return count != N;
}

int main() {
    cin >> N >> M >> S;
    REP (i, M) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        adj[a].insert(b);
        adj[b].insert(a);
    }
    Yes(solve());
}

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

using namespace std;

#define db(x) cerr << #x << " = " << x << endl;
#define ll long long

#define INF 10000000000000

#define MAXW 112345
#define MAXN 112

int n, w;

vector< vector<ll> > dp;

vector< vector<int> > vis;

vector< vector<int> > matriz;

ll solve(int i, int w)
{
    //db(i)
    //db(w)
    if(w < 0)
        return -INF;

    if(i == n)
        return 0;

    if(vis[i][w])
        return dp[i][w];

    vis[i][w] = 1;

    if(w == 0)
    {
        return 0;
    }

    dp[i][w] = max(solve(i + 1, w - matriz[i][0]) + matriz[i][1], solve(i + 1, w));

    return dp[i][w];
}

int main()
{
    scanf("%d%d", &n, &w);

    dp  = vector< vector<ll> >(MAXN, vector<ll>(MAXW));
    vis = vector< vector<int> >(MAXN, vector<int>(MAXW));

    matriz = vector< vector<int> >(MAXN, vector<int>(2));

    for(int i = 0; i < matriz.size(); i++)
    {
        for(int j = 0; j < matriz[i].size(); j++)
        {
            int aux;
            scanf("%d", &aux);
            matriz[i][j] = aux;
        }
    }

    cout << solve(0, w);
}



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

int main(){
	string a,b;
	cin >> a >> b;
	if(a=="H"&&b=="H"){
		cout << "H" << endl;
	}else if(a=="H"&&b=="D"){
		cout << "D" << endl;
	}else if(a=="D"&&b=="H"){
		cout << "D" << endl;
	}else if(a=="D"&&b=="D"){
		cout << "H" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int A,B,z;
	if(0<=A&&A<=23){
		if(0<=B&&B<=23)
		{
			scanf("%d%d",&A,&B);
			z=A+B;
			int f=z%24;
			printf("%d",f);
		}
		else
		{
			printf("Error");
		}	
	}
	else
	{
		printf("Error");
	}
}

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

int main() {
  int N;
  string a;
  cin >> N;
  int b = 0;
  for(int i = 0; i < N; i++){
  	cin >> a;
    if(a == "Y"){
      b = 1;
    }
  }
  if(b == 0){
  	cout << "Three" << endl;
  } else {
  	cout << "Four" << endl;
  }
}

Measured memory_bytes: 256
import collections


def bellman_ford(es, n, start):
    infinity = float("inf")
    m = len(es)

    d = [infinity] * (n + 1)
    d[start] = 0

    for _ in range(m):
        updated = False

        for u, v, w in es:
            if d[u] == infinity: continue

            dd = d[u] + w

            if dd < d[v]:
                d[v] = dd
                updated = True

        if not updated: break

    for u, v, w in es:
        if d[u] < infinity and d[u] + w < d[v]:
            return None, True

    return d, False


N, M, P = [int(e) for e in input().split()]

Es = [None] * M

for i in range(M):
    a, b, c = ([int(e) for e in input().split()])
    Es[i] = (a - 1, b - 1, P - c)

q = collections.deque()
q.append(N - 1)

valid = [False] * N
valid[N - 1] = True

while 0 < len(q):
    cur = q.popleft()

    for u, v, _ in Es:
        if cur == v and not valid[u]:
            valid[u] = True
            q.append(u)

es_tmp = []
for e in Es:
    if valid[e[0]] and valid[e[1]]:
        es_tmp.append(e)

Es = es_tmp

distances, le = bellman_ford(Es, N - 1, 0)

if le:
    print(-1)
else:
    print(max(-distances[-1], 0))


Measured memory_bytes: 50536
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int C = sc.nextInt();
        
        int D[][] = new int[C][C];
        for(int i = 0; i < C; i++) {
            for(int j = 0; j < C; j++) {
                D[i][j] = sc.nextInt();
            }
        }
        int c[][] = new int[N][N];
        for(int i = 0; i < N; i++) {
            for(int j = 0; j < N; j++) {
                c[i][j] = sc.nextInt() - 1;
            }
        }
        
        long sum[][] = new long[3][C];
        for(int k = 0; k < C; k++ ) {
            for(int i = 0; i < N; i++) {
                for(int j = 0; j < N; j++) {
                    sum[(i+j)%3][k] += D[c[i][j]][k];
                }
            }
        }
        
        long min = Long.MAX_VALUE;
        for( int x = 0; x < C; x++ ) {
            for(int y = 0; y < C; y++ ) {
                if( x == y ) continue;
                for( int z = 0; z < C; z++ ) {
                    if( x == z ) continue;
                    if( y == z ) continue;
                    min = Math.min( min, sum[0][x] + sum[1][y] + sum[2][z] );
                }
            }
        }
        
        System.out.println( min );
    }
}


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

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int rectanglesCount=0;
        int lozengesCount=0;
        while(sc.hasNext()) {
            Integer[] list = Arrays.stream(sc.nextLine().split(",")).map(Integer::parseInt).toArray(Integer[]::new);
            if(list[0]*list[0]+list[1]*list[1]==list[2]*list[2]) {
                rectanglesCount++;
            }
            if(list[0]==list[1]) {
                lozengesCount++;
            }
        }
        System.out.println(rectanglesCount+"\n"+lozengesCount);
    }
}


Measured memory_bytes: 31788
import numpy as np
N=int(input())
A=sorted(list(map(int,input().split())))
Amax=A[-1]+1
B=np.zeros(Amax,dtype=int)
ans=0
#1～Amaxの範囲でjがA[i]の倍数の時,B[j]+=1
for i in A:
	for j in range(i,Amax,i):
		B[j]+=1
#B[i]==1:その数でしか割り切れない→count up
for i in A:
	if B[i]==1:
		ans+=1
print(ans)

Measured memory_bytes: 51492
#include <iostream>
using namespace std;
int A[100100];

int partition(int p, int r) {
  int x = A[r];
  int i = p-1;
  for (int j = p; j < r; j++) {
    if (A[j] <= x) {
      i++;
      swap(A[i], A[j]);
    }
  }  
  swap(A[i+1], A[r]);
  return i+1;
}

int main() {
  int N; cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int p =  partition(0, N-1);
  for (int i = 0; i < N; i++) {
    if (i == p) cout << "[";
    cout << A[i];
    if (i == p) cout << "]";

    if (i != N-1) {
      cout << " ";
    } else {
      cout << endl;
    }
  }
}




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

/*                        [Template]                        */
#define async ios_base::sync_with_stdio(false); cin.tie(NULL);
#define Int long long int
#define let auto
#define of :
#define all(y) y.begin(), y.end()
#define present( x, y ) x.find( y ) != x.end()
#define _matrix(T) vector<vector<T>>
template<class T>
auto matrix( int r, int c, T v ){
	return vector<vector<T>>( r, vector<T>( c, v ) ) ;
}
int mod = (int)1e9 + 7 ;
/************************************************************/

class Graph{
	public :
		int nodes ;
		vector<vector<int>> g ;
		Graph( ){
			nodes = 0 ;
		}
		Graph( int nodes ) : nodes ( nodes ) {
			g.resize( nodes + 1 ) ;
		}
		void init( int nodes ){
			this -> nodes = nodes ;
			g.resize( nodes + 1 ) ;
		}
		void refresh(){
			g.clear() ;
			nodes = 0 ;
		}
		void addEdge( int &f, int &t ){
			g[f].push_back(t) ;
		}
} ;

Graph G ;
vector<int> dist ;

int max( int itr, vector<bool> &vis ){
	if( dist[itr] != -1 ) return dist[itr] ;
	vis[itr] = true ;
	int mx = 0 ;
	for( int v : G.g[itr] ){
		// if( !vis[v] )
		mx = max( mx, max( v, vis ) ) ;
	}
	return dist[ itr ] = ( mx + 1 ) ;
}

signed main(){
	int N, M ; cin >> N >> M ;
	int f, t ;
	G.init( N ) ;
	dist.resize( N + 1 ) ;
	dist.assign( N + 1, -1 ) ;
	for( int e = 1 ; e <= M ; e++ ){
		cin >> f >> t ;
		G.addEdge( f, t ) ;
	}
	vector<bool> vis( N + 1, false ) ;
	for( int i = 1 ; i <= N ; i++ ){
		if( !vis[i] ){
			max( i, vis ) ;
		}
	}
	G.refresh() ;
	int ans = 0 ;
	// for( int d of dist ) cout << d << " " ; cout << endl ;
	for( int d of dist ) ans = max( ans, d - 1 ) ;
	cout << ans ;
	return 0 ;
}

Measured memory_bytes: 11084
#include <iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<math.h>
#include<cmath>
#define ll long long
using namespace std;
long double pi = 3.14159265358979323846;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	char n;
	cin >> n;
	cout << (char)(n + 1);
	
	
	return 0;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        
        if(K % 2 == 0){
            System.out.println(K / 2 * K / 2);
        }else{
            System.out.println(K / 2 * (K / 2 + 1));
        }
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	char s [4];
	scanf("%s", s);
	if(s[0]=='S'){
		if(s[1]=='A'){
			printf("1");
		}else{
			printf("7");
		}
	}else if (s[0]== 'M'){
		printf("6");
	}else if (s[0]== 'W'){
		printf("4");
	}else if (s[0]== 'F'){
		printf("2");
	}else{
		if (s[1]=='U'){
			printf("5");
		}else{
			printf("3");
		}
	}
	return 0;
}

Measured memory_bytes: 256
using System;

namespace _2261
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            long n = s.Length;
            char[] a = new char[] { 'i','w','(',')','{','}','[',']' };
            char[] b = new char[] { 'i','w',')','(','}','{',']','[' };
            int max = 0;
            for (long i = 0; i < Math.Pow(2,n); i++)
            {
                long x = i;
                string now = "";
                for (int j = 0; j < n; j++)
                {
                    if (x % 2 == 1) now += s[j];
                    x /= 2;
                }
                bool flag = true;
                for (int j = 0; j < now.Length && flag; j++)
                {
                    if (Array.IndexOf(a,now[j]) != Array.IndexOf(b,now[now.Length - j - 1])) flag = false;
                }
                if (flag && now.IndexOf("iwi") >= 0)
                    max = Math.Max(max,now.Length);
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 10568
def erase(line)
  ret = line.join
  (1..9).each do |i|
    5.downto(3).each do |j|
      ret.gsub!(/#{i.to_s}{#{j}}/, '0'*j)
    end
  end
  ret.split('')
end

def fall(board)
  board.transpose.map{ |l|
    l.join.delete('0').rjust(@h, '0').split('') }.transpose
end

def plus(board)
  board.flatten.map(&:to_i).reduce(:+)
end

def solve(board)
  loop do
    score = plus(board)
    board.map!{ |l| erase(l) }
    board = fall(board)
    break if score == plus(board)
  end
  plus(board)
end

while (@h = gets.to_i) != 0
  board = @h.times.map{ gets.split }
  score = plus(board)
  puts score - solve(board)
end

Measured memory_bytes: 10712
#include <stdio.h>
#include <iostream>
 
int main(void)
{
  int A, B, C;
  std::cin >> A >> B >> C;
  if (A <= C && C <= B)
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;
  
  return 0;
}

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

int main() {
    int n,m;
    cin >> n >> m;

    int ans = n*(n-1)/2 + m*(m-1)/2;

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

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll H,W;
void input(){
    fast_io();
    cin >> H >> W;
}

ll cal(ll a, ll b, ll c){
    return max({a,b,c})-min({a,b,c});
}

int solve(){
    ll ans = H*W+1;
    ll a,b,c;
    for (int h = 1; h < H; h++)
    {
        a = h*W;
        b = (H-h)/2*W;
        c = H*W-a-b;
        ans = min(ans,cal(a,b,c));
        b = (H-h)*(W/2);
        c = H*W-a-b;
        ans = min(ans,cal(a,b,c));
    }
    swap(H,W);
    for (int h = 1; h < H; h++)
    {
        a = h*W;
        b = (H-h)/2*W;
        c = H*W-a-b;
        ans = min(ans,cal(a,b,c));
        b = (H-h)*(W/2);
        c = H*W-a-b;
        ans = min(ans,cal(a,b,c));
    }
    cout << ans << endl;
    return 0;
}   

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

Measured memory_bytes: 256
#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>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x%mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod - 2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		assert(n < mod);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
}c(200005);

int main() {
	int H, W, A, B;
	cin >> H >> W >> A >> B;
	mint ans = 0;
	for (int j = 1; j <= W - B; ++j) {
		ans += c((H - A - 1) + (B + j - 1), (H - A - 1))*c((A - 1) + (W - B - j), (A - 1));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6220
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

string S, T;

int main() {
  //
  cin >> S >> T;
  ll ans = INF;
  for (int i = 0; i <= S.size() - T.size(); ++i) {
    ll cnt = 0;
    for (int j = 0; j < T.size(); ++j) {
      if (S[i + j] != T[j]) {
        ++cnt;
      }
    }
    chmin(ans, cnt);
  }

  cout << ans;
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    char C[1000][1000];
    char color[2][2] = { {'R', 'Y'}, {'G', 'B'} };
    int H,W,D;
    cin >> H >> W >> D;
    
    
    for ( int i = 0; i < H+W; i++ ) {
    for ( int j = 0; j < H+W; j++ ) {        
        C[i][j] = color[ (i/D)%2 ][ (j/D)%2 ];
    }
    }
    
    for ( int i = 0; i < H; i++ ) {
        for ( int j = 0; j < W; j++ ) {        
            cout << C[i+j][i-j+W];
        }
        cout << endl;
    }
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f;

int n;
char s[205][205];
int dis[205][205];

int col[205];
bool dfs(int v, int cc)
{
	if(col[v] != 0) return col[v] == cc;
	col[v] = cc;
	rep(i, n) if(s[v][i] == '1' && !dfs(i, -cc)) return false;
	return true;
}

int main()
{
	scanf("%d", &n);
	rep(i, n) scanf("%s", s[i]);
	
	if(!dfs(0, 1)) {
		printf("-1\n");
		return 0;
	}
	
	rep(i, n) rep(j, n)
	if(i == j) dis[i][j] = 0;
	else if(s[i][j] == '1') dis[i][j] = 1;
	else dis[i][j] = INF;
	rep(k, n) rep(i, n) rep(j, n) dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
	int ans = 0;
	rep(i, n) rep(j, n) ans = max(ans, dis[i][j]);
	printf("%d\n", ans + 1);
	return 0;
}

Measured memory_bytes: 512
int main() {
	int n, a[100];
	scanf("%d", &n);
	int i;
	for (i = 0; i < n; i++) {
		scanf("%d", a + i);
	}
	for (; i; i--) {
		printf("%d", a[i-1]);
		putchar((i > 1) ? ' ' : '\n');
	}
}


Measured memory_bytes: 2040
#include <stdio.h>
 
int main(void){
  int n = 0;
  int a = 0;
  int amin = 0;
  long int count = 0;
  
  scanf("%d",&n);
  while(n--){
    scanf("%d",&a);
    if(a > amin || a == 0) amin = a;
    else count += amin - a;
  }
  printf("%ld\n",count);
  return 0;
}

Measured memory_bytes: 1708
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }

#include <map>

vector<int> road, train;
int root(int, vi&);
bool unite(int, int, vi&);
int n, k, l;
map<pii, int> cnt;

void init()
{
	cin >> n >> k >> l;
	road.resize(n, -1);
	train.resize(n, -1);
}

int main()
{
	init();

	REP(_i, k)
	{
		int p, q;
		cin >> p >> q; --p; --q;
		unite(p, q, road);
	}
	REP(_i, l)
	{
		int p, q;
		cin >> p >> q; --p; --q;
		unite(p, q, train);
	}

	REP(i, n)
	{
		cnt[pii(root(i, road), root(i, train))]++;
	}

	REP(i, n)
	{
		cout << cnt[pii(root(i, road), root(i, train))] << " ";
	}
	cout << endl;

}


int root(int a, vi& v)
{
	if (v[a] < 0)
		return a;
	return v[a] = root(v[a], v);
}


bool unite(int a, int b, vi& v)
{
	int root_a = root(a, v);
	int root_b = root(b, v);

	if (root_a == root_b)
		return false;

	int size_a = -v[root_a];
	int size_b = -v[root_b];

	if (size_a < size_b)
	{
		swap(a, b); swap(size_a, size_b); swap(root_a, root_b);
	}

	v[root_a] += -size_b;
	v[root_b] = root_a;

	return true;
}


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

int main(){
    int N;
    cin >> N;
    int h[110];
    for (int i=0; i<N; i++) cin >> h[i];

    int ans=0;
    for (int i=0; i<N; i++){
        if (h[i]==0){
            continue;
        }
        else {
            h[i]--;
            ans++;
            for (int j=i+1; j<N; j++){
                if (h[j]==0){
                    break;
                } else {
                    h[j]--;
                }
            }
        }
        if (h[i]!=0){
            i--;
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream> 
#include <vector>
#include <string>
#include <math.h>
using namespace std;
#define ll long long int
int main() {
  ll n,m = 1e16,k = 0;
  ll a[5];
  cin >> n;
  for ( ll i = 0; i < 5; i++ ) {
    cin >> a[i];
    m = min(m,a[i]);
     
  }
  
  ll x = n/m;
  if ( (n%m) == 0 ) x--;
  cout << x + 5 << endl;
  return 0;
}


Measured memory_bytes: 256
let lines = [];
let reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});

// 標準入力の読み込み
reader.on('line', function(line) {
    lines.push(line);
});

reader.on('close', function() {
    // 処理の記述
    const n = lines[0];

    let result = '';
    for (let i = 0; i < n; i++) {
        result += 'ACL';
    }


    // 表示
    console.log(result);
});

Measured memory_bytes: 30104
#include<stdio.h>

int judge(int,int);

int memo[1000001];

int main(void){
  int n,m,i,count;

  for(i=0;i<1000001;i++)
    memo[i]=-1;
  
  memo[0]=1;
  memo[1]=0;

  while(1){
    scanf("%d",&n);

    if(n==0)break;

      scanf("%d",&m);

    count=0;
    for(i=n;i<=m;i++){
      if(judge(i,1)==0){
	memo[i]=0;
	count++;
      }
    }

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

  return 0;
}

int judge(int x,int fg){

  if(x%2==0)judge(x/2,2);
  else if(x%3==0)judge(x/3,3);
  else if(x%5==0)judge(x/5,5);

  if(memo[x]==0){
    memo[x*fg]=0;
    return 0;
  }
  return memo[x]=1;
}

Measured memory_bytes: 4308
# -*- coding: utf-8 -*

def find(l, r, lst):

    if (l - 1) not in lst:
        return (l - 1)
    
    if (r + 1) not in lst:
        return (r + 1)
    
    return find(l - 1, r + 1, lst)



def main():
    # 整数の入力
    x, n = map(int, input().split())
    lst = list(map(int, input().split()))

    if n == 0:
        print(x)
        exit(0)

    if x not in lst:
        print(x)
        exit(0)
    
    print(find(x, x, lst))




if __name__ == '__main__':
    main()

Measured memory_bytes: 9204
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] val = new int[3];
		val[0] = sc.nextInt();
		val[1] = sc.nextInt();
		val[2] = sc.nextInt();
		Arrays.sort(val);

		int cnt = 0;
		while(true) {
			if(val[0] == val[1] && val[0] == val[2])
				break;
			else if( (val[0] == val[1]) && ((val[0] + 1) == val[2]) ) {
				cnt++;
				break;
			} else if( (val[0] + 1 == val[1]) && (val[1] == val[2]) ) {
				cnt += 2;
				break;
			}

			int dif = val[1] - val[0];
			if(dif >= 2) {
				cnt += dif / 2;
				val[0] += (dif / 2) * 2;
			} else {
				int dif2 = val[2] - val[1];
				cnt += dif2;
				val[0] += dif2;
				val[1] += dif2;
			}
			Arrays.sort(val);
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (ll i = a; i < b; i++)

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    cin >> a[0];
    ll s = a[0];

    rep(i, 1, n)
    {
        cin >> a[i];
        s ^= a[i];
    }
    rep(i, 0, n)
    {
        ll ans = s;
        ans ^= a[i];
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 4836
package main

import (
	"fmt"
)

func CircleinR(n []int) {
	W := n[0]
	H := n[1]
	x := n[2]
	y := n[3]
	r := n[4]

		switch {	
		case x + r > W: //right
			fmt.Println("No")
		case x - r < 0: //left
			fmt.Println("No")
		case y + r > H: //upper
			fmt.Println("No")
		case y - r < 0: //lower
			fmt.Println("No")
		default:
			fmt.Println("Yes")
		}
	
}

func main(){
	var dataInt []int
	var inp int
	
		for i := 0; i < 5; i++ {		
			fmt.Scan(&inp)
			dataInt = append(dataInt, inp)
		}

	CircleinR(dataInt)
}


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

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

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var arr0=Arr[0].split(" ").map(Number);
var n=arr0[0];
var m=arr0[1];
var l=arr0[2];
Arr.shift();
var nm=Arr.slice(0,n);
var ml=Arr.slice(n,Arr.length);

var ML=[]
for(var i=0;i<m;i++){
   var arr=(ml[i]).split(" ").map(Number);
   ML.push([]);
   for(var j=0;j<l;j++){
      ML[i][j]=arr[j];
   }
}

for(var i=0;i<n;i++){
   var NM=nm[i].split(" ").map(Number);
   var arr=[];
   for(var j=0;j<l;j++){
      var sum=0;
      for(var k=0;k<m;k++)sum+=NM[k]*ML[k][j];  
      arr.push(sum);    
   }
   console.log(arr.join(" "));
}

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

map<string, int> days;

void init() {
	days["SUN"] = 0;
    days["MON"] = 1;
    days["TUE"] = 2;
    days["WED"] = 3;
    days["THU"] = 4;
    days["FRI"] = 5;
    days["SAT"] = 6;
}

int main() {
	string S;
	cin >> S;
	init();
	int id = days[S];
	cout << 7 - id << endl;
    return 0;
}

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

using namespace std;

int main(void){
    
    int n;
    cin >> n;
    
    set<string> st;
    
    for (int i = 0; i < n; i++){
        string s;
        cin >> s;
        
        st.insert(s);
    }
    
    int ans = (int)st.size();
    cout << ans << endl;
}


Measured memory_bytes: 19184
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    void solve(Scanner sc, PrintWriter pw) {
        int N = sc.nextInt();
        Map<String, Integer> map = new HashMap<>();
        for (int i = 0 ; i < N; i++) {
            String str = sc.next();
            map.put(str, map.getOrDefault(str, 0) + 1);
        }
        String[] results = new String[]{"AC", "WA", "TLE", "RE"};
        for (String result : results) {
            pw.println(String.format("%s x %d", result, map.getOrDefault(result, 0)));
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        new Main().solve(sc, pw);
        pw.flush();
        pw.close();
        sc.close();
    }
}


Measured memory_bytes: 57324
#include <iostream>       
                          
int main(int argc, char *argv[]) {
    int matrix[100][100] = {{0}};
    int n, m = 0;         
    int vector[100] = {0};
                          
    std::cin >> n >> m;   
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            std::cin >> matrix[i][j];
        }                 
    }                     
    for(int i = 0; i < m; i++) {
        std::cin >> vector[i];
    }                     
                          
    for(int i = 0; i < n; i++) {
        long int ret = 0; 
        for(int j = 0; j < m; j++) {
            ret += matrix[i][j] * vector[j];
        }                 
        std::cout << ret << std::endl;
    }                     
    return 0;             
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define ld long double
#define tc() ll t;cin>>t;while(t--)
#define inp(n) ll n;cin>>(n)
#define inp2(n,m) ll n,m;cin>>(n);cin>>(m)
#define inp3(n,m,g) ll n,m,g;cin>>(n);cin>>(m);cin>>(g)
#define inps(s) string s;cin>>(s)
#define fr(i,n) for(ll i=0;i<n;i++)
#define rf(n,i) for(ll i=n-1;i>=0;i--)
#define vi vector<int >
#define vl vector<ll>
#define vd vector<ld>
#define vs vector<string >
#define pii pair<int,int>
#define pci pair<char ,int>
#define pic pair<int ,char>
#define psi pair<string ,int>
#define mii map<int ,int >
#define mci map<char ,int>
#define msi map<string ,int>
#define si set<int >
#define ss set<string>
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define mem(a,b) memset(a,b,sizeof(a))
#define mod 1000000007

int main() {
    fast
    int n;
    cin>>n;
    vector<long long int>v(n);
    bool zero = false;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
        if(v[i]==0)
        zero = true;
    }
    long long int ans=1;
    long long int prev=ans;
    long long int check = 1000000000000000000;
    ll large = 1e18;
	
	sort(v.rbegin(), v.rend());
	for(int i=0;i<n;i++){
		if (ans > check / v[i]) {
			ans = -1;
			break;
		}
		ans *= v[i];
	}
    if(zero)
    cout<<"0";
    else
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3976
#include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main(int argc, const char *argv[])
{
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  vector<pair<int, int>> bc(m);
  for (auto &n : a) cin >> n;
  for (auto &p : bc) cin >> p.first >> p.second;
  sort(a.begin(), a.end());
  sort(bc.begin(), bc.end(), [](auto &a, auto &b) { return b.second < a.second; });
  
  int cur = 0;
  for (auto &p : bc) {
    if (a[cur] >= p.second) break;
    for (int i = 0; i < p.first && a[cur] < p.second; i++, cur++) {
      a[cur] = p.second;
    }
  }

  cout << accumulate(a.begin(), a.end(), 0llu) << "\n";
  return 0;
}

Measured memory_bytes: 1408
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	int M;

	private void solve(){
		M = nextInt();
		out.println((24 - M) + 24);
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	private boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	private String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	private int nextInt() {
		return Integer.parseInt(next());
	}

	private long nextLong() {
		return Long.parseLong(next());
	}

	private double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll A,B,C;
    cin >> A >> B >> C;
    if(A == B && B == C && A % 2 == 0){
        cout << "-1" << endl;
        exit(0);
    }
    ll ans = 0;
    while(A % 2 == 0 && B % 2 == 0 && C % 2 == 0){
        ll na = B / 2 + C / 2;
        ll nb = A / 2 + C / 2;
        ll nc = A / 2 + B / 2;
        A = na; B = nb; C = nc;
        ans++;
    }
    cout << ans << endl;
}

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

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

  vector<int> a(N);
  vector<ll> sum(N);
  rep(i, N) cin >> a[i];

  sum[0] = a[0];
  for (int i = 1; i < N; i++) sum[i] = a[i] + sum[i - 1];

  ll ans = LLONG_MAX;
  for (int i = 0; i < N - 1; i++) {
    ans = min(ans, abs((sum[N - 1] - sum[i]) - sum[i]));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5636
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll ans=max(a*c,b*d);
  chmax(ans,max(a*d,b*c));
  out(ans);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 3648