akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vector<string> S(N);
  vl T(N);
  ll sum = 0;
  REP(i, N) {
    cin >> S[i] >> T[i];
    sum += T[i];
  }
  string X;
  cin >> X;
  ll ans = 0;
  REP(i, N) {
    ans += T[i];
    if (S[i] == X) {
      break;
    }
  }
  cout << sum - ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int N = S.length();
		String zenhan = S.substring(0, (N-1)/2);
		String kouhan = S.substring((N+1)/2);
		String zenhan_r = new StringBuilder(zenhan).reverse().toString();
		String kouhan_r = new StringBuilder(kouhan).reverse().toString();		
		if(zenhan.equals(zenhan_r) && zenhan.equals(kouhan_r) && kouhan.equals(kouhan_r))
			System.out.println("Yes");
		else
			System.out.println("No");

	}

}

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

using namespace std;

const int SIZE_LIMIT = 2e5+5;
int arr[SIZE_LIMIT];

int main() {
  memset(arr, 0, sizeof(arr));

  int n = 0;
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    scanf("%d", arr+i);
  }

  long long ans = 0, maxA = arr[0];
  for (int i = 0; i < n; ++i) {
    if (arr[i] < maxA) {
      ans += maxA - arr[i];
    } else if (arr[i] > maxA) {
      maxA = arr[i];
    }
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 4624
#include <stdio.h>
#include <string.h>


int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	
	if(a == b)printf("Draw\n");
	else
	{
	    if(a == 1)a = 14;
	    if(b == 1)b = 14;
	    if(a > b)printf("Alice\n");
	    else printf("Bob\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i,m,n) for(int i = m - 1; i >= n; i--)
#define ALL(v) v.begin(), v.end()
#define itn int
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
#define println(x) cout << x << endl
#define print(x) cout << x << " "
template<typename T, typename U>
inline bool CMAX(T &m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U>
inline bool CMIN(T &m, U x) { if (m > x) { m = x; return true; } return false; }

typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;
const int MOD = 1e9+7;
vector<int> g;

int root (int x){
    if(g[x] == x) return x;
    else return g[x] = root(g[x]);
}
bool same (int x,int y){
    return g[x] == g[y];
}
void unite(int x,int y){
    x = root(x);
    y = root(y);
    if(x == y) return;
    g[x] = y;
}
int main(){
    int n,m;
    cin >> n >> m;
    int ans = 0;
    g = vector<int>(n);
    vector<pair<int,int>> keiro(m);
    REP(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        keiro[i].first = a;
        keiro[i].second = b;
    } 
    REP(i,m){
        REP(j,n) g[j] = j;
        REP(j,m){
            if(i == j) continue;
            unite(keiro[j].first,keiro[j].second);
        }
        int temp = root(g[0]);
        REP(j,n){
            if(root(j) != temp){ ans++;break;}
        }
    }
    println(ans);
    return 0;
}

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

int INF = 1E+9 + 1;
int N, K;

void dp(int s, const int *H, int *cost) {
    for (int i=1; i<=K; i++) 
        cost[s+i] = min(cost[s+i], cost[s] + abs(H[s] - H[s+i]));
    if (s<=N-2)  dp(s+1, H, cost);
}

int main() {
    cin >> N >> K;
    int H[N + K + 1] = {} , cost[N + K + 1] = {};
    for (int i=0; i<N; i++) scanf("%d", &H[i]), cost[i]=INF;

    cost[0] = 0;
    dp(0, H, cost);

    cout << cost[N-1] << endl;

    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <queue>
#include <vector>
using namespace std;
int main(){
  int N,M;
  long long K;
  cin>>N>>M>>K;
  long long A[200001],B[200001];
  long long sum=0;
  for(int i=0;i<N;i++) cin>>A[i];
  for(int i=0;i<M;i++){
   cin>>B[i];
   sum+=B[i]; 
  }
  int a=-1;
  int b=M-1;
  int answer=0;
  while(a<N){
    if(sum<=K){
      answer=max(answer,a+b+2);
      a++;
      if(a<N) sum+=A[a];
    }
    else{
      if(b>=0){
      sum-=B[b];
      b--;
      }
      else break;
    }
  }
  
  cout<<answer<<endl;
  
  
  
  return 0;
}

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

using namespace std;

int main(int argc, char** argv){
    int N;
    cin >> N;
    vector<int> H(N);
    for (int i=0; i<N; i++) cin >> H[i];

    int base = H[N-1];
    bool flag = true;
    for (int i=N-1; i>=0; i--){
        if (H[i] >= base + 2){
            flag = false;
            break;
        }
        else if (H[i] < base){
            base = H[i];
        }
    }

    if (flag) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N;
    cin >> N;
    ll ans = 1;
    for (ll i = 1; i <= N; i++){
        ans *= i;
        ans = ans % 1000000007;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	FastScanner in;
	PrintWriter out;

	void solve() {
		int n = in.nextInt();
		int k = in.nextInt();

		int[] h = new int[n];
		for (int i = 0; i < h.length; i++) {
			h[i] = in.nextInt();
		}
		Arrays.sort(h);

		int answer = 0;
		for (int i = h.length - 1; i >= 0; i--) {
			if (h[i] >= k) {
				answer++;
			}
		}
		out.println(answer);
	}

	void run() {
		try {
			in = new FastScanner(new File("Main.in"));
			out = new PrintWriter(new File("Main.out"));

			solve();

			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void runIO() {

		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

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

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

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

	public static void main(String[] args) {
		new Main().runIO();
	}
}


Measured memory_bytes: 32400
import math

x1, y1, x2, y2 = map(int, input().split())

s = math.sqrt((x1-x2) ** 2 + (y1-y2) ** 2)
a = math.atan2(y2-y1, x2-x1)

x3 = x2 - math.sin(a) * s
y3 = y2 + math.cos(a) * s

x4 = x1 - math.sin(a) * s
y4 = y1 + math.cos(a) * s

print(round(x3), round(y3), round(x4), round(y4))

Measured memory_bytes: 9396
#include <bits/stdc++.h>
using namespace std;
const double PI  = acos(-1.0);
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 
int main()
{
    int N;
    cin >> N;
    N %= 10;
    if (N == 3){
        cout << "bon";
    } else if (N == 0 || N == 1 || N == 6 || N == 8){
        cout << "pon";
    } else {
        cout << "hon";
    }
    return 0;
}



Measured memory_bytes: 3636
# coding: utf-8
boxes = list(map(int, input().split()))
tmp_a, tmp_b = boxes[1], boxes[0]
boxes[0], boxes[1] = tmp_a, tmp_b
tmp_a, tmp_c = boxes[2], boxes[0]
boxes[0], boxes[2] = tmp_a, tmp_c
print(boxes[0], boxes[1], boxes[2])

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

using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
#define debug(n,v) cout<<#v<<":";for(int i=0;i<n;i++)cout<<v[i]<<" ";cout<<endl; 
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef unsigned short us;
int main(){
    clock_t start=clock();
    int n;
    cin>>n;
    int a[n][n];rep(i,n)rep(j,n) a[i][j]=-1;
    rep(i,n){
        rep(j,n-1){
            cin>>a[i][j];a[i][j]--;
        }
    }
    
    //0~n-1人の試合の進行度
    int index[n]={};
    //1日たって何も進捗が埋めなければ-1出す用の旗
    bool update;
    for(int day=1;day<=n*(n-1)/2;day++){
        update=false;
        set<pair<int,int>> s;
        //今日まだ試合できるか
        bool can[n];
        rep(i,n) can[i]=true;
        vector<pair<int,int>> match;
        for(int i=0;i<n;i++){
            if(index[i]>n-2) continue;
            if(!s.count(make_pair(a[i][index[i]],i))) s.insert(make_pair(i,a[i][index[i]]));
            else{
                match.push_back(make_pair(i,a[i][index[i]]));
                can[i]=false;can[a[i][index[i]]]=false;
                update=true;
            }
        }
        for(auto x:match){
            index[x.first]++;index[x.second]++;
        }
        if(!update){
            puts("-1");return 0;
        }
        //debug(n,index);
        bool f=true;
        rep(i,n){
            if(index[i]!=n-1){f=false;break;}
        }
        if(f){
            cout<<day<<endl;return 0;
        }
        double ttt=(double)(clock()-start)/CLOCKS_PER_SEC;
        if(ttt>1.5){
            cout<<n*(n-1)/2<<endl;return 0;
        }
    }
    cout<<(n*(n-1)/2)<<endl;
    return 0;
}

Measured memory_bytes: 4224
import java.util.*;
public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        //int n = sc.nextInt();
        // int x = sc.nextInt();
        // int a = sc.nextInt();
        // int b = sc.nextInt();
        String s = sc.next();
        String youbi[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};


        int day = 0;
        for(int n=0;n<7;n++){
            if(youbi[n].equals(s)){
                System.out.println(7-n);
            }
        }


    }
}


Measured memory_bytes: 21204
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>

#ifdef _MSC_VER
#pragma warning(disable:4996)
#endif

using namespace std;


int main() {
	int s, w;
	cin >> s >> w;
	cout << ((w >= s) ? "unsafe" : "safe");

	return 0;
}



Measured memory_bytes: 3636
#include<stdio.h>
#define min(a,b) ((a) < (b) ? a : b)
#define max(a,b) ((a) > (b) ? a : b)
main()
{

    int w,h,x,y,r;

    while(scanf("%d %d %d %d %d",&w,&h,&x,&y,&r)!=EOF){

    if((x+r<=w && x-r>=0) && (y+r<=h && y-r>=0))
        printf("Yes\n");
    else
        printf("No\n");
    }

    return 0;




}



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

int main() {
    int N;
    cin >> N;
    vector <int> A(N);
    vector <int> B(N);
    vector <int> C(N-1);
    for (int i=0; i<N; i++) cin >> A.at(i);
    for (int i=0; i<N; i++) cin >> B.at(i);
    for (int i=0; i<N-1; i++) cin >> C.at(i);
    int ans=0;
    for (int i=0; i<N-1; i++) {
        ans+=B.at(A.at(i)-1);
        if (A.at(i+1)-A.at(i)==1) ans+=C.at(A.at(i)-1);
    }
    ans+=B.at(A.at(N-1)-1);
    cout << ans;
}

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

int ctoi(char c){
  if(c == '0') return 0;
  if(c == '1') return 1;
  if(c == '2') return 2;
  if(c == '3') return 3;
  if(c == '4') return 4;
  if(c == '5') return 5;
  if(c == '6') return 6;
  if(c == '7') return 7;
  if(c == '8') return 8;
  if(c == '9') return 9;
}
int zettai(int n){
  if(n < 0)n *= (-1);
  return n;
}
  
 
int main() {
  string S;
  cin >> S;
  int minx = 1000;
  for(int i = 0; i < S.size() - 2; i++){
    int x = ctoi(S.at(i))*100 + ctoi(S.at(i+1))*10 + ctoi(S.at(i + 2));
    //cout << "; " << x << endl;
    if(x < 0) x *= (-1);
    minx = min(zettai(753 - x), minx);
    //cout << minx << endl;
  }
  cout << minx << endl;
}
    
    

Measured memory_bytes: 3620
def main():
    K = int(input())
    ans = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    count = 9
    if K <= count:
        print(ans[K-1])
    else:
        for x in ans:
            mod = x % 10
            base = 10*x + mod

            if mod != 0:
                ans.append(base-1)
                count += 1

            ans.append(base)
            count += 1

            if mod != 9:
                ans.append(base+1)
                count += 1

            if count >= K:
                break
        print(ans[K-1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 13320
#include<bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <string>
#include <vector>
#include <bitset>
#include <functional>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;
typedef long double ldb;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repu(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define repc(i,a,b,c) for(i=a;i<b;i+=c)
#define repcu(i,a,b,c) for(i=a;i<=b;i+=c)
#define repcd(i,a,b,c) for(i=a;i>=b;i-=c)
#define FIN freopen("input.in","r",stdin)
#define FOUT freopen("output.out","w",stdout)
#define CLR(a) memset(a,0,sizeof(a))
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define VI vector<int>
#define VII vector<PII>
#define VLL vector<PLL>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second

template<typename T>inline void gn(T &x){
	x=0;T f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
template<typename T>inline void gt(T x){
	if(!x)return;
	gt(x/10);putchar(x%10+'0');
}

struct TT{
	LL a,b;
}tt,ss;
const LL N=200005;
LL t,n,m,ans;
LL MOD=1e9+7;
LL f[N];

LL qp(LL a){
	LL res=1,b=MOD-2;
	while(b){
		if(b&1)res=res*a%MOD;
		b>>=1;
		a=a*a%MOD;
	}
	return (res+MOD)%MOD;
}

LL C(LL a,LL b){
	return f[a]*qp(f[b]*f[a-b]%MOD)%MOD;
}

int main()
{
	LL i,j,k,l,res=0;
	f[0]=1;
	for(i=1;i<N;i++)f[i]=f[i-1]*i%MOD;
	LL H,W,A,B;
	cin>>H>>W>>A>>B;
	ans=C(H+W-2,W-1);
	for(i=H-A+1;i<=H;i++){
		res+=C(i+B-2,B-1)*C(H-i+1+W-B-2,W-B-1)%MOD;
		res%=MOD;
	}
	ans=(ans-res+MOD)%MOD;
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  long int N, K;
  cin >> N >> K;
  
  while (true) {
  
    if (N < abs(N-K)){
      break;
    }
    
    if(N > K){
      N = N % K;
    } else {
      N = abs(N - K);
    }
  }    
  cout << N << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int n, k;
	vector<int>list;

	cin >> n >> k;

	for (int i = 0; i < n; i++) {
		int num;
		cin >> num;
		list.push_back(num);
	}

	n -= k;
	int cnt = 1;

	cnt += (n / (k - 1));
	if (n % (k - 1) >= 1)cnt++;

	cout << cnt << endl;



	return 0;
}

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

using namespace std;

const int MD = 1000000007;

int main() {
	long long n, k; cin >> n >> k;
	long long x = n - (k - 1) + 1;
	cout << (x * x * n * 3 + x * x * 6 - x * x * k * 6 + x * k * n * 6 - x * n * 3 - x * k * k * 6 + x * k * 12 - x * x * x * 2 + x * 2) / 6 % MD << '\n';
	return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define pii pair<int, int> 
#define mod 998244353
ll power(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b%2!=0) res=(res*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return res;
}
ll ncr(ll n,ll k){
    if(k==0||k==n) return 1ll;
    if(k>n-k) k=n-k;
    ll pro=1;
    for(ll i=0;i<k;i++){
        pro=(pro*(n-i))%mod;
        pro/=(i+1);
    }
    return (pro%mod);
}
vector<int> prime;
void seive(){
    vector<bool > isprime(2001,true);
    for(int i=2;i*i<=2000;i++){
        if(isprime[i]){
            for(int j=i*i;j<=2000;j+=i){
                isprime[j]=false;
            }
        }
    }
    for(int i=2;i<=2000;i++){
        if(isprime[i]) prime.push_back(i);
    }
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string str;
    cin>>str;
    if(str=="Sunny") cout<<"Cloudy";
    else if(str=="Cloudy") cout<<"Rainy";
    else cout<<"Sunny";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vll a(n);
    for (ll i = 0; i < n; i++) cin >> a[i];
    ll ans = 0;

    for (ll i = 0; i < n; i++) {
        if (a[i] == 0) continue;
        if (i == 0) {
            ans += a[i] / 2;
            a[i] -= a[i] / 2 * 2;
        } else {
            a[i] += a[i - 1];
            ans += a[i] / 2;
            a[i] -= a[i] / 2 * 2;
        }
    }
    // DEBUG_VLL(a)
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a;
    cin >> a;
    cout << a + a*a + a*a*a;

    return 0;
}

Measured memory_bytes: 3648
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Sat Jul 13 12:57:12 2019
//
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	arr := make([]int, n)

	s := 0
	for i := range arr {
		fmt.Scan(&arr[i])
		s += arr[i]
	}

	ans := []int{}
	sum := 0
	for i := 1; i < len(arr); i += 2 {
		sum += arr[i]
	}
	ans = append(ans, s-2*sum)

	for i := 1; i < len(arr); i++ {
		ans = append(ans, 2*arr[i-1]-ans[i-1])
	}

	for i := range ans {
		if i != 0 {
			fmt.Print(" ")
		}
		fmt.Print(ans[i])
	}
	fmt.Println()
}


Measured memory_bytes: 9728
n = int(input())
a = list(map(int, input().split()))
s = [0] * (n + 1)
c, d = 0, 0
for i in range(n):
    s[i + 1] = s[i] + a[i]
    if i % 2 == 0:
        if s[i + 1] == 0:
            c += 1
            s[i + 1] = 1
        elif s[i + 1] < 0:
            c += -s[i + 1] + 1
            s[i + 1] = 1
    else:
        if s[i + 1] == 0:
            c += 1
            s[i + 1] = -1
        elif s[i + 1] > 0:
            c += s[i + 1] + 1
            s[i + 1] = -1

for i in range(n):
    s[i + 1] = s[i] + a[i]
    if i % 2 != 0:
        if s[i + 1] == 0:
            d += 1
            s[i + 1] = 1
        elif s[i + 1] < 0:
            d += -s[i + 1] + 1
            s[i + 1] = 1
    else:
        if s[i + 1] == 0:
            d += 1
            s[i + 1] = -1
        elif s[i + 1] > 0:
            d += s[i + 1] + 1
            s[i + 1] = -1
print(min(c, d))


Measured memory_bytes: 14332
#include <iostream>
#include <algorithm>
#include <vector>
template <typename Base>
class SparseTable
{
public:
    using T = typename Base::T;
    using SemiLattice = Base;
    template <typename InIt>
    SparseTable(const InIt first, const InIt last) : size(std::distance(first, last)), lg2(size + 1, 0)
    {
        std::vector<T> val{first, last};
        for (std::size_t i = 2; i <= size; i++) { lg2[i] = lg2[i / 2] + 1; }
        table.resize(size, std::vector<T>(lg2[size] + 1));
        for (std::size_t i = 0; i < size; i++) { table[i][0] = val[i]; }
        for (std::size_t j = 0; j < lg2[size]; j++) {
            for (std::size_t i = 0, w = 1 << j; i <= size - (w << 1); i++) { table[i][j + 1] = op(table[i][j], table[i + w][j]); }
        }
    }
    T accumulate(const std::size_t l, const std::size_t r) const
    {
        const std::size_t j = lg2[r - l];
        return op(table[l][j], table[r - (1 << j)][j]);
    }

private:
    const std::size_t size;
    std::vector<std::size_t> lg2;
    std::vector<std::vector<T>> table;
    const SemiLattice op{};
};
int main()
{
    int N, A, B;
    std::cin >> N >> A >> B;
    std::cout << std::min(A, B) << " " << std::max(0, A + B - N) << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int n,x;
    cin >> n >> x;
    vector<int> l(n),sl(n+1);
    sl[0] = 0;
    int res = 1;
    REP(i,n){
        cin >> l[i];
        sl[i+1] = sl[i]+l[i];
        if(sl[i+1]<=x){
            res++;
        }
    }
    put(res);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100000+5
#define MOD 998244353
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
template<class T> inline void read(T &x){
    x=0; 
    T f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-'){
            f=-1;
        }
        ch=getchar();
    }
    while(ch<='9' && ch>='0'){
        x=x*10+(ch-'0');
        ch=getchar();
    }
    x*=f;
}
int ans=0;
int main(){
    int d,l,r;
    cin>>l>>r>>d;
    for(int i=l;i<=r;i++)
    {
        if(i%d==0)
        {
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct node{
  struct node *next, *prev;
  int key;
}node;
void insert(int);
void delete(node*);
void deleteFirst(void);
void deleteLast(void);
node* finder(int);
void print(void);
node *head;
int main(){
  int n, i, key;
  char func[11];
  scanf("%d",&n);
  head = (node *)malloc(sizeof(node));
  head->next = head->prev = head;
  for(i=0; i<n; i++){
    scanf("%s%d",func,&key);
    if(func[0] == 'i') insert(key);
    else if(func[0] == 'd'){
      if(func[6] == 'F') deleteFirst();
      else if(func[6] == 'L') deleteLast();
      else delete(finder(key));
    }
  }
  print();
  return 0;
}
void insert(int key){
  node *n = (node *)malloc(sizeof(node));
  n->key = key;
  n->next = head->next;
  head->next->prev = n;
  head->next = n;
  n->prev = head;
}
void delete(node *del){
  if(del == head) return;
  del->prev->next = del->next;
  del->next->prev = del->prev;
  free(del);
}
void deleteFirst(void){
  delete(head->next);
}
void deleteLast(void){
  delete(head->prev);
}
node* finder(int key){
  node *n;
  for(n=head->next; n != head && n->key != key; n=n->next);
  return n;
}
void print(void){
  node *n;
  for(n=head->next; n!=head; n=n->next){
    printf("%d",n->key);
    if(n != head->prev) printf(" ");
  }
  printf("\n");
}

Measured memory_bytes: 31656
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextssort(n,a){return a?cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>b-a):cin.slice(cid,cid+=n).map(a=>+a).sort((a,b)=>a-b);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}
var streams=[];function print(s){streams.push(s);}

var def;
function segTree(n){
  var x = 2; n--;
  while(n)n >>= 1, x <<= 1;
  this.seg = Array(x-1).fill(def);
  this.l = x >> 1;
}
segTree.prototype={
  get:function(x){
    var v = this.seg;
    x += this.l-1;
    var r = def;
    while(x >= 0){
      if(v[x] < r)r = v[x];
      x = x-1>>1;
    }
    return r;
  },
  update:function(l,r,t){//[l,r)
    if(l >= r)return;
    var self = this;
    q(l,r,0,this.l,0);
    function q(l,r,x,y,i){
      if(l === x && r === y){self.seg[i] = Math.min(self.seg[i],t);return;}
      var m = x+y >> 1;
      if(m < r)if(l < m){q(l,m,x,m,i+i+1);q(m,r,m,y,i+1<<1);}
      else q(l,r,m,y,i+1<<1);
      else q(l,r,x,m,i+i+1);
    }
  },
}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));
if(streams.length)console.log(streams.join("\n"));

function main(){
  var [n,q] = nexts(2);
  def = n;
  var ans = (n-2) * (n-2);
  var segy = new segTree(n+1);
  var segx = new segTree(n+1);
  for(var i = 0; i < q; i++){
    var [t,u] = nexts(2);
    if(t === 1){
      var z = segx.get(u);
      ans -= z-2;
      segy.update(1,z,u);
    }else{
      var z = segy.get(u);
      ans -= z-2;
      segx.update(1,z,u);
    }
  }
  return ans;
}

Measured memory_bytes: 90388
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        k: i32,
        a: i32,
        b: i32
    }

    let ans = if (a..=b).filter(|x| x % k == 0).count() >= 1 {
        "OK"
    } else {
        "NG"
    };

    println!("{}", ans);
}


Measured memory_bytes: 2136
//AtCoder ABC046 B - AtCoDeerくんとボール色塗り / Painting Balls with AtCoDeer
#include <bits/stdc++.h>
using namespace std;
using lli=int64_t;

int main() {
    lli N,K;
    cin>>N>>K;
    lli ans=1;
    for(int i=1;i<=N;++i){
        ans*=(i==1?K:K-1);
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;
using ll = long long;

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

  int h, w, k;
  cin >> h >> w >> k;
  vector<vector<char>> v(h, vector<char>(w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> v[i][j];
    }
  }

  int ans = 0;
  for (int b1 = 0; b1 < (1 << h); b1++) {
    for (int b2 = 0; b2 < (1 << w); b2++) {
      int sum = 0;
      for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
          if (v[i][j] == '#' && (!(b1 & (1 << i)) && !(b2 & (1 << j)))) {
            sum++;
          }
        }
      }
      if (sum == k) {
        ans++;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

vector<ll> rG[101010];
vector<ll> dp(101010, -1);
vector<ll> par(101010);

ll rec(ll now, ll r){
	if(dp[now]>0) return dp[now];
	if(now == r){
		dp[now] = 0;
		return 0;
	}
	ll res = -1;
	REP(j, rG[now].size()){
		ll tmp = rec(rG[now][j], r)+1;
		if(tmp>res){
			res = tmp;
			par[now] = rG[now][j];
		}
	}
	dp[now] = res;
	return res;
}


int main(){
	ll N, M;
	cin >> N >> M;
	REP(i, N+M-1){
		ll A, B;
		cin >> A >> B;
		A--;B--;
		rG[B].push_back(A);
	}

	ll r;
	REP(i, N){
		if(rG[i].size()==0) r = i;
	}

	REP(i, N) rec(i, r);
	
	REP(i, N){
		if(i==r){
			cout << 0 << endl;
		}else{
			cout << par[i]+1 << endl;
		}
	}
    return 0;
}

Measured memory_bytes: 11904
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC145B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();
            var flag = true;

            if (N%2 == 0)
            {
                var T1 = S.Substring(0,N / 2);
                var T2 = S.Substring(N / 2, N / 2);
                flag = (T1 == T2 ? true : false);
            }
            else
            {
                flag = false;
            }

            Console.WriteLine(flag ? "Yes" : "No");
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 0;
int n, k;
int main(){
	IOS
	cin >> n >> k;
	int vis[n+5]={0};
	while(k--){
		int x;
		cin >> x;
		while(x--){
			int a;
			cin >> a;
			vis[a]++;
		}
	}
	int jumlah=0;
	for(int i=1;i<=n;i++){
		if(!vis[i]){
			jumlah++;
		}
	}
	cout << jumlah << '\n';
}

Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<cstdlib>
#include<cstdio>
//#include<cmath>
#define MAX 50000
using namespace std;
int c[21][MAX+10];
int coin[MAX];

int main()
{
    int n,m,sum=0;
    cin>>n>>m;
    int i,w;
    for(i=0;i<m;i++)
    {
        cin>>coin[i];
    }
    sort(coin,coin+m);


    for(i=0;i<=m;i++)
    {
        c[i][1]=1;
        c[i][0]=0;
    }
    for(w=1;w<=n;w++)
    {
        c[1][w]=w/coin[0];
       //c[0][w]=0;
    }

    for(i = 2; i <= m; i++)
    {
        for(w = 2; w <= n; w++)
        {
            if(w < coin[i-1])
            {
                c[i][w] = c[i - 1][w];
            }
            else
            {
                int x = c[i-1][w];
                int y = c[i][w - coin[i-1]] + 1;
                c[i][w]=x>y?y:x;
                
            }
        }
    }
	cout<<c[m][n]<<endl;
    return 0;
}






Measured memory_bytes: 7092
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    int n, a[112345];

    int cnt = 0;

    cin >> n;
    REP(i, n)
    {
        cin >> a[i];
        if (a[i] % 2)
            cnt++;
    }

    cout << (cnt % 2 ? "NO" : "YES") << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define rep(x, a, b) for(int x = (a); x <= (b); ++x)
#define rop(x, a, b) for(int x = (a); x < (b); ++x)
#define per(x, a, b) for(int x = (a); x >= (b); --x)
using namespace std;
typedef long long LL;
typedef double DB;
int n, a[100005], wz[100005];
int main() {
	scanf("%d", &n);
	rep(i, 1, n) scanf("%d", &a[i]), wz[a[i]] = i;
	rep(i, 1, n) printf("%d ", i * n);
	puts("");
	rep(i, 1, n) printf("%d ", (n - i + 1) * n + wz[i] - 1);
	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for (int i=0; i < (n); i++)
using namespace std;
//using namespace atcoder;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int MOD = 1000000007;
const double pi = 3.141592653589;

int main() {
    int n;
    cin >> n;
    ll a[n];
    rep(i,n)cin >> a[i];
    ll ans = 0;
    for(int i = 0;i<n-1;i++){
        for (int j=i+1;j<n;j++){
            ans = max(ans, abs(a[i]-a[j]));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <set>

using namespace std;

int main() {

    int N, L, a[1000000];

    cin >> N >> L;

    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    //solve
    multiset<int> ms;

    for (int i = 0; i < L; i++) {
        ms.insert(a[i]);
    }

    cout << *ms.begin();

    for (int i = L; i < N; i++) {
        ms.erase(ms.find(a[i - L]));
        ms.insert(a[i]);
        cout << ' ' << *ms.begin();
    }

    cout << endl;
}


Measured memory_bytes: 11640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define strall(v) (v).cbegin(),(v).cend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

vector<bool> a(105,false);

int main(){
 int a,b,cnt=0;
 cin >> a >> b;
 for(int i=1;i<=a;i++) for(int j=1;j<=12;j++){ 
   if(i == a) if(j > b) break;
   if(i == j) cnt++;
 }
 cout << cnt << endl;  
}

Measured memory_bytes: 256
# import math
# import statistics
# import itertools
# a=int(input())
# b=input()
# c=[]
# for i in a:
#     c.append(int(i))
N,K= map(int,input().split())
# f = list(map(int,input().split()))
# g = [int(input()) for _ in range(N)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen

if N%K==0:
    print(0)
else:
    et=N//K
    a1=et*K
    a2=(et+1)*K
    mi = min(abs(a1-N),abs(a2-N))
    print(mi)

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

int main(void){
    
    float distance=0, angle = 0;
    float position = 90;
    float y = 0, x = 0; 
    float rad;
    
    while(1)
    {
        scanf("%f,%f", &distance, &angle);

        if(distance == 0 && angle == 0)
        {
            break;
        }
        
        rad = M_PI*(position/180);
        
        x += distance*cos(rad);
        y += distance*sin(rad);
        
        position -= angle;
        
    }
    
    
    printf("%d\n%d\n", (int)x,(int)y);
    
    return 0;
}


Measured memory_bytes: 2740
'use strict'
function main(input) {
  input = Number(input.trim())
  const sum = n => n.split('').reduce((p, c) => Number(p) + Number(c), 0)
  let ans = 0
  for (let i = 1; i < input; i++) {
    let j = input - i
    let c = sum(String(i)+String(j))
    if (!ans || ans > c) ans = c
  }
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 15128
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
using namespace std;
#define lli                                 long long int
#define lb                                  long double
#define pi                                  acos(-1)
#define FindDistance(ax,ay,bx,by)           sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by))
#define gcd(a,b)                            __gcd(a,b)
#define lcm(a,b)                           (a/gcd(a,b))*b
#define T                                  int t;cin>>t;for(int tt=1;tt<=t;tt++)
#define all(v)                             v.begin(),v.end()
#define pb                                 push_back
#define inf                                999999999999999
#define mod                                1000000007
#define maxn                               100003
#define FastIO                             ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int main()
{
    FastIO;
    lli n,mon,i,x,ans=0;
    vector<lli>a,b;
    cin>>n;
    for(i=0;i<n+1;i++)
    {
        cin>>x;
        a.pb(x);
    }
    for(i=0;i<n;i++)
    {
        cin>>x;
        b.pb(x);
    }
//    for(i=0;i<n-1;i++)
//    {
//        cin>>x;
//        c.pb(x);
//    }
    for(i=0;i<n;i++)
    {
        mon=min(a[i],b[i]);
        ans+=mon;
        b[i]-=mon;
        a[i]-=mon;
        mon=min(a[i+1],b[i]);
        ans+=mon;
        b[i]-=mon;
        a[i+1]-=mon;

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

}


Measured memory_bytes: 5576
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    if (a1+a2+a3 >= 22){
        cout << "bust" << endl;
    }
    else{
        cout << "win" << endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
  
using namespace std;
  
int main(void){
  
    int n;
    string bun;
    char inp;
  
    cin>>n;
    getchar();
    for(int i=0;i<n;i++){
        bun=("");
       while(1){
           inp=getchar();
           if(inp=='\n') break;
           bun+=inp;
       }
       for(int cnt=6;cnt<=bun.length()-1;cnt++){
           if(bun[cnt]=='o'&&bun[cnt-1]=='n'&&bun[cnt-2]=='i'&&bun[cnt-3]=='h'&&bun[cnt-4]=='s'&&bun[cnt-5]=='o'&&bun[cnt-6]=='H') bun[cnt]='a';
       }
       cout<<bun<<endl;
    }
  
    return 0;
}

Measured memory_bytes: 1196
N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [False]*N
path = [0]
at = 0
loop = 0
visited[0]=True
for i in range(N):
    at = A[at]-1
    if visited[at]:
        loop = i+1-path.index(at)
        break
    else:
        visited[at]=True
        path.append(at)
if K < len(path):
    print(path[K]+1)
else:
    print(path[(K-path.index(at))%loop+path.index(at)]+1)

Measured memory_bytes: 32292
/*
 * Getting Started - Maximum Profit
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_D&lang=jp
 */
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int n;
    cin >> n;
    int maxv = -1000000000;
    int minv;
    cin >> minv;
    for (int i = 1; i < n; i++) {
        int v;
        cin >> v;
        maxv = max(maxv, v - minv);
        minv = min(minv, v);
    }
    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=2147483647;
const ll LLMAX=9223372036854775807;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll A,B,M;
    cin>>A>>B>>M;
    vll a(A),b(B);
    for(ll i=0;i<A;i++)cin>>a[i];
    for(ll i=0;i<B;i++)cin>>b[i];
    vll x(M),y(M),c(M);
    for(ll i=0;i<M;i++){
        cin>>x[i]>>y[i]>>c[i];
        x[i]--;y[i]--;
    }
    
    ll ans=LLMAX;
    for(ll i=0;i<M;i++){
        chmin(ans,a[x[i]]+b[y[i]]-c[i]);
    }
    sort(ALL(a));
    sort(ALL(b));
    chmin(ans,a[0]+b[0]);
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 4224
k = int(input())
cnt = 1
ans = 7
mul = 70 % k
ans %= k
flags = [False] * k
flags[ans] = True
while ans != 0:
    ans += mul
    cnt += 1
    ans %= k
    mul *= 10
    mul %= k
    if flags[ans]:
        cnt = -1
        break
    flags[ans] = True

print(cnt)


Measured memory_bytes: 16712
#include<stdio.h>
#include<string.h>
int main()
{
	char S[123],s[123];
	int i,p;
	for(;gets(S),S[0]!='.';)
	{
		for(i=p=0;S[i];i++)
		{
			if(S[i]=='('||S[i]=='[')
				s[p++]=S[i];
			else if(S[i]==')'||S[i]==']')
			{
				if(p!=0&&(s[p-1]==S[i]-1||s[p-1]==S[i]-2))
					p--;
				else
					break;
			}
		}
		puts(p||i!=strlen(S)?"no":"yes");
	}
	return 0;
}

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

using namespace std;

int main()
{
    int N,a;
    long long sum[200001];
    sum[0] = 0;
    long long min_num = 2 * pow(10, 9.0);

    cin >> N;

    for (int i = 1; i <= N; i++) {
        cin >> a;
        sum[i] = sum[i - 1] + a;
    }
    
    for ( int i = 1; i < N; i++) {
        min_num = min(min_num, abs(sum[N] - (2 * sum[i])));
    }
    cout << min_num << '\n';

}

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

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

		if( n == 0 && m == 0 ) {
			break;
		}

		vector<int> p( n );
		for( int i = 0; i < m; ++i ) {
			for( int j = 0; j < n; ++j ) {
				int x;
				cin >> x;

				p.at( j ) += x;
			}
		}

		int result = 0;
		for( auto v: p ) {
			result = max( result, v );
		}

		cout << result << endl;
	}
}



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

#define INF 1LL << 60
#define pb push_back
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, b, e) for (int i = (b); i <= (e); i++)

int A, B, T;

int main() {
    cin >> A >> B >> T;

    cout << (T / A) * B << endl;

    return 0;
}


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

#define debug(x) (cerr << #x << " = " << x << endl;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define FOR(it, b, e) for (typeof(b) it = (b); it != (e); ++it)
#define MSET(c, v) memset(c, v, sizeof(c)

const int INF = 0x3F3F3F3F; 
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const double EPS = 1e-10;

inline int cmp(double x, double y = 0) 
{  
  if(fabs(x - y) < EPS)
    return 0;
  return x > y ? 1 : -1;
}

const int maxn = 101;

int x[maxn];

map<string,int>mapa;

int main()
{
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  set<int>s;
  for(int i = 0 ; i < n ; i++)
  {
    int a;
    cin >> a;
    s.insert(a);
  }

  cout << (s.size() == n ? "YES" : "NO") << endl;

  return 0;
}

Measured memory_bytes: 9600