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

using namespace std;

int colors[100][100];

int main() {
  int h, w, n;
  scanf("%d %d %d", &h, &w, &n);
  int row = 0, col = 0, delta = 1;
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    for (int j = 0; j < a; j++) {
      colors[row][col] = i;
      col += delta;
      if (col == w) {
        delta = -1;
        col = w - 1;
        row++;
      }
      if (col == -1) {
        col = 0;
        delta = 1;
        row++;
      }
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (j) printf(" ");
      printf("%d", colors[i][j]);
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 384
#include<algorithm>
#include<iostream>
#include<cstring>
#include<fstream>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define INF 0X3F3F3F3F3F3F3F3F
#define N 100005
#define M 200005
#define LL long long
#define ULL unsigned long long
#define FF(i, a, b) for(int i = a; i <= b; ++i)
#define RR(i, a, b) for(int i = a; i >= b; --i)
#define FJ(i, a, b) for(int i = a; i < b; ++i)
#define SC(x) scanf("%d", &x)
#define SCC(x, y) scanf("%d%d", &x, &y)
#define SCCC(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define SS(x) scanf("%s", x)
#define PR(x) printf("%d\n", x)
#define CL(a, x) memset(a, x, sizeof(a))
#define _P fd[rt]
#define _L fd[rt << 1]
#define _R fd[rt << 1 | 1]
#define MID int mid = ((l + r) >> 1)
#define lson rt<<1 ,l, mid
#define rson rt<<1 | 1, mid + 1, r
#define VI vector<int>
#define db double
#define PII pair<int, int>
#define PLL pair<unsigned long long, unsigned long long>
#define MP make_pair
#define PB push_back
#define IN freopen("in.txt", "r", stdin)
#define OUT freopen("out.txt", "w", stdout)
using namespace std;
const int MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const int dir[4][2] = {{-1, 0}, {0, -1}, {0, 1}, {1, 0}};
inline void II(int &n){char ch = getchar(); n = 0; bool t = 0;
for(; ch < '0'; ch = getchar()) if(ch == '-') t = 1;
for(; ch >= '0'; n = n * 10 + ch - '0', ch = getchar()); if(t) n =- n;}
inline void OO(int a){if(a < 0) {putchar('-'); a = -a;}
if(a >= 10) OO(a / 10); putchar(a % 10 + '0');}
inline int sgn(double x){return (x > EPS) - (x < -EPS);}
int f[N], n, c, x, y, w;
vector<PII> a[N];
int main(){
   // IN;
    SCC(n, c);
    FF(i, 1, n){
        SCCC(x, y, w);
        a[w].PB(MP(x, y));
    }
    FF(i, 1, c){
        sort(a[i].begin(), a[i].end());
        int l = 0, r = 0;
        for(PII x : a[i]){
            if(x.first != r){
                if(r != 0){
                    ++f[l - 1];
                    --f[r];
                }
                l = x.first;
                r = x.second;
            }else r = x.second;
        }
        if(r != 0){
            ++f[l - 1];
            --f[r];
        }
    }
    FF(i, 1, 100000) f[i] += f[i - 1];
    int ans = 0;
    FF(i, 1, 100000)
        if(f[i] > ans) ans = f[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4224
n = int(input())
arr_a = list(map(int, input().split()))

mod = 10**9 + 7
memo = {}

for i in range(n):
    if i == 0:
        memo[n-i-1] = 0
    else:
        memo[n-i-1] = (memo[n-i] + arr_a[n-i]) % mod

ans = 0
for i in range(n):
    ans += arr_a[i] * memo[i]
    ans = ans % mod

print(ans)


Measured memory_bytes: 123804
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int ans = 1000;
  for (int i = 1; i <= N / 2; i++) {
    int a = N - i;
    int j = i;
    int sumi = 0;
    int suma = 0;
    while (j > 0) {
      sumi += j % 10;
      j /= 10;
    }
    while (a > 0) {
      suma += a % 10;
      a /= 10;
    }
    ans = min(ans, sumi + suma);
  }
  cout << ans << endl;
}
  

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int p = x / 100;
        if(x >= 100 * p && x <= 105 * p){
            System.out.println(1);
            return;
        }
        System.out.println(0);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main(){
long long int a,b[100010],c[100010],ans=0;
  cin >> a;
  
  for(int i=0;i<a;i++)
    cin >> b[i] ;
  
        
  for(int i=0;i<a;i++){
     
    if(b[i]%2 ==1){
      ans++;
    }
  }
  
  if(ans %2 == 1){
    
    cout << "NO" << endl;
  }
  
  else{
    
    cout << "YES" << endl;
  }
}

Measured memory_bytes: 1024
use std::io::stdin;

fn main(){
    let mut table: Vec<Vec<i64>> = Vec::new();
    let n: usize = getvec()[0];
    for _ in 0..n {
        table.push(getvec());
    }
    println!("{}", solve(&table));
}

fn solve(table: &Vec<Vec<i64>>) -> i64 {
    let mut ans = 0;
    for start in 0..table.len() {
        for end in start..table.len() {
            let mut needed = true;
            for relay in 0..table.len() {
                if start==relay || end==relay { continue }
                if table[start][relay] + table[relay][end] < table[start][end] {
                    return -1;
                } else if table[start][relay] + table[relay][end] == table[start][end] {
                    needed = false;
                    break
                }
            }
            ans = if needed { ans + table[start][end] } else { ans };
        }
    }
    ans
}

#[allow(dead_code)]
fn getline() -> String {
    let mut s = String::new();
    match stdin().read_line(&mut s){
        Ok(_) => {s.trim().to_string()}
        Err(_) => String::new()
    }
}

#[allow(dead_code)]
fn getvec<T: std::str::FromStr>() -> Vec<T>{
    let line = getline();
    line.split_whitespace().filter_map(|x| x.parse().ok()).collect()
}

#[allow(dead_code)]
fn getpair() -> (usize, usize){
    let nm = getvec();
    (nm[0], nm[1])
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
 
const int MAX=510000;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  
  long double w,h,x,y;
  cin >> w >> h >> x >> y;
  if(w/2==x && h/2==y){
    cout << fixed << setprecision(9) << w*h/2 << endl;
    cout << 1 << endl;
  }
  else{
    cout << fixed << setprecision(9) << w*h/2 << endl;
    cout << 0 << endl;
  }
  return 0;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
ll M;
std::vector<int> G[100100];
ll dp[100100], dp2[100100];

ll dfs(int v, int p){
    dp[v] = 1;

    for(int w : G[v]){
        if(w == p){
            continue;
        }

        dp[v] = dp[v] * (dfs(w, v) + 1) % M;
    }

    return dp[v];
}

void dfs2(int v, int p, ll c){
    int deg = G[v].size();

    std::vector<ll> vl(deg + 1), vr(deg + 1);

    vl[0] = 1;

    for(int i=0;i<deg;++i){
        if(G[v][i] == p){
            vl[i+1] = vl[i] * (c + 1) % M;
        }else{
            vl[i+1] = vl[i] * (dp[G[v][i]] + 1) % M;
        }
    }

    vr[deg] = 1;

    for(int i=deg-1;i>=0;--i){
        if(G[v][i] == p){
            vr[i] = vr[i+1] * (c + 1) % M;
        }else{
            vr[i] = vr[i+1] * (dp[G[v][i]] + 1) % M;
        }
    }

    dp2[v] = vr[0];

    for(int i=0;i<deg;++i){
        int w = G[v][i];

        if(w == p){
            continue;
        }

        dfs2(w, v, vl[i] * vr[i+1] % M);
    }
}

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

    std::cin >> N >> M;

    for(int i=0;i<N-1;++i){
        int x, y;
        std::cin >> x >> y;

        G[x].emplace_back(y);
        G[y].emplace_back(x);
    }

    dfs(1, -1);
    dfs2(1, -1, 1);

    for(int i=1;i<=N;++i){
        std::cout << dp2[i] << std::endl;
    }
}


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

int main(){
    string s;
    cin >> s;
    ll n = s.size();
    vector<vector<ll>> dp(n+1,vector<ll>(13));
    dp[0][0] = 1;
    rep(i,n){
        int c;
        if(s.at(i) == '?') c = -1;
        else c = s.at(i) - '0';
        rep(j,10){
            if(c != -1 && c != j) continue;
            rep(k,13){
                int e = (k * 10 + j) % 13;
                dp[i+1][e] += dp[i][k];
            }
            rep(k,13){
                dp[i+1][k] = dp[i+1][k] % p;
            }
        }
    }

    cout << dp[n][5] << endl;
    return 0;
}

Measured memory_bytes: 13696
//***The night is the darkest just before the dawn***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

pair<ll,ll> a[1003];
ll dp[10002];

ll fun(ll h,ll n){
	if(h<=0) return(0);
	if(dp[h]!=-1) return(dp[h]);
	else{
		ll mi=a[0].se+fun(h-a[0].fi,n);
		for(ll i=1;i<n;i++)
			mi=min(mi,a[i].se+fun(h-a[i].fi,n));
		dp[h]=mi;
		return(mi);
	}
}


int main()
{
	ll h,n,mi=1e5,cn=0;
	cin>>h>>n;

	dp[0]=-1;
	for1(i,h) dp[i]=-1;

	forn(i,n){
		cin>>a[i].fi>>a[i].se;
		//mi=min(mi,a[i].se);
	}
	cout<<fun(h,n);
	//cout<<dp[h];
}

Measured memory_bytes: 1024
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    ll a, b, c, d; cin >> a >> b >> c >> d;
    ll ans = -LONGINF;
    for(int i=-1; i<=1; i++) {
        for(int j=-1; j<=1; j++) {
            if(i == 0 and !(a <= 0 and 0 <= b)) continue;
            if(j == 0 and !(c <= 0 and 0 <= d)) continue;
            ll A = (i == -1 ? a : b);
            ll B = (j == -1 ? c : d);
            if(i == 0) A = 0;
            if(j == 0) B = 0;
            chmax(ans, A*B);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
x = int(input())

if x < 600:
    print(8)
elif x < 800:
    print(7)
elif x < 1000:
    print(6)
elif x < 1200:
    print(5)
elif x < 1400:
    print(4)
elif x < 1600:
    print(3)
elif x < 1800:
    print(2)
else:
    print(1)

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

using namespace std;

using Num = uint64_t;

namespace {
    constexpr Num mod = 1000000007;

    Num frac(int n) {
        Num result = 1;
        for (int i = 2; i <= n; ++i) {
            result *= i;
            result %= mod;
        }
        return result;
    }
}

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

    if (N > M)
        swap(N, M);
    // N <= M

    if (M - N > 1){
        cout << 0 << endl;
        return 0;
    }

    Num result = frac(N);

    result *= result;
    result %= mod;

    if (N != M) {
        result *= M;
        result %= mod;
    } else {
        result *= 2;
        result %= mod;
    }

    cout << result << endl;

    return 0;
}


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


int main(int argc, char const *argv[])
{
    int N;
    cin>>N;
    int num[N];
    
    for(int i = 0; i < N; i++)
    {
        cin>>num[i];
    
    }
    int ans=0;


    while(true){
        bool exist_odd=false;
        
        for(int i = 0; i < N; i++)
        {  
            if (num[i]%2!=0) exist_odd=true;
        }
        if(exist_odd)break;
        
        for(int i = 0; i < N; i++)
        {
            num[i]=num[i]/2;
        }
        ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 768
#include<stdio.h>
int main()
{
  long long int n;
  long long int attackTimes=0; 
  long long int counter = 1;
  scanf("%lld",&n);
  if(n==1)
  {
    printf("1");
    return 0;
  }
  while(n>=1)
  {
    attackTimes+=counter;
    counter*=2;
    
    n/=2;  //7 -> 3->1  4->2->1
  }
  printf("%lld",attackTimes);
  return 0;
}
  
  
  

Measured memory_bytes: 128
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    k = 0
    tmp = 0
    while tmp < n:
        k += 1
        tmp += k
    if tmp == n:
        print("Yes")
        ans = [[]]
        x = 1
        for i in range(k):
            tmp = []
            for j in range(i+1):
                ans[j].append(x)
                tmp.append(x)
                x += 1
            ans.append(tmp)
        print(len(ans))
        for ai in ans:
            print(len(ai), *ai)
    else:
        print("No")
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 47452
#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 rrep(i,n) for(int i=(n);i>=0;i--)
#define rrepa(i,a,n) for(int i=(n)-1;i>=(a);i--)
#define sortn(a) sort((a).begin(),(a).end())
#define sortr(a) sort((a).begin(),(a).end(),greater<int>())
#define MOD 1000000007

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int main(){
    
    int n;
    cin >> n;
    ll ans=0;
    vl a(n);
    rep(i,n){
        cin >> a[i];
        ans ^= a[i];    
    }
    rep(i,n)a[i] &= (~ans);;

    int c=0;
    rrep(i,59){
        repa(j,c,n){
            if(a[j]>>i&1){
                swap(a[c],a[j]);
                rep(k,n){
                    if(k==c)continue;
                    if(a[k]>>i&1){
                        a[k] ^= a[c];
                    }
                }
                c++;
                break;
            }
        }
    }

    ll tmp=0;
    rep(i,c){
        tmp ^= a[i];
    }

    ans += tmp*2; 

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

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

int main() {
  int h, n;
  cin >> h >> n;
  vector<int> vec(n);
  rep(i, n) cin >> vec.at(i);
  int a = 0;
  rep(i, n) a += vec.at(i);
  if(h <= a) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 640
s = input()
buf = 0
str_len = len(s)
total = 0

while buf < str_len:
    l_count = 0
    r_count = 0

    while buf < str_len and s[buf] == "<":
        l_count += 1
        buf += 1

    while buf < str_len and s[buf] == ">":
        r_count += 1
        buf += 1

    f = lambda x : x * ( x + 1 ) // 2
    n = max(l_count, r_count)
    total += f(n)
    m = min(l_count, r_count) - 1
    total += f(m)

print(total)


Measured memory_bytes: 4104
if __name__ == '__main__':

	n = int(input())

	S = [0,0,0,0]
	
	for _ in range(n):
		cmd = input()
		if cmd == "AC":
			S[0] += 1
		elif cmd == "TLE":
			S[2] += 1
		elif cmd == "WA":
			S[1] += 1
		else:
			S[3] += 1

	for i in range(4):
		if i == 0:
			print("AC x " + str(S[0]))
		elif i == 1:
			print("WA x " + str(S[1]))
		elif i == 2:
			print("TLE x " + str(S[2]))
		else:
			print("RE x " + str(S[3]))



Measured memory_bytes: 9232
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;
int main(){

  int n;cin>>n;
  string s;cin>>s;


  int ans=0;
  rep(i,0,n-2){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
      ans++;
    }
  }

  out(ans);

  return 0;
}


Measured memory_bytes: 768
#include<stdio.h>
#include<string.h>
int main( ){
  char a[101],b[101];
  scanf("%s %s",a,b);
  if( strlen( a ) < strlen( b ) ) {
    printf("LESS\n");
  }
  else if( strlen( a ) > strlen( b ) ) {
    printf("GREATER\n");
  } else {
    if( strcmp( a, b ) == 0 ){
      printf("EQUAL\n");
    }
    else if( strcmp( a,b ) < 0  ){
      printf("LESS\n");
    }
    else if( strcmp( a,b ) > 0  ){
      printf("GREATER\n");
    }
  }
  return 0;
}

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

int main()
{
    int n, a, sum;

    while( cin >> n )
    {
        if( n == 0 )
            break;

        sum = 0;

        for( int i = 0; i < n * ( n - 1 ) / 2; i++ )
        {
            cin >> a;
            sum += a;
        }
        cout << sum / ( n - 1 ) << endl;
    }
    return 0;
}


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

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

struct node {
  ll v, d;
  node(ll _a, ll _b):v(_a),d(_b){}
  bool operator<(const node &n) const { return d > n.d; }
};
struct edge {
  ll to, d;
  edge(ll _to, ll _d):to(_to),d(_d){}
};
class dijkstra{
public:
  vector<vector<edge>> G;
  vector<ll> dist;
  vector<ll> prev;

  dijkstra(ll s,const vector<vector<edge>> &_G):G(_G){ // sからの最短経路
    dist.resize(G.size(),1ll << 59);
    //prev.resize(G.size(),-1);
  
    priority_queue<node> que;
    que.push(node(s, 0));
    dist[s] = 0;
    
    while(!que.empty()){
      ll v = que.top().v, d = que.top().d;
      que.pop();
      
      rep(i, G[v].size()){
	ll tmp = d + G[v][i].d;
	if(dist[G[v][i].to] > tmp){
	  dist[G[v][i].to] = tmp;
	  //prev[G[v][i].to] = v;
	  que.push(node(G[v][i].to, tmp));
	}
      }
    }
  }

  vector<ll> getpath(ll t){ // tへの最短経路を返す
    vector<ll> path;
    while(t != -1){
      path.push_back(t);
      t = prev[t];
    }
    reverse(path.begin(), path.end());
    return path;
  }
};

int main(){
#define int ll
  int n,m,r; cin >> n >> m >> r;
  vector<vector<edge>> g(n);
  rep(i,m){
    int s,t,d; cin >> s >> t >> d;
    g[s].pb(edge(t,d));
  }
  dijkstra d(r,g);
  rep(i,n){
    if(d.dist[i] == 1ll<<59) cout << "INF\n";
    else cout << d.dist[i] << endl;
  }
}


Measured memory_bytes: 30784
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
# include <climits>
#define ll long long int
#define rep(i,rept) for (ll i = 0; i < rept; i++)
using namespace std;
int ketawa(ll num) {
	int dig, sum = 0;
	while (num) {
		dig = num % 10;
		sum = sum + dig;
		num = num / 10;
	}
	return sum;
}
ll solve(int n, int k)
{
	int memo[110000];
	fill(memo, memo + k, INT_MAX);
	deque<ll> q;
	q.emplace_front(n);
	memo[n] = 0;

	while (!q.empty()) {
		ll cur = q.front(); q.pop_front();
		if (cur%k == 0) {
			return memo[cur] + 1;
		}
		//
		ll next = cur * 10;
		if (memo[next%k] > memo[cur]) {
			q.push_front(next%k);
			memo[next%k] = memo[cur];
		}

		//
		next = cur + 1;

		if (memo[next%k] > memo[cur]+1) {
			q.push_back(next%k);
			memo[next%k] = memo[cur] + 1;
		}
	}
	return -1;
}

int main()
{
	int n;
	cin >> n;
	cout << solve(1, n);
	return 0;
}


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

const int N = 205;
const int INF = (int) 1e9;

int a, b, c;
int n, m, r;
int vis[N];
int dist[N][N];

int main() {
	scanf("%d %d %d", &n, &m, &r);
	for(int i = 0; i < r; ++i) {
		scanf("%d", &vis[i]);
	}
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= n; ++j) {
			if(i != j) dist[i][j] = INF;
		}
	}
	for(int i = 0; i < m; ++i) {
		scanf("%d %d %d", &a, &b, &c);
		dist[a][b] = dist[b][a] = c;
	}

	// O(n^3)
	for(int k = 1; k <= n; ++k) {
		for(int i = 1; i <= n; ++i) {
			for(int j = 1; j <= n; ++j) {
				if(dist[i][k] + dist[k][j] < dist[i][j])
					dist[i][j] =  dist[i][k] + dist[k][j];
			}
		}
	}

	int ans = INT_MAX;
	sort(vis, vis + r);
	
	// O(r!)
	do {
		int cost = 0;
		for(int i = 0; i < r - 1; ++i) {
			cost += dist[vis[i]][vis[i + 1]];
		}
		ans = min(ans, cost);
	} while(next_permutation(vis, vis + r));
	
	printf("%d\n", ans);
}

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

int main() {
    int N; cin >> N;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        if (i % 2 == 0 && a % 2 == 1) ans++;
    }
    cout << ans << endl;
}

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

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

ll H, W, D;
ll A[305][305];
ll Q;
ll L[100005];
ll R[100005];
ll cost[100005];
map<ll, P> mp;

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

	cin >> H >> W >> D;

	for (int i = 0;i < H;i++){
		for (int j = 0;j < W;j++){
			cin >> A[i][j];
			mp[A[i][j]] = P(i,j);
		}
	}

	cin >> Q;

	for (int i = 0;i < Q;i++){
		cin >> L[i] >> R[i];
	}

	for (int i = 1;i <= D;i++){
		ll now = i;
		ll sum = 0;
		while(true){
			cost[now] = sum;
			ll next = now+D;
			if(next > H*W) break;
			sum += abs(mp[now].second - mp[next].second) + abs(mp[now].first - mp[next].first);
			now = next;
		}
	}

	for (int i = 0;i < Q;i++){
		cout << cost[R[i]] - cost[L[i]] << endl;
	}

	return 0;

}


Measured memory_bytes: 9728
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<(n);i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;

int main(){
    int sx,sy,tx,ty;cin>>sx>>sy>>tx>>ty;
	string ans;
	int dx = tx-sx,dy=ty-sy;
	cout<<string(dx,'R')<<string(dy,'U');
	cout<<string(dx,'L')<<string(dy,'D');
	cout<<'D'<<string(dx+1,'R')<<string(dy+1,'U')<<'L';
	cout<<'U'<<string(dx+1,'L')<<string(dy+1,'D')<<'R'<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

#define MAX_V 300

struct edge{int to,cap,rev;};

vector<edge> G[MAX_V];  //??°???????????????
int level[MAX_V];       //?§??????????????????¢
int iter[MAX_V];        //???????????§????????????

// from??????to?????????????????????cap???????????°?????????????????????
void add_edge(int from,int to,int cap){
	G[from].push_back(  (edge){ to  ,cap,(int)G[to  ].size()   }  );
	G[to  ].push_back(  (edge){ from,0  ,(int)G[from].size()-1 }  );
}

// s????????????????????¢???BFS??§?¨??????????
void bfs(int s){
	rep(i,MAX_V)level[i]=-1;
	queue<int> que;
	level[s]=0;
	que.push(s);
	while(!que.empty()){
		int v=que.front();que.pop();
		
		rep(i,G[v].size()){
			edge &e=G[v][i];
			if(e.cap>0 && level[e.to]<0){
				level[e.to]=level[v]+1;
				que.push(e.to);
			}
		}
	}
}

//?¢?????????????DFS??§??¢???
int dfs(int v,int t,int f){
	if(v==t)return f;
	for(int &i=iter[v];i<G[v].size();i++){
		edge &e=G[v][i];
		if(e.cap>0&&level[v]<level[e.to]){
			int d=dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}

// s??????t???????????§???????±???????
int max_flow(int s,int t){
	if(s==t)return INF;
	int flow=0;
	for(;;){
		bfs(s);
		if(level[t]<0)return flow;
		memset(iter,0,sizeof(iter));
		int f;
		while((f=dfs(s,t,INF))>0){
			flow+=f;
		}
	}
}


int main(){
	int n,m;
	cin>>n>>m;
	
	vector<vector<int>> d(n,vector<int>(n,-1));
	
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--,b--;
		d[b][a]=i+1;
		add_edge(a,b,1);
		add_edge(b,a,1);
	}
	
	int s,t;
	cin>>s>>t;
	s--,t--;
	
	vector<edge> Gt[MAX_V];
	rep(i,MAX_V)Gt[i] = G[i];
	
	int res = max_flow(s,t);
	
	set<int> ans;
	rep(i,MAX_V){
		rep(j,G[i].size()){
			if(Gt[i][j].cap==1&&G[i][j].cap==0){
				if(d[i][G[i][j].to]!=-1)ans.insert(d[i][G[i][j].to]);
			}
		}
	}
	
	cout<<res<<endl;
	cout<<ans.size()<<endl;

	for(auto &elm:ans){
		cout<<elm<<endl;
	}
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N;
    cin >> N;
    vector<vector<ll>> G(N);
    vector<ll> c(N);
    ///vector<Pll> v(N);
    ll a,b;
    rep(i,N-1){
        cin >> a >> b;
        G[--a].push_back(--b);
        G[b].push_back(a);
    }
    rep(i,N){
        cin >> c[i];
    }
    sort(c.begin(), c.end(), greater<ll>());
    queue<ll> que;
    que.push(0);
    ll cur = 0;
    vector<ll> memo(N);
    while(!que.empty()){
        ll v = que.front();
        que.pop();
        if(memo[v] != 0) continue;
        memo[v] = c[cur];
        cur++;
        for(auto& u:G[v]){
            que.push(u);
        }
    }
    ll ans = 0;
    rep(i,N-1){
        ans += c[i+1];
    }
    cout << ans << endl;
    PR(memo,N);
}

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

int main(){
  int N;
  cin >> N;
  vector<int> H(N);
  for (int i=0; i<N; i++) {
    cin >> H.at(i);
  }
  if (H.size() == 1) {
    cout << "Yes" << endl;
    return 0;
  }
  for (int i=N-1; i>=1; i--) {
    if (H.at(i-1) - H.at(i) == 1) {
      H.at(i-1)--;
    }
    else if (H.at(i-1) - H.at(i) > 1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

double pi=acos(-1);

int main(){
    double a,b,x;
    cin>>a>>b>>x;
    x/=a;
    
    if(a*b>=2*x){
        double y=2*x/b;
        double ans=atan(b/y);
        ans=ans*180/pi;
        cout<<fixed<<setprecision(10)<<ans<<endl;
    }
    else{
        double y=(2*x-a*b)/a;
        double ans=atan((b-y)/a);
        ans=ans*180/pi;
        cout<<fixed<<setprecision(10)<<ans<<endl;
    }

    
}



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

#define int long long 

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define data asd09123jdf02i3h

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 1e6+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 1e9+7;

int a[maxn],x,n;

signed main() {
    read(n),read(x);
    for(int i=1;i<=n;i++) read(a[i]),a[i]+=a[i-1];
    int ans=1e18;
    for(int k=1;k<=n;k++) {
        int res=0,r=5;
        for(int i=n;i>0;i-=k) {
            res+=r*(a[i]-a[i-k<0?0:i-k]),(i==n?0:r+=2);
            if(res>ans) break;
        }
        ans=min(ans,res+k*x+n*x);
    }
    write(ans);
    return 0;
}


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

int main(){
    int n; cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) cin >> a[i];
    int count = 0, num = 1;
    for(int i = 0; i < n; i++){
        if(a[i] == num) num++;
        else count++;
    }
    if(count == n){
        cout << -1 << endl;
        return 0;
    }
    cout << count << endl;
    return 0;
}

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

typedef complex<double> P;
#define X real()
#define Y imag()

struct Node{
    int l, r;
    double d;
    Node(int l, int r, double d):l(l), r(r), d(d) {};
    bool operator<(const Node &n)const{return d > n.d;};
};

int N;
vector<P> M;

double solve(){
    vector<int> ys;
    for(auto p: M) ys.push_back(p.Y);
    sort(ys.begin(), ys.end());
    ys.erase(unique(ys.begin(), ys.end()), ys.end());
    
    vector<P> M2;
    
    for(int i=0; i<N-1; i++){
        auto p1 = M[i], p2 = M[i+1];
        vector<P> tm;
        bool rev = false;
        
        if(p2.Y != p1.Y){
            if(p1.Y > p2.Y){
                rev = true;
                swap(p1, p2);
            }
            for(auto y: ys){
                if(p1.Y <= y && y <= p2.Y)
                    tm.emplace_back((p2.X-p1.X)*(y-p1.Y)/(p2.Y-p1.Y)+p1.X, y);
            }
        }else{
            tm.emplace_back(p1);
            tm.emplace_back(p2);
        }
        if(rev)
            reverse(tm.begin(), tm.end());
        if(M2.size())
            M2.pop_back();
        M2.insert(M2.end(), tm.begin(), tm.end());
    }
    
    priority_queue<Node> que;
    //vector<vector<int>> done(M2.size(), vector<int>(M2.size()));
    //vector<vector<double>> d(M2.size(), vector<double>(M2.size(), 1e9));
    set<pair<int, int>> done;
    map<pair<int, int>, double> d;
    
    que.push(Node(0, M2.size()-1, 0));
    //d[0][M2.size()-1] = 0;
    d[make_pair(0, M2.size()-1)] = 0;
    
    while(!que.empty()){
        auto v = que.top(); que.pop();
        //if(done[v.l][v.r]++) continue;
        if(done.count(make_pair(v.l, v.r))) continue;
        done.insert(make_pair(v.l, v.r));
        
        if(v.r == v.l)
            return d[make_pair(v.l, v.r)]; //d[v.l][v.r];
        
        for(int nl=v.l-1; nl<=v.l+1; nl++){
            for(int nr=v.r-1; nr<=v.r+1; nr++) if(0<=nl&&nl<M2.size()&&0<=nr&&nr<M2.size() && M2[nl].Y == M2[nr].Y){
                double cost = abs(M2[v.l]-M2[nl]) + abs(M2[v.r]-M2[nr]);
                if(d.count(make_pair(nl, nr))==0 || d[make_pair(v.l, v.r)] + cost < d[make_pair(nl, nr)]){
                    d[make_pair(nl, nr)] = d[make_pair(v.l, v.r)] + cost;
                    que.push(Node(nl, nr, d[make_pair(nl, nr)]));
                }
            }
        }
    }
    return -1;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(16);
    cout.setf(ios::fixed);
    while(cin >> N, N){
        M.resize(N);
        for(int i=0; i<N; i++){
            int x, y; cin >> x >> y;
            M[i] = P(x, y);
        }
        cout << solve() << endl;
    }
    
    return 0;
}

Measured memory_bytes: 6976
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
//#include <unordered_map>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 1000000007
#define x first
#define y second
#define pi acos(-1.0)
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
//#define dprintf(...) 
#define hash _hash
//#define dprintf(...) fprintf(outFile,__VA_ARGS__)
 
#define FOREACH(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define ull unsigned long long
#define ll long long
#define N 110


template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}
 
//FILE* outFile;
 
//inline void add(int &a,int b){a+=b;while(a>=mod)a-=mod;}


int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=ans*(ll)a%mod;
        a=(ll)a*a%mod;b>>=1;
    }
    return ans;
}

int a[N];
int main(){
    //freopen("A.in","r",stdin);
    //freopen("A.out","w",stdout);
    //freopen("1.txt","w",stdout);
    //srand(time(0));
    int T=30,j,k,i,ca=0,n,m;
    scanf("%d%d",&n,&m);
    rep(i,0,m)scanf("%d",&a[i]);
    int x=-1,y=-1;
    rep(i,0,m){
        if(a[i]&1){
            if(x==-1)x=i;else if(y==-1)y=i;else{puts("Impossible");return 0;}
        }
    }
    if(x!=-1)swap(a[0],a[x]);
    if(y!=-1)swap(a[m-1],a[y]);
    vi b;
    int sum=0;
    if(a[0]>1)b.pb(a[0]-1),sum+=a[0]-1;
    rep(i,1,m-1){
        b.pb(a[i]),sum+=a[i];
    }
    b.pb(n-sum);
    rep(i,0,m)printf("%d ",a[i]);puts("");
    printf("%d\n",SZ(b));
    rep(i,0,SZ(b))printf("%d ",b[i]);puts("");
    //cerr<<1.*clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N; cin >> N;
    ll even = 0;
    REP(i, N)
    {
        ll a; cin >> a;
        if(a % 2 == 0) even++;
    }
    if(N == even) cout << "second" << endl;
    else cout << "first" << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        //String[]  C = new String[H];
        for(int i=0;i<H;i++){
            String cur = sc.next();
            System.out.println(cur);
            System.out.println(cur);
        }

    }
}


Measured memory_bytes: 22868
#include<iostream>
#include<string.h>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;

#define inf 0x3f3f3f3f
#define N




int main()
{
	std::ios::sync_with_stdio(false);
	long long n,i,j,k;

    while(cin>>i>>j>>k)
    {
    cout<<k<<" "<<i<<" "<<j<<endl;
    }
	return 0;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
#include<string>
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define ll long long
#define mod (ll)(1e9+7)
#define nax (ll)(1e6 +1)
#define INFL LLONG_MAX
#define INF INT_MAX
#define disp(a,n,arr) for(int i=a;i<(ll)n;i++) cout << arr[i] << " "; cout << "\n";
#define check cout << "Working\n";
#define pi pair<int,int>
#define pl pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vpl vector<pl>
#define vpi vector<pi>
#define vb vector<bool>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;

ll binpow(ll a, ll b) {
	ll x = 1;
	while (b) {
		if (b & 1) x = x * a;
		a = a * a;
		b >>= 1;
	}
	return x;
}

ll mult(ll a, ll b) {
	ll x = 0;
	while (b) {
		if (b & 1) x = (x + a);
		a = (a + a);
		b >>= 1;
	}
	return x;
}



int main() {

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

	// Write your code here

	int t = 1;
	//cin >> t;
	while (t--) {
		char ch;
		cin >> ch;
		if (isupper(ch)) {
			cout << "A\n";
		} else {
			cout << "a\n";
		}
	}


	return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

class Main{
	public static String shiftChar(int num, String str){
    	char[] charr = str.toCharArray();
      int length = charr.length;
      int temp = 0;
      char ch = '0';
      String result = "";
      
      for(int i = 0;i< length; i++){
      	int input = charr[i];
        int value = input + num;
        if(value > 90){
        	temp = value - 90+ 64;
          ch = (char)temp;
          result += ch;
        }else{
        	ch = (char)value;
          result += ch;
        }
      }
      return result;
    }
  public static void main(String[] agrs){
  	Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    String str = sc.next();
    System.out.println(shiftChar(num,str));
  }
}

Measured memory_bytes: 146900
import java.util.*;
public class Main {
	    public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        String[] a = sc.nextLine().split("");
	        for(int i = 0; i < a.length; i++){
	            if(",".equals(a[i])) a[i] = " ";
	            System.out.print(a[i]);
	        }
	    }
}

Measured memory_bytes: 21844
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        StringBuffer str = new StringBuffer(scan.next());
        int q = scan.nextInt();

        for (int i = 0; i < q; i++) {
            String order = scan.next();
            int a = scan.nextInt(), b = scan.nextInt() + 1;
            switch (order) {
                case "replace":
                    String p = scan.next();
                    str = str.replace(a, b, p);
                    break;
                case "reverse":
                    StringBuffer tmpStr = new StringBuffer(str.substring(a, b)).reverse();
                    str = str.replace(a, b, tmpStr.toString());
                    break;
                case "print":
                    System.out.println(str.substring(a, b));
                    break;
            }
        }
    }
}

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

int tax(int n, int t){
  return n * (100 + t) / 100;
}


int main(void){
  while(true){
    int x, y, s;
    cin >> x >> y >> s;
    if(x == 0 && y == 0 && s == 0){ break; }
    
    int ans = 1;
    for(int i = 1; i < s; i++)
      for(int j = 1; j < s; j++){
        if(tax(i, x) + tax(j, x) == s){
          ans = max(ans, tax(i, y) + tax(j, y));
        }
      }

    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3060
program test
implicit none
character(len=100) :: s(100),ans(100)
character :: char
integer(8) :: i,j,h,w,is_bomb(0:100,0:100)=0

read(*,*) h,w
do i=1,h
	read(*,*) s(i)
	do j=1,w
		if(s(i)(j:j) == "#") then
			is_bomb(i,j) = 1
		endif
	enddo
enddo

do i=1,h
	do j=1,w
		if(is_bomb(i,j) == 1)then
			ans(i)(j:j) = "#"
		else
			write(char,'(I0)') sum(is_bomb(i-1:i+1,j-1:j+1))
			ans(i)(j:j) = char
		endif
	enddo
enddo

do i=1,h
	write(*,*) ans(i)(1:w)
enddo

end program

Measured memory_bytes: 256
import java.util.*
import java.math.*
fun main(args: Array<String>) {

    val N = readLine()!!.toInt()
    //val N = readLine()!!.split("").map{it.toInt()}
    val A = readLine()!!.split(" ").map{it.toLong()}
    //val S = readLine()!!

    if (N == 2) {
        println(Math.max(A[0],A[1]))
        return
    }

    fun gcd(a:Long,b:Long) :Long{
        if(b == 0L)
            return a
        return gcd(b, a%b)
    }

    var ans = longArrayOf(0,0)
    ans[0] = gcd(gcd(A[0],A[1]),A[2])
    ans[1] = longArrayOf(gcd(A[0],A[1]),gcd(A[0],A[2]),gcd(A[1],A[2])).max()!!
    for (i in 3 until N) {
        ans[1] = Math.max(gcd(ans[1],A[i]),ans[0])
        ans[0] = gcd(ans[0],A[i])
    }


    println(ans.max());
}


Measured memory_bytes: 57712
#include<bits/stdc++.h>
#define INF 1e9+7
#define ll long long
#define f(x) for(ull i=0;i<x;i++)
#define F first
#define S second
#define N 100005
#define M 1000000007
#define mp make_pair
#define ull unsigned long long
#define sc(n) scanf("%d",&n)
#define gcd __gcd
using namespace std;

int main() {
	ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int m;
    m=n/15;
    cout<<n*800-m*200<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<62)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,m;
    cin>>n>>m;
    
    ll ans=n-m-m;
    puta(ans<0?0:ans);
    
}


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

int main(){
  int N;
  cin >> N;
  vector<int> x(N);
  vector<int> y(N);
  for (int i = 0; i < N; i++){
    cin >> x.at(i);
    cin >> y.at(i);
  }
  int count = 1;
  for (int i = 1; i < N; i++){
    count *= i;
  }
  count *= 2;
  int A = 1;
  for (int i = 1; i <= N; i++){
    A *= i;
  }
  
  double ans = 0.0000000000;
  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      ans += sqrt((x.at(i) - x.at(j)) * (x.at(i) - x.at(j)) + (y.at(i) - y.at(j)) * (y.at(i) - y.at(j)));
    }
  }
  cout << fixed << setprecision(10);
  cout << count * ans / A << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Test1 {

    


    class ClassMain {


        



        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                //int n = int.Parse(line);
                int n = ints[0];
                int k = ints[1];
                if (n == 0) { break; }

                List<int> cards = new List<int>();
                bool zeroExsist = false;
                for (int i = 0; i < k; i++) {
                    int adding  = int.Parse(Console.ReadLine());
                    if(adding==0){zeroExsist=true;}
                    cards.Add(adding);
                }
                cards.Sort();

                if (zeroExsist == false) {
                    int cnt = 0;
                    int max = -1;
                    int prev = -1;
                    foreach (int ele in cards) {
                        if (prev + 1 != ele) { cnt = 1; }
                        else {
                            cnt++;
                            if (max < cnt) { max = cnt; }
                        }
                        prev = ele;
                    }
                    Console.WriteLine(max);
                }
                else {//Zero Exists.
                    int prev = -1;
                    List<int> startend = new List<int>();
                    cards.RemoveAt(0);
                    startend.Add(cards.ElementAt(0));
                    cards.RemoveAt(0);
                    prev = startend.ElementAt(0);

                    foreach (int ele in cards) {
                        if (ele!=prev+1) {
                            startend.Add(prev);
                            startend.Add(ele);                            
                        }
                        prev = ele;
                    }
                    startend.Add(prev);

                    int prevstart = startend.ElementAt(0);
                    int prevEnd = startend.ElementAt(1);
                    int maxLen = prevEnd-prevstart+1;
                    for (int i = 2; i < startend.Count; i+=2) {
                        int prevLen = prevEnd - prevstart + 1;
                        int thisS=startend.ElementAt(i);
                        int thisE = startend.ElementAt(i + 1);
                        int thisLen = thisE - thisS + 1;
                        int renL = 0;
                        if (prevEnd + 2 == thisS) { renL = prevLen + thisLen + 1; }
                        maxLen = Math.Max(maxLen, renL);
                        maxLen = Math.Max(maxLen, thisLen + 1);
                        prevEnd = thisE;
                        prevstart = thisS;
                    }
                    Console.WriteLine(maxLen);
                }

                
            }
        }

        
    }

    

    
}

Measured memory_bytes: 7544
var abc = require('fs').readFileSync('/dev/stdin', 'utf8').split(' ').map(Number);
var a = abc[0];
var b = abc[1];
var c = abc[2];
 
var i;
var result = 0;
for (i = a; i <= b; i++) {
  if (c % i === 0) {
    result++;
  }
}
console.log(result);


Measured memory_bytes: 15400