akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define MAX 1000

int prim();

int n;
int A[MAX][MAX];

int main(){
  int i, j;
  int answer;

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      scanf("%d", &A[i][j]);
    }
  }
  
  answer = prim();
 
  printf("%d\n", answer);
  
  return 0;
}

int prim(){
  int i, j;
  int answer = 0;
  int min, minj;
  int visit[MAX],w[MAX];//weightの意

  for(i = 0; i < n; i++){
    visit[i] = 0;
    w[i] = 2001;
  }

  w[0] = 0;//最初の移動距離は0

  for(i = 0; i < n - 1; i++){
    min = 2001;
    
    for(j = 0; j < n; j++){
      if(w[j] < min && visit[j] == 0){//常に最小の値を上書きしていく
	min = w[j];
	minj = j;
      }
    }

    visit[minj] = 1;//移動した点はもう行かぬ

    for(j = 0; j < n; j++){
      if(A[minj][j] != -1 && A[minj][j] < w[j] && visit[j] == 0){
	w[j] = A[minj][j];
      }
    }
  }

  for(i = 0; i < n; i++){
    answer += w[i];
  }
  
  return answer;
}



Measured memory_bytes: 2108
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>
#include <memory>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <numeric>

int main() {
	int n, d; std::cin >> n >> d;
	std::cout << (n + 2 * d) / (2 * d + 1) << std::endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;


int main(void) {
    string str;
    int i,j;
    cin >> str;
    bool i_f, j_f;
    i_f = j_f = false;

    i = stoi( str.substr(0,2) );
    j = stoi( str.substr(2,2) );

    if ( 0<i && i<=12 ) {
        i_f = true;
    }
    if ( 0<j && j<=12 ) {
        j_f = true;
    }

    if (i_f && j_f) {
        cout << "AMBIGUOUS" << endl;
    } else if ( i_f ) {
        cout << "MMYY" << endl;
    } else if ( j_f ) {
        cout << "YYMM" << endl;
    } else {
        cout << "NA" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
#include <utility>

typedef long long ll;
using namespace std;

int main(void){
  int k,x,i;
  cin>>k>>x;

  for(int i=x-k+1;i<=x+k-1;i++){
    cout<<i<<" ";
  }
  cout<<endl;

  return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,n,j) for(int i=(j);i<(n);++i)
#define ssort(n) sort((n).begin(),(n).end())
#define rsort(n) sort((n).begin(),(n).end(),greater<int>())
#define mp make_pair
using ll=long long;
using ld=long double;
typedef pair<int,int> P;
typedef pair<P,int> COST;
#define repl(i,n) for(ll i=0;i<(n);++i)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
using Graf=vector<vector<int>>;
#define MAX 1000000007

int main()
{
    int n;
    cin >> n;
    vector<ll> x(n),y(n);

    rep(i,n){
        cin >> x[i] >> y[i];
    }
    vector<ll> tmp(n);
    vector<ll> tmp_2(n);
    rep(i,n){
        tmp[i]=x[i]+y[i];
        tmp_2[i]=x[i]-y[i];
    }
    ssort(tmp);ssort(tmp_2);
    ll ans=max(abs(tmp[0]-tmp[n-1]),abs(tmp_2[0]-tmp_2[n-1]));
    cout << ans << endl;
}

Measured memory_bytes: 9600
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
from _collections import defaultdict
from functools import lru_cache

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3,d + 1,2):
            if n % i == 0:
                return False
        return True

MOD = int(1e09) + 7

def main():
    N = cin.int()
    S = cin.stringList(N)
    T = [defaultdict(int) for i in range(N)]
    for i,s in enumerate(S):
        for t in s:
            T[i][t]+=1
    for s in string.ascii_lowercase:
        m = int(1e09)
        for t in T:
            m = min(m,t[s])
        print(s * m,end="")
    print("")
    return

if __name__ == "__main__":
    main()


Measured memory_bytes: 40048
# cattuper's solution
import sys
input = sys.stdin.buffer.readline
n, q = map(int, input().split())
c = list(map(int, input().split()))
l = [0] * q
r = [0] * q

queries = [[] for _ in range(n)]
rights = [[] for _ in range(n)]
for i in range(q):
    l[i], r[i] = map(int, input().split())
    l[i] -= 1
    queries[l[i]].append(i)

last_app = [-1] * (n+1)
for i in range(n):
    if last_app[c[i]] != -1:
        last = last_app[c[i]]
        rights[last].append(i)
    last_app[c[i]] = i



ans = [0] * q

seg = [0] * (1 << 20)

def add(x):
    x += 1 << 19
    while x:
        seg[x] += 1
        x = x // 2

def sum_of(l, r):
    l += 1 << 19
    r += 1 << 19
    ans = 0
    while l < r:
        if l % 2 == 1:
            ans += seg[l]
            l += 1
        if r % 2 == 1:
            ans += seg[r-1]
            r -= 1
        l //= 2
        r //= 2
    return ans

        
for i in range(n-1, -1, -1):
    for right in rights[i]:
        add(right)
    for q_ind in queries[i]:
        left = l[q_ind]
        right = r[q_ind]
        ans[q_ind] = (right - left) - sum_of(left, right)

for i in range(q):
    print(ans[i])

Measured memory_bytes: 227000
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int cCount = 0;
		
		if(s.matches("A[a-z][Ca-z]*[a-z]"))
			for(int i = 2; i < s.length()-1; i++) {
				char c = s.charAt(i);
				char e = 'C';
				if(c == e)
					cCount++;
			}
			if(cCount == 1)
				System.out.println("AC");
		else
			System.out.println("WA");
	}
}

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

cw = [0] * (n + 1)
for i in range(1, n + 1):
    if s[i - 1] == 'W':
        cw[i] = cw[i - 1] + 1
    else:
        cw[i] = cw[i - 1]

s2 = s[::-1]
ce = [0] * (n + 1)
for i in range(1, n + 1):
    if s2[i - 1] == 'E':
        ce[i] = ce[i - 1] + 1
    else:
        ce[i] = ce[i - 1]
ce = ce[::-1]

ans = float('inf')
for i in range(n):
    ans = min(ans, cw[i] + ce[i + 1])
print(ans)

Measured memory_bytes: 24652
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<stack>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
int main()
{
	ll n;
	scanf("%lld",&n);
	printf("%lld\n",n*(n-1)/2);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};



int main(void) {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n){
    cin >> a[i];
    a[i]--;
  }
  vi b(n);
  rep(i,n){
    cin >> b[i];
  }
  vi c(n-1);
  rep(i,n-1){
    cin >> c[i];
  }
  int sum = 0;
  rep(i,n){
    sum += b[a[i]];
    if(i==n-1) break;
    if(a[i]+1==a[i+1]) sum += c[a[i]];
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{o:chars,e:chars};
    for i in 0..max(o.len(),e.len()) {
        if i < o.len() {print!("{}", o[i])};
        if i < e.len() {print!("{}", e[i])};
    }
    println!("");
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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 ctoi(char c){return c-'0';}


// TODO: write
int main() {
  int n,m;cin>>n>>m;
  int ans = n*(n-1)/2 + m*(m-1)/2;
  print(ans);
  return 0;
}


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

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

    vector<ll> t(n);
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> t.at(i) >> a.at(i);
      	//cout << t.at(i) << ' ' << a.at(i) << endl;
    }

    vector<ll> x(n);
    x.at(0) = 1;
    for (int i = 1; i < n; i++) {
        x.at(i) = max( ( (t.at(i-1) * x.at(i-1) + t.at(i)-1) / t.at(i) ), (a.at(i-1) * x.at(i-1) + a.at(i)-1) / a.at(i)) ;
    	//cout << x.at(i) << endl;
    }

    ll ans = (t.at(n-1) + a.at(n-1)) * x.at(n-1);
    cout << ans << endl;
    return 0;
}

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

public class Main {	
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
        int a = fs.nextInt();
		int b = fs.nextInt();
		int c = fs.nextInt();
		
	System.out.println(c+" "+a+" "+b);


	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

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

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

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

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

	}
}


Measured memory_bytes: 21204
n = int(input())
a = list(map(int, input().split()))
div = (10 ** 9) + 7

#最大公約数
def gcb(a, b):
    while b!=0:
        a,b=b,a%b
    return a

#最小公倍数
def lcm(a,b):
    return a * b // gcb(a, b)

lc = 1
for i in range(n):
    lc = lcm(lc, a[i])

ans = 0
for i in range(n):
    ans += lc // a[i]
print(ans % div)

Measured memory_bytes: 4084
#include <stdio.h>
#include <stdlib.h>

int main(void){
	int i,j,n,x,ans;

	while(1){
		scanf("%d",&n);
		if(n==0)break;

		ans=-100000;
		int* a = (int*)malloc(sizeof(int)*(n+1));
		a[0]=0;

		for(i=1;i<=n;i++){
			scanf("%d",&x);
			a[i]=a[i-1]+x;
		}

		for(i=0;i<n;i++){
			for(j=i+1;j<=n;j++){
				if(a[j]-a[i]>ans)ans=a[j]-a[i];
			}
		}

		free(a);
		printf("%d\n",ans);
	}

	return 0;
}

Measured memory_bytes: 612
//31
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int n,m,s;cin>>n>>m>>s,n|m|s;){
    int dp[2][51][3001]={{{1}}};
    for(int i=1;i<=m;i++){
      copy(dp[i+1&1][0],dp[(i+1&1)+1][0],dp[i&1][0]);
      for(int j=0;j<n*n;j++){
	for(int k=0;k+i<=s;k++){
	  dp[i&1][j+1][k+i]=(dp[i&1][j+1][k+i]+dp[i+1&1][j][k])%100000;
	}
      }
    }
    cout<<dp[m&1][n*n][s]<<endl;
  }
  return 0;
}
      

Measured memory_bytes: 2376
import sys
input = sys.stdin.readline

def calc():
    x, n = [int(x) for x in input().split()]

    if n == 0:
        q = [x for x in range(102)]
    else:
        p = [int(x) for x in input().split()]
        q = [x for x in range(102) if x not in p]
    diffs = [abs(x - qk) for qk in q]
    mindiff = min(diffs)
    idx = diffs.index(mindiff)
    print(q[idx])

calc()

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

int main() {
    string s;
    getline(cin,s);
    rep(i,0,s.length()) {
        if('a' <= s[i] && s[i] <= 'z') s[i] -= 32;
    }
    cout << s << endl;
}

Measured memory_bytes: 1172
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
	int N,C,D[30][30],c[500][500];
	int X0[30]={0},X1[30]={0},X2[30]={0};
	
	cin>>N>>C;
	REP(i,C){
		REP(j,C){
			cin>>D[i][j];
		}
	}
	REP(i,N){
		REP(j,N){
			cin>>c[i][j];
			if((i+j)%3==0){
				X0[c[i][j]-1]++;
			}
			else if((i+j)%3==1){
				X1[c[i][j]-1]++;
			}
			else{
				X2[c[i][j]-1]++;
			}
		}
	}
	
	
	int ans=1000000000;
	REP(i,C){
		REP(j,C){
			REP(k,C){
				if(i!=j&&j!=k&&k!=i){
					int t=0;
					REP(l,C){
						t+=D[l][i]*X0[l];
						t+=D[l][j]*X1[l];
						t+=D[l][k]*X2[l];
					}
					ans=min(ans,t);
				}
				
			}
		}
	}
	
	
	cout<<ans<<endl;



	return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;


int main() {
	
    string s ;
    cin >> s ;
    int count = 0;
   for(int i=0;i<3;i++)
   {
     if(s[i]=='o') count++ ;
   }

    cout << 700+(count*100) << endl ;  
	return 0;
}



Measured memory_bytes: 256
import copy
S = str(input())
s = list(S)
L = len(s)
break2 = 0
text = ""
for i in range(L):
    j = 0
    for j in range(L):
        t = copy.deepcopy(s)
        del t[i:j+1]
        text = "".join(t)
        if text == "keyence":
            print("YES")
            break2 = 1
            break
        else:
            pass
    if break2 == 1:
        break
if break2 == 0:
    print("NO")

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

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector < pair < int, int >>sc(M);
	for (int i = 0; i < M; i++) {
		int s, c;
		cin >> s >> c;
		s--;
		sc[i] = make_pair(s, c);
	}
	sort(sc.begin(), sc.end());

	vector < int >ans(N, 0);

	bool isFirstCaracterSpecified = false;
	for (int i = 0; i < M; i++) {
		if (i > 0) {
			if (sc[i - 1].first == sc[i].first
			    && sc[i - 1].second != sc[i].second) {
				cout << -1 << endl;
				return 0;
			}
		}
		if (sc[i].first == 0) {
			isFirstCaracterSpecified = true;
		}
		ans[sc[i].first] = sc[i].second;
	}

	if (!isFirstCaracterSpecified && N > 1) {
		ans[0] = 1;
	}

	if (ans[0] == 0 && N > 1) {
		cout << -1 << endl;
		return 0;
	}

	for (int i = 0; i < N; i++) {
		cout << ans[i];
	}
	cout << "\n";

	return 0;
}


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

#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef pair<int, int> pii;

int a, b;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> a >> b;
	if (a < b)
		cout << 0;
	else
		cout << 10;
	return 0;
}


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

int main()
{
    int n, m, x, a[110];
    cin >> n >> m >> x;
    for (int i = 0; i < m; i++) cin >> a[i];

    sort(a, a + m);

    int cnt = 0, b = 0, c = 0;
    for (int i = 0; i <= n; i++) {
        if (a[cnt] == i) {
            cnt++;
            if (i < x) b++;
            if (i > x) c++;
        }
    }

    cout << min(b, c) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	  public static void main(String args[]){
      	Scanner scan = new Scanner(System.in);
            
        int N = scan.nextInt();
        String S = scan.next();
        
        int x = 0;
        int cnt = 0;
        
        String[] strArray = S.split("");
		for(String s_one : strArray) {
		  if(s_one.charAt(0) == 'I')x++;
          else if(s_one.charAt(0) == 'D')x--;
          
          if(x > cnt)cnt = x;
		}
        
        System.out.println(cnt);
	  }
}

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

#define Pi acos(-1)
#define INPUT_OUTPUT { \
	freopen("input.txt", "r", stdin); \
	freopen("output.txt", "w", stdout); \
}

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

int main()
{
	//INPUT_OUTPUT; // I use this to test code easily in my code editor!
	
	int a, b;
	cin >> a >> b;
	if((a == 1 || a == 2) && (b == 2 || b == 1)) cout << "3\n";
	else if((a == 2 || a == 3)&&(b==2||b==3)) cout << "1\n";
	else if((a==1||a==3) && (b==1 || b == 3)) cout << "2\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a){
    long long ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
int main(){
    ll a,b;
    cin >> a >> b;
    if(a>b)swap(a,b);
    if(a==1&&b==1){
        cout << 1 << endl;
        return 0;
    }
    if(a==1&&b!=1){
        cout << b-2 << endl;
        return 0;
    }
    cout << (a-2)*(b-2) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(){
	int D,N;
	int i,j;
	scanf("%d %d",&D,&N);
	int temp[D];
	for(i=0;i<D;i++){
		scanf("%d",&temp[i]);
	}
	int min[N];
	int max[N];
	int hade[N];
	int up[D];
	int down[D];
	for(i=0;i<N;i++){
		scanf("%d %d %d",&min[i],&max[i],&hade[i]);
	}
	for(i=0;i<D;i++){
		up[i]=0;
		down[i]=100;
	}
	for(i=0;i<D;i++){
		for(j=0;j<N;j++){
			if(min[j]<=temp[i]&&temp[i]<=max[j]){
				if(up[i]<hade[j]){
					up[i]=hade[j];
				}
				if(down[i]>hade[j]){
					down[i]=hade[j];
				}
			}
		}
	}
	int data[D][2];
	for(i=0;i<D;i++){
		data[i][0]=0;
		data[i][1]=0;
	}
	for(i=1;i<D;i++){
		data[i][0]=abs(up[i]-up[i-1])+data[i-1][0]<abs(up[i]-down[i-1])+data[i-1][1] ? abs(up[i]-down[i-1])+data[i-1][1] : abs(up[i]-up[i-1])+data[i-1][0];
		data[i][1]=abs(down[i]-up[i-1])+data[i-1][0]<abs(down[i]-down[i-1])+data[i-1][1] ? abs(down[i]-down[i-1])+data[i-1][1] : abs(down[i]-up[i-1])+data[i-1][0];
	}
	printf("%d\n",data[D-1][0]>data[D-1][1]?data[D-1][0]:data[D-1][1]);
	return 0;
}

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


int main() {

    int k, s;
    cin >> k >> s;
    int ans = 0;
    rep(i,k+1) {
        rep(j,k+1) {
            int l = s - i - j;
            if (0 <= l && l <= k) ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()  
{ 
    FAST_INP;
    int l,r,d;
    cin >> l >> r>> d;
    int ans=0;
    for(int i=l;i<=r;i++){
    	if(i%d==0) ans++;
	}
	cout << ans;
    return 0;
} 

Measured memory_bytes: 3648
#include<stdio.h>

int main(){
int a, b, d, r;
scanf("%d %d", &a, &b);
	double f;
	d = a / b;
	r = a % b;
	f = (double)a / (double)b;
	printf("%d %d %f\n", d, r, f);
    return 0;
}


Measured memory_bytes: 2760
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007


 int main(){

  string s;
  long long k;

   cin>>s>>k;
   int ichinum = 0;

   for(int i=0;i<s.size();i++){
    if(s[i] == '1')
        ichinum++;
     else
            break;
   }

   if(ichinum >= k)
    cout<<"1"<<endl;
   else
    cout<<s[ichinum]<<endl;

 return 0;
 }


Measured memory_bytes: 3608
def a_plus_b():
	n, a, b = map(int, raw_input().split(" "))
	if a>b:
		print 0
		return
	if n==1:
		if a==b:
			print 1
		else:
			print 0
		return
	min_sum = a*(n-1)+b
	max_sum = b*(n-1)+a
	print max_sum-min_sum+1


if __name__ == "__main__":
	a_plus_b()

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

#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
int mod = 1e9 + 7, size = 1e6 + 1;

int main()
{
    fast

    double d,t,s;
    cin >> d >> t >> s;

    if ((d/s) <= t) cout << "Yes\n";
    else cout << "No\n";
}
// () ! # &


Measured memory_bytes: 3732
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
class Solver{
public:
    static const int MAXN=1e2+10;
    static const ll MOD=1e9+7;
    int N;
    const char s[5]="ACGT";
    ll dp[MAXN][4][4][4];
    bool check(int i,int j,int k){
        string r="";
        r+=s[i];
        r+=s[j];
        r+=s[k];
        if(r=="AGC")return false;
        return true;
    }
    void solve(){
        cin>>N;
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                for(int k=0;k<4;k++){
                    if(check(i,j,k)&&check(i,k,j)&&check(j,i,k))
                    dp[3][i][j][k]=1;
                }
            }
        }
        for(int l=4;l<=N;l++){
            for(int i=0;i<4;i++){
                for(int j=0;j<4;j++){
                    for(int k=0;k<4;k++){
                        for(int u=0;u<4;u++){
                            if(check(i,j,k)&&check(i,k,j)&&check(j,i,k)&&check(u,i,k)&&check(u,j,k)){
                                dp[l][i][j][k]=(dp[l][i][j][k]+dp[l-1][u][i][j])%MOD;
                            }
                        }
                    }
                }
            }
        }
        ll ans=0;
        for(int i=0;i<4;i++){
            for(int j=0;j<4;j++){
                for(int k=0;k<4;k++){
                    ans=(ans+dp[N][i][j][k])%MOD;
                }
            }
        }
        cout<<ans;
    }
};
int main()
{
    // freopen("in.txt","r",stdin);
    (new Solver())->solve();
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

int N, C, s[100005], t[100005], aa[30][200005];

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

    cin >> N >> C;

    rep(i, N) {
        int c;
        cin >> s[i] >> t[i] >> c;
        --c;
        s[i] *= 2;
        t[i] *= 2;
        FOR(j, s[i], t[i])aa[c][j] = 1;
    }
    rep(c, C)FOR(i, 1, 200005) {
        if (aa[c][i] && !aa[c][i - 1])aa[c][i - 1] = 1;
    }

    int ma = 0, cnt = 0;
    FOR(i, 1, 200005) {
        rep(c, C){
            if (aa[c][i] && !aa[c][i - 1]) {
                cnt++;
            } else if (!aa[c][i] && aa[c][i - 1]) {
                cnt--;
            }
        }
        smax(ma, cnt);
    }
    cout << ma << endl;
}


Measured memory_bytes: 24448
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=1e5+9;
int main()
{
    FASTINOUT;
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    if (s[0]=='a'&&s[1]=='b'&&s[2]=='c')
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

inline int readin(){
	int x=0,c;
	for (;(c=getchar())<'0'||c>'9';);
	for (;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+c-48;
	return x;
}

int main(){
	int n=readin(),i=readin();
	printf("%d",n-i+1);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int wall, eall;
    wall = 0;
    eall = 0;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'W')
            wall++;
        if (s[i] == 'E')
            eall++;
    }
    int wbef = 0;
    int ebef = 0;
    int waf = wall;
    int eaf = eall;
    int cres = 99999999;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'W')
            waf--;
        if (s[i] == 'E')
            eaf--;
        if (cres > wbef + eaf)
            cres = wbef + eaf;
        if (s[i] == 'W')
            wbef++;
        if (s[i] == 'E')
            ebef++;
    }
    cout << cres << endl;
    return 0;
}

Measured memory_bytes: 900
package main

import "fmt"

func main() {
	var c string
	fmt.Scan(&c)
	m := map[byte]byte{
		'A': 'T',
		'T': 'A',
		'G': 'C',
		'C': 'G',
	}
	fmt.Println(string(m[c[0]]))
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>

using namespace std;

typedef long long ll;

#define rep(i, N) for (ll i = 0; i < (ll)(N); ++i)

int main(){
    ll N,flag=0;
    cin >> N;
    vector<int> A(N,0);
    for(ll i=0;i<N;i++){
        cin >> A[i];
    }
    sort(A.begin(),A.end());
    for(ll i=0;i<N-1;i++){
        if(A[i]==A[i+1]){
            flag = 1;
        }
    }
    if(flag==1){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
    return 0;
}

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

struct edge{int s,t,n;}e[200010];
int n,h[100010],ans;

bool dfs(int x,int f)
{
	bool p=0;
	for (int i=h[x],y; y=e[i].t,i; i=e[i].n)
		if ((y!=f)&&(dfs(y,x)))
			ans+=!p,p=1;
	return !p;
}

void work()
{
	scanf("%d",&n);
	for (int i=1,u,v,tot=0; i<n; i++)
		{
			scanf("%d %d",&u,&v);
			e[++tot]=(edge){u,v,h[u]},h[u]=tot;
			e[++tot]=(edge){v,u,h[v]},h[v]=tot;
		}
	dfs(1,0);
	puts(2*ans==n?"Second":"First");
}

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


Measured memory_bytes: 2944
#!/usr/bin/env python3
# CGL_1_B: Points/Vectors - Reflection


def dprod(v1, v2):
    x1, y1 = v1
    x2, y2 = v2
    return x1 * x2 + y1 * y2


def proj(p1, p2, p):
    x1, y1 = p1
    x2, y2 = p2
    x, y = p

    v1 = (x2-x1, y2-y1)
    v2 = (x-x1, y-y1)
    r = dprod(v1, v2) / dprod(v1, v1)

    return (x1 + r*v1[0], y1 + r*v1[1])


def refl(p1, p2, p):
    px, py = p
    hx, hy = proj(p1, p2, p)
    return (px + 2.0*(hx - px), py + 2.0*(hy - py))


def run():
    x1, y1, x2, y2 = [int(i) for i in input().split()]
    q = int(input())

    for _ in range(q):
        x, y = [int(i) for i in input().split()]
        print("{:.10f} {:.10f}".format(*refl((x1, y1), (x2, y2), (x, y))))


if __name__ == '__main__':
    run()



Measured memory_bytes: 5648
import java.util.*;
public class Main{
	static boolean Anag(String s, String t){
		HashMap<Character, Integer> map = new HashMap<>();
		map.put('a', 1);
		map.put('b', 2);
		map.put('c', 3);
		map.put('d', 4);
		map.put('e', 5);
		map.put('f', 6);
		map.put('g', 7);
		map.put('h', 8);
		map.put('i', 9);
		map.put('j', 10);
		map.put('k', 11);
		map.put('l', 12);
		map.put('m', 13);
		map.put('n', 14);
		map.put('o', 15);
		map.put('p', 16);
		map.put('q', 17);
		map.put('r', 18);
		map.put('s', 19);
		map.put('t', 20);
		map.put('u', 21);
		map.put('v', 22);
		map.put('w', 23);
		map.put('x', 24);
		map.put('y', 25);
		map.put('z', 26);
		int[] sh = new int[s.length()];
		int[] th = new int[t.length()];
		for(int i=0; i<s.length(); i++){
			sh[i] = map.get(s.charAt(i));
		}
		for(int i=0; i<t.length(); i++){
			th[i] = map.get(t.charAt(i));
		}
		Arrays.sort(sh);
		Arrays.sort(th);
		for(int i=0; i<=(t.length())/2; i++){
			int thh = th[i];
			th[i] = th[t.length()-1-i];
			th[t.length()-1-i] = thh;
		}
		for(int i=0; i<Math.min(s.length(), t.length()); i++){
			if(sh[i]<th[i])return true;
			if(sh[i]>th[i])return false;
		}
		if(s.length()>=t.length())return false;
		return true;
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		System.out.println(Anag(S, T)==true ? "Yes" : "No");
	}
}

Measured memory_bytes: 21844
import sys
x=int(input())
if x>=5000:
    print(1)
else:
    for i_100 in range(x//100+1):
        for i_101 in range(x//100+1):
            for i_102 in range(x//100+1):
                for i_103 in range(x//100+1):
                    for i_104 in range(x//100+1):
                        for i_105 in range(x//100+1):
                            if i_100*100+i_101*101+i_102*102+i_103*103+i_104*104+i_105*105==x:
                                print(1)
                                sys.exit()
    print(0)

Measured memory_bytes: 44124
#include <bits/stdc++.h>
using namespace std;
//A - Addition and Subtraction Easy
int main() {
  int a,b;
  char op;
  cin >> a >> op >> b;
  if(op=='+')
    cout << a + b << endl;
  else if (op=='-')
    cout << a - b << endl;
  else
    cout << "error" << endl;
}


Measured memory_bytes: 256
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65
//おまじない



int main() {

	char pic[101][101];
	int h, w;

	cin >> h >> w;

	rep(i, 0, h) {
		rep(j, 0, w) {
			cin >> pic[i][j];
		}
	}

	rep(i,0,h+2){
		rep(j, 0, w + 2) {
			if (j == w + 1) {
			cout << '#' << endl;
			}
			else if (i == 0||i==h+1) {
				cout << '#';
			}
			else if (j == 0) {
				cout << '#';
			}else {
				cout << pic[i-1][j-1];
			}
		}
	}


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,ans=0;
int a[50],b[50];
bool g[50][50] = {false} , visit[50] = {false};
void dfs(int v);
int main(){
  cin >> n >> m;
  for (size_t i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    g[a[i]-1][b[i]-1] = g[b[i]-1][a[i]-1] = true;
  }
  for (size_t i = 0; i < m; i++) {
    g[a[i]-1][b[i]-1] = g[b[i]-1][a[i]-1] = false;
    for (size_t x = 0; x < n; x++) visit[x] = false;
    dfs(0);
    for (size_t x = 0; x < n; x++){
      if(!visit[x]){
        ans++;
        break;
      }
    }
    g[a[i]-1][b[i]-1] = g[b[i]-1][a[i]-1] = true;
  }
  cout << ans;
}

void dfs(int v){
  visit[v] = true;
  for (size_t i = 0; i < n; i++) {
      if(!g[i][v] || visit[i]) continue;
      dfs(i);
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

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

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long 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 {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= 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 {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b>>1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;


//////////////////////////
ll K, N;

void prev(vector<ll>& A) {
	ll M = A.size();
	if (A[M - 1] == 1) { A.pop_back(); return; }

	A[M - 1]--;

	rep(i, N - M) {
		A.push_back(K);
	}


}

int main() {
	ll N;
	cin >> N;
	vector<ll> A(N + 1);
	vector<ll> neg;

	cin >> A[1];
	for(ll i=2; i<=N; i++) {
		char c;
		cin >> c;
		if (c == '-') { neg.push_back(i); }
		cin >> A[i];
	}
	ll M = neg.size();

	vector<ll> rui(N + 1, 0);
	repn(i, N) rui[i] = rui[i - 1] + A[i];
	ll S = rui[N];

	vector<ll> nrui(M + 1, 0);
	repn(i, M) nrui[i] = nrui[i - 1] + A[neg[i - 1]];

	ll ans = -INF;

	repn(i, M-1) {
		ans = max(ans, S - 2 * (nrui[i] + rui[neg[i] - 1] - rui[neg[i - 1]]));
		//cout << nrui[i] << endl;
		//cout << rui[neg[i] - 1] << " " << rui[neg[i - 1]] << endl;
	}
	ans = max(ans, S - 2 * nrui[M]);

	cout << ans << endl;
	
}


Measured memory_bytes: 3572
X = int(input())

ints = [5, 4, 3, 2, 1]
flag = False
if X >= 100:
  two_pieces = X % 100
  other_pieces = (X - two_pieces) / 100
  
  for i in ints:
    num_include = int(two_pieces / i)
    if num_include > 0 and num_include <= other_pieces:
        two_pieces -= i * num_include  
        other_pieces -= num_include
    if two_pieces == 0:
        flag = True
        break
    if other_pieces == 0: 
        break
  
print(int(flag))

Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int x = max(a, max(b, c));
  int ans;
  if(x == a) ans = b + c;
  if(x == b) ans = a + c;
  if(x == c) ans = b + a;
  cout << ans << endl;
}


Measured memory_bytes: 256
using System;

namespace AOJ.ITP
{
    public class StructuredProgramming
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());

            string output = "";
            // 3の倍数または"3"が含まれる数字を出力
            for (int i = 1; i <= n; i++)
            {
                if (i % 3 == 0) { output += " " + i; }
                else
                {
                    int tmp = i;
                    while (tmp > 0)
                    {
                        if (tmp % 10 == 3)
                        {
                            output += " " + i;
                            break;
                        }
                        else { tmp /= 10; }
                    }
                }
            }

            Console.WriteLine(output);
        }
    }
}

Measured memory_bytes: 6020
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int count = 0;
        int maxCount = 0;
        int N = in.nextInt();
        int actual = in.nextInt();
        for (int i = 1; i < N; i++) {
            int siguiente = in.nextInt();
            if(actual >= siguiente){
                count++;
            }else{
                if(maxCount< count){
                    maxCount = count;
                }
                count = 0;
            }
            
            actual = siguiente;
            
        }
        
        if(maxCount< count){
            maxCount = count;
        }
        System.out.println(maxCount);
                
    }
    
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,a,n) for(int i=a;i<=n;i++)
#define repb(i,a,n) for(int i=a;i>=n;i--)
#define trav(a,x) for(auto a=x.begin();a!=x.end();a++)
#define all(x) x.begin(),x.end()
#define fst first
#define snd second
#define pb push_back
#define mp make_pair
typedef long double ld;
typedef pair <int,int> pii;
typedef vector <int> vi;
typedef long long ll;


void pre(){

}

void solve(){
  map<string,int> m1;
  string s1="AC",s2="WA",s3="TLE",s4="RE";

  int n; cin>>n;

  while(n--){
    string s; cin>>s;
    m1[s]++;
  }

  cout<<s1<<" "<<"x"<<" "<<m1[s1]<<"\n";
  cout<<s2<<" "<<"x"<<" "<<m1[s2]<<"\n";
  cout<<s3<<" "<<"x"<<" "<<m1[s3]<<"\n";
  cout<<s4<<" "<<"x"<<" "<<m1[s4]<<"\n";
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  pre();
  int t; t=1;
  rep(i,t) solve();
  return 0;
}


Measured memory_bytes: 3660
#!/usr/bin/env python3

import sys
from math import sqrt
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, D = map(int, input().split())

X = [list(map(int, input().split())) for _ in range(N)]


def check_bi(Y, Z):
    sum_ = 0
    for y, z in zip(Y, Z):
       sum_ += (y-z)**2

    for i in range(int(sqrt(sum_))+1):
        if i * i == sum_:
            return True
    return False


count = 0
for i, x in enumerate(X[:len(X)-1]):
    for y in X[i+1:]:
        count += check_bi(x, y)

print(count)



Measured memory_bytes: 9156
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	i64 a, b, x;
	cin >> a >> b >> x;
	i64 div_a = a % x == 0 ? a / x - 1 : a / x;
	i64 div_b = b / x;
	print(div_b - div_a);
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <bitset>
#include <cmath>
#define ff first
#define ss second
#define MAXN 300005
#define INF 1000000001000000001LL
#define int long long

using namespace std;

const int mod = 998244353; //1000000007;
int n, i, ans, a[MAXN], b[MAXN];
set <pair<int, int> > s;

main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base :: sync_with_stdio(false);
    cin.tie();
    cin >> n;

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

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

        s.insert({b[i], i});
    }

    while(s.size() != 0){
        int i = (--s.end()) -> ss;
        s.erase(--s.end());
        int x = b[(i + 1) % n], y = b[(i + n - 1) % n];

        if(b[i] == a[i])
            continue;
        
        if(b[i] <= x + y){
            cout << "-1";
            return 0;
        }

        if(a[i] >= x + y){
            if((b[i] - a[i]) % (x + y)){
                cout << "-1";
                return 0;
            }

            ans += (b[i] - a[i]) / (x + y);
            b[i] = a[i];
        }
        else{
            int cnt = (b[i] - 1) / (x + y);
            ans += cnt;
            b[i] -= cnt * (x + y);

            if(b[i] != a[i])
                s.insert({b[i], i});
        }
    }

    cout << ans;
    return 0;
}







Measured memory_bytes: 16384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

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

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

bool comp(P a, P b){
	return (a.first < b.first);
}

int main(void){
	int n,i,j,a,b,c,l[10],p,q,r,x,y,z,ans=INF,tmp,t;
	cin >> n;
	cin >> a >> b >> c;
	for(i=0; i<n; ++i){
		cin >> l[i];
	}
	for(i=0; i<(1<<(2*n)); ++i){
		t = i;
		p = 0; q = 0; r = 0;
		x = 0; y = 0; z = 0;
		tmp = 0;
		for(j=0; j<n; ++j){
			switch(t%4){
				case 1:
				++p;
				x += l[j];
				break;
				case 2:
				++q;
				y += l[j];
				break;
				case 3:
				++r;
				z += l[j];
				break;
			}
			t /= 4;
		}
		if(!(p&&q&&r)){
			continue;
		}
		tmp += 10*(p+q+r-3);
		tmp += abs(x-a)+abs(y-b)+abs(z-c);
		ans = min(tmp,ans);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

#+++++
		
def main():
	l, r = map(int, input().split())
	
	if r - l >= 2019:
		return 0
	
	min_v = 2020
	for i in range(r+1)[l:]:
		for j in range(r+1)[i+1:]:
			v = i * j % 2019
			#print(i,j, i*j, v)
			min_v = v if v < min_v else min_v
		
	print(min_v)
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 3064