akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
// template starts
typedef long long int ll;
ll fact(ll n, ll p){
	ll ans = 1;
	for(ll i = 1; i <= n; i++){
		ans *= i;
		ans %= p;
	}
	return ans;
}
ll power(ll x, ll n, ll p){
	ll res = 1;
	if(n == 1) return x%p;
	if(n%2 == 1) res = x%p;

	ll temp = power(x,n/2,p);
	return res*((temp*temp)%p)%p;
}
ll inv(ll a, ll p){
	return power(a,p-2,p);
}
ll nCr(ll n, ll r, ll p){
	if(r > n) return 0;
	ll t1 = fact(n,p);
	ll t2 = inv(fact(r,p),p);
	ll t3 = inv(fact(n-r,p),p);

	return (((t1*t2)%p)*t3)%p;
}
vector<vector<ll> > multiply(vector<vector<ll> > &a, vector<vector<ll> > &b, ll p){
	int r1,c1,r2,c2;
	r1 = a.size(); c1 = a[0].size();
	r2 = b.size(); c2 = b[0].size();

	vector<vector<ll> > result(r1,vector<ll>(c2,0));

	if(c1 != r2) return result;

	for(int i = 0; i < r1; i++){
		for(int j = 0; j < c2; j++){
			for(int k = 0; k < c1; k++){
				result[i][j] += a[i][k]*b[k][j];
				result[i][j] %= p;
			}
		}
	}
	return result;
}

vector<vector<ll> > power(vector<vector<ll> >&a,ll n, ll p){
	int r = a.size();
	vector<vector<ll> > result(r,vector<ll>(r,0));
	for(int i = 0; i < r; i++) result[i][i] = 1;

	while(n > 0){
		if(n%2 == 1){
			result = multiply(result,a,p);
		}
		n /= 2;
		a = multiply(a,a,p);
	}
	return result;
}
// template ends here

void solve(){
	// code starts from here
	string str;
	cin >> str;
	if(find(all(str),'7') == str.end()) cout << "No" << endl;
	else cout << "Yes" << endl;
}

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

	int T;
	//cin >> T;
	T = 1;
	while(T--){
		solve();
	}

	return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int n,m;
double ans;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=1000;i++)
		ans+=1/pow(2,m)*pow(((pow(2,m)-1)/pow(2,m)),i-1)*i*1900*m+(n-m)*100*pow(((pow(2,m)-1)/pow(2,m)),i-1);
	printf("%.0lf",ans);
	return 0;	
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <bitset>

using ll = long long;

using namespace std;

using P = pair<int, int>;
#define fi first
#define se second

#define MAX 100010

vector<P> G[MAX];
bitset<MAX> flip;
bool visited[MAX] = {0};
bitset<2*MAX> ans;

int dfs(int i) {
    visited[i] = true;
    int sum = flip[i];
    for (auto &g:G[i]) {
        if (visited[g.fi]) continue;
        int res = dfs(g.fi);
        ans[g.se] = (res % 2);
        sum += res;
    }
    return sum;
}

int main() {
    int n, m;
    cin >> n >> m;
    P bombs[n];
    for (auto &bi:bombs) {
        cin >> bi.fi >> bi.se;
    }
    sort(bombs, bombs+n);
    bool prev = 0;
    for (int i=0; i<n; i++) {
        flip[i] = (bombs[i].se != prev);
        prev = bombs[i].se;
    }
    flip[n] = prev;
    for (int i=0; i<m; i++) {
        int l, r;
        cin >> l >> r;
        int ppl = partition_point(bombs, bombs+n, [&](P x) { return x.fi < l; }) - bombs,
            ppr = partition_point(bombs, bombs+n, [&](P x) { return x.fi <= r; }) - bombs;
        if (ppl == ppr) continue;
        G[ppl].push_back({ppr, i});
        G[ppr].push_back({ppl, i});
    }
    for (int i=0; i<=n; i++) {
        if (visited[i]) continue;
        if (dfs(i) % 2) {
            cout << -1 << '\n';
            return 0;
        }
    }
    cout << ans.count() << '\n';
    for (int i=0; i<m; i++) {
        if (ans[i]) cout << i + 1 << ' ';
    }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 13440
from math import cos, sin, sqrt, radians, degrees, acos, fabs

if __name__ == '__main__':
    epsilon = 1e-9

    # ??????????????\???
    num = int(input())
    for i in range(num):
        x1, y1, x2, y2, x3, y3 = [float(x) for x in input().split(' ')]

        # ??????????????§????§???¢???cos???????±???????arccos??§?§???????????????????
        a = sqrt((x1-x2)**2 + (y1-y2)**2)
        b = sqrt((x2-x3)**2 + (y2-y3)**2)
        c = sqrt((x1-x3)**2 + (y1-y3)**2)
        cosA = (b**2+c**2-a**2)/(2*b*c)

        # ???????§???????????????°?????£????????????????????\????????????????±????????????¨?????§?????????
        r = a / sin(acos(cosA)) / 2

        """
       ??????O?????§?¨????(x, y)??¨????????¨
       (x-x1)**2 + (y-y1)**2 = (x-x2)**2 + (y-y2)**2
       x**2 -2*x1*x + x1**2 + y**2 -2*y1*y + y1**2 = ... -2*x2*x, x2**2, -2*y2*y, y2**2
       ?????¨????????¨ (-2*x1 + 2*x2)x + (-2y1 + 2*y2)y + (x1**2 + y1**2 - x2**2 - y2**2) = 0
       x1, x3???????????????????§????
       (-2*x1 + 2*x3)x + (-2y1 + 2*y3)y + (x1**2 + y1**2 - x3**2 - y3**2) = 0
       """
        A = -2*x1 + 2*x2
        B = -2*y1 + 2*y2
        C = -2*x1 + 2*x3
        D = -2*y1 + 2*y3
        E = x1**2 + y1**2 - x2**2 - y2**2
        F = x1**2 + y1**2 - x3**2 - y3**2

        x = 1/(A*D-B*C) * (D*E - B*F)
        y = 1/(A*D-B*C) * (-C*E + A*F)
        # ?¨????????????¨?????? -0.0 ???????????´???????????¶?????? 0.0 ?????????
        if fabs(x) < epsilon:
            x = 0.0
        if fabs(y) < epsilon:
            y = 0.0

        print('{0:.3f} {1:.3f} {2:.3f}'.format(-x, -y, r))

Measured memory_bytes: 7940
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;


int main()
{
    int n;
    cin>>n;
    ll ans;
    cin>>ans;
    rep(i,n-1){
        ll a;
        cin>>a;
        ans = ans/__gcd(ans,a)*a;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3636
/**Bismillahir Rahmanir Rahim  *///{
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1;
const double eps = 1e-6, ldeps = 1e-9;
#define im(a, b) if (a>=b) a -= b; else if (a<0) a += b;
struct Dbg {
static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto dud(C *x)->decltype(os << *x, 0);
template<class C> static char dud(...);
template<class C> typename enable_if<sizeof dud<C>(0)!=1, Dbg&>::type operator<<(const C &x) { os << x; return *this; }
template<class C> typename enable_if<sizeof dud<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    *this << "\n[";
    for (auto &elem : x) *this << elem << ", ";
    return *this << "]";
}
template<class B, class C> Dbg &operator <<(const pair<B, C> &x) {
    return *this << "{" << x.first << ", " << x.second << "}";
}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args ...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(string(#args)), args), dbg << endl
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int n, m, K, T, Q, cn;//}
const int inf = 1000000007, mxn = -1;

char s[5], t[5];

int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.precision(10);
    cin >> s >> t;
    for (int i = 0; i < 3; i++) {
        n += s[i]==t[i];
    }
    cout << n << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
//#include <boost/multiprecision/cpp_int.hpp>

#define BIT(a) (1 << (a))

using namespace std;
//using namespace boost::multiprecision;

long long MOD = 1000000007;


long long mod_pow(long long x, long long n){
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}


int main(void){
    char s[10];
    char tmp[] = "abc";
    int flag[] = {0, 0, 0};
    cin >> s;
    for (int i = 0; i < 3; i++){
        for (int j = 0; j < 3; j++){
            if (tmp[j] == s[i]){
                flag[j] = 1;
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < 3; i++){
        ans += flag[i];
    }
    if (ans == 3){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}



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

using namespace std;
using ll = long long;

const int INF = 1001001001;

int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ans;
	ans = max(a * c, a * d);
	ans = max(ans, b * c);
	ans = max(ans, b * d);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int C = sc.nextInt();
        
        double RC = C / 180.0 *Math.PI; 
        
        System.out.println(1.0 / 2 * a * b * Math.sin(RC));
        
        System.out.println(a + b + Math.sqrt((a * a) + (b * b) - (2 * a * b * Math.cos(RC))));
        
        System.out.println(b * Math.sin(RC));
    }
}


Measured memory_bytes: 26272
#include<bits/stdc++.h>
using namespace std;
int tmp[200000];
int main()
{
	int n,i,t=1000000000,ti;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&tmp[i]);
	}
	sort(tmp,tmp+n);
	for(i=0;i<n-1;i++)
	{
		if(abs(tmp[i]-tmp[n-1]/2)<=t)
		{
			t=abs(tmp[i]-tmp[n-1]/2);
			ti=i;
		}
	}
	printf("%d %d",tmp[n-1],tmp[ti]);
	return 0;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Grid
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while (!(line = br.readLine()).equals("0")) {
			int n = Integer.parseInt(line);
			byte[][] grid = new byte[n][n];

			for (int i = 0; i < n; i++) {
				line = br.readLine();
				for (int j = 0; j < n; j++) {
					grid[i][j] = (byte) (line.charAt(j) - '0');
				}
			}

			short max = 0;
			// 左右
			for (int i = 0; i < n; i++) {
				short sum = 0;
				for (int j = 0; j < n; j++) {
					if (grid[i][j] > 0) {
						sum++;
					} else {
						sum = 0;
					}
					if (sum > max)
						max = sum;
				}
			}
			// 上下
			for (int i = 0; i < n; i++) {
				short sum = 0;
				for (int j = 0; j < n; j++) {
					if (grid[j][i] > 0) {
						sum++;
					} else {
						sum = 0;
					}
					if (sum > max)
						max = sum;
				}
			}
			// 対角線(右上->左下)
			for (int i = 0; i < 2 * n - 1; i++) {
				short sum = 0;
				int p, q, r;
				if (i < n) {
					p = i;
					q = 0;
					r = i + 1;
				} else {
					p = n - 1;
					q = i - n + 1;
					r = n;
				}
				for (int j = q; j < r; j++) {
					// try {
					// System.out.print(grid[p][j]);
					if (grid[p][j] > 0) {
						sum++;
					} else {
						sum = 0;
					}
					if (sum > max)
						max = sum;
					p--;
					// } catch (ArrayIndexOutOfBoundsException e) {
					// System.err.println(String.format("i=%d:j=%d:p=%d:q=%d",
					// i, j, p, q));
					// }
				}
				// System.out.print("|");
			}
			// System.out.println("");
			// 対角線(左上->右下)
			for (int i = 0; i < 2 * n - 1; i++) {
				short sum = 0;
				int p, q, r;
				if (i < n) {
					p = 0;
					q = n - i - 1;
					r = n;
				} else {
					p = i - n + 1;
					q = 0;
					r = 2 * n - i - 1;
				}
				for (int j = q; j < r; j++) {
					// try {//
					// System.out.print(grid[p][j]);//
					if (grid[p][j] > 0) {
						sum++;
					} else {
						sum = 0;
					}
					if (sum > max)
						max = sum;
					p++;
					// } catch (ArrayIndexOutOfBoundsException e) {//
					// System.err.println(String.format("i=%d:j=%d:p=%d:q=%d",//
					// i, j, p, q));//
					// }//
				}
				// System.out.print("|");//
			}
			// System.out.println();//
			System.out.println(max);
		}
	}
}

Measured memory_bytes: 24628
use std::cmp::max;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let mut left = vec![];
    let mut right = vec![];
    for _ in 0..n {
        let l: i64 = sc.read();
        let r: i64 = sc.read();
        left.push(l);
        right.push(-r);
    }

    left.sort();
    right.sort();
    left.reverse();
    right.reverse();

    let mut left_sum = vec![0; n + 1];
    let mut right_sum = vec![0; n + 1];
    for i in 0..n {
        left_sum[i + 1] = left_sum[i] + left[i];
        right_sum[i + 1] = right_sum[i] + right[i];
    }

    let mut ans = 0;
    for left in 0..n {
        if left > 0 && left + left - 1 <= n {
            ans = max(ans, left_sum[left] + right_sum[left - 1]);
        }
        if left + left <= n {
            ans = max(ans, left_sum[left] + right_sum[left]);
        }
        if left + left + 1 <= n {
            ans = max(ans, left_sum[left] + right_sum[left + 1]);
        }
    }
    println!("{}", ans * 2);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

int div2(int n) {
  int count = 0;
  while (true) {
    if (n % 2 == 0) {
      n /= 2;
      count++;
    } else {
      break;
    }
  }
  return count;
}

int main() {
  int N, total = 0;
  cin >> N;

  int tmp;
  for (int i = 0; i < N; i++) {
    cin >> tmp;
    total += div2(tmp);
  }
  cout << total << endl;
}


Measured memory_bytes: 888
#include <iostream>

std::string S;
int main() {
    std::cin >> S;
    if(S == "SUN"){
        std::cout << 7 << std::endl;
    }else if(S == "MON"){
        std::cout << 6 << std::endl;
    }else if(S == "TUE"){
        std::cout << 5 << std::endl;
    }else if(S == "WED"){
        std::cout << 4 << std::endl;
    }else if(S == "THU"){
        std::cout << 3 << std::endl;
    }else if(S == "FRI"){
        std::cout << 2 << std::endl;
    }else{
        std::cout << 1 << std::endl;
    }
}

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

#define MOD 10000007
#define f first
#define s second
#define pb push_back
#define es " "
#define endl "\n"
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define ll long long int
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)

int memo[25][25], n, m;

char matriz[25][25];

int gx[]={0, 0, 1, -1};
int gy[]={1, -1, 0, 0};

int bfs(int x, int y){
    queue<pair<int, pair<int, int> > >fila;
    memset(memo, 0, sizeof memo);
    memo[x][y]=1;
    int ans=-1;
    fila.push({0, {x, y}});
    while(!fila.empty()){
        int pri=fila.front().s.f;
        int seg=fila.front().s.s;
        int dist=fila.front().f;
        ans=max(ans, dist);
        fila.pop();
        for(int i=0; i<4; i++){
            int ax=pri+gx[i];
            int ay=seg+gy[i];
            if(ax>0 && ax<=n && ay>0 && ay<=m && matriz[ax][ay]!='#' && !memo[ax][ay]){
                memo[ax][ay]=1;
                fila.push({dist+1, {ax, ay}});
            }
        }
    }
    return ans;
}

int main(){
    fastio;
    cin >> n >> m;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            cin >> matriz[i][j];
        }
    }
    int resp=-1;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            if(matriz[i][j]!='#'){
                resp=max(resp, bfs(i, j));
            }
        }
    }
    cout << resp << endl;
    return 0;
}

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

using namespace std;

#define ll long long
#define ull unsigned long long
#define re register
#define il inline
#define inf 0x3f3f3f

template <class T> inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool f = 0;
  for (; !isdigit(c); c = getchar())
    f ^= c == '-';
  for (; isdigit(c); c = getchar())
    x = x * 10 + (c ^ 48);
  x = f ? -x : x;
}

template <class T> inline void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  T y = 1;
  int len = 1;
  for (; y <= x / 10; y *= 10)
    ++len;
  for (; len; --len, x %= y, y /= 10)
    putchar(x / y + 48);
}

int h, w, d;
char s[4] = {'R', 'Y', 'G', 'B'};

int main() {
  read(h), read(w), read(d);
  for (int i = 1; i <= h; ++i, putchar('\n'))
    for (int j = 1; j <= w; ++j) {
      int x = i + j + w, y = i - j + w;

      putchar(s[((x / d) & 1) * 2 + ((y / d) & 1)]);
    }
  return 0;
}


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

using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main()
{
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	string s; cin >> s;
	s.push_back('#'); s.push_back('#');
	n += 2;
	a--, b--, c--, d--;

	if(c > d) {
		swap(c, d);
		swap(a, b);
	}
	int cnt = 0;

//	cout << a << " " << b << " " << c << " " << d << endl;
	s[a] = 'A', s[b] = 'B';

	while(a != c || b != d) {

		if(s[b + 1] == '.' && b + 1 <= d) {
			s[b] = '.';
			b += 1;
			s[b] = 'B';
		} else if(s[b + 2]== '.' && b + 2 <= d) {
			s[b] = '.';
			b += 2;
			s[b] = 'B';
		} else if(s[a + 1] == '.' && a + 1 <= c) {
			s[a] = '.';
			a  += 1;
			s[a] = 'A';
		}else if(s[a + 2] == '.' && a + 2 <= c) {
			s[a] = '.';
			a += 2;
			s[a] = 'A';
		}
		//cout << "cnt : " << cnt << " a : " << a << " b : " << b << " " << s << endl;
		cnt++;
		if(cnt >= 10 * n) {
			cout << "No" << endl;
			return 0;
		}
	} 
	cout << "Yes" << endl;
}	

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  vector<tuple<string, int, int>> v;
  for(int i=0; i<n; i++){
    string s;
    int p;
    cin >> s >> p;
    v.push_back(make_tuple(s, -p, i+1));
  }
  sort(v.begin(), v.end());
  for(int i=0; i<n; i++){
    int m;
    tie(ignore, ignore, m)=v[i];
    cout << m << endl;
  }
  return 0;
}

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

using namespace std;

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

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

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

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

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

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

int main() {

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

	int ret = a - b;



	cout << c-min(ret, c) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

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

	vector<vector<int>> g(N * N);
	vector<int> d(N * N, 0);
	for (int i = 0; i < N; ++i) {
		vector<int> A(N - 1);
		for (auto& x : A) {
			cin >> x;
			--x;
		}
		for (int j = 0; j + 1 < N - 1; ++j) {
			int x1 = min(i, A[j]);
			int y1 = max(i, A[j]);
			int x2 = min(i, A[j + 1]);
			int y2 = max(i, A[j + 1]);

			int src = x1 * N + y1;
			int dst = x2 * N + y2;

			g[src].push_back(dst);
			++d[dst];
		}
	}

	queue<int> q;
	for (int i = 0; i < N * N; ++i) {
		int x = i / N;
		int y = i % N;
		//cout << "d[" << x << "][" << y << "]=" << d[i] << endl;
		if (x >= y) {
			continue;
		}
		if (d[i] == 0) {
			q.push(i);
		}
	}

	int ans = 0;
	int M = 0;
	while (!q.empty()) {
		queue<int> next;
		while (!q.empty()) {
			int x = q.front(); q.pop();
			for (auto dst : g[x]) {
				--d[dst];
				if (d[dst] == 0) {
					next.push(dst);
				}
			}
			g[x].clear();
			++M;
		}
		q = move(next);
		++ans;
	}

	if (M < N * (N - 1) / 2) {
		ans = -1;
	}
	cout << ans << endl;
}


Measured memory_bytes: 43264
from sys import exit
from numpy.random import rand
# A,B,C = [int(n) for n in input().split()]
# N = int(input())
# a = [int(input()) for _ in range(N)]
# S = str(input())
# L = len(S)
# T = str(input())
N = int(input())
# dic = {}
# for i in range(1,N+1):
#     dic[i] = 0
#偶数ならN+1をつくる
ansgroup = []
if N%2 == 0:
    for i in range(1,N//2+1):
        ansgroup.append([i, N-i+1])
else:
    for i in range(1,N//2+1):
        ansgroup.append([i, N-i])
    ansgroup.append([N])
nodesum = 0
ans = []
for i in range(len(ansgroup)):
    for j in range(i+1,len(ansgroup)):
        for e1 in ansgroup[i]:
            for e2 in ansgroup[j]:
                nodesum+=1
                ans.append([e1,e2])
print(nodesum)
for a in ans:
    print(a[0],a[1])
# ansset = set([ i for i in range(1,N+1)])
# tmpset = set()
# for i in range(1,len(ans)):
#     if ans[i-1][0] == ans[i][0]:
#         tmpset = ans[i][1] | ans[i-1][1]
#     else:
#         print(ans[i-1][0],ansset)
#         ansset = set([ i for i in range(1,N+1)])
# exit()
#奇数ならNをつくる組みあわせがペアそれ以外とぜんぶつながる


Measured memory_bytes: 14512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  string s;
  int X,Y,x[10000]={},y[10000]={},nx=0,ny=0,I=0,n;
  bool f=0;
  cin>>s>>X>>Y;
  n=s.length();
  for(;I<n;){
    if(s[I++]=='T') break;
    X--;
  }
  for(;I<n;){
    if(s[I++]=='T'){
      if(f) nx++;
      else ny++;
      f=1-f;
    }
    else{
      if(f) x[nx]++;
      else y[ny]++;
    }
  }
  if(f) nx++;
  else ny++;
  bool dpx[8010][16000]={},dpy[8010][16000]={};
  dpx[0][8000]=1;dpy[0][8000]=1;
  fr(i,nx){
    fr(j,16000){
      if(j-x[i]>=0&&dpx[i][j-x[i]]) dpx[i+1][j]=1;
      if(j+x[i]<16000&&dpx[i][j+x[i]]) dpx[i+1][j]=1;
    }
  }
  fr(i,ny){
    fr(j,16000){
      if(j-y[i]>=0&&dpy[i][j-y[i]]) dpy[i+1][j]=1;
      if(j+y[i]<16000&&dpy[i][j+y[i]]) dpy[i+1][j]=1;
    }
  }
  cout<<((dpx[nx][X+8000]&&dpy[ny][Y+8000])?"Yes":"No")<<endl;
}

Measured memory_bytes: 250624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
  
  ll N;
  cin >> N;
  
  bool sev = false;
  while(N != 0){
    if(N % 10 == 7)  sev = true;
    N /= 10;
  }
  
  if(sev)  cout << "Yes" << endl;
  else  cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 3624
INTEGER N
CHARACTER(20),ALLOCATABLE,DIMENSION(:)::S
INTEGER M
CHARACTER(20) AKIBAKO
INTEGER,ALLOCATABLE,DIMENSION(:)::KOSU
READ*,N
ALLOCATE(S(N))
READ*,S
READ*,M
!バブルソートで辞書順に
  do i=1,N-1
     do j=i+1,N
        if( LGT(S(I),S(J)) )then
           AKIBAKO=S(I)
           S(I)=S(J)
           S(J)=AKIBAKO
        end if
     end do
  end do
ALLOCATE(KOSU(N))
KOSU=0
DO I=1,N
  IF(I>1.AND.S(I)==S(I-1))THEN
    KOSU(I)=KOSU(I-1)+1
  ELSE
    KOSU(I)=1
  ENDIF
END DO
DO I=1,M
  READ*,AKIBAKO
  DO J=1,N
    IF(AKIBAKO==S(J))KOSU(J)=KOSU(J)-1
  END DO
END DO
PRINT"(I0)",MAX(MAXVAL(KOSU),0)
END

Measured memory_bytes: 384
import java.util.Scanner;


public class Main{

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String[] temp = scanner.nextLine().split(" ");
		int n = Integer.parseInt(temp[0]);
		int k = Integer.parseInt(temp[1]);

		int list[] = new int[n];
		for(int i = 0; i < n; i++ ) {
			list[i] = Integer.parseInt(scanner.nextLine());
		}
		//execute

		sort(list, 0, n - 1);

		int ans = Integer.MAX_VALUE;
		for(int i = 0; i < n -( k -1)  ;i ++) {
			ans = Math.min(ans, Math.abs(list[i] - list[i + k - 1]));

		}

		System.out.println(ans);

	}

	public static void sort(int[] list, int left, int right) {
		if(left <= right) {
			int l = left;
			int r = right;
			int pivot = list[(left + right) >>> 1];

			while(l <= r) {

				while(list[l] < pivot) {
					l++;
				}
				while(list[r] > pivot) {
					r--;
				}

				if(l <= r) {
					int temp = list[l];
					list[l] = list[r];
					list[r] = temp;
					l++;
					r--;
				}
			}
			sort(list, l, right);
			sort(list, left, r);
			}
		}
}


Measured memory_bytes: 94708
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <queue>
using namespace std;

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

int64_t gcd(int64_t a,int64_t b){
    if(a < b)
    {
        int64_t temp = a;
        a = b ;
        b = temp;
    }
    int64_t copya = a;
    int64_t copyb = b;
    int64_t r = a%b ;
    while (r != 0)
    {
        a = b ;
        b = r ;
        r = a%b ;
    }
    return b ;
    
}


int main(){    
    int n,x,t ;
    cin >> n >> x >> t ;
    int ans = t*(n/x) ;
    if (n%x != 0)
    {
        ans += t ;
    }
    cout << ans << endl ;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<utility>

constexpr size_t mod = 1e9+7;

int main(){
    
    size_t n, m;
    
    std::cin >> n >> m;

    std::vector<std::pair<size_t, bool>> cnt(n + 1, {0, true});

    for(size_t i = 0; i < m; i++){
        size_t tmp;
        std::cin >> tmp;
        cnt[tmp].second = false;
    }

    cnt[0].first = 1;
    if(cnt[1].second == true) cnt[1].first = 1;

    for(size_t i = 2; i <= n; i++){
        if(cnt[i].second == true){
            cnt[i].first = cnt[i - 1].first + cnt[i - 2].first;
            cnt[i].first %= mod;
        }
    }

    std::cout << cnt.at(n).first << std::endl;
    
    return 0;
}


Measured memory_bytes: 1792
/*
 * main.cpp
 *
 *  Created on: 2020/04/09
 *      Author: SkAaO
 */

#include <iostream>

using namespace std;

int main(){
	int N;
	cin >> N;
	int n = N;
	int sum = 0;

	while(1){
		sum += N % 10;
		if(N / 10 == 0){
			break;
		}
		N /= 10;
	}

	if(n % sum == 0){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}




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

void solve(int n, string str, int char_count)
{
    if (n == 0) {
        cout << str << endl;
        return;
    }

    for (size_t i = 0; i <= char_count; i++) {
        string next = str + string(1, ('a' + i));

        if (i == char_count) {
            solve(n - 1, next, char_count + 1);
        } else {
            solve(n - 1, next, char_count);
        }
    }
}

int main()
{
    int n;
    cin >> n;
    solve(n, (char *)(""), 0);
}

Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var X = int.Parse(ReadLine());

        var p = new bool[110000];

        for (int i = 0; i < p.Length; i++)
            p[i] = true;

        p[0] = p[1] = false;

        for (int i = 0; i <= Math.Sqrt(p.Length); i++)
        {
            if (!p[i])
                continue;

            for (int j = i * 2; j < p.Length; j += i)
                p[j] = false;
        }

        for (int i = X; i < p.Length; i++)
        {
            if(p[i])
            {
                WriteLine(i);
                return;
            }
        }
    }
}


Measured memory_bytes: 27496
# https://atcoder.jp/contests/abc149/tasks/abc149_b

read S ; S=($S) ; a=$((S[0])) ; b=$((S[1])) ; k=$((S[2]))

if [ $a -ge $k ] ; then
  a=$((a - k))
  k=$((0))
else
  k=$((k - a))
  a=$((0))
fi

if [ $b -ge $k ] ; then
  b=$((b - k))
  k=$((0))
else
  k=$((k - b))
  b=$((0))
fi

echo $a $b


Measured memory_bytes: 500
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
// #include<assert.h>
#include<random>
using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  int L,R,d; cin>>L; cin>>R;cin>>d;
  int res = 0;
  for (int i = L; i <= R; i++)
  {
    if(i%d == 0)res++;
  }
  
  cout<<res<<endl;
  

   

  return; 
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define size 1000

void push(int);
int pop(void);

int stack[size];
int top = 0;

int main(){
  int x;
  char s[100];
  int a,b;

  while(scanf("%s",s) != EOF){
    /* if(s[0] =='F') break; */
    if(s[0] == '+'){
      
      a = pop();
      b = pop();

      /*printf("%d %d \n",a,b);*/
      push(a + b);
    }
    else if(s[0] == '-'){
      b = pop();
      a = pop();
      push(a - b);
    }
    else if(s[0] == '*'){
      a = pop();
      b = pop();
      push(a * b);
    }
    else{
      x = atoi(s);
      push(x);
    }

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

  return 0;
}


void push(int x){
  if(top == size){
    exit(2);
      }
  top++;
  stack[top] = x;
}

int pop(void){
  if(top == 0){
    exit(3);
  }
  top--;
  return stack[top+1];
}
  
  
  



Measured memory_bytes: 2104
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

int dist[1010][1010];

signed main() {
    int H, W;
    cin >> H >> W;

    vector<string> board(H);
    rep(i, H) cin >> board[i];

    rep(y, H) rep(x, W) dist[y][x] = -1;

    queue<pair<int, int>> q;
    rep(y, H) rep(x, W) {
        if (board[y][x] == '#') {
            q.push(mp(x, y));
            dist[y][x] = 0;
        }
    }

    int ret = 0;
    while (!q.empty()) {
        auto p = q.front(); q.pop();
        int x = p.first;
        int y = p.second;
        int d = dist[y][x];
        rep(dir, 4) {
            int nx = x + dx[dir];
            int ny = y + dy[dir];
            if (nx < 0 || nx >= W || ny < 0 || ny >= H) continue;
            if (dist[ny][nx] != -1) continue;
            dist[ny][nx] = d + 1;
            ret = max(ret, d + 1);
            q.push(mp(nx, ny));
        }
    }

    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 25472
// -*- coding:utf-8-unix -*-

use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        x: usize,
    }
    if x == 1 || x == 2 * n - 1 {
        println!("No");
        return;
    }
    if n == 2 {
        println!("Yes\n1\n2\n3");
        return;
    }
    if x == 2 {
        println!("Yes");
        for i in 5..=n + 1 {
            println!("{}", i);
        }
        println!("3\n2\n1\n4");
        for i in n + 2..=2 * n - 1 {
            println!("{}", i);
        }
        return;
    }
    let mut others = Vec::new();
    for i in 3..=2 * n - 2 {
        if i != x {
            others.push(i);
        }
    }
    println!("Yes");
    for _ in 1..=n - 3 {
        println!("{}", others.pop().unwrap());
    }
    println!("1\n{}\n{}\n2", x, 2 * n - 1);
    for _ in 1..=n - 2 {
        println!("{}", others.pop().unwrap());
    }
}


Measured memory_bytes: 3736
#include<cstdio>

int n, A[50];

int solve (int i, int m) {
  if (m == 0) return 1;
  if (i >= n) return 0;
  int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
  return res;
}

int main() {
  int q, M, i;

  scanf("%d", &n);
  for (size_t i = 0; i < n; i++) scanf("%d", &A[i]);
  scanf("%d", &q);
  for ( i = 0; i < q; i++) {
    scanf("%d", &M);
    if (solve(0, M)) printf("yes\n");
    else printf("no\n");
  }

  return 0;
}



Measured memory_bytes: 2704
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lim 100005
#define mod 1000000007
#define mp make_pair
#define sd(n) scanf("%lld",&n)
#define FIO(name) freopen(name,"r",stdin)
#define F first
#define S second
ll a[lim+1];
int main()
{
	
	//FIO("in.txt");
	ll a,b,x;
	cin>>a>>b>>x;
	ll a1=b/x;
	a1+=1;
	ll a2=0;
	if(a!=0)
	 a2=((a-1)/x)+1;
	cout<<a1-a2<<endl;

	
	
	
}



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

int main() {
 
  int x;
  cin >> x;
  x = x%10;
  if (x == 3) {
    cout << "bon" << endl;
  }
  else if(x==0 || x==1 || x==6 || x==8){
    cout << "pon" << endl;
  }else{
    cout << "hon" << endl;
  }

}


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

using namespace std;

long long solve(const vector<long long>& X, int L){
    const int N = X.size();
    if(N == 1) return X[0];
    int addIdx = 0;
    int addMul = N;
    int subIdx = N-1;
    int subMul = N-1;
    long long cur = 0;
    while(addMul > 0){
        cur += min(2, addMul) * X[addIdx];
        ++addIdx;
        addMul -= 2;
    }
    --addIdx;
    while(subMul > 0){
        cur += min(2, subMul) * (L - X[subIdx]);
        --subIdx;
        subMul -= 2;
    }
    ++subIdx;
    long long res = cur;
    for(int i=0;i<N-1;i++){
        if(addMul == 0){
            ++addIdx;
            addMul = -1;
        } else {
            addMul = 0;
        }
        cur += X[addIdx];
        cur -= 2 * X[i];
        cur -= L - X[subIdx];
        if(subMul == -1){
            ++subIdx;
            subMul = 0;
        } else {
            subMul = -1;
        }
        res = max(cur, res);
    }
    return res;
}

int main(){
    long long L, N; cin >> L >> N;
    vector<long long> X(N), Y(N);
    for(auto& x : X) cin >> x;
    for(int i=0;i<N;i++) Y[i] = L - X[N-1-i];
    cout << max(solve(X, L), solve(Y, L)) << endl;
}

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


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

    vector <int> t(n);
    vector <string> s(n);
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
        cin >> t[i];
    }
    cin >> x;

    int ans = 0;
    bool find = false;
    for (int i = 0; i < n; ++i) {
        if (find == false) {
            if (s[i] == x) {
                find = true;
            }
        } else {
            ans = ans + t[i];
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
typedef long long int ll;
#define debug(val) "[ " << #val " : " << (val) << " ]\n"
#define space " "
#define space " "
#define vi vector<int>
#define PI atan(1)*4
#define pb push_back
#define ff first
#define ss second
#define PI atan(1)*4

const int maxN = 1000 + 3 ;
char a[maxN][maxN] ;
int dp[maxN][maxN] ;
const int INF =  (int)2e9 ;
const int Mod = (int)1e9 + 7;

void solve() {
    int n , m ;
    cin >> n >> m ;
    for(int i=0;i<n;i++){
        string s ;cin >> s ;
        for(int j=0;j<m;j++){
            a[i][j] = s[j] ;
        }
    }

  
    dp[0][0] = 1 ;
    for(int i=0;i<n;i++) {
        for(int j=0;j<m;j++){
            if(a[i][j] == '#'){
                dp[i][j] = -1 ;
                continue;
            }
            if((i+1 < n) && a[i+1][j] == '.'){
                dp[i+1][j] += dp[i][j] ;dp[i+1][j]%= Mod ;}
            if((j+1 < m) && a[i][j+1] == '.'){
                dp[i][j+1] += dp[i][j] ;dp[i][j+1] %= Mod ; }

        }
    }
//    for(int i=0;i<n;i++){
//        for(int j=0;j<m;j++){
//            cerr << dp[i][j] << space ;
//        }
//        cerr << endl;
//    }
    cout << dp[n-1][m-1] << endl;


}
int main() {
#ifdef _DEBUG // place in cmake-build-debug folder
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int q = 1;
    //cin >> q;
    for (int i = 1; i <= q; i++) {
        // cout << "Case #" << i << ": ";
        solve();
    }
}


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

int H, W;
int c[10][10];
int A[200][200];
int cost[10][10];
int const INF = 100100100;
typedef pair<int, int> P;

int main(void){
    cin >> H >> W;
    
    for (int i=0; i<10; i++) for (int j=0; j<10; j++) cin >> c[i][j];
    for (int i=0; i<H; i++) for (int j=0; j<W; j++) cin >> A[i][j];
    
    for (int i=0; i<10; i++) fill(cost[i], cost[i] + 10, INF);
    
    for (int s=0; s<10; s++){
        cost[s][s] = 0;
        priority_queue<P, vector<P>, greater<P>> que;
        que.push(pair(s, 0));
        
        while(!que.empty()){
            P p=que.top(); que.pop();
            
            if(cost[s][p.first] < p.second) continue; 
            
            for (int i=0; i<10; i++){
                if(cost[s][p.first] + c[p.first][i] < cost[s][i]){
                    cost[s][i] = cost[s][p.first] + c[p.first][i];
                    que.push(P(i, cost[s][i]));
                }
            }
        }
    }
    
    int ans = 0;
    for (int i=0; i<H; i++){
        for (int j=0; j<W; j++){
            if(A[i][j] != -1){
                ans += cost[A[i][j]][1];
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3768
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        int a = 0;
        int max = 0;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) == 'A' || s.charAt(i) == 'C' || s.charAt(i) == 'G' || s.charAt(i) == 'T'){
                a++;
                if(a > max){
                    max = a;
                }
            }else{
                a = 0;
            }
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 24916
N = int(input())
A = list(map(int, input().split()))
mod = 1000000007
S = 0
for i in range(N):
    S += A[i]

sum = 0
for i in range(N):
    S -= A[i]
    if S<0:
        S+= mod
    sum += int(A[i]*S%mod)
    

sum = int(sum%mod)    
print(sum)

Measured memory_bytes: 31516
from operator import itemgetter
faces = list(map(int, input().split()))
commands = input()

for command in commands:
    if command == 'N':
        faces = itemgetter(1,5,2,3,0,4)(faces)
    elif command == 'E':
        faces = itemgetter(3,1,0,5,4,2)(faces)
    elif command == 'S':
        faces = itemgetter(4,0,2,3,5,1)(faces)
    elif command == 'W':
        faces = itemgetter(2,1,5,0,4,3)(faces)
print(faces[0])


Measured memory_bytes: 5684
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>

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

using namespace std;

int main() {

	
	string str;
	cin >> str;

	int f1 = 0;
	int f2 = 0;

	vector<int>dis(4, 0);

	rep(i, 0, str.length()) {
		if (str[i] == 'E')dis[0]++;
		else if (str[i] == 'W')dis[1]++;
		else if (str[i] == 'S')dis[2]++;
		else if (str[i] == 'N')dis[3]++;

	}

	if ((dis[0] == 0 && dis[1] == 0) ||(dis[0] != 0 && dis[1] != 0))f1++;
	if ((dis[2] == 0 && dis[3] == 0) || (dis[2] != 0 && dis[3] != 0))f2++;


	if (f1!=0 && f2!=0)cout << "Yes" << endl;
	else cout << "No" << endl;






	return 0;
}

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

typedef long long int LLI;
LLI a, b, n, ans=0x7fffffffffffffff;

int main() {
  scanf("%lld%lld%lld", &a, &b, &n);
  for (LLI i=1; i<=n; i++) {
    for (LLI j=1; j<=n; j++) {
      if (i*b%j) continue;
      ans = min(ans, abs(a-i*b/j));
    }
  }

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

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

int main() {
    long long N;
    cin >> N;
    vector<pair<long, long>>A(N);
    vector<pair<long long, long long>>Pos;
    for (long long i = 0; i < N; i++) {
        cin >> A.at(i).first >> A.at(i).second;
        Pos.push_back(make_pair(A.at(i).first + A.at(i).second, A.at(i).first - A.at(i).second));
    }
    sort(Pos.begin(), Pos.end());
    long long ans = 0, t = -100000000;
    for (int i = 0; i < N; i++)  {
        if (t < Pos.at(i).second) {
            ans++;
            t = Pos.at(i).first - 1;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int H,A;
  cin>>H>>A;
  cout<<(H+A-1)/A<<endl;

  return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
n_l = []
ans = [0, 0, 0]

for _ in range(n):
    l = list(map(int, input().split()))
    n_l.append(l)
for x in range(m):
    p = int(input())
    for o in range(n):
        n_l[o][x] *= p
for i in n_l:
    print(sum(i))


Measured memory_bytes: 6020
<?php
    /*
        Problem URL : http://arc068.contest.atcoder.jp/tasks/arc068_a
        Score  :
        Result :
        Time   : ms
        Memory : KB
     */
 
    ini_set('error_reporting', E_ALL & ~E_NOTICE);
    ini_set('display_errors', 'On');
    // define('DEBUG', true);
    define('DEBUG', false);

    $kai = 0;

    fscanf(STDIN, "%d", $x);

    $kai = floor($x / 11);
    $x -= 11 * $kai;

    $kai += $kai;

    if ($x > 6) {
        $kai += 2;
    } elseif ($x > 0) {
        $kai += 1;
    }

    echo sprintf("%d\n", $kai);


Measured memory_bytes: 3064
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
//Tariquzzaman Faisal
//_Faisal101_
//IUT_CSE'19
//190041101
 
#include<iostream>
#include<stdio.h>
#include<vector>
#include<deque>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#include<cstring>
#include<climits>
#include<cmath>
#include<iterator>
#include<set>
#define fileOut freopen("out.txt","w",stdout)
#define fileIn freopen("in.txt","r",stdout)
#define testcases ll TC,T; cin >> TC; for(T=1; T<=TC; T++)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define INFLL 9223372036854775807
#define INF 2147483647
#define pi acos(-1.0)
#define ll long long
#define endll printf("\n")
#define CASE printf("Case %lld: ",T)
#define ff first
#define ss second
#define mem(ara,n) memset(ara,n,sizeof ara)
#define ull unsigned long long
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mid3(a,b,c) min(max(a,b),max(b,c),max(a,b))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define endl '\n'
#define ld long double
 
 
using namespace std;


int main(){
    ll teams;
    cin >> teams;
    ll ara[teams*3];
    for (int i = 0; i < teams*3; ++i)
    {
        cin >> ara[i];
    }
    sort(ara, ara + teams*3, greater<ll>());
    // for (int i = 0; i < teams*3; ++i)
    // {
    //     cout<<ara[i]<<" ";
    // }
    // endll;
    ll power = 0, times = 0;
    for (int i = 1; i < teams*3 && times<teams; i+=2)
    {
        times++;
        power += ara[i];
    }
    cout<<power<<endl;
    return 0;
}

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

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

  // ここにプログラムを追記
  
}


Measured memory_bytes: 256